Search in sources :

Example 1 with EJBClientArtifactStub

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

the class WarExplodedMojoTest method testExplodedWar_WithEJBClient.

/**
 * @throws Exception in case of an error.
 */
public void testExplodedWar_WithEJBClient() throws Exception {
    // setup test data
    String testId = "ExplodedWar_WithEJB";
    MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
    File webAppDirectory = new File(getTestDirectory(), testId);
    File webAppSource = createWebAppSource(testId);
    File classesDir = createClassesDir(testId, true);
    EJBClientArtifactStub ejbArtifact = new EJBClientArtifactStub(getBasedir());
    File ejbFile = ejbArtifact.getFile();
    assertTrue("ejb jar not found: " + ejbFile.toString(), ejbFile.exists());
    // configure mojo
    project.addArtifact(ejbArtifact);
    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/ejbclientartifact-0.0-Test-client.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());
    // house keeping
    expectedWebSourceFile.delete();
    expectedWebSource2File.delete();
    expectedEJBArtifact.delete();
}
Also used : MavenProjectArtifactsStub(org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub) EJBClientArtifactStub(org.apache.maven.plugins.war.stub.EJBClientArtifactStub) File(java.io.File)

Aggregations

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