From cf4f4223f8184058329f0466097be6c6d042641c Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 30 Aug 2017 16:06:00 +0900 Subject: [PATCH] test --- .../noauthprobe/service/NoAuthProbeService.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java b/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java index 1fe3a87..b7f315e 100644 --- a/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java @@ -1,5 +1,6 @@ package com.loafle.overflow.module.noauthprobe.service; +import com.loafle.overflow.commons.utils.StringConvertor; import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.member.model.Member; import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus; @@ -30,6 +31,9 @@ public class NoAuthProbeService { public NoAuthProbe regist(NoAuthProbe noAuthProbe) { + noAuthProbe.setTempProbeKey(UUID.randomUUID().toString()); + noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short)3)); + return this.noAuthProbeDAO.save(noAuthProbe); } @@ -50,21 +54,22 @@ public class NoAuthProbeService { Probe probe = null; for (NoAuthProbe noAuth : noAuthProbes) { BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - String key = passwordEncoder.encode(UUID.randomUUID().toString()); + String encryptKey = passwordEncoder.encode(UUID.randomUUID().toString()); probe = new Probe(); - probe.setEncryptionKey(key); + probe.setEncryptionKey(encryptKey); probe.setProbeKey(noAuth.getApiKey()); probe.setDomain(new Domain(1)); probe.setAuthorizeMember(new Member(1)); probe.setStatus(new MetaProbeStatus((short)1)); probe.setTargetCount(0); probe.setSensorCount(0); - probe.setEncryptionKey("111"); - probe.setDisplayName(noAuth.getHostName()+"'s probe"); + + String dispName = noAuth.getHostName().isEmpty() ? + StringConvertor.intToIp(noAuth.getIpAddress()) : noAuth.getHostName(); + probe.setDisplayName(dispName); probes.add(probe); - noAuth.setStatus(new MetaNoAuthProbeStatus((short) 1)); }