diff --git a/src/main/resources/profiles/local/init.sample.sql b/src/main/resources/profiles/local/init.sample.sql index c05e491..7850b3c 100644 --- a/src/main/resources/profiles/local/init.sample.sql +++ b/src/main/resources/profiles/local/init.sample.sql @@ -454,6 +454,10 @@ INSERT INTO public.infra_host_port (port, infra_host_ip_id, meta_port_type_id) VALUES (80, 17, 1); +INSERT INTO public.infra_host_port + (port, infra_host_ip_id, meta_port_type_id) +VALUES +(22, 19, 1); INSERT INTO public.infra_host_application (infra_host_id, "name") diff --git a/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java b/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java index 3a6d50f..33eb920 100644 --- a/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/sensor/service/SensorServiceTest.java @@ -7,9 +7,11 @@ import com.loafle.overflow.central.spring.AppConfigTest; import java.util.ArrayList; import java.util.List; +import com.loafle.overflow.model.infra.Infra; import com.loafle.overflow.model.meta.MetaCrawlerMapping; import com.loafle.overflow.model.sensor.Sensor; import com.loafle.overflow.model.target.Target; +import com.loafle.overflow.service.central.infra.InfraService; import com.loafle.overflow.service.central.sensor.SensorService; import com.loafle.overflow.service.central.target.TargetService; import org.junit.Assert; @@ -38,6 +40,22 @@ public class SensorServiceTest { @Autowired MetaCrawlerMappingDAO metaCrawlerMappingDAO; + @Autowired + InfraService infraService; + + @Test + public void registDefault() throws Exception { + Long tempInfraID = Long.valueOf(1); + Long tempProbeID = Long.valueOf(1); + + Infra infra = this.infraService.read(tempInfraID); + List infraIDs = new ArrayList<>(); + infraIDs.add(infra.getId()); + List targets = this.targetService.registAll(infraIDs, tempProbeID); + + Assert.assertNotNull(this.sensorService.readAllByTargetID(targets.get(0).getId())); + } + @Test @Ignore public void regist() throws Exception {