Search in sources :

Example 16 with ImmutableOutputModel

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

the class MetadataComponentModelValidatorTestCase method sourceReturnsObjectType.

@Test
public void sourceReturnsObjectType() {
    exception.expect(IllegalModelDefinitionException.class);
    when(sourceModel.getOutput()).thenReturn(new ImmutableOutputModel(EMPTY, toMetadataType(Object.class), 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 17 with ImmutableOutputModel

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

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