use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class AbstractContentTypeRamlValidator method validate.
@Override
protected void validate(final Resource resource) {
actionTypes.forEach(actionType -> {
final Action action = resource.getActions().get(actionType);
if (action != null) {
final Collection<MimeType> mediaTypes = mediaTypesToValidate(action);
checkNonEmpty(mediaTypes);
}
});
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class RamlResourceToSubscriptionConverter method asSubscription.
public Subscription asSubscription(final Resource resource) {
final String resourceUri = resource.getUri();
final String subscriptionName = subscriptionNamesGenerator.createSubscriptionNameFrom(resourceUri);
final Collection<MimeType> mimeTypes = resource.getAction(POST).getBody().values();
final List<Event> events = ramlMimeTypeListToEventListConverter.toEvents(mimeTypes);
final String eventSourceName = subscriptionNamesGenerator.createEventSourceNameFrom(resourceUri);
final String jmsUri = jmsUriGenerator.createJmsUriFrom(resourceUri);
final String restUri = null;
final Eventsource eventsource = new Eventsource(eventSourceName, new Location(jmsUri, restUri));
return new Subscription(subscriptionName, events, eventsource);
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class ActionMimeTypeDefinitionTest method shouldCreateWithRequestTypeAndReturnRequestTypeAsNameType.
@Test
public void shouldCreateWithRequestTypeAndReturnRequestTypeAsNameType() throws Exception {
final MimeType mimeType = mock(MimeType.class);
assertThat(definitionWithRequest(mimeType).getNameType(), sameInstance(mimeType));
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class ActionMimeTypeDefinitionTest method shouldCreateWithResponseTypeAndReturnResponseTypeAsResponeType.
@Test
public void shouldCreateWithResponseTypeAndReturnResponseTypeAsResponeType() throws Exception {
final MimeType mimeType = mock(MimeType.class);
assertThat(definitionWithResponse(mimeType).getResponseType(), sameInstance(mimeType));
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class ActionMimeTypeDefinitionTest method shouldCreateWithResponseTypeAndReturnResponseTypeAsNameType.
@Test
public void shouldCreateWithResponseTypeAndReturnResponseTypeAsNameType() throws Exception {
final MimeType mimeType = mock(MimeType.class);
assertThat(definitionWithResponse(mimeType).getNameType(), sameInstance(mimeType));
}
Aggregations