use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class PojoIntegrationTestBase method remoteTestPojo_splitParam.
@Test
public void remoteTestPojo_splitParam() {
User result = PojoService.test.splitParam(1, new User());
assertThat(result.toString(), is("User [name=nameA, users count:0, age=100, index=1]"));
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class PojoIntegrationTestBase method remoteCodeFirstPojo_testUserMap.
@Test
public void remoteCodeFirstPojo_testUserMap() {
User user1 = new User();
user1.setNames(new String[] { "u1", "u2" });
User user2 = new User();
user2.setNames(new String[] { "u3", "u4" });
Map<String, User> userMap = new HashMap<>();
userMap.put("u1", user1);
userMap.put("u2", user2);
Map<String, User> result = PojoService.codeFirst.testUserMap(userMap);
assertThat(result.get("u1").getNames()[0], is("u1"));
assertThat(result.get("u1").getNames()[1], is("u2"));
assertThat(result.get("u2").getNames()[0], is("u3"));
assertThat(result.get("u2").getNames()[1], is("u4"));
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class CodeFirstJaxrs method cseResponse.
// public Response getUserResponse() {
//
// }
@ApiResponse(code = 200, response = User.class, message = "")
@ResponseHeaders({ @ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class) })
@Path("/cseResponse")
@GET
public Response cseResponse(InvocationContext c1) {
Response response = Response.createSuccess(Status.ACCEPTED, new User());
Headers headers = response.getHeaders();
headers.addHeader("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE).toString());
InvocationContext c2 = ContextUtils.getInvocationContext();
headers.addHeader("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
return response;
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class CodeFirstPojoClient method testCodeFirstUserMap.
private void testCodeFirstUserMap(CodeFirstPojoIntf codeFirst) {
User user1 = new User();
user1.setNames(new String[] { "u1", "u2" });
User user2 = new User();
user2.setNames(new String[] { "u3", "u4" });
Map<String, User> userMap = new HashMap<>();
userMap.put("u1", user1);
userMap.put("u2", user2);
Map<String, User> result = codeFirst.testUserMap(userMap);
TestMgr.check("u1", result.get("u1").getNames()[0]);
TestMgr.check("u2", result.get("u1").getNames()[1]);
TestMgr.check("u3", result.get("u2").getNames()[0]);
TestMgr.check("u4", result.get("u2").getNames()[1]);
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class CodeFirstRestTemplate method testCodeFirstUserMap.
private void testCodeFirstUserMap(RestTemplate template, String cseUrlPrefix) {
User user1 = new User();
user1.setNames(new String[] { "u1", "u2" });
User user2 = new User();
user2.setNames(new String[] { "u3", "u4" });
Map<String, User> userMap = new HashMap<>();
userMap.put("u1", user1);
userMap.put("u2", user2);
@SuppressWarnings("unchecked") Map<String, User> result = template.postForObject(cseUrlPrefix + "testUserMap", userMap, Map.class);
TestMgr.check("u1", result.get("u1").getNames()[0]);
TestMgr.check("u2", result.get("u1").getNames()[1]);
TestMgr.check("u3", result.get("u2").getNames()[0]);
TestMgr.check("u4", result.get("u2").getNames()[1]);
}
Aggregations