[maven-ejb-plugin] branch MEJB-129 updated (a2eefc2 -> 90c83f0)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven-ejb-plugin] branch MEJB-129 updated (a2eefc2 -> 90c83f0)

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

michaelo pushed a change to branch MEJB-129
in repository https://gitbox.apache.org/repos/asf/maven-ejb-plugin.git.


 discard a2eefc2  [MEJB-129] Refactor IncludesExcludes to reduce code duplication
     new 90c83f0  [MEJB-129] Refactor IncludesExcludes to reduce code duplication

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a2eefc2)
            \
             N -- N -- N   refs/heads/MEJB-129 (90c83f0)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[maven-ejb-plugin] 01/01: [MEJB-129] Refactor IncludesExcludes to reduce code duplication

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

michaelo pushed a commit to branch MEJB-129
in repository https://gitbox.apache.org/repos/asf/maven-ejb-plugin.git

commit 90c83f0026db37f1694b2282eab49cc06afeaece
Author: Piotrek Żygieło <[hidden email]>
AuthorDate: Sun Apr 12 21:41:23 2020 +0200

    [MEJB-129] Refactor IncludesExcludes to reduce code duplication
   
    This closes #3
---
 .../apache/maven/plugins/ejb/IncludesExcludes.java | 24 ++++++++--------------
 .../maven/plugins/ejb/IncludesExcludesTest.java    | 17 +++++++++++++++
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java b/src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java
index 2b5e0a7..337d622 100644
--- a/src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java
+++ b/src/main/java/org/apache/maven/plugins/ejb/IncludesExcludes.java
@@ -46,33 +46,27 @@ public class IncludesExcludes
 
     public String[] resultingIncludes()
     {
-        String[] result = new String[0];
-        if ( includes.isEmpty() )
-        {
-            result = defaultIncludes.toArray( new String[defaultIncludes.size()] );
-        }
-        else
-        {
-            result = includes.toArray( new String[includes.size()] );
-        }
-
-        return result;
+        return resultingXcludes( includes, defaultIncludes );
     }
 
     public String[] resultingExcludes()
     {
+        return resultingXcludes( excludes, defaultExcludes );
+    }
+
+    private static String[] resultingXcludes( List<String> currentXcludes, List<String> defaultXcludes )
+    {
         String[] result = new String[0];
-        if ( excludes.isEmpty() )
+        if ( currentXcludes.isEmpty() )
         {
-            result = defaultExcludes.toArray( new String[defaultExcludes.size()] );
+            result = defaultXcludes.toArray( new String[0] );
         }
         else
         {
-            result = excludes.toArray( new String[excludes.size()] );
+            result = currentXcludes.toArray( new String[0] );
         }
 
         return result;
-
     }
 
     private List<String> makeNonNullList( List<String> in )
diff --git a/src/test/java/org/apache/maven/plugins/ejb/IncludesExcludesTest.java b/src/test/java/org/apache/maven/plugins/ejb/IncludesExcludesTest.java
index 430de25..5261d21 100644
--- a/src/test/java/org/apache/maven/plugins/ejb/IncludesExcludesTest.java
+++ b/src/test/java/org/apache/maven/plugins/ejb/IncludesExcludesTest.java
@@ -79,4 +79,21 @@ public class IncludesExcludesTest
         assertThat( ie.resultingExcludes() ).isEqualTo( new String[0] );
     }
 
+    @Test
+    public void nonNullIncludesShouldResultInTheSameIncludes()
+    {
+        IncludesExcludes ie = new IncludesExcludes( Arrays.asList( "**/package.html" ), null,
+                                                    Arrays.asList( "**/site.html" ), null );
+
+        assertThat( ie.resultingIncludes() ).isEqualTo( new String[] { "**/package.html" } );
+    }
+
+    @Test
+    public void nonNullExcludesShouldResultInTheSameExcludes()
+    {
+        IncludesExcludes ie = new IncludesExcludes( null, Arrays.asList( "**/package.html" ),
+                                                    null, Arrays.asList( "**/site.html" ) );
+
+        assertThat( ie.resultingExcludes() ).isEqualTo( new String[] { "**/package.html" } );
+    }
 }