You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jg...@apache.org on 2016/08/01 21:30:06 UTC

[1/2] karaf git commit: KARAF-4642: featuresBoot order is not honored

Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x dbd58bcec -> 9f513b950


KARAF-4642: featuresBoot order is not honored


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

Branch: refs/heads/karaf-4.0.x
Commit: f86eb6389513a5aa2befc4c04df5855c276bbbbb
Parents: 2c0bf85
Author: James Carman <ja...@contractor.cengage.com>
Authored: Mon Aug 1 15:21:16 2016 -0400
Committer: James Carman <ja...@contractor.cengage.com>
Committed: Mon Aug 1 15:21:16 2016 -0400

----------------------------------------------------------------------
 .../internal/service/BootFeaturesInstaller.java |  3 +-
 .../service/BootFeaturesInstallerTest.java      | 55 ++++++++++++--------
 2 files changed, 36 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/f86eb638/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
index f3b1647..d45cfc6 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.regex.Matcher;
@@ -141,7 +142,7 @@ public class BootFeaturesInstaller {
     }
 
     protected Set<String> parseFeatureList(String group) {
-        HashSet<String> features = new HashSet<>();
+        HashSet<String> features = new LinkedHashSet<>();
         for (String feature : Arrays.asList(group.trim().split("\\s*,\\s*"))) {
             if (feature.length() > 0) {
                 features.add(feature);

http://git-wip-us.apache.org/repos/asf/karaf/blob/f86eb638/features/core/src/test/java/org/apache/karaf/features/internal/service/BootFeaturesInstallerTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/internal/service/BootFeaturesInstallerTest.java b/features/core/src/test/java/org/apache/karaf/features/internal/service/BootFeaturesInstallerTest.java
index 1754e25..1c6b0d5 100644
--- a/features/core/src/test/java/org/apache/karaf/features/internal/service/BootFeaturesInstallerTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/internal/service/BootFeaturesInstallerTest.java
@@ -16,21 +16,28 @@
  */
 package org.apache.karaf.features.internal.service;
 
-import static java.util.Arrays.asList;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.fail;
-
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
 
-import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.FeaturesService.Option;
 import org.apache.karaf.features.TestBase;
-import org.easymock.EasyMock;
+import org.easymock.Capture;
 import org.junit.Assert;
 import org.junit.Test;
 
+import static java.util.Arrays.asList;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.newCapture;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
 public class BootFeaturesInstallerTest extends TestBase {
 
     @Test
@@ -44,51 +51,57 @@ public class BootFeaturesInstallerTest extends TestBase {
     
     @Test
     public void testDefaultBootFeatures() throws Exception  {
-        FeaturesServiceImpl impl = EasyMock.createMock(FeaturesServiceImpl.class);
+        FeaturesServiceImpl impl = createMock(FeaturesServiceImpl.class);
 
-        impl.installFeatures(setOf("config", "standard", "region"), EnumSet.of(Option.NoFailOnFeatureNotFound));
-        EasyMock.expectLastCall();
+        Capture<Set<String>> featuresCapture = newCapture();
+        impl.installFeatures(capture(featuresCapture), eq(EnumSet.of(Option.NoFailOnFeatureNotFound)));
+        expectLastCall();
 
         impl.bootDone();
-        EasyMock.expectLastCall();
+        expectLastCall();
 
         replay(impl);
         BootFeaturesInstaller bootFeatures = new BootFeaturesInstaller(null, impl, "", "config,standard,region", false);
         bootFeatures.installBootFeatures();
-        EasyMock.verify(impl);        
+        verify(impl);
+
+        List<String> features = new ArrayList<String>(featuresCapture.getValue());
+        Assert.assertEquals("config", features.get(0));
+        Assert.assertEquals("standard", features.get(1));
+        Assert.assertEquals("region", features.get(2));
     }
 
     @Test
     public void testStagedBoot() throws Exception  {
-        FeaturesServiceImpl impl = EasyMock.createStrictMock(FeaturesServiceImpl.class);
+        FeaturesServiceImpl impl = createStrictMock(FeaturesServiceImpl.class);
 
         impl.installFeatures(setOf("transaction"), EnumSet.of(Option.NoFailOnFeatureNotFound));
-        EasyMock.expectLastCall();
+        expectLastCall();
         impl.installFeatures(setOf("ssh"), EnumSet.of(Option.NoFailOnFeatureNotFound));
-        EasyMock.expectLastCall();
+        expectLastCall();
 
         impl.bootDone();
-        EasyMock.expectLastCall();
+        expectLastCall();
 
         replay(impl);
         BootFeaturesInstaller bootFeatures = new BootFeaturesInstaller(null, impl , "", "(transaction), ssh", false);
         bootFeatures.installBootFeatures();
-        EasyMock.verify(impl);        
+        verify(impl);
     }
 
     @Test
     public void testStartDoesNotFailWithOneInvalidUri() throws Exception {
-        FeaturesServiceImpl impl = EasyMock.createStrictMock(FeaturesServiceImpl.class);
+        FeaturesServiceImpl impl = createStrictMock(FeaturesServiceImpl.class);
         impl.addRepository(URI.create("mvn:inexistent/features/1.0/xml/features"));
-        EasyMock.expectLastCall().andThrow(new IllegalArgumentException());
+        expectLastCall().andThrow(new IllegalArgumentException());
 
         impl.bootDone();
-        EasyMock.expectLastCall();
+        expectLastCall();
 
         replay(impl);
         BootFeaturesInstaller bootFeatures = new BootFeaturesInstaller(null, impl, "mvn:inexistent/features/1.0/xml/features", "", false);
         bootFeatures.installBootFeatures();
-        EasyMock.verify(impl);
+        verify(impl);
     }
 
 }


[2/2] karaf git commit: Merge branch 'KARAF-4642-4.0.x' of https://github.com/jwcarman/karaf into karaf-4.0.x

Posted by jg...@apache.org.
Merge branch 'KARAF-4642-4.0.x' of https://github.com/jwcarman/karaf into karaf-4.0.x


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

Branch: refs/heads/karaf-4.0.x
Commit: 9f513b9505a3f6217c976706f0f7b6c81919a617
Parents: dbd58bc f86eb63
Author: jgoodyear <jg...@apache.org>
Authored: Mon Aug 1 18:23:29 2016 -0230
Committer: jgoodyear <jg...@apache.org>
Committed: Mon Aug 1 18:23:29 2016 -0230

----------------------------------------------------------------------
 .../internal/service/BootFeaturesInstaller.java |  3 +-
 .../service/BootFeaturesInstallerTest.java      | 55 ++++++++++++--------
 2 files changed, 36 insertions(+), 22 deletions(-)
----------------------------------------------------------------------