Bug 288253 - ConfigurationAdmin after Configuration.setLocation() change: ManagedService instance not called when PID is updated
diff --git a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
index 35188f5..a1b9aca 100644
--- a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
 Bundle-SymbolicName: org.eclipse.equinox.cm.test
 Bundle-Version: 1.0.0
 Bundle-Activator: org.eclipse.equinox.cm.test.Activator
-Import-Package: junit.framework;version="[3.8.0,4.0.0)",
+Import-Package: junit.framework;version="3.8.1",
  org.osgi.framework;version="1.3.0",
  org.osgi.service.cm;version="1.2.0",
  org.osgi.service.event;version="1.1.0",
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
index 28671dd..2d671c3 100644
--- a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others
+ * Copyright (c) 2007, 2010 IBM Corporation and others
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -126,6 +126,18 @@
 			assertEquals(2, updateCount);
 		}
 
+		String location = config.getBundleLocation();
+		config.setBundleLocation("bogus");
+		synchronized (lock) {
+			config.update();
+			locked = true;
+			lock.wait(100);
+			assertTrue(locked);
+			assertEquals(2, updateCount);
+			locked = false;
+		}
+		config.setBundleLocation(location);
+
 		dict.remove(Constants.SERVICE_PID);
 		synchronized (lock) {
 			reg.setProperties(dict);
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationImpl.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationImpl.java
index 3af8b62..630dc89 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationImpl.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2009 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2005, 2010 Cognos Incorporated, IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -228,6 +228,7 @@
 			checkDeleted();
 			configurationAdminFactory.checkConfigurationPermission();
 			this.bundleLocation = bundleLocation;
+			boundBundle = null; // always reset the boundBundle when setBundleLocation is called
 		} finally {
 			unlock();
 		}