use of io.servicecomb.demo.compute.Person in project java-chassis by ServiceComb.
the class JaxrsClient method testPost.
private static void testPost(RestTemplate template, String cseUrlPrefix) {
Map<String, String> params = new HashMap<>();
params.put("a", "5");
params.put("b", "3");
int result = template.postForObject(cseUrlPrefix + "/compute/add", params, Integer.class);
TestMgr.check(8, result);
Person person = new Person();
person.setName("world");
Person resultPerson = template.postForObject(cseUrlPrefix + "/compute/sayhello", person, Person.class);
TestMgr.check("hello world", resultPerson.getName());
HttpHeaders headers = new HttpHeaders();
headers.add("prefix", "haha");
HttpEntity<Person> reqEntity = new HttpEntity<>(person, headers);
TestMgr.check("haha world", template.postForObject(cseUrlPrefix + "/compute/saysomething", reqEntity, String.class));
}
use of io.servicecomb.demo.compute.Person in project java-chassis by ServiceComb.
the class CodeFirstPojoClient method testCodeFirstSaySomething.
protected void testCodeFirstSaySomething(CodeFirstPojoIntf codeFirst) {
Person person = new Person();
person.setName("person name");
String result = codeFirst.saySomething("prefix prefix", person);
TestMgr.check("prefix prefix person name", result);
}
use of io.servicecomb.demo.compute.Person in project java-chassis by ServiceComb.
the class CodeFirstPojoClient method testCodeFirstSayHello.
protected void testCodeFirstSayHello(CodeFirstPojoIntf codeFirst) {
Person input = new Person();
input.setName("person name");
Person result = codeFirst.sayHello(input);
TestMgr.check("hello person name", result.getName());
}
use of io.servicecomb.demo.compute.Person in project java-chassis by ServiceComb.
the class CodeFirstRestTemplate method testCodeFirstSaySomething.
protected void testCodeFirstSaySomething(RestTemplate template, String cseUrlPrefix) {
Person person = new Person();
person.setName("person name");
HttpHeaders headers = new HttpHeaders();
headers.add("prefix", "prefix prefix");
HttpEntity<Person> requestEntity = new HttpEntity<>(person, headers);
String result = template.postForObject(cseUrlPrefix + "saysomething", requestEntity, String.class);
TestMgr.check("prefix prefix person name", result);
}
use of io.servicecomb.demo.compute.Person in project java-chassis by ServiceComb.
the class JaxrsClient method testExchange.
private static void testExchange(RestTemplate template, String cseUrlPrefix) {
HttpHeaders headers = new HttpHeaders();
headers.add("Accept", MediaType.APPLICATION_JSON);
Person person = new Person();
person.setName("world");
HttpEntity<Person> requestEntity = new HttpEntity<>(person, headers);
ResponseEntity<Person> resEntity = template.exchange(cseUrlPrefix + "/compute/sayhello", HttpMethod.POST, requestEntity, Person.class);
TestMgr.check("hello world", resEntity.getBody());
ResponseEntity<String> resEntity2 = template.exchange(cseUrlPrefix + "/compute/addstring?s=abc&s=def", HttpMethod.DELETE, null, String.class);
TestMgr.check("abcdef", resEntity2.getBody());
}
Aggregations