use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.
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() {
Response response = Response.createSuccess(Status.ACCEPTED, new User());
response.getHeaders().addHeader("h1", "h1v").addHeader("h2", "h2v");
return response;
}
use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.
the class ClientVerticle method send.
protected void send(Long event) {
User user = new User();
TestRequest request = new TestRequest();
request.setUser(user);
request.setIndex(idx);
request.setData(PojoClient.buffer);
SchemaMeta schemaMeta = config.getMicroserviceMeta().ensureFindSchemaMeta("server");
Object[] args = new Object[] { request };
Invocation invocation = InvocationFactory.forConsumer(config, schemaMeta, "wrapParam", args);
InvokerUtils.reactiveInvoke(invocation, ar -> {
if (ar.isSuccessed()) {
User result = ar.getResult();
if (result.getIndex() != idx) {
System.out.printf("error result:%s, expect idx %d\n", result, idx);
}
} else {
CommonExceptionData data = (CommonExceptionData) ((InvocationException) ar.getResult()).getErrorData();
System.out.println(data.getMessage());
}
send(null);
});
}
use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.
the class PojoClientTest 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.1", transport, "server", "splitParam", new Object[] { 3, new User() });
TestMgr.check("User [name=nameA, users count:0, age=100, index=3]", result);
}
use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.
the class PojoClientTest 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());
}
use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.
the class PojoClientTest method testSplitParam.
private static void testSplitParam(Test test) {
User result = test.splitParam(1, new User());
LOGGER.info("split param result:{}", result);
TestMgr.check("User [name=nameA, users count:0, age=100, index=1]", result);
}
Aggregations