init sql
This commit is contained in:
parent
d205de4546
commit
39f4ac1b6f
|
@ -201,3 +201,9 @@ INSERT INTO public.noauth_probe (id,api_key,create_date,host_name,ip_address,mac
|
|||
|
||||
INSERT INTO public.probe (id,create_date,description,encryption_key,last_polling_date,next_polling_date,probe_key,status,domain_id) VALUES (
|
||||
1,'2017-06-26 11:43:25.155','snoop probe','9c8d41ab57de11e7a2c9080027658d13',NULL,NULL,'a1e1710557de11e78799080027658d13','I',1);
|
||||
|
||||
INSERT INTO public.infra_machine (id,create_date,meta,probe_id) VALUES (
|
||||
0,'2017-06-26 12:12:11.698',NULL,1);
|
||||
|
||||
INSERT INTO public.infra (id,child_id,create_date,type_id) VALUES (
|
||||
1,0,'2017-06-26 12:12:11.809',1);
|
|
@ -1,66 +0,0 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaCrawler;
|
||||
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 MetaCrawlerDAOTest {
|
||||
|
||||
@Autowired
|
||||
private MetaCrawlerDAO metaCrawlerDAO;
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void Create() {
|
||||
|
||||
List<MetaCrawler> metaCrawlerList = new ArrayList<>();
|
||||
|
||||
MetaCrawler crawMWI = new MetaCrawler();
|
||||
crawMWI.setName("WMI_CRAWLER");
|
||||
crawMWI.setDescription("WMI");
|
||||
|
||||
MetaCrawler crawlerSNMPV2 = new MetaCrawler();
|
||||
crawlerSNMPV2.setName("SNMP_V2_CRAWLER");
|
||||
crawlerSNMPV2.setDescription("SNMPV2");
|
||||
|
||||
MetaCrawler crawlerSNMPV3 = new MetaCrawler();
|
||||
crawlerSNMPV3.setName("SNMP_V3_CRAWLER");
|
||||
crawlerSNMPV3.setDescription("SNMPV3");
|
||||
|
||||
MetaCrawler crawlerMySQL = new MetaCrawler();
|
||||
crawlerMySQL.setName("MYSQL_CRAWLER");
|
||||
crawlerMySQL.setDescription("MYSQL");
|
||||
|
||||
metaCrawlerList.add(crawMWI);
|
||||
metaCrawlerList.add(crawlerSNMPV2);
|
||||
metaCrawlerList.add(crawlerSNMPV3);
|
||||
metaCrawlerList.add(crawlerMySQL);
|
||||
|
||||
|
||||
|
||||
for(int indexI = 0 ; indexI< metaCrawlerList.size();++indexI) {
|
||||
MetaCrawler crawler = metaCrawlerList.get(indexI);
|
||||
crawler.setId((short)(indexI + 1));
|
||||
this.metaCrawlerDAO.save(crawler);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaCrawler;
|
||||
import com.loafle.overflow.meta.model.MetaCrawlerInputItem;
|
||||
import com.loafle.overflow.meta.model.MetaInputType;
|
||||
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 static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 25.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class MetaCrawlerInputItemDAOTest {
|
||||
|
||||
@Autowired
|
||||
private MetaCrawlerInputItemDAO metaCrawlerInputItemDAO;
|
||||
|
||||
@Test
|
||||
public void craete() {
|
||||
|
||||
MetaInputType typeText = new MetaInputType();
|
||||
typeText.setId((short)1);
|
||||
|
||||
MetaInputType typePW = new MetaInputType();
|
||||
typePW.setId((short)2);
|
||||
|
||||
|
||||
int ID = 0;
|
||||
//WMI
|
||||
{
|
||||
MetaCrawler crawlerWMI = new MetaCrawler();
|
||||
crawlerWMI.setId((short)1);
|
||||
|
||||
MetaCrawlerInputItem itemID = new MetaCrawlerInputItem();
|
||||
itemID.setId(++ID);
|
||||
itemID.setMetaInputType(typeText);
|
||||
itemID.setMetaCrawler(crawlerWMI);
|
||||
itemID.setRequired(true);
|
||||
itemID.setDescription("Windows Account ID");
|
||||
itemID.setPattern("");
|
||||
itemID.setName("ID");
|
||||
itemID.setDefaultValue("Loafle");
|
||||
|
||||
MetaCrawlerInputItem itemPW = new MetaCrawlerInputItem();
|
||||
itemPW.setId(++ID);
|
||||
itemPW.setMetaInputType(typePW);
|
||||
itemPW.setMetaCrawler(crawlerWMI);
|
||||
itemPW.setRequired(true);
|
||||
itemPW.setDescription("Windows Account PW");
|
||||
itemPW.setPattern("");
|
||||
itemPW.setName("PassWord");
|
||||
itemPW.setDefaultValue("");
|
||||
|
||||
this.metaCrawlerInputItemDAO.save(itemID);
|
||||
this.metaCrawlerInputItemDAO.save(itemPW);
|
||||
}
|
||||
|
||||
|
||||
//SNMP V2
|
||||
{
|
||||
MetaCrawler crawlerSNMPV2 = new MetaCrawler();
|
||||
crawlerSNMPV2.setId((short)2);
|
||||
|
||||
MetaCrawlerInputItem itemCommunity = new MetaCrawlerInputItem();
|
||||
itemCommunity.setId(++ID);
|
||||
itemCommunity.setMetaInputType(typeText);
|
||||
itemCommunity.setMetaCrawler(crawlerSNMPV2);
|
||||
itemCommunity.setRequired(true);
|
||||
itemCommunity.setDescription("SNMP V2 Community");
|
||||
itemCommunity.setPattern("");
|
||||
itemCommunity.setName("Community");
|
||||
itemCommunity.setDefaultValue("public");
|
||||
|
||||
this.metaCrawlerInputItemDAO.save(itemCommunity);
|
||||
}
|
||||
|
||||
|
||||
//MySQL
|
||||
{
|
||||
MetaCrawler crawlerMySQL = new MetaCrawler();
|
||||
crawlerMySQL.setId((short)4);
|
||||
|
||||
MetaCrawlerInputItem itemDB = new MetaCrawlerInputItem();
|
||||
itemDB.setId(++ID);
|
||||
itemDB.setMetaInputType(typeText);
|
||||
itemDB.setMetaCrawler(crawlerMySQL);
|
||||
itemDB.setRequired(true);
|
||||
itemDB.setDescription("MYSQL DB Name");
|
||||
itemDB.setPattern("");
|
||||
itemDB.setName("DB Name");
|
||||
itemDB.setDefaultValue("mysqldb");
|
||||
|
||||
MetaCrawlerInputItem itemID = new MetaCrawlerInputItem();
|
||||
itemID.setId(++ID);
|
||||
itemID.setMetaInputType(typeText);
|
||||
itemID.setMetaCrawler(crawlerMySQL);
|
||||
itemID.setRequired(true);
|
||||
itemID.setDescription("MYSQL Account ID");
|
||||
itemID.setPattern("");
|
||||
itemID.setName("ID");
|
||||
itemID.setDefaultValue("Loafle");
|
||||
|
||||
MetaCrawlerInputItem itemPW = new MetaCrawlerInputItem();
|
||||
itemPW.setId(++ID);
|
||||
itemPW.setMetaInputType(typePW);
|
||||
itemPW.setMetaCrawler(crawlerMySQL);
|
||||
itemPW.setRequired(true);
|
||||
itemPW.setDescription("MYSQL Account PW");
|
||||
itemPW.setPattern("");
|
||||
itemPW.setName("PassWord");
|
||||
itemPW.setDefaultValue("");
|
||||
|
||||
this.metaCrawlerInputItemDAO.save(itemDB);
|
||||
this.metaCrawlerInputItemDAO.save(itemID);
|
||||
this.metaCrawlerInputItemDAO.save(itemPW);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaInputType;
|
||||
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 MetaInputTypeDAOTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private MetaInputTypeDAO metaInputTypeDAO;
|
||||
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
|
||||
MetaInputType typeText = new MetaInputType();
|
||||
typeText.setName("TEXT_TYPE");
|
||||
typeText.setDescription("TEXT");
|
||||
|
||||
MetaInputType typePW = new MetaInputType();
|
||||
typePW.setName("PASSWORD_TYPE");
|
||||
typePW.setDescription("PASSWORD");
|
||||
|
||||
MetaInputType typeNumber = new MetaInputType();
|
||||
typeNumber.setName("NUMBER_TYPE");
|
||||
typeNumber.setDescription("NUMBER");
|
||||
|
||||
MetaInputType typeBool = new MetaInputType();
|
||||
typeBool.setName("BOOLEAN_TYPE");
|
||||
typeBool.setDescription("BOOLEAN");
|
||||
|
||||
MetaInputType typeSelect = new MetaInputType();
|
||||
typeSelect.setName("SELECT_TYPE");
|
||||
typeSelect.setDescription("SELECT");
|
||||
|
||||
List<MetaInputType> metaInputTypes = new ArrayList<>();
|
||||
|
||||
metaInputTypes.add(typeText);
|
||||
metaInputTypes.add(typePW);
|
||||
metaInputTypes.add(typeNumber);
|
||||
metaInputTypes.add(typeBool);
|
||||
metaInputTypes.add(typeSelect);
|
||||
|
||||
|
||||
for(int indexI = 1; indexI <= metaInputTypes.size(); ++indexI) {
|
||||
MetaInputType type = metaInputTypes.get(indexI-1);
|
||||
type.setId((short)indexI);
|
||||
this.metaInputTypeDAO.save(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaMemberStatus;
|
||||
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 MetaMemberStatusDAOTest {
|
||||
|
||||
@Autowired
|
||||
private MetaMemberStatusDAO metaMemberStatusDAO;
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
|
||||
MetaMemberStatus statusNoAuth = new MetaMemberStatus();
|
||||
statusNoAuth.setName("NOAUTH");
|
||||
|
||||
MetaMemberStatus statusNormal = new MetaMemberStatus();
|
||||
statusNormal.setName("NORMAL");
|
||||
|
||||
MetaMemberStatus statusDiaPause = new MetaMemberStatus();
|
||||
statusDiaPause.setName("DIAPAUSE");
|
||||
|
||||
MetaMemberStatus statusWithDrawal = new MetaMemberStatus();
|
||||
statusWithDrawal.setName("WITHDRAWAL");
|
||||
|
||||
List<MetaMemberStatus> metaMemberStatuses = new ArrayList<>();
|
||||
|
||||
metaMemberStatuses.add(statusNoAuth);
|
||||
metaMemberStatuses.add(statusNormal);
|
||||
metaMemberStatuses.add(statusDiaPause);
|
||||
metaMemberStatuses.add(statusWithDrawal);
|
||||
|
||||
|
||||
for(int indexI = 1; indexI <= metaMemberStatuses.size(); ++indexI) {
|
||||
MetaMemberStatus status = metaMemberStatuses.get(indexI-1);
|
||||
|
||||
status.setId((short)indexI);
|
||||
this.metaMemberStatusDAO.save(status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.loafle.overflow.module.infra.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.module.infra.model.Infra;
|
||||
import com.loafle.overflow.module.infra.model.InfraMachine;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
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.Date;
|
||||
|
||||
@Ignore
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class InfraDAOTest {
|
||||
|
||||
@Autowired
|
||||
private InfraDAO infraDAO;
|
||||
|
||||
@Autowired
|
||||
private InfraMachineDAO infraMachineDAO;
|
||||
|
||||
private long machineId;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
InfraMachine machine = new InfraMachine();
|
||||
machine.setCreateDate(new Date());
|
||||
Probe probe = new Probe();
|
||||
probe.setId(1);
|
||||
machine.setProbe(probe);
|
||||
|
||||
this.machineId = this.infraMachineDAO.save(machine).getId();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
Infra infra = new Infra();
|
||||
infra.setChildId(this.machineId);
|
||||
MetaInfraType type = new MetaInfraType();
|
||||
type.setId(1);
|
||||
infra.setType(type);
|
||||
infra.setCreateDate(new Date());
|
||||
|
||||
infraDAO.save(infra);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user