diff --git a/src/test/java/com/dispose/test/dptech/DPTechInterfaceTestCase.java b/src/test/java/com/dispose/test/dptech/DPTechInterfaceTestCase.java index b0f4694c..59c28785 100644 --- a/src/test/java/com/dispose/test/dptech/DPTechInterfaceTestCase.java +++ b/src/test/java/com/dispose/test/dptech/DPTechInterfaceTestCase.java @@ -5,6 +5,7 @@ import com.dispose.ability.impl.DpTechAbilityImpl; import com.dispose.common.*; import com.dispose.pojo.entity.DisposeDevice; import com.dispose.pojo.po.MulReturnType; +import com.dispose.pojo.vo.DeviceFirewareInfo; import com.dispose.test.Global.InitTestEnvironment; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; @@ -133,4 +134,51 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment { Assert.assertEquals(ret.getFirstParam(), ErrorCode.ERR_OK); } } + + /** + * T 3 Gets ability device fireware.. + */ + @Test + public void t3_getAbilityDeviceFirewareTest() { + DisposeAbility db; + + DisposeDevice dev = DisposeDevice.builder() + .ipAddr("10.88.77.15") + .ipPort("") + .deviceType(DisposeDeviceType.DPTECH_UMC) + .areaCode(0) + .deviceName("中移杭研实验室迪普清洗设备") + .manufacturer("DPTech") + .model("UMC") + .version("5.7.13") + .userName("admin") + .password("UMCAdministrator") + .urlPath("UMC/service/AbnormalFlowCleaningService") + .urlType(HttpType.HTTP) + .readme("实验室测试设备") + .status(ObjectStatus.NORMAL) + .build(); + + String httpType = dev.getUrlType() == HttpType.HTTP ? "http://" : "https://"; + String addr = getAbilityMapKey(dev.getIpAddr(), dev.getIpPort()); + String url = httpType + addr + "/" + dev.getUrlPath(); + + if (dev.getDeviceType().getValue().equals(DPTECH_UMC)) { + db = new DpTechAbilityImpl(); + + // 初始化设备 + db.initDeviceEnv(url, dev.getUserName(), dev.getPassword()); + + Assert.assertTrue(db.getDeviceLinkStatus()); + MulReturnType ret = db.getAbilityDeviceFireware(); + + Assert.assertEquals(ret.getFirstParam(), ErrorCode.ERR_OK); + Assert.assertEquals(ret.getSecondParam().getVendor(), "DpTech"); + Assert.assertEquals(ret.getSecondParam().getModel(), "UMC"); + Assert.assertEquals(ret.getSecondParam().getOs(), "Windows Server"); + Assert.assertEquals(ret.getSecondParam().getKernel(), "Windows"); + Assert.assertEquals(ret.getSecondParam().getArch(), "x86_64"); + Assert.assertEquals(ret.getSecondParam().getVersion(), "5.7.31"); + } + } } diff --git a/src/test/java/com/dispose/test/haohan/HAOHanInterfaceTestCast.java b/src/test/java/com/dispose/test/haohan/HAOHanInterfaceTestCast.java index 31a652bb..51bc6ab8 100644 --- a/src/test/java/com/dispose/test/haohan/HAOHanInterfaceTestCast.java +++ b/src/test/java/com/dispose/test/haohan/HAOHanInterfaceTestCast.java @@ -5,6 +5,7 @@ import com.dispose.ability.impl.HaoHanAbilityImpl; import com.dispose.common.*; import com.dispose.pojo.entity.DisposeDevice; import com.dispose.pojo.po.MulReturnType; +import com.dispose.pojo.vo.DeviceFirewareInfo; import com.dispose.test.Global.InitTestEnvironment; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; @@ -133,4 +134,50 @@ public class HAOHanInterfaceTestCast extends InitTestEnvironment { Assert.assertEquals(ret.getFirstParam(), ErrorCode.ERR_OK); } } + + /** + * T 3 Gets ability device fireware.. + */ + @Test + public void t3_getAbilityDeviceFirewareTest() { + DisposeAbility db; + + DisposeDevice dev = DisposeDevice.builder() + .ipAddr("10.88.77.88") + .ipPort("18080") + .deviceType(DisposeDeviceType.HAOHAN_PLATFORM) + .areaCode(0) + .deviceName("中移杭研实验室浩瀚清洗设备") + .manufacturer("Haohan") + .model("Unknown") + .version("Unknown") + .userName("") + .password("") + .urlPath("DDoSClean/clean") + .urlType(HttpType.HTTP) + .readme("实验室测试设备") + .status(ObjectStatus.NORMAL) + .build(); + + String httpType = dev.getUrlType() == HttpType.HTTP ? "http://" : "https://"; + String addr = getAbilityMapKey(dev.getIpAddr(), dev.getIpPort()); + String url = httpType + addr + "/" + dev.getUrlPath(); + + if (dev.getDeviceType().getValue().equals(HAOHAN_PLATFORM)) { + db = new HaoHanAbilityImpl(); + + // 初始化设备 + db.initDeviceEnv(url, dev.getUserName(), dev.getPassword()); + + Assert.assertTrue(db.getDeviceLinkStatus()); + MulReturnType ret = db.getAbilityDeviceFireware(); + + Assert.assertEquals(ret.getFirstParam(), ErrorCode.ERR_OK); + Assert.assertEquals(ret.getSecondParam().getVendor(), "HaoHan"); + Assert.assertEquals(ret.getSecondParam().getOs(), "Linux Server"); + Assert.assertEquals(ret.getSecondParam().getKernel(), "Linux"); + Assert.assertEquals(ret.getSecondParam().getArch(), "x86_64"); + Assert.assertEquals(ret.getSecondParam().getVersion(), "Unknown"); + } + } }