use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class MyHandler method handle.
@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
LOGGER.info("If you see this log, that means this demo project has been converted to ServiceComb framework.");
invocation.next(response -> {
if (invocation.getOperationMeta().getSchemaQualifiedName().equals("server.splitParam")) {
User user = response.getResult();
user.setName(user.getName() + SPLITPARAM_RESPONSE_USER_SUFFIX);
asyncResp.handle(response);
} else {
asyncResp.handle(response);
}
});
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class TestGeneric method testHolderUser_rest.
@SuppressWarnings("unchecked")
private void testHolderUser_rest() {
Holder<User> holder = new Holder<>(new User());
Holder<User> result = intf.testHolderUser(holder);
TestMgr.check("{\"name\":\"nameA\",\"age\":100,\"index\":0,\"names\":null}", result.value.jsonString());
result = restTemplate.postForObject(prefix + "/holderUser", holder, Holder.class);
TestMgr.check("{\"name\":\"nameA\",\"age\":100,\"index\":0,\"names\":null}", result.value.jsonString());
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class CodeFirstPojoClient method testCodeFirstUserArray.
private void testCodeFirstUserArray(CodeFirstPojoIntf codeFirst) {
User user1 = new User();
user1.setNames(new String[] { "u1", "u2" });
User user2 = new User();
user2.setNames(new String[] { "u3", "u4" });
User[] users = new User[] { user1, user2 };
List<User> result = codeFirst.testUserArray(Arrays.asList(users));
TestMgr.check("u1", result.get(0).getNames()[0]);
TestMgr.check("u2", result.get(0).getNames()[1]);
TestMgr.check("u3", result.get(1).getNames()[0]);
TestMgr.check("u4", result.get(1).getNames()[1]);
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class PojoClient method testCommonInvoke.
private static void testCommonInvoke(String transport) {
Object result = InvokerUtils.syncInvoke("pojo", "server", "splitParam", new Object[] { 2, new User() });
TestMgr.check("User [name=nameA, users count:0, age=100, index=2]", result);
result = InvokerUtils.syncInvoke("pojo", "0.0.4", transport, "server", "splitParam", new Object[] { 3, new User() });
TestMgr.check("User [name=nameA, users count:0, age=100, index=3]", result);
}
use of org.apache.servicecomb.demo.server.User in project incubator-servicecomb-java-chassis by apache.
the class PojoClient method testChinese.
private static void testChinese(Test test) {
TestMgr.check("code is '测试'", test.getTestString("测试"));
User user = new User();
user.setName("名字");
User result = test.splitParam(1, user);
TestMgr.check("名字, users count:0", result.getName());
}
Aggregations