You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/06/29 09:53:53 UTC

karaf git commit: [KARAF-3475] Refresh bundles during wiring

Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 399ad55e7 -> 416db2d11


[KARAF-3475] Refresh bundles during wiring


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

Branch: refs/heads/karaf-3.0.x
Commit: 416db2d1146703f2c0e6812cc4de5ac190a0cc42
Parents: 399ad55
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Mon Jun 29 09:45:19 2015 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Mon Jun 29 09:45:19 2015 +0200

----------------------------------------------------------------------
 .../karaf/features/internal/BundleManager.java  |  2 +-
 .../apache/karaf/itests/KarafTestSupport.java   | 21 +++++++-------------
 2 files changed, 8 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/416db2d1/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java b/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
index 4e5daf5..8e4044c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
@@ -407,7 +407,7 @@ public class BundleManager {
 
     protected void refreshPackages(Collection<Bundle> bundles) {
         final Object refreshLock = new Object();
-        FrameworkWiring wiring = bundleContext.getBundle().adapt(FrameworkWiring.class);
+        FrameworkWiring wiring = bundleContext.getBundle(0).adapt(FrameworkWiring.class);
         if (wiring != null) {
             synchronized (refreshLock) {
                 wiring.refreshBundles(bundles, new FrameworkListener() {

http://git-wip-us.apache.org/repos/asf/karaf/blob/416db2d1/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
index f1331e1..aa9439d 100644
--- a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
+++ b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
@@ -25,14 +25,7 @@ import java.io.PrintStream;
 import java.net.URL;
 import java.security.Principal;
 import java.security.PrivilegedExceptionAction;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
@@ -411,12 +404,12 @@ public class KarafTestSupport {
 	}
 
     protected void installAndAssertFeature(String feature) throws Exception {
-        featureService.installFeature(feature);
+        featureService.installFeature(feature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
         assertFeatureInstalled(feature);
     }
 
     protected void installAndAssertFeature(String feature, String version) throws Exception {
-        featureService.installFeature(feature, version);
+        featureService.installFeature(feature, version, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
         assertFeatureInstalled(feature, version);
     }
 
@@ -424,7 +417,7 @@ public class KarafTestSupport {
     	Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featureService.listInstalledFeatures()));
     	try {
 			for (String curFeature : feature) {
-				featureService.installFeature(curFeature);
+				featureService.installFeature(curFeature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
 			    assertFeatureInstalled(curFeature);
 			}
 		} finally {
@@ -435,7 +428,7 @@ public class KarafTestSupport {
     protected void installAssertAndUninstallFeature(String feature) throws Exception {
         Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featureService.listInstalledFeatures()));
         try {
-            featureService.installFeature(feature);
+            featureService.installFeature(feature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
             assertFeatureInstalled(feature);
         } finally {
             uninstallNewFeatures(featuresBefore);
@@ -445,7 +438,7 @@ public class KarafTestSupport {
     protected void installAssertAndUninstallFeature(String feature, String version) throws Exception {
         Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featureService.listInstalledFeatures()));
         try {
-            featureService.installFeature(feature, version);
+            featureService.installFeature(feature, version, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
             assertFeatureInstalled(feature, version);
         } finally {
             uninstallNewFeatures(featuresBefore);
@@ -466,7 +459,7 @@ public class KarafTestSupport {
 			if (!featuresBefore.contains(curFeature)) {
 				try {
 					System.out.println("Uninstalling " + curFeature.getName());
-					featureService.uninstallFeature(curFeature.getName(), curFeature.getVersion());
+					featureService.uninstallFeature(curFeature.getName(), curFeature.getVersion(), EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
 				} catch (Exception e) {
 					LOG.error(e.getMessage(), e);
 				}