diff --git a/.vscode/launch.test.json b/.vscode/launch.test.json new file mode 100644 index 0000000..f5ce1ed --- /dev/null +++ b/.vscode/launch.test.json @@ -0,0 +1,28 @@ +{ + "run": { + "default": "", + "items": [ + { + "name": "central", + "projectName": "central", + "workingDirectory": "/project/loafle/overflow/central", + "args": [], + "vmargs": [], + "preLaunchTask": "" + } + ] + }, + "debug": { + "default": "", + "items": [ + { + "name": "central", + "projectName": "central", + "workingDirectory": "/project/loafle/overflow/central", + "args": [], + "vmargs": [], + "preLaunchTask": "" + } + ] + } +} \ No newline at end of file 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 55ac110..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 @@ -48,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); } @@ -125,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..34629d3 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,6 +1,5 @@ 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; @@ -18,8 +17,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(@Param("domainID") 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 d455936..5b9ed5c 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 @@ -5,7 +5,6 @@ import com.loafle.overflow.core.annotation.ProbeAPI; import com.loafle.overflow.core.annotation.WebappAPI; import com.loafle.overflow.central.commons.utils.GenerateKey; import com.loafle.overflow.central.commons.utils.SessionMetadata; -import com.loafle.overflow.central.commons.utils.StringConvertor; import com.loafle.overflow.central.module.noauthprobe.dao.NoAuthProbeDAO; import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.model.apikey.ApiKey; @@ -20,6 +19,9 @@ import com.loafle.overflow.model.meta.MetaInfraVendor; import com.loafle.overflow.model.meta.MetaNoAuthProbeStatus; import com.loafle.overflow.model.meta.MetaProbeStatus; import com.loafle.overflow.model.noauthprobe.NoAuthProbe; +import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescription; +import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescriptionHost; +import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescriptionNetwork; import com.loafle.overflow.model.probe.Probe; import com.loafle.overflow.model.probe.ProbeHost; import com.loafle.overflow.service.central.apikey.ApiKeyService; @@ -32,16 +34,13 @@ import com.loafle.overflow.service.central.probe.ProbeHostService; import com.loafle.overflow.service.central.probe.ProbeService; import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.TypeReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; import java.io.IOException; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.UUID; import javax.transaction.Transactional; @@ -52,190 +51,189 @@ import javax.transaction.Transactional; @Service("NoAuthProbeService") public class CentralNoAuthProbeService implements NoAuthProbeService { - @Autowired - private NoAuthProbeDAO noAuthProbeDAO; + @Autowired + private NoAuthProbeDAO noAuthProbeDAO; - @Autowired - private ApiKeyService apiKeyService; + @Autowired + private ApiKeyService apiKeyService; - @Autowired - private ProbeService probeService; + @Autowired + private ProbeService probeService; - @Autowired - private MessagePublisher messagePublisher; + @Autowired + private MessagePublisher messagePublisher; - @Autowired - private DomainMemberService domainMemberService; + @Autowired + private DomainMemberService domainMemberService; - @Autowired - private ObjectMapper objectMapper; + @Autowired + private ObjectMapper objectMapper; - @Autowired - private InfraMachineService infraMachineService; - @Autowired - private InfraOSService infraOSService; - @Autowired - private InfraHostService infraHostService; - @Autowired - private ProbeHostService probeHostService; + @Autowired + private InfraMachineService infraMachineService; + @Autowired + private InfraOSService infraOSService; + @Autowired + private InfraHostService infraHostService; + @Autowired + private ProbeHostService probeHostService; - @ProbeAPI - public NoAuthProbe regist(NoAuthProbe noAuthProbe) throws OverflowException { + @ProbeAPI + public NoAuthProbe regist(NoAuthProbe noAuthProbe) throws OverflowException { - ApiKey apiKey = apiKeyService.readByApiKey(noAuthProbe.getApiKey()); - noAuthProbe.setDomain(apiKey.getDomain()); + ApiKey apiKey = apiKeyService.readByApiKey(noAuthProbe.getApiKey()); + noAuthProbe.setDomain(apiKey.getDomain()); - noAuthProbe.setTempProbeKey(GenerateKey.getKey()); - noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 3)); + noAuthProbe.setTempProbeKey(GenerateKey.getKey()); + noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 3)); - messagePublisher.publishToDomainMembers(apiKey.getDomain().getId(), "NoAuthProbeService.regist", noAuthProbe); + messagePublisher.publishToDomainMembers(apiKey.getDomain().getId(), "NoAuthProbeService.regist", noAuthProbe); - return this.noAuthProbeDAO.save(noAuthProbe); + return this.noAuthProbeDAO.save(noAuthProbe); + } + + public List readAllByDomainID(Long domainID) throws OverflowException { + + return this.noAuthProbeDAO.findAllByDomainId(domainID); + } + + public NoAuthProbe read(Long id) { + return this.noAuthProbeDAO.findOne(id); + } + + @WebappAPI + @Transactional + public List acceptNoAuthProbe(Long noAuthProbeID) throws OverflowException { + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID); + + NoAuthProbeDescription noAuthProbeDescription = null; + try { + noAuthProbeDescription = this.objectMapper.readValue(noAuthProbe.getDescription(), NoAuthProbeDescription.class); + } catch (IOException e) { + throw new OverflowException("json error", e); } - public List readAllByDomain(Domain domain) throws OverflowException { + Probe probe = this.newProbe(noAuthProbe, noAuthProbeDescription); + InfraMachine machine = this.newInfraMachine(noAuthProbe); + InfraOS os = this.newInfraOS(machine, noAuthProbeDescription.getHost()); + InfraHost host = this.newInfraHost(os, noAuthProbeDescription.getNetwork()); + this.newProbeHost(host, probe); - return this.noAuthProbeDAO.findAllByDomain(domain); - } + noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 1)); + this.noAuthProbeDAO.save(noAuthProbe); - public NoAuthProbe read(long id) { - return this.noAuthProbeDAO.findOne(id); - } + messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Accept", probe.getProbeKey()); - @WebappAPI - @Transactional - public List acceptNoAuthProbe(NoAuthProbe noAuthProbe) throws OverflowException { + return this.readAllByDomainID(noAuthProbe.getDomain().getId()); + } - HashMap objMap; - try { - objMap = this.objectMapper.readValue(noAuthProbe.getDescription(), new TypeReference>(){}); - } catch (IOException e) { - throw new OverflowException("json error", e); - } + private Probe newProbe(NoAuthProbe noauthprobe, NoAuthProbeDescription noAuthProbeDescription) throws OverflowException { - Map hostMap = (Map) objMap.get("host"); - Map netMap = (Map) objMap.get("network"); + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + String encryptKey = passwordEncoder.encode(UUID.randomUUID().toString()); - Probe probe = this.newProbe(noAuthProbe, hostMap, netMap); - InfraMachine machine = this.newInfraMachine(noAuthProbe); - InfraOS os = this.newInfraOS(machine, hostMap); - InfraHost host = this.newInfraHost(os, netMap); - this.newProbeHost(host, probe); + ApiKey apiKey = apiKeyService.readByApiKey(noauthprobe.getApiKey()); + String memberEmail = SessionMetadata.getTargetID(); + DomainMember domainMember = domainMemberService.readByMemberEmail(memberEmail); - noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 1)); - this.noAuthProbeDAO.save(noAuthProbe); + Probe probe = new Probe(); + probe.setEncryptionKey(encryptKey); + probe.setProbeKey(GenerateKey.getKey()); + probe.setDomain(new Domain(apiKey.getDomain().getId())); + probe.setAuthorizeMember(new Member(domainMember.getMember().getId())); + probe.setTargetCount(0); + probe.setStatus(new MetaProbeStatus((short) 1)); - messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Accept", - probe.getProbeKey()); + String dispName = noAuthProbeDescription.getHost().getName(); + dispName += " probe"; + probe.setDisplayName(dispName); - return this.readAllByDomain(noAuthProbe.getDomain()); - } + String addrStr = noAuthProbeDescription.getNetwork().getAddress(); + String[] addrArr = addrStr.split("\\|"); + probe.setCidr(addrArr[0]); - private Probe newProbe(NoAuthProbe noauthprobe, Map hostMap, Map netMap) throws OverflowException { + return this.probeService.regist(probe); + } - BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - String encryptKey = passwordEncoder.encode(UUID.randomUUID().toString()); + private InfraMachine newInfraMachine(NoAuthProbe noauthprobe) throws OverflowException { + MetaInfraType infraType = new MetaInfraType(); + infraType.setId(1); - ApiKey apiKey = apiKeyService.readByApiKey(noauthprobe.getApiKey()); - String memberEmail = SessionMetadata.getTargetID(); - DomainMember domainMember = domainMemberService.readByMemberEmail(memberEmail); + InfraMachine infraMachine = new InfraMachine(); + infraMachine.setMeta(noauthprobe.getDescription()); + infraMachine.setInfraType(infraType); - Probe probe = new Probe(); - probe.setEncryptionKey(encryptKey); - probe.setProbeKey(GenerateKey.getKey()); - probe.setDomain(new Domain(apiKey.getDomain().getId())); - probe.setAuthorizeMember(new Member(domainMember.getMember().getId())); - probe.setTargetCount(0); - probe.setStatus(new MetaProbeStatus((short) 1)); + return this.infraMachineService.regist(infraMachine); + } - String dispName = hostMap.get("name"); - dispName += " probe"; - probe.setDisplayName(dispName); + private InfraOS newInfraOS(InfraMachine infraMachine, NoAuthProbeDescriptionHost noAuthProbeDescriptionHost) throws OverflowException { + MetaInfraType infraType = new MetaInfraType(); + infraType.setId(3); - String addrStr = netMap.get("address"); - String[] addrArr = addrStr.split("\\|"); - probe.setCidr(addrArr[0]); + InfraOS infraOS = new InfraOS(); + infraOS.setMachine(infraMachine); + infraOS.setInfraType(infraType); + infraOS.setVendor(MetaInfraVendor.CreateInfraVendorByOS(noAuthProbeDescriptionHost.getOS())); - return this.probeService.regist(probe); - } + return this.infraOSService.regist(infraOS); + } - private InfraMachine newInfraMachine(NoAuthProbe noauthprobe) throws OverflowException { - MetaInfraType infraType = new MetaInfraType(); - infraType.setId(1); + private InfraHost newInfraHost(InfraOS infraOS, NoAuthProbeDescriptionNetwork noAuthProbeDescriptionNetwork) throws OverflowException { + MetaInfraType infraType = new MetaInfraType(); + infraType.setId(2); - InfraMachine infraMachine = new InfraMachine(); - infraMachine.setMeta(noauthprobe.getDescription()); - infraMachine.setInfraType(infraType); + InfraHost infraHost = new InfraHost(); + String addrStr = noAuthProbeDescriptionNetwork.getAddress(); + String[] addrArr = addrStr.split("\\|"); - return this.infraMachineService.regist(infraMachine); - } + infraHost.setIpv4(addrArr[0]); + infraHost.setMac(noAuthProbeDescriptionNetwork.getMacAddress()); + infraHost.setOs(infraOS); + infraHost.setInfraType(infraType); - private InfraOS newInfraOS(InfraMachine infraMachine, Map hostMap) throws OverflowException { - MetaInfraType infraType = new MetaInfraType(); - infraType.setId(3); + return this.infraHostService.regist(infraHost); + } - InfraOS infraOS = new InfraOS(); - infraOS.setMachine(infraMachine); - infraOS.setInfraType(infraType); - infraOS.setVendor(MetaInfraVendor.CreateInfraVendorByOS(hostMap.get("os"))); + private void newProbeHost(InfraHost infraHost, Probe probe) throws OverflowException { + ProbeHost probeHost = new ProbeHost(); + probeHost.setHost(infraHost); + probeHost.setProbe(probe); - return this.infraOSService.regist(infraOS); - } + this.probeHostService.regist(probeHost); + } - private InfraHost newInfraHost(InfraOS infraOS, Map netMap) throws OverflowException { - MetaInfraType infraType = new MetaInfraType(); - infraType.setId(2); + @WebappAPI + public List denyNoauthProbe(Long noAuthProbeID) throws OverflowException { + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID); - InfraHost infraHost = new InfraHost(); - String addrStr = netMap.get("address"); - String[] addrArr = addrStr.split("\\|"); + noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 2)); + this.noAuthProbeDAO.save(noAuthProbe); - infraHost.setIpv4(addrArr[0]); - infraHost.setMac(netMap.get("macAddress")); - infraHost.setOs(infraOS); - infraHost.setInfraType(infraType); + messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Deny"); - return this.infraHostService.regist(infraHost); - } + return this.readAllByDomainID(noAuthProbe.getDomain().getId()); + } - private void newProbeHost(InfraHost infraHost, Probe probe) throws OverflowException { - ProbeHost probeHost = new ProbeHost(); - probeHost.setHost(infraHost); - probeHost.setProbe(probe); + public NoAuthProbe readByTempProbeKey(String tempKey) throws OverflowException { + return this.noAuthProbeDAO.findByTempProbeKey(tempKey); + } - this.probeHostService.regist(probeHost); - } + public void onConnect(String tempKey, String connectAddress) throws OverflowException { + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findByTempProbeKey(tempKey); + noAuthProbe.setConnectDate(new Date()); + noAuthProbe.setConnectAddress(connectAddress); + noAuthProbe = this.noAuthProbeDAO.save(noAuthProbe); - @WebappAPI - public List denyNoauthProbe(NoAuthProbe noAuthProbe) throws OverflowException { - noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 2)); - this.noAuthProbeDAO.save(noAuthProbe); + messagePublisher.publishToDomainMembers(noAuthProbe.getDomain().getId(), "NoAuthProbeService.onConnect", noAuthProbe); + } - messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Deny"); + public void onDisconnect(String tempKey) throws OverflowException { + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findByTempProbeKey(tempKey); + noAuthProbe.setConnectDate(null); + noAuthProbe.setConnectAddress(null); + noAuthProbe = this.noAuthProbeDAO.save(noAuthProbe); - return this.readAllByDomain(noAuthProbe.getDomain()); - } - - public NoAuthProbe readByTempProbeKey(String tempKey) throws OverflowException { - return this.noAuthProbeDAO.findByTempProbeKey(tempKey); - } - - public void onConnect(String tempKey, String connectAddress) throws OverflowException { - NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findByTempProbeKey(tempKey); - noAuthProbe.setConnectDate(new Date()); - noAuthProbe.setConnectAddress(connectAddress); - noAuthProbe = this.noAuthProbeDAO.save(noAuthProbe); - - messagePublisher.publishToDomainMembers(noAuthProbe.getDomain().getId(), "NoAuthProbeService.onConnect", noAuthProbe); - } - - public void onDisconnect(String tempKey) throws OverflowException { - NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findByTempProbeKey(tempKey); - noAuthProbe.setConnectDate(null); - noAuthProbe.setConnectAddress(null); - noAuthProbe = this.noAuthProbeDAO.save(noAuthProbe); - - messagePublisher.publishToDomainMembers(noAuthProbe.getDomain().getId(), "NoAuthProbeService.onDisconnect", noAuthProbe); - } + messagePublisher.publishToDomainMembers(noAuthProbe.getDomain().getId(), "NoAuthProbeService.onDisconnect", noAuthProbe); + } } 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/init.sql b/src/main/resources/local/init.sql index 11e6b9b..13a1fe6 100644 --- a/src/main/resources/local/init.sql +++ b/src/main/resources/local/init.sql @@ -990,7 +990,7 @@ INSERT INTO public.infra_os_application ("name",id,os_id) VALUES ( INSERT INTO public.infra_os_daemon ("name",id,os_id) VALUES ( 'Apache',6,2); -insert into public.PROBE_INFRAHOST (HOST_ID, PROBE_ID) values (3, 1); +insert into public.probe_host (HOST_ID, PROBE_ID) values (3, 1); INSERT INTO public.sensor (crawler_input_items,create_date,description,crawler_id,status,target_id,item_count,display_name) VALUES ( @@ -1237,10 +1237,10 @@ INSERT INTO public.noauth_probe (api_key,create_date,description,temp_probe_key, '52abd6fd57e511e7ac52080027658d13','2017-06-26 12:43:46.877','{"host":{"name":"geek-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"03000200-0400-0500-0006-000700080009"},"network":{"name":"enp3s0","address":"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d13',1,NULL,3); INSERT INTO public.noauth_probe (api_key,create_date,description,temp_probe_key,domain_id,probe_id,status) VALUES ( -'52abd6fd57e511e7ac52080027658d14','2017-08-11 12:43:46.877','{"host":{"name":"insanity-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"4C4C4544-0044-4A10-8039-C7C04F595031"},"network":{"name":"enp3s0","address":"192.168.1.105/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d14',1,NULL,3); +'52abd6fd57e511e7ac52080027658d13','2017-08-11 12:43:46.877','{"host":{"name":"insanity-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"4C4C4544-0044-4A10-8039-C7C04F595031"},"network":{"name":"enp3s0","address":"192.168.1.105/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d14',1,NULL,3); INSERT INTO public.noauth_probe (api_key,create_date,description,temp_probe_key,domain_id,probe_id,status) VALUES ( -'52abd6fd57e511e7ac52080027658d15','2017-08-11 12:43:46.877','{"host":{"name":"snoop-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"DE60E4C3-347A-4D38-AEAB-1760471665EA"},"network":{"name":"enp3s0","address":"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d15',1,NULL,3); +'52abd6fd57e511e7ac52080027658d13','2017-08-11 12:43:46.877','{"host":{"name":"snoop-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"DE60E4C3-347A-4D38-AEAB-1760471665EA"},"network":{"name":"enp3s0","address":"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d15',1,NULL,3); 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/noauthprobe/service/NoAuthProbeServiceTest.java b/src/test/java/com/loafle/overflow/central/module/noauthprobe/service/NoAuthProbeServiceTest.java index 2e19359..21882a1 100644 --- a/src/test/java/com/loafle/overflow/central/module/noauthprobe/service/NoAuthProbeServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/noauthprobe/service/NoAuthProbeServiceTest.java @@ -1,164 +1,154 @@ -// package com.loafle.overflow.central.module.noauthprobe.service; +package com.loafle.overflow.central.module.noauthprobe.service; -// import com.loafle.overflow.central.commons.service.MessagePublisher; -// import com.loafle.overflow.central.spring.AppConfigTest; -// import com.loafle.overflow.core.exception.OverflowException; -// import com.loafle.overflow.model.domain.Domain; -// import com.loafle.overflow.model.meta.MetaNoAuthProbeStatus; -// import com.loafle.overflow.model.noauthprobe.NoAuthProbe; -// import com.loafle.overflow.service.central.noauthprobe.NoAuthProbeService; +import com.loafle.overflow.central.commons.service.MessagePublisher; +import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.core.exception.OverflowException; +import com.loafle.overflow.model.domain.Domain; +import com.loafle.overflow.model.meta.MetaNoAuthProbeStatus; +import com.loafle.overflow.model.noauthprobe.NoAuthProbe; +import com.loafle.overflow.service.central.noauthprobe.NoAuthProbeService; -// 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 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.io.IOException; -// import java.util.ArrayList; -// import java.util.List; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; -// /** -// * Created by snoop on 17. 6. 28. -// */ -// @RunWith(SpringJUnit4ClassRunner.class) -// @ContextConfiguration(classes = {AppConfigTest.class}) -// public class NoAuthProbeServiceTest { +/** + * Created by snoop on 17. 6. 28. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { AppConfigTest.class }) +public class NoAuthProbeServiceTest { -// @Autowired -// private NoAuthProbeService noAuthProbeService; + @Autowired + private CentralNoAuthProbeService noAuthProbeService; -// @Autowired -// private MessagePublisher messagePublisher; + @Autowired + private MessagePublisher messagePublisher; -// @Ignore -// @Test -// public void regist() throws Exception { + @Ignore + @Test + public void regist() throws Exception { -// NoAuthProbe noAuthProbe = new NoAuthProbe(); + NoAuthProbe noAuthProbe = new NoAuthProbe(); + // noAuthProbe.setHostName("snoop"); + // noAuthProbe.setIpAddress(3232235980L); + // noAuthProbe.setMacAddress(8796753988883L); + noAuthProbe.setDescription( + "{\"host\":{\"name\":\"snoop-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"DE60E4C3-347A-4D38-AEAB-1760471665EA\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); -// // noAuthProbe.setHostName("snoop"); -// // noAuthProbe.setIpAddress(3232235980L); -// // noAuthProbe.setMacAddress(8796753988883L); -// noAuthProbe.setDescription("{\"host\":{\"name\":\"snoop-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"DE60E4C3-347A-4D38-AEAB-1760471665EA\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); + noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13"); -// noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13"); + MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); + metaNoAuthProbeStatus.setId((short) 3); -// MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); -// metaNoAuthProbeStatus.setId((short)3); + noAuthProbe.setStatus(metaNoAuthProbeStatus); + noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13"); -// noAuthProbe.setStatus(metaNoAuthProbeStatus); -// noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13"); + Domain d = new Domain(); + d.setId(Long.valueOf(1)); + noAuthProbe.setDomain(d); -// Domain d = new Domain(); -// d.setId(1); -// noAuthProbe.setDomain(d); + this.noAuthProbeService.regist(noAuthProbe); -// this.noAuthProbeService.regist(noAuthProbe); + Assert.assertNotEquals(noAuthProbe.getId().longValue(), 0); -// Assert.assertNotEquals(noAuthProbe.getId(), 0); + } -// } + @Ignore + @Test + public void registForNoAuthProbes() throws Exception { -// @Ignore -// @Test -// public void registForNoAuthProbes() throws Exception { + NoAuthProbe noAuthProbe = new NoAuthProbe(); -// NoAuthProbe noAuthProbe = new NoAuthProbe(); + // noAuthProbe.setHostName("geek"); + // noAuthProbe.setIpAddress(3232235980L); + // noAuthProbe.setMacAddress(8796753988883L); + noAuthProbe.setDescription( + "{\"host\":{\"name\":\"geek-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"03000200-0400-0500-0006-000700080009\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); + noAuthProbe.setApiKey("521abd6fd57e511e7ac52080027658d13"); -// // noAuthProbe.setHostName("geek"); -// // noAuthProbe.setIpAddress(3232235980L); -// // noAuthProbe.setMacAddress(8796753988883L); -// noAuthProbe.setDescription("{\"host\":{\"name\":\"geek-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"03000200-0400-0500-0006-000700080009\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); -// noAuthProbe.setApiKey("521abd6fd57e511e7ac52080027658d13"); + MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); + metaNoAuthProbeStatus.setId((short) 3); -// MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); -// metaNoAuthProbeStatus.setId((short)3); + noAuthProbe.setStatus(metaNoAuthProbeStatus); + noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13"); -// noAuthProbe.setStatus(metaNoAuthProbeStatus); -// noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13"); + Domain d = new Domain(); + d.setId(Long.valueOf(1)); + noAuthProbe.setDomain(d); -// Domain d = new Domain(); -// d.setId(1); -// noAuthProbe.setDomain(d); + List noAuthProbes = new ArrayList(); -// List noAuthProbes = new ArrayList(); + noAuthProbes.add(noAuthProbe); + // List dd = + // this.noAuthProbeService.registForNoAuthProbes(noAuthProbes); -// noAuthProbes.add(noAuthProbe); -// // List dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes); + // System.out.println(dd.get(0).getId()); -// // System.out.println(dd.get(0).getId()); + Assert.assertNotEquals(noAuthProbes.size(), 2); -// Assert.assertNotEquals(noAuthProbes.size(), 2); + } -// } + @Ignore + @Test + public void readAllByDomainID() throws Exception { + List probes = this.noAuthProbeService.readAllByDomainID(Long.valueOf(1)); -// @Ignore -// @Test -// public void readAllByDomain() throws Exception { + Assert.assertNotEquals(probes.size(), 0); -// Domain domain = new Domain(); -// domain.setId(1); + } -// List probes = this.noAuthProbeService.readAllByDomain(domain); + @Ignore + @Test + public void read() throws Exception { + NoAuthProbe noAuthProbe = this.noAuthProbeService.read(Long.valueOf(1)); -// Assert.assertNotEquals(probes.size(), 0); + Assert.assertNotEquals(noAuthProbe, null); + } -// } + @Ignore + @Test + public void acceptProbe() throws Exception { -// @Ignore -// @Test -// public void read() throws Exception { + this.noAuthProbeService.acceptNoAuthProbe(Long.valueOf(1)); -// NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1); + } -// Assert.assertNotEquals(noAuthProbe, null); -// } + @Ignore + @Test + public void ssss() { + String ss = "192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64"; -// @Ignore -// @Test -// public void acceptProbe() throws IOException { + String[] sss = ss.split("\\|"); -// NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1); + System.out.println(sss[0]); + } -// this.noAuthProbeService.acceptNoAuthProbe(noAuthProbe); + @Test + public void readByTempKey() throws Exception { -// } + NoAuthProbe noAuthProbe = this.noAuthProbeService.readByTempProbeKey("1cf2555c57d511e79714080027658d15"); -// @Ignore -// @Test -// public void ssss() { -// String ss = "192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64"; + Assert.assertNotEquals(noAuthProbe, null); -// String[] sss = ss.split("\\|"); + } -// System.out.println(sss[0]); -// } + @Test + @Ignore + public void sendWeb() throws OverflowException { + List probes = this.noAuthProbeService.readAllByDomainID(Long.valueOf(1)); -// @Test -// public void readByTempKey() { + messagePublisher.publishToDomainMembers(Long.valueOf(1), "NoAuthProbeService.regist", probes); -// NoAuthProbe noAuthProbe = this.noAuthProbeService.readByTempKey("1cf2555c57d511e79714080027658d15"); + } -// Assert.assertNotEquals(noAuthProbe, null); - -// } - -// @Test -// @Ignore -// public void sendWeb() throws OverflowException { - -// Domain domain = new Domain(); -// domain.setId(1); - -// List probes = this.noAuthProbeService.readAllByDomain(domain); - -// messagePublisher.publishToDomainMembers(domain.getId(), "NoAuthProbeService.regist", probes); - -// } - - -// } \ No newline at end of file +} \ No newline at end of file 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..5eb3939 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 @@ -1,146 +1,145 @@ - package com.loafle.overflow.central.module.target.service; +package com.loafle.overflow.central.module.target.service; - import com.google.gson.Gson; - import com.google.gson.GsonBuilder; - import com.google.gson.reflect.TypeToken; - import com.loafle.overflow.central.spring.AppConfigTest; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.loafle.overflow.central.spring.AppConfigTest; - import com.loafle.overflow.model.discovery.Host; - import com.loafle.overflow.model.probe.Probe; - import com.loafle.overflow.service.central.target.TargetDiscoveryService; - import org.codehaus.jackson.map.DeserializationConfig; - import org.codehaus.jackson.map.ObjectMapper; - import org.junit.Ignore; - import org.junit.Test; - import org.junit.runner.RunWith; - import org.springframework.aop.support.AopUtils; - import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.core.io.ResourceLoader; - import org.springframework.test.context.ContextConfiguration; - import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import com.loafle.overflow.model.discovery.Host; +import com.loafle.overflow.model.probe.Probe; +import com.loafle.overflow.service.central.target.TargetDiscoveryService; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.aop.support.AopUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ResourceLoader; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - import java.io.BufferedReader; - import java.io.FileReader; - import java.io.IOException; - import java.lang.reflect.Method; - import java.lang.reflect.ParameterizedType; - import java.lang.reflect.Type; - import java.util.Date; - import java.util.List; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.List; - /** - * Created by snoop on 17. 6. 28. - */ +/** + * Created by snoop on 17. 6. 28. +*/ - @RunWith(SpringJUnit4ClassRunner.class) - @ContextConfiguration(classes = {AppConfigTest.class}) - public class TargetDiscoveryServiceTest { +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfigTest.class}) +public class TargetDiscoveryServiceTest { - @Autowired - private ResourceLoader resourceLoader; + @Autowired + private ResourceLoader resourceLoader; - @Autowired - private TargetDiscoveryService targetDiscoveryService; + @Autowired + private TargetDiscoveryService targetDiscoveryService; // @Ignore - @Test - public void saveAllTarget() throws Exception { + @Test + public void saveAllTarget() throws Exception { - String json = readFileAsString(resourceLoader.getResource("classpath:2018-04-25-tds.json").getURI().getPath()); + String json = readFileAsString(resourceLoader.getResource("classpath:2018-04-25-tds.json").getURI().getPath()); // Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonDateDeserializer()).create(); - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - List hosts = mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, Host.class)); + List hosts = mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, Host.class)); - Probe probe = new Probe(); - probe.setId(1); + Probe probe = new Probe(); + probe.setId(Long.valueOf(1)); - this.targetDiscoveryService.saveAllTarget(hosts, probe); - } + this.targetDiscoveryService.saveAllTarget(hosts, probe); + } - private String readFileAsString(String filePath) throws IOException { - StringBuffer fileData = new StringBuffer(); - BufferedReader reader = new BufferedReader( - new FileReader(filePath)); - char[] buf = new char[1024]; - int numRead=0; - while((numRead=reader.read(buf)) != -1){ - String readData = String.valueOf(buf, 0, numRead); - fileData.append(readData); - } - reader.close(); - return fileData.toString(); - } + private String readFileAsString(String filePath) throws IOException { + StringBuffer fileData = new StringBuffer(); + BufferedReader reader = new BufferedReader( + new FileReader(filePath)); + char[] buf = new char[1024]; + int numRead=0; + while((numRead=reader.read(buf)) != -1){ + String readData = String.valueOf(buf, 0, numRead); + fileData.append(readData); + } + reader.close(); + return fileData.toString(); + } - @Ignore - @Test - public void testParam() throws NoSuchMethodException { + @Ignore + @Test + public void testParam() throws NoSuchMethodException { - Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class); - // Method m = TargetDiscoveryService.class.getMethod("saveAllTarget", List.class, Probe.class); + Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class); +// Method m = TargetDiscoveryService.class.getMethod("saveAllTarget", List.class, Probe.class); - Class clazz = AopUtils.getTargetClass(this.targetDiscoveryService); - Method[] ms = clazz.getMethods(); + Class clazz = AopUtils.getTargetClass(this.targetDiscoveryService); + Method[] ms = clazz.getMethods(); - Method sm = null; - for(Method mm : ms){ - if ("saveAllTarget".equals(mm.getName())) { - sm = mm; - break; - } - } + Method sm = null; + for(Method mm : ms){ + if ("saveAllTarget".equals(mm.getName())) { + sm = mm; + break; + } + } - if (sm != null) { - Type[] ts = sm.getGenericParameterTypes(); - for(Type t : ts){ - if (t instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType)t; - System.out.println(pt.getActualTypeArguments()[0].getTypeName()); - } - System.out.println(t.getTypeName()); + if (sm != null) { + Type[] ts = sm.getGenericParameterTypes(); + for(Type t : ts){ + if (t instanceof ParameterizedType) { + ParameterizedType pt = (ParameterizedType)t; + System.out.println(pt.getActualTypeArguments()[0].getTypeName()); + } + System.out.println(t.getTypeName()); - } - } + } + } - System.out.println(m.getName()); - Type[] genericParameterTypes = m.getGenericParameterTypes(); + System.out.println(m.getName()); + Type[] genericParameterTypes = m.getGenericParameterTypes(); - for(Type genericParameterType : genericParameterTypes){ - if(genericParameterType instanceof ParameterizedType){ - ParameterizedType aType = (ParameterizedType) genericParameterType; - Type[] parameterArgTypes = aType.getActualTypeArguments(); - for(Type parameterArgType : parameterArgTypes){ - Class parameterArgClass = (Class) parameterArgType; - System.out.println("parameterArgClass = " + parameterArgClass); - } - } - } - } + for(Type genericParameterType : genericParameterTypes){ + if(genericParameterType instanceof ParameterizedType){ + ParameterizedType aType = (ParameterizedType) genericParameterType; + Type[] parameterArgTypes = aType.getActualTypeArguments(); + for(Type parameterArgType : parameterArgTypes){ + Class parameterArgClass = (Class) parameterArgType; + System.out.println("parameterArgClass = " + parameterArgClass); + } + } + } + } - @Ignore - @Test - public void testName() throws ClassNotFoundException { + @Ignore + @Test + public void testName() throws ClassNotFoundException { - Object o = this.targetDiscoveryService; + Object o = this.targetDiscoveryService; - String nnn = o.getClass().getSimpleName(); - System.out.println(nnn); + String nnn = o.getClass().getSimpleName(); + System.out.println(nnn); - } + } - } \ No newline at end of file +} \ No newline at end of file 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