Search in sources :

Example 11 with ExtensionDeclarer

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

the class ConnectionDeclarationEnricherTestCase method before.

@Before
public void before() throws Exception {
    connectedOperation = spy(new ExtensionDeclarer().withOperation(CONNECTED_OPERATION).requiresConnection(true).getDeclaration());
    notConnectedOperation = spy(new ExtensionDeclarer().withOperation(NOT_CONNECTED_OPERATION).requiresConnection(false).getDeclaration());
    when(extensionLoadingContext.getExtensionDeclarer()).thenReturn(extensionDeclarer);
    when(extensionDeclarer.getDeclaration()).thenReturn(extensionDeclaration);
    when(extensionDeclaration.getOperations()).thenReturn(asList(connectedOperation, notConnectedOperation));
}
Also used : ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) Before(org.junit.Before)

Example 12 with ExtensionDeclarer

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

the class DynamicMetadataDeclarationEnricherTestCase method setUp.

@Before
public void setUp() {
    DefaultJavaModelLoaderDelegate loader = new DefaultJavaModelLoaderDelegate(MetadataExtension.class, getProductVersion());
    ExtensionDeclarer declarer = loader.declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
    new DynamicMetadataDeclarationEnricher().enrich(new DefaultExtensionLoadingContext(declarer, this.getClass().getClassLoader(), getDefault(emptySet())));
    declaration = declarer.getDeclaration();
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) DefaultJavaModelLoaderDelegate(org.mule.runtime.module.extension.internal.loader.java.DefaultJavaModelLoaderDelegate) Before(org.junit.Before)

Example 13 with ExtensionDeclarer

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

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

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

ExtensionDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer)35 ExtensionDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration)15 Test (org.junit.Test)14 SmallTest (org.mule.tck.size.SmallTest)14 DefaultExtensionLoadingContext (org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext)8 MetadataType (org.mule.metadata.api.model.MetadataType)6 ExtensionTypeDescriptorModelProperty (org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionTypeDescriptorModelProperty)6 Before (org.junit.Before)5 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)5 HeisenbergExtension (org.mule.test.heisenberg.extension.HeisenbergExtension)5 Declarer (org.mule.runtime.api.meta.model.declaration.fluent.Declarer)4 ExtensionParameter (org.mule.runtime.module.extension.api.loader.java.type.ExtensionParameter)4 Type (org.mule.runtime.module.extension.api.loader.java.type.Type)4 ObjectType (org.mule.metadata.api.model.ObjectType)3 ConfigurationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration)3 HasOperationDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.HasOperationDeclarer)3 IllegalModelDefinitionException (org.mule.runtime.extension.api.exception.IllegalModelDefinitionException)3 ExtensionLoadingContext (org.mule.runtime.extension.api.loader.ExtensionLoadingContext)3 DefaultJavaModelLoaderDelegate (org.mule.runtime.module.extension.internal.loader.java.DefaultJavaModelLoaderDelegate)3 ImplementingMethodModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ImplementingMethodModelProperty)3