Search in sources :

Example 11 with ImmutableOutputModel

use of org.mule.runtime.extension.api.model.ImmutableOutputModel 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 12 with ImmutableOutputModel

use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.

the class MetadataComponentModelValidatorTestCase method sourceReturnsDictionaryType.

@Test
public void sourceReturnsDictionaryType() {
    exception.expect(IllegalModelDefinitionException.class);
    when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel("", dictionaryType, false, emptySet()));
    validate(extensionModel, validator);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 13 with ImmutableOutputModel

use of org.mule.runtime.extension.api.model.ImmutableOutputModel in project mule by mulesoft.

the class MetadataComponentModelValidatorTestCase method sourceReturnsArrayTypeOfObjectWithoutDefinedOutputResolver.

@Test
public void sourceReturnsArrayTypeOfObjectWithoutDefinedOutputResolver() {
    arrayType = typeBuilder.arrayType().of(toMetadataType(Object.class)).build();
    exception.expect(IllegalModelDefinitionException.class);
    when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel("", arrayType, false, emptySet()));
    validate(extensionModel, validator);
}
Also used : ImmutableOutputModel(org.mule.runtime.extension.api.model.ImmutableOutputModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 14 with ImmutableOutputModel

use of org.mule.runtime.extension.api.model.ImmutableOutputModel 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 15 with ImmutableOutputModel

use of org.mule.runtime.extension.api.model.ImmutableOutputModel 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)

Aggregations

ImmutableOutputModel (org.mule.runtime.extension.api.model.ImmutableOutputModel)17 Test (org.junit.Test)12 SmallTest (org.mule.tck.size.SmallTest)12 DefaultMetadataResolverFactory (org.mule.runtime.core.internal.metadata.DefaultMetadataResolverFactory)5 Before (org.junit.Before)4 MetadataKeyIdModelProperty (org.mule.runtime.extension.api.property.MetadataKeyIdModelProperty)3 MetadataType (org.mule.metadata.api.model.MetadataType)2 NullMetadataResolver (org.mule.runtime.extension.api.metadata.NullMetadataResolver)2 ExecutionContext (org.mule.runtime.extension.api.runtime.operation.ExecutionContext)2 TestNoConfigMetadataResolver (org.mule.test.metadata.extension.resolver.TestNoConfigMetadataResolver)2 ExtensionsTestUtils.toMetadataType (org.mule.test.module.extension.internal.util.ExtensionsTestUtils.toMetadataType)2 Map (java.util.Map)1 Matchers.anyMap (org.mockito.Matchers.anyMap)1 Matchers.anyObject (org.mockito.Matchers.anyObject)1 Matchers.anyString (org.mockito.Matchers.anyString)1 ArrayType (org.mule.metadata.api.model.ArrayType)1 ObjectType (org.mule.metadata.api.model.ObjectType)1 NotificationDispatcher (org.mule.runtime.api.notification.NotificationDispatcher)1 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 NoRetryPolicyTemplate (org.mule.runtime.core.api.retry.policy.NoRetryPolicyTemplate)1