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);
}
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));
}
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);
}
Aggregations