This commit is contained in:
crusader 2018-05-24 19:05:23 +09:00
parent 3d3ea7b0b0
commit 31fd84e984
51 changed files with 145 additions and 173 deletions

View File

@ -3,7 +3,7 @@ package com.loafle.overflow.central.commons.service;
import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.core.exception.OverflowException;
public interface MessagePublisher { 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 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; void publishToMember(final String memberID, final String method, final Object... params) throws OverflowException;

View File

@ -3,7 +3,6 @@ package com.loafle.overflow.central.module.apikey.dao;
import com.loafle.overflow.model.apikey.ApiKey; import com.loafle.overflow.model.apikey.ApiKey;
import com.loafle.overflow.model.domain.Domain;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -16,5 +15,5 @@ public interface ApiKeyDAO extends JpaRepository<ApiKey, Long> {
ApiKey findByApiKey(String apiKey); ApiKey findByApiKey(String apiKey);
ApiKey findByDomain(Domain domain); ApiKey findByDomainId(Long domainID);
} }

View File

@ -27,8 +27,8 @@ public class CentralApiKeyService implements ApiKeyService {
return this.apiKeyDAO.save(apiKey); return this.apiKeyDAO.save(apiKey);
} }
public ApiKey readByDomain(Domain domain) throws OverflowException { public ApiKey readByDomainID(Long domainID) throws OverflowException {
return this.apiKeyDAO.findByDomain(domain); return this.apiKeyDAO.findByDomainId(domainID);
} }
public boolean check(String apiKey) throws OverflowException { public boolean check(String apiKey) throws OverflowException {

View File

@ -40,7 +40,7 @@ public class CentralAuthCrawlerService implements AuthCrawlerService {
return this.authCrawlerDAO.save(dbAuthCrawler); 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); Infra infra = this.infraService.read(infraId);

View File

@ -21,12 +21,10 @@ public interface DomainMemberDAO extends JpaRepository<DomainMember, Long> {
@Query("SELECT dm from DomainMember dm where dm.member.email = (:email)") @Query("SELECT dm from DomainMember dm where dm.member.email = (:email)")
DomainMember findByMemberEmail(@Param("email") String email); DomainMember findByMemberEmail(@Param("email") String email);
@Query("SELECT dm.domain from DomainMember dm where dm.member = (:member)") @Query("SELECT dm.domain from DomainMember dm where dm.member.id = (:memberID)")
Domain findDomainByMember(@Param("member") Member member); Domain findDomainByMemberId(@Param("memberID") Long memberID);
@Query("SELECT dm.member from DomainMember dm where dm.domain = (:domain)")
List<Member> findAllMemberByDomain(@Param("domain") Domain domain);
@Query("SELECT dm.member from DomainMember dm where dm.domain.id = (:domainID)") @Query("SELECT dm.member from DomainMember dm where dm.domain.id = (:domainID)")
List<Member> findAllMemberByDomainID(@Param("domainID") long domainID); List<Member> findAllMemberByDomainId(@Param("domainID") Long domainID);
} }

View File

@ -22,28 +22,20 @@ public class CentralDomainMemberService implements DomainMemberService {
@Autowired @Autowired
private DomainMemberDAO domainMemberDAO; private DomainMemberDAO domainMemberDAO;
@Autowired
private MemberDAO memberDAO;
public void regist(DomainMember domainMember) { public void regist(DomainMember domainMember) {
this.domainMemberDAO.save(domainMember); this.domainMemberDAO.save(domainMember);
} }
public Domain readDomainByMemberID(long id) { public Domain readDomainByMemberID(Long memberID) {
Member member = this.memberDAO.findOne(id); return this.domainMemberDAO.findDomainByMemberId(memberID);
return this.domainMemberDAO.findDomainByMember(member);
} }
public DomainMember readByMemberEmail(String email) { public DomainMember readByMemberEmail(String email) {
return this.domainMemberDAO.findByMemberEmail(email); return this.domainMemberDAO.findByMemberEmail(email);
} }
public List<Member> readAllMemberByDomain(Domain domain) { public List<Member> readAllMemberByDomainID(final Long domainID) {
return this.domainMemberDAO.findAllMemberByDomain(domain); return this.domainMemberDAO.findAllMemberByDomainId(domainID);
}
public List<Member> readAllMemberByDomainID(final long domainID) {
return this.domainMemberDAO.findAllMemberByDomainID(domainID);
} }
} }

View File

@ -17,11 +17,9 @@ import com.loafle.overflow.model.member.Member;
import com.loafle.overflow.model.meta.MetaEmailStatus; import com.loafle.overflow.model.meta.MetaEmailStatus;
import com.loafle.overflow.model.meta.MetaMemberStatus; import com.loafle.overflow.model.meta.MetaMemberStatus;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; 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/"; // 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); return this.emailAuthDAO.findOne(id);
} }
@ -127,7 +125,7 @@ public class EmailAuthService {
} }
// dZQgXM1o/Cx48X8DM+6ec/oPfqA2l/LdWtijOZ2EnWk= // dZQgXM1o/Cx48X8DM+6ec/oPfqA2l/LdWtijOZ2EnWk=
public List<EmailAuth> readByMember(long memberId) { public List<EmailAuth> readByMember(Long memberId) {
return this.emailAuthDAO.findByMember(new Member(memberId)); return this.emailAuthDAO.findByMember(new Member(memberId));
} }

View File

