use of io.servicecomb.demo.server.TestRequest 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.TestRequest in project java-chassis by ServiceComb.
the class PojoClient method testWrapParam.
private static void testWrapParam(Test test) {
User user = new User();
TestRequest request = new TestRequest();
request.setUser(user);
request.setIndex(0);
request.setData(buffer);
request.getUsers().add(user);
User result = test.wrapParam(request);
LOGGER.info("wrap param result:{}", result);
TestMgr.check("User [name=nameA, users count:1, age=100, index=0]", result);
}
use of io.servicecomb.demo.server.TestRequest in project java-chassis by ServiceComb.
the class ClientThread method run.
@Override
public void run() {
Test test = PojoClient.test;
CseContext.getInstance().getConsumerProviderManager().setTransport("pojo", Config.getTransport());
System.out.printf("test %s performance\n", Config.getTransport());
while (isRunning()) {
int idx = 0;
for (; ; ) {
User user = new User();
TestRequest request = new TestRequest();
request.setUser(user);
request.setIndex(idx);
request.setData(PojoClient.buffer);
try {
User result = test.wrapParam(request);
if (result.getIndex() != idx) {
System.out.printf("error result:%s, expect idx %d\n", result, idx);
}
} catch (Throwable e) {
// e.printStackTrace();
}
}
}
}
use of io.servicecomb.demo.server.TestRequest in project java-chassis by ServiceComb.
the class PojoClientTest method testWrapParam.
private static void testWrapParam(Test test) {
User user = new User();
TestRequest request = new TestRequest();
request.setUser(user);
request.setIndex(0);
request.setData(buffer);
request.getUsers().add(user);
User result = test.wrapParam(request);
LOGGER.info("wrap param result:{}", result);
TestMgr.check("User [name=nameA, users count:1, age=100, index=0]", result);
}
Aggregations