REM:
1. 修正虚拟处置设备单元测试异常
This commit is contained in:
huangxin 2020-04-22 10:25:43 +08:00
parent 77dfc5a296
commit b32a960138
3 changed files with 14 additions and 16 deletions

View File

@ -63,11 +63,16 @@ public class VirtualDeviceImpl implements DisposeEntryManager {
capList.add(DisposeDeviceCapacity.builder()
.capacity(ConstValue.DeviceCapacity.CLEANUP.getCode())
.protectIpV4(new String[] {"192.168.1.1", "192.168.1.2"})
.protectIpV6(new String[]{})
.tolFlowCapacity(1024)
.build());
capList.add(DisposeDeviceCapacity.builder()
.capacity(ConstValue.DeviceCapacity.DETECIVE.getCode())
.protectIpV4(new String[] {"192.168.2.1", "192.168.2.2"})
.protectIpV6(new String[]{})
.tolFlowCapacity(0)
.build());
return capList;

View File

@ -39,8 +39,10 @@ public class DeviceCapacityData extends IDReturnStatus {
}
cpList.forEach(v -> {
String ipAddrs = String.join(",", Arrays.asList(v.getProtectIpV4()))
+ "," + String.join(",", Arrays.asList(v.getProtectIpV6())
String ipAddrs = String.join(",",
Arrays.asList(v.getProtectIpV4() != null ? v.getProtectIpV4() : new String[] {}))
+ "," + String.join(",",
Arrays.asList(v.getProtectIpV6() != null ? v.getProtectIpV6() : new String[] {})
);
if (ipAddrs.endsWith(",")) {

View File

@ -44,12 +44,11 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(v.getType(),
v.getIpAddr(),
ConstValue.IPAddrType.getIpAddrType(v.getIpAddr()));
if (dp != null) {
v.setLinkStatus(dp.getDeviceLinkStatus() ? 1 : 0);
v.setVersion(dp.getVersion());
v.setDevInfo(dp.getDeviceInfo());
v.setDevCaps(dp.getDeviceCapacity());
}
disposeDevMap.put(v.getIpAddr(), v);
});
@ -96,10 +95,6 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
return ErrorCode.ERR_NOSUCHDEVICE;
}
if (dp == null) {
return ErrorCode.ERR_NOSUCHTYPE;
}
disposeDeviceMapper.delDisposeDeviceByIp(ipAddr);
disposeDevMap.remove(ipAddr);
@ -123,10 +118,6 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
return new MReturnType<>(ErrorCode.ERR_NOSUCHDEVICE, dev.getIpAddr());
}
if (dp == null) {
return new MReturnType<>(ErrorCode.ERR_NOSUCHTYPE, dev.getIpAddr());
}
if (disposeDeviceMapper.isDeviceExistsByIp(dev.getIpAddr()) > 0) {
return new MReturnType<>(ErrorCode.ERR_DEVICEEXISTS, dev.getIpAddr());
}