@Test
public void testShareConfigurationDependencyWithMultipleServices() {
DependencyManager m = new DependencyManager(context);
// helper class that ensures certain steps get executed in sequence
Ensure e = new Ensure();
// create a service provider and consumer
Component provider = m.createComponent().setImplementation(new ConfigurationProvider(e)).add(m.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true));
ConfigurationDependency dependency = m.createConfigurationDependency().setPid("test");
Component consumer1 = m.createComponent().setImplementation(new ConfigurationConsumer(e, 2)).add(dependency);
Component consumer2 = m.createComponent().setImplementation(new ConfigurationConsumer(e, 3)).add(dependency);
// add the configuration provider that should publish the configuration as step 1
m.add(provider);
// add the first consumer, and wait until its updated() method is invoked
m.add(consumer1);
e.waitForStep(2, 15000);
// add the second consumer, and wait until its updated() method is invoked
m.add(consumer2);
e.waitForStep(3, 15000);
// break down the test again
m.remove(consumer2);
m.remove(consumer1);
m.remove(provider);