You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2009/08/20 19:51:53 UTC

svn commit: r806277 - in /maven/plugins/trunk/maven-assembly-plugin: ./ src/main/java/org/apache/maven/plugin/assembly/ src/main/java/org/apache/maven/plugin/assembly/format/ src/main/java/org/apache/maven/plugin/assembly/mojos/ src/test/java/org/apach...

Author: epunzalan
Date: Thu Aug 20 17:51:53 2009
New Revision: 806277

URL: http://svn.apache.org/viewvc?rev=806277&view=rev
Log:
[MASSEMBLY-385] upgrading file/fileset filtering to use maven-filtering

Modified:
    maven/plugins/trunk/maven-assembly-plugin/pom.xml
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileSetFormatterTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java

Modified: maven/plugins/trunk/maven-assembly-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/pom.xml?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-assembly-plugin/pom.xml Thu Aug 20 17:51:53 2009
@@ -86,6 +86,11 @@
       <version>1.1</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-filtering</artifactId>
+      <version>1.0-beta-2</version>
+    </dependency>
+    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-active-collections</artifactId>
       <version>1.0-beta-2</version>

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java Thu Aug 20 17:51:53 2009
@@ -23,6 +23,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 
 import java.io.File;
 import java.util.List;
@@ -86,4 +87,6 @@
     MavenSession getMavenSession();
     
     String getArchiverConfig();
+
+    MavenFileFilter getMavenFileFilter();
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java Thu Aug 20 17:51:53 2009
@@ -21,26 +21,16 @@
 
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
-import org.apache.maven.plugin.assembly.utils.PropertyUtils;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFilteringException;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.InterpolationFilterReader;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
+import java.util.Collections;
 
 /**
  * @version $Id$
@@ -52,22 +42,12 @@
 
     private final AssemblerConfigurationSource configSource;
 
-    private Properties filterProperties;
-
     public FileFormatter( AssemblerConfigurationSource configSource, Logger logger )
     {
         this.configSource = configSource;
         this.logger = logger;
     }
 
-    // used for unit testing currently.
-    protected FileFormatter( Properties filterProperties, AssemblerConfigurationSource configSource, Logger logger )
-    {
-        this.filterProperties = filterProperties;
-        this.configSource = configSource;
-        this.logger = logger;
-    }
-
     public File format( File source, boolean filter, String lineEnding )
         throws AssemblyFormattingException
     {
@@ -77,182 +57,63 @@
     public File format( File source, boolean filter, String lineEnding, File tempRoot )
         throws AssemblyFormattingException
     {
-        if ( !filter && ( AssemblyFileUtils.getLineEndingCharacters( lineEnding ) == null ) )
-        {
-            return source;
-        }
-
-        File result = source;
-
         AssemblyFileUtils.verifyTempDirectoryAvailability( tempRoot, logger );
 
-        String sourceName = source.getName();
-
-        try
-        {
-            boolean contentIsChanged = false;
-
-            String rawContents = readFile( source );
-
-            String contents = rawContents;
-
-            if ( filter )
-            {
-                contents = filter( contents, source );
-            }
-
-            contentIsChanged = !contents.equals( rawContents );
-
-            BufferedReader contentReader = new BufferedReader( new StringReader( contents ) );
-
-            File tempFilterFile = FileUtils.createTempFile( sourceName + ".", ".filtered", tempRoot );
+        File result = source;
 
-            boolean fileWritten = formatLineEndings( contentReader, tempFilterFile, lineEnding, contentIsChanged );
+        if ( filter )
+            result = doFileFilter( source, tempRoot );
 
-            if ( fileWritten )
-            {
-                result = tempFilterFile;
-            }
-        }
-        catch ( FileNotFoundException e )
-        {
-            throw new AssemblyFormattingException( "File to filter not found: " + e.getMessage(), e );
-        }
-        catch ( IOException e )
+        String lineEndingChars = AssemblyFileUtils.getLineEndingCharacters( lineEnding );
+        if ( lineEndingChars != null )
         {
-            throw new AssemblyFormattingException( "Error filtering file '" + source + "': " + e.getMessage(), e );
+            result = formatLineEndings( lineEndingChars, result, tempRoot );
         }
 
         return result;
     }
 
-    /**
-     * Read file content, using platform encoding.
-     * @param source the file to read
-     * @return the file content, read with platform encoding
-     */
-    private String readFile( File source )
-        throws IOException
+    private File doFileFilter( File source, File tempRoot )
+        throws AssemblyFormattingException
     {
-        FileReader fileReader = null;
-
-        StringWriter contentWriter = new StringWriter();
-
         try
         {
-            fileReader = new FileReader( source ); // platform encoding
-
-            IOUtil.copy( fileReader, contentWriter );
-        }
-        finally
-        {
-            IOUtil.close( fileReader );
-        }
+            File target = FileUtils.createTempFile( source.getName() + ".", ".filtered", tempRoot );
 
-        return contentWriter.toString();
-    }
-
-    private boolean formatLineEndings( BufferedReader contentReader, File tempFilterFile, String lineEnding,
-                                    boolean contentIsChanged )
-        throws IOException, AssemblyFormattingException
-    {
-        boolean fileWritten = false;
+            //@todo this test can be improved
+            boolean isPropertiesFile = source.getName().toLowerCase().contains( ".properties" );
 
-        String lineEndingChars = AssemblyFileUtils.getLineEndingCharacters( lineEnding );
-
-        if ( lineEndingChars != null )
-        {
-            AssemblyFileUtils.convertLineEndings( contentReader, tempFilterFile, lineEndingChars );
+            configSource.getMavenFileFilter().copyFile( source, target, true, configSource.getProject(),
+                    Collections.EMPTY_LIST, isPropertiesFile, null, configSource.getMavenSession() );
 
-            fileWritten = true;
+            return target;
         }
-        else if ( contentIsChanged )
+        catch (MavenFilteringException e)
         {
-            FileWriter fileWriter = null;
-
-            try
-            {
-                fileWriter = new FileWriter( tempFilterFile ); // platform encoding
-
-                IOUtil.copy( contentReader, fileWriter );
-
-                fileWritten = true;
-            }
-            finally
-            {
-                IOUtil.close( fileWriter );
-            }
+            throw new AssemblyFormattingException( "Error filtering file '" + source + "': " + e.getMessage(), e );
         }
-
-        return fileWritten;
     }
 
