use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.
the class CodeFirstSpringmvc method responseEntity.
@ResponseHeaders({ @ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class) })
@RequestMapping(path = "/responseEntity", method = RequestMethod.GET)
public ResponseEntity<User> responseEntity() {
HttpHeaders headers = new HttpHeaders();
headers.add("h1", "h1v");
headers.add("h2", "h2v");
return new ResponseEntity<User>(new User(), headers, HttpStatus.ACCEPTED);
}
use of io.servicecomb.demo.server.User 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.User in project java-chassis by ServiceComb.
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.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 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());
}
use of io.servicecomb.demo.server.User 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