use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.
the class SoapInvokeOperationDeclarer method declareMetadata.
private void declareMetadata(OperationDeclarer operation, ClassTypeLoader loader) {
ImmutableMap.Builder<String, Supplier<? extends InputTypeResolver>> inputResolver = ImmutableMap.builder();
inputResolver.put(BODY_PARAM, InvokeRequestTypeResolver::new);
inputResolver.put(HEADERS_PARAM, InvokeInputHeadersTypeResolver::new);
inputResolver.put(ATTACHMENTS_PARAM, InvokeInputAttachmentsTypeResolver::new);
DefaultMetadataResolverFactory factory = new DefaultMetadataResolverFactory(InvokeKeysResolver::new, inputResolver.build(), InvokeOutputTypeResolver::new, NullMetadataResolver::new);
operation.withModelProperty(new MetadataResolverFactoryModelProperty(() -> factory));
operation.withModelProperty(new MetadataKeyIdModelProperty(loader.load(WebServiceTypeKey.class), KEYS_GROUP));
}
use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method valid.
@Test
public void valid() {
mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(MOCK_RESOLVER_SUPPLIER, emptyMap(), MOCK_RESOLVER_SUPPLIER, NULL_RESOLVER_SUPPLIER));
validate(extensionModel, validator);
}
use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method metadataResolverWithDifferentCategories.
@Test
public void metadataResolverWithDifferentCategories() {
exception.expect(IllegalModelDefinitionException.class);
exception.expectMessage(containsString("specifies metadata resolvers that doesn't belong to the same category"));
mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(ResolverSupplier.of(DifferentCategoryResolver.class), emptyMap(), SIMPLE_OUTPUT_RESOLVER, NULL_RESOLVER_SUPPLIER));
validate(extensionModel, validator);
}
use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method metadataResolverWithEmptyCategoryName.
@Test
public void metadataResolverWithEmptyCategoryName() {
exception.expect(IllegalModelDefinitionException.class);
exception.expectMessage(containsString("which has an empty category name"));
mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(ResolverSupplier.of(EmptyCategoryName.class), emptyMap(), SIMPLE_OUTPUT_RESOLVER, NULL_RESOLVER_SUPPLIER));
validate(extensionModel, validator);
}
use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method metadataResolverWithRepeatedResolverName.
@Test
public void metadataResolverWithRepeatedResolverName() {
exception.expect(IllegalModelDefinitionException.class);
exception.expectMessage(containsString("Resolver names should be unique for a given category"));
Map<String, Supplier<? extends InputTypeResolver>> inputResolvers = new HashedMap();
ParameterModel parameterModel = mock(ParameterModel.class);
when(parameterModel.getName()).thenReturn(PARAMETER_NAME);
when(parameterModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(java.util.Optional.empty());
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(java.util.Optional.empty());
mockParameters(sourceModel, parameterModel);
inputResolvers.put(PARAMETER_NAME, ResolverSupplier.of(SimpleInputResolver.class));
mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(NULL_RESOLVER_SUPPLIER, inputResolvers, SIMPLE_OUTPUT_RESOLVER, NULL_RESOLVER_SUPPLIER));
validate(extensionModel, validator);
}
Aggregations