From d4940105ffb7776e2e21a7ce0ddd7b55602e1b20 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 6 Jun 2018 14:52:00 +0900 Subject: [PATCH] test --- .../target/service/CentralTargetService.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java b/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java index c004ec5..e69677f 100644 --- a/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java +++ b/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java @@ -82,20 +82,21 @@ public class CentralTargetService implements TargetService { return this.targetDAO.save(t); } - - public Target readExistHostTarget(Long probeId, String ip) throws OverflowException { + public Target readExistHostTarget(Long probeId, String ip) throws OverflowException { InfraHost infraHost = this.infraHostService.readByProbeIdAndIpv4(probeId, ip); - if (null == infraHost) return null; + if (null == infraHost) + return null; return this.targetDAO.findByInfraId(infraHost.getId()); } - public Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException { - InfraService infraService = this.infraServiceService.readByInfraHostIDAndPortAndPortType(hostId, portNumber, portType); - if (null == infraService) return null; + public Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException { + InfraService infraService = this.infraServiceService.readByInfraHostIDAndPortAndPortType(hostId, portNumber, + portType); + if (null == infraService) + return null; return this.targetDAO.findByInfraId(infraService.getId()); } - @Transactional public List registDiscoveredTargets(Long probeId, List hosts, List services) throws OverflowException { @@ -113,7 +114,7 @@ public class CentralTargetService implements TargetService { InfraHost infraHost = this.registInfraHostByDiscoveredHost(host, probeId); Target target = new Target(); target.setInfra(infraHost); - String displayName = (host.getIpv6() == null || host.getIpv6().trim().isEmpty() ? host.getIpv6() : host.getIpv4(); + String displayName = (host.getIpv6() == null || host.getIpv6().trim().isEmpty()) ? host.getIpv6() : host.getIpv4(); target.setDisplayName(displayName); targets.add(this.targetDAO.save(target)); } @@ -135,7 +136,7 @@ public class CentralTargetService implements TargetService { infraHost = this.registInfraHostByDiscoveredHost(host, probeId); infraService = this.registInfraServiceByDiscoveredService(infraHost, service, probeId); } - + Target target = new Target(); target.setInfra(infraService); String displayName = service.getServiceName(); @@ -155,7 +156,8 @@ public class CentralTargetService implements TargetService { return this.infraHostService.regist(infraHost); } - private InfraService registInfraServiceByDiscoveredService(InfraHost infraHost, Service service, Long probeId) throws OverflowException { + private InfraService registInfraServiceByDiscoveredService(InfraHost infraHost, Service service, Long probeId) + throws OverflowException { InfraService infraService = new InfraService(); infraHost.setMetaInfraType(new MetaInfraType(7)); infraService.setInfraHost(infraHost);