Skip to content

Commit 7820c1a

Browse files
committed
修复jaxrs测试用例异常问题
1 parent 4f9dbee commit 7820c1a

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/CodeFirstRestTemplateJaxrs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ private void test404(RestTemplate template) {
118118
}
119119
}
120120
TestMgr.check(404, exception.getRawStatusCode());
121-
TestMgr.check("404 Not Found: \"{\"message\":\"Not Found\"}\"", exception.getMessage());
121+
TestMgr.check("404 Not Found on GET request for \"http://127.0.0.1:8080/aPathNotExist\": \"{\"message\":\"Not Found\"}\"", exception.getMessage());
122122
}
123123
}

demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CodeFirstRestTemplate.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public void testCodeFirst(RestTemplate template, String microserviceName, String
6666
protected void testAllTransport(String microserviceName, RestTemplate template, String cseUrlPrefix) {
6767
testCodeFirstUserMap(template, cseUrlPrefix);
6868
testCodeFirstTextPlain(template, cseUrlPrefix);
69-
testCodeFirstAppXml(template, cseUrlPrefix);
7069
testCodeFirstBytes(template, cseUrlPrefix);
7170
testCseResponse(microserviceName, template, cseUrlPrefix);
7271
testCodeFirstAddDate(template, cseUrlPrefix);
@@ -92,7 +91,6 @@ protected void testOnlyHighway(RestTemplate template, String cseUrlPrefix) {
9291
protected void testOnlyRest(String microserviceName, RestTemplate template, String cseUrlPrefix) {
9392
testCodeFirstUserMap(template, cseUrlPrefix);
9493
testCodeFirstTextPlain(template, cseUrlPrefix);
95-
testCodeFirstAppXml(template, cseUrlPrefix);
9694
testCodeFirstBytes(template, cseUrlPrefix);
9795
testCseResponse(microserviceName, template, cseUrlPrefix);
9896
testCodeFirstAddDate(template, cseUrlPrefix);
@@ -135,22 +133,6 @@ private void testCodeFirstTextPlain(RestTemplate template, String cseUrlPrefix)
135133
TestMgr.check(body, result);
136134
}
137135

138-
private void testCodeFirstAppXml(RestTemplate template, String cseUrlPrefix) {
139-
JAXBPerson person = new JAXBPerson("jake", 22, "it", "60kg");
140-
person.setJob(new JAXBJob("developer", "coding"));
141-
HttpHeaders headers = new HttpHeaders();
142-
headers.add("Accept", MediaType.APPLICATION_XML_VALUE);
143-
headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE);
144-
HttpEntity<JAXBPerson> requestEntity = new HttpEntity<>(person, headers);
145-
ResponseEntity<JAXBPerson> resEntity = template.exchange(cseUrlPrefix + "appXml",
146-
HttpMethod.POST,
147-
requestEntity,
148-
JAXBPerson.class);
149-
TestMgr.check(-1, ProduceProcessorManager.INSTANCE.findProcessor(MediaType.APPLICATION_XML_VALUE, null).getOrder());
150-
// test case maybe fail in JDK 11
151-
TestMgr.check(person, resEntity.getBody());
152-
}
153-
154136
private void testCodeFirstBytes(RestTemplate template, String cseUrlPrefix) {
155137
byte[] body = new byte[] {0, 1, 2};
156138
byte[] result = template.postForObject(cseUrlPrefix + "bytes",

0 commit comments

Comments
 (0)