Search in sources :

Example 6 with DefaultMetadataResolverFactory

use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory 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);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) DefaultMetadataResolverFactory(org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 7 with DefaultMetadataResolverFactory

use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.

the class MetadataComponentModelValidatorTestCase method operationReturnsDictionaryTypeWithPojoValue.

@Test
public void operationReturnsDictionaryTypeWithPojoValue() {
    dictionaryType = typeBuilder.objectType().openWith(toMetadataType(Apple.class)).build();
    when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel("", dictionaryType, false, emptySet()));
    mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(MOCK_RESOLVER_SUPPLIER, emptyMap(), MOCK_RESOLVER_SUPPLIER, NULL_RESOLVER_SUPPLIER));
    validate(extensionModel, validator);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) Apple(org.mule.tck.testmodels.fruit.Apple) DefaultMetadataResolverFactory(org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 8 with DefaultMetadataResolverFactory

use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.

the class MetadataComponentModelValidatorTestCase method sourceReturnsDictionaryTypeWithDefinedOutputResolver.

@Test
public void sourceReturnsDictionaryTypeWithDefinedOutputResolver() {
    when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel("", dictionaryType, false, emptySet()));
    mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(NULL_RESOLVER_SUPPLIER, emptyMap(), SIMPLE_OUTPUT_RESOLVER, NULL_RESOLVER_SUPPLIER));
    validate(extensionModel, validator);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) DefaultMetadataResolverFactory(org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 9 with DefaultMetadataResolverFactory

use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.

the class MetadataComponentModelValidatorTestCase method sourceReturnsPojoType.

@Test
public void sourceReturnsPojoType() {
    mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(MOCK_RESOLVER_SUPPLIER, emptyMap(), MOCK_RESOLVER_SUPPLIER, NULL_RESOLVER_SUPPLIER));
    when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(Apple.class), false, emptySet()));
    validate(extensionModel, validator);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) DefaultMetadataResolverFactory(org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 10 with DefaultMetadataResolverFactory

use of org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory in project mule by mulesoft.

the class MetadataComponentModelValidatorTestCase method operationWithAttributeResolverButNoAttributes.

@Test
public void operationWithAttributeResolverButNoAttributes() {
    exception.expect(IllegalModelDefinitionException.class);
    when(extensionModel.getSourceModels()).thenReturn(emptyList());
    mockMetadataResolverFactory(operationModel, new DefaultMetadataResolverFactory(NULL_RESOLVER_SUPPLIER, emptyMap(), SIMPLE_OUTPUT_RESOLVER, SIMPLE_OUTPUT_RESOLVER));
    when(operationModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(empty());
    when(operationModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(Object.class), false, emptySet()));
    when(operationModel.getOutputAttributes()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(void.class), false, emptySet()));
    validate(extensionModel, validator);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) DefaultMetadataResolverFactory(org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

DefaultMetadataResolverFactory (org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory)11 Test (org.junit.Test)10 SmallTest (org.mule.tck.size.SmallTest)10 ImmutableOutputModel (org.mule.runtime.extension.api.model.ImmutableOutputModel)5 Supplier (java.util.function.Supplier)2 InputTypeResolver (org.mule.runtime.api.metadata.resolving.InputTypeResolver)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 HashedMap (org.apache.commons.collections.map.HashedMap)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)1 NullMetadataResolverSupplier (org.mule.runtime.core.internal.metadata.NullMetadataResolverSupplier)1 NullMetadataResolver (org.mule.runtime.extension.api.metadata.NullMetadataResolver)1 MetadataKeyIdModelProperty (org.mule.runtime.extension.api.property.MetadataKeyIdModelProperty)1 MetadataResolverFactoryModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.MetadataResolverFactoryModelProperty)1 ResolverSupplier (org.mule.runtime.module.extension.internal.metadata.ResolverSupplier)1 InvokeInputAttachmentsTypeResolver (org.mule.runtime.module.extension.soap.internal.metadata.InvokeInputAttachmentsTypeResolver)1 InvokeInputHeadersTypeResolver (org.mule.runtime.module.extension.soap.internal.metadata.InvokeInputHeadersTypeResolver)1 InvokeKeysResolver (org.mule.runtime.module.extension.soap.internal.metadata.InvokeKeysResolver)1 InvokeOutputTypeResolver (org.mule.runtime.module.extension.soap.internal.metadata.InvokeOutputTypeResolver)1 InvokeRequestTypeResolver (org.mule.runtime.module.extension.soap.internal.metadata.InvokeRequestTypeResolver)1