Commit a379ea1b LN

接口测试增加验证

1 个父辈 6411bc91
......@@ -72,7 +72,12 @@ public class EquipConfigController {
String ip = config.GetConfigValue("host", "");
int webPort = config.GetConfigValue("webPort", 0);
String webUrl = String.format("ws://%s:%d/", ip, webPort);
if (ObjectUtil.isEmpty(ip)) {
return ResultBean.newErrorResult(1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"host"});
}
if (ObjectUtil.isEmpty(webPort)||webPort==0) {
return ResultBean.newErrorResult(1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"webPort"});
}
if (TMSCommunicator.wsURL.equals(webUrl)) {
result = tmsCommunicator.isConnected();
} else {
......@@ -81,6 +86,12 @@ public class EquipConfigController {
} else {
String ip = config.GetConfigValue("host", "");
int apiPort = config.GetConfigValue("apiPort", 0);
if (ObjectUtil.isEmpty(ip)) {
return ResultBean.newErrorResult(1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"host"});
}
if (ObjectUtil.isEmpty(apiPort)||apiPort==0) {
return ResultBean.newErrorResult(1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"apiPort"});
}
result=tmsApis.TestApi(ip,apiPort);
}
......
......@@ -58,8 +58,16 @@ public class EquipConfigUtil {
if(equipType.equals(EquipmentType.PANACIMNEOLINK.name())) {
//增加配置
LinkedHashMap<String, Object> defMap = new LinkedHashMap<>();
defMap.put("PanaCIMIP", dataCache.getCache(Constants.Cache_PanaCIMIP));
defMap.put("PanaCIMPort", dataCache.getCache(Constants.Cache_PanaCIMPort));
String ip=dataCache.getCache(Constants.Cache_PanaCIMIP);
if(ip==null){
ip="";
}
String port=dataCache.getCache(Constants.Cache_PanaCIMPort);
if(port==null){
port="";
}
defMap.put("PanaCIMIP", ip);
defMap.put("PanaCIMPort", port);
configInfo.setApiConfigMap(defMap);
}
......
......@@ -546,6 +546,7 @@ public class TMSApis {
storageTypes.add(type);
isConns.add(Integer.parseInt(conCode));
i++;
break;
}
String RequestID="0";
......
......@@ -737,6 +737,10 @@ public class PanaApiController extends BaseSmfApiListener {
String keepAliveUrl=getkeepAliveUrl();
try{
if(ObjectUtil.isEmpty(keepAliveUrl)){
log.error("未找到地址 keepAliveUrl,返回false");
return false;
}
Map<String,Object> result = HttpHelper.getJsonResult(keepAliveUrl,new HashMap<>(),3000);
if(result!=null&&result.size()==2){
int code=(Integer)result.get("code");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!