Search in sources :

Example 11 with OperationDeclaration

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

the class OperationDescriptionDocumenter method documentOperations.

private void documentOperations(WithOperationsDeclaration<?> declaration, Map<String, Element> methods) {
    for (OperationDeclaration operation : declaration.getOperations()) {
        Element method = methods.get(operation.getName());
        // the one which defined the operation being processed
        if (method == null) {
            continue;
        }
        MethodDocumentation documentation = processor.getMethodDocumentation(processingEnv, method);
        operation.setDescription(documentation.getSummary());
        parameterDeclarer.document(operation, method, documentation);
    }
}
Also used : MethodDocumentation(org.mule.runtime.module.extension.internal.capability.xml.schema.MethodDocumentation) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)

Example 12 with OperationDeclaration

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

the class GroupLayoutTestCase method groupLayout.

@Test
public void groupLayout() {
    OperationDeclaration operation = getOperation(extensionDeclaration, "convinceAnimalKiller");
    assertThat(operation.getParameterGroups(), hasSize(2));
    ParameterGroupDeclaration group = operation.getParameterGroups().get(0);
    assertThat(group.getLayoutModel().getTabName().get(), is(ARGUMENTS_TAB));
}
Also used : ParameterGroupDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) Test(org.junit.Test)

Example 13 with OperationDeclaration

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

the class JavaDeclarationDelegateTestCase method assertOperation.

private void assertOperation(WithOperationsDeclaration declaration, String operationName, String operationDescription) throws Exception {
    OperationDeclaration operation = getOperation(declaration, operationName);
    assertThat(operation, is(notNullValue()));
    assertThat(operation.getDescription(), equalTo(operationDescription));
}
Also used : OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)

Example 14 with OperationDeclaration

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

the class JavaDeclarationDelegateTestCase method flowListeningOperationWithoutAttributes.

@Test
public void flowListeningOperationWithoutAttributes() {
    setLoader(loaderFor(VeganExtension.class));
    ExtensionDeclarer declarer = declareExtension();
    final ExtensionDeclaration declaration = declarer.getDeclaration();
    OperationDeclaration operation = getOperation(getConfiguration(declaration, BANANA), "getLunch");
    assertThat(operation, is(notNullValue()));
    assertOutputType(operation.getOutput(), toMetadataType(Fruit.class), false);
    assertOutputType(operation.getOutputAttributes(), TYPE_BUILDER.voidType().build(), false);
}
Also used : Fruit(org.mule.tck.testmodels.fruit.Fruit) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) VeganExtension(org.mule.test.vegan.extension.VeganExtension) 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 OperationDeclaration

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

the class JavaDeclarationDelegateTestCase method listOfResultsOperationWithoutGenerics.

@Test
public void listOfResultsOperationWithoutGenerics() throws Exception {
    ExtensionDeclarer declarer = loaderFor(HeisenbergWithListOfResultOperations.class).declare(new DefaultExtensionLoadingContext(getClass().getClassLoader(), getDefault(emptySet())));
    OperationDeclaration operation = getOperation(declarer.getDeclaration(), "listOfResultsWithoutGenerics");
    MetadataType outputType = operation.getOutput().getType();
    assertThat(outputType, is(instanceOf(ArrayType.class)));
    assertMessageType(((ArrayType) outputType).getType(), TYPE_BUILDER.anyType().build(), TYPE_BUILDER.anyType().build());
}
Also used : DefaultExtensionLoadingContext(org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext) ExtensionDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer) MetadataType(org.mule.metadata.api.model.MetadataType) ExtensionsTestUtils.toMetadataType(org.mule.test.module.extension.internal.util.ExtensionsTestUtils.toMetadataType) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)26 Test (org.junit.Test)18 ExtensionDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration)12 ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)9 ExtensionDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer)6 SmallTest (org.mule.tck.size.SmallTest)5 ConfigurationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration)4 SourceDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.SourceDeclaration)4 WithOperationsDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.WithOperationsDeclaration)4 List (java.util.List)3 DeclarationEnricher (org.mule.runtime.extension.api.loader.DeclarationEnricher)3 ExtensionLoadingContext (org.mule.runtime.extension.api.loader.ExtensionLoadingContext)3 DefaultExtensionLoadingContext (org.mule.runtime.extension.internal.loader.DefaultExtensionLoadingContext)3 String.format (java.lang.String.format)2 Map (java.util.Map)2 Optional (java.util.Optional)2 Optional.ofNullable (java.util.Optional.ofNullable)2 MetadataType (org.mule.metadata.api.model.MetadataType)2 StringType (org.mule.metadata.api.model.StringType)2 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)2