Author: fmeschbe
Date: Thu Aug 20 08:13:10 2009
New Revision: 806083
URL: http://svn.apache.org/viewvc?rev=806083&view=rev
Log:
FELIX-1448 setting the static bundle to a different location than
the dynamic bundle location is currently set to has to remove the
dynamic bundle location binding to be able to send further updates
to the new target bundle
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationBase.java
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationBindingTest.java
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationBase.java
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationBase.java?rev=806083&r1=806082&r2=806083&view=diff
==============================================================================
---
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationBase.java
(original)
+++
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationBase.java
Thu Aug 20 08:13:10 2009
@@ -196,6 +196,18 @@
}
*
*/
+
+ // corrollary to not reassigning configurations: we have to check
+ // whether the dynamic bundle location is different from the static
+ // now. If so, the dynamic bundle location has to be removed.
+ // also set the service reference to null because we assume to not
+ // be bound to a service anymore
+ if ( bundleLocation != null && getDynamicBundleLocation() != null
+ && !bundleLocation.equals( getDynamicBundleLocation() ) )
+ {
+ setDynamicBundleLocation( null );
+ setServiceReference( null );
+ }
}
Modified:
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationBindingTest.java
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationBindingTest.java?rev=806083&r1=806082&r2=806083&view=diff
==============================================================================
---
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationBindingTest.java
(original)
+++
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationBindingTest.java
Thu Aug 20 08:13:10 2009
@@ -605,7 +605,7 @@
@Test
- public void test_switch_dynamic_binding() throws BundleException
+ public void test_switch_dynamic_binding() throws BundleException,
IOException
{
// 1. create config with pid with null location
// 2. update config with properties
@@ -672,11 +672,19 @@
TestCase.assertNull( testerB1.props );
TestCase.assertEquals( 0, testerB1.numManagedServiceUpdatedCalls );
}
+
+ // 6. Update configuration now
+ config.update();
+ delay();
+
+ // ==> configuration supplied to the service ms2
+ TestCase.assertNotNull( testerB1.props );
+ TestCase.assertEquals( 1, testerB1.numManagedServiceUpdatedCalls );
}
@Test
- public void test_switch_static_binding_factory() throws BundleException
+ public void test_switch_static_binding_factory() throws BundleException,
IOException
{
// 1. create config with pid and locationA
// 2. update config with properties
@@ -743,11 +751,19 @@
TestCase.assertNull( testerB1.configs.get( pid ) );
TestCase.assertEquals( 0,
testerB1.numManagedServiceFactoryUpdatedCalls );
}
- }
+
+ // 6. Update configuration now
+ config.update();
+ delay();
+
+ // ==> configuration supplied to the service ms2
+ TestCase.assertNotNull( testerB1.configs.get( pid ) );
+ TestCase.assertEquals( 1,
testerB1.numManagedServiceFactoryUpdatedCalls );
+ }
@Test
- public void test_switch_dynamic_binding_factory() throws BundleException
+ public void test_switch_dynamic_binding_factory() throws BundleException,
IOException
{
// 1. create config with pid and locationA
// 2. update config with properties
@@ -818,11 +834,19 @@
TestCase.assertNull( testerB1.configs.get( pid ) );
TestCase.assertEquals( 0,
testerB1.numManagedServiceFactoryUpdatedCalls );
}
+
+ // 6. Update configuration now
+ config.update();
+ delay();
+
+ // ==> configuration supplied to the service ms2
+ TestCase.assertNotNull( testerB1.configs.get( pid ) );
+ TestCase.assertEquals( 1,
testerB1.numManagedServiceFactoryUpdatedCalls );
}
@Test
- public void test_switch_dynamic_binding_after_uninstall() throws
BundleException
+ public void test_switch_dynamic_binding_after_uninstall() throws
BundleException, IOException
{
// 1. create config with pid with null location
// 2. update config with properties
@@ -886,11 +910,19 @@
TestCase.assertNull( testerB1.props );
TestCase.assertEquals( 0, testerB1.numManagedServiceUpdatedCalls );
}
+
+ // 6. Update configuration now
+ config.update();
+ delay();
+
+ // ==> configuration supplied to the service ms2
+ TestCase.assertNotNull( testerB1.props );
+ TestCase.assertEquals( 1, testerB1.numManagedServiceUpdatedCalls );
}
@Test
- public void test_switch_dynamic_binding_factory_after_uninstall() throws
BundleException
+ public void test_switch_dynamic_binding_factory_after_uninstall() throws
BundleException, IOException
{
// 1. create config with pid and locationA
// 2. update config with properties
@@ -954,5 +986,13 @@
TestCase.assertNull( testerB1.configs.get( pid ) );
TestCase.assertEquals( 0,
testerB1.numManagedServiceFactoryUpdatedCalls );
}
+
+ // 6. Update configuration now
+ config.update();
+ delay();
+
+ // ==> configuration supplied to the service ms2
+ TestCase.assertNotNull( testerB1.configs.get( pid ) );
+ TestCase.assertEquals( 1,
testerB1.numManagedServiceFactoryUpdatedCalls );
}
}