From c30e609eb477d24476cde8b8d504852189c87897 Mon Sep 17 00:00:00 2001 From: wangyiyun Date: Fri, 4 Sep 2020 10:48:03 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E6=B7=BB=E5=8A=A0=E5=A4=84?= =?UTF-8?q?=E7=BD=AE=E8=83=BD=E5=8A=9B=E9=AA=8C=E8=AF=81=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DisposeAbilityRouterServiceTest.java | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) 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)); + } + } }