karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggrzy...@apache.org
Subject [1/2] karaf git commit: [KARAF-5221] Fix AssemblyMojo.pidsToExtract
Date Mon, 26 Jun 2017 08:49:54 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.1.x 528455ab7 -> 42fef157a
  refs/heads/master a2e46e899 -> 818ab2ca3


[KARAF-5221] Fix AssemblyMojo.pidsToExtract


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/818ab2ca
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/818ab2ca
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/818ab2ca

Branch: refs/heads/master
Commit: 818ab2ca36662e3ef05cd42be73058bae2b4879d
Parents: a2e46e8
Author: Grzegorz Grzybek <gr.grzybek@gmail.com>
Authored: Mon Jun 26 10:47:28 2017 +0200
Committer: Grzegorz Grzybek <gr.grzybek@gmail.com>
Committed: Mon Jun 26 10:47:28 2017 +0200

----------------------------------------------------------------------
 .../apache/karaf/profile/assembly/Builder.java   |  9 +++++++--
 .../karaf/profile/assembly/BuilderTest.java      | 19 +++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/818ab2ca/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
index 790846f..808c333 100644
--- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
+++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
@@ -36,6 +36,7 @@ import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -163,7 +164,7 @@ public class Builder {
     String mavenRepositories;
     Map<String, String> config = new LinkedHashMap<>();
     Map<String, String> system = new LinkedHashMap<>();
-    List<String> pidsToExtract;
+    List<String> pidsToExtract = new LinkedList<>();
 
     private ScheduledExecutorService executor;
     private DownloadManager manager;
@@ -381,7 +382,11 @@ public class Builder {
     }
 
     public Builder pidsToExtract(List<String> pidsToExtract) {
-        this.pidsToExtract = pidsToExtract;
+        if (pidsToExtract != null) {
+            for (String pid : pidsToExtract) {
+                this.pidsToExtract.add(pid.trim());
+            }
+        }
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/818ab2ca/profile/src/test/java/org/apache/karaf/profile/assembly/BuilderTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/karaf/profile/assembly/BuilderTest.java b/profile/src/test/java/org/apache/karaf/profile/assembly/BuilderTest.java
index 623a2ca..3b82371 100644
--- a/profile/src/test/java/org/apache/karaf/profile/assembly/BuilderTest.java
+++ b/profile/src/test/java/org/apache/karaf/profile/assembly/BuilderTest.java
@@ -22,11 +22,16 @@ import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
 
 import org.junit.Ignore;
 import org.junit.Test;
 import org.osgi.framework.Constants;
 
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
 public class BuilderTest {
 
     @Test
@@ -58,6 +63,20 @@ public class BuilderTest {
     }
 
     @Test
+    public void testPidsToExtract() {
+        String pidsToExtract = "\n" +
+                "                        !jmx.acl.*,\n" +
+                "                        !org.apache.karaf.command.acl.*,\n" +
+                "                        *\n" +
+                "                    ";
+        List<String> p2e = Arrays.asList(pidsToExtract.split(","));
+        Builder builder = Builder.newInstance().pidsToExtract(p2e);
+        assertThat(builder.getPidsToExtract().get(0), equalTo("!jmx.acl.*"));
+        assertThat(builder.getPidsToExtract().get(1), equalTo("!org.apache.karaf.command.acl.*"));
+        assertThat(builder.getPidsToExtract().get(2), equalTo("*"));
+    }
+
+    @Test
     @Ignore("This test can not run at this position as it needs the staticFramework kar which
is not yet available")
     public void testBuilder() throws Exception {
 


Mime
View raw message