use of org.mule.runtime.api.meta.model.connection.ConnectionProviderModel in project mule by mulesoft.
the class DefaultExtensionSchemaGenerator method generate.
/**
* {@inheritDoc}
*/
@Override
public String generate(ExtensionModel extensionModel, DslResolvingContext dslContext) {
XmlDslModel xmlDslModel = extensionModel.getXmlDslModel();
validate(extensionModel, xmlDslModel);
SchemaBuilder schemaBuilder = SchemaBuilder.newSchema(extensionModel, xmlDslModel, dslContext);
new IdempotentExtensionWalker() {
@Override
public void onConfiguration(ConfigurationModel model) {
schemaBuilder.registerConfigElement(model);
}
@Override
protected void onConstruct(ConstructModel model) {
schemaBuilder.registerOperation(model);
}
@Override
public void onOperation(OperationModel model) {
schemaBuilder.registerOperation(model);
}
@Override
public void onConnectionProvider(ConnectionProviderModel model) {
schemaBuilder.registerConnectionProviderElement(model);
}
@Override
public void onSource(SourceModel model) {
schemaBuilder.registerMessageSource(model);
}
}.walk(extensionModel);
schemaBuilder.registerEnums();
// Make sure the XML libs use the container classloader internally
return withContextClassLoader(DefaultExtensionSchemaGenerator.class.getClassLoader(), () -> renderSchema(schemaBuilder.build()));
}
use of org.mule.runtime.api.meta.model.connection.ConnectionProviderModel in project mule by mulesoft.
the class ExtensionDescriptionDocumenterTestCase method assertDescriptionsSingleConfig.
private void assertDescriptionsSingleConfig(ExtensionModel extensionModel) {
assertThat(extensionModel.getConfigurationModels(), hasSize(1));
assertThat(extensionModel.getOperationModels(), hasSize(1));
OperationModel withParameterGroup = extensionModel.getOperationModels().get(0);
assertDescription(withParameterGroup, "Operation with parameter group");
List<ParameterModel> operationParams = withParameterGroup.getAllParameterModels();
assertDescription(operationParams.get(0), "value param description");
assertDescription(operationParams.get(1), "First Description");
assertDescription(operationParams.get(2), "Second Description");
ConfigurationModel config = extensionModel.getConfigurationModels().get(0);
assertDescription(extensionModel, "Test Extension Description with single config");
assertDescription(config, DEFAULT_CONFIG_DESCRIPTION);
assertDescription(config.getAllParameterModels().get(0), "Config parameter");
assertDescription(config.getAllParameterModels().get(1), "Config Parameter with an Optional value");
assertThat(config.getOperationModels(), hasSize(1));
assertDescription(config.getOperationModels().get(0), "Operation with description");
ConnectionProviderModel provider = config.getConnectionProviders().get(0);
assertDescription(provider, "Provider description");
assertDescription(provider.getAllParameterModels().get(0), "Connection Param Description");
assertDescription(provider.getAllParameterModels().get(1), "First Description");
assertDescription(provider.getAllParameterModels().get(2), "Second Description");
}
use of org.mule.runtime.api.meta.model.connection.ConnectionProviderModel in project mule by mulesoft.
the class ConfigurationProviderToolingAdapter method withConnectionProviderInfo.
private <T> T withConnectionProviderInfo(WithConnectionProviderCallable<T> withConnectionProviderCallable) throws ValueResolvingException {
ConnectionProvider<?> connectionProvider = configuration.getConnectionProvider().orElseThrow(() -> new ValueResolvingException("Unable to obtain the Connection Provider Instance", UNKNOWN));
ConnectionProvider unwrap = unwrapProviderWrapper(connectionProvider);
ConnectionProviderModel connectionProviderModel = getConnectionProviderModel(unwrap.getClass(), getAllConnectionProviders(getExtensionModel(), getConfigurationModel())).orElseThrow(() -> new ValueResolvingException("Internal error. Unable to obtain the Connection Provider Model", UNKNOWN));
return withConnectionProviderCallable.call(unwrap, connectionProviderModel);
}
use of org.mule.runtime.api.meta.model.connection.ConnectionProviderModel in project mule by mulesoft.
the class ComplexExtensionDeclarationTestCase method connectionProvider.
@Test
public void connectionProvider() {
ConnectionProviderModel provider = extensionModel.getConfigurationModel(REQUESTER_CONFIG_NAME).get().getConnectionProviders().get(0);
assertThat(provider.getName(), is(REQUESTER_PROVIDER));
}
use of org.mule.runtime.api.meta.model.connection.ConnectionProviderModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method exportedLibraries.
@Test
public void exportedLibraries() {
ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
assertExternalLibraries(extensionModel);
new IdempotentExtensionWalker() {
@Override
protected void onConfiguration(ConfigurationModel model) {
assertExternalLibraries(model);
}
@Override
protected void onConnectionProvider(ConnectionProviderModel model) {
assertExternalLibraries(model);
}
}.walk(extensionModel);
}
Aggregations