Search in sources :

Example 1 with TestArtifactDescriptor

use of org.mule.runtime.module.artifact.builder.TestArtifactDescriptor in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysApplicationWithPrivilegedPluginDependingOnPlugin.

@Test
public void deploysApplicationWithPrivilegedPluginDependingOnPlugin() throws Exception {
    ArtifactPluginFileBuilder echoPlugin = new ArtifactPluginFileBuilder("echoPlugin").configuredWith(PRIVILEGED_EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").configuredWith(PRIVILEGED_ARTIFACTS_PROPERTY, "org.mule.test:dependantPlugin").dependingOn(new JarFileBuilder("echoTestJar", echoTestJarFile));
    ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
    final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin);
    addPackedAppFromBuilder(artifactFileBuilder);
    startDeployment();
    assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.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) TestArtifactDescriptor(org.mule.runtime.module.artifact.builder.TestArtifactDescriptor) Test(org.junit.Test)

Example 2 with TestArtifactDescriptor

use of org.mule.runtime.module.artifact.builder.TestArtifactDescriptor in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysApplicationWithPluginDependingOnPlugin.

@Test
public void deploysApplicationWithPluginDependingOnPlugin() throws Exception {
    ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
    final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin);
    addPackedAppFromBuilder(artifactFileBuilder);
    startDeployment();
    assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.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) TestArtifactDescriptor(org.mule.runtime.module.artifact.builder.TestArtifactDescriptor) Test(org.junit.Test)

Example 3 with TestArtifactDescriptor

use of org.mule.runtime.module.artifact.builder.TestArtifactDescriptor in project mule by mulesoft.

the class ApplicationDeploymentTestCase method failsToDeployApplicationWithPluginDependantOnPluginNotShipped.

@Test
public void failsToDeployApplicationWithPluginDependantOnPluginNotShipped() throws Exception {
    ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").dependingOn(echoPlugin);
    final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin);
    addPackedAppFromBuilder(artifactFileBuilder);
    startDeployment();
    assertDeploymentFailure(applicationDeploymentListener, artifactFileBuilder.getId(), times(1));
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) TestArtifactDescriptor(org.mule.runtime.module.artifact.builder.TestArtifactDescriptor) Test(org.junit.Test)

Example 4 with TestArtifactDescriptor

use of org.mule.runtime.module.artifact.builder.TestArtifactDescriptor in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysLightApplicationWithPluginDependingOnPlugin.

@Test
public void deploysLightApplicationWithPluginDependingOnPlugin() throws Exception {
    ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class").dependingOn(echoPlugin);
    File mavenRepoFolder = Paths.get(getMuleBaseFolder().getAbsolutePath(), "repository").toFile();
    File testGroupIdRepoFolder = Paths.get(mavenRepoFolder.getAbsolutePath(), "org", "mule", "test").toFile();
    JarFileBuilder testJarFileDependency = new JarFileBuilder("echoTestJar", echoTestJarFile);
    copyFile(testJarFileDependency.getArtifactPomFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoTestJar", "1.0.0", "echoTestJar-1.0.0.pom").toFile());
    copyFile(testJarFileDependency.getArtifactFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoTestJar", "1.0.0", "echoTestJar-1.0.0.jar").toFile());
    copyFile(echoPlugin.getArtifactPomFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoPlugin", "1.0.0", "echoPlugin-1.0.0.pom").toFile());
    copyFile(echoPlugin.getArtifactFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "echoPlugin", "1.0.0", "echoPlugin-1.0.0-mule-plugin.jar").toFile());
    copyFile(dependantPlugin.getArtifactPomFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "dependantPlugin", "1.0.0", "dependantPlugin-1.0.0.pom").toFile());
    copyFile(dependantPlugin.getArtifactFile(), Paths.get(testGroupIdRepoFolder.getAbsolutePath(), "dependantPlugin", "1.0.0", "dependantPlugin-1.0.0-mule-plugin.jar").toFile());
    final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin).usingLightWeightPackage();
    addPackedAppFromBuilder(artifactFileBuilder);
    startDeployment();
    assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.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) TestArtifactDescriptor(org.mule.runtime.module.artifact.builder.TestArtifactDescriptor) FileUtils.writeStringToFile(org.apache.commons.io.FileUtils.writeStringToFile) File(java.io.File) FileUtils.copyFile(org.apache.commons.io.FileUtils.copyFile) Test(org.junit.Test)

Example 5 with TestArtifactDescriptor

use of org.mule.runtime.module.artifact.builder.TestArtifactDescriptor in project mule by mulesoft.

the class ApplicationDeploymentTestCase method failsToDeployApplicationWithMissingPluginDependencyOnPlugin.

@Test
public void failsToDeployApplicationWithMissingPluginDependencyOnPlugin() throws Exception {
    ArtifactPluginFileBuilder dependantPlugin = new ArtifactPluginFileBuilder("dependantPlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo.echo").containingClass(pluginEcho3TestClassFile, "org/foo/echo/Plugin3Echo.class");
    final TestArtifactDescriptor artifactFileBuilder = new ApplicationFileBuilder("plugin-depending-on-plugin-app").definedBy("plugin-depending-on-plugin-app-config.xml").dependingOn(dependantPlugin);
    addPackedAppFromBuilder(artifactFileBuilder);
    startDeployment();
    assertDeploymentSuccess(applicationDeploymentListener, artifactFileBuilder.getId());
    try {
        executeApplicationFlow("main");
        fail("Expected to fail as there should be a missing class");
    } catch (Exception e) {
        assertThat(e.getCause().getCause(), instanceOf(MuleFatalException.class));
        assertThat(e.getCause().getCause().getCause(), instanceOf(NoClassDefFoundError.class));
        assertThat(e.getCause().getCause().getCause().getMessage(), containsString("org/foo/EchoTest"));
    }
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) TestArtifactDescriptor(org.mule.runtime.module.artifact.builder.TestArtifactDescriptor) MuleFatalException(org.mule.runtime.api.exception.MuleFatalException) MuleException(org.mule.runtime.api.exception.MuleException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 TestArtifactDescriptor (org.mule.runtime.module.artifact.builder.TestArtifactDescriptor)6 ApplicationFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder)6 ArtifactPluginFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder)6 File (java.io.File)2 FileUtils.copyFile (org.apache.commons.io.FileUtils.copyFile)2 FileUtils.writeStringToFile (org.apache.commons.io.FileUtils.writeStringToFile)2 JarFileBuilder (org.mule.runtime.module.deployment.impl.internal.builder.JarFileBuilder)2 MuleException (org.mule.runtime.api.exception.MuleException)1 MuleFatalException (org.mule.runtime.api.exception.MuleFatalException)1 CompilerUtils (org.mule.tck.util.CompilerUtils)1 SingleClassCompiler (org.mule.tck.util.CompilerUtils.SingleClassCompiler)1