Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2013-06-27 15:44:01 +0000
committerThomas Watson2013-08-09 21:06:01 +0000
commit55f96a565cf574519f8f98173516a351cc24ac19 (patch)
treee2dcb292ba1fa97811909a49251773f94574abc9 /bundles/org.eclipse.equinox.cm.test
parentbb85ea1fe005e4e2e33c486929f70c0c8bcdd46e (diff)
downloadrt.equinox.bundles-55f96a565cf574519f8f98173516a351cc24ac19.tar.gz
rt.equinox.bundles-55f96a565cf574519f8f98173516a351cc24ac19.tar.xz
rt.equinox.bundles-55f96a565cf574519f8f98173516a351cc24ac19.zip
Implement CM spec version 1.5
Diffstat (limited to 'bundles/org.eclipse.equinox.cm.test')
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java9
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java45
2 files changed, 40 insertions, 14 deletions
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java
index 707d9d13d..ef6cd9288 100644
--- a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java
@@ -87,10 +87,10 @@ public class ManagedServiceFactoryTest extends TestCase {
synchronized (lock) {
reg2 = Activator.getBundleContext().registerService(ManagedServiceFactory.class.getName(), msf, dict);
locked = true;
- lock.wait(100);
- assertTrue(locked);
- assertEquals(1, updateCount);
- locked = false;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(2, updateCount);
}
reg.unregister();
reg2.unregister();
@@ -163,6 +163,7 @@ public class ManagedServiceFactoryTest extends TestCase {
config.delete();
config = cm.createFactoryConfiguration("test2");
+ config.update(props);
dict.put(Constants.SERVICE_PID, "test2");
synchronized (lock) {
reg.setProperties(dict);
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 e1612ed3c..29e7a6e50 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
@@ -78,10 +78,10 @@ public class ManagedServiceTest extends TestCase {
synchronized (lock) {
reg2 = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
locked = true;
- lock.wait(100);
- assertTrue(locked);
- assertEquals(1, updateCount);
- locked = false;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(2, updateCount);
}
reg.unregister();
reg2.unregister();
@@ -171,26 +171,51 @@ public class ManagedServiceTest extends TestCase {
}
String location = config.getBundleLocation();
- config.setBundleLocation("bogus");
+
+ synchronized (lock) {
+ config.setBundleLocation("bogus");
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(3, updateCount);
+ }
+
synchronized (lock) {
config.update();
locked = true;
lock.wait(100);
assertTrue(locked);
- assertEquals(2, updateCount);
+ assertEquals(3, updateCount);
locked = false;
}
- config.setBundleLocation(location);
+
+ synchronized (lock) {
+ config.setBundleLocation(location);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(4, updateCount);
+ }
dict.remove(Constants.SERVICE_PID);
synchronized (lock) {
reg.setProperties(dict);
+ locked = true;
+ lock.wait(100);
+ assertTrue(locked);
+ assertEquals(4, updateCount);
+ locked = false;
+ }
+
+ synchronized (lock) {
props.put("testkey", "testvalue2");
config.update(props);
locked = true;
lock.wait(100);
assertTrue(locked);
- assertEquals(2, updateCount);
+ assertEquals(4, updateCount);
locked = false;
}
@@ -203,7 +228,7 @@ public class ManagedServiceTest extends TestCase {
lock.wait(5000);
if (locked)
fail("should have updated");
- assertEquals(3, updateCount);
+ assertEquals(5, updateCount);
}
synchronized (lock) {
@@ -212,7 +237,7 @@ public class ManagedServiceTest extends TestCase {
lock.wait(5000);
if (locked)
fail("should have updated");
- assertEquals(4, updateCount);
+ assertEquals(6, updateCount);
}
reg.unregister();
}

Back to the top