Search in sources :

Example 1 with TLDArtifactStub

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

the class WarExplodedMojoTest method testExplodedWar_WithTLD.

/**
 * @throws Exception in case of an error.
 */
public void testExplodedWar_WithTLD() throws Exception {
    // setup test data
    String testId = "ExplodedWar_WithTLD";
    MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
    File webAppDirectory = new File(getTestDirectory(), testId);
    File webAppSource = createWebAppSource(testId);
    File classesDir = createClassesDir(testId, true);
    TLDArtifactStub tldArtifact = new TLDArtifactStub(getBasedir());
    File tldFile = tldArtifact.getFile();
    assertTrue("tld jar not found: " + tldFile.getAbsolutePath(), tldFile.exists());
    // configure mojo
    project.addArtifact(tldArtifact);
    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 expectedTLDArtifact = new File(webAppDirectory, "WEB-INF/tld/tldartifact-0.0-Test.tld");
    assertTrue("source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists());
    assertTrue("source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists());
    assertTrue("tld artifact not found: " + expectedTLDArtifact.toString(), expectedTLDArtifact.exists());
    // house keeping
    expectedWebSourceFile.delete();
    expectedWebSource2File.delete();
    expectedTLDArtifact.delete();
}
Also used : TLDArtifactStub(org.apache.maven.plugins.war.stub.TLDArtifactStub) MavenProjectArtifactsStub(org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub) File(java.io.File)

Aggregations

File (java.io.File)1 MavenProjectArtifactsStub (org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub)1 TLDArtifactStub (org.apache.maven.plugins.war.stub.TLDArtifactStub)1