@ -47,7 +47,7 @@ public class SensorConfigGenerator {
} }
Sensor dbSensor = sensorItems.get(0).getSensor(); 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 // 7 = Infra OS Service
if(infra.getInfraType().getId() == 7) { if(infra.getInfraType().getId() == 7) {

View File

@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.history.dao;
import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.history.History; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -17,13 +16,13 @@ import org.springframework.stereotype.Repository;
*/ */
@Repository @Repository
public interface HistoryDAO extends JpaRepository<History, Long> { public interface HistoryDAO extends JpaRepository<History, Long> {
Page<History> findAllByProbe(Probe probe, Pageable pageable); Page<History> findAllByProbeId(Long probeID, Pageable pageable);
@Query("SELECT h FROM History h WHERE h.probe.id = :#{#probe.id} and h.type.id = :#{#type.id}") @Query("SELECT h FROM History h WHERE h.probe.id = :#{#probeID} and h.type.id = :#{#type.id}")
Page<History> findAllByProbeAndType(@Param("probe") Probe probe, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageable); Page<History> findAllByProbeIdAndType(@Param("probeID") Long probeID, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageable);
Page<History> findAllByDomain(@Param("domain") Domain domain, Pageable pageRequest); Page<History> findAllByDomainId(Long domainID, Pageable pageRequest);
@Query("SELECT h FROM History h WHERE h.domain.id = :#{#domain.id} and h.type.id = :#{#type.id}") @Query("SELECT h FROM History h WHERE h.domain.id = :#{#domainID} and h.type.id = :#{#type.id}")
Page<History> findAllByDomainAndType(@Param("domain") Domain domain, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageRequest); Page<History> findAllByDomainIdAndType(@Param("domainID") Long domainID, @Param("type") com.loafle.overflow.model.meta.MetaHistoryType type, Pageable pageRequest);
} }

View File

@ -23,20 +23,20 @@ public class CentralHistoryService implements HistoryService {
} }
public Page<History> readAllByProbeAndType(Probe probe, MetaHistoryType type, PageParams pageParams) { public Page<History> readAllByProbeIDAndType(Long probeID, MetaHistoryType type, PageParams pageParams) {
return this.historyDAO.findAllByProbeAndType(probe, type, PageUtil.getPageRequest(pageParams)); return this.historyDAO.findAllByProbeIdAndType(probeID, type, PageUtil.getPageRequest(pageParams));
} }
public Page<History> readAllByProbe(Probe probe, com.loafle.overflow.core.model.PageParams pageParams) { public Page<History> readAllByProbeID(Long probeID, PageParams pageParams) {
return this.historyDAO.findAllByProbe(probe, PageUtil.getPageRequest(pageParams)); return this.historyDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams));
} }
public Page<History> readAllByDomain(Domain domain, PageParams pageParams) { public Page<History> readAllByDomainID(Long domainID, PageParams pageParams) {
return this.historyDAO.findAllByDomain(domain, PageUtil.getPageRequest(pageParams)); return this.historyDAO.findAllByDomainId(domainID, PageUtil.getPageRequest(pageParams));
} }
public Page<History> readAllByDomainAndType(Domain domain, MetaHistoryType type, PageParams pageParams) { public Page<History> readAllByDomainIDAndType(Long domainID, MetaHistoryType type, PageParams pageParams) {
return this.historyDAO.findAllByDomainAndType(domain, type, PageUtil.getPageRequest(pageParams)); return this.historyDAO.findAllByDomainIdAndType(domainID, type, PageUtil.getPageRequest(pageParams));
} }
} }

View File

@ -17,9 +17,9 @@ import java.util.List;
*/ */
@Repository @Repository
public interface InfraDAO extends JpaRepository<Infra, Long> { public interface InfraDAO extends JpaRepository<Infra, Long> {
List<Infra> findAllByProbe(Probe probe); List<Infra> findAllByProbeId(Long probeID);
Page<Infra> findAllByProbe(Probe probe, Pageable pageable); Page<Infra> findAllByProbeId(Long probeID, Pageable pageable);
@Query("SELECT i FROM INFRA i WHERE i.probe IN (:probeList) AND i.target != NULL") @Query("SELECT i FROM INFRA i WHERE i.probe IN (:probeList) AND i.target != NULL")
Page<Infra> findAllByProbeList(@Param("probeList") List<Probe> probeList, Pageable pageable); Page<Infra> findAllByProbeList(@Param("probeList") List<Probe> probeList, Pageable pageable);
@ -28,6 +28,6 @@ public interface InfraDAO extends JpaRepository<Infra, Long> {
@Query("SELECT DISTINCT i.target FROM INFRA i WHERE i.probe IN (:probeList)") @Query("SELECT DISTINCT i.target FROM INFRA i WHERE i.probe IN (:probeList)")
List<Target> findAllTargetByProbeList(@Param("probeList") List<Probe> probeList); List<Target> findAllTargetByProbeList(@Param("probeList") List<Probe> probeList);
Infra findByTarget(Target target); Infra findByTargetId(Long targetID);
// List<Infra> findAllByProbe(List<Probe> probeList); // List<Infra> findAllByProbe(List<Probe> probeList);
} }

View File

@ -13,5 +13,5 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface InfraOSPortDAO extends JpaRepository<InfraOSPort, Long> { public interface InfraOSPortDAO extends JpaRepository<InfraOSPort, Long> {
@Query("SELECT p from com.loafle.overflow.model.infra.InfraOSPort p WHERE p.os.id = (:osId) AND p.port = (:portNumber) AND p.portType = (:portType)") @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);
} }

View File

@ -12,5 +12,5 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface InfraServiceDAO extends JpaRepository<InfraService, Long> { public interface InfraServiceDAO extends JpaRepository<InfraService, Long> {
@Query("SELECT ins from com.loafle.overflow.model.infra.InfraService ins WHERE ins.host.id = (:hostId) AND ins.port = (:portNumber) AND ins.portType = (:portType)") @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);
} }

View File

