You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/04/20 18:51:31 UTC

[maven-assembly-plugin] branch MASSEMBLY-932 created (now 3a58218)

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a change to branch MASSEMBLY-932
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git.


      at 3a58218  [MASSEMBLY-932] resource filtering skipped for resources in the current project

This branch includes the following new commits:

     new 3a58218  [MASSEMBLY-932] resource filtering skipped for resources in the current project

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-assembly-plugin] 01/01: [MASSEMBLY-932] resource filtering skipped for resources in the current project

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MASSEMBLY-932
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git

commit 3a58218f0c9ea4b52de5a0bf8a2d7aa0059d546d
Author: rfscholte <rf...@apache.org>
AuthorDate: Mon Apr 20 20:51:18 2020 +0200

    [MASSEMBLY-932] resource filtering skipped for resources in the current project
---
 .../archive/archiver/AssemblyProxyArchiver.java    |  2 +-
 .../archiver/AssemblyProxyArchiverTest.java        | 66 +++++++++++++++-------
 2 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java b/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
index a8ec9ba..e4501ab 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
@@ -768,7 +768,7 @@ public class AssemblyProxyArchiver
             dfs.setIncludes( newIn.toArray( new String[newIn.size()] ) );
             dfs.setIncludingEmptyDirectories( fs.isIncludingEmptyDirectories() );
             dfs.setPrefix( fs.getPrefix() );
-            dfs.setUsingDefaultExcludes( fs.isUsingDefaultExcludes() );
+            dfs.setStreamTransformer( fs.getStreamTransformer() );
 
             delegate.addFileSet( dfs );
         }
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java
index ed7815f..b823c93 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java
@@ -19,20 +19,30 @@ package org.apache.maven.plugins.assembly.archive.archiver;
  * under the License.
  */
 
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.FileSet;
 import org.codehaus.plexus.archiver.diags.TrackingArchiver;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.util.DefaultFileSet;
 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 import org.codehaus.plexus.components.io.fileselectors.FileSelector;
+import org.codehaus.plexus.components.io.functions.InputStreamTransformer;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.easymock.EasyMock;
-import org.easymock.classextension.EasyMockSupport;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
+import org.mockito.ArgumentCaptor;
 
 import javax.annotation.Nonnull;
 import java.io.File;
@@ -43,11 +53,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.easymock.EasyMock.anyObject;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class AssemblyProxyArchiverTest
 {
     @Rule
@@ -114,34 +119,23 @@ public class AssemblyProxyArchiverTest
     public void addFile_NoPerms_CallAcceptFilesOnlyOnce()
         throws IOException, ArchiverException
     {
-        EasyMockSupport mm = new EasyMockSupport();
-        final Archiver delegate = mm.createMock( Archiver.class );
-
-        delegate.addFile( (File) anyObject(), (String) anyObject() );
-        EasyMock.expectLastCall().anyTimes();
-
-        delegate.setForced( true );
-        EasyMock.expectLastCall().anyTimes();
+        final Archiver delegate = mock( Archiver.class );
 
         final CounterSelector counter = new CounterSelector( true );
         final List<FileSelector> selectors = new ArrayList<>();
         selectors.add( counter );
 
-        mm.replayAll();
-
         final AssemblyProxyArchiver archiver =
             new AssemblyProxyArchiver( "", delegate, null, selectors, null, new File( "." ),
                                        new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
-
         archiver.setForced( true );
 
         final File inputFile = temporaryFolder.newFile();
-
         archiver.addFile( inputFile, "file.txt" );
 
         assertEquals( 1, counter.getCount() );
-
-        mm.verifyAll();
+        verify( delegate ).addFile( inputFile, "file.txt" );
+        verify( delegate ).setForced( true );
     }
 
     @Test
@@ -173,6 +167,36 @@ public class AssemblyProxyArchiverTest
 
         assertEquals( 1, counter.getCount() );
     }
+    
+    @Test
+    public void assemblyWorkDir() 
+    {
+        final Archiver delegate = mock( Archiver.class );
+        final List<FileSelector> selectors = new ArrayList<>();
+
+        final AssemblyProxyArchiver archiver =
+            new AssemblyProxyArchiver( "prefix", delegate, null, selectors, null,
+                                       new File( temporaryFolder.getRoot(), "module1" ),
+                                       new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
+        
+        FileSet fileSet = mock( FileSet.class );
+        when( fileSet.getDirectory() ).thenReturn( temporaryFolder.getRoot() ); 
+        when( fileSet.getStreamTransformer() ).thenReturn( mock( InputStreamTransformer.class ) );
+        
+        archiver.addFileSet( fileSet );
+
+        ArgumentCaptor<FileSet> delFileSet = ArgumentCaptor.forClass( FileSet.class );
+        verify( delegate ).addFileSet( delFileSet.capture() );
+        
+        assertThat( delFileSet.getValue().getDirectory(), is( fileSet.getDirectory() ) );
+        assertThat( delFileSet.getValue().getExcludes(), is( new String[] { "module1" } ) );
+        assertThat( delFileSet.getValue().getFileMappers(), is( fileSet.getFileMappers() ) );
+        assertThat( delFileSet.getValue().getFileSelectors(), is( fileSet.getFileSelectors() ) );
+        assertThat( delFileSet.getValue().getIncludes(), is(  new String[0] ) );
+        assertThat( delFileSet.getValue().getPrefix(), is( "prefix/" ) );
+        assertThat( delFileSet.getValue().getStreamTransformer(), is( fileSet.getStreamTransformer() ) );
+    }
+    
 
     private static final class CounterSelector
         implements FileSelector