use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class AbstractDeploymentTestCase method createExtensionApplicationWithServices.
protected ApplicationFileBuilder createExtensionApplicationWithServices(String appConfigFile, ArtifactPluginFileBuilder... plugins) throws Exception {
installEchoService();
installFooService();
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionPlugin").definedBy(appConfigFile);
for (ArtifactPluginFileBuilder plugin : plugins) {
applicationFileBuilder.dependingOn(plugin);
}
return applicationFileBuilder;
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class AbstractDeploymentTestCase method createHelloExtensionV2PluginFileBuilder.
private ArtifactPluginFileBuilder createHelloExtensionV2PluginFileBuilder() {
MulePluginModelBuilder mulePluginModelBuilder = new MulePluginModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName("helloExtensionPlugin").setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader("helloExtensionPlugin", MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, "2.0.0"));
mulePluginModelBuilder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId(MULE_LOADER_ID).build());
mulePluginModelBuilder.withExtensionModelDescriber().setId(JAVA_LOADER_ID).addProperty("type", "org.foo.hello.HelloExtension").addProperty("version", "2.0.0");
return new ArtifactPluginFileBuilder("helloExtensionPlugin-2.0.0").dependingOn(new JarFileBuilder("helloExtensionV2", helloExtensionV2JarFile)).describedBy((mulePluginModelBuilder.build()));
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class AbstractDeploymentTestCase method createExceptionThrowingPluginFileBuilder.
private ArtifactPluginFileBuilder createExceptionThrowingPluginFileBuilder() {
final String pluginName = "exceptionPlugin";
MulePluginModel.MulePluginModelBuilder mulePluginModelBuilder = new MulePluginModel.MulePluginModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName(pluginName).setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader(pluginName, MULE_PLUGIN_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, "1.0.0"));
mulePluginModelBuilder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId(MULE_LOADER_ID).addProperty(EXPORTED_RESOURCES, asList("/META-INF/mule-exception.xsd", "/META-INF/mule.schemas")).build());
File exceptionTestClassFile = null;
File serviceTestClassFile = null;
try {
exceptionTestClassFile = new CompilerUtils.SingleClassCompiler().compile(getResourceFile("/org/exception/CustomException.java"));
serviceTestClassFile = new CompilerUtils.SingleClassCompiler().compile(getResourceFile("/org/exception/ExceptionComponentBuildingDefinitionProvider.java"));
} catch (URISyntaxException e) {
fail(e.getMessage());
}
ArtifactPluginFileBuilder exceptionPluginFileBuilder = new ArtifactPluginFileBuilder("exceptionPlugin").containingResource("exception/META-INF/mule.schemas", "META-INF/mule.schemas").containingResource("exception/META-INF/mule-exception.xsd", "META-INF/mule-exception.xsd").containingResource("exception/META-INF/services/org.mule.runtime.dsl.api.component.ComponentBuildingDefinitionProvider", "META-INF/services/org.mule.runtime.dsl.api.component.ComponentBuildingDefinitionProvider").containingClass(exceptionTestClassFile, "org/exception/CustomException.class").containingClass(serviceTestClassFile, "org/exception/ExceptionComponentBuildingDefinitionProvider.class").configuredWith(EXPORTED_RESOURCE_PROPERTY, "META-INF/mule-exception.xsd,META-INF/mule.schemas").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.exception").describedBy(mulePluginModelBuilder.build());
return exceptionPluginFileBuilder;
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class AbstractDeploymentTestCase method createPolicyIncludingDependantPluginFileBuilder.
private PolicyFileBuilder createPolicyIncludingDependantPluginFileBuilder() {
MulePolicyModelBuilder mulePolicyModelBuilder = new MulePolicyModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName(BAZ_POLICY_NAME).setRequiredProduct(Product.MULE).withBundleDescriptorLoader(createBundleDescriptorLoader(BAZ_POLICY_NAME, MULE_POLICY_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID)).withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptor(MULE_LOADER_ID, emptyMap()));
ArtifactPluginFileBuilder dependantPlugin;
try {
dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(new SingleClassCompiler().compile(getResourceFile("/org/foo/echo/Plugin3Echo.java")), "org/foo/echo/Plugin3Echo.class").dependingOn(helloExtensionV1Plugin);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
return new PolicyFileBuilder(BAZ_POLICY_NAME).describedBy(mulePolicyModelBuilder.build()).dependingOn(dependantPlugin);
}
use of org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppWithPluginBootstrapProperty.
@Test
public void deploysAppWithPluginBootstrapProperty() throws Exception {
final ArtifactPluginFileBuilder pluginFileBuilder = new ArtifactPluginFileBuilder("bootstrapPlugin").containingResource("plugin-bootstrap.properties", BOOTSTRAP_PROPERTIES).containingClass(echoTestClassFile, "org/foo/EchoTest.class").configuredWith(EXPORTED_RESOURCE_PROPERTY, BOOTSTRAP_PROPERTIES);
ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("app-with-plugin-bootstrap").definedBy("app-with-plugin-bootstrap.xml").dependingOn(pluginFileBuilder);
addPackedAppFromBuilder(applicationFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
final Application application = findApp(applicationFileBuilder.getId(), 1);
final Optional<Object> lookupObject = application.getRegistry().lookupByName("plugin.echotest");
assertThat(lookupObject.isPresent(), is(true));
assertThat(lookupObject.get().getClass().getName(), equalTo("org.foo.EchoTest"));
}
Aggregations