@ -20,7 +20,7 @@ public class CentralInfraHostService implements InfraHostService {
return this.infraHostDAO.save(infraHost); return this.infraHostDAO.save(infraHost);
} }
public InfraHost read(long id) throws OverflowException { public InfraHost read(Long id) throws OverflowException {
return this.infraHostDAO.findOne(id); return this.infraHostDAO.findOne(id);
} }

View File

@ -19,7 +19,7 @@ public class CentralInfraMachineService implements InfraMachineService {
return this.infraMachineDAO.save(infraMachine); return this.infraMachineDAO.save(infraMachine);
} }
public InfraMachine read(long id) { public InfraMachine read(Long id) {
return this.infraMachineDAO.findOne(id); return this.infraMachineDAO.findOne(id);
} }
} }

View File

@ -20,7 +20,7 @@ public class CentralInfraOSApplicationService implements InfraOSApplicationServi
return this.infraOSApplicationDAO.save(infraOSApplication); return this.infraOSApplicationDAO.save(infraOSApplication);
} }
public InfraOSApplication read(long id)throws OverflowException { public InfraOSApplication read(Long id)throws OverflowException {
return this.infraOSApplicationDAO.findOne(id); return this.infraOSApplicationDAO.findOne(id);
} }
} }

View File

@ -20,7 +20,7 @@ public class CentralInfraOSDaemonService implements InfraOSDaemonService {
return this.infraOSDaemonDAO.save(infraOSDaemon); return this.infraOSDaemonDAO.save(infraOSDaemon);
} }
public InfraOSDaemon read(long id) throws OverflowException { public InfraOSDaemon read(Long id) throws OverflowException {
return this.infraOSDaemonDAO.findOne(id); return this.infraOSDaemonDAO.findOne(id);
} }
} }

View File

@ -20,11 +20,11 @@ public class CentralInfraOSPortService implements InfraOSPortService {
return this.infraOSPortDAO.save(infraOSPort); return this.infraOSPortDAO.save(infraOSPort);
} }
public InfraOSPort read(long id) throws OverflowException { public InfraOSPort read(Long id) throws OverflowException {
return this.infraOSPortDAO.findOne(id); 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); return this.infraOSPortDAO.findByPort(osId, portNumber, portType);
} }
} }

View File

@ -20,7 +20,7 @@ public class CentralInfraOSService implements InfraOSService {
return this.infraOSDAO.save(infraOS); return this.infraOSDAO.save(infraOS);
} }
public InfraOS read(long id) throws OverflowException { public InfraOS read(Long id) throws OverflowException {
return this.infraOSDAO.findOne(id); return this.infraOSDAO.findOne(id);
} }
} }

View File

@ -37,18 +37,18 @@ public class CentralInfraService implements InfraService {
return this.infraDAO.save(infra); 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 infra = this.infraDAO.findOne(id);
infra.getTarget().setSensors(this.sensorDAO.findAllByTarget(infra.getTarget())); infra.getTarget().setSensors(this.sensorDAO.findAllByTargetId(infra.getTarget().getId()));
return infra; return infra;
} }
public Page<Infra> readAllByProbe(Probe probe, PageParams pageParams) throws OverflowException { public Page<Infra> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
return this.infraDAO.findAllByProbe(probe, PageUtil.getPageRequest(pageParams)); return this.infraDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams));
} }
public Page<Infra> readAllByDomain(Domain domain, PageParams pageParams) throws OverflowException { public Page<Infra> readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException {
List<Probe> probeList = this.probeService.readAllByDomain(domain); List<Probe> probeList = this.probeService.readAllByDomainID(domainID);
if(probeList == null || probeList.size() <= 0) { if(probeList == null || probeList.size() <= 0) {
throw new OverflowException("ProbeNotFoundException", new Throwable()); throw new OverflowException("ProbeNotFoundException", new Throwable());
@ -56,15 +56,15 @@ public class CentralInfraService implements InfraService {
Page<Infra> infraList = this.infraDAO.findAllByProbeList(probeList, PageUtil.getPageRequest(pageParams)); Page<Infra> infraList = this.infraDAO.findAllByProbeList(probeList, PageUtil.getPageRequest(pageParams));
for (Infra infra: infraList) { for (Infra infra: infraList) {
infra.getTarget().setSensors(this.sensorDAO.findAllByTarget(infra.getTarget())); infra.getTarget().setSensors(this.sensorDAO.findAllByTargetId(infra.getTarget().getId()));
} }
return infraList; return infraList;
} }
public List<Target> readAllTargetByDomain(Domain domain) throws OverflowException { public List<Target> readAllTargetByDomainID(Long domainID) throws OverflowException {
List<Probe> probeList = this.probeService.readAllByDomain(domain); List<Probe> probeList = this.probeService.readAllByDomainID(domainID);
if(probeList == null || probeList.size() <= 0) { if(probeList == null || probeList.size() <= 0) {
throw new OverflowException("ProbeNotFoundException", new Throwable()); throw new OverflowException("ProbeNotFoundException", new Throwable());
@ -78,8 +78,8 @@ public class CentralInfraService implements InfraService {
// return null; // return null;
} }
public Infra readByTarget(Target target) throws OverflowException { public Infra readByTargetID(Long targetID) throws OverflowException {
return this.infraDAO.findByTarget(target); return this.infraDAO.findByTargetId(targetID);
} }
} }

View File

@ -20,11 +20,11 @@ public class CentralInfraServiceService implements InfraServiceService {
return this.infraServiceDAO.save(infraService); return this.infraServiceDAO.save(infraService);
} }
public InfraService read(long id) throws OverflowException { public InfraService read(Long id) throws OverflowException {
return this.infraServiceDAO.findOne(id); 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); return this.infraServiceDAO.findByService(hostId, portNumber, portType);
} }
} }

