some services
This commit is contained in:
parent
c75bb9564e
commit
403ae5e03b
|
@ -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<Infra, Long> {
|
||||
// @Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
||||
// Member findByEmail(@Param("m2") Member member);
|
||||
public List<Infra> findAllByProbe(Probe probe);
|
||||
|
||||
}
|
|
@ -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<Infra> readAllByProbe(Probe probe) {
|
||||
return this.infraDAO.findAllByProbe(probe);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ProbeServiceTest {
|
|||
|
||||
List<Probe> probes = this.probeService.readAllByDomain(domain);
|
||||
|
||||
Assert.assertNotEquals(probes.size(), 0);
|
||||
Assert.assertEquals(probes.size(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user