Search in sources :

Example 1 with EJBArtifactStubWithClassifier

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

the class WarExplodedMojoTest method testExplodedWar_DuplicateWithClassifier.

/**
     * @throws Exception in case of an error.
     */
public void testExplodedWar_DuplicateWithClassifier() throws Exception {
    // setup test data
    String testId = "ExplodedWar_DuplicateWithClassifier";
    MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
    File webAppDirectory = new File(getTestDirectory(), testId);
    File webAppSource = createWebAppSource(testId);
    File classesDir = createClassesDir(testId, true);
    EJBArtifactStub ejbArtifact = new EJBArtifactStub(getBasedir());
    EJBArtifactStubWithClassifier ejbArtifactDup = new EJBArtifactStubWithClassifier(getBasedir());
    File ejbFile = ejbArtifact.getFile();
    // ejbArtifact has a hard coded file, only one assert is needed
    assertTrue("ejb not found: " + ejbFile.getAbsolutePath(), ejbFile.exists());
    // configure mojo
    ejbArtifact.setGroupId("org.sample.ejb");
    ejbArtifactDup.setGroupId("org.sample.ejb");
    ejbArtifactDup.setClassifier("classifier");
    project.addArtifact(ejbArtifact);
    project.addArtifact(ejbArtifactDup);
    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 expectedEJBArtifact = new File(webAppDirectory, "WEB-INF/lib/ejbartifact-0.0-Test.jar");
    File expectedEJBDupArtifact = new File(webAppDirectory, "WEB-INF/lib/ejbartifact-0.0-Test-classifier.jar");
    assertTrue("source files not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists());
    assertTrue("source files not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists());
    assertTrue("ejb artifact not found: " + expectedEJBArtifact.toString(), expectedEJBArtifact.exists());
    assertTrue("ejb dup artifact not found: " + expectedEJBDupArtifact.toString(), expectedEJBDupArtifact.exists());
    // house keeping
    expectedWebSourceFile.delete();
    expectedWebSource2File.delete();
    expectedEJBArtifact.delete();
    expectedEJBDupArtifact.delete();
}
Also used : MavenProjectArtifactsStub(org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub) EJBArtifactStubWithClassifier(org.apache.maven.plugins.war.stub.EJBArtifactStubWithClassifier) EJBArtifactStub(org.apache.maven.plugins.war.stub.EJBArtifactStub) File(java.io.File)

Aggregations

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