diff --git a/src/main/java/com/loafle/overflow/central/commons/service/MessagePublisher.java b/src/main/java/com/loafle/overflow/central/commons/service/MessagePublisher.java index 8d0d756..a86403b 100644 --- a/src/main/java/com/loafle/overflow/central/commons/service/MessagePublisher.java +++ b/src/main/java/com/loafle/overflow/central/commons/service/MessagePublisher.java @@ -3,7 +3,7 @@ package com.loafle.overflow.central.commons.service; import com.loafle.overflow.core.exception.OverflowException; public interface MessagePublisher { - void publishToDomainMembers(final long domainID, final String method, final Object... params) throws OverflowException; + void publishToDomainMembers(final Long domainID, final String method, final Object... params) throws OverflowException; void publishToDomainMembersByProbeKey(final String probeKey, final String method, final Object... params) throws OverflowException; void publishToMember(final String memberID, final String method, final Object... params) throws OverflowException; diff --git a/src/main/java/com/loafle/overflow/central/module/apikey/dao/ApiKeyDAO.java b/src/main/java/com/loafle/overflow/central/module/apikey/dao/ApiKeyDAO.java index 2d2fce3..035facd 100644 --- a/src/main/java/com/loafle/overflow/central/module/apikey/dao/ApiKeyDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/apikey/dao/ApiKeyDAO.java @@ -3,7 +3,6 @@ package com.loafle.overflow.central.module.apikey.dao; import com.loafle.overflow.model.apikey.ApiKey; -import com.loafle.overflow.model.domain.Domain; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @@ -16,5 +15,5 @@ public interface ApiKeyDAO extends JpaRepository { ApiKey findByApiKey(String apiKey); - ApiKey findByDomain(Domain domain); + ApiKey findByDomainId(Long domainID); } diff --git a/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java b/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java index 897fa1d..0e5a737 100644 --- a/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java +++ b/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java @@ -27,8 +27,8 @@ public class CentralApiKeyService implements ApiKeyService { return this.apiKeyDAO.save(apiKey); } - public ApiKey readByDomain(Domain domain) throws OverflowException { - return this.apiKeyDAO.findByDomain(domain); + public ApiKey readByDomainID(Long domainID) throws OverflowException { + return this.apiKeyDAO.findByDomainId(domainID); } public boolean check(String apiKey) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/auth/service/CentralAuthCrawlerService.java b/src/main/java/com/loafle/overflow/central/module/auth/service/CentralAuthCrawlerService.java index 901d6bb..b6d12ea 100644 --- a/src/main/java/com/loafle/overflow/central/module/auth/service/CentralAuthCrawlerService.java +++ b/src/main/java/com/loafle/overflow/central/module/auth/service/CentralAuthCrawlerService.java @@ -40,7 +40,7 @@ public class CentralAuthCrawlerService implements AuthCrawlerService { return this.authCrawlerDAO.save(dbAuthCrawler); } - public boolean checkAuthCrawler(long infraId, MetaCrawler crawler, String authJson) throws OverflowException { + public boolean checkAuthCrawler(Long infraId, MetaCrawler crawler, String authJson) throws OverflowException { Infra infra = this.infraService.read(infraId); diff --git a/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java b/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java index eaae6b1..7b98953 100644 --- a/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java @@ -21,12 +21,10 @@ public interface DomainMemberDAO extends JpaRepository { @Query("SELECT dm from DomainMember dm where dm.member.email = (:email)") DomainMember findByMemberEmail(@Param("email") String email); - @Query("SELECT dm.domain from DomainMember dm where dm.member = (:member)") - Domain findDomainByMember(@Param("member") Member member); + @Query("SELECT dm.domain from DomainMember dm where dm.member.id = (:memberID)") + Domain findDomainByMemberId(@Param("memberID") Long memberID); - @Query("SELECT dm.member from DomainMember dm where dm.domain = (:domain)") - List findAllMemberByDomain(@Param("domain") Domain domain); @Query("SELECT dm.member from DomainMember dm where dm.domain.id = (:domainID)") - List findAllMemberByDomainID(@Param("domainID") long domainID); + List findAllMemberByDomainId(@Param("domainID") Long domainID); } diff --git a/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java b/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java index 9c5a8a3..26d8a4b 100644 --- a/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java +++ b/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java @@ -22,28 +22,20 @@ public class CentralDomainMemberService implements DomainMemberService { @Autowired private DomainMemberDAO domainMemberDAO; - @Autowired - private MemberDAO memberDAO; - public void regist(DomainMember domainMember) { this.domainMemberDAO.save(domainMember); } - public Domain readDomainByMemberID(long id) { - Member member = this.memberDAO.findOne(id); - return this.domainMemberDAO.findDomainByMember(member); + public Domain readDomainByMemberID(Long memberID) { + return this.domainMemberDAO.findDomainByMemberId(memberID); } public DomainMember readByMemberEmail(String email) { return this.domainMemberDAO.findByMemberEmail(email); } - public List readAllMemberByDomain(Domain domain) { - return this.domainMemberDAO.findAllMemberByDomain(domain); - } - - public List readAllMemberByDomainID(final long domainID) { - return this.domainMemberDAO.findAllMemberByDomainID(domainID); + public List readAllMemberByDomainID(final Long domainID) { + return this.domainMemberDAO.findAllMemberByDomainId(domainID); } } diff --git a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java b/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java index 91c7578..5c0b3bd 100644 --- a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java +++ b/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java @@ -17,11 +17,9 @@ import com.loafle.overflow.model.member.Member; import com.loafle.overflow.model.meta.MetaEmailStatus; import com.loafle.overflow.model.meta.MetaMemberStatus; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.mail.MailException; import org.springframework.stereotype.Service; import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.net.URLEncoder; import java.util.*; @@ -50,7 +48,7 @@ public class EmailAuthService { // private static final String WEB_NG_MEMBER_ADDR = "http://127.0.0.1:4200/auth/"; - public EmailAuth read(long id) { + public EmailAuth read(Long id) { return this.emailAuthDAO.findOne(id); } @@ -127,7 +125,7 @@ public class EmailAuthService { } // dZQgXM1o/Cx48X8DM+6ec/oPfqA2l/LdWtijOZ2EnWk= - public List readByMember(long memberId) { + public List readByMember(Long memberId) { return this.emailAuthDAO.findByMember(new Member(memberId)); } diff --git a/src/main/java/com/loafle/overflow/central/module/generator/service/SensorConfigGenerator.java b/src/main/java/com/loafle/overflow/central/module/generator/service/SensorConfigGenerator.java index ed96d32..be36a08 100644 --- a/src/main/java/com/loafle/overflow/central/module/generator/service/SensorConfigGenerator.java +++ b/src/main/java/com/loafle/overflow/central/module/generator/service/SensorConfigGenerator.java @@ -47,7 +47,7 @@ public class SensorConfigGenerator { } Sensor dbSensor = sensorItems.get(0).getSensor(); - Infra infra = this.infraService.readByTarget(dbSensor.getTarget()); + Infra infra = this.infraService.readByTargetID(dbSensor.getTarget().getId()); // 7 = Infra OS Service if(infra.getInfraType().getId() == 7) { diff --git a/src/main/java/com/loafle/overflow/central/module/history/dao/HistoryDAO.java b/src/main/java/com/loafle/overflow/central/module/history/dao/HistoryDAO.java index 17742b1..699f6b5 100644 --- a/src/main/java/com/loafle/overflow/central/module/history/dao/HistoryDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/history/dao/HistoryDAO.java @@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.history.dao; import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.history.History; -import com.loafle.overflow.model.probe.Probe; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -17,13 +16,13 @@ import org.springframework.stereotype.Repository; */ @Repository public interface HistoryDAO extends JpaRepository { - Page findAllByProbe(Probe probe, Pageable pageable); + Page findAllByProbeId(Long probeID, Pageable pageable); - @Query("SELECT h FROM History h WHERE h.probe.id = :#{#probe.id} and h.type.id = :#{#type.id}") - Page findAllByProbeAndType(@Param("probe") Probe probe, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageable); + @Query("SELECT h FROM History h WHERE h.probe.id = :#{#probeID} and h.type.id = :#{#type.id}") + Page findAllByProbeIdAndType(@Param("probeID") Long probeID, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageable); - Page findAllByDomain(@Param("domain") Domain domain, Pageable pageRequest); + Page findAllByDomainId(Long domainID, Pageable pageRequest); - @Query("SELECT h FROM History h WHERE h.domain.id = :#{#domain.id} and h.type.id = :#{#type.id}") - Page findAllByDomainAndType(@Param("domain") Domain domain, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageRequest); + @Query("SELECT h FROM History h WHERE h.domain.id = :#{#domainID} and h.type.id = :#{#type.id}") + Page findAllByDomainIdAndType(@Param("domainID") Long domainID, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageRequest); } diff --git a/src/main/java/com/loafle/overflow/central/module/history/service/CentralHistoryService.java b/src/main/java/com/loafle/overflow/central/module/history/service/CentralHistoryService.java index a2fecbf..d93a6e0 100644 --- a/src/main/java/com/loafle/overflow/central/module/history/service/CentralHistoryService.java +++ b/src/main/java/com/loafle/overflow/central/module/history/service/CentralHistoryService.java @@ -23,20 +23,20 @@ public class CentralHistoryService implements HistoryService { } - public Page readAllByProbeAndType(Probe probe, MetaHistoryType type, PageParams pageParams) { - return this.historyDAO.findAllByProbeAndType(probe, type, PageUtil.getPageRequest(pageParams)); + public Page readAllByProbeIDAndType(Long probeID, MetaHistoryType type, PageParams pageParams) { + return this.historyDAO.findAllByProbeIdAndType(probeID, type, PageUtil.getPageRequest(pageParams)); } - public Page readAllByProbe(Probe probe, com.loafle.overflow.core.model.PageParams pageParams) { - return this.historyDAO.findAllByProbe(probe, PageUtil.getPageRequest(pageParams)); + public Page readAllByProbeID(Long probeID, PageParams pageParams) { + return this.historyDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams)); } - public Page readAllByDomain(Domain domain, PageParams pageParams) { - return this.historyDAO.findAllByDomain(domain, PageUtil.getPageRequest(pageParams)); + public Page readAllByDomainID(Long domainID, PageParams pageParams) { + return this.historyDAO.findAllByDomainId(domainID, PageUtil.getPageRequest(pageParams)); } - public Page readAllByDomainAndType(Domain domain, MetaHistoryType type, PageParams pageParams) { - return this.historyDAO.findAllByDomainAndType(domain, type, PageUtil.getPageRequest(pageParams)); + public Page readAllByDomainIDAndType(Long domainID, MetaHistoryType type, PageParams pageParams) { + return this.historyDAO.findAllByDomainIdAndType(domainID, type, PageUtil.getPageRequest(pageParams)); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java index bd6a9d4..77169cc 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java @@ -17,9 +17,9 @@ import java.util.List; */ @Repository public interface InfraDAO extends JpaRepository { - List findAllByProbe(Probe probe); + List findAllByProbeId(Long probeID); - Page findAllByProbe(Probe probe, Pageable pageable); + Page findAllByProbeId(Long probeID, Pageable pageable); @Query("SELECT i FROM INFRA i WHERE i.probe IN (:probeList) AND i.target != NULL") Page findAllByProbeList(@Param("probeList") List probeList, Pageable pageable); @@ -28,6 +28,6 @@ public interface InfraDAO extends JpaRepository { @Query("SELECT DISTINCT i.target FROM INFRA i WHERE i.probe IN (:probeList)") List findAllTargetByProbeList(@Param("probeList") List probeList); - Infra findByTarget(Target target); + Infra findByTargetId(Long targetID); // List findAllByProbe(List probeList); } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java index 4fefafc..ce387f6 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java @@ -13,5 +13,5 @@ import org.springframework.stereotype.Repository; @Repository public interface InfraOSPortDAO extends JpaRepository { @Query("SELECT p from com.loafle.overflow.model.infra.InfraOSPort p WHERE p.os.id = (:osId) AND p.port = (:portNumber) AND p.portType = (:portType)") - InfraOSPort findByPort(@Param("osId") long osId,@Param("portNumber") Integer portNumber,@Param("portType") String portType); + InfraOSPort findByPort(@Param("osId") Long osId,@Param("portNumber") Integer portNumber,@Param("portType") String portType); } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java index 35b5a70..f9a6f9c 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java @@ -12,5 +12,5 @@ import org.springframework.stereotype.Repository; @Repository public interface InfraServiceDAO extends JpaRepository { @Query("SELECT ins from com.loafle.overflow.model.infra.InfraService ins WHERE ins.host.id = (:hostId) AND ins.port = (:portNumber) AND ins.portType = (:portType)") - InfraService findByService(@Param("hostId") long hostId,@Param("portNumber") int portNumber,@Param("portType") String portType); + InfraService findByService(@Param("hostId") Long hostId,@Param("portNumber") Integer portNumber,@Param("portType") String portType); } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java index b208197..277f1bf 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java @@ -20,7 +20,7 @@ public class CentralInfraHostService implements InfraHostService { return this.infraHostDAO.save(infraHost); } - public InfraHost read(long id) throws OverflowException { + public InfraHost read(Long id) throws OverflowException { return this.infraHostDAO.findOne(id); } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java index 8278f20..009d851 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java @@ -19,7 +19,7 @@ public class CentralInfraMachineService implements InfraMachineService { return this.infraMachineDAO.save(infraMachine); } - public InfraMachine read(long id) { + public InfraMachine read(Long id) { return this.infraMachineDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java index a2b97da..77b81ae 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java @@ -20,7 +20,7 @@ public class CentralInfraOSApplicationService implements InfraOSApplicationServi return this.infraOSApplicationDAO.save(infraOSApplication); } - public InfraOSApplication read(long id)throws OverflowException { + public InfraOSApplication read(Long id)throws OverflowException { return this.infraOSApplicationDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java index 9cb812b..04f924f 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java @@ -20,7 +20,7 @@ public class CentralInfraOSDaemonService implements InfraOSDaemonService { return this.infraOSDaemonDAO.save(infraOSDaemon); } - public InfraOSDaemon read(long id) throws OverflowException { + public InfraOSDaemon read(Long id) throws OverflowException { return this.infraOSDaemonDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java index db67f98..5a3db99 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java @@ -20,11 +20,11 @@ public class CentralInfraOSPortService implements InfraOSPortService { return this.infraOSPortDAO.save(infraOSPort); } - public InfraOSPort read(long id) throws OverflowException { + public InfraOSPort read(Long id) throws OverflowException { return this.infraOSPortDAO.findOne(id); } - public InfraOSPort readByPort(long osId, int portNumber, String portType) throws OverflowException { + public InfraOSPort readByPort(Long osId, int portNumber, String portType) throws OverflowException { return this.infraOSPortDAO.findByPort(osId, portNumber, portType); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java index 3f5eb0b..613f95c 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java @@ -20,7 +20,7 @@ public class CentralInfraOSService implements InfraOSService { return this.infraOSDAO.save(infraOS); } - public InfraOS read(long id) throws OverflowException { + public InfraOS read(Long id) throws OverflowException { return this.infraOSDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java index da6b4d1..79d85ac 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java @@ -37,18 +37,18 @@ public class CentralInfraService implements InfraService { return this.infraDAO.save(infra); } - public Infra read(long id) throws OverflowException { + public Infra read(Long id) throws OverflowException { Infra infra = this.infraDAO.findOne(id); - infra.getTarget().setSensors(this.sensorDAO.findAllByTarget(infra.getTarget())); + infra.getTarget().setSensors(this.sensorDAO.findAllByTargetId(infra.getTarget().getId())); return infra; } - public Page readAllByProbe(Probe probe, PageParams pageParams) throws OverflowException { - return this.infraDAO.findAllByProbe(probe, PageUtil.getPageRequest(pageParams)); + public Page readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException { + return this.infraDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams)); } - public Page readAllByDomain(Domain domain, PageParams pageParams) throws OverflowException { - List probeList = this.probeService.readAllByDomain(domain); + public Page readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException { + List probeList = this.probeService.readAllByDomainID(domainID); if(probeList == null || probeList.size() <= 0) { throw new OverflowException("ProbeNotFoundException", new Throwable()); @@ -56,15 +56,15 @@ public class CentralInfraService implements InfraService { Page infraList = this.infraDAO.findAllByProbeList(probeList, PageUtil.getPageRequest(pageParams)); for (Infra infra: infraList) { - infra.getTarget().setSensors(this.sensorDAO.findAllByTarget(infra.getTarget())); + infra.getTarget().setSensors(this.sensorDAO.findAllByTargetId(infra.getTarget().getId())); } return infraList; } - public List readAllTargetByDomain(Domain domain) throws OverflowException { + public List readAllTargetByDomainID(Long domainID) throws OverflowException { - List probeList = this.probeService.readAllByDomain(domain); + List probeList = this.probeService.readAllByDomainID(domainID); if(probeList == null || probeList.size() <= 0) { throw new OverflowException("ProbeNotFoundException", new Throwable()); @@ -78,8 +78,8 @@ public class CentralInfraService implements InfraService { // return null; } - public Infra readByTarget(Target target) throws OverflowException { - return this.infraDAO.findByTarget(target); + public Infra readByTargetID(Long targetID) throws OverflowException { + return this.infraDAO.findByTargetId(targetID); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java index 84038e9..ecb33a2 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java @@ -20,11 +20,11 @@ public class CentralInfraServiceService implements InfraServiceService { return this.infraServiceDAO.save(infraService); } - public InfraService read(long id) throws OverflowException { + public InfraService read(Long id) throws OverflowException { return this.infraServiceDAO.findOne(id); } - public InfraService readByService(long hostId, int portNumber, String portType) throws OverflowException { + public InfraService readByService(Long hostId, int portNumber, String portType) throws OverflowException { return this.infraServiceDAO.findByService(hostId, portNumber, portType); } } diff --git a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java index ee76ac9..8a80bdd 100644 --- a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java +++ b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java @@ -238,7 +238,7 @@ public class CentralMemberService implements MemberService { return cMember; } - public Member read(long memberId) throws OverflowException { + public Member read(Long memberId) throws OverflowException { if (memberId <= 0) { throw new OverflowException("SignInIdNotExistException()", new Throwable()); } @@ -248,7 +248,7 @@ public class CentralMemberService implements MemberService { } @WebappAPI - public void withdrawal(Member member) throws OverflowException { + public void withdrawal(Long memberId) throws OverflowException { String email = SessionMetadata.getTargetID(); // Todo DB delete? @@ -262,7 +262,7 @@ public class CentralMemberService implements MemberService { return null; } - return this.domainMemberService.readAllMemberByDomain(probe.getDomain()); + return this.domainMemberService.readAllMemberByDomainID(probe.getDomain().getId()); } public List readAllByApiKey(String apikey) throws OverflowException { @@ -273,15 +273,10 @@ public class CentralMemberService implements MemberService { return null; } - return this.domainMemberService.readAllMemberByDomain(apiKey.getDomain()); + return this.domainMemberService.readAllMemberByDomainID(apiKey.getDomain().getId()); } - public List readAllByDomain(Domain domain) throws OverflowException { - - return this.domainMemberService.readAllMemberByDomain(domain); - } - - public List readAllByDomainID(final long domainID) throws OverflowException { + public List readAllByDomainID(final Long domainID) throws OverflowException { return this.domainMemberService.readAllMemberByDomainID(domainID); } diff --git a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java index 23fbc02..a3124ad 100644 --- a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java +++ b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java @@ -50,11 +50,11 @@ public class CentralMemberTotpService implements MemberTotpService { return this.totpDAO.save(totp); } - public void remove(long id) throws OverflowException { + public void remove(Long id) throws OverflowException { this.totpDAO.delete(id); } - public MemberTotp read(long id) throws OverflowException { + public MemberTotp read(Long id) throws OverflowException { return this.totpDAO.findOne(id); } diff --git a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java index 1269296..7a1a011 100644 --- a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java +++ b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java @@ -22,7 +22,7 @@ public class CentralMetaSensorDisplayItemService implements MetaSensorDisplayIte return this.displayItemDAO.save(item); } - public MetaSensorDisplayItem read(long id) throws OverflowException { + public MetaSensorDisplayItem read(Long id) throws OverflowException { return this.displayItemDAO.findOne(id); } diff --git a/src/main/java/com/loafle/overflow/central/module/noauthprobe/dao/NoAuthProbeDAO.java b/src/main/java/com/loafle/overflow/central/module/noauthprobe/dao/NoAuthProbeDAO.java index 7f1d6f7..21bafd1 100644 --- a/src/main/java/com/loafle/overflow/central/module/noauthprobe/dao/NoAuthProbeDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/noauthprobe/dao/NoAuthProbeDAO.java @@ -1,11 +1,9 @@ package com.loafle.overflow.central.module.noauthprobe.dao; -import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.noauthprobe.NoAuthProbe; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -18,8 +16,8 @@ public interface NoAuthProbeDAO extends JpaRepository { NoAuthProbe findByTempProbeKey(String tempProbeKey); - @Query("SELECT n FROM NoAuthProbe n WHERE n.domain.id = :#{#domain.id} and n.status.id = 3") // 3 = Process - List findAllByDomain(@Param("domain") Domain domain); + @Query("SELECT n FROM NoAuthProbe n WHERE n.domain.id = :#{#domainID} and n.status.id = 3") // 3 = Process + List findAllByDomainId(Long domainID); // NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent); // List findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent); diff --git a/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java b/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java index c944212..15d7769 100644 --- a/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java +++ b/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java @@ -92,18 +92,19 @@ public class CentralNoAuthProbeService implements NoAuthProbeService { return this.noAuthProbeDAO.save(noAuthProbe); } - public List readAllByDomain(Domain domain) throws OverflowException { + public List readAllByDomainID(Long domainID) throws OverflowException { - return this.noAuthProbeDAO.findAllByDomain(domain); + return this.noAuthProbeDAO.findAllByDomainId(domainID); } - public NoAuthProbe read(long id) { + public NoAuthProbe read(Long id) { return this.noAuthProbeDAO.findOne(id); } @WebappAPI @Transactional - public List acceptNoAuthProbe(NoAuthProbe noAuthProbe) throws OverflowException { + public List acceptNoAuthProbe(Long noAuthProbeID) throws OverflowException { + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID); NoAuthProbeDescription noAuthProbeDescription = null; try { @@ -124,7 +125,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService { messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Accept", probe.getProbeKey()); - return this.readAllByDomain(noAuthProbe.getDomain()); + return this.readAllByDomainID(noAuthProbe.getDomain().getId()); } private Probe newProbe(NoAuthProbe noauthprobe, NoAuthProbeDescription noAuthProbeDescription) throws OverflowException { @@ -203,13 +204,15 @@ public class CentralNoAuthProbeService implements NoAuthProbeService { } @WebappAPI - public List denyNoauthProbe(NoAuthProbe noAuthProbe) throws OverflowException { + public List denyNoauthProbe(Long noAuthProbeID) throws OverflowException { + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID); + noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 2)); this.noAuthProbeDAO.save(noAuthProbe); messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Deny"); - return this.readAllByDomain(noAuthProbe.getDomain()); + return this.readAllByDomainID(noAuthProbe.getDomain().getId()); } public NoAuthProbe readByTempProbeKey(String tempKey) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeDAO.java b/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeDAO.java index 5345516..88f4543 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeDAO.java @@ -1,6 +1,5 @@ package com.loafle.overflow.central.module.probe.dao; -import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.probe.Probe; import org.springframework.data.jpa.repository.JpaRepository; @@ -16,7 +15,7 @@ import java.util.List; public interface ProbeDAO extends JpaRepository { Probe findByProbeKey(String probeKey); - List findAllByDomainOrderByIdDesc(Domain domain); + List findAllByDomainIdOrderByIdDesc(Long domainID); // @Modifying(clearAutomatically = true) // @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress = :connectAddress where p.probeKey = :probeKey") diff --git a/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeHostDAO.java b/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeHostDAO.java index 4e8bd2c..6da4760 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeHostDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeHostDAO.java @@ -2,8 +2,6 @@ package com.loafle.overflow.central.module.probe.dao; import java.util.List; -import com.loafle.overflow.model.domain.Domain; -import com.loafle.overflow.model.probe.Probe; import com.loafle.overflow.model.probe.ProbeHost; import org.springframework.data.jpa.repository.JpaRepository; @@ -17,8 +15,8 @@ import org.springframework.stereotype.Repository; */ @Repository public interface ProbeHostDAO extends JpaRepository { - ProbeHost findByProbe(Probe probe); + ProbeHost findByProbeId(Long probeID); - @Query("SELECT h FROM ProbeHost h WHERE h.probe.domain = (:domain)") - List findAllByDomain(@Param("domain")Domain domain); + @Query("SELECT h FROM ProbeHost h WHERE h.probe.domain.id = (:domainID)") + List findAllByDomainId(@Param("domainID")Long domainID); } diff --git a/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeTaskDAO.java b/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeTaskDAO.java index 38f8b23..98690ce 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeTaskDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/dao/ProbeTaskDAO.java @@ -5,7 +5,6 @@ import org.springframework.stereotype.Repository; import java.util.List; -import com.loafle.overflow.model.probe.Probe; import com.loafle.overflow.model.probe.ProbeTask; /** @@ -13,5 +12,5 @@ import com.loafle.overflow.model.probe.ProbeTask; */ @Repository public interface ProbeTaskDAO extends JpaRepository { - List findAllByProbe(Probe probe); + List findAllByProbeId(Long probeID); } diff --git a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java index 91959a5..f940915 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java @@ -21,20 +21,20 @@ public class CentralProbeHostService implements ProbeHostService { @Autowired private ProbeHostDAO probeHostDAO; - public ProbeHost read(long id) throws OverflowException { + public ProbeHost read(Long id) throws OverflowException { return this.probeHostDAO.findOne(id); } - public ProbeHost readByProbe(Probe probe) throws OverflowException { - return this.probeHostDAO.findByProbe(probe); + public ProbeHost readByProbeID(Long probeID) throws OverflowException { + return this.probeHostDAO.findByProbeId(probeID); } public ProbeHost regist(ProbeHost probeHost) throws OverflowException { return this.probeHostDAO.save(probeHost); } - public List readAllByDomain(Domain domain) throws OverflowException { - return this.probeHostDAO.findAllByDomain(domain); + public List readAllByDomainID(Long domainID) throws OverflowException { + return this.probeHostDAO.findAllByDomainId(domainID); } } diff --git a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java index e4e234e..c07e8b7 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java @@ -32,12 +32,12 @@ public class CentralProbeService implements ProbeService { return this.probeDAO.save(probes); } - public List readAllByDomain(Domain domain) throws OverflowException { - List probes = this.probeDAO.findAllByDomainOrderByIdDesc(domain); + public List readAllByDomainID(Long domainID) throws OverflowException { + List probes = this.probeDAO.findAllByDomainIdOrderByIdDesc(domainID); return probes; } - public Probe read(long id) throws OverflowException { + public Probe read(Long id) throws OverflowException { return this.probeDAO.findOne(id); } @@ -49,7 +49,7 @@ public class CentralProbeService implements ProbeService { return this.probeDAO.save(probe); } - public boolean remove(long id) throws OverflowException { + public boolean remove(Long id) throws OverflowException { this.probeDAO.delete(id); return true; } @@ -69,7 +69,7 @@ public class CentralProbeService implements ProbeService { return this.probeDAO.save(p); } - public Probe modifyDisplayName(long probeId, String displayName) { + public Probe modifyDisplayName(Long probeId, String displayName) { Probe probe = this.probeDAO.findOne(probeId); probe.setDisplayName(displayName); return this.probeDAO.save(probe); diff --git a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeTaskService.java b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeTaskService.java index 9c60ab2..31c74e5 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeTaskService.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeTaskService.java @@ -24,7 +24,7 @@ public class CentralProbeTaskService implements ProbeTaskService{ return this.probeTaskDAO.save(probeTask); } - public List readAllByProbe(Probe probe) throws OverflowException { - return this.probeTaskDAO.findAllByProbe(probe); + public List readAllByProbeID(Long probeID) throws OverflowException { + return this.probeTaskDAO.findAllByProbeId(probeID); } } diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/dao/SensorDAO.java b/src/main/java/com/loafle/overflow/central/module/sensor/dao/SensorDAO.java index 998ca3f..d1efeee 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/dao/SensorDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/dao/SensorDAO.java @@ -18,9 +18,8 @@ import com.loafle.overflow.model.target.Target; */ @Repository public interface SensorDAO extends JpaRepository { - - Page findAllByTarget(Target target, Pageable pageable); - List findAllByTarget(Target target); + Page findAllByTargetId(Long targetID, Pageable pageable); + List findAllByTargetId(Long targetID); @Query("SELECT s from Sensor s WHERE s.target in (:targetList)") Page findAllByTargetList(@Param("targetList") List targetList, Pageable pageable); diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java index 6d1ed75..fc26dc6 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java @@ -55,9 +55,9 @@ public class CentralSensorService implements SensorService { return this.sensorDAO.save(sensor); } - public Page readAllByDomain(Domain domain, PageParams pageParams) throws OverflowException { + public Page readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException { - List probeList = this.probeService.readAllByDomain(domain); + List probeList = this.probeService.readAllByDomainID(domainID); if (probeList == null || probeList.size() <= 0) { throw new OverflowException("", new Throwable()); @@ -72,37 +72,40 @@ public class CentralSensorService implements SensorService { return this.sensorDAO.findAllByTargetList(targetList, PageUtil.getPageRequest(pageParams)); } - public Page readAllByInfra(long infraId, PageParams pageParams) throws OverflowException { - Infra dbInfra = this.infraService.read(infraId); + public Page readAllByInfraID(Long infraID, PageParams pageParams) throws OverflowException { + Infra dbInfra = this.infraService.read(infraID); if (dbInfra == null || dbInfra.getTarget() == null) { throw new OverflowException("", new Throwable()); } - return this.sensorDAO.findAllByTarget(dbInfra.getTarget(), PageUtil.getPageRequest(pageParams)); + return this.sensorDAO.findAllByTargetId(dbInfra.getTarget().getId(), PageUtil.getPageRequest(pageParams)); } - public Page readAllByTarget(Target target, PageParams pageParams) throws OverflowException { - return this.sensorDAO.findAllByTarget(target, PageUtil.getPageRequest(pageParams)); + public Page readAllByTargetID(Long targetID, PageParams pageParams) throws OverflowException { + return this.sensorDAO.findAllByTargetId(targetID, PageUtil.getPageRequest(pageParams)); } - public Sensor read(String id) throws OverflowException { + public Sensor read(Long id) throws OverflowException { return this.sensorDAO.findOne(Long.valueOf(id)); } @Transactional - public void remove(Sensor sensor) throws OverflowException { + public void remove(Long sensorID) throws OverflowException { + Sensor sensor = this.sensorDAO.findOne(sensorID); this.targetService.decreaseSensorCount(sensor.getTarget()); this.sensorDAO.delete(sensor); } - public Sensor start(Sensor sensor) throws OverflowException { + public Sensor start(Long sensorID) throws OverflowException { + Sensor sensor = this.sensorDAO.findOne(sensorID); MetaSensorStatus status = new MetaSensorStatus((short) 1); sensor.setStatus(status); return this.sensorDAO.save(sensor); } - public Sensor stop(Sensor sensor) throws OverflowException { + public Sensor stop(Long sensorID) throws OverflowException { + Sensor sensor = this.sensorDAO.findOne(sensorID); MetaSensorStatus status = new MetaSensorStatus((short) 2); sensor.setStatus(status); return this.sensorDAO.save(sensor); diff --git a/src/main/java/com/loafle/overflow/central/redis/service/RedisMessagePublisher.java b/src/main/java/com/loafle/overflow/central/redis/service/RedisMessagePublisher.java index 3534233..b1154f1 100644 --- a/src/main/java/com/loafle/overflow/central/redis/service/RedisMessagePublisher.java +++ b/src/main/java/com/loafle/overflow/central/redis/service/RedisMessagePublisher.java @@ -43,7 +43,7 @@ public class RedisMessagePublisher implements MessagePublisher { this.topics = topics; } - public void publishToDomainMembers(final long domainID, final String method, final Object... params) + public void publishToDomainMembers(final Long domainID, final String method, final Object... params) throws OverflowException { PublishMessage message = new PublishMessage(); message.setTargetType(PublishMessage.TargetType.MEMBER); @@ -92,7 +92,7 @@ public class RedisMessagePublisher implements MessagePublisher { } @Cacheable("memberListByDomain") - protected List getMemberListByDomainID(final long domainID) throws OverflowException { + protected List getMemberListByDomainID(final Long domainID) throws OverflowException { return this.getMemberList(memberService.readAllByDomainID(domainID)); } diff --git a/src/main/resources/local/database.properties b/src/main/resources/local/database.properties index a04336a..e8c1188 100644 --- a/src/main/resources/local/database.properties +++ b/src/main/resources/local/database.properties @@ -1,4 +1,4 @@ -datasource.url=jdbc:postgresql://192.168.1.101:5432/overflow +datasource.url=jdbc:postgresql://192.168.1.50:5432/overflow datasource.username=overflow datasource.password=qwer5795 datasource.driver-class-name=org.postgresql.Driver diff --git a/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java b/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java index 56ce348..d26db65 100644 --- a/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java @@ -35,14 +35,14 @@ public class ApiKeyServiceTest { apiKey.setApiKey("70124b775bd511e7b059080027658d13"); Domain domain = new Domain(); - domain.setId(1); + domain.setId(Long.valueOf(1)); apiKey.setDomain(domain); this.apiKeyService.regist(apiKey); - Assert.assertNotEquals(apiKey.getId(), 0); + Assert.assertNotEquals(apiKey.getId().longValue(), 0); } @Ignore @@ -61,11 +61,7 @@ public class ApiKeyServiceTest { @Ignore @Test public void findByDomain() throws OverflowException { - - Domain domain = new Domain(); - domain.setId(1); - - ApiKey apiKey = this.apiKeyService.readByDomain(domain); + ApiKey apiKey = this.apiKeyService.readByDomainID(Long.valueOf(1)); Assert.assertNotEquals(apiKey, null); diff --git a/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java b/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java index ad5155f..26c6242 100644 --- a/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java @@ -28,7 +28,7 @@ public class AuthCrawlerServiceTest { AuthCrawler authCrawler = new AuthCrawler(); Target target = new Target(); - target.setId(4); + target.setId(Long.valueOf(4)); authCrawler.setTarget(target); @@ -43,7 +43,7 @@ public class AuthCrawlerServiceTest { this.authCrawlerService.regist(authCrawler); - Assert.assertNotEquals(authCrawler.getId(), 0); + Assert.assertNotEquals(authCrawler.getId().longValue(), 0); } @@ -54,7 +54,7 @@ public class AuthCrawlerServiceTest { metaCrawler.setId((short)23); Target target = new Target(); - target.setId(5); + target.setId(Long.valueOf(5)); AuthCrawler authCrawler = this.authCrawlerService.readAuth(metaCrawler, target); diff --git a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java index fd7c116..459b865 100644 --- a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java @@ -36,27 +36,23 @@ public class DomainMemberServiceTest { DomainMember domainMember = new DomainMember(); Domain domain = new Domain(); - domain.setId(1); + domain.setId(Long.valueOf(1)); Member member = new Member(); - member.setId(1); + member.setId(Long.valueOf(1)); domainMember.setDomain(domain); domainMember.setMember(member); this.domainMemberService.regist(domainMember); - Assert.assertNotEquals(domainMember.getId(), 0); + Assert.assertNotEquals(domainMember.getId().longValue(), 0); } @Test public void readAllMemberByDomain() throws OverflowException { - - Domain domain = new Domain(); - domain.setId(1); - - List members = this.domainMemberService.readAllMemberByDomain(domain); + List members = this.domainMemberService.readAllMemberByDomainID(Long.valueOf(1)); Assert.assertNotEquals(members.size(), 0); diff --git a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java index 3280996..1887bea 100644 --- a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java @@ -33,7 +33,7 @@ public class DomainServiceTest { this.domainService.regist(domain); - Assert.assertNotEquals(domain.getId(), 0); + Assert.assertNotEquals(domain.getId().longValue(), 0); } } \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java b/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java index 5acc2c6..f9ac2ce 100644 --- a/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java @@ -30,7 +30,7 @@ public class EmailAuthServiceTest { @Ignore public void TestMailSend() throws Exception { Member member = new Member(); - member.setId(1); + member.setId(Long.valueOf(1)); member.setEmail("overflow@loafle.com"); this.emailAuthService.sendEmailByMember(member); } @@ -39,7 +39,7 @@ public class EmailAuthServiceTest { public void TestCompareDate() throws Exception { Calendar cal = Calendar.getInstance(); - EmailAuth auth = emailAuthService.read(1); + EmailAuth auth = emailAuthService.read(Long.valueOf(1)); cal.setTime(auth.getCreateDate()); cal.add(Calendar.HOUR, 12); diff --git a/src/test/java/com/loafle/overflow/central/module/history/service/HistoryServiceTest.java b/src/test/java/com/loafle/overflow/central/module/history/service/HistoryServiceTest.java index fc4b598..b52328a 100644 --- a/src/test/java/com/loafle/overflow/central/module/history/service/HistoryServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/history/service/HistoryServiceTest.java @@ -35,9 +35,9 @@ public class HistoryServiceTest { Random rand = new Random(); for (int i=0;i<100;i++) { History h = new History(); - h.setMember(new Member(1)); - h.setProbe(new Probe(rand.nextBoolean() ? 1 : 2)); - h.setDomain(new Domain(1)); + h.setMember(new Member(Long.valueOf(1))); + h.setProbe(new Probe(rand.nextBoolean() ? Long.valueOf(1) : Long.valueOf(2))); + h.setDomain(new Domain(Long.valueOf(1))); h.setType(new MetaHistoryType(rand.nextInt((6 - 1) + 1) + 1)); h.setMessage("Test History " + i); this.historyService.regist(h); @@ -60,7 +60,7 @@ public class HistoryServiceTest { p.setSortCol("type.name"); p.setSortDirection("descending"); - Page result = this.historyService.readAllByProbe(new Probe(1), p); + Page result = this.historyService.readAllByProbeID(Long.valueOf(1), p); for (History h : result.getContent()) { System.out.println(h.getId()); } diff --git a/src/test/java/com/loafle/overflow/central/module/infra/dao/InfraDAOTest.java b/src/test/java/com/loafle/overflow/central/module/infra/dao/InfraDAOTest.java index c790393..e3e8bb8 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/dao/InfraDAOTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/dao/InfraDAOTest.java @@ -28,7 +28,7 @@ public class InfraDAOTest { List probes = new ArrayList<>(); Probe probe = new Probe(); - probe.setId(1); + probe.setId(Long.valueOf(1)); probes.add(probe); diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraHostServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraHostServiceTest.java index 604e34b..6db89eb 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraHostServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraHostServiceTest.java @@ -37,7 +37,7 @@ public class InfraHostServiceTest { infraHost.setMac("30-9C-23-15-A3-09"); infraHost.setIpv4("192.168.1.1"); InfraOS infraOS = new InfraOS(); - infraOS.setId(2); + infraOS.setId(Long.valueOf(2)); infraHost.setOs(infraOS); @@ -47,14 +47,14 @@ public class InfraHostServiceTest { this.infraHostService.regist(infraHost); - Assert.assertNotEquals(infraHost.getId(), 0 ); + Assert.assertNotEquals(infraHost.getId().longValue(), 0 ); } @Test public void read() throws Exception { - InfraHost infraHost = this.infraHostService.read(1); + InfraHost infraHost = this.infraHostService.read(Long.valueOf(1)); String json = objectMapper.writeValueAsString(infraHost); diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraMachineServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraMachineServiceTest.java index a2c2d91..3205f3f 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraMachineServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraMachineServiceTest.java @@ -42,7 +42,7 @@ public class InfraMachineServiceTest { this.infraMachineService.regist(infraMachine); - Assert.assertNotEquals(infraMachine.getId(), 0); + Assert.assertNotEquals(infraMachine.getId().longValue(), 0); } @@ -51,7 +51,7 @@ public class InfraMachineServiceTest { // regist(); - InfraMachine infraMachine = this.infraMachineService.read(1); + InfraMachine infraMachine = this.infraMachineService.read(Long.valueOf(1)); String json = objectMapper.writeValueAsString(infraMachine); System.out.println(json); diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSApplicationServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSApplicationServiceTest.java index d6826be..3dffda8 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSApplicationServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSApplicationServiceTest.java @@ -36,7 +36,7 @@ public class InfraOSApplicationServiceTest { infraOSApplication.setName("Apache"); InfraOS infraOS = new InfraOS(); - infraOS.setId(2); + infraOS.setId(Long.valueOf(2)); infraOSApplication.setOs(infraOS); @@ -46,14 +46,14 @@ public class InfraOSApplicationServiceTest { this.infraOSApplicationService.regist(infraOSApplication); - Assert.assertNotEquals(infraOSApplication.getId(), 0); + Assert.assertNotEquals(infraOSApplication.getId().longValue(), 0); } @Test public void read() throws Exception { - InfraOSApplication infraOSApplication = this.infraOSApplicationService.read(1); + InfraOSApplication infraOSApplication = this.infraOSApplicationService.read(Long.valueOf(1)); Assert.assertNotNull(infraOSApplication); diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSDaemonServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSDaemonServiceTest.java index 93a8a79..9f0a5cf 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSDaemonServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSDaemonServiceTest.java @@ -36,7 +36,7 @@ public class InfraOSDaemonServiceTest { infraOSDaemon.setName("Apache"); InfraOS infraOS = new InfraOS(); - infraOS.setId(2); + infraOS.setId(Long.valueOf(2)); infraOSDaemon.setOs(infraOS); @@ -46,14 +46,14 @@ public class InfraOSDaemonServiceTest { this.infraOSDaemonService.regist(infraOSDaemon); - Assert.assertNotEquals(infraOSDaemon.getId(), 0); + Assert.assertNotEquals(infraOSDaemon.getId().longValue(), 0); } @Test public void read() throws Exception { - InfraOSDaemon infraOSDaemon = this.infraOSDaemonService.read(1); + InfraOSDaemon infraOSDaemon = this.infraOSDaemonService.read(Long.valueOf(1)); Assert.assertNotNull(infraOSDaemon); String json = objectMapper.writeValueAsString(infraOSDaemon); diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSPortServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSPortServiceTest.java index cfefd2e..a3fa625 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSPortServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSPortServiceTest.java @@ -37,7 +37,7 @@ public class InfraOSPortServiceTest { infraOSPort.setPortType("TCP"); InfraOS infraOS = new InfraOS(); - infraOS.setId(1); + infraOS.setId(Long.valueOf(1)); MetaInfraType metaInfraType = new MetaInfraType(); metaInfraType.setId(2); @@ -58,7 +58,7 @@ public class InfraOSPortServiceTest { InfraOSPort infraOSPort; try { - infraOSPort = this.infraOSPortService.readByPort(1, 22, "TCP"); + infraOSPort = this.infraOSPortService.readByPort(Long.valueOf(1), 22, "TCP"); Assert.assertNotEquals(infraOSPort, null); } catch (OverflowException e) { // TODO Auto-generated catch block diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSServiceTest.java index 70adbbc..57b26bc 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/InfraOSServiceTest.java @@ -40,7 +40,7 @@ public class InfraOSServiceTest { infraOS.setMeta(""); InfraMachine infraMachine = new InfraMachine(); - infraMachine.setId(1); + infraMachine.setId(Long.valueOf(1)); MetaInfraType metaInfraType = new MetaInfraType(); metaInfraType.setId(3); @@ -55,7 +55,7 @@ public class InfraOSServiceTest { @Test public void read() throws Exception { - InfraOS infraOS = this.infraOSService.read(1); + InfraOS infraOS = this.infraOSService.read(Long.valueOf(1)); String json = objectMapper.writeValueAsString(infraOS); System.out.println(json); } diff --git a/src/test/java/com/loafle/overflow/central/module/target/service/TargetDiscoveryServiceTest.java b/src/test/java/com/loafle/overflow/central/module/target/service/TargetDiscoveryServiceTest.java index 1724465..26bec29 100644 --- a/src/test/java/com/loafle/overflow/central/module/target/service/TargetDiscoveryServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/target/service/TargetDiscoveryServiceTest.java @@ -60,7 +60,7 @@ Probe probe = new Probe(); - probe.setId(1); + probe.setId(Long.valueOf(1)); this.targetDiscoveryService.saveAllTarget(hosts, probe); } diff --git a/src/test/resources/database.properties b/src/test/resources/database.properties index e8c1188..a04336a 100644 --- a/src/test/resources/database.properties +++ b/src/test/resources/database.properties @@ -1,4 +1,4 @@ -datasource.url=jdbc:postgresql://192.168.1.50:5432/overflow +datasource.url=jdbc:postgresql://192.168.1.101:5432/overflow datasource.username=overflow datasource.password=qwer5795 datasource.driver-class-name=org.postgresql.Driver