From 75cd0da04ee82a1e85348f80c977fd609d556543 Mon Sep 17 00:00:00 2001 From: geek Date: Fri, 29 Jun 2018 15:04:26 +0900 Subject: [PATCH] email token duplication check --- .../resources/profiles/local/init.sample.sql | 9 ++- .../service/CentralInfraServiceTest.java | 57 +++++++++++++++++++ ...tralMetaDisplayItemMappingServiceTest.java | 34 +++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/test/java/com/loafle/overflow/central/module/meta/service/CentralMetaDisplayItemMappingServiceTest.java diff --git a/src/main/resources/profiles/local/init.sample.sql b/src/main/resources/profiles/local/init.sample.sql index 9a7ee93..c05e491 100644 --- a/src/main/resources/profiles/local/init.sample.sql +++ b/src/main/resources/profiles/local/init.sample.sql @@ -231,6 +231,10 @@ 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 ("address", iface, mac, network, id, meta_ip_type_id, meta_target_zone_type_id) @@ -544,7 +548,10 @@ INSERT INTO public.infra_service (id, description, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) VALUES (27, NULL, 16, 1, 1014); - +INSERT INTO public.infra_service + (id, description, infra_host_port_id, meta_crypto_type_id, meta_target_service_type_id) +VALUES + (28, NULL, 17, 17, 1047); INSERT INTO public.target diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java index f0df2a4..73b01f4 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java @@ -6,6 +6,7 @@ import com.loafle.overflow.model.discovery.Host; import com.loafle.overflow.model.discovery.Port; import com.loafle.overflow.model.discovery.Service; import com.loafle.overflow.model.discovery.Zone; +import com.loafle.overflow.model.infra.Infra; import com.loafle.overflow.model.meta.MetaCryptoType; import com.loafle.overflow.model.meta.MetaIPType; import com.loafle.overflow.model.meta.MetaPortType; @@ -105,4 +106,60 @@ public class CentralInfraServiceTest { @Test public void readAllInfraByProbeID() { } + + @Test + public void registByZone() { + } + + @Test + public void registByHost() { + } + + +// Long probeID, +// com.loafle.overflow.model.discovery.Service service + @Test + public void registByService() throws OverflowException { + Host host = null; + Service service = null; + Port port = null; + MetaCryptoType cryptoType = null; + + Zone zone = new Zone(); + zone.setAddress("192.168.1.103/24"); + zone.setDiscoveredDate(new Date()); + zone.setIface("enp3s0"); + zone.setMac("44:8a:5b:44:8c:e8"); + zone.setMetaIPType(MetaIPType.Enum.V4.to()); + zone.setNetwork("192.168.1.0/24"); + + host = new Host(); + host.setMetaIPType(MetaIPType.Enum.V4.to()); + host.getMetaIPType().setKey("V4"); + host.setAddress("192.168.1.103"); + host.setMac("44:8a:5b:44:8c:e8"); + host.setDiscoveredDate(new Date()); + host.setZone(zone); + + port = new Port(); + port.setDiscoveredDate(new Date()); + port.setHost(host); + port.setMetaPortType(MetaPortType.Enum.TCP.to()); + port.setPortNumber(22); + + service = new Service(); + cryptoType = new MetaCryptoType(); + cryptoType.setKey("TLS"); + cryptoType.setId(Short.valueOf((short) 17)); + cryptoType.setName("TLS"); + + service.setMetaCryptoType(cryptoType); + service.setPort(port); + service.setDiscoveredDate(new Date()); + service.setKey("SSH"); + + com.loafle.overflow.model.infra.InfraService in = this.infraService.registByService(Long.valueOf(3), service); + + System.out.println(in); + } } diff --git a/src/test/java/com/loafle/overflow/central/module/meta/service/CentralMetaDisplayItemMappingServiceTest.java b/src/test/java/com/loafle/overflow/central/module/meta/service/CentralMetaDisplayItemMappingServiceTest.java new file mode 100644 index 0000000..3331fac --- /dev/null +++ b/src/test/java/com/loafle/overflow/central/module/meta/service/CentralMetaDisplayItemMappingServiceTest.java @@ -0,0 +1,34 @@ +package com.loafle.overflow.central.module.meta.service; + +import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.model.meta.MetaDisplayItemMapping; +import com.loafle.overflow.service.central.meta.MetaDisplayItemMappingService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.*; + +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("test") +@ContextConfiguration(classes = {AppConfigTest.class}) +public class CentralMetaDisplayItemMappingServiceTest { + + @Autowired + private MetaDisplayItemMappingService metaDisplayItemMappingService; + + @Test + public void readAllByMetaDisplayItemID() { + } + + @Test + public void readAllByMetaCrawlerMappingID() { + } + + @Test + public void readAll() { + } +}