diff --git a/src/test/java/com/dispose/test/service/DisposeAbilityRouterServiceTest.java b/src/test/java/com/dispose/test/service/DisposeAbilityRouterServiceTest.java index 22f5b76e..6c1bd3cc 100644 --- a/src/test/java/com/dispose/test/service/DisposeAbilityRouterServiceTest.java +++ b/src/test/java/com/dispose/test/service/DisposeAbilityRouterServiceTest.java @@ -1,12 +1,12 @@ package com.dispose.test.service; -import com.dispose.common.DisposeDeviceType; -import com.dispose.common.ErrorCode; -import com.dispose.common.HttpType; -import com.dispose.common.ObjectStatus; +import com.dispose.common.*; import com.dispose.manager.DisposeDeviceManager; import com.dispose.mapper.DisposeDeviceMapper; +import com.dispose.mapper.DisposeTaskMapper; +import com.dispose.pojo.entity.DisposeCapacity; import com.dispose.pojo.entity.DisposeDevice; +import com.dispose.pojo.entity.DisposeTask; import com.dispose.pojo.po.AbilityInfo; import com.dispose.pojo.po.MulReturnType; import com.dispose.service.DisposeAbilityRouterService; @@ -66,6 +66,11 @@ public class DisposeAbilityRouterServiceTest extends InitTestEnvironment { */ @Resource private DisposeDeviceManager disposeDeviceManager; + /** + * The dispose device manager. + */ + @Resource + private DisposeTaskMapper disposeTaskMapper; /** * The Object mapper. */ @@ -269,4 +274,30 @@ public class DisposeAbilityRouterServiceTest extends InitTestEnvironment { } }); } + /** + * A 9 verify dispose capacity test. + */ + @Test + public void a9_verifyDisposeCapacityTest(){ + long deviceId = disposeDeviceMapper.selectAll().get(0).getId(); + DisposeCapacityType capacityType = DisposeCapacityType.CLEANUP; + String disposeIp = disposeTaskMapper.selectAll().get(0).getDisposeIp(); + + ErrorCode err = disposeAbilityRouterService.verifyDisposeCapacity(deviceId,disposeIp,capacityType); + if(err == ErrorCode.ERR_NOSUCHDEVICE){ + Assert.assertNotEquals(deviceId,-1L); + for (DisposeDevice d : disposeDeviceMapper.selectAll()) { + Assert.assertNotEquals(java.util.Optional.ofNullable(d.getId()),deviceId); + } + }else if(err == ErrorCode.ERR_NOSUCHTYPE){ + Assert.assertNotEquals((int) capacityType.getValue(), 0); + Assert.assertNotEquals((int) capacityType.getValue(), 1); + Assert.assertNotEquals((int) capacityType.getValue(), 2); + Assert.assertNotEquals((int) capacityType.getValue(), 3); + } + else if(err == ErrorCode.ERR_IPNODEVICE) + { + disposeTaskMapper.selectAll().forEach(i -> Assert.assertNotEquals(i.getDisposeIp(), disposeIp)); + } + } }