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));
}
Aggregations