use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method operationReturnsObjectType.
@Test
public void operationReturnsObjectType() {
exception.expect(IllegalModelDefinitionException.class);
when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(Object.class), false, emptySet()));
validate(extensionModel, validator);
}
use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method sourceReturnsArrayTypeOfDictionaryWithObjectValue.
@Test
public void sourceReturnsArrayTypeOfDictionaryWithObjectValue() {
arrayType = typeBuilder.arrayType().of(dictionaryType).build();
exception.expect(IllegalModelDefinitionException.class);
when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel("", arrayType, false, emptySet()));
validate(extensionModel, validator);
}
use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method before.
@Before
public void before() {
when(extensionModel.getOperationModels()).thenReturn(asList(operationModel));
when(extensionModel.getSourceModels()).thenReturn(asList(sourceModel));
ExtensionTypeDescriptorModelProperty descriptorModelProperty = mock(ExtensionTypeDescriptorModelProperty.class);
when(extensionModel.getModelProperty(ExtensionTypeDescriptorModelProperty.class)).thenReturn(of(descriptorModelProperty));
Type extensionType = mock(Type.class);
when(descriptorModelProperty.getType()).thenReturn(extensionType);
when(extensionType.getDeclaringClass()).thenReturn(of(this.getClass()));
when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(String.class), false, emptySet()));
when(operationModel.getOutputAttributes()).thenReturn(new ImmutableOutputModel(StringUtils.EMPTY, create(JAVA).voidType().build(), false, emptySet()));
when(operationModel.getName()).thenReturn("operation");
mockMetadataResolverFactory(operationModel, null);
when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(String.class), false, emptySet()));
when(sourceModel.getOutputAttributes()).thenReturn(new ImmutableOutputModel(StringUtils.EMPTY, create(JAVA).voidType().build(), false, emptySet()));
when(sourceModel.getName()).thenReturn("source");
when(sourceModel.getSuccessCallback()).thenReturn(of(sourceCallbackModel));
when(sourceModel.getErrorCallback()).thenReturn(of(sourceCallbackModel));
mockMetadataResolverFactory(sourceModel, null);
MetadataKeyIdModelProperty keyIdModelProperty = new MetadataKeyIdModelProperty(loader.load(InvalidMetadataKeyIdPojo.class), EMPTY);
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(of(keyIdModelProperty));
when(operationModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(empty());
when(sourceModel.getModelProperty(ExtensionOperationDescriptorModelProperty.class)).thenReturn(empty());
when(operationModel.getModelProperty(ExtensionOperationDescriptorModelProperty.class)).thenReturn(empty());
visitableMock(operationModel, sourceModel);
dictionaryType = typeBuilder.objectType().openWith(toMetadataType(Object.class)).build();
}
use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method operationReturnsDictionaryTypeWithObjectTypeValue.
@Test
public void operationReturnsDictionaryTypeWithObjectTypeValue() {
exception.expect(IllegalModelDefinitionException.class);
when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel("", dictionaryType, false, emptySet()));
validate(extensionModel, validator);
}
use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method sourceReturnsObjectTypeWithDefinedOutputResolver.
@Test
public void sourceReturnsObjectTypeWithDefinedOutputResolver() {
when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(Object.class), false, emptySet()));
mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(NULL_RESOLVER_SUPPLIER, emptyMap(), SIMPLE_OUTPUT_RESOLVER, NULL_RESOLVER_SUPPLIER));
validate(extensionModel, validator);
}
Aggregations