diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/AdapterServiceTestWithPublisher.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/AdapterServiceTestWithPublisher.java
deleted file mode 100644
index fd42251..0000000
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/AdapterServiceTestWithPublisher.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.felix.dm.annotation.api.AdapterService;
-import org.apache.felix.dm.annotation.api.Component;
-import org.apache.felix.dm.annotation.api.Init;
-import org.apache.felix.dm.annotation.api.LifecycleController;
-import org.apache.felix.dm.annotation.api.Property;
-import org.apache.felix.dm.annotation.api.ServiceDependency;
-import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
-
-/**
- * Test an AdapterService which provides its interface using a @ServiceLifecycle.
- */
-public class AdapterServiceTestWithPublisher
-{
-    public interface Provider
-    {
-    }
-
-    public interface Provider2
-    {
-    }
-
-    @Component
-    public static class Consumer
-    {
-        @ServiceDependency(filter="(name=AdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-        
-        @ServiceDependency(required=false, removed = "unbind")
-        void bind(Map properties, Provider2 provider)
-        {
-            m_sequencer.step(1);
-            // check ProviderImpl properties
-            if ("bar".equals(properties.get("foo")))
-            {
-                m_sequencer.step(2);
-            }
-            // check extra ProviderImpl properties (returned by start method)
-            if ("bar2".equals(properties.get("foo2")))
-            {
-                m_sequencer.step(3);
-            }
-            // check Provider2Impl properties
-            if ("bar3".equals(properties.get("foo3")))
-            {
-                m_sequencer.step(4);
-            }
-            // check extra Provider2Impl properties (returned by start method)
-            if ("bar4".equals(properties.get("foo4")))
-            {
-                m_sequencer.step(5);
-            }
-
-        }
-
-        void unbind(Provider2 provider)
-        {
-            m_sequencer.step(6);
-        }
-    }
-    
-    @Component(properties={@Property(name="foo", value="bar")})
-    public static class ProviderImpl implements Provider
-    {
-        @Start
-        Map start()
-        {
-            // Add some extra service properties ... they will be appended to the one we have defined
-            // in the @Service annotation.
-            return new HashMap() {{ put("foo2", "bar2"); }};
-        }
-    }
-
-    @AdapterService(properties={@Property(name="foo3", value="bar3")}, adapteeService=Provider.class)
-    public static class Provider2Impl implements Provider2
-    {
-        @LifecycleController
-        Runnable m_publisher; // injected and used to register our service
-        
-        @LifecycleController(start=false)
-        Runnable m_unpublisher; // injected and used to unregister our service
-        
-        @ServiceDependency(filter="(name=AdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-
-        @Init
-        void init()
-        {
-            // register service in 1 second
-            Utils.schedule(m_publisher, 1000);
-            // unregister the service in 2 seconds
-            Utils.schedule(m_unpublisher, 2000);
-        }
-        
-        @Start
-        Map start()
-        {
-            // Add some extra service properties ... they will be appended to the one we have defined
-            // in the @Service annotation.
-            return new HashMap() {{ put("foo4", "bar4"); }};
-        }
-    }
-}
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/FactoryConfigurationAdapterServiceTestWithPublisher.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/FactoryConfigurationAdapterServiceTestWithPublisher.java
deleted file mode 100644
index 9cff105..0000000
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/FactoryConfigurationAdapterServiceTestWithPublisher.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.apache.felix.dm.annotation.api.Component;
-import org.apache.felix.dm.annotation.api.FactoryConfigurationAdapterService;
-import org.apache.felix.dm.annotation.api.Init;
-import org.apache.felix.dm.annotation.api.LifecycleController;
-import org.apache.felix.dm.annotation.api.Property;
-import org.apache.felix.dm.annotation.api.ServiceDependency;
-import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-/**
- * Test a FactoryConfigurationAdapterService which provides its interface using a @ServiceLifecycle.
- */
-public class FactoryConfigurationAdapterServiceTestWithPublisher
-{
-    public interface Provider
-    {
-    }
-
-    @Component
-    public static class Consumer
-    {
-        @ServiceDependency(filter="(name=FactoryConfigurationAdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-        
-        @ServiceDependency(required=false, removed = "unbind")
-        void bind(Map properties, Provider provider)
-        {
-            m_sequencer.step(1);
-            // check ProviderImpl properties
-            if ("bar".equals(properties.get("foo")))
-            {
-                m_sequencer.step(2);
-            }
-            // check extra ProviderImpl properties (returned by start method)
-            if ("bar2".equals(properties.get("foo2")))
-            {
-                m_sequencer.step(3);
-            }
-            // check Factory Configuration properties
-            if ("bar3".equals(properties.get("foo3")))
-            {
-                m_sequencer.step(4);
-            }
-        }
-
-        void unbind(Provider provider)
-        {
-            m_sequencer.step(5);
-        }
-    }
-    
-    @Component
-    public static class Configurator
-    {
-        @ServiceDependency
-        void bind(ConfigurationAdmin cm) throws IOException
-        {
-            Configuration cf = cm.createFactoryConfiguration("MyPid", null);
-            cf.update(new Hashtable() {{ put("foo3", "bar3"); }});
-        }
-    }
-    
-    @FactoryConfigurationAdapterService(propagate=true, properties={@Property(name="foo", value="bar")}, factoryPid="MyPid", updated="updated")
-    public static class ProviderImpl implements Provider
-    {
-        @LifecycleController
-        Runnable m_publisher; // injected and used to register our service
-        
-        @LifecycleController(start=false)
-        Runnable m_unpublisher; // injected and used to unregister our service
-        
-        @ServiceDependency(filter="(name=FactoryConfigurationAdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-
-        void updated(Dictionary conf) {
-        }
-        
-        @Init
-        void init()
-        {
-            // register service in 1 second
-            Utils.schedule(m_publisher, 1000);
-            // unregister the service in 2 seconds
-            Utils.schedule(m_unpublisher, 2000);
-        }
-        
-        @Start
-        Map start()
-        {
-            // Add some extra service properties ... they will be appended to the one we have defined
-            // in the @Service annotation.
-            return new HashMap() {{ put("foo2", "bar2"); }};
-        }
-
-    }
-}
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/FactoryServiceTestWthPublisher.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/FactoryServiceTestWthPublisher.java
deleted file mode 100644
index 488c425..0000000
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/FactoryServiceTestWthPublisher.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
-
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.felix.dm.annotation.api.Component;
-import org.apache.felix.dm.annotation.api.Init;
-import org.apache.felix.dm.annotation.api.LifecycleController;
-import org.apache.felix.dm.annotation.api.Property;
-import org.apache.felix.dm.annotation.api.ServiceDependency;
-import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
-
-/**
- * A Service instantiated from a FactorySet, and which registers/unregisters its service,
- * using the @ServiceLifecycle annotation.
- */
-public class FactoryServiceTestWthPublisher
-{
-    public interface Provider
-    {
-    }
-
-    @Component
-    public static class Consumer
-    {
-        @ServiceDependency(filter="(name=FactoryServiceTestWthPublisher)")
-        Sequencer m_sequencer;
-        
-        @ServiceDependency(required=false, removed = "unbind")
-        void bind(Map properties, Provider provider)
-        {
-            m_sequencer.step(1);
-            if ("bar".equals(properties.get("foo"))) 
-            {
-                m_sequencer.step(2);
-            }
-            if ("bar2".equals(properties.get("foo2"))) 
-            {
-                m_sequencer.step(3);
-            }
-            if ("bar3".equals(properties.get("foo3"))) 
-            {
-                m_sequencer.step(4);
-            }
-        }
-
-        void unbind(Provider provider)
-        {
-            m_sequencer.step(5);
-        }
-    }
-   
-    @Component(factorySet="MyFactory", properties={@Property(name="foo", value="bar")})
-    public static class ProviderImpl implements Provider
-    {
-        @LifecycleController
-        Runnable m_publisher; // injected and used to register our service
-        
-        @LifecycleController(start=false)
-        Runnable m_unpublisher; // injected and used to unregister our service
-        
-        @ServiceDependency(filter="(name=FactoryServiceTestWthPublisher)")
-        Sequencer m_sequencer;
-        
-        @Init
-        void init()
-        {
-            // register service in 1 second
-            Utils.schedule(m_publisher, 1000);
-            // unregister the service in 2 seconds
-            Utils.schedule(m_unpublisher, 2000);
-        }
-        
-        @Start
-        Map start()
-        {
-            // At this point, our service properties are the one specified in our @Service annotation + the one specified by our Factory.
-            // We also append an extra service property here:
-            return new HashMap() {{ put("foo3", "bar3"); }};
-        }
-    }
-    
-    @Component
-    public static class ProviderImplFactory 
-    {
-        @ServiceDependency(filter="(" + Component.FACTORY_NAME + "=MyFactory)")
-        void bind(Set<Dictionary> m_providerImplFactory)
-        {
-            m_providerImplFactory.add(new Hashtable() {{ put("foo2", "bar2"); }});
-        }
-    }
-}
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/annotation/PublisherAnnotationTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/annotation/PublisherAnnotationTest.java
deleted file mode 100644
index 8ef1b27..0000000
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/annotation/PublisherAnnotationTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.dm.test.annotation;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.test.Base;
-import org.apache.felix.dm.test.BundleGenerator;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-/**
- * Use case: Verify the @ServiceLifecycle annotation, which allows a component to activate/deactivate itself programatically.
- */
-@RunWith(JUnit4TestRunner.class)
-public class PublisherAnnotationTest extends AnnotationBase
-{
-    @Configuration
-    public static Option[] configuration()
-    {
-        return options(
-            systemProperty(DMLOG_PROPERTY).value( "true" ),
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject(),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager.runtime").versionAsInProject()),
-            provision(
-                new BundleGenerator()
-                    .set(Constants.BUNDLE_SYMBOLICNAME, "PublisherAnnotationsTest")
-                    .set("Export-Package", "org.apache.felix.dm.test.bundle.annotation.sequencer")
-                    .set("Private-Package", "org.apache.felix.dm.test.bundle.annotation.publisher")
-                    .set("Import-Package", "*")
-                    .set("-plugin", "org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin")
-                    .build()));            
-    }
-    
-    /**
-     * A Service that just registers/unregisters its service, using the @ServiceLifecycle annotation.
-     */
-    @Test
-    public void testServiceWithPublisher(BundleContext context)
-    {
-        DependencyManager m = new DependencyManager(context);
-        m.add(makeSequencer(m, "ServiceTestWthPublisher")); 
-        m_ensure.waitForStep(4, 10000);
-    }
-    
-    /**
-     * A Service instantiated from a FactorySet, and which registers/unregisters its service,
-     * using the @ServiceLifecycle annotation.
-     */
-    @Test
-    public void testFactoryServiceWithPublisher(BundleContext context)
-    {
-        DependencyManager m = new DependencyManager(context);
-        m.add(makeSequencer(m, "FactoryServiceTestWthPublisher")); 
-        m_ensure.waitForStep(5, 10000);
-    }
-
-    /**
-     * Test an AdapterService which provides its interface using a @ServiceLifecycle.
-     */
-    @Test
-    public void testAdapterServiceWithPublisher(BundleContext context)
-    {
-        DependencyManager m = new DependencyManager(context);
-        m.add(makeSequencer(m, "AdapterServiceTestWithPublisher")); 
-        m_ensure.waitForStep(6, 10000);
-    }
-
-    /**
-     * Test a BundleAdapterService which provides its interface using a @ServiceLifecycle.
-     */
-    @Test
-    public void testBundleAdapterServiceWithPublisher(BundleContext context)
-    {
-        DependencyManager m = new DependencyManager(context);
-        m.add(makeSequencer(m, "BundleAdapterServiceTestWithPublisher")); 
-        m_ensure.waitForStep(5, 10000);
-    }
-
-    /**
-     * Test a ResourceAdapterService which provides its interface using a @ServiceLifecycle.
-     */
-    @Test
-    public void TestResourceAdapterServiceWithPublisher(BundleContext context)
-    {
-        DependencyManager m = new DependencyManager(context);
-        m.add(makeSequencer(m, "ResourceAdapterServiceTestWithPublisher")); 
-        m_ensure.waitForStep(5, 10000);
-    }
-
-    /**
-     * Test a FactoryConfigurationAdapterService which provides its interface using a @ServiceLifecycle.
-     */
-    @Test
-    public void testFactoryAdapterServiceWithPublisher(BundleContext context)
-    {
-        DependencyManager m = new DependencyManager(context);
-        m.add(makeSequencer(m, "FactoryConfigurationAdapterServiceTestWithPublisher")); 
-        m_ensure.waitForStep(5, 10000);
-    }
-}
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/AdapterServiceTestWithPublisher.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/AdapterServiceTestWithPublisher.java
new file mode 100644
index 0000000..411d6d9
--- /dev/null
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/AdapterServiceTestWithPublisher.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dependencymanager.test2.components;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.felix.dm.annotation.api.AdapterService;
+import org.apache.felix.dm.annotation.api.Component;
+import org.apache.felix.dm.annotation.api.Init;
+import org.apache.felix.dm.annotation.api.LifecycleController;
+import org.apache.felix.dm.annotation.api.Property;
+import org.apache.felix.dm.annotation.api.ServiceDependency;
+import org.apache.felix.dm.annotation.api.Start;
+
+/**
+ * Test an AdapterService which provides its interface using a @ServiceLifecycle.
+ */
+public class AdapterServiceTestWithPublisher {
+    public static final String ENSURE = "AdapterServiceTestWithPublisher";
+
+    public interface Provider {
+    }
+
+    public interface Provider2 {
+    }
+
+    @Component
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(required = false, removed = "unbind")
+        void bind(Map properties, Provider2 provider) {
+            m_sequencer.step(1);
+            // check ProviderImpl properties
+            if ("bar".equals(properties.get("foo"))) {
+                m_sequencer.step(2);
+            }
+            // check extra ProviderImpl properties (returned by start method)
+            if ("bar2".equals(properties.get("foo2"))) {
+                m_sequencer.step(3);
+            }
+            // check Provider2Impl properties
+            if ("bar3".equals(properties.get("foo3"))) {
+                m_sequencer.step(4);
+            }
+            // check extra Provider2Impl properties (returned by start method)
+            if ("bar4".equals(properties.get("foo4"))) {
+                m_sequencer.step(5);
+            }
+
+        }
+
+        void unbind(Provider2 provider) {
+            m_sequencer.step(6);
+        }
+    }
+
+    @Component(properties = {@Property(name = "foo", value = "bar")})
+    public static class ProviderImpl implements Provider {
+        @Start
+        Map start() {
+            // Add some extra service properties ... they will be appended to the one we have defined
+            // in the @Service annotation.
+            return new HashMap() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
+        }
+    }
+
+    @AdapterService(properties = {@Property(name = "foo3", value = "bar3")}, adapteeService = Provider.class)
+    public static class Provider2Impl implements Provider2 {
+        @LifecycleController
+        volatile Runnable m_publisher; // injected and used to register our service
+
+        @LifecycleController(start = false)
+        volatile Runnable m_unpublisher; // injected and used to unregister our service
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Init
+        void init() {
+            // register service in 1 second
+            Utils.schedule(m_publisher, 1000);
+            // unregister the service in 2 seconds
+            Utils.schedule(m_unpublisher, 2000);
+        }
+
+        @Start
+        Map start() {
+            // Add some extra service properties ... they will be appended to the one we have defined
+            // in the @Service annotation.
+            return new HashMap() {
+                {
+                    put("foo4", "bar4");
+                }
+            };
+        }
+    }
+}
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/BundleAdapterServiceTestWithPublisher.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/BundleAdapterServiceTestWithPublisher.java
similarity index 60%
rename from dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/BundleAdapterServiceTestWithPublisher.java
rename to dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/BundleAdapterServiceTestWithPublisher.java
index e92b4f5..5f3a138 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/BundleAdapterServiceTestWithPublisher.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/BundleAdapterServiceTestWithPublisher.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
+package org.apache.felix.dependencymanager.test2.components;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -28,41 +28,35 @@
 import org.apache.felix.dm.annotation.api.Property;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
 import org.osgi.framework.Bundle;
 
 /**
  * Test a BundleAdapterService which provides its interface using a @ServiceLifecycle.
  */
-public class BundleAdapterServiceTestWithPublisher
-{
-    public interface Provider
-    {
+public class BundleAdapterServiceTestWithPublisher {
+    public static final String ENSURE = "BundleAdapterServiceTestWithPublisher";
+
+    public interface Provider {
     }
 
     @Component
-    public static class Consumer
-    {
-        @ServiceDependency(filter="(name=BundleAdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-        
-        @ServiceDependency(required=false, removed = "unbind")
-        void bind(Map properties, Provider provider)
-        {
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(required = false, removed = "unbind")
+        void bind(Map properties, Provider provider) {
             m_sequencer.step(1);
             // check ProviderImpl properties
-            if ("bar".equals(properties.get("foo")))
-            {
+            if ("bar".equals(properties.get("foo"))) {
                 m_sequencer.step(2);
             }
             // check extra ProviderImpl properties (returned by start method)
-            if ("bar2".equals(properties.get("foo2")))
-            {
+            if ("bar2".equals(properties.get("foo2"))) {
                 m_sequencer.step(3);
             }
             // check properties propagated from bundle
-            if ("org.apache.felix.dependencymanager".equals(properties.get("Bundle-SymbolicName"))) 
-            {
+            if ("org.apache.felix.dependencymanager".equals(properties.get("Bundle-SymbolicName"))) {
                 m_sequencer.step(4);
             } else {
                 Thread.dumpStack();
@@ -70,42 +64,40 @@
             }
         }
 
-        void unbind(Provider provider)
-        {
+        void unbind(Provider provider) {
             m_sequencer.step(5);
         }
     }
-    
-    @BundleAdapterService(properties={@Property(name="foo", value="bar")},
-                          filter = "(Bundle-SymbolicName=org.apache.felix.dependencymanager)",
-                          stateMask = Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE,
-                          propagate = true)
-    public static class ProviderImpl implements Provider
-    {
+
+    @BundleAdapterService(properties = {@Property(name = "foo", value = "bar")}, filter = "(Bundle-SymbolicName=org.apache.felix.dependencymanager)", stateMask = Bundle.INSTALLED
+            | Bundle.RESOLVED | Bundle.ACTIVE, propagate = true)
+    public static class ProviderImpl implements Provider {
         @LifecycleController
-        Runnable m_publisher; // injected and used to register our service
-        
-        @LifecycleController(start=false)
-        Runnable m_unpublisher; // injected and used to unregister our service
-        
-        @ServiceDependency(filter="(name=BundleAdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
+        volatile Runnable m_publisher; // injected and used to register our service
+
+        @LifecycleController(start = false)
+        volatile Runnable m_unpublisher; // injected and used to unregister our service
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
 
         @Init
-        void init()
-        {
+        void init() {
             // register service in 1 second
             Utils.schedule(m_publisher, 1000);
             // unregister the service in 2 seconds
             Utils.schedule(m_unpublisher, 2000);
         }
-        
+
         @Start
-        Map start()
-        {
+        Map start() {
             // Add some extra service properties ... they will be appended to the one we have defined
             // in the @Service annotation.
-            return new HashMap() {{ put("foo2", "bar2"); }};
+            return new HashMap() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
         }
     }
 }
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAdapterServiceProperties.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAdapterServiceProperties.java
index ccba089..844d730 100644
--- a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAdapterServiceProperties.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAdapterServiceProperties.java
@@ -32,6 +32,8 @@
  * from it's start callback
  */
 public class ExtraAdapterServiceProperties {
+    public final static String ENSURE = "ExtraAdapterServiceProperties";
+
     public interface Provider {
     }
 
@@ -58,7 +60,7 @@
 
     @Component
     public static class Consumer {
-        @ServiceDependency(filter = "(name=testExtraAdapterServiceProperties)")
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
         volatile Ensure m_sequencer;
 
         private volatile Map m_properties;
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAspectServiceProperties.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAspectServiceProperties.java
index 7b2c7c6..3b0b40d 100644
--- a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAspectServiceProperties.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraAspectServiceProperties.java
@@ -32,6 +32,8 @@
  * from it's start callback
  */
 public class ExtraAspectServiceProperties {
+    public final static String ENSURE = "ExtraAspectServiceProperties";
+
     public interface Provider {
     }
 
@@ -53,7 +55,7 @@
 
     @Component
     public static class Consumer {
-        @ServiceDependency(filter = "(name=testExtraAspectServiceProperties)")
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
         volatile Ensure m_sequencer;
 
         private volatile Map m_properties;
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraFactoryServiceProperties.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraFactoryServiceProperties.java
index a39b5f3..e233acd 100644
--- a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraFactoryServiceProperties.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraFactoryServiceProperties.java
@@ -30,10 +30,13 @@
 import org.apache.felix.dm.annotation.api.Start;
 
 public class ExtraFactoryServiceProperties {
+    public final static String FACTORYSET = "ExtraFactoryServiceProperties.FACTORYSET";
+    public final static String ENSURE = "ExtraFactoryServiceProperties";
+
     public interface Provider {
     }
 
-    @Component(properties = {@Property(name = "foo", value = "bar")}, factorySet = "MyFactory")
+    @Component(properties = {@Property(name = "foo", value = "bar")}, factorySet = FACTORYSET)
     public static class ProviderImpl implements Provider {
         @Start
         Map<String, String> start() {
@@ -47,7 +50,7 @@
 
     @Component
     public static class ProviderImplFactory {
-        @ServiceDependency
+        @ServiceDependency(filter = "(" + Component.FACTORY_NAME + "=" + FACTORYSET + ")")
         volatile Set<Dictionary> m_factory;
 
         @Start
@@ -62,7 +65,7 @@
 
     @Component
     public static class Consumer {
-        @ServiceDependency(filter = "(name=testExtraFactoryServiceProperties)")
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
         volatile Ensure m_sequencer;
 
         private volatile Map m_properties;
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraServiceProperties.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraServiceProperties.java
index 530aa7a..5f931e4 100644
--- a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraServiceProperties.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ExtraServiceProperties.java
@@ -31,6 +31,8 @@
  * from it's start callback
  */
 public class ExtraServiceProperties {
+    public final static String ENSURE = "ExtraServiceProperties";
+    
     public interface Provider {
     }
 
@@ -48,7 +50,7 @@
 
     @Component
     public static class Consumer {
-        @ServiceDependency(filter = "(name=testExtraServiceProperties)")
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
         volatile Ensure m_sequencer;
 
         private volatile Map m_properties;
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/FactoryConfigurationAdapterServiceTestWithPublisher.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/FactoryConfigurationAdapterServiceTestWithPublisher.java
new file mode 100644
index 0000000..1dff92a
--- /dev/null
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/FactoryConfigurationAdapterServiceTestWithPublisher.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dependencymanager.test2.components;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.felix.dm.annotation.api.Component;
+import org.apache.felix.dm.annotation.api.FactoryConfigurationAdapterService;
+import org.apache.felix.dm.annotation.api.Init;
+import org.apache.felix.dm.annotation.api.LifecycleController;
+import org.apache.felix.dm.annotation.api.Property;
+import org.apache.felix.dm.annotation.api.ServiceDependency;
+import org.apache.felix.dm.annotation.api.Start;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+/**
+ * Test a FactoryConfigurationAdapterService which provides its interface using a @ServiceLifecycle.
+ */
+public class FactoryConfigurationAdapterServiceTestWithPublisher {
+    public final static String PID="FactoryConfigurationAdapterServiceTestWithPublisher.PID";
+    public final static String ENSURE = "FactoryConfigurationAdapterServiceTestWithPublisher";
+    
+    public interface Provider {
+    }
+
+    @Component
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(required = false, removed = "unbind")
+        void bind(Map properties, Provider provider) {
+            m_sequencer.step(1);
+            // check ProviderImpl properties
+            if ("bar".equals(properties.get("foo"))) {
+                m_sequencer.step(2);
+            }
+            // check extra ProviderImpl properties (returned by start method)
+            if ("bar2".equals(properties.get("foo2"))) {
+                m_sequencer.step(3);
+            }
+            // check Factory Configuration properties
+            if ("bar3".equals(properties.get("foo3"))) {
+                m_sequencer.step(4);
+            }
+        }
+
+        void unbind(Provider provider) {
+            m_sequencer.step(5);
+        }
+    }
+
+    @Component
+    public static class Configurator {
+        @ServiceDependency
+        void bind(ConfigurationAdmin cm) throws IOException {
+            Configuration cf = cm.createFactoryConfiguration(PID, null);
+            cf.update(new Hashtable() {
+                {
+                    put("foo3", "bar3");
+                }
+            });
+        }
+    }
+
+    @FactoryConfigurationAdapterService(propagate = true, properties = {@Property(name = "foo", value = "bar")}, factoryPid = PID, updated = "updated")
+    public static class ProviderImpl implements Provider {
+        @LifecycleController
+        volatile Runnable m_publisher; // injected and used to register our service
+
+        @LifecycleController(start = false)
+        volatile Runnable m_unpublisher; // injected and used to unregister our service
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        void updated(Dictionary conf) {
+        }
+
+        @Init
+        void init() {
+            // register service in 1 second
+            Utils.schedule(m_publisher, 1000);
+            // unregister the service in 2 seconds
+            Utils.schedule(m_unpublisher, 2000);
+        }
+
+        @Start
+        Map start() {
+            // Add some extra service properties ... they will be appended to the one we have defined
+            // in the @Service annotation.
+            return new HashMap() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
+        }
+
+    }
+}
diff --git a/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/FactoryServiceTestWthPublisher.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/FactoryServiceTestWthPublisher.java
new file mode 100644
index 0000000..31af18e
--- /dev/null
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/FactoryServiceTestWthPublisher.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dependencymanager.test2.components;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.felix.dm.annotation.api.Component;
+import org.apache.felix.dm.annotation.api.Init;
+import org.apache.felix.dm.annotation.api.LifecycleController;
+import org.apache.felix.dm.annotation.api.Property;
+import org.apache.felix.dm.annotation.api.ServiceDependency;
+import org.apache.felix.dm.annotation.api.Start;
+
+/**
+ * A Service instantiated from a FactorySet, and which registers/unregisters its service,
+ * using the @ServiceLifecycle annotation.
+ */
+public class FactoryServiceTestWthPublisher {
+    public final static String FACTORY_SET = "FactoryServiceTestWthPublisher.FACTORYSET";
+    public final static String ENSURE = "FactoryServiceTestWthPublisher";
+    
+    public interface Provider {
+    }
+
+    @Component
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(required = false, removed = "unbind")
+        void bind(Map properties, Provider provider) {
+            System.out.println("BIND: " + provider + ", map=" + properties);
+            m_sequencer.step(1);
+            if ("bar".equals(properties.get("foo"))) {
+                m_sequencer.step(2);
+            }
+            if ("bar2".equals(properties.get("foo2"))) {
+                m_sequencer.step(3);
+            }
+            if ("bar3".equals(properties.get("foo3"))) {
+                m_sequencer.step(4);
+            }
+        }
+
+        void unbind(Provider provider) {
+            m_sequencer.step(5);
+        }
+    }
+
+    @Component(factorySet = FACTORY_SET, properties = {@Property(name = "foo", value = "bar")})
+    public static class ProviderImpl implements Provider {
+        @LifecycleController
+        volatile Runnable m_publisher; // injected and used to register our service
+
+        @LifecycleController(start = false)
+        volatile Runnable m_unpublisher; // injected and used to unregister our service
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Init
+        void init() {
+            // register service in 1 second
+            Utils.schedule(m_publisher, 1000);
+            // unregister the service in 2 seconds
+            Utils.schedule(m_unpublisher, 2000);
+        }
+
+        @Start
+        Map start() {
+            // At this point, our service properties are the one specified in our @Service annotation + the one specified by our Factory.
+            // We also append an extra service property here:
+            return new HashMap() {
+                {
+                    put("foo3", "bar3");
+                }
+            };
+        }
+    }
+
+    @Component
+    public static class ProviderImplFactory {
+        @ServiceDependency(filter = "(" + Component.FACTORY_NAME + "=" + FACTORY_SET + ")")
+        void bind(Set<Dictionary> m_providerImplFactory) {
+            m_providerImplFactory.add(new Hashtable() {
+                {
+                    put("foo2", "bar2");
+                }
+            });
+        }
+    }
+}
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/ResourceAdapterServiceTestWithPublisher.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ResourceAdapterServiceTestWithPublisher.java
similarity index 65%
rename from dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/ResourceAdapterServiceTestWithPublisher.java
rename to dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ResourceAdapterServiceTestWithPublisher.java
index 45a1f46..c62af10 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/ResourceAdapterServiceTestWithPublisher.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ResourceAdapterServiceTestWithPublisher.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
+package org.apache.felix.dependencymanager.test2.components;
 
 import java.net.URL;
 import java.util.HashMap;
@@ -36,7 +36,6 @@
 import org.apache.felix.dm.annotation.api.ResourceAdapterService;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
@@ -44,94 +43,76 @@
 /**
  * Test a ResourceAdapterService which provides its interface using a @ServiceLifecycle.
  */
-public class ResourceAdapterServiceTestWithPublisher
-{
-    public interface Provider
-    {
+public class ResourceAdapterServiceTestWithPublisher {
+    public static final String ENSURE = "ResourceAdapterServiceTestWithPublisher";
+
+    public interface Provider {
     }
 
     @Component
-    public static class Consumer
-    {
-        @ServiceDependency(filter="(name=ResourceAdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-        
-        @ServiceDependency(required=false, removed = "unbind")
-        void bind(Map properties, Provider provider)
-        {
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(required = false, removed = "unbind")
+        void bind(Map properties, Provider provider) {
             m_sequencer.step(1);
             // check ProviderImpl properties
-            if ("bar".equals(properties.get("foo")))
-            {
+            if ("bar".equals(properties.get("foo"))) {
                 m_sequencer.step(2);
             }
             // check extra ProviderImpl properties (returned by start method)
-            if ("bar2".equals(properties.get("foo2")))
-            {
+            if ("bar2".equals(properties.get("foo2"))) {
                 m_sequencer.step(3);
             }
             // check properties propagated by the resource adapter
-            if ("/path/to/test1.txt".equals(properties.get(ResourceHandler.PATH)))
-            { 
+            if ("/path/to/test1.txt".equals(properties.get(ResourceHandler.PATH))) {
                 m_sequencer.step(4);
             }
-            if ("localhost".equals(properties.get(ResourceHandler.HOST)))
-            {
+            if ("localhost".equals(properties.get(ResourceHandler.HOST))) {
                 m_sequencer.step(5);
             }
         }
 
-        void unbind(Provider provider)
-        {
+        void unbind(Provider provider) {
             m_sequencer.step(6);
         }
     }
-    
+
     @Component
-    public static class ResourceProvider
-    {
+    public static class ResourceProvider {
         @Inject
         private volatile BundleContext m_context;
         private final Map m_handlers = new HashMap();
         private URL[] m_resources;
-        
+
         public ResourceProvider() throws Exception {
-            m_resources = new URL[] {
-                new URL("file://localhost/path/to/test1.txt"),
-                new URL("file://localhost/path/to/test2.txt"),
-                new URL("file://localhost/path/to/README.doc")
-                };
+            m_resources = new URL[]{new URL("file://localhost/path/to/test1.txt"),
+                    new URL("file://localhost/path/to/test2.txt"), new URL("file://localhost/path/to/README.doc")};
         }
-        
+
         /**
          * Handles a new Resource consumer
          * @param serviceProperties
          * @param handler
          */
-        @ServiceDependency(removed = "remove", required=false)
-        public void add(Map serviceProperties, ResourceHandler handler)
-        {        
+        @ServiceDependency(removed = "remove", required = false)
+        public void add(Map serviceProperties, ResourceHandler handler) {
             String filterString = (String) serviceProperties.get("filter");
             Filter filter = null;
             if (filterString != null) {
-                try
-                {
+                try {
                     filter = m_context.createFilter(filterString);
-                }
-                catch (InvalidSyntaxException e)
-                {
+                } catch (InvalidSyntaxException e) {
                     Assert.fail("Could not create filter for resource handler: " + e);
                     return;
                 }
             }
-            synchronized (m_handlers)
-            {
+            synchronized (m_handlers) {
                 m_handlers.put(handler, filter);
             }
-            for (int i = 0; i < m_resources.length; i++)
-            {
-                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i])))
-                {
+            for (int i = 0; i < m_resources.length; i++) {
+                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                     handler.added(m_resources[i]);
                 }
             }
@@ -141,22 +122,17 @@
          * Remove a Resource consumer.bar
          * @param handler
          */
-        public void remove(ResourceHandler handler)
-        {
+        public void remove(ResourceHandler handler) {
             Filter filter;
-            synchronized (m_handlers)
-            {
+            synchronized (m_handlers) {
                 filter = (Filter) m_handlers.remove(handler);
             }
             removeResources(handler, filter);
         }
 
-        private void removeResources(ResourceHandler handler, Filter filter)
-        {
-            for (int i = 0; i < m_resources.length; i++)
-            {
-                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i])))
-                {
+        private void removeResources(ResourceHandler handler, Filter filter) {
+            for (int i = 0; i < m_resources.length; i++) {
+                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
                     handler.removed(m_resources[i]);
                 }
             }
@@ -167,52 +143,48 @@
          * provide our Resources anymore.
          */
         @Destroy
-        public void destroy()
-        {
+        public void destroy() {
             Entry[] handlers;
-            synchronized (m_handlers)
-            {
+            synchronized (m_handlers) {
                 handlers = (Entry[]) m_handlers.entrySet().toArray(new Entry[m_handlers.size()]);
             }
-            for (int i = 0; i < handlers.length; i++)
-            {
+            for (int i = 0; i < handlers.length; i++) {
                 removeResources((ResourceHandler) handlers[i].getKey(), (Filter) handlers[i].getValue());
             }
         }
     }
-    
-    @ResourceAdapterService(filter = "(&(path=/path/to/test1.txt)(host=localhost))", 
-                            properties = {@Property(name="foo", value="bar")},
-                            propagate = true)
-    public static class ProviderImpl implements Provider
-    {
+
+    @ResourceAdapterService(filter = "(&(path=/path/to/test1.txt)(host=localhost))", properties = {@Property(name = "foo", value = "bar")}, propagate = true)
+    public static class ProviderImpl implements Provider {
         @LifecycleController
-        Runnable m_publisher; // injected and used to register our service
-        
-        @LifecycleController(start=false)
-        Runnable m_unpublisher; // injected and used to unregister our service
-        
-        @ServiceDependency(filter="(name=ResourceAdapterServiceTestWithPublisher)")
-        Sequencer m_sequencer;
-  
+        volatile Runnable m_publisher; // injected and used to register our service
+
+        @LifecycleController(start = false)
+        volatile Runnable m_unpublisher; // injected and used to unregister our service
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
         // Injected by reflection
-        URL m_resource;
+        volatile URL m_resource;
 
         @Init
-        void init()
-        {
+        void init() {
             // register service in 1 second
             Utils.schedule(m_publisher, 1000);
             // unregister the service in 2 seconds
             Utils.schedule(m_unpublisher, 2000);
         }
-        
+
         @Start
-        Map start()
-        {
+        Map start() {
             // Add some extra service properties ... they will be appended to the one we have defined
             // in the @Service annotation.
-            return new HashMap() {{ put("foo2", "bar2"); }};
+            return new HashMap() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
         }
     }
 }
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/ServiceTestWthPublisher.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ServiceTestWthPublisher.java
similarity index 60%
rename from dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/ServiceTestWthPublisher.java
rename to dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ServiceTestWthPublisher.java
index bfdddb4..d834619 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/ServiceTestWthPublisher.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/ServiceTestWthPublisher.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
+package org.apache.felix.dependencymanager.test2.components;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -27,70 +27,65 @@
 import org.apache.felix.dm.annotation.api.Property;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
 
 /**
  * A Service that just registers/unregisters its service, using the @ServiceLifecycle annotation.
  */
-public class ServiceTestWthPublisher
-{
-    public interface Provider
-    {
+public class ServiceTestWthPublisher {
+    public final static String ENSURE = "ServiceTestWthPublisher";
+    
+    public interface Provider {
     }
 
     @Component
-    public static class Consumer
-    {
-        @ServiceDependency(filter="(name=ServiceTestWthPublisher)")
-        Sequencer m_sequencer;
-        
-        @ServiceDependency(required=false, removed = "unbind")
-        void bind(Map properties, Provider provider)
-        {
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(required = false, removed = "unbind")
+        void bind(Map properties, Provider provider) {
             m_sequencer.step(1);
-            if ("bar".equals(properties.get("foo")))
-            {
+            if ("bar".equals(properties.get("foo"))) {
                 m_sequencer.step(2);
             }
-            if ("bar2".equals(properties.get("foo2")))
-            {
+            if ("bar2".equals(properties.get("foo2"))) {
                 m_sequencer.step(3);
             }
         }
 
-        void unbind(Provider provider)
-        {
+        void unbind(Provider provider) {
             m_sequencer.step(4);
         }
     }
-    
-    @Component(properties={@Property(name="foo", value="bar")})
-    public static class ProviderImpl implements Provider
-    {
+
+    @Component(properties = {@Property(name = "foo", value = "bar")})
+    public static class ProviderImpl implements Provider {
         @LifecycleController
-        Runnable m_publisher; // injected and used to register our service
-        
-        @LifecycleController(start=false)
-        Runnable m_unpublisher; // injected and used to unregister our service
-        
-        @ServiceDependency(filter="(name=ServiceTestWthPublisher)")
-        Sequencer m_sequencer;
+        volatile Runnable m_publisher; // injected and used to register our service
+
+        @LifecycleController(start = false)
+        volatile Runnable m_unpublisher; // injected and used to unregister our service
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
 
         @Init
-        void init()
-        {
+        void init() {
             // register service in 1 second
             Utils.schedule(m_publisher, 1000);
             // unregister the service in 2 seconds
             Utils.schedule(m_unpublisher, 2000);
         }
-        
+
         @Start
-        Map start()
-        {
+        Map start() {
             // Add some extra service properties ... they will be appended to the one we have defined
             // in the @Service annotation.
-            return new HashMap() {{ put("foo2", "bar2"); }};
+            return new HashMap() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
         }
     }
 }
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/Utils.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/Utils.java
similarity index 81%
rename from dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/Utils.java
rename to dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/Utils.java
index 0ec0cfb..aec4356 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/publisher/Utils.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/Utils.java
@@ -16,21 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test.bundle.annotation.publisher;
+package org.apache.felix.dependencymanager.test2.components;
 
-public class Utils
-{
-    public static void schedule(final Runnable task, final long n)
-    {
+public class Utils {
+    public static void schedule(final Runnable task, final long n) {
         Thread t = new Thread() {
-            public void run()
-            {
-                try
-                {
+            public void run() {
+                try {
                     sleep(n);
-                }
-                catch (InterruptedException e)
-                {
+                } catch (InterruptedException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                 }
diff --git a/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/ExtraServicePropertiesTest.java b/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/ExtraServicePropertiesTest.java
index b5f1060..1707d0a 100644
--- a/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/ExtraServicePropertiesTest.java
+++ b/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/ExtraServicePropertiesTest.java
@@ -19,6 +19,10 @@
 package org.apache.felix.dependencymanager.test2.integration.annotations;
 
 import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.components.ExtraAdapterServiceProperties;
+import org.apache.felix.dependencymanager.test2.components.ExtraAspectServiceProperties;
+import org.apache.felix.dependencymanager.test2.components.ExtraFactoryServiceProperties;
+import org.apache.felix.dependencymanager.test2.components.ExtraServiceProperties;
 import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -36,7 +40,7 @@
     @Test
     public void testExtraServiceProperties() {
         Ensure e = new Ensure();
-        ServiceRegistration sr = register(e, "testExtraServiceProperties");
+        ServiceRegistration sr = register(e, ExtraServiceProperties.ENSURE);
         e.waitForStep(2, 10000);
         sr.unregister();
     }
@@ -47,7 +51,7 @@
     @Test
     public void testExtraFactoryServiceProperties() {
         Ensure e = new Ensure();
-        ServiceRegistration sr = register(e, "testExtraFactoryServiceProperties");
+        ServiceRegistration sr = register(e, ExtraFactoryServiceProperties.ENSURE);
         e.waitForStep(3, 10000);
         sr.unregister();
     }
@@ -58,7 +62,7 @@
     @Test
     public void testExtraAdapterServiceProperties() {
         Ensure e = new Ensure();
-        ServiceRegistration sr = register(e, "testExtraAdapterServiceProperties");
+        ServiceRegistration sr = register(e, ExtraAdapterServiceProperties.ENSURE);
         e.waitForStep(3, 10000);
         sr.unregister();
     }
@@ -69,7 +73,7 @@
     @Test
     public void testExtraAspectServiceProperties() {
         Ensure e = new Ensure();
-        ServiceRegistration sr = register(e, "testExtraAspectServiceProperties");
+        ServiceRegistration sr = register(e, ExtraAspectServiceProperties.ENSURE);
         e.waitForStep(3, 10000);
         sr.unregister();
     }
diff --git a/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/PublisherAnnotationTest.java b/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/PublisherAnnotationTest.java
new file mode 100644
index 0000000..84c0685
--- /dev/null
+++ b/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/PublisherAnnotationTest.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dependencymanager.test2.integration.annotations;
+
+import org.apache.felix.dependencymanager.test2.components.AdapterServiceTestWithPublisher;
+import org.apache.felix.dependencymanager.test2.components.BundleAdapterServiceTestWithPublisher;
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.components.FactoryConfigurationAdapterServiceTestWithPublisher;
+import org.apache.felix.dependencymanager.test2.components.FactoryServiceTestWthPublisher;
+import org.apache.felix.dependencymanager.test2.components.ResourceAdapterServiceTestWithPublisher;
+import org.apache.felix.dependencymanager.test2.components.ServiceTestWthPublisher;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.ServiceRegistration;
+
+@RunWith(PaxExam.class)
+public class PublisherAnnotationTest extends TestBase {
+    /**
+     * A Service that just registers/unregisters its service, using the @ServiceLifecycle annotation.
+     */
+    @Test
+    public void testServiceWithPublisher() {
+        Ensure e = new Ensure();
+        ServiceRegistration sr = register(e, ServiceTestWthPublisher.ENSURE);
+        e.waitForStep(4, 10000);
+        sr.unregister();
+    }
+
+    /**
+     * A Service instantiated from a FactorySet, and which registers/unregisters its service,
+     * using the @ServiceLifecycle annotation.
+     */
+    @Test
+    public void testFactoryServiceWithPublisher() {
+        Ensure e = new Ensure();
+        ServiceRegistration sr = register(e, FactoryServiceTestWthPublisher.ENSURE);
+        e.waitForStep(5, 10000);
+        sr.unregister();
+    }
+
+    /**
+     * Test an AdapterService which provides its interface using a @ServiceLifecycle.
+     */
+    @Test
+    public void testAdapterServiceWithPublisher() {
+        Ensure e = new Ensure();
+        ServiceRegistration sr = register(e, AdapterServiceTestWithPublisher.ENSURE);
+        e.waitForStep(6, 10000);
+        sr.unregister();
+    }
+
+    /**
+     * Test a BundleAdapterService which provides its interface using a @ServiceLifecycle.
+     */
+    @Test
+    public void testBundleAdapterServiceWithPublisher() {
+        Ensure e = new Ensure();
+        ServiceRegistration sr = register(e, BundleAdapterServiceTestWithPublisher.ENSURE);
+        e.waitForStep(5, 10000);
+        sr.unregister();
+    }
+
+    /**
+     * Test a ResourceAdapterService which provides its interface using a @ServiceLifecycle.
+     */
+    @Test
+    public void TestResourceAdapterServiceWithPublisher() {
+        Ensure e = new Ensure();
+        ServiceRegistration sr = register(e, ResourceAdapterServiceTestWithPublisher.ENSURE);
+        e.waitForStep(5, 10000);
+        sr.unregister();
+    }
+
+    /**
+     * Test a FactoryConfigurationAdapterService which provides its interface using a @ServiceLifecycle.
+     */
+    @Test
+    public void testFactoryAdapterServiceWithPublisher() {
+        Ensure e = new Ensure();
+        ServiceRegistration sr = register(e, FactoryConfigurationAdapterServiceTestWithPublisher.ENSURE);
+        e.waitForStep(5, 10000);
+        sr.unregister();
+    }
+}
