You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2014/10/23 23:01:38 UTC

svn commit: r1633948 [20/21] - in /maven/plugins/branches/MASSEMBLY-704: ./ integration-test-archetype/ integration-test-archetype/src/main/resources/META-INF/maven/ integration-test-archetype/src/main/resources/archetype-resources/ integration-test-ar...

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java Thu Oct 23 21:01:23 2014
@@ -24,92 +24,70 @@ import java.util.List;
 
 import junit.framework.Assert;
 
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
-import org.easymock.MockControl;
+import org.easymock.EasyMock;
+import org.easymock.classextension.EasyMockSupport;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
 
 public class MockAndControlForAddDependencySetsTask
 {
 
-    public Archiver archiver;
-
-    public MockControl archiverCtl;
-
-    public AssemblerConfigurationSource configSource;
-
-    public MockControl configSourceCtl;
+    public final Archiver archiver;
 
-    public MockControl dependencyResolverCtl;
+    public final AssemblerConfigurationSource configSource;
 
-    public MavenProjectBuilder projectBuilder;
+    public final MavenProjectBuilder projectBuilder;
 
-    public MockControl archiverManagerCtl;
-
-    public ArchiverManager archiverManager;
-
-    public MockControl projectBuilderCtl;
+    public final ArchiverManager archiverManager;
 
     private final MavenProject project;
 
-    public MockAndControlForAddDependencySetsTask( final MockManager mockManager )
+    public MockAndControlForAddDependencySetsTask( final EasyMockSupport mockManager )
     {
         this( mockManager, null );
     }
 
-    public MockAndControlForAddDependencySetsTask( final MockManager mockManager, final MavenProject project )
+    public MockAndControlForAddDependencySetsTask( final EasyMockSupport mockManager, final MavenProject project )
     {
         this.project = project;
 
-        archiverCtl = MockControl.createControl( Archiver.class );
-        mockManager.add( archiverCtl );
-
-        archiver = (Archiver) archiverCtl.getMock();
+        archiver = mockManager.createMock(Archiver.class);
+        configSource = mockManager.createMock (AssemblerConfigurationSource.class);
 
-        configSourceCtl = MockControl.createControl( AssemblerConfigurationSource.class );
-        mockManager.add( configSourceCtl );
 
-        configSource = (AssemblerConfigurationSource) configSourceCtl.getMock();
+        projectBuilder = mockManager.createMock(MavenProjectBuilder.class);
 
-        projectBuilderCtl = MockControl.createControl( MavenProjectBuilder.class );
-        mockManager.add( projectBuilderCtl );
-
-        projectBuilder = (MavenProjectBuilder) projectBuilderCtl.getMock();
-
-        archiverManagerCtl = MockControl.createControl( ArchiverManager.class );
-        mockManager.add( archiverManagerCtl );
-
-        archiverManager = (ArchiverManager) archiverManagerCtl.getMock();
+        archiverManager = mockManager.createMock(ArchiverManager.class);
 
         enableDefaultExpectations();
     }
 
     private void enableDefaultExpectations()
     {
-        configSource.getProject();
-        configSourceCtl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect(configSource.getProject()).andReturn( project ).anyTimes();
     }
 
-    public void expectAddArchivedFileSet( final File file, final String outputLocation, final String[] includes,
-                                          final String[] excludes )
+    public void expectAddArchivedFileSet()
     {
         try
         {
-            archiver.addArchivedFileSet( file, outputLocation, includes, excludes );
+            archiver.addArchivedFileSet( (File)anyObject(), (String)anyObject(), (String[])anyObject(), (String[])anyObject() );
 
-            if ( ( includes != null ) || ( excludes != null ) )
-            {
-                archiverCtl.setMatcher( MockControl.ARRAY_MATCHER );
-            }
+                archiver.addArchivedFileSet( (File) anyObject(), (String) anyObject(), (String[]) anyObject(),
+                                             (String[]) anyObject() );
+            EasyMock.expectLastCall().anyTimes();
 
-            archiverCtl.setVoidCallable( MockControl.ONE_OR_MORE );
         }
         catch ( final ArchiverException e )
         {
@@ -120,11 +98,8 @@ public class MockAndControlForAddDepende
     public void expectModeChange( final int originalDirMode, final int originalFileMode, final int dirMode,
                                   final int fileMode, final int numberOfChanges )
     {
-        archiver.getOverrideDirectoryMode();
-        archiverCtl.setReturnValue( originalDirMode );
-
-        archiver.getOverrideFileMode();
-        archiverCtl.setReturnValue( originalFileMode );
+        expect( archiver.getOverrideDirectoryMode()).andReturn( originalDirMode );
+        expect(archiver.getOverrideFileMode()).andReturn( originalFileMode );
 
         // one of the changes will occur below, when we restore the original mode.
         if ( numberOfChanges > 1 )
@@ -166,38 +141,32 @@ public class MockAndControlForAddDepende
 
     public void expectGetReactorProjects( final List<MavenProject> projects )
     {
-        configSource.getReactorProjects();
-        configSourceCtl.setReturnValue( projects, MockControl.ONE_OR_MORE );
+        expect(configSource.getReactorProjects()).andReturn( projects ).anyTimes();
     }
 
     public void expectCSGetFinalName( final String finalName )
     {
-        configSource.getFinalName();
-        configSourceCtl.setReturnValue( finalName, MockControl.ONE_OR_MORE );
+        expect(configSource.getFinalName()).andReturn( finalName ).anyTimes();
     }
 
     public void expectGetDestFile( final File destFile )
     {
-        archiver.getDestFile();
-        archiverCtl.setReturnValue( destFile, MockControl.ZERO_OR_MORE );
+        expect(archiver.getDestFile()).andReturn( destFile ).anyTimes();
     }
 
     public void expectCSGetRepositories( final ArtifactRepository localRepo, final List<ArtifactRepository> remoteRepos )
     {
-        configSource.getLocalRepository();
-        configSourceCtl.setReturnValue( localRepo, MockControl.ONE_OR_MORE );
-
-        configSource.getRemoteRepositories();
-        configSourceCtl.setReturnValue( remoteRepos, MockControl.ONE_OR_MORE );
+        expect(configSource.getLocalRepository()).andReturn( localRepo ).anyTimes();
+        expect(configSource.getRemoteRepositories()).andReturn( remoteRepos ).anyTimes();
     }
 
     public void expectBuildFromRepository( final ProjectBuildingException error )
     {
         try
         {
-            projectBuilder.buildFromRepository( null, null, null );
-            projectBuilderCtl.setMatcher( MockControl.ALWAYS_MATCHER );
-            projectBuilderCtl.setThrowable( error, MockControl.ONE_OR_MORE );
+            expect(projectBuilder.buildFromRepository( (Artifact) anyObject(), (List) anyObject(),
+                                                (ArtifactRepository) anyObject() )).andThrow( error );
+//            projectBuilderCtl.setThrowable( error, MockControl.ONE_OR_MORE );
         }
         catch ( final ProjectBuildingException e )
         {
@@ -209,9 +178,7 @@ public class MockAndControlForAddDepende
     {
         try
         {
-            projectBuilder.buildFromRepository( null, null, null );
-            projectBuilderCtl.setMatcher( MockControl.ALWAYS_MATCHER );
-            projectBuilderCtl.setReturnValue( project, MockControl.ONE_OR_MORE );
+            expect(projectBuilder.buildFromRepository( ( Artifact) anyObject(), (List)anyObject(), (ArtifactRepository)anyObject() )).andReturn( project ).anyTimes();
         }
         catch ( final ProjectBuildingException e )
         {
@@ -221,8 +188,7 @@ public class MockAndControlForAddDepende
 
     public void expectGetSession( final MavenSession session )
     {
-        configSource.getMavenSession();
-        configSourceCtl.setReturnValue( session, MockControl.ZERO_OR_MORE );
+        expect(configSource.getMavenSession()).andReturn( session ).anyTimes();
     }
 
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java Thu Oct 23 21:01:23 2014
@@ -19,73 +19,50 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import java.io.File;
-
 import junit.framework.Assert;
-
-import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.plugin.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
-import org.easymock.MockControl;
+import org.codehaus.plexus.archiver.FileSet;
+import org.easymock.EasyMock;
+import org.easymock.classextension.EasyMockSupport;
+
+import java.io.File;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
 
 public class MockAndControlForAddFileSetsTask
 {
 
-    public AssemblerConfigurationSource configSource;
+    public final AssemblerConfigurationSource configSource;
 
-    public MockControl configSourceCtl;
 
     public Archiver archiver;
 
-    public MockControl archiverCtl;
-
-    public TestFileManager fileManager;
-
     public File archiveBaseDir;
 
-    public MockAndControlForAddFileSetsTask( MockManager mockManager, TestFileManager fileManager )
+    public MockAndControlForAddFileSetsTask( EasyMockSupport mockManager, TestFileManager fileManager )
     {
-        this.fileManager = fileManager;
-
-        configSourceCtl = MockControl.createControl( AssemblerConfigurationSource.class );
-        mockManager.add( configSourceCtl );
-
-        configSource = (AssemblerConfigurationSource) configSourceCtl.getMock();
-
-        archiverCtl = MockControl.createControl( Archiver.class );
-        mockManager.add( archiverCtl );
-
-        archiver = (Archiver) archiverCtl.getMock();
-
+        configSource = mockManager.createMock (AssemblerConfigurationSource.class);
+        archiver = mockManager.createMock (Archiver.class);
         archiveBaseDir = fileManager.createTempDir();
 
-        configSource.getMavenSession();
-        configSourceCtl.setReturnValue( null, MockControl.ZERO_OR_MORE );
+        expect(configSource.getMavenSession()).andReturn( null).anyTimes();
     }
 
     public void expectGetArchiveBaseDirectory()
     {
-        configSource.getArchiveBaseDirectory();
-        configSourceCtl.setReturnValue( archiveBaseDir, MockControl.ONE_OR_MORE );
-    }
-
-    public void expectGetBasedir( File basedir )
-    {
-        configSource.getBasedir();
-        configSourceCtl.setReturnValue( basedir, MockControl.ONE_OR_MORE );
+        expect(configSource.getArchiveBaseDirectory()).andReturn( archiveBaseDir ).anyTimes();
     }
 
-    public void expectModeChanges( int[] modes, int modeChangeCount )
+    void expectModeChanges( int[] modes, int modeChangeCount )
     {
-        archiver.getOverrideDirectoryMode();
-        archiverCtl.setReturnValue( modes[0] );
+        expect(archiver.getOverrideDirectoryMode()).andReturn( modes[0] );
+        expect(archiver.getOverrideFileMode()).andReturn( modes[1] );
 
-        archiver.getOverrideFileMode();
-        archiverCtl.setReturnValue( modes[1] );
 
         if ( modeChangeCount > 1 )
         {
@@ -114,37 +91,30 @@ public class MockAndControlForAddFileSet
         }
     }
 
-    public void expectAdditionOfSingleFileSet( MavenProject project, File basedir, String finalName,
-                                               boolean shouldAddDir, int[] modes, int modeChangeCount,
+    public void expectAdditionOfSingleFileSet( MavenProject project, String finalName, boolean shouldAddDir, int[] modes, int modeChangeCount,
                                                boolean isDebugEnabled )
     {
-        expectAdditionOfSingleFileSet( project, basedir, finalName, shouldAddDir, modes, modeChangeCount,
+        expectAdditionOfSingleFileSet( project, finalName, shouldAddDir, modes, modeChangeCount,
                                        isDebugEnabled, true );
 
     }
 
-    public void expectAdditionOfSingleFileSet( MavenProject project, File basedir, String finalName,
-                                               boolean shouldAddDir, int[] modes, int modeChangeCount,
+    public void expectAdditionOfSingleFileSet( MavenProject project, String finalName, boolean shouldAddDir, int[] modes, int modeChangeCount,
                                                boolean isDebugEnabled, boolean isProjectUsed )
     {
         // the logger sends a debug message with this info inside the addFileSet(..) method..
         if ( isDebugEnabled )
         {
-            archiver.getOverrideDirectoryMode();
-            archiverCtl.setReturnValue( modes[0] );
-
-            archiver.getOverrideFileMode();
-            archiverCtl.setReturnValue( modes[1] );
+            expect(archiver.getOverrideDirectoryMode()).andReturn( modes[0] );
+            expect(archiver.getOverrideFileMode()).andReturn( modes[1] );
         }
 
         if ( isProjectUsed )
         {
-            configSource.getProject();
-            configSourceCtl.setReturnValue( project, MockControl.ONE_OR_MORE );
+            expect(configSource.getProject()).andReturn( project ).atLeastOnce();
         }
 
-        configSource.getFinalName();
-        configSourceCtl.setReturnValue( finalName, MockControl.ONE_OR_MORE );
+        expect( configSource.getFinalName()).andReturn( finalName ).atLeastOnce();
 
         if ( shouldAddDir )
         {
@@ -152,9 +122,8 @@ public class MockAndControlForAddFileSet
 
             try
             {
-                archiver.addFileSet( null );
-                archiverCtl.setMatcher( MockControl.ALWAYS_MATCHER );
-                archiverCtl.setVoidCallable( MockControl.ONE_OR_MORE );
+                archiver.addFileSet( (FileSet) anyObject() );
+                EasyMock.expectLastCall().atLeastOnce();
             }
             catch ( ArchiverException e )
             {
@@ -166,20 +135,12 @@ public class MockAndControlForAddFileSet
 
     public void expectGetProject( MavenProject project )
     {
-        configSource.getProject();
-        configSourceCtl.setReturnValue( project, MockControl.ONE_OR_MORE );
-    }
-
-    public void expectGetSession( MavenSession session )
-    {
-        configSource.getMavenSession();
-        configSourceCtl.setReturnValue( session, MockControl.ONE_OR_MORE );
+        expect(configSource.getProject()).andReturn( project ).atLeastOnce();
     }
 
     public void expectGetFinalName( String finalName )
     {
-        configSource.getFinalName();
-        configSourceCtl.setReturnValue( finalName, MockControl.ONE_OR_MORE );
+        expect( configSource.getFinalName()).andReturn( finalName ).atLeastOnce();
     }
 
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolverTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolverTest.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolverTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolverTest.java Thu Oct 23 21:01:23 2014
@@ -19,19 +19,12 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
@@ -40,12 +33,20 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.plugin.assembly.model.ModuleBinaries;
 import org.apache.maven.plugin.assembly.model.ModuleSet;
 import org.apache.maven.plugin.assembly.model.Repository;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
+import org.apache.maven.plugin.assembly.resolved.AssemblyId;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.easymock.MockControl;
+import org.easymock.classextension.EasyMockSupport;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static org.easymock.EasyMock.expect;
 
 public class DefaultDependencyResolverTest
     extends PlexusTestCase
@@ -61,8 +62,6 @@ public class DefaultDependencyResolverTe
 
     private ArtifactMetadataSource metadataSource;
 
-    private ArtifactCollector collector;
-
     private ConsoleLogger logger;
 
     @Override
@@ -76,7 +75,6 @@ public class DefaultDependencyResolverTe
         factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
         repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
         layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
-        collector = (ArtifactCollector) lookup( ArtifactCollector.class.getName() );
         logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "test" );
     }
 
@@ -101,10 +99,11 @@ public class DefaultDependencyResolverTe
 
         final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
 
-        new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).getDependencySetResolutionRequirements( new Assembly(),
-                                                                                                                                      depSets,
-                                                                                                                                      info,
-                                                                                                                                      project );
+        final Assembly assembly = new Assembly();
+        new DefaultDependencyResolver( resolver, metadataSource, factory, logger ).updateDependencySetResolutionRequirements(
+            depSets,
+                info, AssemblyId.createAssemblyId( assembly),
+                project);
 
         assertTrue( info.isResolutionRequired() );
         assertFalse( info.isResolvedTransitively() );
@@ -121,12 +120,9 @@ public class DefaultDependencyResolverTe
     public void test_getModuleSetResolutionRequirements()
         throws DependencyResolutionException
     {
-        final MockManager mm = new MockManager();
-
-        final MockControl csControl = MockControl.createControl( AssemblerConfigurationSource.class );
-        mm.add( csControl );
+        final EasyMockSupport mm = new EasyMockSupport();
 
-        final AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csControl.getMock();
+        final AssemblerConfigurationSource cs = mm.createMock( AssemblerConfigurationSource.class );
 
         final File rootDir = new File( "root" );
         final MavenProject project = createMavenProject( "main-group", "main-artifact", "1", rootDir );
@@ -159,11 +155,9 @@ public class DefaultDependencyResolverTe
         allProjects.add( module2 );
         allProjects.add( module2a );
 
-        cs.getReactorProjects();
-        csControl.setReturnValue( allProjects, MockControl.ZERO_OR_MORE );
+        expect( cs.getReactorProjects()).andReturn( allProjects ).anyTimes();
 
-        cs.getProject();
-        csControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect( cs.getProject()).andReturn( project ).anyTimes();
 
         final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
 
@@ -202,13 +196,13 @@ public class DefaultDependencyResolverTe
         mm.replayAll();
 
         final DefaultDependencyResolver resolver =
-            new DefaultDependencyResolver( this.resolver, metadataSource, factory, collector, logger );
+            new DefaultDependencyResolver( this.resolver, metadataSource, factory, logger );
         resolver.enableLogging( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
 
         final Assembly assembly = new Assembly();
         assembly.setModuleSets( moduleSets );
 
-        resolver.getModuleSetResolutionRequirements( assembly, info, cs );
+        resolver.updateModuleSetResolutionRequirements(assembly, info, cs);
 
         assertTrue( info.isResolutionRequired() );
 
@@ -257,9 +251,9 @@ public class DefaultDependencyResolverTe
         assembly.setRepositories( repositories );
 
         final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
-        new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).getRepositoryResolutionRequirements( assembly,
-                                                                                                                                   info,
-                                                                                                                                   project );
+        new DefaultDependencyResolver( resolver, metadataSource, factory, logger ).updateRepositoryResolutionRequirements(assembly,
+                info
+        );
 
         assertTrue( info.isResolutionRequired() );
 
@@ -298,7 +292,7 @@ public class DefaultDependencyResolverTe
         project.setRemoteArtifactRepositories( projectRepos );
 
         final List<ArtifactRepository> aggregated =
-            new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).aggregateRemoteArtifactRepositories( externalRepos,
+            new DefaultDependencyResolver( resolver, metadataSource, factory, logger ).aggregateRemoteArtifactRepositories( externalRepos,
                                                                                                                                        Collections.singleton( project ) );
 
         assertRepositoryWithId( er1.getId(), aggregated, true );

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilterTest.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilterTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilterTest.java Thu Oct 23 21:01:23 2014
@@ -57,6 +57,8 @@ import org.jdom.Text;
 import org.jdom.input.SAXBuilder;
 import org.jdom.xpath.XPath;
 
+import javax.annotation.Nonnull;
+
 public class ComponentsXmlArchiverFileFilterTest
     extends TestCase
 {
@@ -80,8 +82,8 @@ public class ComponentsXmlArchiverFileFi
     public void testAddComponentsXml_ShouldAddComponentWithoutRoleHint()
         throws IOException, XmlPullParserException
     {
-        final Reader reader =
-            writeComponentsXml( Collections.singletonList( new ComponentDef( "role", null, "org.apache.maven.Impl" ) ) );
+        final Reader reader = writeComponentsXml(
+            Collections.singletonList( new ComponentDef( "role", null, "org.apache.maven.Impl" ) ) );
 
         filter.addComponentsXml( reader );
 
@@ -89,18 +91,16 @@ public class ComponentsXmlArchiverFileFi
 
         final Xpp3Dom componentDom = filter.components.get( "role" );
 
-        assertEquals( "role", componentDom.getChild( "role" )
-                                          .getValue() );
+        assertEquals( "role", componentDom.getChild( "role" ).getValue() );
         assertNull( componentDom.getChild( "role-hint" ) );
-        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" )
-                                                           .getValue() );
+        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" ).getValue() );
     }
 
     public void testAddComponentsXml_ShouldAddComponentWithRoleHint()
         throws IOException, XmlPullParserException
     {
-        final Reader reader =
-            writeComponentsXml( Collections.singletonList( new ComponentDef( "role", "hint", "org.apache.maven.Impl" ) ) );
+        final Reader reader = writeComponentsXml(
+            Collections.singletonList( new ComponentDef( "role", "hint", "org.apache.maven.Impl" ) ) );
 
         filter.addComponentsXml( reader );
 
@@ -108,12 +108,9 @@ public class ComponentsXmlArchiverFileFi
 
         final Xpp3Dom componentDom = filter.components.get( "rolehint" );
 
-        assertEquals( "role", componentDom.getChild( "role" )
-                                          .getValue() );
-        assertEquals( "hint", componentDom.getChild( "role-hint" )
-                                          .getValue() );
-        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" )
-                                                           .getValue() );
+        assertEquals( "role", componentDom.getChild( "role" ).getValue() );
+        assertEquals( "hint", componentDom.getChild( "role-hint" ).getValue() );
+        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" ).getValue() );
     }
 
     public void testAddComponentsXml_ShouldAddTwoComponentsWithRoleHints()
@@ -132,21 +129,15 @@ public class ComponentsXmlArchiverFileFi
 
         Xpp3Dom componentDom = filter.components.get( "rolehint" );
 
-        assertEquals( "role", componentDom.getChild( "role" )
-                                          .getValue() );
-        assertEquals( "hint", componentDom.getChild( "role-hint" )
-                                          .getValue() );
-        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" )
-                                                           .getValue() );
+        assertEquals( "role", componentDom.getChild( "role" ).getValue() );
+        assertEquals( "hint", componentDom.getChild( "role-hint" ).getValue() );
+        assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" ).getValue() );
 
         componentDom = filter.components.get( "rolehint2" );
 
-        assertEquals( "role", componentDom.getChild( "role" )
-                                          .getValue() );
-        assertEquals( "hint2", componentDom.getChild( "role-hint" )
-                                           .getValue() );
-        assertEquals( "org.apache.maven.Impl2", componentDom.getChild( "implementation" )
-                                                            .getValue() );
+        assertEquals( "role", componentDom.getChild( "role" ).getValue() );
+        assertEquals( "hint2", componentDom.getChild( "role-hint" ).getValue() );
+        assertEquals( "org.apache.maven.Impl2", componentDom.getChild( "implementation" ).getValue() );
     }
 
     public void testAddToArchive_ShouldWriteComponentWithoutHintToFile()
@@ -366,11 +357,11 @@ public class ComponentsXmlArchiverFileFi
 
     private static final class ComponentDef
     {
-        String role;
+        final String role;
 
-        String roleHint;
+        final String roleHint;
 
-        String implementation;
+        final String implementation;
 
         ComponentDef( final String role, final String roleHint, final String implementation )
         {
@@ -393,32 +384,32 @@ public class ComponentsXmlArchiverFileFi
 
         private boolean ignorePermissions;
 
-        public void addDirectory( final File directory )
+        public void addDirectory( final @Nonnull File directory )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addDirectory( final File directory, final String prefix )
+        public void addDirectory( final @Nonnull File directory, final String prefix )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addDirectory( final File directory, final String[] includes, final String[] excludes )
+        public void addDirectory( final @Nonnull File directory, final String[] includes, final String[] excludes )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addDirectory( final File directory, final String prefix, final String[] includes,
+        public void addDirectory( final @Nonnull File directory, final String prefix, final String[] includes,
                                   final String[] excludes )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addFile( final File inputFile, final String destFileName )
+        public void addFile( final @Nonnull File inputFile, final @Nonnull String destFileName )
             throws ArchiverException
         {
             this.inputFile = inputFile;
@@ -435,7 +426,7 @@ public class ComponentsXmlArchiverFileFi
             return destFileName;
         }
 
-        public void addFile( final File inputFile, final String destFileName, final int permissions )
+        public void addFile( final @Nonnull File inputFile, final @Nonnull String destFileName, final int permissions )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
@@ -462,8 +453,20 @@ public class ComponentsXmlArchiverFileFi
             throw new UnsupportedOperationException( "not supported" );
         }
 
+        public void addSymlink( String s, String s2 )
+            throws ArchiverException
+        {
+            throw new UnsupportedOperationException( "not supported" );
+        }
+
+        public void addSymlink( String s, int i, String s2 )
+            throws ArchiverException
+        {
+            throw new UnsupportedOperationException( "not supported" );
+        }
+
         @SuppressWarnings( "rawtypes" )
-        public Map getFiles()
+        public Map<String, ArchiveEntry> getFiles()
         {
             throw new UnsupportedOperationException( "not supported" );
         }
@@ -493,13 +496,13 @@ public class ComponentsXmlArchiverFileFi
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addArchivedFileSet( final File archiveFile )
+        public void addArchivedFileSet( final @Nonnull File archiveFile )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addArchivedFileSet( final File archiveFile, final String prefix )
+        public void addArchivedFileSet( final @Nonnull File archiveFile, final String prefix )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
@@ -511,7 +514,7 @@ public class ComponentsXmlArchiverFileFi
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addArchivedFileSet( final File archiveFile, final String prefix, final String[] includes,
+        public void addArchivedFileSet( final @Nonnull File archiveFile, final String prefix, final String[] includes,
                                         final String[] excludes )
             throws ArchiverException
         {
@@ -543,7 +546,7 @@ public class ComponentsXmlArchiverFileFi
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public void addFileSet( final FileSet fileSet )
+        public void addFileSet( final @Nonnull FileSet fileSet )
             throws ArchiverException
         {
             throw new UnsupportedOperationException( "not supported" );
@@ -561,7 +564,9 @@ public class ComponentsXmlArchiverFileFi
             throw new UnsupportedOperationException( "not supported" );
         }
 
-        public ResourceIterator getResources()
+        public
+        @Nonnull
+        ResourceIterator getResources()
             throws ArchiverException
         {
             return new ResourceIterator()

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/format/FileFormatterTest.java Thu Oct 23 21:01:23 2014
@@ -19,22 +19,25 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.plugin.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.easymock.MockControl;
+import org.easymock.classextension.EasyMockSupport;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static org.easymock.EasyMock.expect;
 
 public class FileFormatterTest
     extends PlexusTestCase
@@ -44,35 +47,33 @@ public class FileFormatterTest
 
     private final TestFileManager fileManager = new TestFileManager( "fileFormatterTest.", "" );
 
-    private final MockManager mockManager = new MockManager();
+    private final EasyMockSupport mockManager = new EasyMockSupport();
 
     private AssemblerConfigurationSource configSource;
 
-    private MockControl configSourceControl;
 
     @Override
-    public void setUp() throws Exception
+    public void setUp()
+        throws Exception
     {
         super.setUp();
 
-        configSourceControl = MockControl.createControl( AssemblerConfigurationSource.class );
-        mockManager.add( configSourceControl );
-
-        configSource = (AssemblerConfigurationSource) configSourceControl.getMock();
+        configSource = mockManager.createMock(AssemblerConfigurationSource.class);
     }
 
     @Override
-    public void tearDown() throws IOException
+    public void tearDown()
+        throws IOException
     {
         fileManager.cleanUp();
     }
 
-    public void testTemporaryRootDirectoryNotExist() throws IOException, AssemblyFormattingException
+    public void testTemporaryRootDirectoryNotExist()
+        throws IOException, AssemblyFormattingException
     {
         final File basedir = fileManager.createTempDir();
         final File tempRoot = new File( basedir, "tempdir" );
-        configSource.getTemporaryRootDirectory();
-        configSourceControl.setReturnValue( tempRoot );
+        expect( configSource.getTemporaryRootDirectory()).andReturn( tempRoot );
 
         final File file = fileManager.createFile( basedir, "one.txt", "This is a\ntest." );
 
@@ -85,12 +86,12 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldNotTransformOneFile() throws IOException, AssemblyFormattingException
+    public void testShouldNotTransformOneFile()
+        throws IOException, AssemblyFormattingException
     {
         final File basedir = fileManager.createTempDir();
 
-        configSource.getTemporaryRootDirectory();
-        configSourceControl.setReturnValue( basedir );
+        expect( configSource.getTemporaryRootDirectory()).andReturn( basedir );
 
         // Model model = new Model();
         // model.setArtifactId( "artifact" );
@@ -113,12 +114,12 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldConvertCRLFLineEndingsInFile() throws IOException, AssemblyFormattingException
+    public void testShouldConvertCRLFLineEndingsInFile()
+        throws IOException, AssemblyFormattingException
     {
         final File basedir = fileManager.createTempDir();
 
-        configSource.getTemporaryRootDirectory();
-        configSourceControl.setReturnValue( basedir );
+        expect( configSource.getTemporaryRootDirectory()).andReturn( basedir );
 
         final File file = fileManager.createFile( basedir, "one.txt", "This is a\ntest." );
 
@@ -131,12 +132,12 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldConvertLFLineEndingsInFile() throws IOException, AssemblyFormattingException
+    public void testShouldConvertLFLineEndingsInFile()
+        throws IOException, AssemblyFormattingException
     {
         final File basedir = fileManager.createTempDir();
 
-        configSource.getTemporaryRootDirectory();
-        configSourceControl.setReturnValue( basedir );
+        expect( configSource.getTemporaryRootDirectory()).andReturn( basedir );
 
         final File file = fileManager.createFile( basedir, "one.txt", "This is a\r\ntest." );
 
@@ -149,7 +150,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterProjectExpressionInFile() throws Exception
+    public void testShouldFilterProjectExpressionInFile()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -167,7 +169,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterExpressionInPropertiesFileWithWindowsEscapes() throws Exception
+    public void testShouldFilterExpressionInPropertiesFileWithWindowsEscapes()
+        throws Exception
     {
 
         final File sourceDir = fileManager.createTempDir();
@@ -178,7 +181,7 @@ public class FileFormatterTest
         build.setOutputDirectory( "C:\\out\\deeper" );
         project.setBuild( build );
 
-        enableBasicFilteringConfiguration( project, sourceDir );
+        enableBasicFilteringConfiguration( project, sourceDir, null );
 
         final File file = fileManager.createFile( sourceDir, "one.properties", "out=${project.build.outputDirectory}" );
 
@@ -192,7 +195,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterExpressionInPropertiesFileWithoutWindowsEscapes() throws Exception
+    public void testShouldFilterExpressionInPropertiesFileWithoutWindowsEscapes()
+        throws Exception
     {
 
         final File sourceDir = fileManager.createTempDir();
@@ -201,7 +205,7 @@ public class FileFormatterTest
         build.setOutputDirectory( "C:\\out\\deeper" );
         project.setBuild( build );
 
-        enableBasicFilteringConfiguration( project, sourceDir );
+        enableBasicFilteringConfiguration( project, sourceDir, null );
 
         final File file =
             fileManager.createFile( sourceDir, "one.txt", "project.basedirA=${project.build.outputDirectory}" );
@@ -215,7 +219,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterExpressionFromFiltersFileInFile() throws Exception
+    public void testShouldFilterExpressionFromFiltersFileInFile()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -235,7 +240,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterExpressionFromFiltersFileInPropertiesFileWithoutWindowsEscapes() throws Exception
+    public void testShouldFilterExpressionFromFiltersFileInPropertiesFileWithoutWindowsEscapes()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -254,7 +260,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterExpressionFromFiltersFileInNonPropertiesFileWithoutWindowsEscapes() throws Exception
+    public void testShouldFilterExpressionFromFiltersFileInNonPropertiesFileWithoutWindowsEscapes()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -274,7 +281,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldNotIgnoreFirstWordInDotNotationExpressions() throws Exception
+    public void testShouldNotIgnoreFirstWordInDotNotationExpressions()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -292,7 +300,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldFilterExpressionsFromTwoFiltersFilesInFile() throws Exception
+    public void testShouldFilterExpressionsFromTwoFiltersFilesInFile()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -318,7 +327,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldOverrideOneFilterValueWithAnotherAndFilterFile() throws Exception
+    public void testShouldOverrideOneFilterValueWithAnotherAndFilterFile()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -342,7 +352,8 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
-    public void testShouldOverrideProjectValueWithFilterValueAndFilterFile() throws Exception
+    public void testShouldOverrideProjectValueWithFilterValueAndFilterFile()
+        throws Exception
     {
         final File basedir = fileManager.createTempDir();
 
@@ -365,6 +376,121 @@ public class FileFormatterTest
         mockManager.verifyAll();
     }
 
+    public void testShouldCombineProjectValueWithFilterValueAndFilterFile()
+        throws Exception
+    {
+        final File basedir = fileManager.createTempDir();
+
+        final File buildFilterProps =
+            fileManager.createFile( basedir, "build-filter.properties", "common=build\r\nbuild.test=build\r\n" );
+        final File configFilterProps =
+            fileManager.createFile( basedir, "config-filter.properties", "common=config\r\nconfig.test=config\r\n" );
+
+        final List<String> buildFilters = new ArrayList<String>();
+        buildFilters.add( buildFilterProps.getCanonicalPath() );
+
+        final List<String> configFilters = new ArrayList<String>();
+        configFilters.add( configFilterProps.getCanonicalPath() );
+
+        enableFilteringConfiguration( basedir, buildFilters, configFilters, true );
+
+        final File file =
+            fileManager.createFile( basedir, "one.txt",
+                                    "filtered common=${common} build.test=${build.test} config.test=${config.test}." );
+
+        mockManager.replayAll();
+
+        final File result = new FileFormatter( configSource, logger ).format( file, true, null, "UTF-8" );
+
+        assertEquals( "filtered common=build build.test=build config.test=config.",
+                      fileManager.getFileContents( result ) );
+
+        mockManager.verifyAll();
+    }
+
+    public void testShouldIgnoreProjectValueWithFilterValueAndFilterFile()
+        throws Exception
+    {
+        final File basedir = fileManager.createTempDir();
+
+        final File buildFilterProps =
+            fileManager.createFile( basedir, "build-filter.properties", "common=build\r\nbuild.test=build\r\n" );
+        final File configFilterProps =
+            fileManager.createFile( basedir, "config-filter.properties", "common=config\r\nconfig.test=config\r\n" );
+
+        final List<String> buildFilters = new ArrayList<String>();
+        buildFilters.add( buildFilterProps.getCanonicalPath() );
+
+        final List<String> configFilters = new ArrayList<String>();
+        configFilters.add( configFilterProps.getCanonicalPath() );
+
+        enableFilteringConfiguration( basedir, buildFilters, configFilters, false );
+
+        final File file =
+            fileManager.createFile( basedir, "config.txt",
+                                    "filtered common=${common} build.test=${build.test} config.test=${config.test}." );
+
+        mockManager.replayAll();
+
+        final File result = new FileFormatter( configSource, logger ).format( file, true, null, "UTF-8" );
+
+        assertEquals( "filtered common=config build.test=${build.test} config.test=config.",
+                      fileManager.getFileContents( result ) );
+
+        mockManager.verifyAll();
+    }
+
+    public void testShouldFilterExpressionFromFiltersFileInFileAddCustomDelimiters()
+        throws Exception
+    {
+        final File basedir = fileManager.createTempDir();
+
+        final File filterProps = fileManager.createFile( basedir, "filter.properties", "property=Test" );
+
+        final List<String> delimiters = Collections.unmodifiableList( Arrays.asList( "${*}", "@", "#", "(*)" ) );
+
+        enableBasicFilteringConfiguration( basedir, Collections.singletonList( filterProps.getCanonicalPath() ),
+                                           delimiters );
+
+        final File file =
+            fileManager.createFile( basedir, "one.txt",
+                                    "This is a test for project: ${property} @property@ #property# (property)." );
+
+        mockManager.replayAll();
+
+        final File result = new FileFormatter( configSource, logger ).format( file, true, null, "UTF-8" );
+
+        assertEquals( "This is a test for project: Test Test Test Test.", fileManager.getFileContents( result ) );
+
+        mockManager.verifyAll();
+    }
+
+    public void testShouldFilterExpressionFromFiltersFileInFileCustomDelimiters()
+        throws Exception
+    {
+        final File basedir = fileManager.createTempDir();
+
+        final File filterProps = fileManager.createFile( basedir, "filter.properties", "property=Test" );
+
+        final List<String> delimiters = Collections.unmodifiableList( Arrays.asList( "#", "(*)" ) );
+
+        enableBasicFilteringConfiguration( basedir, Collections.singletonList( filterProps.getCanonicalPath() ),
+                                           delimiters );
+
+        final File file =
+            fileManager.createFile( basedir, "one.txt",
+                                    "This is a test for project: ${property} @property@ #property# (property)." );
+
+        mockManager.replayAll();
+
+        final File result = new FileFormatter( configSource, logger ).format( file, true, null, "UTF-8" );
+
+        assertEquals( "This is a test for project: ${property} @property@ Test Test.",
+                      fileManager.getFileContents( result ) );
+
+        mockManager.verifyAll();
+    }
+
     private MavenProject createBasicMavenProject()
     {
         final Model model = new Model();
@@ -375,38 +501,72 @@ public class FileFormatterTest
         return new MavenProject( model );
     }
 
-    private void enableBasicFilteringConfiguration( final MavenProject project, final File basedir ) throws Exception
+    private void enableBasicFilteringConfiguration( final MavenProject project, final File basedir, final List<String> delimiters )
+        throws Exception
+    {
+
+        enableFilteringConfiguration( project, basedir, delimiters, Collections.<String> emptyList(), true );
+
+    }
+
+    private void enableFilteringConfiguration( final MavenProject project, final File basedir, final List<String> delimiters,
+                                               final List<String> filters, final boolean includeProjectBuildFilters )
+        throws Exception
     {
-        configSource.getTemporaryRootDirectory();
-        configSourceControl.setReturnValue( basedir );
+        expect( configSource.getTemporaryRootDirectory()).andReturn( basedir ).atLeastOnce();
+        expect( configSource.getEscapeString()).andReturn( null ).atLeastOnce();
+
+        expect( configSource.getProject()).andReturn( project).atLeastOnce();
 
-        configSource.getEscapeString();
-        configSourceControl.setReturnValue( null, MockControl.ONE_OR_MORE );
+        expect( configSource.getMavenFileFilter()).andReturn(
+            (MavenFileFilter) lookup( "org.apache.maven.shared.filtering.MavenFileFilter" ) );
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ONE_OR_MORE );
+        expect( configSource.getMavenSession()).andReturn( null );
 
-        configSource.getMavenFileFilter();
-        configSourceControl.setReturnValue( lookup( "org.apache.maven.shared.filtering.MavenFileFilter" ) );
+        expect( configSource.getFilters()).andReturn( filters );
 
-        configSource.getMavenSession();
-        configSourceControl.setReturnValue( null );
+        expect( configSource.isIncludeProjectBuildFilters()).andReturn( includeProjectBuildFilters );
+
+        expect( configSource.getDelimiters()).andReturn( delimiters );
 
-        configSource.getFilters();
-        configSourceControl.setReturnValue( Collections.EMPTY_LIST );
     }
 
-    private void enableBasicFilteringConfiguration( final File basedir, final List<String> filterFilenames )
+    private void enableBasicFilteringConfiguration( final File basedir, final List<String> buildFilterFilenames )
         throws Exception
     {
         final MavenProject project = createBasicMavenProject();
-        if ( filterFilenames != null )
+        if ( buildFilterFilenames != null )
         {
-            project.getBuild()
-                   .setFilters( filterFilenames );
+            project.getBuild().setFilters( buildFilterFilenames );
         }
 
-        enableBasicFilteringConfiguration( project, basedir );
+        enableBasicFilteringConfiguration( project, basedir, null );
     }
 
+    private void enableFilteringConfiguration( final File basedir, final List<String> buildFilterFilenames,
+                                               final List<String> configFilterFilenames,
+                                               boolean includeProjectBuildFilters )
+        throws Exception
+    {
+        final MavenProject project = createBasicMavenProject();
+        if ( buildFilterFilenames != null )
+        {
+            project.getBuild().setFilters( buildFilterFilenames );
+        }
+
+        enableFilteringConfiguration( project, basedir, null, configFilterFilenames, includeProjectBuildFilters );
+    }
+
+    private void enableBasicFilteringConfiguration( final File basedir, final List<String> buildFilterFilenames, final List<String> delimiters )
+        throws Exception
+    {
+
+        final MavenProject project = createBasicMavenProject();
+        if ( buildFilterFilenames != null )
+        {
+            project.getBuild().setFilters( buildFilterFilenames );
+        }
+
+        enableBasicFilteringConfiguration( project, basedir, delimiters );
+    }
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluatorTest.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluatorTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluatorTest.java Thu Oct 23 21:01:23 2014
@@ -19,42 +19,28 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import java.io.IOException;
-import java.util.Properties;
-
 import junit.framework.TestCase;
-
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.testutils.ConfigSourceStub;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.easymock.MockControl;
-import org.easymock.classextension.MockClassControl;
+import org.easymock.classextension.EasyMockSupport;
+import org.easymock.classextension.IMocksControl;
+
+import java.util.Properties;
+
+import static org.easymock.EasyMock.expect;
 
 public class AssemblyExpressionEvaluatorTest
     extends TestCase
 {
 
-    private AssemblyInterpolator interpolator;
-
     private final ConfigSourceStub configSourceStub = new ConfigSourceStub();
 
-    @Override
-    public void setUp()
-        throws IOException
-    {
-        interpolator = new AssemblyInterpolator();
-
-        interpolator.enableLogging( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
-    }
-
     public void testShouldResolveModelGroupId()
         throws ExpressionEvaluationException
     {
@@ -106,42 +92,26 @@ public class AssemblyExpressionEvaluator
 
         model.setProperties( props );
 
-        final MockManager mm = new MockManager();
-
-        final MockControl sessionControl = MockClassControl.createControl( MavenSession.class );
-        final MavenSession session = (MavenSession) sessionControl.getMock();
+        final EasyMockSupport mm = new EasyMockSupport();
 
-        mm.add( sessionControl );
+        MavenSession session = mm.createControl().createMock( MavenSession.class );
 
         final Properties execProps = new Properties();
         execProps.setProperty( "groupId", "still.another.id" );
 
-        session.getExecutionProperties();
-        sessionControl.setReturnValue( execProps, MockControl.ZERO_OR_MORE );
-
-        session.getUserProperties();
-        sessionControl.setReturnValue( new Properties(), MockControl.ZERO_OR_MORE );
-
-        final MockControl csControl = MockControl.createControl( AssemblerConfigurationSource.class );
-        final AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csControl.getMock();
-
-        mm.add( csControl );
-
-        cs.getMavenSession();
-        csControl.setReturnValue( session, MockControl.ZERO_OR_MORE );
+        expect( session.getExecutionProperties()).andReturn( execProps ).anyTimes();
+        expect( session.getUserProperties()).andReturn( new Properties() ).anyTimes();
 
-        cs.getProject();
-        csControl.setReturnValue( new MavenProject( model ), MockControl.ZERO_OR_MORE );
+        AssemblerConfigurationSource cs = mm.createControl().createMock( AssemblerConfigurationSource.class );
 
-        final MockControl lrCtl = MockControl.createControl( ArtifactRepository.class );
-        final ArtifactRepository lr = (ArtifactRepository) lrCtl.getMock();
-        mm.add( lrCtl );
+        expect( cs.getMavenSession()).andReturn( session );
+        expect( cs.getProject() ).andReturn( new MavenProject( model ) );
 
-        lr.getBasedir();
-        lrCtl.setReturnValue( "/path/to/local/repo", MockControl.ZERO_OR_MORE );
+        final IMocksControl lrCtl = mm.createControl();
+        final ArtifactRepository lr = lrCtl.createMock( ArtifactRepository.class );
 
-        cs.getLocalRepository();
-        csControl.setReturnValue( lr, MockControl.ZERO_OR_MORE );
+        expect( lr.getBasedir()).andReturn( "/path/to/local/repo" ).anyTimes();
+        expect( cs.getLocalRepository()).andReturn( lr ).anyTimes();
 
         mm.replayAll();
 
@@ -150,7 +120,6 @@ public class AssemblyExpressionEvaluator
         assertEquals( "assembly.still.another.id", result );
 
         mm.verifyAll();
-        mm.clear();
     }
 
     public void testShouldReturnUnchangedInputForUnresolvedExpression()

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolatorTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolatorTest.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolatorTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolatorTest.java Thu Oct 23 21:01:23 2014
@@ -33,12 +33,13 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.plugin.assembly.model.Assembly;
 import org.apache.maven.plugin.assembly.model.DependencySet;
 import org.apache.maven.plugin.assembly.testutils.ConfigSourceStub;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.easymock.MockControl;
-import org.easymock.classextension.MockClassControl;
+import org.easymock.classextension.EasyMockSupport;
+
+import static org.easymock.EasyMock.expect;
 
 public class AssemblyInterpolatorTest
     extends TestCase
@@ -176,39 +177,27 @@ public class AssemblyInterpolatorTest
 
         assembly.setId( "assembly.${groupId}" );
 
-        final MockManager mm = new MockManager();
-
-        final MockControl sessionControl = MockClassControl.createControl( MavenSession.class );
-        final MavenSession session = (MavenSession) sessionControl.getMock();
+        final EasyMockSupport mm = new EasyMockSupport();
 
-        mm.add( sessionControl );
+        final MavenSession session = mm.createMock( MavenSession.class );
 
         final Properties execProps = new Properties();
         execProps.setProperty( "groupId", "still.another.id" );
 
-        session.getExecutionProperties();
-        sessionControl.setReturnValue( execProps, MockControl.ZERO_OR_MORE );
-
-        session.getUserProperties();
-        sessionControl.setReturnValue( new Properties(), MockControl.ZERO_OR_MORE );
+        expect( session.getExecutionProperties()).andReturn( execProps ).anyTimes();
 
-        final MockControl csControl = MockControl.createControl( AssemblerConfigurationSource.class );
-        final AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csControl.getMock();
+        expect( session.getUserProperties()).andReturn(  new Properties()).anyTimes();
 
-        mm.add( csControl );
+        final AssemblerConfigurationSource cs = mm.createMock( AssemblerConfigurationSource.class );
 
         final MockControl lrCtl = MockControl.createControl( ArtifactRepository.class );
-        final ArtifactRepository lr = (ArtifactRepository) lrCtl.getMock();
-        mm.add( lrCtl );
+        final ArtifactRepository lr =  mm.createMock( ArtifactRepository.class );
 
-        lr.getBasedir();
-        lrCtl.setReturnValue( "/path/to/local/repo", MockControl.ZERO_OR_MORE );
+        expect( lr.getBasedir()).andReturn(  "/path/to/local/repo").anyTimes();
 
-        cs.getLocalRepository();
-        csControl.setReturnValue( lr, MockControl.ZERO_OR_MORE );
+        expect(cs.getLocalRepository()).andReturn( lr ).anyTimes();
 
-        cs.getMavenSession();
-        csControl.setReturnValue( session, MockControl.ZERO_OR_MORE );
+        expect( cs.getMavenSession()).andReturn( session ).anyTimes();
 
         mm.replayAll();
 
@@ -217,7 +206,7 @@ public class AssemblyInterpolatorTest
         assertEquals( "assembly.still.another.id", result.getId() );
 
         mm.verifyAll();
-        mm.clear();
+        mm.resetAll();
     }
 
     public void testShouldNotTouchUnresolvedExpression()

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java Thu Oct 23 21:01:23 2014
@@ -19,20 +19,7 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
 import junit.framework.TestCase;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Model;
@@ -47,11 +34,24 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.plugin.assembly.model.Repository;
 import org.apache.maven.plugin.assembly.model.io.xpp3.AssemblyXpp3Writer;
 import org.apache.maven.plugin.assembly.model.io.xpp3.ComponentXpp3Writer;
-import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.plugin.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.IOUtil;
-import org.easymock.MockControl;
+import org.easymock.classextension.EasyMockSupport;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.easymock.EasyMock.expect;
 
 public class DefaultAssemblyReaderTest
     extends TestCase
@@ -59,42 +59,28 @@ public class DefaultAssemblyReaderTest
 
     private TestFileManager fileManager;
 
-    private MockManager mockManager;
+    private EasyMockSupport mockManager;
 
-    private MockControl configSourceControl;
 
     private AssemblerConfigurationSource configSource;
 
     private ArtifactRepository localRepo;
 
-    private MockControl localRepoControl;
 
     @Override
     public void setUp()
     {
         fileManager = new TestFileManager( "assembly-reader.test.", ".xml" );
-        mockManager = new MockManager();
-
-        configSourceControl = MockControl.createControl( AssemblerConfigurationSource.class );
-        mockManager.add( configSourceControl );
-
-        configSource = (AssemblerConfigurationSource) configSourceControl.getMock();
-
-        localRepoControl = MockControl.createControl( ArtifactRepository.class );
-        localRepo = (ArtifactRepository) localRepoControl.getMock();
-        mockManager.add( localRepoControl );
-
-        localRepo.getBasedir();
-        localRepoControl.setReturnValue( "/path/to/local/repo", MockControl.ZERO_OR_MORE );
+        mockManager = new EasyMockSupport();
 
-        configSource.getLocalRepository();
-        configSourceControl.setReturnValue( localRepo, MockControl.ZERO_OR_MORE );
+        configSource = mockManager.createMock(AssemblerConfigurationSource.class);
 
-        configSource.getRemoteRepositories();
-        configSourceControl.setReturnValue( Collections.EMPTY_LIST, MockControl.ZERO_OR_MORE );
+        localRepo = mockManager.createMock( ArtifactRepository.class );
 
-        configSource.getMavenSession();
-        configSourceControl.setReturnValue( null, MockControl.ZERO_OR_MORE );
+        expect(localRepo.getBasedir()).andReturn("/path/to/local/repo").anyTimes();
+        expect(configSource.getLocalRepository()).andReturn( localRepo ).anyTimes();
+        expect( configSource.getRemoteRepositories()).andReturn( Collections.<ArtifactRepository>emptyList()).anyTimes();
+        expect(configSource.getMavenSession()).andReturn( null).anyTimes();
     }
 
     @Override
@@ -110,8 +96,7 @@ public class DefaultAssemblyReaderTest
         final File siteDir = File.createTempFile( "assembly-reader.", ".test" );
         siteDir.delete();
 
-        configSource.getSiteDirectory();
-        configSourceControl.setReturnValue( siteDir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getSiteDirectory()).andReturn( siteDir ).anyTimes();
 
         final Assembly assembly = new Assembly();
 
@@ -136,8 +121,7 @@ public class DefaultAssemblyReaderTest
     {
         final File siteDir = fileManager.createTempDir();
 
-        configSource.getSiteDirectory();
-        configSourceControl.setReturnValue( siteDir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getSiteDirectory()).andReturn( siteDir ).anyTimes();
 
         final Assembly assembly = new Assembly();
 
@@ -502,13 +486,11 @@ public class DefaultAssemblyReaderTest
 
         final File basedir = componentFile.getParentFile();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
         final MavenProject project = new MavenProject();
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( project ).anyTimes();
 
         mockManager.replayAll();
 
@@ -541,8 +523,7 @@ public class DefaultAssemblyReaderTest
 
         final File basedir = fileManager.createTempDir();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
         final Model model = new Model();
         model.setGroupId( "group" );
@@ -551,11 +532,9 @@ public class DefaultAssemblyReaderTest
 
         final MavenProject project = new MavenProject( model );
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( project ).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
         mockManager.replayAll();
 
@@ -583,13 +562,11 @@ public class DefaultAssemblyReaderTest
 
         final File siteDir = fileManager.createTempDir();
 
-        configSource.getSiteDirectory();
-        configSourceControl.setReturnValue( siteDir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getSiteDirectory()).andReturn( siteDir ).anyTimes();
 
         final File basedir = fileManager.createTempDir();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
         final Model model = new Model();
         model.setGroupId( "group" );
@@ -598,11 +575,9 @@ public class DefaultAssemblyReaderTest
 
         final MavenProject project = new MavenProject( model );
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect(configSource.getProject()).andReturn( project ).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
         mockManager.replayAll();
 
@@ -635,13 +610,11 @@ public class DefaultAssemblyReaderTest
 
         final File siteDir = fileManager.createTempDir();
 
-        configSource.getSiteDirectory();
-        configSourceControl.setReturnValue( siteDir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getSiteDirectory()).andReturn( siteDir ).anyTimes();
 
         final File basedir = fileManager.createTempDir();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
         final Model model = new Model();
         model.setGroupId( "group" );
@@ -650,11 +623,9 @@ public class DefaultAssemblyReaderTest
 
         final MavenProject project = new MavenProject( model );
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( project ).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( true, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( true ).anyTimes();
 
         mockManager.replayAll();
 
@@ -711,8 +682,7 @@ public class DefaultAssemblyReaderTest
 
         final StringReader sr = new StringReader( sw.toString() );
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
         final Model model = new Model();
         model.setGroupId( "group" );
@@ -720,11 +690,9 @@ public class DefaultAssemblyReaderTest
         model.setVersion( "version" );
 
         final MavenProject project = new MavenProject( model );
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( project ).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
         mockManager.replayAll();
 
@@ -781,8 +749,7 @@ public class DefaultAssemblyReaderTest
 
         final StringReader sr = new StringReader( sw.toString() );
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ONE_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).atLeastOnce();
 
         final Model model = new Model();
         model.setGroupId( "group" );
@@ -791,11 +758,9 @@ public class DefaultAssemblyReaderTest
 
         final MavenProject project = new MavenProject( model );
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ONE_OR_MORE );
+        expect( configSource.getProject()).andReturn( project ).atLeastOnce();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false );
+        expect( configSource.isSiteIncluded()).andReturn( false );
 
         mockManager.replayAll();
 
@@ -828,8 +793,7 @@ public class DefaultAssemblyReaderTest
 
         final File basedir = fileManager.createTempDir();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
         final Model model = new Model();
         model.setGroupId( "group" );
@@ -838,11 +802,9 @@ public class DefaultAssemblyReaderTest
 
         final MavenProject project = new MavenProject( model );
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( project ).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
         mockManager.replayAll();
 
@@ -868,14 +830,11 @@ public class DefaultAssemblyReaderTest
 
         final File basedir = assemblyFile.getParentFile();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir).anyTimes();
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( new MavenProject( new Model() ), MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( new MavenProject( new Model() )).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
         Writer writer = null;
         try
@@ -902,17 +861,13 @@ public class DefaultAssemblyReaderTest
     {
         final File basedir = fileManager.createTempDir();
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir).anyTimes();
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( new MavenProject( new Model() ), MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( new MavenProject( new Model() )).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
-        configSource.isIgnoreMissingDescriptor();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isIgnoreMissingDescriptor()).andReturn( false ).anyTimes();
 
         mockManager.replayAll();
 
@@ -1157,32 +1112,23 @@ public class DefaultAssemblyReaderTest
                                                   final boolean ignoreMissing )
         throws AssemblyReadException, InvalidAssemblerConfigurationException
     {
-        configSource.getDescriptor();
-        configSourceControl.setReturnValue( descriptor );
+        expect( configSource.getDescriptor()).andReturn( descriptor );
 
-        configSource.getDescriptorId();
-        configSourceControl.setReturnValue( descriptorRef );
+        expect( configSource.getDescriptorId()).andReturn( descriptorRef );
 
-        configSource.getDescriptorReferences();
-        configSourceControl.setReturnValue( descriptorRefs );
+        expect( configSource.getDescriptorReferences()).andReturn( descriptorRefs );
 
-        configSource.getDescriptors();
-        configSourceControl.setReturnValue( descriptors );
+        expect( configSource.getDescriptors()).andReturn( descriptors );
 
-        configSource.getDescriptorSourceDirectory();
-        configSourceControl.setReturnValue( descriptorDir );
+        expect( configSource.getDescriptorSourceDirectory()).andReturn( descriptorDir );
 
-        configSource.getBasedir();
-        configSourceControl.setReturnValue( basedir, MockControl.ZERO_OR_MORE );
+        expect( configSource.getBasedir()).andReturn( basedir ).anyTimes();
 
-        configSource.getProject();
-        configSourceControl.setReturnValue( new MavenProject( new Model() ), MockControl.ZERO_OR_MORE );
+        expect( configSource.getProject()).andReturn( new MavenProject( new Model() )).anyTimes();
 
-        configSource.isSiteIncluded();
-        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        expect( configSource.isSiteIncluded()).andReturn( false ).anyTimes();
 
-        configSource.isIgnoreMissingDescriptor();
-        configSourceControl.setReturnValue( ignoreMissing, MockControl.ZERO_OR_MORE );
+        expect( configSource.isIgnoreMissingDescriptor()).andReturn(  ignoreMissing).anyTimes();
 
         mockManager.replayAll();
 

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/ConfigSourceStub.java Thu Oct 23 21:01:23 2014
@@ -28,6 +28,7 @@ import org.apache.maven.execution.MavenS
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.filtering.MavenFileFilter;
+import org.apache.maven.shared.filtering.MavenReaderFilter;
 
 public class ConfigSourceStub
     implements AssemblerConfigurationSource
@@ -82,6 +83,10 @@ public class ConfigSourceStub
         return null;
     }
 
+    public boolean isIncludeProjectBuildFilters() {
+    	return false;
+    }
+
     public String getFinalName()
     {
         return null;
@@ -167,11 +172,6 @@ public class ConfigSourceStub
         return false;
     }
 
-    public void setArchiverConfig( final String archiverConfig )
-    {
-        this.archiverConfig = archiverConfig;
-    }
-
     public String getArchiverConfig()
     {
         return archiverConfig;
@@ -182,6 +182,12 @@ public class ConfigSourceStub
         return null;
     }
 
+    public MavenReaderFilter getMavenReaderFilter()
+    {
+        return null;
+    }
+
+
     public void setProject( final MavenProject mavenProject )
     {
         project = mavenProject;
@@ -209,4 +215,9 @@ public class ConfigSourceStub
     public String getEscapeString() {
         return null;
     }
+
+	public List<String> getDelimiters() {
+		return null;
+	}
+
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/TestFileManager.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/TestFileManager.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/TestFileManager.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/test/java/org/apache/maven/plugin/assembly/testutils/TestFileManager.java Thu Oct 23 21:01:23 2014
@@ -19,6 +19,9 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+
 import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
@@ -27,11 +30,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.Assert;
-
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-
 public class TestFileManager
 {
 
@@ -45,8 +43,6 @@ public class TestFileManager
 
     private StackTraceElement callerInfo;
 
-    private Thread cleanupWarning;
-
     private boolean warnAboutCleanup = false;
 
     public TestFileManager( final String baseFilename, final String fileSuffix )
@@ -71,7 +67,7 @@ public class TestFileManager
 
         };
 
-        cleanupWarning = new Thread( warning );
+        Thread cleanupWarning = new Thread( warning );
 
         Runtime.getRuntime()
                .addShutdownHook( cleanupWarning );
@@ -97,12 +93,13 @@ public class TestFileManager
         {
             Thread.sleep( 20 );
         }
-        catch ( final InterruptedException e )
+        catch ( final InterruptedException ignore )
         {
         }
 
         final File dir = new File( TEMP_DIR_PATH, baseFilename + System.currentTimeMillis() );
 
+        //noinspection ResultOfMethodCallIgnored
         dir.mkdirs();
         markForDeletion( dir );
 
@@ -142,33 +139,10 @@ public class TestFileManager
         warnAboutCleanup = false;
     }
 
-    public void assertFileExistence( final File dir, final String filename, final boolean shouldExist )
-    {
-        final File file = new File( dir, filename );
-
-        if ( shouldExist )
-        {
-            Assert.assertTrue( file.exists() );
-        }
-        else
-        {
-            Assert.assertFalse( file.exists() );
-        }
-    }
-
-    public void assertFileContents( final File dir, final String filename, final String contentsTest )
-        throws IOException
-    {
-        assertFileExistence( dir, filename, true );
-
-        final File file = new File( dir, filename );
-
-        Assert.assertEquals( contentsTest, getFileContents( file ) );
-    }
-
     /**
      * NOTE: the file content is written using platform encoding.
      */
+    @SuppressWarnings( "ResultOfMethodCallIgnored" )
     public File createFile( final File dir, final String filename, final String contents ) throws IOException
     {
         final File file = new File( dir, filename );
@@ -224,10 +198,4 @@ public class TestFileManager
         super.finalize();
     }
 
-    public File createFile( final String filename, final String content ) throws IOException
-    {
-        final File dir = createTempDir();
-        return createFile( dir, filename, content );
-    }
-
 }