ing
This commit is contained in:
parent
8d0e5a0839
commit
9b27386cc3
|
@ -62,103 +62,21 @@ INSERT INTO public.probe (authorize_date,cidr,"name", description,encryption_key
|
||||||
INSERT INTO public.probe (authorize_date,cidr,"name", description,encryption_key,probe_key,authorize_member_id,domain_id,meta_probe_status_id, target_count) VALUES (
|
INSERT INTO public.probe (authorize_date,cidr,"name", description,encryption_key,probe_key,authorize_member_id,domain_id,meta_probe_status_id, target_count) VALUES (
|
||||||
'2017-08-21 15:00:09.691','192.168.2.0/24','insanity probe','test probe 22222','f1f72c8d2a814580bb7c4615ec43a6a8','95d8bcdc739741dca74c4a0e489e0774',1,1,1,0);
|
'2017-08-21 15:00:09.691','192.168.2.0/24','insanity probe','test probe 22222','f1f72c8d2a814580bb7c4615ec43a6a8','95d8bcdc739741dca74c4a0e489e0774',1,1,1,0);
|
||||||
|
|
||||||
INSERT INTO public.probe (authorize_date,cidr,connect_address,connect_date,description,encryption_key,"name",probe_key,target_count,authorize_member_id,domain_id,meta_probe_status_id) VALUES (
|
|
||||||
'2018-06-21 11:14:50.707','192.168.1.0/24','192.168.1.101:58324','2018-06-21 11:14:51.256',NULL,'$2a$10$itfWaATv4ZDV/mpKNzpPkOc9rlR5WrxdKGqVC0om4WMGKsJxlzFk6','crusader-ubuntu probe','e100fd7174f811e89b79367a389c8dcd',0,1,1,1
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (1, 1, 1);
|
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (1, 1, 1);
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 1);
|
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 1);
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 1);
|
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 1);
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (1, 1, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (2, 2, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
INSERT INTO public.infra (infra_type, meta_infra_type_id, probe_id) VALUES (3, 3, 3);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_zone (id, meta_target_zone_type_id, network, iface, meta_ip_type_id, "address", mac) VALUES (1, 1, '192.168.1.0/24', 'enp3s0', 1, '192.168.1.101', '44:8a:5b:f1:f1:f3');
|
INSERT INTO public.infra_zone (id, meta_target_zone_type_id, network, iface, meta_ip_type_id, "address", mac) VALUES (1, 1, '192.168.1.0/24', 'enp3s0', 1, '192.168.1.101', '44:8a:5b:f1:f1:f3');
|
||||||
INSERT INTO public.infra_zone (id, meta_target_zone_type_id, network, iface, meta_ip_type_id, "address", mac) VALUES (4, NULL, '192.168.1.0/24', 'enp3s0',1,'192.168.1.101/24', '44:8a:5b:f1:f1:f3');
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host_machine (meta) VALUES ('{"vendor": "Micro-Star International Co., Ltd.", "product": "GP60 2QF (To be filled by O.E.M.)", "version": "REV:1.0", "serial": "9S716GH21875ZF1000339"}');
|
INSERT INTO public.infra_host_machine (meta) VALUES ('{"vendor": "Micro-Star International Co., Ltd.", "product": "GP60 2QF (To be filled by O.E.M.)", "version": "REV:1.0", "serial": "9S716GH21875ZF1000339"}');
|
||||||
INSERT INTO public.infra_host_machine (meta) VALUES ('{}');
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host_os ("name", os, platform, platform_family, platform_version, kernel_version, host_id) VALUES (
|
INSERT INTO public.infra_host_os ("name", os, platform, platform_family, platform_version, kernel_version, host_id) VALUES ('geek-ubuntu', 'linux', 'ubuntu', 'debian', '', '4.4.0-93-generic', '03000200-0400-0500-0006-000700080009');
|
||||||
'geek-ubuntu', 'linux', 'ubuntu', 'debian', '', '4.4.0-93-generic', '03000200-0400-0500-0006-000700080009');
|
|
||||||
INSERT INTO public.infra_host_os ("name", os, platform, platform_family, platform_version, kernel_version, host_id) VALUES (
|
|
||||||
'crusader-ubuntu', 'linux', 'ubuntu', 'debian', NULL, '4.4.0-128-generic', '5c9e1778-f25f-4df3-8712-83973684e369');
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (2, 1, 127, 1, 1);
|
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (2, 1, 127, 1, 1);
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (5, 4, 100, 2, 2);
|
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (6, 4, 100, NULL, NULL);
|
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (7, 4, 100, NULL, NULL);
|
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (8, 4, 100, NULL, NULL);
|
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (9, 4, 100, NULL, NULL);
|
|
||||||
INSERT INTO public.infra_host (id, infra_zone_id, meta_target_host_type_id, infra_host_machine_id, infra_host_os_id) VALUES (10, 4, 100, NULL, NULL);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
INSERT INTO public.infra_host_ip (infra_host_id, meta_ip_type_id, "address", mac) VALUES (2, 1, '192.168.1.101', '44:8a:5b:f1:f1:f3');
|
||||||
('192.168.1.101',NULL,NULL,'44:8a:5b:f1:f1:f3',2,1);
|
INSERT INTO public.infra_host_port (infra_host_ip_id, meta_port_type_id, port) VALUES (1, 1, 5432);
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('192.168.1.101/24','192.168.1.254','enp3s0','44:8a:5b:f1:f1:f3',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('fe80::36c0:6c3e:6006:dd23/64','192.168.1.254','enp3s0','44:8a:5b:f1:f1:f3',5,2);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.23.0.1/16',NULL,'br-6c078941d24b','02:42:98:1e:b0:58',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.20.0.1/16',NULL,'br-7b643c9b5284','02:42:aa:2a:dc:fb',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('fe80::42:aaff:fe2a:dcfb/64',NULL,'br-7b643c9b5284','02:42:aa:2a:dc:fb',5,2);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.19.0.1/16',NULL,'br-a73e4d7bd0ac','02:42:e3:25:b7:44',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.21.0.1/16',NULL,'br-a87d468914e9','02:42:b4:75:bc:9c',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.18.0.1/16',NULL,'br-bc97baaa807f','02:42:2b:c8:e5:dd',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.17.0.1/16',NULL,'docker0','02:42:ff:84:de:ab',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.22.0.1/16',NULL,'br-30ea20f4fdbe','02:42:13:0a:eb:69',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('172.24.0.1/16',NULL,'br-629e1bf40111','02:42:8f:8f:5c:72',5,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('fe80::347a:38ff:fe9c:8dcd/64',NULL,'veth9163936','36:7a:38:9c:8d:cd',5,2);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('192.168.1.254',NULL,NULL,'64:e5:99:63:e7:80',6,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('192.168.1.10',NULL,NULL,'d0:50:99:97:5d:99',7,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('192.168.1.204',NULL,NULL,'a8:e5:39:5b:c9:62',8,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('192.168.1.102',NULL,NULL,'44:8a:5b:f1:f2:d3',9,1);
|
|
||||||
INSERT INTO public.infra_host_ip ("address",gateway,iface,mac,infra_host_id,meta_ip_type_id) VALUES
|
|
||||||
('192.168.1.50',NULL,NULL,'6c:f0:49:7a:60:68',10,1);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (5432,1,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (53,14,2);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (22,15,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (161,16,2);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (161,14,2);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (22,18,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (80,15,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (139,17,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (88,16,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (445,17,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (443,15,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (135,17,1);
|
|
||||||
INSERT INTO public.infra_host_port (port,infra_host_ip_id,meta_port_type_id) VALUES (80,14,1);
|
|
||||||
|
|
||||||
INSERT INTO public.infra_host_application (infra_host_id, "name") VALUES (2, 'Apache Httpd');
|
INSERT INTO public.infra_host_application (infra_host_id, "name") VALUES (2, 'Apache Httpd');
|
||||||
|
|
||||||
|
@ -172,19 +90,7 @@ INSERT INTO public.infra_host_daemon (infra_host_id, "name") VALUES (2, 'Postgre
|
||||||
INSERT INTO public.infra_host_daemon (infra_host_id, "name") VALUES (2, 'MySQL');
|
INSERT INTO public.infra_host_daemon (infra_host_id, "name") VALUES (2, 'MySQL');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (3,1,1,1035);
|
INSERT INTO public.infra_service (id, meta_target_service_type_id, infra_host_port_id, meta_crypto_type_id) VALUES (3, 1035, 1, 1);
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (11,2,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (12,3,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (13,4,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (14,5,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (15,6,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (16,7,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (17,8,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (18,9,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (19,10,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (20,11,2,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (21,12,1,NULL);
|
|
||||||
INSERT INTO public.infra_service (id, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (22,13,1,NULL);
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO public.target (infra_id, "name", description, sensor_count, meta_target_type_id) VALUES (1, 'Zone', 'Zone Target', 1, 2);
|
INSERT INTO public.target (infra_id, "name", description, sensor_count, meta_target_type_id) VALUES (1, 'Zone', 'Zone Target', 1, 2);
|
||||||
|
|
|
@ -25,10 +25,9 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ActiveProfiles("test")
|
@ActiveProfiles("test")
|
||||||
@ContextConfiguration(classes = {AppConfigTest.class})
|
@ContextConfiguration(classes = { AppConfigTest.class })
|
||||||
public class CentralInfraServiceTest {
|
public class CentralInfraServiceTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -57,43 +56,45 @@ public class CentralInfraServiceTest {
|
||||||
zone.setMetaIPType(MetaIPType.Enum.V4.to());
|
zone.setMetaIPType(MetaIPType.Enum.V4.to());
|
||||||
zone.setNetwork("192.168.10.0/24");
|
zone.setNetwork("192.168.10.0/24");
|
||||||
|
|
||||||
// for (int i = 1; i < 6; i++) {
|
// for (int i = 1; i < 6; i++) {
|
||||||
host = new Host();
|
host = new Host();
|
||||||
host.setMetaIPType(MetaIPType.Enum.V4.to());
|
host.setMetaIPType(MetaIPType.Enum.V4.to());
|
||||||
host.getMetaIPType().setKey("V4");
|
host.getMetaIPType().setKey("V4");
|
||||||
host.setAddress("192.168.10.12");
|
host.setAddress("192.168.10.12");
|
||||||
host.setMac("44:8a:5b:44:8c:e7");
|
host.setMac("44:8a:5b:44:8c:e7");
|
||||||
host.setDiscoveredDate(new Date());
|
host.setDiscoveredDate(new Date());
|
||||||
host.setZone(zone);
|
host.setZone(zone);
|
||||||
for (int j = 24; j < 25; j ++) {
|
for (int j = 24; j < 25; j++) {
|
||||||
port = new Port();
|
port = new Port();
|
||||||
port.setDiscoveredDate(new Date());
|
port.setDiscoveredDate(new Date());
|
||||||
port.setHost(host);
|
port.setHost(host);
|
||||||
port.setMetaPortType(MetaPortType.Enum.TCP.to());
|
port.setMetaPortType(MetaPortType.Enum.TCP.to());
|
||||||
port.setPortNumber(j);
|
port.setPortNumber(j);
|
||||||
|
|
||||||
for (int x = 24; x < 25; x ++) {
|
for (int x = 24; x < 25; x++) {
|
||||||
service = new Service();
|
service = new Service();
|
||||||
cryptoType = new MetaCryptoType();
|
cryptoType = new MetaCryptoType();
|
||||||
cryptoType.setKey("UNKNOWN");
|
cryptoType.setKey("UNKNOWN");
|
||||||
cryptoType.setId(Short.valueOf((short)2));
|
cryptoType.setId(Short.valueOf((short) 2));
|
||||||
cryptoType.setName("Unknown");
|
cryptoType.setName("Unknown");
|
||||||
|
|
||||||
service.setMetaCryptoType(cryptoType);
|
service.setMetaCryptoType(cryptoType);
|
||||||
service.setPort(port);
|
service.setPort(port);
|
||||||
service.setDiscoveredDate(new Date());
|
service.setDiscoveredDate(new Date());
|
||||||
service.setName("Unknown");
|
service.setName("Unknown");
|
||||||
services.add(service);
|
services.add(service);
|
||||||
}
|
|
||||||
port.setServiceList(services);
|
|
||||||
ports.add(port);
|
|
||||||
}
|
}
|
||||||
host.setPortList(ports);
|
port.setServiceList(services);
|
||||||
hosts.add(host);
|
ports.add(port);
|
||||||
// }
|
}
|
||||||
|
host.setPortList(ports);
|
||||||
|
hosts.add(host);
|
||||||
|
// }
|
||||||
|
|
||||||
List<Infra> infras = this.infraService.registDiscoverd(Long.valueOf((long)1), hosts, services);
|
// List<Infra> infras = this.infraService.registDiscoverd(Long.valueOf((long)1),
|
||||||
System.out.println("CentralInfraServiceTest Infra List Size: " + infras.size());
|
// hosts, services);
|
||||||
|
// System.out.println("CentralInfraServiceTest Infra List Size: " +
|
||||||
|
// infras.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue
Block a user