use of org.apache.servicecomb.demo.compute.Person in project incubator-servicecomb-java-chassis by apache.
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));
}
}
use of org.apache.servicecomb.demo.compute.Person in project incubator-servicecomb-java-chassis by apache.
the class JaxrsIntegrationTestBase method ableToPostWithHeaderWithIdentifier.
@Test
public void ableToPostWithHeaderWithIdentifier() {
Person person = new Person();
person.setName("person name");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(APPLICATION_JSON);
headers.add("prefix-test", "prefix prefix");
HttpEntity<Person> requestEntity = new HttpEntity<>(person, headers);
for (String url : urls) {
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url + "saysomething1", requestEntity, String.class);
assertEquals("prefix prefix person name", jsonBodyOf(responseEntity, String.class));
}
}
use of org.apache.servicecomb.demo.compute.Person in project incubator-servicecomb-java-chassis by apache.
the class SpringMvcIntegrationTestBase 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);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(codeFirstUrl + "saysomething", requestEntity, String.class);
assertThat(jsonOf(responseEntity.getBody(), String.class), is("prefix prefix person name"));
}
use of org.apache.servicecomb.demo.compute.Person in project incubator-servicecomb-java-chassis by apache.
the class SpringMvcIntegrationTestBase method ableToPostObjectAsJson.
@Test
public void ableToPostObjectAsJson() {
Map<String, String> personFieldMap = new HashMap<>();
personFieldMap.put("name", "person name from map");
Person person = restTemplate.postForObject(codeFirstUrl + "sayhello", jsonRequest(personFieldMap), Person.class);
assertThat(person.toString(), is("hello person name from map"));
Person input = new Person();
input.setName("person name from Object");
person = restTemplate.postForObject(codeFirstUrl + "sayhello", jsonRequest(input), Person.class);
assertThat(person.toString(), is("hello person name from Object"));
}
use of org.apache.servicecomb.demo.compute.Person in project incubator-servicecomb-java-chassis by apache.
the class PojoIntegrationTestBase method remoteCodeFirstPojo_saySomething.
@Test
public void remoteCodeFirstPojo_saySomething() {
Person person = new Person();
person.setName("person name");
String result = PojoService.codeFirst.saySomething("prefix prefix", person);
assertThat(result, is("prefix prefix person name"));
}
Aggregations