Search in sources :

Example 1 with DefaultObjectType

use of org.mule.metadata.api.model.impl.DefaultObjectType in project mule by mulesoft.

the class CoreExtensionModelTestCase method otherModels.

@Test
public void otherModels() {
    assertThat(coreExtensionModel.getResources(), empty());
    assertThat(coreExtensionModel.getSubTypes(), hasSize(1));
    SubTypesModel subTypesModel = coreExtensionModel.getSubTypes().iterator().next();
    assertThat(subTypesModel.getBaseType().getAnnotation(TypeIdAnnotation.class).get().getValue(), is(Scheduler.class.getName()));
    assertThat(subTypesModel.getSubTypes(), hasSize(2));
    Iterator<ObjectType> iterator = subTypesModel.getSubTypes().iterator();
    final DefaultObjectType ffSchedulerType = (DefaultObjectType) iterator.next();
    assertThat(ffSchedulerType.getFields(), hasSize(3));
    assertThat(ffSchedulerType.getFieldByName("frequency").get().isRequired(), is(false));
    assertThat(ffSchedulerType.getFieldByName("frequency").get().getValue(), instanceOf(DefaultNumberType.class));
    assertThat(ffSchedulerType.getFieldByName("startDelay").get().isRequired(), is(false));
    assertThat(ffSchedulerType.getFieldByName("startDelay").get().getValue(), instanceOf(DefaultNumberType.class));
    assertThat(ffSchedulerType.getFieldByName("timeUnit").get().isRequired(), is(false));
    assertThat(ffSchedulerType.getFieldByName("timeUnit").get().getValue(), instanceOf(DefaultStringType.class));
    final DefaultObjectType cronSchedulerType = (DefaultObjectType) iterator.next();
    assertThat(cronSchedulerType.getFields(), hasSize(2));
    assertThat(cronSchedulerType.getFieldByName("expression").get().isRequired(), is(true));
    assertThat(cronSchedulerType.getFieldByName("expression").get().getValue(), instanceOf(DefaultStringType.class));
    assertThat(cronSchedulerType.getFieldByName("timeZone").get().isRequired(), is(true));
    assertThat(cronSchedulerType.getFieldByName("timeZone").get().getValue(), instanceOf(DefaultStringType.class));
    assertThat(coreExtensionModel.getExternalLibraryModels(), empty());
    assertThat(coreExtensionModel.getImportedTypes(), empty());
    assertThat(coreExtensionModel.getConfigurationModels(), empty());
    assertThat(coreExtensionModel.getOperationModels(), hasSize(8));
    assertThat(coreExtensionModel.getConstructModels(), hasSize(15));
    assertThat(coreExtensionModel.getConnectionProviders(), empty());
    assertThat(coreExtensionModel.getSourceModels(), hasSize(1));
    assertThat(coreExtensionModel.getErrorModels(), hasItem(newError(TRANSFORMATION).withParent(errorMuleAny).build()));
    assertThat(coreExtensionModel.getTypes(), hasSize(5));
}
Also used : SubTypesModel(org.mule.runtime.api.meta.model.SubTypesModel) ObjectType(org.mule.metadata.api.model.ObjectType) DefaultObjectType(org.mule.metadata.api.model.impl.DefaultObjectType) DefaultNumberType(org.mule.metadata.api.model.impl.DefaultNumberType) DefaultObjectType(org.mule.metadata.api.model.impl.DefaultObjectType) DefaultStringType(org.mule.metadata.api.model.impl.DefaultStringType) TypeIdAnnotation(org.mule.metadata.api.annotation.TypeIdAnnotation) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)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 SubTypesModel (org.mule.runtime.api.meta.model.SubTypesModel)1