Search in sources :

Example 6 with JarFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method failsToDeploysAppZipWithInvalidPrivilegedExtensionPlugin.

@Test
public void failsToDeploysAppZipWithInvalidPrivilegedExtensionPlugin() throws Exception {
    ArtifactPluginFileBuilder invalidPrivilegedPlugin = new ArtifactPluginFileBuilder("invalidPrivilegedPlugin").dependingOn(new JarFileBuilder("privilegedExtensionV1", privilegedExtensionV1JarFile)).configuredWith(EXPORTED_RESOURCE_PROPERTY, "/");
    ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("invalidPrivilegedPluginApp").definedBy(APP_WITH_PRIVILEGED_EXTENSION_PLUGIN_CONFIG).dependingOn(invalidPrivilegedPlugin);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) Test(org.junit.Test)

Example 7 with JarFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.

the class ApplicationDeploymentTestCase method failsToDeployApplicationOnMissingService.

@Test
public void failsToDeployApplicationOnMissingService() throws Exception {
    ArtifactPluginFileBuilder extensionPlugin = new ArtifactPluginFileBuilder("extensionPlugin").dependingOn(new JarFileBuilder("bundleExtensionv1", helloExtensionV1JarFile)).configuredWith(EXPORTED_RESOURCE_PROPERTY, "/, META-INF");
    ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("appWithExtensionPlugin").definedBy(APP_WITH_EXTENSION_PLUGIN_CONFIG).dependingOn(extensionPlugin);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    assertDeploymentFailure(applicationDeploymentListener, applicationFileBuilder.getId());
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) Test(org.junit.Test)

Example 8 with JarFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.

the class ApplicationPolicyDeploymentTestCase method createInjectedHelloExtensionPluginFileBuilder.

private ArtifactPluginFileBuilder createInjectedHelloExtensionPluginFileBuilder() throws URISyntaxException {
    File injectedHelloExtensionJarFile = new CompilerUtils.ExtensionCompiler().compiling(getResourceFile("/org/foo/injected/InjectedHelloExtension.java"), getResourceFile("/org/foo/injected/InjectedHelloOperation.java")).compile("mule-module-hello-1.0.jar", "1.0");
    MulePluginModel.MulePluginModelBuilder mulePluginModelBuilder = new MulePluginModel.MulePluginModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName("helloExtensionPlugin").setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader("helloExtensionPlugin", MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, "1.0.0"));
    mulePluginModelBuilder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId(MULE_LOADER_ID).addProperty(EXPORTED_RESOURCES, asList("/", "META-INF/mule-hello.xsd", "META-INF/spring.handlers", "META-INF/spring.schemas")).build());
    mulePluginModelBuilder.withExtensionModelDescriber().setId(JAVA_LOADER_ID).addProperty("type", "org.foo.injected.InjectedHelloExtension").addProperty("version", "1.0");
    return new ArtifactPluginFileBuilder("helloExtensionPlugin-1.0").dependingOn(new JarFileBuilder("helloExtensionV1", injectedHelloExtensionJarFile)).describedBy((mulePluginModelBuilder.build()));
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) MuleArtifactLoaderDescriptorBuilder(org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) MulePluginModel(org.mule.runtime.api.deployment.meta.MulePluginModel) File(java.io.File)

Example 9 with JarFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.

the class ApplicationPolicyDeploymentTestCase method createSingleExtensionPlugin.