-    private String filter( String rawContents, File source )
-        throws IOException, AssemblyFormattingException
+    private File formatLineEndings( String lineEndingChars, File source, File tempRoot )
+        throws AssemblyFormattingException
     {
-        initializeFiltering();
-
-        Reader reader  = new BufferedReader(new StringReader(rawContents));
-
-        // support ${token}
-        reader = new InterpolationFilterReader( reader, filterProperties, "${", "}" );
+        try
+        {
+            Reader contentReader = new FileReader( source );
 
-        // support @token@
-        reader = new InterpolationFilterReader( reader, filterProperties, "@", "@" );
+            File target = FileUtils.createTempFile( source.getName() + ".", ".formatted", tempRoot );
 
-        boolean isPropertiesFile = false;
+            AssemblyFileUtils.convertLineEndings( contentReader, target, lineEndingChars );
 
-        if ( source.isFile() && source.getName().endsWith( ".properties" ) )
+            return target;
+        }
+        catch ( FileNotFoundException e )
         {
-            isPropertiesFile = true;
+            throw new AssemblyFormattingException( "File to filter not found: " + e.getMessage(), e );
         }
-
-        reader = new InterpolationFilterReader( reader, new ReflectionProperties( configSource.getProject(), isPropertiesFile ), "${", "}" );
-
-        StringWriter sw = new StringWriter();
-        IOUtil.copy( reader, new BufferedWriter(sw));
-
-        return sw.getBuffer().toString();
-
-
-    }
-
-    private void initializeFiltering()
-        throws AssemblyFormattingException
-    {
-        logger.debug( "Initializing assembly filters..." );
-
-        if ( filterProperties == null )
+        catch ( IOException e )
         {
-            // System properties
-            filterProperties = new Properties( System.getProperties() );
-
-            // Project properties
-            MavenProject project = configSource.getProject();
-            filterProperties.putAll( project.getProperties() );
-
-            List filters = configSource.getFilters();
-
-            if ( ( filters != null ) && !filters.isEmpty() )
-            {
-                for ( Iterator i = filters.iterator(); i.hasNext(); )
-                {
-                    String filtersfile = (String) i.next();
-
-                    try
-                    {
-                        Properties properties = PropertyUtils
-                            .getInterpolatedPropertiesFromFile( new File( filtersfile ), true, true );
-
-                        filterProperties.putAll( properties );
-                    }
-                    catch ( IOException e )
-                    {
-                        throw new AssemblyFormattingException( "Error loading property file '" + filtersfile + "'", e );
-                    }
-                }
-            }
+            throw new AssemblyFormattingException( "Error line formatting file '" + source + "': " + e.getMessage(), e );
         }
     }
