fix(Mock测试): 修复Mock期望每更改一次ID自动加一的问题

--bug=1008273 --user=宋天阳 【接口测试】mock期望,每改一次,ID就会+1
https://www.tapd.cn/55049933/s/1073988
This commit is contained in:
song-tianyang 2021-11-24 13:22:43 +08:00 committed by song-tianyang
parent 1b6bbaf236
commit a4573bc76f
1 changed files with 67 additions and 61 deletions

View File

@ -211,17 +211,18 @@ public class MockConfigService {
isSave = true;
request.setId(UUID.randomUUID().toString());
}
//检查名称是否存在
if (request.getName() != null) {
this.checkNameIsExists(request);
}
long timeStmp = System.currentTimeMillis();
String expectNum = this.getMockExpectId(request.getMockConfigId());
MockExpectConfigWithBLOBs model = new MockExpectConfigWithBLOBs();
model.setId(request.getId());
if (isSave) {
String expectNum = this.getMockExpectId(request.getMockConfigId());
model.setExpectNum(expectNum);
}
model.setId(request.getId());
model.setMockConfigId(request.getMockConfigId());
model.setUpdateTime(timeStmp);
model.setStatus(request.getStatus());
@ -268,7 +269,8 @@ public class MockConfigService {
if (index <= savedIndex) {
index = savedIndex + 1;
}
}catch (Exception ignored){}
} catch (Exception ignored) {
}
}
}
return apiNum + index;
@ -292,7 +294,8 @@ public class MockConfigService {
if (index <= savedIndex) {
index = savedIndex + 1;
}
}catch (Exception ignored ){}
} catch (Exception ignored) {
}
}
}
return index;
@ -764,7 +767,8 @@ public class MockConfigService {
int httpCodeNum = 500;
try {
httpCodeNum = Integer.parseInt(responseJsonObj.getString("httpCode"));
}catch (Exception e){}
} catch (Exception e) {
}
response.setStatus(httpCodeNum);
}
if (responseJsonObj.containsKey("delayed")) {
@ -979,6 +983,7 @@ public class MockConfigService {
}
mockConfigMapper.deleteByExample(configExample);
}
public Map<String, List<MockParamSuggestions>> getApiParamsByApiDefinitionBLOBs(ApiDefinitionWithBLOBs apiModel) {
if (apiModel == null) {
return new HashMap<>();
@ -1473,7 +1478,8 @@ public class MockConfigService {
mockExpectConfigMapper.updateByPrimaryKeySelective(model);
}
}
}catch (Exception e){}
} catch (Exception e) {
}
}
}
}