maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snic...@apache.org
Subject svn commit: r563670 - in /maven/plugins/branches/MWAR-97-2/src: main/java/org/apache/maven/plugin/war/ main/java/org/apache/maven/plugin/war/packaging/ main/java/org/apache/maven/plugin/war/util/ test/java/org/apache/maven/plugin/war/ test/java/org/apa...
Date Tue, 07 Aug 2007 21:49:33 GMT
Author: snicoll
Date: Tue Aug  7 14:49:32 2007
New Revision: 563670

URL: http://svn.apache.org/viewvc?view=rev&rev=563670
Log:
- Implemented a registration callback to have a fine grained policy with file registration
- Fixed samples (dependencies were not added in the expected order)
- WebappStructure handles a cache and reacts accordingly

Modified:
    maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
    maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
    maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java
    maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
    maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarOverlaysTest.java
    maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/stub/MavenProjectArtifactsStub.java

Modified: maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java?view=diff&rev=563670&r1=563669&r2=563670
==============================================================================
--- maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
(original)
+++ maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
Tue Aug  7 14:49:32 2007
@@ -570,7 +570,7 @@
         throws MojoExecutionException, MojoFailureException, IOException
     {
 
-        WebappStructure cache = new WebappStructure();
+        WebappStructure cache = new WebappStructure( null );
         if ( webappStructure != null && webappStructure.exists() )
         {
             // TODO: LOAD the webapp structure thingy using xstream

Modified: maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java?view=diff&rev=563670&r1=563669&r2=563670
==============================================================================
--- maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
(original)
+++ maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
Tue Aug  7 14:49:32 2007
@@ -24,6 +24,7 @@
 import org.apache.maven.plugin.war.AbstractWarMojo;
 import org.apache.maven.plugin.war.util.MappingUtils;
 import org.apache.maven.plugin.war.util.PathSet;
+import org.apache.maven.plugin.war.util.WebappStructure;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
@@ -129,44 +130,51 @@
      * @param context        the context to use
      * @param file           the file to copy
      * @param targetFilename the relative path according to the root of the webapp
-     * @return true if the file has been copied, false otherwise
      * @throws IOException if an error occured while copying
      */
-    protected boolean copyFile( String sourceId, WarPackagingContext context, File file,
String targetFilename )
+    protected void copyFile( String sourceId, final WarPackagingContext context, final File
file,
+                             String targetFilename )
         throws IOException
     {
-
-        File targetFile = new File( context.getWebappDirectory(), targetFilename );
-        // Check if the file already belongs to *this* source. If so only copy if it has
changed. If it does not
-        // belong to this source, check if the source is still registered in the project.
If so, skip the file,
-        // if not overwrite the file and issue a warning
-        if ( context.getWebappStructure().isRegistered( targetFilename ) )
+        final File targetFile = new File( context.getWebappDirectory(), targetFilename );
+        context.getWebappStructure().registerFile( sourceId, targetFilename, new WebappStructure.RegistrationCallback()
         {
-            final String owner = context.getWebappStructure().getOwner( targetFilename );
-            if ( sourceId.equals( owner ) )
+            public void registered( String ownerId, String targetFilename )
+                throws IOException
             {
-                return copyFile( context, file, targetFile, targetFilename, true );
+                copyFile( context, file, targetFile, targetFilename, false );
             }
-            else if ( context.getOwnerIds().contains( owner ) )
+
+            public void alreadyRegistered( String ownerId, String targetFilename )
+                throws IOException
             {
-                context.getLog().info(
-                    " - " + targetFilename + " wasn't copied because it has already been
packaged." );
-                return false;
+                copyFile( context, file, targetFile, targetFilename, true );
             }
-            else
+
+            public void refused( String ownerId, String targetFilename, String actualOwnerId
)
+                throws IOException
             {
-                context.getLog().warn( "Overlay with id[" + owner +
-                    "] does not exist anymore in the current project. " +
-                    "It is recommended to invoke clean if the dependencies of the project
changed." );
-                return copyFile( context, file, targetFile, targetFilename, false );
+                context.getLog().info( " - " + targetFilename + " wasn't copied because it
has " +
+                    "already been packaged for overlay[" + actualOwnerId + "]." );
+            }
+
+            public void superseded( String ownerId, String targetFilename, String deprecatedOwnerId
)
+                throws IOException
+            {
+                context.getLog().info( "File + " + targetFilename + " belonged to overlay["
+ deprecatedOwnerId +
+                    "] so it will be overwritten." );
+                copyFile( context, file, targetFile, targetFilename, false );
             }
-        }
-        else
-        {
-            context.getWebappStructure().registerFile( sourceId, targetFilename );
-            return copyFile( context, file, targetFile, targetFilename, false );
-        }
 
+            public void supersededUnknownOwner( String ownerId, String targetFilename, String
unknownOwnerId )
+                throws IOException
+            {
+                context.getLog().warn( "Overlay[" + unknownOwnerId + "] does not exist anymore
in " +
+                    "the current project. It is recommended to invoke clean if the dependencies
of " +
+                    "the project changed." );
+                copyFile( context, file, targetFile, targetFilename, false );
+            }
+        } );
     }
 
     /**

Modified: maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java?view=diff&rev=563670&r1=563669&r2=563670
==============================================================================
--- maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java
(original)
+++ maven/plugins/branches/MWAR-97-2/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java
Tue Aug  7 14:49:32 2007
@@ -1,5 +1,6 @@
 package org.apache.maven.plugin.war.util;
 
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -22,15 +23,38 @@
 
     private final transient PathSet allFiles;
 
+    private final transient WebappStructure cache;
+
     /**
-     * Creates a new instance.
+     * Creates a new empty instance.
      */
-    public WebappStructure()
+    private WebappStructure()
     {
         this.registeredFiles = new HashMap();
         this.allFiles = new PathSet();
+        this.cache = null;
+    }
+
+    /**
+     * Creates a new instance with the specified cache.
+     *
+     * @param cache the cache
+     */
+    public WebappStructure( WebappStructure cache )
+    {
+        this.registeredFiles = new HashMap();
+        this.allFiles = new PathSet();
+        if ( cache == null )
+        {
+            this.cache = new WebappStructure();
+        }
+        else
+        {
+            this.cache = cache;
+        }
     }
 
+
     /**
      * Specify if the specified <tt>path</tt> is registered or not.
      *
@@ -55,8 +79,7 @@
     {
         if ( !isRegistered( path ) )
         {
-            getFullStructure().add( path );
-            getStructure( id ).add( path );
+            doRegister( id, path );
             return true;
         }
         else
@@ -66,6 +89,48 @@
     }
 
     /**
+     * Registers the specified path for the specified owner. Invokes
+     * the <tt>callback</tt> with the result of the registration.
+     *
+     * @param id       the owner of the path
+     * @param path     the relative path from the webapp root directory
+     * @param callback the callback to invoke with the result of the registration
+     * @throws IOException if the callback invocation throws an IOException
+     */
+    public void registerFile( String id, String path, RegistrationCallback callback )
+        throws IOException
+    {
+
+        // If the file is already in the current structure, rejects it with the current owner
+        if ( isRegistered( path ) )
+        {
+            callback.refused( id, path, getOwner( path ) );
+        }
+        else
+        {
+            doRegister( id, path );
+            // This is a new file
+            if ( cache.getOwner( path ) == null )
+            {
+                callback.registered( id, path );
+
+            } // The file already belonged to this owner
+            else if ( cache.getOwner( path ).equals( id ) )
+            {
+                callback.alreadyRegistered( id, path );
+            } // The file belongs to another owner and it's known currently
+            else if ( getOwners().contains( cache.getOwner( path ) ) )
+            {
+                callback.superseded( id, path, cache.getOwner( path ) );
+            } // The file belongs to another owner and it's unknown
+            else
+            {
+                callback.supersededUnknownOwner( id, path, cache.getOwner( path ) );
+            }
+        }
+    }
+
+    /**
      * Returns the owner of the specified <tt>path</tt>. If the file is not
      * registered, returns <tt>null</tt>
      *
@@ -138,5 +203,99 @@
             registeredFiles.put( id, pathSet );
         }
         return pathSet;
+    }
+
+    private void doRegister( String id, String path )
+    {
+        getFullStructure().add( path );
+        getStructure( id ).add( path );
+    }
+
+    /**
+     * Callback interfce to handle events related to filepath registration in
+     * the webapp.
+     */
+    public interface RegistrationCallback
+    {
+
+
+        /**
+         * Called if the <tt>targetFilename</tt> for the specified <tt>ownerId</tt>
+         * has been registered successfully.
+         * <p/>
+         * This means that the <tt>targetFilename</tt> was unknown and has been
+         * registered successfully.
+         *
+         * @param ownerId        the ownerId
+         * @param targetFilename the relative path according to the root of the webapp
+         * @throws IOException if an error occured while handling this event
+         */
+        void registered( String ownerId, String targetFilename )
+            throws IOException;
+
+        /**
+         * Called if the <tt>targetFilename</tt> for the specified <tt>ownerId</tt>
+         * has already been registered.
+         * <p/>
+         * This means that the <tt>targetFilename</tt> was known and belongs
to the
+         * specified owner.
+         *
+         * @param ownerId        the ownerId
+         * @param targetFilename the relative path according to the root of the webapp
+         * @throws IOException if an error occured while handling this event
+         */
+        void alreadyRegistered( String ownerId, String targetFilename )
+            throws IOException;
+
+        /**
+         * Called if the registration of the <tt>targetFilename</tt> for the
+         * specified <tt>ownerId</tt> has been refused since the path already
+         * belongs to the <tt>actualOwnerId</tt>.
+         * <p/>
+         * This means that the <tt>targetFilename</tt> was known and does not
+         * belong to the specified owner.
+         *
+         * @param ownerId        the ownerId
+         * @param targetFilename the relative path according to the root of the webapp
+         * @param actualOwnerId  the actual owner
+         * @throws IOException if an error occured while handling this event
+         */
+        void refused( String ownerId, String targetFilename, String actualOwnerId )
+            throws IOException;
+
+        /**
+         * Called if the <tt>targetFilename</tt> for the specified <tt>ownerId</tt>
+         * has been registered successfully by superseding a <tt>deprecatedOwnerId</tt>,
+         * that is the previous owner of the file.
+         * <p/>
+         * This means that the <tt>targetFilename</tt> was known but for another
+         * owner. This usually happens after a project's configuration change. As a
+         * result, the file has been registered successfully to the new owner.
+         *
+         * @param ownerId           the ownerId
+         * @param targetFilename    the relative path according to the root of the webapp
+         * @param deprecatedOwnerId the previous owner that does not exist anymore
+         * @throws IOException if an error occured while handling this event
+         */
+        void superseded( String ownerId, String targetFilename, String deprecatedOwnerId
)
+            throws IOException;
+
+        /**
+         * Called if the <tt>targetFilename</tt> for the specified <tt>ownerId</tt>
+         * has been registered successfully by superseding a <tt>unknownOwnerId</tt>,
+         * that is an owner that does not exist anymore in the current project.
+         * <p/>
+         * This means that the <tt>targetFilename</tt> was known but for an owner
that
+         * does not exist anymore. Hence the file has been registered successfully to
+         * the new owner.
+         *
+         * @param ownerId        the ownerId
+         * @param targetFilename the relative path according to the root of the webapp
+         * @param unknownOwnerId the previous owner that does not exist anymore
+         * @throws IOException if an error occured while handling this event
+         */
+        void supersededUnknownOwner( String ownerId, String targetFilename, String unknownOwnerId
)
+            throws IOException;
+
     }
 }

Modified: maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java?view=diff&rev=563670&r1=563669&r2=563670
==============================================================================
--- maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
(original)
+++ maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
Tue Aug  7 14:49:32 2007
@@ -318,58 +318,60 @@
         expectedFile.delete();
     }
 
-    /**
-     * Merge a dependent WAR that gets updated since the last run.
-     */
-    public void testExplodedWarMergeWarUpdated()
-        throws Exception
-    {
-        // setup test data
-        MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
-        WarArtifactStub warArtifact = new WarArtifactStub( getBasedir() );
-
-        String testId = "testExplodedWarMergeWarUpdated";
-        File webAppDirectory = new File( getTestDirectory(), testId );
-        FileUtils.deleteDirectory( webAppDirectory );
-
-        File webAppSource = getWebAppSource( testId );
-
-        File workDirectory = new File( getTestDirectory(), "/war/work-" + testId );
-        createDir( workDirectory );
-
-        File classesDir = createClassesDir( testId, true );
-
-        // configure mojo
-        project.addArtifact( warArtifact );
-        this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory,
project );
-        setVariableValueToObject( mojo, "workDirectory", workDirectory );
-        mojo.execute();
-
-        // validate operation
-        File expectedFile = new File( webAppDirectory, "/org/sample/company/test.jsp" );
-
-        assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists() );
-        assertEquals( "file incorrect", "", FileUtils.fileRead( expectedFile ) );
-
-        // update file, so the local one is older
-        warArtifact.setFile( new File( warArtifact.getFile().getParentFile(), "simple-updated.war"
) );
-
-        mojo.execute();
-
-        assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists() );
-        assertEquals( "file incorrect", "updated\n", FileUtils.fileRead( expectedFile ) );
-
-        // update file, so the local one is newer
-        warArtifact.setFile( new File( warArtifact.getFile().getParentFile(), "simple.war"
) );
-
-        mojo.execute();
-
-        assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists() );
-        assertEquals( "file incorrect", "updated\n", FileUtils.fileRead( expectedFile ) );
-
-        // house keeping
-        expectedFile.delete();
-    }
+//    The last modified thingy behavior is not applicable anymore. This is the only test
that
+//    has been removed.
+//    /**
+//     * Merge a dependent WAR that gets updated since the last run.
+//     */
+//    public void testExplodedWarMergeWarUpdated()
+//        throws Exception
+//    {
+//        // setup test data
+//        MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
+//        WarArtifactStub warArtifact = new WarArtifactStub( getBasedir() );
+//
+//        String testId = "testExplodedWarMergeWarUpdated";
+//        File webAppDirectory = new File( getTestDirectory(), testId );
+//        FileUtils.deleteDirectory( webAppDirectory );
+//
+//        File webAppSource = getWebAppSource( testId );
+//
+//        File workDirectory = new File( getTestDirectory(), "/war/work-" + testId );
+//        createDir( workDirectory );
+//
+//        File classesDir = createClassesDir( testId, true );
+//
+//        // configure mojo
+//        project.addArtifact( warArtifact );
+//        this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory,
project );
+//        setVariableValueToObject( mojo, "workDirectory", workDirectory );
+//        mojo.execute();
+//
+//        // validate operation
+//        File expectedFile = new File( webAppDirectory, "/org/sample/company/test.jsp" );
+//
+//        assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists()
);
+//        assertEquals( "file incorrect", "", FileUtils.fileRead( expectedFile ) );
+//
+//        // update file, so the local one is older
+//        warArtifact.setFile( new File( warArtifact.getFile().getParentFile(), "simple-updated.war"
) );
+//
+//        mojo.execute();
+//
+//        assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists()
);
+//        assertEquals( "file incorrect", "updated\n", FileUtils.fileRead( expectedFile )
);
+//
+//        // update file, so the local one is newer
+//        warArtifact.setFile( new File( warArtifact.getFile().getParentFile(), "simple.war"
) );
+//
+//        mojo.execute();
+//
+//        assertTrue( "file not found: " + expectedFile.toString(), expectedFile.exists()
);
+//        assertEquals( "file incorrect", "updated\n", FileUtils.fileRead( expectedFile )
);
+//
+//        // house keeping
+//        expectedFile.delete();
+//    }
 
     /**
      * @throws Exception

Modified: maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarOverlaysTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarOverlaysTest.java?view=diff&rev=563670&r1=563669&r2=563670
==============================================================================
--- maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarOverlaysTest.java
(original)
+++ maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/WarOverlaysTest.java
Tue Aug  7 14:49:32 2007
@@ -184,7 +184,7 @@
         final File webAppDirectory = setUpMojo( testId, new ArtifactStub[]{overlay1, overlay2,
overlay3},
                                                 new String[]{"org/sample/company/test.jsp",
"jsp/b.jsp"} );
 
-        assertScenariOne( testId, webAppDirectory);
+        assertScenariOne( testId, webAppDirectory );
     }
 
 
@@ -213,13 +213,13 @@
 
         // Add the tags
         final List overlays = new ArrayList();
-        overlays.add( new DefaultOverlay(overlay1));
-        overlays.add( new DefaultOverlay(overlay2));
-        overlays.add( new DefaultOverlay(overlay3));
-        mojo.setOverlays( overlays);
+        overlays.add( new DefaultOverlay( overlay1 ) );
+        overlays.add( new DefaultOverlay( overlay2 ) );
+        overlays.add( new DefaultOverlay( overlay3 ) );
+        mojo.setOverlays( overlays );
 
         // current project ignored. Should be on top of the list
-        assertScenariOne( testId, webAppDirectory);
+        assertScenariOne( testId, webAppDirectory );
     }
 
     /**
@@ -249,31 +249,28 @@
         final List overlays = new ArrayList();
 
         // Add the default project explicitely
-        overlays.add(Overlay.currentProjectInstance());
+        overlays.add( Overlay.currentProjectInstance() );
 
         // Other overlays
-        overlays.add( new DefaultOverlay(overlay1));
-        overlays.add( new DefaultOverlay(overlay2));
-        overlays.add( new DefaultOverlay(overlay3));
-        mojo.setOverlays( overlays);
+        overlays.add( new DefaultOverlay( overlay1 ) );
+        overlays.add( new DefaultOverlay( overlay2 ) );
+        overlays.add( new DefaultOverlay( overlay3 ) );
+        mojo.setOverlays( overlays );
 
         // current project ignored. Should be on top of the list
-        assertScenariOne( testId, webAppDirectory);
+        assertScenariOne( testId, webAppDirectory );
     }
 
 
-
-
     /**
      * Runs the mojo and asserts a scenerio with 3 overlays and no
      * includes/excludes settings.
      *
-     *
-     * @param testId thie id of the test
+     * @param testId          thie id of the test
      * @param webAppDirectory the webapp directory
      * @throws Exception if an exception occurs
      */
