Search in sources :

Example 1 with XarArtifactStub

use of org.apache.maven.plugins.war.stub.XarArtifactStub in project maven-plugins by apache.

the class WarExplodedMojoTest method testExplodedWarWithXar.

/**
     * @throws Exception in case of an error.
     */
public void testExplodedWarWithXar() throws Exception {
    // setup test data
    String testId = "ExplodedWarWithXar";
    MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
    File webAppDirectory = new File(getTestDirectory(), testId);
    File webAppSource = createWebAppSource(testId);
    File classesDir = createClassesDir(testId, true);
    // Fake here since the xar artifact handler does not exist: no biggie
    ArtifactHandler artifactHandler = (ArtifactHandler) lookup(ArtifactHandler.ROLE, "jar");
    ArtifactStub xarArtifact = new XarArtifactStub(getBasedir(), artifactHandler);
    File xarFile = xarArtifact.getFile();
    assertTrue("jar not found: " + xarFile.toString(), xarFile.exists());
    // configure mojo
    project.addArtifact(xarArtifact);
    this.configureMojo(mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project);
    mojo.execute();
    // validate operation
    File expectedWebSourceFile = new File(webAppDirectory, "pansit.jsp");
    File expectedWebSource2File = new File(webAppDirectory, "org/web/app/last-exile.jsp");
    // final name form is <artifactId>-<version>.<type>
    File expectedJarArtifact = new File(webAppDirectory, "WEB-INF/extensions/xarartifact-0.0-Test.jar");
    assertTrue("source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists());
    assertTrue("source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists());
    assertTrue("jar artifact not found: " + expectedJarArtifact.toString(), expectedJarArtifact.exists());
    // house keeping
    expectedWebSourceFile.delete();
    expectedWebSource2File.delete();
    expectedJarArtifact.delete();
}
Also used : XarArtifactStub(org.apache.maven.plugins.war.stub.XarArtifactStub) ArtifactHandler(org.apache.maven.artifact.handler.ArtifactHandler) MavenProjectArtifactsStub(org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub) XarArtifactStub(org.apache.maven.plugins.war.stub.XarArtifactStub) MarArtifactStub(org.apache.maven.plugins.war.stub.MarArtifactStub) EJBArtifactStub(org.apache.maven.plugins.war.stub.EJBArtifactStub) WarArtifactStub(org.apache.maven.plugins.war.stub.WarArtifactStub) PARArtifactStub(org.apache.maven.plugins.war.stub.PARArtifactStub) TLDArtifactStub(org.apache.maven.plugins.war.stub.TLDArtifactStub) IncludeExcludeWarArtifactStub(org.apache.maven.plugins.war.stub.IncludeExcludeWarArtifactStub) ArtifactStub(org.apache.maven.plugin.testing.stubs.ArtifactStub) EJBClientArtifactStub(org.apache.maven.plugins.war.stub.EJBClientArtifactStub) JarArtifactStub(org.apache.maven.plugins.war.stub.JarArtifactStub) AarArtifactStub(org.apache.maven.plugins.war.stub.AarArtifactStub) File(java.io.File)

Aggregations

File (java.io.File)1 ArtifactHandler (org.apache.maven.artifact.handler.ArtifactHandler)1 ArtifactStub (org.apache.maven.plugin.testing.stubs.ArtifactStub)1 AarArtifactStub (org.apache.maven.plugins.war.stub.AarArtifactStub)1 EJBArtifactStub (org.apache.maven.plugins.war.stub.EJBArtifactStub)1 EJBClientArtifactStub (org.apache.maven.plugins.war.stub.EJBClientArtifactStub)1 IncludeExcludeWarArtifactStub (org.apache.maven.plugins.war.stub.IncludeExcludeWarArtifactStub)1 JarArtifactStub (org.apache.maven.plugins.war.stub.JarArtifactStub)1 MarArtifactStub (org.apache.maven.plugins.war.stub.MarArtifactStub)1 MavenProjectArtifactsStub (org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub)1 PARArtifactStub (org.apache.maven.plugins.war.stub.PARArtifactStub)1 TLDArtifactStub (org.apache.maven.plugins.war.stub.TLDArtifactStub)1 WarArtifactStub (org.apache.maven.plugins.war.stub.WarArtifactStub)1 XarArtifactStub (org.apache.maven.plugins.war.stub.XarArtifactStub)1