-
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java Thu Aug 20 17:51:53 2009
@@ -26,6 +26,8 @@
 /**
  * @author Andreas Hoheneder (ahoh_at_inode.at)
  * @version $Id$
+ *
+ * @depcrecated 
  */
 public class ReflectionProperties
     extends Properties

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java Thu Aug 20 17:51:53 2009
@@ -37,6 +37,7 @@
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 
 import java.io.File;
@@ -212,6 +213,13 @@
     private MavenProjectHelper projectHelper;
     
     /**
+     * Maven shared filtering utility.
+     *
+     * @component
+     */
+    private MavenFileFilter mavenFileFilter;
+
+    /**
      * The Maven Session Object
      *
      * @parameter expression="${session}"
@@ -723,4 +731,8 @@
         return archiverConfig == null ? null : archiverConfig.toString();
     }
 
+    public MavenFileFilter getMavenFileFilter()
+    {
+        return mavenFileFilter;
+    }
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java Thu Aug 20 17:51:53 2009
@@ -33,12 +33,11 @@
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
+import org.codehaus.plexus.PlexusTestCase;
 import org.easymock.MockControl;
 
-import junit.framework.TestCase;
-
 public class FileFormatterTest
-    extends TestCase
+    extends PlexusTestCase
 {
 
     private Logger logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "test" );
@@ -52,7 +51,10 @@
     private MockControl configSourceControl;
 
     public void setUp()
+        throws Exception
     {
+        super.setUp();
+
         configSourceControl = MockControl.createControl( AssemblerConfigurationSource.class );
         mockManager.add( configSourceControl );
 
@@ -155,7 +157,7 @@
     }
 
     public void testShouldFilterProjectExpressionInFile()
-        throws IOException, AssemblyFormattingException
+        throws Exception
     {
         File basedir = fileManager.createTempDir();
 
@@ -167,13 +169,13 @@
 
         File result = new FileFormatter( configSource, logger ).format( file, true, null );
 
-        assertEquals( "This is a test for project: artifact @artifactId@.", fileManager.getFileContents( result ) );
+        assertEquals( "This is a test for project: artifact artifact.", fileManager.getFileContents( result ) );
 
         mockManager.verifyAll();
     }
 
     public void testShouldFilterExpressionInPropertiesFileWithWindowsEscapes()
-      throws IOException, AssemblyFormattingException
+        throws Exception
     {
 
        File sourceDir = fileManager.createTempDir();
@@ -184,7 +186,7 @@
        build.setOutputDirectory( "C:\\out\\deeper" );
        project.setBuild(build);
        
-       enableBasicFilteringConfiguration(project, sourceDir, Collections.EMPTY_LIST);
+       enableBasicFilteringConfiguration( project, sourceDir );
 
        File file = fileManager.createFile(sourceDir, "one.properties", "out=${project.build.outputDirectory}");
 
@@ -199,7 +201,7 @@
    }
 
     public void testShouldFilterExpressionInPropertiesFileWithoutWindowsEscapes()
-      throws IOException, AssemblyFormattingException
+        throws Exception
     {
 
        File sourceDir = fileManager.createTempDir();
@@ -208,7 +210,7 @@
        build.setOutputDirectory( "C:\\out\\deeper" );
        project.setBuild(build);
      
-       enableBasicFilteringConfiguration(project, sourceDir, Collections.EMPTY_LIST);
+       enableBasicFilteringConfiguration( project, sourceDir );
 
        File file = fileManager.createFile(sourceDir, "one.txt", "project.basedirA=${project.build.outputDirectory}");
 
@@ -223,7 +225,7 @@
 
     
     public void testShouldFilterExpressionFromFiltersFileInFile()
-        throws IOException, AssemblyFormattingException
+        throws Exception
     {
         File basedir = fileManager.createTempDir();
 
@@ -243,7 +245,27 @@
     }
     
     public void testShouldFilterExpressionFromFiltersFileInPropertiesFileWithoutWindowsEscapes()
-       throws IOException, AssemblyFormattingException
+        throws Exception
+    {
+       File basedir = fileManager.createTempDir();
+
+       File filterProps = fileManager.createFile( basedir, "filter.properties", "property=C:\\\\Test" );
+
+       enableBasicFilteringConfiguration( basedir, Collections.singletonList( filterProps.getCanonicalPath() ) );
+
+       File file = fileManager.createFile( basedir, "one.properties", "project: ${property} @property@." );
+
+       mockManager.replayAll();
+
+       File result = new FileFormatter( configSource, logger ).format( file, true, null );
+
+       assertEquals( "project: C\\:\\\\Test C\\:\\\\Test.", fileManager.getFileContents( result ) );
+
+       mockManager.verifyAll();
+    }
+
+    public void testShouldFilterExpressionFromFiltersFileInNonPropertiesFileWithoutWindowsEscapes()
+        throws Exception
     {
        File basedir = fileManager.createTempDir();
 
@@ -251,7 +273,7 @@
 
        enableBasicFilteringConfiguration( basedir, Collections.singletonList( filterProps.getCanonicalPath() ) );
 
-       File file = fileManager.createFile( basedir, "one.properties", "This is a test for project: ${property} @property@." );
+       File file = fileManager.createFile( basedir, "one.txt", "This is a test for project: ${property} @property@." );
 
        mockManager.replayAll();
 
@@ -262,8 +284,26 @@
        mockManager.verifyAll();
     }
 
+    public void testShouldNotIgnoreFirstWordInDotNotationExpressions()
+        throws Exception
+    {
+        File basedir = fileManager.createTempDir();
+
+        enableBasicFilteringConfiguration( basedir, Collections.EMPTY_LIST );
+
+        File file = fileManager.createFile( basedir, "one.txt", "testing ${bean.id} which used to resolve to project.id" );
+
+        mockManager.replayAll();
+
+        File result = new FileFormatter( configSource, logger ).format( file, true, null );
+
+        assertEquals( "testing ${bean.id} which used to resolve to project.id", fileManager.getFileContents( result ) );
+
+        mockManager.verifyAll();
+    }
+
     public void testShouldFilterExpressionsFromTwoFiltersFilesInFile()
-        throws IOException, AssemblyFormattingException
+        throws Exception
     {
         File basedir = fileManager.createTempDir();
 
@@ -289,7 +329,7 @@
     }
 
     public void testShouldOverrideOneFilterValueWithAnotherAndFilterFile()
-        throws IOException, AssemblyFormattingException
+        throws Exception
     {
         File basedir = fileManager.createTempDir();
 
@@ -314,7 +354,7 @@
     }
 
     public void testShouldOverrideProjectValueWithFilterValueAndFilterFile()
-        throws IOException, AssemblyFormattingException
+        throws Exception
     {
         File basedir = fileManager.createTempDir();
 
@@ -345,24 +385,29 @@
         return new MavenProject( model );
     }
     
-    private void enableBasicFilteringConfiguration(MavenProject project, File basedir, List filterFilenames)
+    private void enableBasicFilteringConfiguration( MavenProject project, File basedir )
+        throws Exception
     {
-       configSource.getTemporaryRootDirectory();
-       configSourceControl.setReturnValue( basedir );
+      configSource.getTemporaryRootDirectory();
+      configSourceControl.setReturnValue( basedir );
 
-       configSource.getProject();
-       configSourceControl.setReturnValue( project, MockControl.ONE_OR_MORE );
+      configSource.getProject();
+      configSourceControl.setReturnValue( project, MockControl.ONE_OR_MORE );
 
-       // list of filenames that contain filter definitions.
-       configSource.getFilters();
-       configSourceControl.setReturnValue( filterFilenames );
-      
+      configSource.getMavenFileFilter();
+      configSourceControl.setReturnValue( lookup( "org.apache.maven.shared.filtering.MavenFileFilter" ) );
+
+      configSource.getMavenSession();
+      configSourceControl.setReturnValue( null );
     }
     
     private void enableBasicFilteringConfiguration( File basedir, List filterFilenames )
+        throws Exception
     {
         MavenProject project = createBasicMavenProject();
-        enableBasicFilteringConfiguration( project, basedir, filterFilenames );
+        project.getBuild().setFilters( filterFilenames );
+
+        enableBasicFilteringConfiguration( project, basedir );
     }
 
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileSetFormatterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileSetFormatterTest.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileSetFormatterTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/format/FileSetFormatterTest.java Thu Aug 20 17:51:53 2009
@@ -30,6 +30,7 @@
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.PlexusTestCase;
 import org.easymock.MockControl;
 
 import java.io.File;
@@ -38,7 +39,7 @@
 import java.util.List;
 
 public class FileSetFormatterTest
-    extends TestCase
+    extends PlexusTestCase
 {
 
     private MockManager mockManager;
@@ -52,7 +53,10 @@
     private MockControl configSourceControl;
 
     public void setUp()
+        throws Exception
     {
+        super.setUp();
+
         mockManager = new MockManager();
 
         fileManager = new TestFileManager( "fileSetFormatter-test.", "" );
@@ -253,7 +257,7 @@
     }
 
     public void testShouldFilterSeveralFiles()
-        throws IOException, AssemblyFormattingException
+        throws Exception
     {
         File basedir = fileManager.createTempDir();
 
@@ -294,6 +298,7 @@
     }
 
     private void enableBasicFilteringConfiguration( File basedir, List filterFilenames )
+        throws Exception
     {
         configSource.getTemporaryRootDirectory();
         configSourceControl.setReturnValue( basedir );
@@ -304,13 +309,16 @@
         model.setVersion( "version" );
 
         MavenProject project = new MavenProject( model );
+        project.getBuild().setFilters( filterFilenames );
 
         configSource.getProject();
         configSourceControl.setReturnValue( project, MockControl.ONE_OR_MORE );
 
-        // list of filenames that contain filter definitions.
-        configSource.getFilters();
-        configSourceControl.setReturnValue( filterFilenames );
+        configSource.getMavenFileFilter();
+        configSourceControl.setReturnValue( lookup( "org.apache.maven.shared.filtering.MavenFileFilter" ), MockControl.ONE_OR_MORE );
+
+        configSource.getMavenSession();
+        configSourceControl.setReturnValue( null, MockControl.ONE_OR_MORE );
     }
 
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java?rev=806277&r1=806276&r2=806277&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java Thu Aug 20 17:51:53 2009
@@ -8,6 +8,7 @@
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 
 public class ConfigSourceStub
     implements AssemblerConfigurationSource
@@ -156,6 +157,10 @@
         return archiverConfig;
     }
 
+    public MavenFileFilter getMavenFileFilter() {
+        return null;
+    }
+
     public void setProject( MavenProject mavenProject )
     {
         this.project = mavenProject;