You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2009/08/14 23:52:54 UTC
svn commit: r804391 -
/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationTest.java
Author: fmeschbe
Date: Fri Aug 14 21:52:54 2009
New Revision: 804391
URL: http://svn.apache.org/viewvc?rev=804391&view=rev
Log:
FELIX-1165 Integration test ensuring ManagedService reconfiguration
after bundle restart if configuration is created before first
ManagedService registration
Modified:
felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationTest.java
Modified: felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationTest.java?rev=804391&r1=804390&r2=804391&view=diff
==============================================================================
--- felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationTest.java (original)
+++ felix/trunk/configadmin/src/test/java/org/apache/felix/cm/integration/ConfigurationTest.java Fri Aug 14 21:52:54 2009
@@ -226,6 +226,57 @@
}
+
+
+ @Test
+ public void test_configure_start_bundle_stop_start_bundle() throws IOException, BundleException
+ {
+ String pid = "test_configure_start_bundle_stop_start_bundle";
+ configure( pid );
+
+ // start the bundle and assert this
+ bundle = installBundle( pid );
+ bundle.start();
+ final TestActivator tester = TestActivator.INSTANCE;
+ TestCase.assertNotNull( "Activator not started !!", tester );
+
+ // give cm time for distribution
+ delay();
+
+ // assert activater has configuration
+ TestCase.assertNotNull( "Expect Properties after Service Registration", tester.props );
+ TestCase.assertEquals( "Expect no update call", 1, tester.numUpdatedCalls );
+
+ // stop the bundle now
+ bundle.stop();
+
+ // assert INSTANCE is null
+ TestCase.assertNull( TestActivator.INSTANCE );
+
+ delay();
+
+ // start the bundle again (and check)
+ bundle.start();
+ final TestActivator tester2 = TestActivator.INSTANCE;
+ TestCase.assertNotNull( "Activator not started the second time!!", tester2 );
+ TestCase.assertNotSame( "Instances must not be the same", tester, tester2 );
+
+ // give cm time for distribution
+ delay();
+
+ // assert activater has configuration
+ TestCase.assertNotNull( "Expect Properties after Service Registration", tester2.props );
+ TestCase.assertEquals( "Expect a second update call", 1, tester2.numUpdatedCalls );
+
+ // cleanup
+ bundle.uninstall();
+ bundle = null;
+
+ // remove the configuration for good
+ deleteConfig( pid );
+ }
+
+
/*
@Test
public void test_() throws BundleException