private ArtifactPluginFileBuilder createSingleExtensionPlugin() {
    MulePluginModel.MulePluginModelBuilder mulePluginModelBuilder = new MulePluginModel.MulePluginModelBuilder().setMinMuleVersion(MIN_MULE_VERSION).setName("simpleExtensionPlugin").setRequiredProduct(MULE).withBundleDescriptorLoader(createBundleDescriptorLoader("simpleExtensionPlugin", MULE_EXTENSION_CLASSIFIER, PROPERTIES_BUNDLE_DESCRIPTOR_LOADER_ID, "1.0.0"));
    mulePluginModelBuilder.withClassLoaderModelDescriptorLoader(new MuleArtifactLoaderDescriptorBuilder().setId(MULE_LOADER_ID).build());
    mulePluginModelBuilder.withExtensionModelDescriber().setId(JAVA_LOADER_ID).addProperty("type", "org.foo.hello.SimpleExtension").addProperty("version", "1.0.0");
    return new ArtifactPluginFileBuilder("simpleExtensionPlugin").dependingOn(new JarFileBuilder("simpleExtension", simpleExtensionJarFile)).describedBy(mulePluginModelBuilder.build());
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) MuleArtifactLoaderDescriptorBuilder(org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) MulePluginModel(org.mule.runtime.api.deployment.meta.MulePluginModel)

Example 10 with JarFileBuilder

use of org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder in project mule by mulesoft.

the class DomainDeploymentTestCase method deploysDomainWithSharedLibPrecedenceOverApplicationPluginLib.

@Test
public void deploysDomainWithSharedLibPrecedenceOverApplicationPluginLib() throws Exception {
    final String domainId = "shared-lib";
    final ArtifactPluginFileBuilder pluginFileBuilder = new ArtifactPluginFileBuilder("echoPlugin1").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(pluginEcho1TestClassFile, "org/foo/Plugin1Echo.class").dependingOn(new JarFileBuilder("barUtils2_0", barUtils2_0JarFile));
    final DomainFileBuilder domainFileBuilder = new DomainFileBuilder(domainId).dependingOnSharedLibrary(new JarFileBuilder("barUtils1.0", barUtils1_0JarFile)).definedBy("empty-domain-config.xml");
    final ApplicationFileBuilder applicationFileBuilder = new ApplicationFileBuilder("shared-lib-precedence-app").definedBy("app-shared-lib-precedence-config.xml").dependingOn(pluginFileBuilder).dependingOn(domainFileBuilder);
    addPackedDomainFromBuilder(domainFileBuilder);
    addPackedAppFromBuilder(applicationFileBuilder);
    startDeployment();
    assertDeploymentSuccess(domainDeploymentListener, domainFileBuilder.getId());
    assertApplicationDeploymentSuccess(applicationDeploymentListener, applicationFileBuilder.getId());
    executeApplicationFlow("main");
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) JarFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder) DomainFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder) Test(org.junit.Test)

Aggregations

JarFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder)21 Test (org.junit.Test)15 ArtifactPluginFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder)15 ApplicationFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder)13 MuleArtifactLoaderDescriptorBuilder (org.mule.runtime.api.deployment.meta.MuleArtifactLoaderDescriptorBuilder)6 MulePluginModel (org.mule.runtime.api.deployment.meta.MulePluginModel)4 DomainFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.DomainFileBuilder)3 File (java.io.File)2 MulePluginModelBuilder (org.mule.runtime.api.deployment.meta.MulePluginModel.MulePluginModelBuilder)2 TestArtifactDescriptor (org.mule.runtime.module.artifact.builder.TestArtifactDescriptor)2 DeployableFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.DeployableFileBuilder)2 FileUtils.copyFile (org.apache.commons.io.FileUtils.copyFile)1 FileUtils.writeStringToFile (org.apache.commons.io.FileUtils.writeStringToFile)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 BeforeClass (org.junit.BeforeClass)1 MuleApplicationClassLoaderFactory (org.mule.runtime.deployment.model.internal.application.MuleApplicationClassLoaderFactory)1 DefaultNativeLibraryFinderFactory (org.mule.runtime.deployment.model.internal.nativelib.DefaultNativeLibraryFinderFactory)1 DefaultDomainManager (org.mule.runtime.module.deployment.impl.internal.domain.DefaultDomainManager)1 TestApplicationFactory.createTestApplicationFactory (org.mule.runtime.module.deployment.internal.TestApplicationFactory.createTestApplicationFactory)1 ExtensionCompiler (org.mule.tck.util.CompilerUtils.ExtensionCompiler)1