use of org.raml.model.Response in project microservice_framework by CJSCommonPlatform.
the class HttpActionBuilder method build.
public Action build() {
final Action action = new Action();
action.setType(actionType);
if (description != null) {
action.setDescription(description);
} else if (mappingDescription != null) {
action.setDescription(mappingDescription.build());
}
action.setBody(body);
if (responseMap.isEmpty()) {
final HashMap<String, Response> responsesFromList = new HashMap<>();
responses.forEach(response -> responsesFromList.put(valueOf(OK.getStatusCode()), response));
action.setResponses(responsesFromList);
} else {
action.setResponses(responseMap);
}
if (resource != null) {
action.setResource(resource);
}
action.setQueryParameters(queryParameters);
return action;
}
use of org.raml.model.Response in project microservice_framework by CJSCommonPlatform.
the class HttpActionBuilder method withHttpActionResponseAndEmptyBody.
public HttpActionBuilder withHttpActionResponseAndEmptyBody() {
final Map<String, MimeType> respBody = new HashMap<>();
final Response response = new Response();
response.setBody(respBody);
responses.add(response);
return this;
}
use of org.raml.model.Response in project microservice_framework by CJSCommonPlatform.
the class ResponseBuilder method build.
public Response build() {
final Response response = new Response();
response.setDescription(description);
response.setBody(responseBody);
return response;
}
use of org.raml.model.Response in project microservice_framework by CJSCommonPlatform.
the class ActionsTest method shouldReturnFalseIfActionHasResponseTypesWithAcceptedType.
@Test
public void shouldReturnFalseIfActionHasResponseTypesWithAcceptedType() throws Exception {
final Map<String, Response> responses = new HashMap<>();
responses.put(valueOf(INTERNAL_SERVER_ERROR.getStatusCode()), response().build());
responses.put(valueOf(BAD_REQUEST.getStatusCode()), response().build());
responses.put(valueOf(ACCEPTED.getStatusCode()), response().build());
final Action action = httpAction().withResponsesFrom(responses).build();
assertThat(isSynchronousAction(action), equalTo(false));
}
Aggregations