Search in sources :

Example 11 with ExtensionDeclaration

use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.

the class DisplayDeclarationEnricherTestCase method parsePathParameterThatIsDirectory.

@Test
public void parsePathParameterThatIsDirectory() {
    ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
    ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME);
    ConnectionProviderDeclaration missileProvider = findProviderByName(config, MissileProvider.NAME);
    List<ParameterDeclaration> params = missileProvider.getAllParameters();
    assertThat(params, hasSize(1));
    ParameterDeclaration pathParam = params.get(0);
    Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel();
    assertThat(pathModel.isPresent(), is(true));
    assertThat(pathModel.get().getType(), is(DIRECTORY));
    assertThat(pathModel.get().acceptsUrls(), is(false));
    assertThat(pathModel.get().getFileExtensions(), empty());
}
Also used : ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) PathModel(org.mule.runtime.api.meta.model.display.PathModel) ConnectionProviderDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConnectionProviderDeclaration) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) Test(org.junit.Test)

Example 12 with ExtensionDeclaration

use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration 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 13 with ExtensionDeclaration

use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration 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 14 with ExtensionDeclaration

use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.

the class LayoutModelTestCase method parseLayoutAnnotationsOnOperationParameter.

@Test
public void parseLayoutAnnotationsOnOperationParameter() {
    ExtensionDeclarer declarer = declareExtension();
    ExtensionDeclaration extensionDeclaration = declarer.getDeclaration();
    OperationDeclaration operation = getOperation(extensionDeclaration, KILL_CUSTOM_OPERATION);
    assertThat(operation, is(notNullValue()));
    assertParameterPlacement(findParameterInGroup(operation, "victim"), KILL_WITH_GROUP, 1);
    assertParameterPlacement(findParameterInGroup(operation, "goodbyeMessage"), KILL_WITH_GROUP, 2);
}
Also used : ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 15 with ExtensionDeclaration

use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration 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

ExtensionDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration)36 Test (org.junit.Test)24 ExtensionDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer)14 ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)14 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)12 SmallTest (org.mule.tck.size.SmallTest)12 ConfigurationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration)9 SourceDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.SourceDeclaration)6 IdempotentDeclarationWalker (org.mule.runtime.extension.api.declaration.fluent.util.IdempotentDeclarationWalker)6 Type (org.mule.runtime.module.extension.api.loader.java.type.Type)5 ExtensionTypeDescriptorModelProperty (org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionTypeDescriptorModelProperty)5 List (java.util.List)3 Optional (java.util.Optional)3 ClassTypeLoader (org.mule.metadata.api.ClassTypeLoader)3 ObjectType (org.mule.metadata.api.model.ObjectType)3 WithOperationsDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.WithOperationsDeclaration)3 IllegalModelDefinitionException (org.mule.runtime.extension.api.exception.IllegalModelDefinitionException)3 DeclarationEnricher (org.mule.runtime.extension.api.loader.DeclarationEnricher)3 String.format (java.lang.String.format)2 Optional.ofNullable (java.util.Optional.ofNullable)2