Search in sources :

Example 1 with JAXBJob

use of org.apache.servicecomb.demo.jaxbbean.JAXBJob in project java-chassis by ServiceComb.

the class CodeFirstRestTemplate method testCodeFirstAppXml.

private void testCodeFirstAppXml(RestTemplate template, String cseUrlPrefix) {
    JAXBPerson person = new JAXBPerson("jake", 22, "it", "60kg");
    person.setJob(new JAXBJob("developer", "coding"));
    HttpHeaders headers = new HttpHeaders();
    headers.add("Accept", MediaType.APPLICATION_XML_VALUE);
    headers.add("Content-Type", MediaType.APPLICATION_JSON_VALUE);
    HttpEntity<JAXBPerson> requestEntity = new HttpEntity<>(person, headers);
    ResponseEntity<JAXBPerson> resEntity = template.exchange(cseUrlPrefix + "appXml", HttpMethod.POST, requestEntity, JAXBPerson.class);
    TestMgr.check(-1, ProduceProcessorManager.INSTANCE.findProcessor(MediaType.APPLICATION_XML_VALUE, null).getOrder());
    // test case maybe fail in JDK 11
    TestMgr.check(person, resEntity.getBody());
}
Also used : JAXBPerson(org.apache.servicecomb.demo.jaxbbean.JAXBPerson) HttpHeaders(org.springframework.http.HttpHeaders) JAXBJob(org.apache.servicecomb.demo.jaxbbean.JAXBJob) HttpEntity(org.springframework.http.HttpEntity)

Aggregations

JAXBJob (org.apache.servicecomb.demo.jaxbbean.JAXBJob)1 JAXBPerson (org.apache.servicecomb.demo.jaxbbean.JAXBPerson)1 HttpEntity (org.springframework.http.HttpEntity)1 HttpHeaders (org.springframework.http.HttpHeaders)1