Search in sources :

Example 6 with ConfigurationDeclaration

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);
}
Also used : ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 7 with ConfigurationDeclaration

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);
}
Also used : LocalDateTime(java.time.LocalDateTime) Set(java.util.Set) Collections.emptySet(java.util.Collections.emptySet) ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) Calendar(java.util.Calendar) HealthStatus(org.mule.test.heisenberg.extension.model.HealthStatus) BigDecimal(java.math.BigDecimal) Date(java.util.Date) ClassInformationAnnotation(org.mule.metadata.java.api.annotation.ClassInformationAnnotation) Weapon(org.mule.test.heisenberg.extension.model.Weapon) KnockeableDoor(org.mule.test.heisenberg.extension.model.KnockeableDoor) Arrays.asList(java.util.Arrays.asList) List(java.util.List) Map(java.util.Map) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)

Example 8 with ConfigurationDeclaration

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);
}
Also used : ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) DEAOfficerAttributes(org.mule.test.heisenberg.extension.model.types.DEAOfficerAttributes) MetadataType(org.mule.metadata.api.model.MetadataType) ExtensionsTestUtils.toMetadataType(org.mule.test.module.extension.internal.util.ExtensionsTestUtils.toMetadataType) SourceDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.SourceDeclaration)

Example 9 with ConfigurationDeclaration

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);
}
Also used : ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 10 with ConfigurationDeclaration

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);
}
Also used : ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

ConfigurationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration)12 ExtensionDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration)9 Test (org.junit.Test)7 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)4 ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)4 SourceDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.SourceDeclaration)4 SmallTest (org.mule.tck.size.SmallTest)4 ConnectionProviderDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConnectionProviderDeclaration)3 ExtensionDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer)3 List (java.util.List)2 PathModel (org.mule.runtime.api.meta.model.display.PathModel)2 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 URL (java.net.URL)1 LocalDateTime (java.time.LocalDateTime)1 Arrays.asList (java.util.Arrays.asList)1 Calendar (java.util.Calendar)1 Collections.emptySet (java.util.Collections.emptySet)1 Date (java.util.Date)1 Map (java.util.Map)1