diff --git a/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java b/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java index f5da8e9..ec1a14a 100644 --- a/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java +++ b/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java @@ -1,12 +1,17 @@ package com.loafle.overflow.module.probe.dao; +import com.loafle.overflow.module.probe.model.Probe; import com.loafle.overflow.module.probe.model.ProbeTask; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; + /** * Created by snoop on 17. 6. 26. */ @Repository public interface ProbeTaskDAO extends JpaRepository { + + List findAllByProbe(Probe probe); } diff --git a/src/test/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAOTest.java b/src/test/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAOTest.java index 20303ab..fcb5d61 100644 --- a/src/test/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAOTest.java +++ b/src/test/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAOTest.java @@ -5,12 +5,16 @@ import com.loafle.overflow.JdbcConfiguration; import com.loafle.overflow.meta.model.MetaProbeTaskType; import com.loafle.overflow.module.probe.model.Probe; import com.loafle.overflow.module.probe.model.ProbeTask; +import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import java.util.List; + import static org.junit.Assert.*; /** @@ -24,6 +28,7 @@ public class ProbeTaskDAOTest { private ProbeTaskDAO probeTaskDAO; + @Ignore @Test public void Create() { @@ -42,7 +47,22 @@ public class ProbeTaskDAOTest { this.probeTaskDAO.save(probeTask); + } + + @Ignore + @Test + public void select() { + + Create(); + + Probe probe = new Probe(); + probe.setId(1); + + List probeTasks = this.probeTaskDAO.findAllByProbe(probe); + + Assert.assertNotEquals(probeTasks.size(), 0 ); } + } \ No newline at end of file