This commit is contained in:
insanity 2017-06-25 17:16:55 +09:00
commit ed9c3155ed
8 changed files with 267 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public class MetaProbeArchitecture {
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = false)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() {
return createDate;
}

View File

@ -33,7 +33,7 @@ public class MetaProbeOs {
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = true)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() {
return createDate;
}

View File

@ -56,7 +56,7 @@ public class MetaProbePackage {
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = false)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() {
return createDate;
}

View File

@ -34,7 +34,7 @@ public class MetaProbeVersion {
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = true)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() {
return createDate;
}

View File

@ -0,0 +1,50 @@
package com.loafle.overflow.meta.dao;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.meta.model.MetaProbeArchitecture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 25.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MetaProbeArchitectureDAOTest {
@Autowired
private MetaProbeArchitectureDAO metaProbeArchitectureDAO;
@Test
public void Create() {
MetaProbeArchitecture ax8632 = new MetaProbeArchitecture();
ax8632.setArchitecture("x86-32bit");
MetaProbeArchitecture ax8664 = new MetaProbeArchitecture();
ax8632.setArchitecture("x86-64bit");
List<MetaProbeArchitecture> list = new ArrayList<>();
list.add(ax8632);
list.add(ax8664);
for(int indexI =1; indexI<= list.size(); ++indexI) {
MetaProbeArchitecture architecture = list.get(indexI-1);
architecture.setId((short)indexI);
this.metaProbeArchitectureDAO.save(architecture);
}
}
}

View File

@ -0,0 +1,62 @@
package com.loafle.overflow.meta.dao;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.meta.model.MetaProbeOs;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 25.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MetaProbeOsDAOTest {
@Autowired
private MetaProbeOsDAO metaProbeOsDAO;
@Test
public void Create() {
MetaProbeOs metaWindows = new MetaProbeOs();
metaWindows.setName("Windows");
MetaProbeOs metaDebian = new MetaProbeOs();
metaDebian.setName("Debian");
MetaProbeOs metaUbuntu = new MetaProbeOs();
metaUbuntu.setName("Ubuntu");
MetaProbeOs metaFedora = new MetaProbeOs();
metaFedora.setName("Fedora");
List<MetaProbeOs> probeOs = new ArrayList<>();
probeOs.add(metaWindows);
probeOs.add(metaDebian);
probeOs.add(metaUbuntu);
probeOs.add(metaFedora);
for (int indexIO = 1; indexIO <= probeOs.size(); ++indexIO) {
MetaProbeOs os = probeOs.get(indexIO -1);
os.setId((short)indexIO);
this.metaProbeOsDAO.save(os);
}
}
}

View File

@ -0,0 +1,97 @@
package com.loafle.overflow.meta.dao;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.meta.model.MetaProbeArchitecture;
import com.loafle.overflow.meta.model.MetaProbeOs;
import com.loafle.overflow.meta.model.MetaProbePackage;
import com.loafle.overflow.meta.model.MetaProbeVersion;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 25.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MetaProbePackageDAOTest {
@Autowired
private MetaProbePackageDAO metaProbePackageDAO;
@Test
public void create()
{
MetaProbeArchitecture ax8632 = new MetaProbeArchitecture();
ax8632.setId((short)1);
MetaProbeArchitecture ax8664 = new MetaProbeArchitecture();
ax8664.setId((short)2);
List<MetaProbeArchitecture> archilist = new ArrayList<>();
archilist.add(ax8632);
archilist.add(ax8664);
MetaProbeOs metaWindows = new MetaProbeOs();
metaWindows.setId((short)1);
MetaProbeOs metaDebian = new MetaProbeOs();
metaDebian.setId((short)2);
MetaProbeOs metaUbuntu = new MetaProbeOs();
metaUbuntu.setId((short)3);
MetaProbeOs metaFedora = new MetaProbeOs();
metaFedora.setId((short)4);
List<MetaProbeOs> probeOs = new ArrayList<>();
probeOs.add(metaWindows);
probeOs.add(metaDebian);
probeOs.add(metaUbuntu);
probeOs.add(metaFedora);
MetaProbeVersion version100 = new MetaProbeVersion();
version100.setId((short)1);
MetaProbeVersion version110 = new MetaProbeVersion();
version110.setId((short)2);
List<MetaProbeVersion> versionlist = new ArrayList<>();
versionlist.add(version100);
versionlist.add(version110);
for(MetaProbeVersion version : versionlist) {
for(MetaProbeArchitecture architecture : archilist) {
for(MetaProbeOs os : probeOs) {
MetaProbePackage aPackage = new MetaProbePackage();
aPackage.setOs(os);
aPackage.setArchitecture(architecture);
aPackage.setVersion(version);
this.metaProbePackageDAO.save(aPackage);
}
}
}
}
}

View File

@ -0,0 +1,54 @@
package com.loafle.overflow.meta.dao;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.meta.model.MetaProbeVersion;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 25.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MetaProbeVersionDAOTest {
@Autowired
private MetaProbeVersionDAO metaProbeVersionDAO;
@Test
public void Create() {
MetaProbeVersion version100 = new MetaProbeVersion();
version100.setVersion("1.0.0");
MetaProbeVersion version110 = new MetaProbeVersion();
version110.setVersion("1.1.0");
List<MetaProbeVersion> list = new ArrayList<>();
list.add(version100);
list.add(version110);
for(int indexI = 1; indexI <= list.size() ;++indexI) {
MetaProbeVersion version = list.get(indexI - 1);
version.setId((short)indexI);
this.metaProbeVersionDAO.save(version);
}
}
}