View File

@ -238,7 +238,7 @@ public class CentralMemberService implements MemberService {
return cMember; return cMember;
} }
public Member read(long memberId) throws OverflowException { public Member read(Long memberId) throws OverflowException {
if (memberId <= 0) { if (memberId <= 0) {
throw new OverflowException("SignInIdNotExistException()", new Throwable()); throw new OverflowException("SignInIdNotExistException()", new Throwable());
} }
@ -248,7 +248,7 @@ public class CentralMemberService implements MemberService {
} }
@WebappAPI @WebappAPI
public void withdrawal(Member member) throws OverflowException { public void withdrawal(Long memberId) throws OverflowException {
String email = SessionMetadata.getTargetID(); String email = SessionMetadata.getTargetID();
// Todo DB delete? // Todo DB delete?
@ -262,7 +262,7 @@ public class CentralMemberService implements MemberService {
return null; return null;
} }
return this.domainMemberService.readAllMemberByDomain(probe.getDomain()); return this.domainMemberService.readAllMemberByDomainID(probe.getDomain().getId());
} }
public List<Member> readAllByApiKey(String apikey) throws OverflowException { public List<Member> readAllByApiKey(String apikey) throws OverflowException {
@ -273,15 +273,10 @@ public class CentralMemberService implements MemberService {
return null; return null;
} }
return this.domainMemberService.readAllMemberByDomain(apiKey.getDomain()); return this.domainMemberService.readAllMemberByDomainID(apiKey.getDomain().getId());
} }
public List<Member> readAllByDomain(Domain domain) throws OverflowException { public List<Member> readAllByDomainID(final Long domainID) throws OverflowException {
return this.domainMemberService.readAllMemberByDomain(domain);
}
public List<Member> readAllByDomainID(final long domainID) throws OverflowException {
return this.domainMemberService.readAllMemberByDomainID(domainID); return this.domainMemberService.readAllMemberByDomainID(domainID);
} }

View File

@ -50,11 +50,11 @@ public class CentralMemberTotpService implements MemberTotpService {
return this.totpDAO.save(totp); return this.totpDAO.save(totp);
} }
public void remove(long id) throws OverflowException { public void remove(Long id) throws OverflowException {
this.totpDAO.delete(id); this.totpDAO.delete(id);
} }
public MemberTotp read(long id) throws OverflowException { public MemberTotp read(Long id) throws OverflowException {
return this.totpDAO.findOne(id); return this.totpDAO.findOne(id);
} }

View File

@ -22,7 +22,7 @@ public class CentralMetaSensorDisplayItemService implements MetaSensorDisplayIte
return this.displayItemDAO.save(item); return this.displayItemDAO.save(item);
} }
public MetaSensorDisplayItem read(long id) throws OverflowException { public MetaSensorDisplayItem read(Long id) throws OverflowException {
return this.displayItemDAO.findOne(id); return this.displayItemDAO.findOne(id);
} }

View File

