use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class ParameterLayoutOrderDeclarationEnricher method enrich.
@Override
public void enrich(ExtensionLoadingContext extensionLoadingContext) {
ExtensionDeclaration declaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration();
new IdempotentDeclarationWalker() {
@Override
public void onOperation(OperationDeclaration declaration) {
establishOrder(declaration);
}
@Override
public void onConfiguration(ConfigurationDeclaration declaration) {
establishOrder(declaration);
}
@Override
public void onSource(SourceDeclaration declaration) {
establishOrder(declaration);
}
@Override
protected void onConnectionProvider(ConnectionProviderDeclaration declaration) {
establishOrder(declaration);
}
}.walk(declaration);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseClassParameter.
@Test
public void parseClassParameter() {
ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME);
List<ParameterDeclaration> params = config.getAllParameters();
assertThat(params, hasSize(2));
ParameterDeclaration pathParam = params.get(1);
Optional<ClassValueModel> classValueModel = pathParam.getDisplayModel().getClassValueModel();
assertThat(classValueModel.isPresent(), is(true));
assertThat(classValueModel.get().getAssignableFrom(), hasSize(1));
assertThat(classValueModel.get().getAssignableFrom().get(0), equalTo("com.starkindustries.AIEngine"));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseSimplePathParameter.
@Test
public void parseSimplePathParameter() {
ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME);
List<ParameterDeclaration> params = config.getAllParameters();
assertThat(params, hasSize(2));
ParameterDeclaration pathParam = params.get(0);
Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel();
assertThat(pathModel.isPresent(), is(true));
assertThat(pathModel.get().getType(), is(ANY));
assertThat(pathModel.get().acceptsUrls(), is(true));
assertThat(pathModel.get().getFileExtensions(), empty());
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration 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());
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration in project mule by mulesoft.
the class ComplexExtensionLoadingTestCase method assertOperation.
private void assertOperation(String configName, String operationName) {
ConfigurationDeclaration config = extensionDeclaration.getConfigurations().stream().filter(c -> c.getName().equals(configName)).findFirst().orElseThrow(() -> new IllegalArgumentException("No config with name " + configName));
OperationDeclaration operation = config.getOperations().stream().filter(model -> model.getName().equals(operationName)).findFirst().orElseThrow(() -> new IllegalArgumentException("No operation with name " + operationName));
assertThat(operation.getName(), is(operationName));
}
Aggregations