Search in sources :

Example 6 with ParameterGroupDeclaration

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

the class BooleanParameterDeclarationEnricher method enrich.

@Override
public void enrich(ExtensionLoadingContext extensionLoadingContext) {
    ExtensionDeclaration extensionDeclaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration();
    new DeclarationWalker() {

        @Override
        protected void onParameter(ParameterizedDeclaration owner, ParameterGroupDeclaration parameterGroup, ParameterDeclaration declaration) {
            declaration.getType().accept(new MetadataTypeVisitor() {

                @Override
                public void visitBoolean(BooleanType booleanType) {
                    declaration.setRequired(false);
                    if (declaration.getDefaultValue() == null && !declaration.isConfigOverride()) {
                        declaration.setDefaultValue(valueOf(FALSE));
                    }
                }
            });
        }
    }.walk(extensionDeclaration);
}
Also used : ParameterGroupDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration) DeclarationWalker(org.mule.runtime.api.meta.model.declaration.fluent.util.DeclarationWalker) ParameterizedDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterizedDeclaration) BooleanType(org.mule.metadata.api.model.BooleanType) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) ConfigOverride(org.mule.runtime.extension.api.annotation.param.ConfigOverride) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) MetadataTypeVisitor(org.mule.metadata.api.visitor.MetadataTypeVisitor) ConfigOverride(org.mule.runtime.extension.api.annotation.param.ConfigOverride)

Example 7 with ParameterGroupDeclaration

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

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

the class MimeTypeParametersDeclarationEnricherTestCase method before.

@Before
public void before() {
    when(extensionLoadingContext.getExtensionDeclarer()).thenReturn(extensionDeclarer);
    when(extensionDeclarer.getDeclaration()).thenReturn(extensionDeclaration);
    when(extensionDeclaration.getOperations()).thenReturn(singletonList(operation));
    when(extensionDeclaration.getMessageSources()).thenReturn(singletonList(source));
    when(source.getSuccessCallback()).thenReturn(empty());
    when(source.getErrorCallback()).thenReturn(empty());
    when(operation.getParameterGroup(DEFAULT_GROUP_NAME)).thenReturn(new ParameterGroupDeclaration(DEFAULT_GROUP_NAME));
    when(source.getParameterGroup(DEFAULT_GROUP_NAME)).thenReturn(new ParameterGroupDeclaration(DEFAULT_GROUP_NAME));
    mockMediaType(operation, false);
    mockMediaType(source, false);
}
Also used : ParameterGroupDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration) Before(org.junit.Before)

Aggregations

ParameterGroupDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration)8 ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)3 Test (org.junit.Test)2 ExclusiveParametersDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExclusiveParametersDeclaration)2 ExtensionDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration)2 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Before (org.junit.Before)1 ClassTypeLoader (org.mule.metadata.api.ClassTypeLoader)1 BooleanType (org.mule.metadata.api.model.BooleanType)1 ObjectType (org.mule.metadata.api.model.ObjectType)1 MetadataTypeVisitor (org.mule.metadata.api.visitor.MetadataTypeVisitor)1 ImportedTypeModel (org.mule.runtime.api.meta.model.ImportedTypeModel)1 ParameterizedDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterizedDeclaration)1 DeclarationWalker (org.mule.runtime.api.meta.model.declaration.fluent.util.DeclarationWalker)1 ExclusiveParametersModel (org.mule.runtime.api.meta.model.parameter.ExclusiveParametersModel)1 ObjectStore (org.mule.runtime.api.store.ObjectStore)1 Reference (org.mule.runtime.api.util.Reference)1 ConfigOverride (org.mule.runtime.extension.api.annotation.param.ConfigOverride)1