test
This commit is contained in:
parent
9eec640d32
commit
cf4f4223f8
|
@ -1,5 +1,6 @@
|
||||||
package com.loafle.overflow.module.noauthprobe.service;
|
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.domain.model.Domain;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
|
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
|
||||||
|
@ -30,6 +31,9 @@ public class NoAuthProbeService {
|
||||||
|
|
||||||
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
|
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
|
||||||
|
|
||||||
|
noAuthProbe.setTempProbeKey(UUID.randomUUID().toString());
|
||||||
|
noAuthProbe.setStatus(new MetaNoAuthProbeStatus((short)3));
|
||||||
|
|
||||||
return this.noAuthProbeDAO.save(noAuthProbe);
|
return this.noAuthProbeDAO.save(noAuthProbe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,21 +54,22 @@ public class NoAuthProbeService {
|
||||||
Probe probe = null;
|
Probe probe = null;
|
||||||
for (NoAuthProbe noAuth : noAuthProbes) {
|
for (NoAuthProbe noAuth : noAuthProbes) {
|
||||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
String key = passwordEncoder.encode(UUID.randomUUID().toString());
|
String encryptKey = passwordEncoder.encode(UUID.randomUUID().toString());
|
||||||
|
|
||||||
probe = new Probe();
|
probe = new Probe();
|
||||||
probe.setEncryptionKey(key);
|
probe.setEncryptionKey(encryptKey);
|
||||||
probe.setProbeKey(noAuth.getApiKey());
|
probe.setProbeKey(noAuth.getApiKey());
|
||||||
probe.setDomain(new Domain(1));
|
probe.setDomain(new Domain(1));
|
||||||
probe.setAuthorizeMember(new Member(1));
|
probe.setAuthorizeMember(new Member(1));
|
||||||
probe.setStatus(new MetaProbeStatus((short)1));
|
probe.setStatus(new MetaProbeStatus((short)1));
|
||||||
probe.setTargetCount(0);
|
probe.setTargetCount(0);
|
||||||
probe.setSensorCount(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);
|
probes.add(probe);
|
||||||
|
|
||||||
noAuth.setStatus(new MetaNoAuthProbeStatus((short) 1));
|
noAuth.setStatus(new MetaNoAuthProbeStatus((short) 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user