@ -1,11 +1,9 @@
package com.loafle.overflow.central.module.noauthprobe.dao; package com.loafle.overflow.central.module.noauthprobe.dao;
import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.noauthprobe.NoAuthProbe; import com.loafle.overflow.model.noauthprobe.NoAuthProbe;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@ -18,8 +16,8 @@ public interface NoAuthProbeDAO extends JpaRepository<NoAuthProbe, Long> {
NoAuthProbe findByTempProbeKey(String tempProbeKey); NoAuthProbe findByTempProbeKey(String tempProbeKey);
@Query("SELECT n FROM NoAuthProbe n WHERE n.domain.id = :#{#domain.id} and n.status.id = 3") // 3 = Process @Query("SELECT n FROM NoAuthProbe n WHERE n.domain.id = :#{#domainID} and n.status.id = 3") // 3 = Process
List<NoAuthProbe> findAllByDomain(@Param("domain") Domain domain); List<NoAuthProbe> findAllByDomainId(Long domainID);
// NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent); // NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent);
// List<NoAuthProbeDeprecate> findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent); // List<NoAuthProbeDeprecate> findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent);

View File

@ -92,18 +92,19 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
return this.noAuthProbeDAO.save(noAuthProbe); return this.noAuthProbeDAO.save(noAuthProbe);
} }
public List<NoAuthProbe> readAllByDomain(Domain domain) throws OverflowException { public List<NoAuthProbe> 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); return this.noAuthProbeDAO.findOne(id);
} }
@WebappAPI @WebappAPI
@Transactional @Transactional
public List<NoAuthProbe> acceptNoAuthProbe(NoAuthProbe noAuthProbe) throws OverflowException { public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID) throws OverflowException {
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID);
NoAuthProbeDescription noAuthProbeDescription = null; NoAuthProbeDescription noAuthProbeDescription = null;
try { try {
@ -124,7 +125,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Accept", messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Accept",
probe.getProbeKey()); probe.getProbeKey());
return this.readAllByDomain(noAuthProbe.getDomain()); return this.readAllByDomainID(noAuthProbe.getDomain().getId());
} }
private Probe newProbe(NoAuthProbe noauthprobe, NoAuthProbeDescription noAuthProbeDescription) throws OverflowException { private Probe newProbe(NoAuthProbe noauthprobe, NoAuthProbeDescription noAuthProbeDescription) throws OverflowException {
@ -203,13 +204,15 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
} }
@WebappAPI @WebappAPI
public List<NoAuthProbe> denyNoauthProbe(NoAuthProbe noAuthProbe) throws OverflowException { public List<NoAuthProbe> denyNoauthProbe(Long noAuthProbeID) throws OverflowException {
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID);
noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 2)); noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short) 2));
this.noAuthProbeDAO.save(noAuthProbe); this.noAuthProbeDAO.save(noAuthProbe);
messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Deny"); messagePublisher.publishToNoAuthProbe(noAuthProbe.getTempProbeKey(), "NoAuthProbeService.Deny");
return this.readAllByDomain(noAuthProbe.getDomain()); return this.readAllByDomainID(noAuthProbe.getDomain().getId());
} }
public NoAuthProbe readByTempProbeKey(String tempKey) throws OverflowException { public NoAuthProbe readByTempProbeKey(String tempKey) throws OverflowException {

View File

@ -1,6 +1,5 @@
package com.loafle.overflow.central.module.probe.dao; package com.loafle.overflow.central.module.probe.dao;
import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.probe.Probe; import com.loafle.overflow.model.probe.Probe;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
@ -16,7 +15,7 @@ import java.util.List;
public interface ProbeDAO extends JpaRepository<Probe, Long> { public interface ProbeDAO extends JpaRepository<Probe, Long> {
Probe findByProbeKey(String probeKey); Probe findByProbeKey(String probeKey);
List<Probe> findAllByDomainOrderByIdDesc(Domain domain); List<Probe> findAllByDomainIdOrderByIdDesc(Long domainID);
// @Modifying(clearAutomatically = true) // @Modifying(clearAutomatically = true)
// @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress = :connectAddress where p.probeKey = :probeKey") // @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress = :connectAddress where p.probeKey = :probeKey")

View File

@ -2,8 +2,6 @@ package com.loafle.overflow.central.module.probe.dao;
import java.util.List; 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 com.loafle.overflow.model.probe.ProbeHost;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
@ -17,8 +15,8 @@ import org.springframework.stereotype.Repository;
*/ */
@Repository @Repository
public interface ProbeHostDAO extends JpaRepository<ProbeHost, Long> { public interface ProbeHostDAO extends JpaRepository<ProbeHost, Long> {
ProbeHost findByProbe(Probe probe); ProbeHost findByProbeId(Long probeID);
@Query("SELECT h FROM ProbeHost h WHERE h.probe.domain = (:domain)") @Query("SELECT h FROM ProbeHost h WHERE h.probe.domain.id = (:domainID)")
List<ProbeHost> findAllByDomain(@Param("domain")Domain domain); List<ProbeHost> findAllByDomainId(@Param("domainID")Long domainID);
} }

View File

@ -5,7 +5,6 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import com.loafle.overflow.model.probe.Probe;
import com.loafle.overflow.model.probe.ProbeTask; import com.loafle.overflow.model.probe.ProbeTask;
/** /**
@ -13,5 +12,5 @@ import com.loafle.overflow.model.probe.ProbeTask;
*/ */
@Repository @Repository
public interface ProbeTaskDAO extends JpaRepository<ProbeTask, Long> { public interface ProbeTaskDAO extends JpaRepository<ProbeTask, Long> {
List<ProbeTask> findAllByProbe(Probe probe); List<ProbeTask> findAllByProbeId(Long probeID);
} }

View File

@ -21,20 +21,20 @@ public class CentralProbeHostService implements ProbeHostService {
@Autowired @Autowired
private ProbeHostDAO probeHostDAO; private ProbeHostDAO probeHostDAO;
public ProbeHost read(long id) throws OverflowException { public ProbeHost read(Long id) throws OverflowException {
return this.probeHostDAO.findOne(id); return this.probeHostDAO.findOne(id);
} }
public ProbeHost readByProbe(Probe probe) throws OverflowException { public ProbeHost readByProbeID(Long probeID) throws OverflowException {
return this.probeHostDAO.findByProbe(probe); return this.probeHostDAO.findByProbeId(probeID);
} }
public ProbeHost regist(ProbeHost probeHost) throws OverflowException { public ProbeHost regist(ProbeHost probeHost) throws OverflowException {
return this.probeHostDAO.save(probeHost); return this.probeHostDAO.save(probeHost);
} }
public List<ProbeHost> readAllByDomain(Domain domain) throws OverflowException { public List<ProbeHost> readAllByDomainID(Long domainID) throws OverflowException {
return this.probeHostDAO.findAllByDomain(domain); return this.probeHostDAO.findAllByDomainId(domainID);
} }
} }

View File

@ -32,12 +32,12 @@ public class CentralProbeService implements ProbeService {
return this.probeDAO.save(probes); return this.probeDAO.save(probes);
} }
public List<Probe> readAllByDomain(Domain domain) throws OverflowException { public List<Probe> readAllByDomainID(Long domainID) throws OverflowException {
List<Probe> probes = this.probeDAO.findAllByDomainOrderByIdDesc(domain); List<Probe> probes = this.probeDAO.findAllByDomainIdOrderByIdDesc(domainID);
return probes; return probes;
} }
public Probe read(long id) throws OverflowException { public Probe read(Long id) throws OverflowException {
return this.probeDAO.findOne(id); return this.probeDAO.findOne(id);
} }
@ -49,7 +49,7 @@ public class CentralProbeService implements ProbeService {
return this.probeDAO.save(probe); return this.probeDAO.save(probe);
} }
public boolean remove(long id) throws OverflowException { public boolean remove(Long id) throws OverflowException {
this.probeDAO.delete(id); this.probeDAO.delete(id);
return true; return true;
} }
@ -69,7 +69,7 @@ public class CentralProbeService implements ProbeService {
return this.probeDAO.save(p); 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 probe = this.probeDAO.findOne(probeId);
probe.setDisplayName(displayName); probe.setDisplayName(displayName);
return this.probeDAO.save(probe); return this.probeDAO.save(probe);

View File

@ -24,7 +24,7 @@ public class CentralProbeTaskService implements ProbeTaskService{
return this.probeTaskDAO.save(probeTask); return this.probeTaskDAO.save(probeTask);
} }
public List<ProbeTask> readAllByProbe(Probe probe) throws OverflowException { public List<ProbeTask> readAllByProbeID(Long probeID) throws OverflowException {
return this.probeTaskDAO.findAllByProbe(probe); return this.probeTaskDAO.findAllByProbeId(probeID);
} }
} }

