Search in sources :

Example 36 with Person

use of org.apache.servicecomb.demo.compute.Person in project java-chassis by ServiceComb.

the class JaxrsIntegrationTestBase method ableToPostWithHeader.

@Test
public void ableToPostWithHeader() {
    Person person = new Person();
    person.setName("person name");
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(APPLICATION_JSON);
    headers.add("prefix", "prefix  prefix");
    HttpEntity<Person> requestEntity = new HttpEntity<>(person, headers);
    for (String url : urls) {
        ResponseEntity<String> responseEntity = restTemplate.postForEntity(url + "saysomething", requestEntity, String.class);
        assertEquals("prefix  prefix person name", jsonBodyOf(responseEntity, String.class));
    }
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) Person(org.apache.servicecomb.demo.compute.Person) Test(org.junit.Test)

Aggregations

Person (org.apache.servicecomb.demo.compute.Person)36 Test (org.junit.Test)16 HttpEntity (org.springframework.http.HttpEntity)13 HttpHeaders (org.springframework.http.HttpHeaders)12 HashMap (java.util.HashMap)8 GenericParam (org.apache.servicecomb.demo.compute.GenericParam)4 JAXBPerson (org.apache.servicecomb.demo.jaxbbean.JAXBPerson)3 ResponseEntity (org.springframework.http.ResponseEntity)3 JsonObject (io.vertx.core.json.JsonObject)2 ArrayList (java.util.ArrayList)2 InputModelForTestIgnore (org.apache.servicecomb.demo.ignore.InputModelForTestIgnore)2 OutputModelForTestIgnore (org.apache.servicecomb.demo.ignore.OutputModelForTestIgnore)2 HttpMessageConverter (org.springframework.http.converter.HttpMessageConverter)2 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)2