Merge remote-tracking branch 'origin/v2.0.0_dev' into v2.0.0_dev

This commit is contained in:
HuangXin 2020-08-12 16:34:55 +08:00
commit 1ccdc5e194
2 changed files with 95 additions and 0 deletions

View File

@ -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<ErrorCode, DeviceFirewareInfo> 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");
}
}
}

View File

@ -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<ErrorCode, DeviceFirewareInfo> 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");
}
}
}