-    private void assertScenariOne(String testId, File webAppDirectory)
+    private void assertScenariOne( String testId, File webAppDirectory )
         throws Exception
     {
         final List assertedFiles = new ArrayList();
@@ -281,11 +278,10 @@
         {
             mojo.execute();
             assertedFiles.addAll( assertWebXml( webAppDirectory ) );
-            assertedFiles.addAll( assertCustomContent( webAppDirectory, new String[]{
-                "jsp/a.jsp", "jsp/b.jsp", "jsp/c.jsp", "jsp/d/a.jsp", "jsp/d/b.jsp", "jsp/d/c.jsp",
-                "org/sample/company/test.jsp", "WEB-INF/classes/a.class", "WEB-INF/classes/b.class",
-                "WEB-INF/classes/c.class", "WEB-INF/lib/a.jar", "WEB-INF/lib/b.jar", "WEB-INF/lib/c.jar"},
-                                                                        "overlay file not
found" ) );
+            assertedFiles.addAll( assertCustomContent( webAppDirectory, new String[]{"jsp/a.jsp",
"jsp/b.jsp",
+                "jsp/c.jsp", "jsp/d/a.jsp", "jsp/d/b.jsp", "jsp/d/c.jsp", "org/sample/company/test.jsp",
+                "WEB-INF/classes/a.class", "WEB-INF/classes/b.class", "WEB-INF/classes/c.class",
"WEB-INF/lib/a.jar",
+                "WEB-INF/lib/b.jar", "WEB-INF/lib/c.jar"}, "overlay file not found" ) );
 
             // Those files should come from the source webapp without any config
             assertDefaultFileContent( testId, webAppDirectory, "jsp/b.jsp" );
@@ -353,11 +349,10 @@
         {
             mojo.execute();
             assertedFiles.addAll( assertWebXml( webAppDirectory ) );
-            assertedFiles.addAll( assertCustomContent( webAppDirectory, new String[]{
-                "jsp/a.jsp", "jsp/b.jsp", "jsp/c.jsp", "jsp/d/a.jsp", "jsp/d/b.jsp", "jsp/d/c.jsp",
-                "org/sample/company/test.jsp", "WEB-INF/classes/a.class", "WEB-INF/classes/b.class",
-                "WEB-INF/classes/c.class", "WEB-INF/lib/a.jar", "WEB-INF/lib/b.jar", "WEB-INF/lib/c.jar"},
-                                                                        "overlay file not
found" ) );
+            assertedFiles.addAll( assertCustomContent( webAppDirectory, new String[]{"jsp/a.jsp",
"jsp/b.jsp",
+                "jsp/c.jsp", "jsp/d/a.jsp", "jsp/d/b.jsp", "jsp/d/c.jsp", "org/sample/company/test.jsp",
+                "WEB-INF/classes/a.class", "WEB-INF/classes/b.class", "WEB-INF/classes/c.class",
"WEB-INF/lib/a.jar",
+                "WEB-INF/lib/b.jar", "WEB-INF/lib/c.jar"}, "overlay file not found" ) );
 
             assertOverlayedFile( webAppDirectory, "overlay-full-3", "jsp/a.jsp" );
             assertOverlayedFile( webAppDirectory, "overlay-full-3", "jsp/b.jsp" );
@@ -399,7 +394,6 @@
         final File webAppDirectory = setUpMojo( testId, new ArtifactStub[]{overlay1, overlay2,
overlay3},
                                                 new String[]{"org/sample/company/test.jsp",
"jsp/b.jsp"} );
 
-
         Overlay over1 = new DefaultOverlay( overlay3 );
         over1.setExcludes( "**/a.*,**/c.*,**/*.xml,jsp/b.jsp" );
 
@@ -425,11 +419,10 @@
         {
             mojo.execute();
             assertedFiles.addAll( assertWebXml( webAppDirectory ) );
-            assertedFiles.addAll( assertCustomContent( webAppDirectory, new String[]{
-                "jsp/a.jsp", "jsp/b.jsp", "jsp/c.jsp", "jsp/d/a.jsp", "jsp/d/b.jsp", "jsp/d/c.jsp",
-                "org/sample/company/test.jsp", "WEB-INF/classes/a.class", "WEB-INF/classes/b.class",
-                "WEB-INF/classes/c.class", "WEB-INF/lib/a.jar", "WEB-INF/lib/b.jar", "WEB-INF/lib/c.jar"},
-                                                                        "overlay file not
found" ) );
+            assertedFiles.addAll( assertCustomContent( webAppDirectory, new String[]{"jsp/a.jsp",
"jsp/b.jsp",
+                "jsp/c.jsp", "jsp/d/a.jsp", "jsp/d/b.jsp", "jsp/d/c.jsp", "org/sample/company/test.jsp",
+                "WEB-INF/classes/a.class", "WEB-INF/classes/b.class", "WEB-INF/classes/c.class",
"WEB-INF/lib/a.jar",
+                "WEB-INF/lib/b.jar", "WEB-INF/lib/c.jar"}, "overlay file not found" ) );
 
             assertOverlayedFile( webAppDirectory, "overlay-full-3", "jsp/a.jsp" );
             assertDefaultFileContent( testId, webAppDirectory, "jsp/b.jsp" );

Modified: maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/stub/MavenProjectArtifactsStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/stub/MavenProjectArtifactsStub.java?view=diff&rev=563670&r1=563669&r2=563670
==============================================================================
--- maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/stub/MavenProjectArtifactsStub.java
(original)
+++ maven/plugins/branches/MWAR-97-2/src/test/java/org/apache/maven/plugin/war/stub/MavenProjectArtifactsStub.java
Tue Aug  7 14:49:32 2007
@@ -22,19 +22,19 @@
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.TreeSet;
 
 public class MavenProjectArtifactsStub
     extends MavenProjectBasicStub
 {
-    HashSet artifacts;
+    TreeSet artifacts;
 
     public MavenProjectArtifactsStub()
         throws Exception
     {
-        artifacts = new HashSet();
+        artifacts = new TreeSet();
     }
 
     public void addArtifact( ArtifactStub stub )



Mime
View raw message