????????????????
???????????? ???????[ 2013/5/20 11:29:10 ] ????????
???????????Failsafe?????????м???????
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<configuration>
<includes>
<include>**/integration/**/*Test.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
?????????????“mvn test”???????????????????У???????“mvn integration-test”??????“integration-test”????“test”?????????Σ?????????????????С????????????????????????????????Jenkins????????????????????????????????????????д?????????У????в????м?????????????????????????????????Σ????????м??????????????????????????????????????????е????????????????????????????????????????????????崻????????????ε???????????????????????????????????????????????????????????????????????????С?
?????????????????
????????????????????????????????????????????????????????????????????????????????г????“??????”??????????????????????????????????????????????д?????????????????????????????????????????????????????????????????????
????????????ε??????????????????????????????????????????????????????????????????
PostMethod postMethod = getPostMethod(
velocityContext?? templateName?? soapAction);
new HttpClient().executeMethod(postMethod);
String responseBodyAsString = postMethod.getResponseBodyAsString();
if (responseBodyAsString.contains("faultstring")) {
throw new WmbException();
}
Document document;
try {
LOGGER.info("request:
" + responseBodyAsString);
document = DocumentHelper.parseText(responseBodyAsString);
} catch (Exception e) {
throw new WmbParseException(
e.getMessage() + "
response:
" + responseBodyAsString);
}
return document;
?????????????????????????????????????????????????“???????”???ζ???????????????????????????????????????????????????????????Velocity??????????????????JDOM???????????????????????????????????????????????????Sonar?????????????????????????????????????????????
??????ó????????Extract Method????????????Add Parameter?????????????Remove Parameter??????????????????????????????????????????
// 1. prepare request body
String requestBody = renderTemplate(velocityContext?? templateName);
// 2. execute a post method and get back response body
PostMethod postMethod = getPostMethod(soapAction?? requestBody);
new HttpClient().executeMethod(postMethod);
String responseBody = postMethod.getResponseBodyAsString();
if (responseBodyAsString.contains("faultstring")) {
throw new WmbException();
}
// 3. deal with response body
Document document = parseResponse(responseBody);
return document;
???????????2?δ?????????????????????????????POST????????????????????????????????????????????????????????
????????????????????????Duplicated Code?????????????????????Extract Class???????????????????????????У????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ú????????????κε???????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11