added sample data

This commit is contained in:
snoop 2017-08-21 15:04:47 +09:00
parent 97edca8f0e
commit 02459e0de6
2 changed files with 35 additions and 14 deletions

View File

@ -397,20 +397,27 @@ INSERT INTO public.domain_member (create_date,domain_id,member_id) VALUES (
INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES ( INSERT INTO public.api_key (api_key,create_date,domain_id) VALUES (
'52abd6fd57e511e7ac52080027658d13','2017-06-26 13:02:28.347',1); '52abd6fd57e511e7ac52080027658d13','2017-06-26 13:02:28.347',1);
INSERT INTO public.probe (authorize_date,cidr,create_date,description,display_name,encryption_key,probe_key,sensor_count,target_count,authorize_member_id,domain_id,status) VALUES (
'2017-08-21 14:48:31.563','192.168.1.0/24','2017-08-21 14:48:31.563','snoop probe','test probe 111111','8c51fa9c5bcc11e7980a080027658d13','899fdd145bcc11e7b611080027658d13',0,0,1,1,1);
INSERT INTO public.probe (authorize_date,cidr,create_date,description,display_name,encryption_key,probe_key,sensor_count,target_count,authorize_member_id,domain_id,status) VALUES (
'2017-08-21 15:00:09.691','192.168.2.0/24','2017-08-21 15:00:09.691','insanity probe','test probe 22222','f1f72c8d2a814580bb7c4615ec43a6a8','95d8bcdc739741dca74c4a0e489e0774',0,0,1,1,1);
INSERT INTO public.target (create_date,description,display_name) VALUES (
'2017-07-27 20:18:09.555','i am target','ghost target');
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
'INFRA_MACHINE','2017-08-21 12:59:10.244',1,NULL,NULL); 'INFRA_MACHINE','2017-08-21 12:59:10.244',1,1,1);
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
'INFRA_OS','2017-08-21 13:05:24.883',3,NULL,NULL); 'INFRA_OS','2017-08-21 13:05:24.883',3,1,1);
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
'INFRA_HOST','2017-08-21 14:20:01.830',2,NULL,NULL); 'INFRA_HOST','2017-08-21 14:20:01.830',2,1,1);
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
'INFRA_SERVICE','2017-08-21 14:24:26.525',7,NULL,NULL); 'INFRA_SERVICE','2017-08-21 14:24:26.525',7,1,1);
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
'INFRA_OS_APPLICATION','2017-08-21 14:27:19.474',4,NULL,NULL); 'INFRA_OS_APPLICATION','2017-08-21 14:27:19.474',4,1,1);
INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES ( INSERT INTO public.infra (infra_type,create_date,type_id,probe_id,target_id) VALUES (
'INFRA_OS_DAEMON','2017-08-21 14:28:48.761',5,NULL,NULL); 'INFRA_OS_DAEMON','2017-08-21 14:28:48.761',5,1,1);
INSERT INTO public.infra_machine (meta,id) VALUES ( INSERT INTO public.infra_machine (meta,id) VALUES (
@ -433,3 +440,5 @@ INSERT INTO public.infra_os_daemon ("name",id,os_id) VALUES (

View File

@ -15,6 +15,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; import java.util.List;
import java.util.UUID;
/** /**
* Created by snoop on 17. 6. 28. * Created by snoop on 17. 6. 28.
@ -26,7 +27,7 @@ public class ProbeServiceTest {
@Autowired @Autowired
private ProbeService probeService; private ProbeService probeService;
@Ignore // @Ignore
@Test @Test
public void regist() throws Exception { public void regist() throws Exception {
@ -40,8 +41,8 @@ public class ProbeServiceTest {
probe.setDomain(domain); probe.setDomain(domain);
probe.setEncryptionKey("8c51fa9c5bcc11e7980a080027658d13"); probe.setEncryptionKey(getUUID());
probe.setProbeKey("899fdd145bcc11e7b611080027658d13"); probe.setProbeKey(getUUID());
MetaProbeStatus status = new MetaProbeStatus(); MetaProbeStatus status = new MetaProbeStatus();
status.setId((short)1); status.setId((short)1);
@ -50,7 +51,7 @@ public class ProbeServiceTest {
probe.setTargetCount(0); probe.setTargetCount(0);
probe.setSensorCount(0); probe.setSensorCount(0);
probe.setDisplayName("test probe"); probe.setDisplayName("test probe 22222");
probe.setCidr("192.168.1.0/24"); probe.setCidr("192.168.1.0/24");
// probe.setAuthorizedDate(new Date()); // probe.setAuthorizedDate(new Date());
@ -58,16 +59,27 @@ public class ProbeServiceTest {
member.setId(1l); member.setId(1l);
probe.setAuthorizeMember(member); probe.setAuthorizeMember(member);
InfraHost infraHost = new InfraHost(); // InfraHost infraHost = new InfraHost();
infraHost.setId(1); // infraHost.setId(1);
//
probe.setHost(infraHost); // probe.setHost(infraHost);
this.probeService.regist(probe); this.probeService.regist(probe);
Assert.assertNotEquals(probe.getId(), 0); Assert.assertNotEquals(probe.getId(), 0);
} }
public String getUUID() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
@Test
public void tttt() {
String uuid = UUID.randomUUID().toString();
String uuid2 = uuid.replaceAll("-", "");
System.out.println(uuid2);
}
@Test @Test
public void readAllByDomain() throws Exception { public void readAllByDomain() throws Exception {