diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java index dec00ed..e124b32 100644 --- a/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java @@ -1,14 +1,18 @@ package com.loafle.overflow.module.infra.dao; +import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.infra.model.Infra; +import com.loafle.overflow.module.probe.model.Probe; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; + /** * Created by insanity on 17. 6. 23. */ @Repository public interface InfraDAO extends JpaRepository { -// @Query("select m from Member m WHERE m.email = :#{#m2.email}") -// Member findByEmail(@Param("m2") Member member); + public List findAllByProbe(Probe probe); + } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java index f154a99..e37a092 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java @@ -1,10 +1,14 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.infra.dao.InfraDAO; import com.loafle.overflow.module.infra.model.Infra; +import com.loafle.overflow.module.probe.model.Probe; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * Created by insanity on 17. 6. 28. */ @@ -23,4 +27,8 @@ public class InfraService { return this.infraDAO.findOne(id); } + public List readAllByProbe(Probe probe) { + return this.infraDAO.findAllByProbe(probe); + } + } diff --git a/src/main/java/com/loafle/overflow/module/probe/service/ProbeService.java b/src/main/java/com/loafle/overflow/module/probe/service/ProbeService.java index 3b78f8a..1aca277 100644 --- a/src/main/java/com/loafle/overflow/module/probe/service/ProbeService.java +++ b/src/main/java/com/loafle/overflow/module/probe/service/ProbeService.java @@ -26,6 +26,10 @@ public class ProbeService { return this.probeDAO.findAllByDomain(domain); } + public Probe read(long id) { + return this.probeDAO.findOne(id); + } + public Probe readByProbeKey(String probeKey) { return this.probeDAO.findByProbeKey(probeKey); diff --git a/src/test/java/com/loafle/overflow/module/probe/service/ProbeServiceTest.java b/src/test/java/com/loafle/overflow/module/probe/service/ProbeServiceTest.java index f0a2eac..7397ef4 100644 --- a/src/test/java/com/loafle/overflow/module/probe/service/ProbeServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/probe/service/ProbeServiceTest.java @@ -77,7 +77,7 @@ public class ProbeServiceTest { List probes = this.probeService.readAllByDomain(domain); - Assert.assertNotEquals(probes.size(), 0); + Assert.assertEquals(probes.size(), 1); }