Search in sources :

Example 6 with SubTypesModel

use of org.mule.runtime.api.meta.model.SubTypesModel in project mule by mulesoft.

the class SoapExtensionWithCustomTransportsDeclarationTestCase method assertSubtypes.

private void assertSubtypes(ExtensionModel model) {
    SubTypesModel subtypes = model.getSubTypes().iterator().next();
    assertThat(getId(subtypes.getBaseType()).get(), is(MessageDispatcherProvider.class.getName()));
    subtypes.getSubTypes().forEach(subtype -> assertThat(getId(subtype).get(), isOneOf(TestHttpMessageDispatcherProvider.class.getName(), DefaultPortalGunDispatcherProvider.class.getName(), MiniverseDispatcherProvider.class.getName())));
}
Also used : SubTypesModel(org.mule.runtime.api.meta.model.SubTypesModel) DefaultPortalGunDispatcherProvider(org.mule.test.ram.DefaultPortalGunDispatcherProvider) TestHttpMessageDispatcherProvider(org.mule.test.ram.TestHttpMessageDispatcherProvider) MiniverseDispatcherProvider(org.mule.test.ram.MiniverseDispatcherProvider)

Example 7 with SubTypesModel

use of org.mule.runtime.api.meta.model.SubTypesModel in project mule by mulesoft.

the class SubtypesModelValidatorTestCase method validSubtypes.

@Test
public void validSubtypes() {
    mockSubTypes(extensionModel, new SubTypesModel(toMetadataType(BaseAbstractPojo.class), singleton(toMetadataType(Pojo.class))), new SubTypesModel(toMetadataType(BaseCustomInterface.class), singleton(toMetadataType(Pojo.class))));
    when(extensionModel.getImportedTypes()).thenReturn(emptySet());
    validate(extensionModel, validator);
}
Also used : SubTypesModel(org.mule.runtime.api.meta.model.SubTypesModel) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 8 with SubTypesModel

use of org.mule.runtime.api.meta.model.SubTypesModel in project mule by mulesoft.

the class NameClashModelValidatorTestCase method topLevelParameterClashOnSubtypeWithSameType.

@Test
public void topLevelParameterClashOnSubtypeWithSameType() {
    ParameterModel offending = getParameter(TOP_LEVEL_SINGULAR_PARAM_NAME, TopLevelTest.class);
    mockParameters(operationModel, offending);
    when(extensionModel.getSubTypes()).thenReturn(ImmutableSet.of(new SubTypesModel(toMetadataType(ChildTest.class), ImmutableSet.of(toMetadataType(TopLevelTest.class)))));
    validate();
}
Also used : SubTypesModel(org.mule.runtime.api.meta.model.SubTypesModel) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 9 with SubTypesModel

use of org.mule.runtime.api.meta.model.SubTypesModel in project mule by mulesoft.

the class SubtypesModelValidatorTestCase method invalidNotSubtypesOfBaseType.

@Test(expected = IllegalModelDefinitionException.class)
public void invalidNotSubtypesOfBaseType() {
    mockSubTypes(extensionModel, new SubTypesModel(toMetadataType(BaseCustomInterface.class), ImmutableSet.of(toMetadataType(AbstractPojo.class), toMetadataType(CustomInterface.class))));
    when(extensionModel.getImportedTypes()).thenReturn(emptySet());
    validate(extensionModel, validator);
}
Also used : SubTypesModel(org.mule.runtime.api.meta.model.SubTypesModel) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

SubTypesModel (org.mule.runtime.api.meta.model.SubTypesModel)9 Test (org.junit.Test)7 SmallTest (org.mule.tck.size.SmallTest)6 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)2 LinkedHashSet (java.util.LinkedHashSet)1 TypeIdAnnotation (org.mule.metadata.api.annotation.TypeIdAnnotation)1 ObjectType (org.mule.metadata.api.model.ObjectType)1 DefaultNumberType (org.mule.metadata.api.model.impl.DefaultNumberType)1 DefaultObjectType (org.mule.metadata.api.model.impl.DefaultObjectType)1 DefaultStringType (org.mule.metadata.api.model.impl.DefaultStringType)1 DefaultPortalGunDispatcherProvider (org.mule.test.ram.DefaultPortalGunDispatcherProvider)1 MiniverseDispatcherProvider (org.mule.test.ram.MiniverseDispatcherProvider)1 TestHttpMessageDispatcherProvider (org.mule.test.ram.TestHttpMessageDispatcherProvider)1