use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.
the class OperationReturnTypeModelValidatorTestCase method muleEventReturnType.
@Test(expected = IllegalModelDefinitionException.class)
public void muleEventReturnType() {
when(methodElement.getReturnType()).thenReturn(new TypeWrapper(forType(new TypeToken<CoreEvent>() {
}.getType()), typeLoader));
validate(extensionModel, validator);
}
use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.
the class OperationReturnTypeModelValidatorTestCase method before.
@Before
public void before() {
ExtensionOperationDescriptorModelProperty modelProperty = new ExtensionOperationDescriptorModelProperty(methodElement);
when(extensionModel.getOperationModels()).thenReturn(asList(operationModel));
when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel("Message.Payload", toMetadataType(String.class), false, emptySet()));
when(operationModel.getName()).thenReturn("operation");
when(operationModel.getModelProperty(ExtensionOperationDescriptorModelProperty.class)).thenReturn(Optional.of(modelProperty));
when(methodElement.getReturnType()).thenReturn(new TypeWrapper(String.class, typeLoader));
visitableMock(operationModel);
}
use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.
the class ParameterGroupModelValidatorTestCase method skipEmptyGroupValidationInRuntimeMode.
@Test
public void skipEmptyGroupValidationInRuntimeMode() {
when(extensionModel.getModelProperty(CompileTimeModelProperty.class)).thenReturn(empty());
ParameterGroupDescriptor descriptor = new ParameterGroupDescriptor("name", new TypeWrapper(EmptyGroupPojo.class, typeLoader), null, mock(AnnotatedElement.class), null);
when(groupModel.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(of(new ParameterGroupModelProperty(descriptor)));
validate(extensionModel, validator);
}
use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.
the class SoapInvokeOperationDeclarer method declareMetadataKeyParameters.
/**
* Given the Invoke Operation Declarer declares all the parameters that the operation has.
*
* @param operation the invoke operation declarer.
*/
private void declareMetadataKeyParameters(OperationDeclarer operation, ClassTypeLoader loader, ReflectionCache reflectionCache) {
TypeWrapper keyType = new TypeWrapper(WebServiceTypeKey.class, loader);
ParameterGroupDeclarer group = operation.onParameterGroup(KEYS_GROUP).withModelProperty(new ParameterGroupModelProperty(new ParameterGroupDescriptor(KEYS_GROUP, keyType)));
StringType stringType = TYPE_BUILDER.stringType().build();
group.withRequiredParameter(SERVICE_PARAM).withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, SERVICE_PARAM, reflectionCache).get())).ofType(stringType).withModelProperty(new MetadataKeyPartModelProperty(1)).withLayout(getLayout(1));
group.withRequiredParameter(OPERATION_PARAM).ofType(stringType).withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, OPERATION_PARAM, reflectionCache).get())).withModelProperty(new MetadataKeyPartModelProperty(2)).withLayout(getLayout(2));
}
use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper in project mule by mulesoft.
the class ClusterSupportEnricherTestCase method setSourceClass.
private void setSourceClass(Class<? extends Source> sourceClass) {
ExtensionTypeDescriptorModelProperty property = new ExtensionTypeDescriptorModelProperty(new TypeWrapper(sourceClass, typeLoader));
when(sourceDeclaration.getModelProperty(ExtensionTypeDescriptorModelProperty.class)).thenReturn(Optional.of(property));
}
Aggregations