fixed
Noauthprobe probe status -> enum ---> Meta update meta test
This commit is contained in:
parent
73a4601ebd
commit
14b94a7647
|
@ -0,0 +1,12 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.meta.model.MetaNoAuthProbeStatus;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 26.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaNoAuthProbeStatusDAO extends JpaRepository<MetaNoAuthProbeStatus, Short> {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.meta.model.MetaProbeStatus;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 26.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaProbeStatusDAO extends JpaRepository<MetaProbeStatus, Short> {
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.loafle.overflow.meta.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 26.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "META_NOAUTH_PROBE_STATUS", schema = "public", catalog = "postgres")
|
||||
public class MetaNoAuthProbeStatus {
|
||||
private short id;
|
||||
private String name;
|
||||
|
||||
public MetaNoAuthProbeStatus() {
|
||||
|
||||
}
|
||||
|
||||
public MetaNoAuthProbeStatus(short id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Id
|
||||
public short getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(short id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "Name", nullable = false, length = 10)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.loafle.overflow.meta.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 26.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "META_PROBE_STATUS", schema = "public", catalog = "postgres")
|
||||
public class MetaProbeStatus {
|
||||
private short id;
|
||||
private String name;
|
||||
|
||||
public MetaProbeStatus() {
|
||||
|
||||
}
|
||||
|
||||
public MetaProbeStatus(short id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Id
|
||||
public short getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(short id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "Name", nullable = false, length = 10)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.loafle.overflow.module.noauthprobe.model;
|
||||
|
||||
|
||||
import com.loafle.overflow.meta.model.MetaNoAuthProbeStatus;
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.noauthprobe.type.AuthType;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
|
@ -19,7 +20,7 @@ public class NoAuthProbe {
|
|||
private String hostName;
|
||||
private long macAddress;
|
||||
private long ipAddress;
|
||||
private AuthType status;
|
||||
private MetaNoAuthProbeStatus status;
|
||||
private String tempProbeKey;
|
||||
private Date createDate;
|
||||
private String apiKey;
|
||||
|
@ -65,13 +66,13 @@ public class NoAuthProbe {
|
|||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
@Column(name = "STATUS", nullable = false, length = 1)
|
||||
@Enumerated(EnumType.STRING)
|
||||
public AuthType getStatus() {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "STATUS", nullable = false)
|
||||
public MetaNoAuthProbeStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(AuthType status) {
|
||||
public void setStatus(MetaNoAuthProbeStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.loafle.overflow.module.probe.model;
|
||||
|
||||
import com.loafle.overflow.meta.model.MetaProbeStatus;
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.probe.type.ProbeStatusType;
|
||||
|
||||
|
@ -13,7 +14,7 @@ import java.util.Date;
|
|||
@Table(name = "PROBE", schema = "public", catalog = "postgres")
|
||||
public class Probe {
|
||||
private long id;
|
||||
private ProbeStatusType status;
|
||||
private MetaProbeStatus status;
|
||||
private String description;
|
||||
private Date createDate;
|
||||
private Date lastPollingDate;
|
||||
|
@ -32,14 +33,13 @@ public class Probe {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "STATUS", nullable = false, length = 1)
|
||||
@Enumerated(EnumType.STRING)
|
||||
public ProbeStatusType getStatus() {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "STATUS", nullable = false)
|
||||
public MetaProbeStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(ProbeStatusType status) {
|
||||
public void setStatus(MetaProbeStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,11 +196,25 @@ INSERT INTO public.domain_member (id,create_date,domain_id,member_id) VALUES (
|
|||
1,'2017-06-26 11:27:43.023',1,1);
|
||||
|
||||
|
||||
INSERT INTO public.noauth_probe (id,api_key,create_date,host_name,ip_address,mac_address,status,temp_probe_key,domain_id,probe_id) VALUES (
|
||||
1,NULL,'2017-06-26 11:42:12.392','snoop',3232235980,8796753988883,'P','1cf2555c57d511e79714080027658d13',1,NULL);
|
||||
INSERT INTO public.meta_probe_status (id,"name") VALUES (
|
||||
1,'INITIAL');
|
||||
INSERT INTO public.meta_probe_status (id,"name") VALUES (
|
||||
2,'NORMAL');
|
||||
|
||||
INSERT INTO public.meta_noauth_probe_status (id,"name") VALUES (
|
||||
1,'ACCEPT');
|
||||
INSERT INTO public.meta_noauth_probe_status (id,"name") VALUES (
|
||||
2,'DENY');
|
||||
INSERT INTO public.meta_noauth_probe_status (id,"name") VALUES (
|
||||
3,'PROCESS');
|
||||
|
||||
|
||||
INSERT INTO public.noauth_probe (id,api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES (
|
||||
1,NULL,'2017-06-26 12:43:46.877','snoop',3232235980,8796753988883,'1cf2555c57d511e79714080027658d13',1,NULL,3);
|
||||
|
||||
INSERT INTO public.probe (id,create_date,description,encryption_key,last_polling_date,next_polling_date,probe_key,domain_id,status) VALUES (
|
||||
1,'2017-06-26 12:44:59.813','snoop probe','9c8d41ab57de11e7a2c9080027658d13',NULL,NULL,'a1e1710557de11e78799080027658d13',1,1);
|
||||
|
||||
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);
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
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.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.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;
|
||||
|
||||
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
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.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 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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
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.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.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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
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.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.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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaNoAuthProbeStatus;
|
||||
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 snoop on 17. 6. 26.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class MetaNoAuthProbeStatusDAOTest {
|
||||
|
||||
@Autowired
|
||||
private MetaNoAuthProbeStatusDAO metaNoAuthProbeStatusDAO;
|
||||
|
||||
@Test
|
||||
public void Create() {
|
||||
|
||||
// A("ACCEPT"),
|
||||
// D("DENY"),
|
||||
// P("PROCESS");
|
||||
|
||||
MetaNoAuthProbeStatus statusAccept = new MetaNoAuthProbeStatus();
|
||||
statusAccept.setId((short)1);
|
||||
statusAccept.setName("ACCEPT");
|
||||
|
||||
MetaNoAuthProbeStatus statusDeny = new MetaNoAuthProbeStatus();
|
||||
statusDeny.setId((short)2);
|
||||
statusDeny.setName("DENY");
|
||||
|
||||
MetaNoAuthProbeStatus statusProcess = new MetaNoAuthProbeStatus();
|
||||
statusProcess.setId((short)3);
|
||||
statusProcess.setName("PROCESS");
|
||||
|
||||
this.metaNoAuthProbeStatusDAO.save(statusAccept);
|
||||
this.metaNoAuthProbeStatusDAO.save(statusDeny);
|
||||
this.metaNoAuthProbeStatusDAO.save(statusProcess);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
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.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.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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
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.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.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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
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.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.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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.loafle.overflow.meta.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaProbeStatus;
|
||||
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 snoop on 17. 6. 26.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class MetaProbeStatusDAOTest {
|
||||
|
||||
@Autowired
|
||||
private MetaProbeStatusDAO metaProbeStatusDAO;
|
||||
|
||||
|
||||
@Test
|
||||
public void Create() {
|
||||
|
||||
// I("INITIAL"),
|
||||
// N("NORMAL");
|
||||
|
||||
MetaProbeStatus statusInitial = new MetaProbeStatus();
|
||||
statusInitial.setId((short)1);
|
||||
statusInitial.setName("INITIAL");
|
||||
|
||||
MetaProbeStatus statusNormal = new MetaProbeStatus();
|
||||
statusNormal.setId((short)2);
|
||||
statusNormal.setName("NORMAL");
|
||||
|
||||
this.metaProbeStatusDAO.save(statusInitial);
|
||||
this.metaProbeStatusDAO.save(statusNormal);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
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.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.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;
|
||||
|
||||
@Ignore
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.noauthprobe.dao;
|
|||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaNoAuthProbeStatus;
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
||||
import com.loafle.overflow.module.noauthprobe.type.AuthType;
|
||||
|
@ -48,7 +49,11 @@ public class NoAuthProbeDAOTest {
|
|||
noAuthProbe.setHostName("snoop");
|
||||
noAuthProbe.setIpAddress(3232235980L);
|
||||
noAuthProbe.setMacAddress(8796753988883L);
|
||||
noAuthProbe.setStatus(AuthType.P);
|
||||
|
||||
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
|
||||
metaNoAuthProbeStatus.setId((short)3);
|
||||
|
||||
noAuthProbe.setStatus(metaNoAuthProbeStatus);
|
||||
noAuthProbe.setTempProbeKey("1cf2555c57d511e79714080027658d13");
|
||||
|
||||
Domain d = new Domain();
|
||||
|
@ -66,7 +71,7 @@ public class NoAuthProbeDAOTest {
|
|||
|
||||
NoAuthProbe probe = this.noAuthProbeDAO.findByTempProbeKey("1cf2555c57d511e79714080027658d13");
|
||||
|
||||
probe.setStatus(AuthType.A);
|
||||
// probe.setStatus(AuthType.A);
|
||||
|
||||
this.noAuthProbeDAO.save(probe);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.loafle.overflow.module.probe.dao;
|
|||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.meta.model.MetaProbeStatus;
|
||||
import com.loafle.overflow.module.domain.model.Domain;
|
||||
import com.loafle.overflow.module.probe.model.Probe;
|
||||
import com.loafle.overflow.module.probe.type.ProbeStatusType;
|
||||
|
@ -39,7 +40,11 @@ public class ProbeDAOTest {
|
|||
|
||||
probe.setEncryptionKey("9c8d41ab57de11e7a2c9080027658d13");
|
||||
probe.setProbeKey("a1e1710557de11e78799080027658d13");
|
||||
probe.setStatus(ProbeStatusType.I);
|
||||
|
||||
MetaProbeStatus status = new MetaProbeStatus();
|
||||
status.setId((short)1);
|
||||
|
||||
probe.setStatus(status);
|
||||
|
||||
this.probeDAO.save(probe);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user