maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r476826 [2/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/
Date Sun, 19 Nov 2006 14:26:08 GMT
Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
(original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
Sun Nov 19 06:26:07 2006
@@ -1,343 +1,343 @@
-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.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Stub
- */
-public class MavenProjectBuildStub
-    extends MavenProjectBasicStub
-{
-    public static final int RESOURCES_FILE = 1;
-
-    public static final int ROOT_FILE = 2;
-
-    public static final int OUTPUT_FILE = 3;
-
-    public static final int SOURCE_FILE = 4;
-
-    protected Build build;
-
-    protected String srcDirectory;
-
-    protected String targetDirectory;
-
-    protected String buildDirectory;
-
-    protected String outputDirectory;
-
-    protected String testOutputDirectory;
-
-    protected String resourcesDirectory;
-
-    protected String testResourcesDirectory;
-
-    protected String targetResourceDirectory;
-
-    protected String targetTestResourcesDirectory;
-
-    protected ArrayList targetClassesList;
-
-    protected ArrayList sourceFileList;
-
-    protected ArrayList resourcesFileList;
-
-    protected ArrayList rootFileList;
-
-    protected ArrayList directoryList;
-
-    protected HashMap dataMap;
-
-    public MavenProjectBuildStub( String key )
-        throws Exception
-    {
-        super( key );
-
-        build = new Build();
-        resourcesFileList = new ArrayList();
-        sourceFileList = new ArrayList();
-        rootFileList = new ArrayList();
-        directoryList = new ArrayList();
-        targetClassesList = new ArrayList();
-        dataMap = new HashMap();
-        setupBuild();
-    }
-
-    public void addDirectory( String name )
-    {
-        if ( isValidPath( name ) )
-        {
-            directoryList.add( name );
-        }
-    }
-
-    public void setOutputDirectory( String dir )
-    {
-        outputDirectory = buildDirectory + "/" + dir;
-        build.setOutputDirectory( outputDirectory );
-    }
-
-    public void addFile( String name, int type )
-    {
-        if ( isValidPath( name ) )
-        {
-            List list = getList( type );
-
-            list.add( name );
-        }
-    }
-
-    public void addFile( String name, String data, int type )
-    {
-        File fileName = new File( name );
-
-        addFile( name, type );
-        dataMap.put( fileName.getName(), data );
-    }
-
-    public String getOutputDirectory()
-    {
-        return outputDirectory;
-    }
-
-    public String getTestOutputDirectory()
-    {
-        return testOutputDirectory;
-    }
-
-    public String getResourcesDirectory()
-    {
-        return resourcesDirectory;
-    }
-
-    public String getTestResourcesDirectory()
-    {
-        return testResourcesDirectory;
-    }
-
-    public Build getBuild()
-    {
-        return build;
-    }
-
-    /**
-     * returns true if the path is relative
-     * and false if absolute
-     * also returns false if it is relative to
-     * the parent
-     *
-     * @param path
-     * @return
-     */
-    private boolean isValidPath( String path )
-    {
-        boolean bRetVal = true;
-
-        if ( path.startsWith( "c:" ) || path.startsWith( ".." ) || path.startsWith( "/" )
|| path.startsWith( "\\" ) )
-        {
-            bRetVal = false;
-        }
-
-        return bRetVal;
-    }
-
-    private void setupBuild()
-    {
-        // check getBasedir method for the exact path
-        // we need to recreate the dir structure in 
-        // an isolated environment
-        srcDirectory = testRootDir + "/src";
-        buildDirectory = testRootDir + "/target";
-        outputDirectory = buildDirectory + "/classes";
-        testOutputDirectory = buildDirectory + "/test-classes";
-        resourcesDirectory = srcDirectory + "/main/resources/";
-        testResourcesDirectory = srcDirectory + "/test/resources/";
-
-        build.setDirectory( buildDirectory );
-        build.setOutputDirectory( outputDirectory );
-        build.setTestOutputDirectory( testOutputDirectory );
-    }
-
-    public void setupBuildEnvironment()
-        throws Exception
-    {
-        // populate dummy resources and dummy test resources
-
-        // setup src dir
-        if ( !FileUtils.fileExists( resourcesDirectory ) )
-        {
-            FileUtils.mkdir( resourcesDirectory );
-        }
-
-        if ( !FileUtils.fileExists( testResourcesDirectory ) )
-        {
-            FileUtils.mkdir( testResourcesDirectory );
-        }
-
-        createDirectories( resourcesDirectory, testResourcesDirectory );
-        createFiles( resourcesDirectory, testResourcesDirectory );
-        setupRootFiles();
-
-        // setup target dir        
-        if ( !FileUtils.fileExists( outputDirectory ) )
-        {
-            FileUtils.mkdir( outputDirectory );
-        }
-
-        if ( !FileUtils.fileExists( testOutputDirectory ) )
-        {
-            FileUtils.mkdir( testOutputDirectory );
-        }
-
-        setupTargetFiles();
-    }
-
-    private void createDirectories( String parent, String testparent )
-    {
-        File currentDirectory;
-
-        for ( int nIndex = 0; nIndex < directoryList.size(); nIndex++ )
-        {
-            currentDirectory = new File( parent, "/" + (String) directoryList.get( nIndex
) );
-
-            if ( !currentDirectory.exists() )
-            {
-                currentDirectory.mkdirs();
-            }
-
-            // duplicate dir structure in test resources
-            currentDirectory = new File( testparent, "/" + (String) directoryList.get( nIndex
) );
-
-            if ( !currentDirectory.exists() )
-            {
-                currentDirectory.mkdirs();
-            }
-        }
-    }
-
-    private List getList( int type )
-    {
-        ArrayList retVal = null;
-
-        switch ( type )
-        {
-            case SOURCE_FILE :
-                retVal = sourceFileList;
-                break;
-            case OUTPUT_FILE :
-                retVal = targetClassesList;
-                break;
-            case RESOURCES_FILE :
-                retVal = resourcesFileList;
-                break;
-            case ROOT_FILE :
-                retVal = rootFileList;
-                break;
-        }
-
-        return retVal;
-    }
-
-    private void createFiles( String parent, int type )
-    {
-        File currentFile;
-        ArrayList list = (ArrayList) getList( type );
-
-        // guard
-        if ( list == null )
-        {
-            return;
-        }
-
-        for ( int nIndex = 0; nIndex < list.size(); nIndex++ )
-        {
-            currentFile = new File( parent, (String) list.get( nIndex ) );
-
-            // create the necessary parent directories
-            // before we create the files
-            if ( !currentFile.getParentFile().exists() )
-            {
-                currentFile.getParentFile().mkdirs();
-            }
-
-            if ( !currentFile.exists() )
-            {
-                try
-                {
-                    currentFile.createNewFile();
-                    populateFile( currentFile, RESOURCES_FILE );
-                }
-                catch ( IOException io )
-                {
-                    //TODO: handle exception
-                }
-            }
-        }
-    }
-
-    private void setupRootFiles()
-    {
-        createFiles( testRootDir, ROOT_FILE );
-    }
-
-    private void setupTargetFiles()
-    {
-        createFiles( getOutputDirectory(), OUTPUT_FILE );
-    }
-
-    private void setupSourceFiles()
-    {
-        createFiles( srcDirectory, SOURCE_FILE );
-    }
-
-    private void createFiles( String parent, String testparent )
-    {
-        createFiles( parent, RESOURCES_FILE );
-        createFiles( testparent, RESOURCES_FILE );
-    }
-
-    private void populateFile( File file, int type )
-    {
-        FileOutputStream outputStream;
-        String data = data = (String) dataMap.get( file.getName() );
-
-        if ( ( data != null ) && file.exists() )
-        {
-            try
-            {
-                outputStream = new FileOutputStream( file );
-                outputStream.write( data.getBytes() );
-                outputStream.flush();
-                outputStream.close();
-            }
-            catch ( IOException ex )
-            {
-                // TODO: handle exception here
-            }
-        }
-    }
-}
+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.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.maven.model.Build;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Stub
+ */
+public class MavenProjectBuildStub
+    extends MavenProjectBasicStub
+{
+    public static final int RESOURCES_FILE = 1;
+
+    public static final int ROOT_FILE = 2;
+
+    public static final int OUTPUT_FILE = 3;
+
+    public static final int SOURCE_FILE = 4;
+
+    protected Build build;
+
+    protected String srcDirectory;
+
+    protected String targetDirectory;
+
+    protected String buildDirectory;
+
+    protected String outputDirectory;
+
+    protected String testOutputDirectory;
+
+    protected String resourcesDirectory;
+
+    protected String testResourcesDirectory;
+
+    protected String targetResourceDirectory;
+
+    protected String targetTestResourcesDirectory;
+
+    protected ArrayList targetClassesList;
+
+    protected ArrayList sourceFileList;
+
+    protected ArrayList resourcesFileList;
+
+    protected ArrayList rootFileList;
+
+    protected ArrayList directoryList;
+
+    protected HashMap dataMap;
+
+    public MavenProjectBuildStub( String key )
+        throws Exception
+    {
+        super( key );
+
+        build = new Build();
+        resourcesFileList = new ArrayList();
+        sourceFileList = new ArrayList();
+        rootFileList = new ArrayList();
+        directoryList = new ArrayList();
+        targetClassesList = new ArrayList();
+        dataMap = new HashMap();
+        setupBuild();
+    }
+
+    public void addDirectory( String name )
+    {
+        if ( isValidPath( name ) )
+        {
+            directoryList.add( name );
+        }
+    }
+
+    public void setOutputDirectory( String dir )
+    {
+        outputDirectory = buildDirectory + "/" + dir;
+        build.setOutputDirectory( outputDirectory );
+    }
+
+    public void addFile( String name, int type )
+    {
+        if ( isValidPath( name ) )
+        {
+            List list = getList( type );
+
+            list.add( name );
+        }
+    }
+
+    public void addFile( String name, String data, int type )
+    {
+        File fileName = new File( name );
+
+        addFile( name, type );
+        dataMap.put( fileName.getName(), data );
+    }
+
+    public String getOutputDirectory()
+    {
+        return outputDirectory;
+    }
+
+    public String getTestOutputDirectory()
+    {
+        return testOutputDirectory;
+    }
+
+    public String getResourcesDirectory()
+    {
+        return resourcesDirectory;
+    }
+
+    public String getTestResourcesDirectory()
+    {
+        return testResourcesDirectory;
+    }
+
+    public Build getBuild()
+    {
+        return build;
+    }
+
+    /**
+     * returns true if the path is relative
+     * and false if absolute
+     * also returns false if it is relative to
+     * the parent
+     *
+     * @param path
+     * @return
+     */
+    private boolean isValidPath( String path )
+    {
+        boolean bRetVal = true;
+
+        if ( path.startsWith( "c:" ) || path.startsWith( ".." ) || path.startsWith( "/" )
|| path.startsWith( "\\" ) )
+        {
+            bRetVal = false;
+        }
+
+        return bRetVal;
+    }
+
+    private void setupBuild()
+    {
+        // check getBasedir method for the exact path
+        // we need to recreate the dir structure in 
+        // an isolated environment
+        srcDirectory = testRootDir + "/src";
+        buildDirectory = testRootDir + "/target";
+        outputDirectory = buildDirectory + "/classes";
+        testOutputDirectory = buildDirectory + "/test-classes";
+        resourcesDirectory = srcDirectory + "/main/resources/";
+        testResourcesDirectory = srcDirectory + "/test/resources/";
+
+        build.setDirectory( buildDirectory );
+        build.setOutputDirectory( outputDirectory );
+        build.setTestOutputDirectory( testOutputDirectory );
+    }
+
+    public void setupBuildEnvironment()
+        throws Exception
+    {
+        // populate dummy resources and dummy test resources
+
+        // setup src dir
+        if ( !FileUtils.fileExists( resourcesDirectory ) )
+        {
+            FileUtils.mkdir( resourcesDirectory );
+        }
+
+        if ( !FileUtils.fileExists( testResourcesDirectory ) )
+        {
+            FileUtils.mkdir( testResourcesDirectory );
+        }
+
+        createDirectories( resourcesDirectory, testResourcesDirectory );
+        createFiles( resourcesDirectory, testResourcesDirectory );
+        setupRootFiles();
+
+        // setup target dir        
+        if ( !FileUtils.fileExists( outputDirectory ) )
+        {
+            FileUtils.mkdir( outputDirectory );
+        }
+
+        if ( !FileUtils.fileExists( testOutputDirectory ) )
+        {
+            FileUtils.mkdir( testOutputDirectory );
+        }
+
+        setupTargetFiles();
+    }
+
+    private void createDirectories( String parent, String testparent )
+    {
+        File currentDirectory;
+
+        for ( int nIndex = 0; nIndex < directoryList.size(); nIndex++ )
+        {
+            currentDirectory = new File( parent, "/" + (String) directoryList.get( nIndex
) );
+
+            if ( !currentDirectory.exists() )
+            {
+                currentDirectory.mkdirs();
+            }
+
+            // duplicate dir structure in test resources
+            currentDirectory = new File( testparent, "/" + (String) directoryList.get( nIndex
) );
+
+            if ( !currentDirectory.exists() )
+            {
+                currentDirectory.mkdirs();
+            }
+        }
+    }
+
+    private List getList( int type )
+    {
+        ArrayList retVal = null;
+
+        switch ( type )
+        {
+            case SOURCE_FILE :
+                retVal = sourceFileList;
+                break;
+            case OUTPUT_FILE :
+                retVal = targetClassesList;
+                break;
+            case RESOURCES_FILE :
+                retVal = resourcesFileList;
+                break;
+            case ROOT_FILE :
+                retVal = rootFileList;
+                break;
+        }
+
+        return retVal;
+    }
+
+    private void createFiles( String parent, int type )
+    {
+        File currentFile;
+        ArrayList list = (ArrayList) getList( type );
+
+        // guard
+        if ( list == null )
+        {
+            return;
+        }
+
+        for ( int nIndex = 0; nIndex < list.size(); nIndex++ )
+        {
+            currentFile = new File( parent, (String) list.get( nIndex ) );
+
+            // create the necessary parent directories
+            // before we create the files
+            if ( !currentFile.getParentFile().exists() )
+            {
+                currentFile.getParentFile().mkdirs();
+            }
+
+            if ( !currentFile.exists() )
+            {
+                try
+                {
+                    currentFile.createNewFile();
+                    populateFile( currentFile, RESOURCES_FILE );
+                }
+                catch ( IOException io )
+                {
+                    //TODO: handle exception
+                }
+            }
+        }
+    }
+
+    private void setupRootFiles()
+    {
+        createFiles( testRootDir, ROOT_FILE );
+    }
+
+    private void setupTargetFiles()
+    {
+        createFiles( getOutputDirectory(), OUTPUT_FILE );
+    }
+
+    private void setupSourceFiles()
+    {
+        createFiles( srcDirectory, SOURCE_FILE );
+    }
+
+    private void createFiles( String parent, String testparent )
+    {
+        createFiles( parent, RESOURCES_FILE );
+        createFiles( testparent, RESOURCES_FILE );
+    }
+
+    private void populateFile( File file, int type )
+    {
+        FileOutputStream outputStream;
+        String data = data = (String) dataMap.get( file.getName() );
+
+        if ( ( data != null ) && file.exists() )
+        {
+            try
+            {
+                outputStream = new FileOutputStream( file );
+                outputStream.write( data.getBytes() );
+                outputStream.flush();
+                outputStream.close();
+            }
+            catch ( IOException ex )
+            {
+                // TODO: handle exception here
+            }
+        }
+    }
+}

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

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java
(original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectResourcesStub.java
Sun Nov 19 06:26:07 2006
@@ -1,112 +1,112 @@
-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 org.apache.maven.model.Resource;
-
-
-/**
- * Stub
- */
-public class MavenProjectResourcesStub
-    extends MavenProjectBuildStub
-{
-
-    public MavenProjectResourcesStub( String id )
-        throws Exception
-    {
-        super( id );
-        setupResources();
-        setupTestResources();
-    }
-
-    public void addInclude( String pattern )
-    {
-        ( (Resource) build.getResources().get( 0 ) ).addInclude( pattern );
-    }
-
-    public void addExclude( String pattern )
-    {
-        ( (Resource) build.getResources().get( 0 ) ).addExclude( pattern );
-    }
-
-    public void addTestInclude( String pattern )
-    {
-        ( (Resource) build.getTestResources().get( 0 ) ).addInclude( pattern );
-    }
-
-    public void addTestExclude( String pattern )
-    {
-        ( (Resource) build.getTestResources().get( 0 ) ).addExclude( pattern );
-    }
-
-    public void setTargetPath( String path )
-    {
-        ( (Resource) build.getResources().get( 0 ) ).setTargetPath( path );
-    }
-
-    public void setTestTargetPath( String path )
-    {
-        ( (Resource) build.getTestResources().get( 0 ) ).setTargetPath( path );
-    }
-
-    public void setDirectory( String dir )
-    {
-        ( (Resource) build.getResources().get( 0 ) ).setDirectory( dir );
-    }
-
-    public void setTestDirectory( String dir )
-    {
-        ( (Resource) build.getTestResources().get( 0 ) ).setDirectory( dir );
-    }
-
-    public void setResourceFiltering( int nIndex, boolean filter )
-    {
-        if ( build.getResources().size() > nIndex )
-        {
-            ( (Resource) build.getResources().get( nIndex ) ).setFiltering( filter );
-        }
-    }
-
-    private void setupResources()
-    {
-        Resource resource = new Resource();
-
-        // see MavenProjectBasicStub for details 
-        // of getBasedir
-
-        // setup default resources
-        resource.setDirectory( getBasedir().getPath() + "/src/main/resources" );
-        resource.setFiltering( false );
-        resource.setTargetPath( null );
-        build.addResource( resource );
-    }
-
-    private void setupTestResources()
-    {
-        Resource resource = new Resource();
-
-        // see MavenProjectBasicStub for details 
-        // of getBasedir      
-
-        // setup default test resources         
-        resource.setDirectory( getBasedir().getPath() + "/src/test/resources" );
-        resource.setFiltering( false );
-        resource.setTargetPath( null );
-        build.addTestResource( resource );
-    }
-}
+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 org.apache.maven.model.Resource;
+
+
+/**
+ * Stub
+ */
+public class MavenProjectResourcesStub
+    extends MavenProjectBuildStub
+{
+
+    public MavenProjectResourcesStub( String id )
+        throws Exception
+    {
+        super( id );
+        setupResources();
+        setupTestResources();
+    }
+
+    public void addInclude( String pattern )
+    {
+        ( (Resource) build.getResources().get( 0 ) ).addInclude( pattern );
+    }
+
+    public void addExclude( String pattern )
+    {
+        ( (Resource) build.getResources().get( 0 ) ).addExclude( pattern );
+    }
+
+    public void addTestInclude( String pattern )
+    {
+        ( (Resource) build.getTestResources().get( 0 ) ).addInclude( pattern );
+    }
+
+    public void addTestExclude( String pattern )
+    {
+        ( (Resource) build.getTestResources().get( 0 ) ).addExclude( pattern );
+    }
+
+    public void setTargetPath( String path )
+    {
+        ( (Resource) build.getResources().get( 0 ) ).setTargetPath( path );
+    }
+
+    public void setTestTargetPath( String path )
+    {
+        ( (Resource) build.getTestResources().get( 0 ) ).setTargetPath( path );
+    }
+
+    public void setDirectory( String dir )
+    {
+        ( (Resource) build.getResources().get( 0 ) ).setDirectory( dir );
+    }
+
+    public void setTestDirectory( String dir )
+    {
+        ( (Resource) build.getTestResources().get( 0 ) ).setDirectory( dir );
+    }
+
+    public void setResourceFiltering( int nIndex, boolean filter )
+    {
+        if ( build.getResources().size() > nIndex )
+        {
+            ( (Resource) build.getResources().get( nIndex ) ).setFiltering( filter );
+        }
+    }
+
+    private void setupResources()
+    {
+        Resource resource = new Resource();
+
+        // see MavenProjectBasicStub for details 
+        // of getBasedir
+
+        // setup default resources
+        resource.setDirectory( getBasedir().getPath() + "/src/main/resources" );
+        resource.setFiltering( false );
+        resource.setTargetPath( null );
+        build.addResource( resource );
+    }
+
+    private void setupTestResources()
+    {
+        Resource resource = new Resource();
+
+        // see MavenProjectBasicStub for details 
+        // of getBasedir      
+
+        // setup default test resources         
+        resource.setDirectory( getBasedir().getPath() + "/src/test/resources" );
+        resource.setFiltering( false );
+        resource.setTargetPath( null );
+        build.addTestResource( resource );
+    }
+}

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

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java
(original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/ModelStub.java
Sun Nov 19 06:26:07 2006
@@ -1,87 +1,87 @@
-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.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-
-/**
- * Stub
- */
-public class ModelStub
-    extends Model
-{
-    public ModelStub()
-    {
-
-    }
-
-    public String getVersion()
-    {
-        return "0.0-TEST";
-    }
-
-    public String getModelVersion()
-    {
-        return "0.0-TEST";
-    }
-
-    public String getName()
-    {
-        return "Test Model";
-    }
-
-    public String getGroupId()
-    {
-        return "org.apache.maven.test";
-    }
-
-    public String getPackaging()
-    {
-        return "jar";
-    }
-
-    public Parent getParent()
-    {
-        //return new Parent();
-        return null;
-    }
-
-    public String getArtifactId()
-    {
-        return "maven-test-plugin";
-    }
-
-    public Properties getProperties()
-    {
-        return new Properties();
-    }
-
-    public List getPackages()
-    {
-        return new LinkedList();
-    }
-
-    public List getProfiles()
-    {
-        return new LinkedList();
-    }
-}
+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.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+
+/**
+ * Stub
+ */
+public class ModelStub
+    extends Model
+{
+    public ModelStub()
+    {
+
+    }
+
+    public String getVersion()
+    {
+        return "0.0-TEST";
+    }
+
+    public String getModelVersion()
+    {
+        return "0.0-TEST";
+    }
+
+    public String getName()
+    {
+        return "Test Model";
+    }
+
+    public String getGroupId()
+    {
+        return "org.apache.maven.test";
+    }
+
+    public String getPackaging()
+    {
+        return "jar";
+    }
+
+    public Parent getParent()
+    {
+        //return new Parent();
+        return null;
+    }
+
+    public String getArtifactId()
+    {
+        return "maven-test-plugin";
+    }
+
+    public Properties getProperties()
+    {
+        return new Properties();
+    }
+
+    public List getPackages()
+    {
+        return new LinkedList();
+    }
+
+    public List getProfiles()
+    {
+        return new LinkedList();
+    }
+}

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

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java
(original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java
Sun Nov 19 06:26:07 2006
@@ -1,177 +1,177 @@
-package org.apache.maven.plugin.ejb.utils;
-
-/*
- * 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.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-
-/**
- * Jar Content Checker
- */
-public class JarContentChecker
-{
-    private final static String FOUND = "1";
-
-    private final static String NOT_FOUND = "0";
-
-    private HashMap fileMap;
-
-    private HashMap directoryMap;
-
-    private HashMap dataMap;
-
-
-    public JarContentChecker()
-    {
-        fileMap = new HashMap();
-        directoryMap = new HashMap();
-        dataMap = new HashMap();
-    }
-
-    public void addDirectory( File dir )
-    {
-        directoryMap.put( dir, NOT_FOUND );
-    }
-
-    public void addFile( File file )
-    {
-        fileMap.put( file, NOT_FOUND );
-    }
-
-    public void addFile( String file, String data )
-    {
-        fileMap.put( file, NOT_FOUND );
-        dataMap.put( file, data );
-    }
-
-
-    /**
-     * checks whether the jar file contains the files for this checker,
-     * files with the same file name but with different data will not
-     * be considered.
-     *
-     * @param File
-     * @return boolean
-     */
-    public boolean isOK( JarFile jarFile )
-    {
-        boolean bRetVal = false;
-        Enumeration zipentries = jarFile.entries();
-        ZipEntry entry;
-        File entryFile;
-
-        resetList();
-
-        while ( zipentries.hasMoreElements() )
-        {
-            entry = (ZipEntry) zipentries.nextElement();
-            entryFile = new File( entry.getName() );
-
-            if ( entry.isDirectory() )
-            {
-                // cross out all files found in the jar file     
-                // found files with incorrect content will not
-                // be counted
-                if ( directoryMap.containsKey( entryFile ) )
-                {
-                    directoryMap.put( entryFile, FOUND );
-                }
-            }
-            else if ( fileMap.containsKey( entryFile ) )
-            {
-                try
-                {
-                    if ( checkContent( entryFile, jarFile.getInputStream( entry ) ) )
-                    {
-                        fileMap.put( entryFile, FOUND );
-                    }
-                }
-                catch ( IOException ex )
-                {
-                    // TODO: handle exception
-                }
-            }
-        }
-
-        bRetVal = checkFinalResult();
-
-        return bRetVal;
-    }
-
-
-    private boolean checkContent( File file, InputStream istream )
-    {
-        boolean bRetVal = true;
-
-        if ( dataMap.containsKey( file ) )
-        {
-            // TODO: do content checking here
-        }
-
-        return bRetVal;
-    }
-
-    private boolean checkFinalResult()
-    {
-        boolean bRetVal = true;
-
-        Iterator keys = fileMap.keySet().iterator();
-
-        while ( keys.hasNext() && bRetVal )
-        {
-            if ( fileMap.get( keys.next() ).equals( NOT_FOUND ) )
-            {
-                bRetVal = false;
-            }
-        }
-
-        keys = directoryMap.keySet().iterator();
-
-        while ( keys.hasNext() && bRetVal )
-        {
-            if ( directoryMap.get( keys.next() ).equals( NOT_FOUND ) )
-            {
-                bRetVal = false;
-            }
-        }
-
-        return bRetVal;
-    }
-
-    private void resetList()
-    {
-        Iterator keys = fileMap.keySet().iterator();
-
-        while ( keys.hasNext() )
-        {
-            fileMap.put( keys.next(), NOT_FOUND );
-        }
-
-        keys = directoryMap.keySet().iterator();
-
-        while ( keys.hasNext() )
-        {
-            directoryMap.put( keys.next(), NOT_FOUND );
-        }
-    }
-}
+package org.apache.maven.plugin.ejb.utils;
+
+/*
+ * 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.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+/**
+ * Jar Content Checker
+ */
+public class JarContentChecker
+{
+    private final static String FOUND = "1";
+
+    private final static String NOT_FOUND = "0";
+
+    private HashMap fileMap;
+
+    private HashMap directoryMap;
+
+    private HashMap dataMap;
+
+
+    public JarContentChecker()
+    {
+        fileMap = new HashMap();
+        directoryMap = new HashMap();
+        dataMap = new HashMap();
+    }
+
+    public void addDirectory( File dir )
+    {
+        directoryMap.put( dir, NOT_FOUND );
+    }
+
+    public void addFile( File file )
+    {
+        fileMap.put( file, NOT_FOUND );
+    }
+
+    public void addFile( String file, String data )
+    {
+        fileMap.put( file, NOT_FOUND );
+        dataMap.put( file, data );
+    }
+
+
+    /**
+     * checks whether the jar file contains the files for this checker,
+     * files with the same file name but with different data will not
+     * be considered.
+     *
+     * @param File
+     * @return boolean
+     */
+    public boolean isOK( JarFile jarFile )
+    {
+        boolean bRetVal = false;
+        Enumeration zipentries = jarFile.entries();
+        ZipEntry entry;
+        File entryFile;
+
+        resetList();
+
+        while ( zipentries.hasMoreElements() )
+        {
+            entry = (ZipEntry) zipentries.nextElement();
+            entryFile = new File( entry.getName() );
+
+            if ( entry.isDirectory() )
+            {
+                // cross out all files found in the jar file     
+                // found files with incorrect content will not
+                // be counted
+                if ( directoryMap.containsKey( entryFile ) )
+                {
+                    directoryMap.put( entryFile, FOUND );
+                }
+            }
+            else if ( fileMap.containsKey( entryFile ) )
+            {
+                try
+                {
+                    if ( checkContent( entryFile, jarFile.getInputStream( entry ) ) )
+                    {
+                        fileMap.put( entryFile, FOUND );
+                    }
+                }
+                catch ( IOException ex )
+                {
+                    // TODO: handle exception
+                }
+            }
+        }
+
+        bRetVal = checkFinalResult();
+
+        return bRetVal;
+    }
+
+
+    private boolean checkContent( File file, InputStream istream )
+    {
+        boolean bRetVal = true;
+
+        if ( dataMap.containsKey( file ) )
+        {
+            // TODO: do content checking here
+        }
+
+        return bRetVal;
+    }
+
+    private boolean checkFinalResult()
+    {
+        boolean bRetVal = true;
+
+        Iterator keys = fileMap.keySet().iterator();
+
+        while ( keys.hasNext() && bRetVal )
+        {
+            if ( fileMap.get( keys.next() ).equals( NOT_FOUND ) )
+            {
+                bRetVal = false;
+            }
+        }
+
+        keys = directoryMap.keySet().iterator();
+
+        while ( keys.hasNext() && bRetVal )
+        {
+            if ( directoryMap.get( keys.next() ).equals( NOT_FOUND ) )
+            {
+                bRetVal = false;
+            }
+        }
+
+        return bRetVal;
+    }
+
+    private void resetList()
+    {
+        Iterator keys = fileMap.keySet().iterator();
+
+        while ( keys.hasNext() )
+        {
+            fileMap.put( keys.next(), NOT_FOUND );
+        }
+
+        keys = directoryMap.keySet().iterator();
+
+        while ( keys.hasNext() )
+        {
+            directoryMap.put( keys.next(), NOT_FOUND );
+        }
+    }
+}

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

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/resources/unit/ejbmojotest/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/resources/unit/ejbmojotest/plugin-config.xml?view=diff&rev=476826&r1=476825&r2=476826
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/resources/unit/ejbmojotest/plugin-config.xml
(original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/resources/unit/ejbmojotest/plugin-config.xml
Sun Nov 19 06:26:07 2006
@@ -1,11 +1,11 @@
-<project>
-  <name>ejb-plugin-test</name>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-ejb-plugin</artifactId>
-        <configuration></configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
+<project>
+  <name>ejb-plugin-test</name>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-ejb-plugin</artifactId>
+        <configuration></configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/test/resources/unit/ejbmojotest/plugin-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message