fix(项目设置): 【项目管理】项目设置里,TCP-mock开启后,接口定义里还是显示未开启
--bug=1013755 --user=宋天阳 【项目管理】项目设置里,TCP-mock开启后,接口定义里还是显示未开启 https://www.tapd.cn/55049933/s/1171790
This commit is contained in:
parent
7f0982c613
commit
8bf88fed9a
|
@ -231,16 +231,17 @@ public class ApiTestEnvironmentService {
|
|||
Integer mockPortStr = config.getMockTcpPort();
|
||||
if(mockPortStr != null && mockPortStr != 0){
|
||||
if(configObj.containsKey("tcpConfig")){
|
||||
if(configObj.containsKey("port")){
|
||||
if(configObj.getInteger("port").intValue() != mockPortStr){
|
||||
JSONObject tcpConfigObj = configObj.getJSONObject("tcpConfig");
|
||||
if(tcpConfigObj.containsKey("port")){
|
||||
if(tcpConfigObj.getInteger("port").intValue() != mockPortStr){
|
||||
needUpdate = true;
|
||||
}
|
||||
}else {
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if(configObj.containsKey("server")){
|
||||
if(!StringUtils.equals(configObj.getString("server"),url)){
|
||||
if(tcpConfigObj.containsKey("server")){
|
||||
if(!StringUtils.equals(tcpConfigObj.getString("server"),url)){
|
||||
needUpdate = true;
|
||||
}
|
||||
}else {
|
||||
|
@ -342,6 +343,20 @@ public class ApiTestEnvironmentService {
|
|||
httpConfig.put("conditions", httpItemArr);
|
||||
httpConfig.put("defaultCondition", "NONE");
|
||||
|
||||
JSONObject tcpConfigObj = new JSONObject();
|
||||
tcpConfigObj.put("classname", "TCPClientImpl");
|
||||
tcpConfigObj.put("reUseConnection", false);
|
||||
tcpConfigObj.put("nodelay", false);
|
||||
tcpConfigObj.put("closeConnection", false);
|
||||
if(project != null){
|
||||
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.MOCK_TCP_PORT.name());
|
||||
Integer mockPort = config.getMockTcpPort();
|
||||
if(mockPort != null && mockPort != 0){
|
||||
tcpConfigObj.put("server", tcpSocket);
|
||||
tcpConfigObj.put("port", mockPort);
|
||||
}
|
||||
}
|
||||
|
||||
ApiTestEnvironmentWithBLOBs blobs = null;
|
||||
if(StringUtils.isNotEmpty(envId)) {
|
||||
blobs = this.get(envId);
|
||||
|
@ -349,6 +364,7 @@ public class ApiTestEnvironmentService {
|
|||
if(blobs != null && StringUtils.isNotEmpty(blobs.getConfig())){
|
||||
JSONObject object = JSONObject.parseObject(blobs.getConfig());
|
||||
object.put("httpConfig", httpConfig);
|
||||
object.put("tcpConfig", tcpConfigObj);
|
||||
blobs.setConfig(object.toString());
|
||||
}else {
|
||||
blobs = new ApiTestEnvironmentWithBLOBs();
|
||||
|
@ -363,20 +379,6 @@ public class ApiTestEnvironmentService {
|
|||
|
||||
JSONArray databaseConfigObj = new JSONArray();
|
||||
|
||||
JSONObject tcpConfigObj = new JSONObject();
|
||||
tcpConfigObj.put("classname", "TCPClientImpl");
|
||||
tcpConfigObj.put("reUseConnection", false);
|
||||
tcpConfigObj.put("nodelay", false);
|
||||
tcpConfigObj.put("closeConnection", false);
|
||||
if(project != null){
|
||||
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.MOCK_TCP_PORT.name());
|
||||
Integer mockPort = config.getMockTcpPort();
|
||||
if(mockPort != null && mockPort != 0){
|
||||
tcpConfigObj.put("server", tcpSocket);
|
||||
tcpConfigObj.put("port", mockPort);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("commonConfig", commonConfigObj);
|
||||
object.put("httpConfig", httpConfig);
|
||||
|
|
Loading…
Reference in New Issue