use of org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader in project mule by mulesoft.
the class XmlExtensionLoaderTestCase method getExtensionModelFrom.
/**
* If {@link #validateXml} is true, the XML of the smart connector must be validated when reading it. False otherwise. Useful to
* simulate the {@link ExtensionModel} generation of a connector that has malformed message processors in the <body/> element.
*
* @param modulePath relative path to the XML connector.
* @return an {@link ExtensionModel}
*/
private ExtensionModel getExtensionModelFrom(String modulePath) {
Map<String, Object> parameters = new HashMap<>();
parameters.put(RESOURCE_XML, modulePath);
parameters.put(XmlExtensionModelLoader.VALIDATE_XML, validateXml);
final ExtensionModel extensionModel = new XmlExtensionModelLoader().loadExtensionModel(getClass().getClassLoader(), getDefault(getDependencyExtensions()), parameters);
assertNoReconnectionIsAdded(extensionModel);
return extensionModel;
}
use of org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader in project mule by mulesoft.
the class XmlExtensionLoaderWithDeclarationTestCase method getExtensionModelFrom.
private ExtensionModel getExtensionModelFrom(Optional<String> declarationPath) {
Map<String, Object> parameters = new HashMap<>();
parameters.put(RESOURCE_XML, MODULE_DECLARATION_RESOURCE_FILE);
parameters.put(XmlExtensionModelLoader.VALIDATE_XML, validateXml);
declarationPath.ifPresent(path -> parameters.put(XmlExtensionModelLoader.RESOURCE_DECLARATION, path));
return new XmlExtensionModelLoader().loadExtensionModel(getClass().getClassLoader(), getDefault(EMPTY_SET), parameters);
}
use of org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader in project mule by mulesoft.
the class DefaultModelValidatorTestCase method getExtensionModelFrom.
private ExtensionModel getExtensionModelFrom(String modulePath, Set<ExtensionModel> extensions) {
Map<String, Object> parameters = new HashMap<>();
parameters.put(RESOURCE_XML, modulePath);
return new XmlExtensionModelLoader().loadExtensionModel(getClass().getClassLoader(), getDefault(extensions), parameters);
}
use of org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader in project mule by mulesoft.
the class TestConnectionFailuresTestCase method getExtensionModelFrom.
private ExtensionModel getExtensionModelFrom(String modulePath, Set<ExtensionModel> extensions) {
Map<String, Object> parameters = new HashMap<>();
parameters.put(RESOURCE_XML, modulePath);
return new XmlExtensionModelLoader().loadExtensionModel(getClass().getClassLoader(), getDefault(extensions), parameters);
}
use of org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader in project mule by mulesoft.
the class AbstractXmlExtensionMuleArtifactFunctionalTestCase method addBuilders.
@Override
protected void addBuilders(List<ConfigurationBuilder> builders) {
super.addBuilders(builders);
builders.add(new AbstractConfigurationBuilder() {
@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
ExtensionManager extensionManager;
if (muleContext.getExtensionManager() == null) {
extensionManager = createDefaultExtensionManager();
muleContext.setExtensionManager(extensionManager);
initialiseIfNeeded(extensionManager, muleContext);
}
extensionManager = muleContext.getExtensionManager();
registerXmlExtensions(extensionManager);
}
private void registerXmlExtensions(ExtensionManager extensionManager) {
// take all the plugins loaded by org.mule.test.runner.api.IsolatedClassLoaderExtensionsManagerConfigurationBuilder in the extension manager
final Set<ExtensionModel> extensions = new HashSet<>(extensionManager.getExtensions());
for (String modulePath : getModulePaths()) {
Map<String, Object> params = new HashMap<>();
params.put(XmlExtensionModelLoader.RESOURCE_XML, modulePath);
params.put(XmlExtensionModelLoader.VALIDATE_XML, shouldValidateXml());
operationsOutputPath().ifPresent(path -> params.put(XmlExtensionModelLoader.RESOURCE_DECLARATION, path));
final DslResolvingContext dslResolvingContext = getDefault(extensions);
final ExtensionModel extensionModel = new XmlExtensionModelLoader().loadExtensionModel(getClass().getClassLoader(), dslResolvingContext, params);
extensions.add(extensionModel);
}
for (ExtensionModel extension : extensions) {
extensionManager.registerExtension(extension);
}
}
});
}
Aggregations