View File

@ -18,9 +18,8 @@ import com.loafle.overflow.model.target.Target;
*/ */
@Repository @Repository
public interface SensorDAO extends JpaRepository<Sensor, Long> { public interface SensorDAO extends JpaRepository<Sensor, Long> {
Page<Sensor> findAllByTargetId(Long targetID, Pageable pageable);
Page<Sensor> findAllByTarget(Target target, Pageable pageable); List<Sensor> findAllByTargetId(Long targetID);
List<Sensor> findAllByTarget(Target target);
@Query("SELECT s from Sensor s WHERE s.target in (:targetList)") @Query("SELECT s from Sensor s WHERE s.target in (:targetList)")
Page<Sensor> findAllByTargetList(@Param("targetList") List<Target> targetList, Pageable pageable); Page<Sensor> findAllByTargetList(@Param("targetList") List<Target> targetList, Pageable pageable);

View File

@ -55,9 +55,9 @@ public class CentralSensorService implements SensorService {
return this.sensorDAO.save(sensor); return this.sensorDAO.save(sensor);
} }
public Page<Sensor> readAllByDomain(Domain domain, PageParams pageParams) throws OverflowException { public Page<Sensor> readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException {
List<Probe> probeList = this.probeService.readAllByDomain(domain); List<Probe> probeList = this.probeService.readAllByDomainID(domainID);
if (probeList == null || probeList.size() <= 0) { if (probeList == null || probeList.size() <= 0) {
throw new OverflowException("", new Throwable()); throw new OverflowException("", new Throwable());
@ -72,37 +72,40 @@ public class CentralSensorService implements SensorService {
return this.sensorDAO.findAllByTargetList(targetList, PageUtil.getPageRequest(pageParams)); return this.sensorDAO.findAllByTargetList(targetList, PageUtil.getPageRequest(pageParams));
} }
public Page<Sensor> readAllByInfra(long infraId, PageParams pageParams) throws OverflowException { public Page<Sensor> readAllByInfraID(Long infraID, PageParams pageParams) throws OverflowException {
Infra dbInfra = this.infraService.read(infraId); Infra dbInfra = this.infraService.read(infraID);
if (dbInfra == null || dbInfra.getTarget() == null) { if (dbInfra == null || dbInfra.getTarget() == null) {
throw new OverflowException("", new Throwable()); 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<Sensor> readAllByTarget(Target target, PageParams pageParams) throws OverflowException { public Page<Sensor> readAllByTargetID(Long targetID, PageParams pageParams) throws OverflowException {
return this.sensorDAO.findAllByTarget(target, PageUtil.getPageRequest(pageParams)); 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)); return this.sensorDAO.findOne(Long.valueOf(id));
} }
@Transactional @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.targetService.decreaseSensorCount(sensor.getTarget());
this.sensorDAO.delete(sensor); 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); MetaSensorStatus status = new MetaSensorStatus((short) 1);
sensor.setStatus(status); sensor.setStatus(status);
return this.sensorDAO.save(sensor); 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); MetaSensorStatus status = new MetaSensorStatus((short) 2);
sensor.setStatus(status); sensor.setStatus(status);
return this.sensorDAO.save(sensor); return this.sensorDAO.save(sensor);

View File

@ -43,7 +43,7 @@ public class RedisMessagePublisher implements MessagePublisher {
this.topics = topics; 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 { throws OverflowException {
PublishMessage message = new PublishMessage(); PublishMessage message = new PublishMessage();
message.setTargetType(PublishMessage.TargetType.MEMBER); message.setTargetType(PublishMessage.TargetType.MEMBER);
@ -92,7 +92,7 @@ public class RedisMessagePublisher implements MessagePublisher {
} }
@Cacheable("memberListByDomain") @Cacheable("memberListByDomain")
protected List<String> getMemberListByDomainID(final long domainID) throws OverflowException { protected List<String> getMemberListByDomainID(final Long domainID) throws OverflowException {
return this.getMemberList(memberService.readAllByDomainID(domainID)); return this.getMemberList(memberService.readAllByDomainID(domainID));
} }

View File

@ -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.username=overflow
datasource.password=qwer5795 datasource.password=qwer5795
datasource.driver-class-name=org.postgresql.Driver datasource.driver-class-name=org.postgresql.Driver

View File

@ -35,14 +35,14 @@ public class ApiKeyServiceTest {
apiKey.setApiKey("70124b775bd511e7b059080027658d13"); apiKey.setApiKey("70124b775bd511e7b059080027658d13");
Domain domain = new Domain(); Domain domain = new Domain();
domain.setId(1); domain.setId(Long.valueOf(1));
apiKey.setDomain(domain); apiKey.setDomain(domain);
this.apiKeyService.regist(apiKey); this.apiKeyService.regist(apiKey);
Assert.assertNotEquals(apiKey.getId(), 0); Assert.assertNotEquals(apiKey.getId().longValue(), 0);
} }
@Ignore @Ignore
@ -61,11 +61,7 @@ public class ApiKeyServiceTest {
@Ignore @Ignore
@Test @Test
public void findByDomain() throws OverflowException { public void findByDomain() throws OverflowException {
ApiKey apiKey = this.apiKeyService.readByDomainID(Long.valueOf(1));
Domain domain = new Domain();
domain.setId(1);
ApiKey apiKey = this.apiKeyService.readByDomain(domain);
Assert.assertNotEquals(apiKey, null); Assert.assertNotEquals(apiKey, null);

View File

@ -28,7 +28,7 @@ public class AuthCrawlerServiceTest {
AuthCrawler authCrawler = new AuthCrawler(); AuthCrawler authCrawler = new AuthCrawler();
Target target = new Target(); Target target = new Target();
target.setId(4); target.setId(Long.valueOf(4));
authCrawler.setTarget(target); authCrawler.setTarget(target);
@ -43,7 +43,7 @@ public class AuthCrawlerServiceTest {
this.authCrawlerService.regist(authCrawler); 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); metaCrawler.setId((short)23);
Target target = new Target(); Target target = new Target();
target.setId(5); target.setId(Long.valueOf(5));
AuthCrawler authCrawler = this.authCrawlerService.readAuth(metaCrawler, target); AuthCrawler authCrawler = this.authCrawlerService.readAuth(metaCrawler, target);

View File

@ -36,27 +36,23 @@ public class DomainMemberServiceTest {
DomainMember domainMember = new DomainMember(); DomainMember domainMember = new DomainMember();
Domain domain = new Domain(); Domain domain = new Domain();
domain.setId(1); domain.setId(Long.valueOf(1));
Member member = new Member(); Member member = new Member();
member.setId(1); member.setId(Long.valueOf(1));
domainMember.setDomain(domain); domainMember.setDomain(domain);
domainMember.setMember(member); domainMember.setMember(member);
this.domainMemberService.regist(domainMember); this.domainMemberService.regist(domainMember);
Assert.assertNotEquals(domainMember.getId(), 0); Assert.assertNotEquals(domainMember.getId().longValue(), 0);
} }
@Test @Test
public void readAllMemberByDomain() throws OverflowException { public void readAllMemberByDomain() throws OverflowException {
List<Member> members = this.domainMemberService.readAllMemberByDomainID(Long.valueOf(1));
Domain domain = new Domain();
domain.setId(1);
List<Member> members = this.domainMemberService.readAllMemberByDomain(domain);
Assert.assertNotEquals(members.size(), 0); Assert.assertNotEquals(members.size(), 0);

View File

@ -33,7 +33,7 @@ public class DomainServiceTest {
this.domainService.regist(domain); this.domainService.regist(domain);
Assert.assertNotEquals(domain.getId(), 0); Assert.assertNotEquals(domain.getId().longValue(), 0);
} }
} }

View File

@ -30,7 +30,7 @@ public class EmailAuthServiceTest {
@Ignore @Ignore
public void TestMailSend() throws Exception { public void TestMailSend() throws Exception {
Member member = new Member(); Member member = new Member();
member.setId(1); member.setId(Long.valueOf(1));
member.setEmail("overflow@loafle.com"); member.setEmail("overflow@loafle.com");
this.emailAuthService.sendEmailByMember(member); this.emailAuthService.sendEmailByMember(member);
} }
@ -39,7 +39,7 @@ public class EmailAuthServiceTest {
public void TestCompareDate() throws Exception { public void TestCompareDate() throws Exception {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
EmailAuth auth = emailAuthService.read(1); EmailAuth auth = emailAuthService.read(Long.valueOf(1));
cal.setTime(auth.getCreateDate()); cal.setTime(auth.getCreateDate());
cal.add(Calendar.HOUR, 12); cal.add(Calendar.HOUR, 12);

View File

@ -35,9 +35,9 @@ public class HistoryServiceTest {
Random rand = new Random(); Random rand = new Random();
for (int i=0;i<100;i++) { for (int i=0;i<100;i++) {
History h = new History(); History h = new History();
h.setMember(new Member(1)); h.setMember(new Member(Long.valueOf(1)));
h.setProbe(new Probe(rand.nextBoolean() ? 1 : 2)); h.setProbe(new Probe(rand.nextBoolean() ? Long.valueOf(1) : Long.valueOf(2)));
h.setDomain(new Domain(1)); h.setDomain(new Domain(Long.valueOf(1)));
h.setType(new MetaHistoryType(rand.nextInt((6 - 1) + 1) + 1)); h.setType(new MetaHistoryType(rand.nextInt((6 - 1) + 1) + 1));
h.setMessage("Test History " + i); h.setMessage("Test History " + i);
this.historyService.regist(h); this.historyService.regist(h);
@ -60,7 +60,7 @@ public class HistoryServiceTest {
p.setSortCol("type.name"); p.setSortCol("type.name");
p.setSortDirection("descending"); p.setSortDirection("descending");
Page<History> result = this.historyService.readAllByProbe(new Probe(1), p); Page<History> result = this.historyService.readAllByProbeID(Long.valueOf(1), p);
for (History h : result.getContent()) { for (History h : result.getContent()) {
System.out.println(h.getId()); System.out.println(h.getId());
} }

View File

@ -28,7 +28,7 @@ public class InfraDAOTest {
List<Probe> probes = new ArrayList<>(); List<Probe> probes = new ArrayList<>();
Probe probe = new Probe(); Probe probe = new Probe();
probe.setId(1); probe.setId(Long.valueOf(1));
probes.add(probe); probes.add(probe);

View File

@ -37,7 +37,7 @@ public class InfraHostServiceTest {
infraHost.setMac("30-9C-23-15-A3-09"); infraHost.setMac("30-9C-23-15-A3-09");
infraHost.setIpv4("192.168.1.1"); infraHost.setIpv4("192.168.1.1");
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(2); infraOS.setId(Long.valueOf(2));
infraHost.setOs(infraOS); infraHost.setOs(infraOS);
@ -47,14 +47,14 @@ public class InfraHostServiceTest {
this.infraHostService.regist(infraHost); this.infraHostService.regist(infraHost);
Assert.assertNotEquals(infraHost.getId(), 0 ); Assert.assertNotEquals(infraHost.getId().longValue(), 0 );
} }
@Test @Test
public void read() throws Exception { public void read() throws Exception {
InfraHost infraHost = this.infraHostService.read(1); InfraHost infraHost = this.infraHostService.read(Long.valueOf(1));
String json = objectMapper.writeValueAsString(infraHost); String json = objectMapper.writeValueAsString(infraHost);

View File

@ -42,7 +42,7 @@ public class InfraMachineServiceTest {
this.infraMachineService.regist(infraMachine); this.infraMachineService.regist(infraMachine);
Assert.assertNotEquals(infraMachine.getId(), 0); Assert.assertNotEquals(infraMachine.getId().longValue(), 0);
} }
@ -51,7 +51,7 @@ public class InfraMachineServiceTest {
// regist(); // regist();
InfraMachine infraMachine = this.infraMachineService.read(1); InfraMachine infraMachine = this.infraMachineService.read(Long.valueOf(1));
String json = objectMapper.writeValueAsString(infraMachine); String json = objectMapper.writeValueAsString(infraMachine);
System.out.println(json); System.out.println(json);

View File

@ -36,7 +36,7 @@ public class InfraOSApplicationServiceTest {
infraOSApplication.setName("Apache"); infraOSApplication.setName("Apache");
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(2); infraOS.setId(Long.valueOf(2));
infraOSApplication.setOs(infraOS); infraOSApplication.setOs(infraOS);
@ -46,14 +46,14 @@ public class InfraOSApplicationServiceTest {
this.infraOSApplicationService.regist(infraOSApplication); this.infraOSApplicationService.regist(infraOSApplication);
Assert.assertNotEquals(infraOSApplication.getId(), 0); Assert.assertNotEquals(infraOSApplication.getId().longValue(), 0);
} }
@Test @Test
public void read() throws Exception { public void read() throws Exception {
InfraOSApplication infraOSApplication = this.infraOSApplicationService.read(1); InfraOSApplication infraOSApplication = this.infraOSApplicationService.read(Long.valueOf(1));
Assert.assertNotNull(infraOSApplication); Assert.assertNotNull(infraOSApplication);

View File

@ -36,7 +36,7 @@ public class InfraOSDaemonServiceTest {
infraOSDaemon.setName("Apache"); infraOSDaemon.setName("Apache");
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(2); infraOS.setId(Long.valueOf(2));
infraOSDaemon.setOs(infraOS); infraOSDaemon.setOs(infraOS);
@ -46,14 +46,14 @@ public class InfraOSDaemonServiceTest {
this.infraOSDaemonService.regist(infraOSDaemon); this.infraOSDaemonService.regist(infraOSDaemon);
Assert.assertNotEquals(infraOSDaemon.getId(), 0); Assert.assertNotEquals(infraOSDaemon.getId().longValue(), 0);
} }
@Test @Test
public void read() throws Exception { public void read() throws Exception {
InfraOSDaemon infraOSDaemon = this.infraOSDaemonService.read(1); InfraOSDaemon infraOSDaemon = this.infraOSDaemonService.read(Long.valueOf(1));
Assert.assertNotNull(infraOSDaemon); Assert.assertNotNull(infraOSDaemon);
String json = objectMapper.writeValueAsString(infraOSDaemon); String json = objectMapper.writeValueAsString(infraOSDaemon);

View File

@ -37,7 +37,7 @@ public class InfraOSPortServiceTest {
infraOSPort.setPortType("TCP"); infraOSPort.setPortType("TCP");
InfraOS infraOS = new InfraOS(); InfraOS infraOS = new InfraOS();
infraOS.setId(1); infraOS.setId(Long.valueOf(1));
MetaInfraType metaInfraType = new MetaInfraType(); MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(2); metaInfraType.setId(2);
@ -58,7 +58,7 @@ public class InfraOSPortServiceTest {
InfraOSPort infraOSPort; InfraOSPort infraOSPort;
try { try {
infraOSPort = this.infraOSPortService.readByPort(1, 22, "TCP"); infraOSPort = this.infraOSPortService.readByPort(Long.valueOf(1), 22, "TCP");
Assert.assertNotEquals(infraOSPort, null); Assert.assertNotEquals(infraOSPort, null);
} catch (OverflowException e) { } catch (OverflowException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block

View File

@ -40,7 +40,7 @@ public class InfraOSServiceTest {
infraOS.setMeta(""); infraOS.setMeta("");
InfraMachine infraMachine = new InfraMachine(); InfraMachine infraMachine = new InfraMachine();
infraMachine.setId(1); infraMachine.setId(Long.valueOf(1));
MetaInfraType metaInfraType = new MetaInfraType(); MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(3); metaInfraType.setId(3);
@ -55,7 +55,7 @@ public class InfraOSServiceTest {
@Test @Test
public void read() throws Exception { public void read() throws Exception {
InfraOS infraOS = this.infraOSService.read(1); InfraOS infraOS = this.infraOSService.read(Long.valueOf(1));
String json = objectMapper.writeValueAsString(infraOS); String json = objectMapper.writeValueAsString(infraOS);
System.out.println(json); System.out.println(json);
} }

View File

@ -60,7 +60,7 @@
Probe probe = new Probe(); Probe probe = new Probe();
probe.setId(1); probe.setId(Long.valueOf(1));
this.targetDiscoveryService.saveAllTarget(hosts, probe); this.targetDiscoveryService.saveAllTarget(hosts, probe);
} }

View File

@ -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.username=overflow
datasource.password=qwer5795 datasource.password=qwer5795
datasource.driver-class-name=org.postgresql.Driver datasource.driver-class-name=org.postgresql.Driver