REM:
1. 解决manager层设备管理单元测试的报错问题
This commit is contained in:
chenlinghy 2020-08-26 17:08:30 +08:00
parent 54f51224ca
commit 2c08b1cb39
1 changed files with 24 additions and 4 deletions

View File

@ -1,11 +1,9 @@
package com.dispose.test.manager; package com.dispose.test.manager;
import com.dispose.common.DisposeDeviceType; import com.dispose.common.*;
import com.dispose.common.ErrorCode;
import com.dispose.common.HttpType;
import com.dispose.common.ObjectStatus;
import com.dispose.manager.DisposeDeviceManager; import com.dispose.manager.DisposeDeviceManager;
import com.dispose.mapper.DisposeDeviceMapper; import com.dispose.mapper.DisposeDeviceMapper;
import com.dispose.pojo.entity.DisposeCapacity;
import com.dispose.pojo.entity.DisposeDevice; import com.dispose.pojo.entity.DisposeDevice;
import com.dispose.pojo.po.MulReturnType; import com.dispose.pojo.po.MulReturnType;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
@ -62,6 +60,16 @@ public class DisposeDeviceManagerTest {
*/ */
@Test @Test
public void a1_addDisposeDevice() { public void a1_addDisposeDevice() {
Long deviceId = disposeDeviceMapper.selectAll().get(0).getId();
List<DisposeCapacity> devCap = new ArrayList<>();
devCap.add(DisposeCapacity.builder()
.deviceId(deviceId)
.ipType(IpAddrType.IPV4_IPV6)
.capacityType(DisposeCapacityType.CLEANUP)
.objectType(DisposeObjectType.IP)
.protectIp("")
.build());
for (int i = 1; i < 3; i++) { for (int i = 1; i < 3; i++) {
String ipAddr = "192.168.0." + i; String ipAddr = "192.168.0." + i;
@ -81,6 +89,7 @@ public class DisposeDeviceManagerTest {
.urlType(HttpType.HTTP) .urlType(HttpType.HTTP)
.readme("实验室测试设备") .readme("实验室测试设备")
.status(ObjectStatus.NORMAL) .status(ObjectStatus.NORMAL)
.devCapacity(devCap)
.build(); .build();
MulReturnType<ErrorCode, Long> ret = disposeDeviceManager.addDisposeDevice(dev); MulReturnType<ErrorCode, Long> ret = disposeDeviceManager.addDisposeDevice(dev);
@ -122,6 +131,16 @@ public class DisposeDeviceManagerTest {
*/ */
@Test @Test
public void a2_upgradeDisposeDevice() throws JsonProcessingException { public void a2_upgradeDisposeDevice() throws JsonProcessingException {
Long deviceId = disposeDeviceMapper.selectAll().get(0).getId();
List<DisposeCapacity> devCap = new ArrayList<>();
devCap.add(DisposeCapacity.builder()
.deviceId(deviceId)
.ipType(IpAddrType.IPV4_IPV6)
.capacityType(DisposeCapacityType.CLEANUP)
.objectType(DisposeObjectType.IP)
.protectIp("")
.build());
for (int i = 1; i < 3; i++) { for (int i = 1; i < 3; i++) {
String ipAddr = "192.168.0." + i; String ipAddr = "192.168.0." + i;
@ -141,6 +160,7 @@ public class DisposeDeviceManagerTest {
.urlType(HttpType.HTTP) .urlType(HttpType.HTTP)
.readme("实验室测试设备") .readme("实验室测试设备")
.status(ObjectStatus.NORMAL) .status(ObjectStatus.NORMAL)
.devCapacity(devCap)
.build(); .build();
disposeDeviceManager.addDisposeDevice(dev); disposeDeviceManager.addDisposeDevice(dev);