use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class IntrospectionUtilsTestCase method assertReturnType.
private void assertReturnType(String method) throws Exception {
MetadataType returnType = IntrospectionUtils.getMethodReturnType(getMethod(method));
assertThat(returnType, is(instanceOf(StringType.class)));
assertType(returnType, String.class);
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class IntrospectionUtilsTestCase method listWithNoGenerics.
@Test
public void listWithNoGenerics() throws Exception {
MetadataType returnType = IntrospectionUtils.getMethodReturnType(getMethod("listNoGenerics"));
assertThat(returnType, instanceOf(ArrayType.class));
assertThat(((ArrayType) returnType).getType(), instanceOf(ObjectType.class));
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class XmlExtensionLoaderDelegate method extractOutputType.
private void extractOutputType(OutputDeclarer outputDeclarer, ComponentIdentifier componentIdentifier, ComponentModel operationModel, Optional<MetadataType> calculatedOutput) {
Optional<ComponentModel> outputAttributesComponentModel = operationModel.getInnerComponents().stream().filter(child -> child.getIdentifier().equals(componentIdentifier)).findFirst();
outputAttributesComponentModel.ifPresent(outputComponentModel -> outputDeclarer.describedAs(getDescription(outputComponentModel)));
MetadataType metadataType = getMetadataType(outputAttributesComponentModel, calculatedOutput);
outputDeclarer.ofType(metadataType);
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class OperationMessageProcessorTestCase method setUpOperationReturning.
private void setUpOperationReturning(Object payload, Type type) throws InitialisationException {
messageProcessor = createOperationMessageProcessor();
MetadataType mapType = new DefaultExtensionsTypeLoaderFactory().createTypeLoader().load(type);
when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel("desc", mapType, false, emptySet()));
initialiseIfNeeded(messageProcessor, muleContext);
when(operationExecutor.execute(any(ExecutionContext.class))).thenReturn(just(payload));
}
use of org.mule.metadata.api.model.MetadataType in project mule by mulesoft.
the class IntrospectionUtilsTestCase method mapWithNoGenerics.
@Test
public void mapWithNoGenerics() throws Exception {
MetadataType returnType = IntrospectionUtils.getMethodReturnType(getMethod("mapNoGenerics"));
assertThat(returnType, instanceOf(ObjectType.class));
assertThat(((ObjectType) returnType).getOpenRestriction().get(), instanceOf(AnyType.class));
}
Aggregations