You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2006/11/19 15:26:08 UTC

svn commit: r476826 [1/2] - in /maven/plugins/trunk/maven-ejb-plugin/src/test: java/org/apache/maven/plugin/ejb/ java/org/apache/maven/plugin/ejb/stub/ java/org/apache/maven/plugin/ejb/utils/ resources/unit/ejbmojotest/

Author: dennisl
Date: Sun Nov 19 06:26:07 2006
New Revision: 476826

URL: http://svn.apache.org/viewvc?view=rev&rev=476826
Log:
o Set EOL style to native.

Modified:
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java   (contents, props changed)
    maven/plugins/trunk/maven-ejb-plugin/src/test/resources/unit/ejbmojotest/plugin-config.xml   (contents, props changed)

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java Sun Nov 19 06:26:07 2006
@@ -1,558 +1,558 @@
-package org.apache.maven.plugin.ejb;
-
-/*
- * Copyright 2001-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.ejb.stub.MavenProjectResourcesStub;
-import org.apache.maven.plugin.ejb.utils.JarContentChecker;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.codehaus.plexus.util.FileUtils;
-
-import java.io.File;
-import java.util.LinkedList;
-import java.util.jar.JarFile;
-
-
-/**
- * EJB plugin Test Case
- */
-
-public class EjbMojoTest
-    extends AbstractMojoTestCase
-{
-    private static final String defaultPOMPath = "target/test-classes/unit/ejbmojotest/plugin-config.xml";
-
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-    }
-
-    public void tearDown()
-        throws Exception
-    {
-
-    }
-
-    /**
-     * check test environment
-     *
-     * @throws Exception
-     */
-    public void testTestEnvironment()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-    }
-
-    /**
-     * basic jar creation test
-     *
-     * @throws Exception
-     */
-    public void testJarCreation_WithoutClientJar()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "jarCreation_WithoutClientJar" );
-
-        // create the necessary test files
-
-        // put this on the target dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // configure mojo
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "false" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        mojo.execute();
-
-        // validate jar creation
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
-        String checkedClientJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
-
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-        assertFalse( FileUtils.fileExists( checkedClientJarFile ) );
-    }
-
-    /**
-     * basic jar creation test with client jar
-     *
-     * @throws Exception
-     */
-    public void testJarCreation_WithClientJar()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "jarCreation_WithClientJar" );
-
-        // set up test files
-
-        // put this on the target dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // configure mojo
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "true" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        mojo.execute();
-
-        // validate jar creation
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
-        String checkedClientJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
-
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-        assertTrue( FileUtils.fileExists( checkedClientJarFile ) );
-    }
-
-    /**
-     * default ejb jar inclusion and exclusion
-     *
-     * @throws Exception
-     */
-    public void testDefaultInclusionsExclusions()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "defaultInclusionsExclusions" );
-
-        // put this on the target output dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
-
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // set up test data
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "false" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        mojo.execute();
-
-        // validate jar creation
-        JarContentChecker inclusionChecker = new JarContentChecker();
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
-
-        // set expected jar contents
-        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
-        inclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
-        inclusionChecker.addFile( new File( "org/sample/ejb/AppBean.class" ) );
-        inclusionChecker.addFile( new File( "org/sample/ejb/AppCMP.class" ) );
-        inclusionChecker.addFile( new File( "org/sample/ejb/AppSession.class" ) );
-
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-    }
-
-    /**
-     * client jar default inclusion and exclusion test
-     *
-     * @throws Exception
-     */
-    public void testClientJarDefaultInclusionsExclusions()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "clientJarDefaultInclusionsExclusions" );
-
-        // put this on the target output dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppStub.class", MavenProjectResourcesStub.OUTPUT_FILE );
-
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // set up test data
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "true" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        mojo.execute();
-
-        // validate jar creation
-        JarContentChecker inclusionChecker = new JarContentChecker();
-        JarContentChecker exclusionChecker = new JarContentChecker();
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
-
-        // set expected jar contents
-        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
-        inclusionChecker.addFile( new File( "org/sample/ejb/AppStub.class" ) );
-
-        // files not included
-        exclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
-        exclusionChecker.addFile( new File( "org/sample/ejb/AppBean.class" ) );
-        exclusionChecker.addFile( new File( "org/sample/ejb/AppCMP.class" ) );
-        exclusionChecker.addFile( new File( "org/sample/ejb/AppSession.class" ) );
-
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-        assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-    }
-
-    /**
-     * client jar inclusion test
-     *
-     * @throws Exception
-     */
-    public void testClientJarInclusions()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "clientJarInclusions" );
-
-        // put this on the target output dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
-
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // set up test data
-        String jarName = "testJar";
-        LinkedList inclusions = new LinkedList();
-
-        inclusions.add( "**/*Include.class" );
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "true" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", inclusions );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        mojo.execute();
-
-        // validate jar creation
-        JarContentChecker inclusionChecker = new JarContentChecker();
-        JarContentChecker exclusionChecker = new JarContentChecker();
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
-
-        // set expected jar contents
-        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
-        inclusionChecker.addFile( new File( "org/sample/ejb/AppInclude.class" ) );
-
-        // read the packaging conventions first for this one
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
-
-        // files not included
-        exclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
-        exclusionChecker.addFile( new File( "org/sample/ejb/AppExclude.class" ) );
-
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-        assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-    }
-
-    /**
-     * client jar exclusions test
-     *
-     * @throws Exception
-     */
-    public void testClientJarExclusions()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "clientJarExclusions" );
-
-        // put this on the target output dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
-        project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
-
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // set up test data
-        String jarName = "testJar";
-        LinkedList exclusions = new LinkedList();
-
-        exclusions.add( "**/*Exclude.class" );
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "true" );
-        setVariableValueToObject( mojo, "clientExcludes", exclusions );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        mojo.execute();
-
-        // validate jar creation
-        JarContentChecker inclusionChecker = new JarContentChecker();
-        JarContentChecker exclusionChecker = new JarContentChecker();
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
-
-        // set expected jar contents
-        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
-        inclusionChecker.addFile( new File( "org/sample/ejb/AppInclude.class" ) );
-
-        // read the packaging conventions first for this one
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
-        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
-
-        // files not included
-        exclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
-        exclusionChecker.addFile( new File( "org/sample/ejb/AppExclude.class" ) );
-
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-        assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
-    }
-
-    /**
-     * tests if the mojo throws an exception when the EJB version is < 3.0
-     * and no deployment descriptor is present. The case with deployment descriptor
-     * present is covered by the testJarCreation* tests.
-     *
-     * @throws Exception
-     */
-    public void testEjbCompliance_2_1_WithoutDescriptor()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "testEjbCompliance_2_1_WithoutDescriptor" );
-
-        // create the necessary test files
-
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // configure mojo
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "false" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
-
-        try
-        {
-            mojo.execute();
-            fail( "Exception should be thrown: No deployment descriptor present." );
-        }
-        catch ( MojoExecutionException e )
-        {
-        }
-    }
-
-    /**
-     * Tests if the jar is created under EJB version 3.0 with
-     * deployment descriptor present.
-     *
-     * @throws Exception
-     */
-    public void testEjbCompliance_3_0_WithDescriptor()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "testEjbCompliance_3_0_WithDescriptor" );
-
-        // create the necessary test files
-
-        // put this on the target dir
-        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // configure mojo
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "false" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "3.0" );
-
-        mojo.execute();
-
-        // validate jar creation
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-    }
-
-    /**
-     * Tests if the jar is created under EJB version 3.0 without
-     * deployment descriptor present.
-     *
-     * @throws Exception
-     */
-    public void testEjbCompliance_3_0_WithoutDescriptor()
-        throws Exception
-    {
-        File pomFile = new File( getBasedir(), defaultPOMPath );
-        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
-
-        assertNotNull( mojo );
-
-        // this will automatically create the isolated
-        // test environment
-        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "testEjbCompliance_3_0_WithoutDescriptor" );
-
-        // create the necessary test files
-
-        // put this on the root dir
-        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
-        // start creating the environment
-        project.setupBuildEnvironment();
-
-        // configure mojo
-        String jarName = "testJar";
-
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
-        setVariableValueToObject( mojo, "jarName", jarName );
-        setVariableValueToObject( mojo, "generateClient", "false" );
-        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
-        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
-        setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "ejbVersion", "3.0" );
-
-        mojo.execute();
-
-        // validate jar creation
-        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
-        assertTrue( FileUtils.fileExists( checkedJarFile ) );
-    }
-}
+package org.apache.maven.plugin.ejb;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.ejb.stub.MavenProjectResourcesStub;
+import org.apache.maven.plugin.ejb.utils.JarContentChecker;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.jar.JarFile;
+
+
+/**
+ * EJB plugin Test Case
+ */
+
+public class EjbMojoTest
+    extends AbstractMojoTestCase
+{
+    private static final String defaultPOMPath = "target/test-classes/unit/ejbmojotest/plugin-config.xml";
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+    }
+
+    public void tearDown()
+        throws Exception
+    {
+
+    }
+
+    /**
+     * check test environment
+     *
+     * @throws Exception
+     */
+    public void testTestEnvironment()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+    }
+
+    /**
+     * basic jar creation test
+     *
+     * @throws Exception
+     */
+    public void testJarCreation_WithoutClientJar()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "jarCreation_WithoutClientJar" );
+
+        // create the necessary test files
+
+        // put this on the target dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // configure mojo
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "false" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        mojo.execute();
+
+        // validate jar creation
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
+        String checkedClientJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
+
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+        assertFalse( FileUtils.fileExists( checkedClientJarFile ) );
+    }
+
+    /**
+     * basic jar creation test with client jar
+     *
+     * @throws Exception
+     */
+    public void testJarCreation_WithClientJar()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "jarCreation_WithClientJar" );
+
+        // set up test files
+
+        // put this on the target dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // configure mojo
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "true" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        mojo.execute();
+
+        // validate jar creation
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
+        String checkedClientJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
+
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+        assertTrue( FileUtils.fileExists( checkedClientJarFile ) );
+    }
+
+    /**
+     * default ejb jar inclusion and exclusion
+     *
+     * @throws Exception
+     */
+    public void testDefaultInclusionsExclusions()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "defaultInclusionsExclusions" );
+
+        // put this on the target output dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
+
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // set up test data
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "false" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        mojo.execute();
+
+        // validate jar creation
+        JarContentChecker inclusionChecker = new JarContentChecker();
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
+
+        // set expected jar contents
+        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
+        inclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
+        inclusionChecker.addFile( new File( "org/sample/ejb/AppBean.class" ) );
+        inclusionChecker.addFile( new File( "org/sample/ejb/AppCMP.class" ) );
+        inclusionChecker.addFile( new File( "org/sample/ejb/AppSession.class" ) );
+
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+    }
+
+    /**
+     * client jar default inclusion and exclusion test
+     *
+     * @throws Exception
+     */
+    public void testClientJarDefaultInclusionsExclusions()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "clientJarDefaultInclusionsExclusions" );
+
+        // put this on the target output dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppStub.class", MavenProjectResourcesStub.OUTPUT_FILE );
+
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // set up test data
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "true" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        mojo.execute();
+
+        // validate jar creation
+        JarContentChecker inclusionChecker = new JarContentChecker();
+        JarContentChecker exclusionChecker = new JarContentChecker();
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
+
+        // set expected jar contents
+        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
+        inclusionChecker.addFile( new File( "org/sample/ejb/AppStub.class" ) );
+
+        // files not included
+        exclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
+        exclusionChecker.addFile( new File( "org/sample/ejb/AppBean.class" ) );
+        exclusionChecker.addFile( new File( "org/sample/ejb/AppCMP.class" ) );
+        exclusionChecker.addFile( new File( "org/sample/ejb/AppSession.class" ) );
+
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+        assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+    }
+
+    /**
+     * client jar inclusion test
+     *
+     * @throws Exception
+     */
+    public void testClientJarInclusions()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "clientJarInclusions" );
+
+        // put this on the target output dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // set up test data
+        String jarName = "testJar";
+        LinkedList inclusions = new LinkedList();
+
+        inclusions.add( "**/*Include.class" );
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "true" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", inclusions );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        mojo.execute();
+
+        // validate jar creation
+        JarContentChecker inclusionChecker = new JarContentChecker();
+        JarContentChecker exclusionChecker = new JarContentChecker();
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
+
+        // set expected jar contents
+        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
+        inclusionChecker.addFile( new File( "org/sample/ejb/AppInclude.class" ) );
+
+        // read the packaging conventions first for this one
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
+
+        // files not included
+        exclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
+        exclusionChecker.addFile( new File( "org/sample/ejb/AppExclude.class" ) );
+
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+        assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+    }
+
+    /**
+     * client jar exclusions test
+     *
+     * @throws Exception
+     */
+    public void testClientJarExclusions()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "clientJarExclusions" );
+
+        // put this on the target output dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+        project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
+
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // set up test data
+        String jarName = "testJar";
+        LinkedList exclusions = new LinkedList();
+
+        exclusions.add( "**/*Exclude.class" );
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "true" );
+        setVariableValueToObject( mojo, "clientExcludes", exclusions );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        mojo.execute();
+
+        // validate jar creation
+        JarContentChecker inclusionChecker = new JarContentChecker();
+        JarContentChecker exclusionChecker = new JarContentChecker();
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + "-client.jar";
+
+        // set expected jar contents
+        inclusionChecker.addFile( new File( "META-INF/MANIFEST.MF" ) );
+        inclusionChecker.addFile( new File( "org/sample/ejb/AppInclude.class" ) );
+
+        // read the packaging conventions first for this one
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml" ) );
+        inclusionChecker.addFile( new File( "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties" ) );
+
+        // files not included
+        exclusionChecker.addFile( new File( "META-INF/ejb-jar.xml" ) );
+        exclusionChecker.addFile( new File( "org/sample/ejb/AppExclude.class" ) );
+
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+        assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+        assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
+    }
+
+    /**
+     * tests if the mojo throws an exception when the EJB version is < 3.0
+     * and no deployment descriptor is present. The case with deployment descriptor
+     * present is covered by the testJarCreation* tests.
+     *
+     * @throws Exception
+     */
+    public void testEjbCompliance_2_1_WithoutDescriptor()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "testEjbCompliance_2_1_WithoutDescriptor" );
+
+        // create the necessary test files
+
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // configure mojo
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "false" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "2.1" );
+
+        try
+        {
+            mojo.execute();
+            fail( "Exception should be thrown: No deployment descriptor present." );
+        }
+        catch ( MojoExecutionException e )
+        {
+        }
+    }
+
+    /**
+     * Tests if the jar is created under EJB version 3.0 with
+     * deployment descriptor present.
+     *
+     * @throws Exception
+     */
+    public void testEjbCompliance_3_0_WithDescriptor()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "testEjbCompliance_3_0_WithDescriptor" );
+
+        // create the necessary test files
+
+        // put this on the target dir
+        project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // configure mojo
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "false" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "3.0" );
+
+        mojo.execute();
+
+        // validate jar creation
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+    }
+
+    /**
+     * Tests if the jar is created under EJB version 3.0 without
+     * deployment descriptor present.
+     *
+     * @throws Exception
+     */
+    public void testEjbCompliance_3_0_WithoutDescriptor()
+        throws Exception
+    {
+        File pomFile = new File( getBasedir(), defaultPOMPath );
+        EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
+
+        assertNotNull( mojo );
+
+        // this will automatically create the isolated
+        // test environment
+        MavenProjectResourcesStub project = new MavenProjectResourcesStub( "testEjbCompliance_3_0_WithoutDescriptor" );
+
+        // create the necessary test files
+
+        // put this on the root dir
+        project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
+        // start creating the environment
+        project.setupBuildEnvironment();
+
+        // configure mojo
+        String jarName = "testJar";
+
+        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
+        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "jarName", jarName );
+        setVariableValueToObject( mojo, "generateClient", "false" );
+        setVariableValueToObject( mojo, "clientExcludes", new LinkedList() );
+        setVariableValueToObject( mojo, "clientIncludes", new LinkedList() );
+        setVariableValueToObject( mojo, "project", project );
+        setVariableValueToObject( mojo, "ejbVersion", "3.0" );
+
+        mojo.execute();
+
+        // validate jar creation
+        String checkedJarFile = project.getBuild().getDirectory() + "/" + jarName + ".jar";
+        assertTrue( FileUtils.fileExists( checkedJarFile ) );
+    }
+}

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java Sun Nov 19 06:26:07 2006
@@ -1,329 +1,329 @@
-package org.apache.maven.plugin.ejb.stub;
-
-/*
- * Copyright 2001-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.File;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-import org.apache.maven.artifact.versioning.VersionRange;
-
-
-/**
- * Stub
- */
-public class ArtifactStub
-    implements Artifact
-{
-
-    boolean hasClassifier;
-
-    boolean resolved;
-
-    boolean optional;
-
-    boolean release;
-
-    ArtifactHandler artifactHandler;
-
-    File file;
-
-    String baseVersion;
-
-    String type;
-
-    String classifier;
-
-    String identifier;
-
-    String dependencyConflictId;
-
-    String downloadUrl;
-
-    String selectedVersion;
-
-    String artifactId;
-
-    String groupId;
-
-    String resolvedVersion;
-
-    String scope;
-
-    String version;
-
-    VersionRange versionRange;
-
-
-    public ArtifactStub()
-    {
-        type = "testtype";
-        scope = "testscope";
-        classifier = "testclassifier";
-        artifactHandler = new DefaultArtifactHandler();
-    }
-
-    public void populate( MavenProjectBasicStub project )
-    {
-        groupId = project.getGroupId();
-        artifactId = project.getArtifactId();
-        version = project.getVersion();
-        versionRange = VersionRange.createFromVersion( version );
-    }
-
-    public boolean hasClassifier()
-    {
-        return true;
-    }
-
-    public String getBaseVersion()
-    {
-        return "Test Version";
-    }
-
-    public void setBaseVersion( String version )
-    {
-        baseVersion = version;
-    }
-
-    public void setFile( File _file )
-    {
-        file = _file;
-    }
-
-    public File getFile()
-    {
-        return new File( "testfile" );
-    }
-
-    public String getGroupId()
-    {
-        return groupId;
-    }
-
-    public String getArtifactId()
-    {
-        return artifactId;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String _version )
-    {
-        version = _version;
-    }
-
-    public String getScope()
-    {
-        return scope;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    public String getClassifier()
-    {
-        return classifier;
-    }
-
-    public String getId()
-    {
-        return identifier;
-    }
-
-    public String getDependencyConflictId()
-    {
-        return dependencyConflictId;
-    }
-
-    public void addMetadata( ArtifactMetadata metadata )
-    {
-
-    }
-
-    public Collection getMetadataList()
-    {
-        return new LinkedList();
-    }
-
-    public void setRepository( ArtifactRepository remoteRepository )
-    {
-
-    }
-
-    public ArtifactRepository getRepository()
-    {
-        return null;
-    }
-
-    public void updateVersion( String version, ArtifactRepository localRepository )
-    {
-
-    }
-
-    public String getDownloadUrl()
-    {
-        return downloadUrl;
-    }
-
-    public void setDownloadUrl( String _downloadUrl )
-    {
-        downloadUrl = _downloadUrl;
-    }
-
-    public ArtifactFilter getDependencyFilter()
-    {
-        return null;
-    }
-
-    public void setDependencyFilter( ArtifactFilter artifactFilter )
-    {
-
-    }
-
-    public ArtifactHandler getArtifactHandler()
-    {
-        return artifactHandler;
-    }
-
-    public List getDependencyTrail()
-    {
-        return new LinkedList();
-    }
-
-    public void setDependencyTrail( List dependencyTrail )
-    {
-
-    }
-
-    public void setScope( String _scope )
-    {
-        scope = _scope;
-    }
-
-    public VersionRange getVersionRange()
-    {
-        return versionRange;
-    }
-
-    public void setVersionRange( VersionRange newRange )
-    {
-
-    }
-
-    public void selectVersion( String version )
-    {
-        selectedVersion = version;
-    }
-
-    public void setGroupId( String _groupId )
-    {
-        groupId = _groupId;
-    }
-
-    public void setArtifactId( String _artifactId )
-    {
-        artifactId = _artifactId;
-    }
-
-    public boolean isSnapshot()
-    {
-        return true;
-    }
-
-    public void setResolved( boolean _resolved )
-    {
-        resolved = _resolved;
-    }
-
-    public boolean isResolved()
-    {
-        return true;
-    }
-
-    public void setResolvedVersion( String version )
-    {
-        resolvedVersion = version;
-    }
-
-
-    public void setArtifactHandler( ArtifactHandler handler )
-    {
-
-    }
-
-    public boolean isRelease()
-    {
-        return true;
-    }
-
-    public void setRelease( boolean _release )
-    {
-        release = _release;
-    }
-
-    public List getAvailableVersions()
-    {
-        return new LinkedList();
-    }
-
-    public void setAvailableVersions( List versions )
-    {
-
-    }
-
-    public boolean isOptional()
-    {
-        return true;
-    }
-
-    public void setOptional( boolean _optional )
-    {
-        optional = _optional;
-    }
-
-    public ArtifactVersion getSelectedVersion()
-        throws OverConstrainedVersionException
-    {
-        return null;
-    }
-
-    public boolean isSelectedVersionKnown()
-        throws OverConstrainedVersionException
-    {
-        return true;
-    }
-
-    public int compareTo( Object object )
-    {
-        return 0;
-    }
-}
+package org.apache.maven.plugin.ejb.stub;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+
+/**
+ * Stub
+ */
+public class ArtifactStub
+    implements Artifact
+{
+
+    boolean hasClassifier;
+
+    boolean resolved;
+
+    boolean optional;
+
+    boolean release;
+
+    ArtifactHandler artifactHandler;
+
+    File file;
+
+    String baseVersion;
+
+    String type;
+
+    String classifier;
+
+    String identifier;
+
+    String dependencyConflictId;
+
+    String downloadUrl;
+
+    String selectedVersion;
+
+    String artifactId;
+
+    String groupId;
+
+    String resolvedVersion;
+
+    String scope;
+
+    String version;
+
+    VersionRange versionRange;
+
+
+    public ArtifactStub()
+    {
+        type = "testtype";
+        scope = "testscope";
+        classifier = "testclassifier";
+        artifactHandler = new DefaultArtifactHandler();
+    }
+
+    public void populate( MavenProjectBasicStub project )
+    {
+        groupId = project.getGroupId();
+        artifactId = project.getArtifactId();
+        version = project.getVersion();
+        versionRange = VersionRange.createFromVersion( version );
+    }
+
+    public boolean hasClassifier()
+    {
+        return true;
+    }
+
+    public String getBaseVersion()
+    {
+        return "Test Version";
+    }
+
+    public void setBaseVersion( String version )
+    {
+        baseVersion = version;
+    }
+
+    public void setFile( File _file )
+    {
+        file = _file;
+    }
+
+    public File getFile()
+    {
+        return new File( "testfile" );
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String _version )
+    {
+        version = _version;
+    }
+
+    public String getScope()
+    {
+        return scope;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+    public String getId()
+    {
+        return identifier;
+    }
+
+    public String getDependencyConflictId()
+    {
+        return dependencyConflictId;
+    }
+
+    public void addMetadata( ArtifactMetadata metadata )
+    {
+
+    }
+
+    public Collection getMetadataList()
+    {
+        return new LinkedList();
+    }
+
+    public void setRepository( ArtifactRepository remoteRepository )
+    {
+
+    }
+
+    public ArtifactRepository getRepository()
+    {
+        return null;
+    }
+
+    public void updateVersion( String version, ArtifactRepository localRepository )
+    {
+
+    }
+
+    public String getDownloadUrl()
+    {
+        return downloadUrl;
+    }
+
+    public void setDownloadUrl( String _downloadUrl )
+    {
+        downloadUrl = _downloadUrl;
+    }
+
+    public ArtifactFilter getDependencyFilter()
+    {
+        return null;
+    }
+
+    public void setDependencyFilter( ArtifactFilter artifactFilter )
+    {
+
+    }
+
+    public ArtifactHandler getArtifactHandler()
+    {
+        return artifactHandler;
+    }
+
+    public List getDependencyTrail()
+    {
+        return new LinkedList();
+    }
+
+    public void setDependencyTrail( List dependencyTrail )
+    {
+
+    }
+
+    public void setScope( String _scope )
+    {
+        scope = _scope;
+    }
+
+    public VersionRange getVersionRange()
+    {
+        return versionRange;
+    }
+
+    public void setVersionRange( VersionRange newRange )
+    {
+
+    }
+
+    public void selectVersion( String version )
+    {
+        selectedVersion = version;
+    }
+
+    public void setGroupId( String _groupId )
+    {
+        groupId = _groupId;
+    }
+
+    public void setArtifactId( String _artifactId )
+    {
+        artifactId = _artifactId;
+    }
+
+    public boolean isSnapshot()
+    {
+        return true;
+    }
+
+    public void setResolved( boolean _resolved )
+    {
+        resolved = _resolved;
+    }
+
+    public boolean isResolved()
+    {
+        return true;
+    }
+
+    public void setResolvedVersion( String version )
+    {
+        resolvedVersion = version;
+    }
+
+
+    public void setArtifactHandler( ArtifactHandler handler )
+    {
+
+    }
+
+    public boolean isRelease()
+    {
+        return true;
+    }
+
+    public void setRelease( boolean _release )
+    {
+        release = _release;
+    }
+
+    public List getAvailableVersions()
+    {
+        return new LinkedList();
+    }
+
+    public void setAvailableVersions( List versions )
+    {
+
+    }
+
+    public boolean isOptional()
+    {
+        return true;
+    }
+
+    public void setOptional( boolean _optional )
+    {
+        optional = _optional;
+    }
+
+    public ArtifactVersion getSelectedVersion()
+        throws OverConstrainedVersionException
+    {
+        return null;
+    }
+
+    public boolean isSelectedVersionKnown()
+        throws OverConstrainedVersionException
+    {
+        return true;
+    }
+
+    public int compareTo( Object object )
+    {
+        return 0;
+    }
+}

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ArtifactStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java Sun Nov 19 06:26:07 2006
@@ -1,163 +1,163 @@
-package org.apache.maven.plugin.ejb.stub;
-
-/*
- * Copyright 2001-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Properties;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Stub
- */
-public class MavenProjectBasicStub
-    extends MavenProject
-{
-    protected String identifier;
-
-    protected String testRootDir;
-
-    protected Properties properties;
-
-    protected String description;
-
-    protected ModelStub model;
-
-    protected File file;
-
-    protected ArtifactStub artifact;
-
-    public MavenProjectBasicStub( String id )
-        throws Exception
-    {
-        // most values are hardcoded to have a controlled environment
-        super( new ModelStub() );
-
-        model = (ModelStub) getModel();
-        properties = new Properties();
-        artifact = new ArtifactStub();
-        identifier = id;
-
-        // set isolated root directory
-        testRootDir = PlexusTestCase.getBasedir() + "/target/test-classes/unit/test-dir/" + identifier;
-
-        if ( !FileUtils.fileExists( testRootDir ) )
-        {
-            FileUtils.mkdir( testRootDir );
-        }
-
-        artifact.populate( this );
-
-        // this is ugly but needed to ensure that the copy constructor 
-        // works correctly
-        initializeParentFields();
-    }
-
-    public String getName()
-    {
-        return "Test Project " + identifier;
-    }
-
-    public void setDescription( String desc )
-    {
-        description = desc;
-    }
-
-    public Model getModel()
-    {
-        return model;
-    }
-
-    public String getDescription()
-    {
-        if ( description == null )
-        {
-            return "this is a test project";
-        }
-        else
-        {
-            return description;
-        }
-    }
-
-    public File getBasedir()
-    {
-        // create an isolated environment 
-        // see setupTestEnvironment for details
-        return new File( testRootDir );
-    }
-
-    public Artifact getArtifact()
-    {
-        return artifact;
-    }
-
-    public String getGroupId()
-    {
-        return "org.apache.maven.plugin.test";
-    }
-
-    public String getArtifactId()
-    {
-        return "maven-resource-plugin-test#" + identifier;
-    }
-
-    public String getPackaging()
-    {
-        return "ejb";
-    }
-
-    public String getVersion()
-    {
-        return identifier;
-    }
-
-    public void addProperty( String key, String value )
-    {
-        properties.put( key, value );
-    }
-
-    public Properties getProperties()
-    {
-        return properties;
-    }
-
-    // to prevent the MavenProject copy constructor from blowing up
-    private void initializeParentFields()
-    {
-        // the pom should be located in the isolated dummy root         
-        super.setFile( new File( getBasedir(), "pom.xml" ) );
-        super.setDependencyArtifacts( new HashSet() );
-        super.setArtifacts( new HashSet() );
-        super.setPluginArtifacts( new HashSet() );
-        super.setReportArtifacts( new HashSet() );
-        super.setExtensionArtifacts( new HashSet() );
-        super.setRemoteArtifactRepositories( new LinkedList() );
-        super.setPluginArtifactRepositories( new LinkedList() );
-        super.setCollectedProjects( new LinkedList() );
-        super.setActiveProfiles( new LinkedList() );
-        super.setOriginalModel( null );
-        super.setExecutionProject( this );
-        super.setArtifact( artifact );
-    }
-}
+package org.apache.maven.plugin.ejb.stub;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Stub
+ */
+public class MavenProjectBasicStub
+    extends MavenProject
+{
+    protected String identifier;
+
+    protected String testRootDir;
+
+    protected Properties properties;
+
+    protected String description;
+
+    protected ModelStub model;
+
+    protected File file;
+
+    protected ArtifactStub artifact;
+
+    public MavenProjectBasicStub( String id )
+        throws Exception
+    {
+        // most values are hardcoded to have a controlled environment
+        super( new ModelStub() );
+
+        model = (ModelStub) getModel();
+        properties = new Properties();
+        artifact = new ArtifactStub();
+        identifier = id;
+
+        // set isolated root directory
+        testRootDir = PlexusTestCase.getBasedir() + "/target/test-classes/unit/test-dir/" + identifier;
+
+        if ( !FileUtils.fileExists( testRootDir ) )
+        {
+            FileUtils.mkdir( testRootDir );
+        }
+
+        artifact.populate( this );
+
+        // this is ugly but needed to ensure that the copy constructor 
+        // works correctly
+        initializeParentFields();
+    }
+
+    public String getName()
+    {
+        return "Test Project " + identifier;
+    }
+
+    public void setDescription( String desc )
+    {
+        description = desc;
+    }
+
+    public Model getModel()
+    {
+        return model;
+    }
+
+    public String getDescription()
+    {
+        if ( description == null )
+        {
+            return "this is a test project";
+        }
+        else
+        {
+            return description;
+        }
+    }
+
+    public File getBasedir()
+    {
+        // create an isolated environment 
+        // see setupTestEnvironment for details
+        return new File( testRootDir );
+    }
+
+    public Artifact getArtifact()
+    {
+        return artifact;
+    }
+
+    public String getGroupId()
+    {
+        return "org.apache.maven.plugin.test";
+    }
+
+    public String getArtifactId()
+    {
+        return "maven-resource-plugin-test#" + identifier;
+    }
+
+    public String getPackaging()
+    {
+        return "ejb";
+    }
+
+    public String getVersion()
+    {
+        return identifier;
+    }
+
+    public void addProperty( String key, String value )
+    {
+        properties.put( key, value );
+    }
+
+    public Properties getProperties()
+    {
+        return properties;
+    }
+
+    // to prevent the MavenProject copy constructor from blowing up
+    private void initializeParentFields()
+    {
+        // the pom should be located in the isolated dummy root         
+        super.setFile( new File( getBasedir(), "pom.xml" ) );
+        super.setDependencyArtifacts( new HashSet() );
+        super.setArtifacts( new HashSet() );
+        super.setPluginArtifacts( new HashSet() );
+        super.setReportArtifacts( new HashSet() );
+        super.setExtensionArtifacts( new HashSet() );
+        super.setRemoteArtifactRepositories( new LinkedList() );
+        super.setPluginArtifactRepositories( new LinkedList() );
+        super.setCollectedProjects( new LinkedList() );
+        super.setActiveProfiles( new LinkedList() );
+        super.setOriginalModel( null );
+        super.setExecutionProject( this );
+        super.setArtifact( artifact );
+    }
+}

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBasicStub.java
------------------------------------------------------------------------------
    svn:eol-style = native