Search in sources :

Example 6 with User

use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.

the class TestImpl method doTest.

private User doTest(int index, User user, List<User> users, byte[] data) {
    if (user == null) {
        user = new User();
    }
    user.setIndex(index);
    int userCount = (users == null) ? 0 : users.size();
    user.setName(user.getName() + ",  users count:" + userCount);
    return user;
}
Also used : User(io.servicecomb.demo.server.User)

Example 7 with User

use of io.servicecomb.demo.server.User 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);
}
Also used : User(io.servicecomb.demo.server.User) TestRequest(io.servicecomb.demo.server.TestRequest)

Example 8 with User

use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.

the class PojoClient 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);
}
Also used : User(io.servicecomb.demo.server.User)

Example 9 with User

use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.

the class CodeFirstSpringmvc method cseResponse.

@ApiResponse(code = 200, response = User.class, message = "")
@ResponseHeaders({ @ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class) })
@RequestMapping(path = "/cseResponse", method = RequestMethod.GET)
public Response cseResponse() {
    Response response = Response.createSuccess(Status.ACCEPTED, new User());
    response.getHeaders().addHeader("h1", "h1v").addHeader("h2", "h2v");
    return response;
}
Also used : ApiResponse(io.swagger.annotations.ApiResponse) Response(io.servicecomb.core.Response) User(io.servicecomb.demo.server.User) ResponseHeaders(io.servicecomb.swagger.extend.annotations.ResponseHeaders) ApiResponse(io.swagger.annotations.ApiResponse) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with User

use of io.servicecomb.demo.server.User in project java-chassis by ServiceComb.

the class CodeFirstRestTemplateSpringmvc method testIntf.

private void testIntf() {
    ResponseEntity<User> responseEntity = intf.responseEntity();
    TestMgr.check("User [name=nameA, age=100, index=0]", responseEntity.getBody());
    TestMgr.check("h1v", responseEntity.getHeaders().getFirst("h1"));
    TestMgr.check("h2v", responseEntity.getHeaders().getFirst("h2"));
    checkStatusCode("springmvc", 202, responseEntity.getStatusCode());
    Response cseResponse = intf.cseResponse();
    TestMgr.check("User [name=nameA, age=100, index=0]", cseResponse.getResult());
    TestMgr.check("h1v", cseResponse.getHeaders().getFirst("h1"));
    TestMgr.check("h2v", cseResponse.getHeaders().getFirst("h2"));
}
Also used : Response(io.servicecomb.core.Response) User(io.servicecomb.demo.server.User)

Aggregations

User (io.servicecomb.demo.server.User)15 TestRequest (io.servicecomb.demo.server.TestRequest)4 Response (io.servicecomb.core.Response)3 ResponseHeaders (io.servicecomb.swagger.extend.annotations.ResponseHeaders)3 ApiResponse (io.swagger.annotations.ApiResponse)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Invocation (io.servicecomb.core.Invocation)1 SchemaMeta (io.servicecomb.core.definition.SchemaMeta)1 CommonExceptionData (io.servicecomb.core.exception.CommonExceptionData)1 Test (io.servicecomb.demo.server.Test)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 HttpHeaders (org.springframework.http.HttpHeaders)1 ResponseEntity (org.springframework.http.ResponseEntity)1