use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method heisenbergPointerPlusExternalConfig.
@Test
public void heisenbergPointerPlusExternalConfig() {
setLoader(loaderFor(HeisenbergPointerPlusExternalConfig.class));
ExtensionDeclaration extensionDeclaration = declareExtension().getDeclaration();
assertExtensionProperties(extensionDeclaration, OTHER_HEISENBERG);
assertThat(extensionDeclaration.getConfigurations().size(), equalTo(2));
ConfigurationDeclaration configuration = extensionDeclaration.getConfigurations().get(1);
assertThat(configuration, is(notNullValue()));
assertThat(configuration.getName(), equalTo(EXTENDED_CONFIG_NAME));
assertThat(configuration.getAllParameters(), hasSize(32));
assertParameter(configuration.getAllParameters(), "extendedProperty", "", STRING_TYPE, true, SUPPORTED, null);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertTestModuleConfiguration.
private void assertTestModuleConfiguration(ExtensionDeclaration extensionDeclaration) throws Exception {
assertThat(extensionDeclaration.getConfigurations(), hasSize(1));
ConfigurationDeclaration conf = extensionDeclaration.getConfigurations().get(0);
assertThat(conf.getName(), equalTo(DEFAULT_CONFIG_NAME));
List<ParameterDeclaration> parameters = conf.getAllParameters();
assertThat(parameters, hasSize(31));
assertParameter(parameters, "myName", "", STRING_TYPE, false, SUPPORTED, HEISENBERG);
assertParameter(parameters, "age", "", toMetadataType(Integer.class), false, SUPPORTED, AGE);
assertParameter(parameters, "enemies", "", listOfString(), true, SUPPORTED, null);
assertParameter(parameters, "money", "", toMetadataType(BigDecimal.class), true, SUPPORTED, null);
assertParameter(parameters, "cancer", "", toMetadataType(boolean.class), true, SUPPORTED, null);
assertParameter(parameters, "cancer", "", toMetadataType(boolean.class), true, SUPPORTED, null);
assertParameter(parameters, "dateOfBirth", "", toMetadataType(Date.class), false, SUPPORTED, null);
assertParameter(parameters, "dateOfDeath", "", toMetadataType(Calendar.class), false, SUPPORTED, null);
assertParameter(parameters, "dateOfConception", "", toMetadataType(LocalDateTime.class), false, SUPPORTED, null);
assertParameter(parameters, "dateOfGraduation", "", toMetadataType(Calendar.class), false, NOT_SUPPORTED, null);
assertParameter(parameters, "recipe", "", TYPE_BUILDER.objectType().openWith(TYPE_BUILDER.numberType().integer().with(new ClassInformationAnnotation(Long.class))).with(new ClassInformationAnnotation(Map.class, asList(String.class, Long.class))).build(), false, SUPPORTED, null);
assertParameter(parameters, "ricinPacks", "", arrayOf(Set.class, objectTypeBuilder(Ricin.class)), false, SUPPORTED, null);
assertParameter(parameters, "nextDoor", "", toMetadataType(KnockeableDoor.class), false, SUPPORTED, null);
assertParameter(parameters, "candidateDoors", "", TYPE_BUILDER.objectType().openWith((objectTypeBuilder(KnockeableDoor.class)).build()).with(new ClassInformationAnnotation(Map.class, asList(String.class, KnockeableDoor.class))).build(), false, SUPPORTED, null);
assertParameter(parameters, "initialHealth", "", toMetadataType(HealthStatus.class), false, SUPPORTED, "CANCER");
assertParameter(parameters, "finalHealth", "", toMetadataType(HealthStatus.class), true, SUPPORTED, null);
assertParameter(parameters, "labAddress", "", STRING_TYPE, false, REQUIRED, null);
assertParameter(parameters, "firstEndevour", "", STRING_TYPE, false, NOT_SUPPORTED, null);
assertParameter(parameters, "weapon", "", toMetadataType(Weapon.class), false, SUPPORTED, null);
assertParameter(parameters, "wildCardWeapons", "", arrayOf(List.class, objectTypeBuilder(Weapon.class)), false, SUPPORTED, null);
assertParameter(parameters, "wildCards", "", arrayOf(List.class, objectTypeBuilder(Object.class)), false, SUPPORTED, null);
assertParameter(parameters, "worksAtDEA", "", toMetadataType(boolean.class), false, SUPPORTED, valueOf(TRUE));
assertParameter(parameters, "lovesMinerals", "", toMetadataType(boolean.class), true, SUPPORTED, null);
assertParameter(parameters, "monthlyIncomes", "", arrayOf(List.class, longTypeBuilder()), true, SUPPORTED, null);
assertParameter(parameters, "labeledRicin", "", TYPE_BUILDER.objectType().openWith(objectTypeBuilder(Ricin.class)).with(new ClassInformationAnnotation(Map.class, asList(String.class, Ricin.class))).build(), false, SUPPORTED, null);
assertParameter(parameters, "deathsBySeasons", "", TYPE_BUILDER.objectType().with(new ClassInformationAnnotation(Map.class, asList(String.class, List.class))).openWith(TYPE_BUILDER.arrayType().of(TYPE_BUILDER.stringType())).build(), false, SUPPORTED, null);
assertParameter(parameters, "weaponValueMap", "", TYPE_BUILDER.objectType().with(new ClassInformationAnnotation(Map.class, asList(String.class, Weapon.class))).openWith(WEAPON_TYPE).build(), false, SUPPORTED, null);
assertParameter(parameters, "healthProgressions", "", TYPE_BUILDER.arrayType().of(TYPE_LOADER.load(HealthStatus.class)).build(), false, SUPPORTED, null);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertTestModuleMessageSource.
private void assertTestModuleMessageSource(ExtensionDeclaration extensionDeclaration) throws Exception {
assertThat(extensionDeclaration.getMessageSources(), hasSize(1));
SourceDeclaration source = extensionDeclaration.getMessageSources().get(0);
assertThat(source.getName(), is(DEA_SOURCE_NAME));
final MetadataType outputType = source.getOutput().getType();
assertThat(outputType, is(instanceOf(ArrayType.class)));
assertMessageType(((ArrayType) outputType).getType(), STRING_TYPE, TYPE_LOADER.load(DEAOfficerAttributes.class));
assertThat(source.getOutputAttributes().getType(), equalTo(TYPE_LOADER.load(Object.class)));
ConfigurationDeclaration config = extensionDeclaration.getConfigurations().get(0);
assertThat(config.getMessageSources(), hasSize(3));
assertHeisenbergSource(config.getMessageSources().get(0), ASYNC_SOURCE_NAME, AsyncHeisenbergSource.class);
assertHeisenbergSource(config.getMessageSources().get(1), SOURCE_NAME, HeisenbergSource.class);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class LayoutModelTestCase method parseLayoutAnnotationsOnParameter.
@Test
public void parseLayoutAnnotationsOnParameter() {
ExtensionDeclarer declarer = declareExtension();
ExtensionDeclaration extensionDeclaration = declarer.getDeclaration();
final ConfigurationDeclaration configurationDeclaration = extensionDeclaration.getConfigurations().get(0);
assertParameterPlacement(findParameterInGroup(configurationDeclaration, "labeledRicin"), RICIN_GROUP_NAME, 1);
assertParameterPlacement(findParameterInGroup(configurationDeclaration, "ricinPacks"), RICIN_GROUP_NAME, 2);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class LayoutModelTestCase method parseLayoutAnnotationsOnParameterGroup.
@Test
public void parseLayoutAnnotationsOnParameterGroup() {
ExtensionDeclarer declarer = declareExtension();
ExtensionDeclaration extensionDeclaration = declarer.getDeclaration();
ConfigurationDeclaration config = extensionDeclaration.getConfigurations().get(0);
assertParameterPlacement(findParameterInGroup(config, "myName"), PERSONAL_INFORMATION_GROUP_NAME, 1);
assertParameterPlacement(findParameterInGroup(config, "age"), PERSONAL_INFORMATION_GROUP_NAME, 2);
assertParameterPlacement(findParameterInGroup(config, "dateOfConception"), PERSONAL_INFORMATION_GROUP_NAME, 3);
assertParameterPlacement(findParameterInGroup(config, "dateOfBirth"), PERSONAL_INFORMATION_GROUP_NAME, 4);
assertParameterPlacement(findParameterInGroup(config, "dateOfDeath"), PERSONAL_INFORMATION_GROUP_NAME, 5);
}
Aggregations