You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/05/14 17:51:26 UTC

svn commit: r1594622 [1/2] - in /felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it: components/ tests/

Author: pderop
Date: Wed May 14 15:51:25 2014
New Revision: 1594622

URL: http://svn.apache.org/r1594622
Log:
added the remaining dm.runtime tests (excepts aspect tests)

Added:
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterServiceTestWithPublisher.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleAdapterServiceTestWithPublisher.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleDependencyAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/CompositeAnnotations.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraAdapterServiceProperties.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraFactoryServiceProperties.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraServiceProperties.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterServiceTestWithPublisher.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryServiceTestWthPublisher.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4050.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4357.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/MultipleAnnotations.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/PropagateAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ResourceAdapterServiceTestWithPublisher.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ResourceAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ServiceFactoryAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ServiceTestWthPublisher.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/TemporalAnnotations.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Utils.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/AdapterAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/BundleDependencyAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/CompositeAnnotationsTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/ExtraServicePropertiesTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/FactoryConfigurationAdapterAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/Felix4050Test.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/Felix4357Test.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/MultipleAnnotationsTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/PropagateAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/PublisherAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/ResourceAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/ServiceFactoryAnnotationTest.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/tests/TemporalAnnotationsTest.java

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterAnnotation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterAnnotation.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterAnnotation.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterAnnotation.java Wed May 14 15:51:25 2014
@@ -0,0 +1,198 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+
+import dm.DependencyManager;
+import dm.annotation.api.AdapterService;
+import dm.annotation.api.Component;
+import dm.annotation.api.Inject;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+public class AdapterAnnotation {
+    public interface S1 {
+        public void run();
+    }
+
+    public interface S2 {
+        public void run2();
+    }
+
+    public interface S3 {
+        public void run3();
+    }
+
+    @Component
+    public static class S3Consumer {
+        private volatile Map<String, String> m_serviceProperties;
+        private volatile S3 m_s3;
+
+        @ServiceDependency
+        void bind(Map<String, String> serviceProperties, S3 s3) {
+            m_serviceProperties = serviceProperties;
+            m_s3 = s3;
+        }
+
+        @Start
+        void start() {
+            // The adapter service must inherit from adaptee service properties ...
+            if ("value1".equals(m_serviceProperties.get("param1")) // adaptee properties
+                && "true".equals(m_serviceProperties.get("adapter"))) // adapter properties
+            {
+                m_s3.run3();
+            }
+        }
+    }
+
+    @AdapterService(adapteeService = S1.class, properties = { @Property(name = "adapter", value = "true") })
+    public static class S1ToS3AdapterAutoConfig implements S3 {
+        public static final String ENSURE = "AdapterAnnotation.autoConfig";
+
+        // This is the adapted service
+        protected volatile S1 m_s1;
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        protected volatile Ensure m_sequencer;
+
+        // Check auto config injections
+        @Inject
+        volatile BundleContext m_bc;
+        BundleContext m_bcNotInjected;
+
+        @Inject
+        volatile DependencyManager m_dm;
+        DependencyManager m_dmNotInjected;
+
+        @Inject
+        volatile dm.Component m_component;
+        dm.Component m_componentNotInjected;
+
+        public void run3() {
+            checkInjectedFields();
+            m_s1.run();
+            m_sequencer.step(3);
+        }
+
+        private void checkInjectedFields() {
+            if (m_bc == null) {
+                m_sequencer.throwable(new Exception("Bundle Context not injected"));
+                return;
+            }
+            if (m_bcNotInjected != null) {
+                m_sequencer.throwable(new Exception("Bundle Context must not be injected"));
+                return;
+            }
+
+            if (m_dm == null) {
+                m_sequencer.throwable(new Exception("DependencyManager not injected"));
+                return;
+            }
+            if (m_dmNotInjected != null) {
+                m_sequencer.throwable(new Exception("DependencyManager must not be injected"));
+                return;
+            }
+
+            if (m_component == null) {
+                m_sequencer.throwable(new Exception("Component not injected"));
+                return;
+            }
+            if (m_componentNotInjected != null) {
+                m_sequencer.throwable(new Exception("Component must not be injected"));
+                return;
+            }
+        }
+    }
+
+    @AdapterService(adapteeService = S1.class, properties = { @Property(name = "adapter", value = "true") }, field = "m_s1")
+    public static class S1ToS3AdapterAutoConfigField implements S3 {
+        public final static String ENSURE = "AdapterAnnotation.autoConfig.field";
+        // This is the adapted service
+        protected volatile S1 m_s1;
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        protected volatile Ensure m_sequencer;
+
+        public void run3() {
+            m_s1.run();
+            m_sequencer.step(3);
+        }
+    }
+
+    @AdapterService(adapteeService = S1.class, properties = { @Property(name = "adapter", value = "true") }, added = "bind", removed = "removed")
+    public static class S1ToS3AdapterCallback implements S3 {
+        public final static String ENSURE = "AdapterAnnotation.callback";
+        // This is the adapted service
+        protected Object m_s1;
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        protected Ensure m_sequencer;
+
+        void bind(S1 s1) {
+            m_s1 = s1;
+        }
+
+        public void run3() {
+            ((S1) m_s1).run();
+        }
+
+        @Stop
+        void stop() {
+            m_sequencer.step(3);
+        }
+
+        void removed(S1 s1) {
+            m_sequencer.step(4);
+        }
+    }
+
+    @Component(properties = { @Property(name = "param1", value = "value1") })
+    public static class S1Impl implements S1 {
+        public final static String ENSURE = "AdapterAnnotation.S1Impl";
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        protected Ensure m_sequencer;
+
+        @ServiceDependency
+        protected S2 m_s2;
+
+        public void run() {
+            m_sequencer.step(1);
+            m_s2.run2();
+        }
+    }
+
+    @Component
+    public static class S2Impl implements S2 {
+        public final static String ENSURE = "AdapterAnnotation.S2Impl";
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        protected Ensure m_sequencer;
+
+        public void run2() {
+            m_sequencer.step(2);
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterServiceTestWithPublisher.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterServiceTestWithPublisher.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterServiceTestWithPublisher.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/AdapterServiceTestWithPublisher.java Wed May 14 15:51:25 2014
@@ -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 dm.runtime.it.components;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import dm.annotation.api.AdapterService;
+import dm.annotation.api.Component;
+import dm.annotation.api.Init;
+import dm.annotation.api.LifecycleController;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * 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");
+                }
+            };
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleAdapterServiceTestWithPublisher.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleAdapterServiceTestWithPublisher.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleAdapterServiceTestWithPublisher.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleAdapterServiceTestWithPublisher.java Wed May 14 15:51:25 2014
@@ -0,0 +1,104 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.framework.Bundle;
+
+import dm.annotation.api.BundleAdapterService;
+import dm.annotation.api.Component;
+import dm.annotation.api.Init;
+import dm.annotation.api.LifecycleController;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * Test a BundleAdapterService which provides its interface using a @ServiceLifecycle.
+ */
+public class BundleAdapterServiceTestWithPublisher {
+    public static final String ENSURE = "BundleAdapterServiceTestWithPublisher";
+
+    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 properties propagated from bundle
+            if (Utils.DM_BSN.equals(properties.get("Bundle-SymbolicName"))) {
+                m_sequencer.step(4);
+            } else {
+                System.out.println("Consumer.bind: properties=" + properties);
+            }
+        }
+
+        void unbind(Provider provider) {
+            m_sequencer.step(5);
+        }
+    }
+
+    @BundleAdapterService(properties = {@Property(name = "foo", value = "bar")}, filter = "(Bundle-SymbolicName=" + Utils.DM_BSN + ")", stateMask = Bundle.INSTALLED
+            | Bundle.RESOLVED | Bundle.ACTIVE, propagate = true)
+    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() {
+            // 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");
+                }
+            };
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleDependencyAnnotation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleDependencyAnnotation.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleDependencyAnnotation.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/BundleDependencyAnnotation.java Wed May 14 15:51:25 2014
@@ -0,0 +1,170 @@
+/*
+* 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 dm.runtime.it.components;
+
+import static dm.runtime.it.components.Utils.DM_BSN;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+import dm.DependencyManager;
+import dm.annotation.api.BundleAdapterService;
+import dm.annotation.api.BundleDependency;
+import dm.annotation.api.Component;
+import dm.annotation.api.Inject;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+public class BundleDependencyAnnotation {
+    public static final String ENSURE_CONSUMER = "BundleDependencyAnnotation.consumer";
+    public static final String ENSURE_ADAPTER = "BundleDependencyAnnotation.adapter";
+
+    public interface ServiceInterface extends Runnable {
+    }
+
+    /**
+     * Simple Consumer which has a BundleDependency dependency.
+     */
+    @Component
+    public static class Consumer {
+        protected volatile boolean m_added;
+        protected volatile boolean m_removed;
+
+        @ServiceDependency(filter = "(name=" + ENSURE_CONSUMER + ")")
+        private volatile Ensure m_sequencer;
+
+        @BundleDependency(required = false, removed = "removed", filter = "(Bundle-SymbolicName=" + DM_BSN + ")")
+        public void add(Bundle b) {
+            if (b != null && b.getSymbolicName().equals(DM_BSN)) {
+                m_added = true;
+            }
+        }
+
+        protected void removed(Bundle b) {
+            m_removed = true;
+        }
+
+        @Start
+        public void start() {
+            m_sequencer.step(1);
+        }
+
+        @Stop
+        public void stop() {
+            if (!m_added) {
+                throw new IllegalStateException("Did not get DependencyManager bundle");
+            }
+
+            if (!m_removed) {
+                throw new IllegalStateException("Did not remove DependencyManager bundle");
+            }
+            m_sequencer.step(2);
+        }
+    }
+
+    /**
+     * ServiceInterface Consumer.
+     */
+    @Component
+    public static class ServiceConsumer {
+        @ServiceDependency(filter = "(name=" + ENSURE_ADAPTER + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency
+        volatile ServiceInterface m_service;
+
+        @Start
+        void start() {
+            m_sequencer.step(2);
+            m_service.run();
+        }
+    }
+
+    /**
+     * A BundleAdapter test, which adapts the dependency manager bundle to the ServiceInterface service.
+     */
+    @BundleAdapterService(filter = "(Bundle-SymbolicName=" + DM_BSN + ")", stateMask = Bundle.INSTALLED
+            | Bundle.RESOLVED | Bundle.ACTIVE, propagate = true, properties = {@Property(name = "foo", value = "bar")})
+    public static class ServiceProvider implements ServiceInterface {
+        // Adapted bundle (injected by reflection).
+        protected volatile Bundle m_bundle;
+
+        // Our Sequencer required dependency
+        @ServiceDependency(filter = "(name=" + ENSURE_ADAPTER + ")")
+        volatile Ensure m_sequencer;
+
+        // Check auto config injections
+        @Inject
+        volatile BundleContext m_bc;
+        BundleContext m_bcNotInjected;
+
+        @Inject
+        volatile DependencyManager m_dm;
+        DependencyManager m_dmNotInjected;
+
+        @Inject
+        volatile dm.Component m_component;
+        dm.Component m_componentNotInjected;
+
+        @Start
+        void start() {
+            checkInjectedFields();
+            m_sequencer.step(1);
+        }
+
+        public void run() {
+            if (m_bundle == null || !m_bundle.getSymbolicName().equals(DM_BSN)) {
+                throw new IllegalStateException("ServiceProvider did not get proper bundle: " + m_bundle);
+            }
+            m_sequencer.step(3);
+        }
+
+        private void checkInjectedFields() {
+            if (m_bc == null) {
+                m_sequencer.throwable(new Exception("Bundle Context not injected"));
+                return;
+            }
+            if (m_bcNotInjected != null) {
+                m_sequencer.throwable(new Exception("Bundle Context must not be injected"));
+                return;
+            }
+
+            if (m_dm == null) {
+                m_sequencer.throwable(new Exception("DependencyManager not injected"));
+                return;
+            }
+            if (m_dmNotInjected != null) {
+                m_sequencer.throwable(new Exception("DependencyManager must not be injected"));
+                return;
+            }
+
+            if (m_component == null) {
+                m_sequencer.throwable(new Exception("Component not injected"));
+                return;
+            }
+            if (m_componentNotInjected != null) {
+                m_sequencer.throwable(new Exception("Component must not be injected"));
+                return;
+            }
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/CompositeAnnotations.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/CompositeAnnotations.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/CompositeAnnotations.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/CompositeAnnotations.java Wed May 14 15:51:25 2014
@@ -0,0 +1,192 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.framework.ServiceRegistration;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Composition;
+import dm.annotation.api.Destroy;
+import dm.annotation.api.Init;
+import dm.annotation.api.Property;
+import dm.annotation.api.Registered;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+public class CompositeAnnotations {
+    public interface C1Service {
+    }
+    
+    public interface Dependency extends Runnable {        
+    }
+
+    /**
+     * This service is also composed of the Component object.
+     */
+    @Component
+    public static class C1 implements C1Service {
+        public final static String ENSURE = "CompositeAnnotations.C1";
+        
+        /* We are composed of this object, which will also be injected with our dependencies */
+        private final C2 m_c2 = new C2();
+
+        /* This dependency filter will be configured from our init method */
+        @ServiceDependency(name = "D")
+        public volatile Dependency m_runnable;
+
+        /* Object used to check that methods are called in the proper sequence */
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        private volatile Ensure m_sequencer;
+
+        /**
+         *  Dynamically configure our "D" dependency, using a dependency customization map 
+         */
+        @Init
+        Map<String, String> init() {
+            m_sequencer.step(1);
+            // Configure a filter for our dependency whose name is "D"
+            Map<String, String> customization = new HashMap<String, String>();
+            customization.put("D.filter", "(foo=bar2)");
+            customization.put("D.required", "true");
+            return customization;
+        }
+
+        /**
+         * Return the list of object our service is composed of
+         */
+        @Composition
+        Object[] getComposition() {
+            return new Object[]{this, m_c2};
+        }
+
+        /** 
+         * Our Service is starting, and our Composites will also be 
+         */
+        @Start
+        void start() {
+            m_sequencer.step(3);
+            m_runnable.run(); /* step 4 */
+            // Our Component.start() method should be called once this method returns.
+        }
+
+        /**
+         * Our provided service has been registered into the OSGi service registry.
+         */
+        @Registered
+        void registered(ServiceRegistration sr) {
+            m_sequencer.step(7);
+        }
+
+        /**
+         *  Our Service is stopping, and our Composites will also be 
+         */
+        @Stop
+        void stop() {
+            m_sequencer.step(9);
+            // Our Component.stop() method should be called once this method returns.
+        }
+
+        /**
+         * Our Service is destroying, and our Composites will also be.
+         */
+        @Destroy
+        void destroy() {
+            m_sequencer.step(11);
+            // Our Component.destroy() method should be called once this method returns.
+        }
+    }
+
+    /**
+     * The CompositeService is also made up of this Class.
+     */
+    public static class C2 {
+        // Injected dependency (from CompositeService)
+        private volatile Ensure m_sequencer;
+
+        // Injected dependency (from CompositeService)
+        public volatile Dependency m_runnable;
+
+        // lifecycle callback (same method as the one from CompositeService)
+        void init() {
+            m_sequencer.step(2);
+        }
+
+        // lifecycle callback (same method as the one from CompositeService)
+        void start() {
+            m_sequencer.step(5);
+            m_runnable.run(); /* step 6 */
+        }
+
+        void registered(ServiceRegistration sr) {
+            if (sr == null) {
+                m_sequencer.throwable(new Exception("null service registration"));
+            }
+            m_sequencer.step(8);
+        }
+
+        // lifecycle callback (same method as the one from CompositeService)
+        void stop() {
+            m_sequencer.step(10);
+        }
+
+        // lifecycle callback (same method as the one from CompositeService)
+        void destroy() {
+            m_sequencer.step(12);
+        }
+    }
+
+    @Component(properties = @Property(name = "foo", value = "bar1"))
+    public static class Dependency1 implements Dependency {
+        public final static String ENSURE = "CompositeAnnotations.Dependency1";
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Start
+        void start() {
+            System.out.println("Dependency1.start");
+        }
+
+        public void run() {
+            m_sequencer.step(Integer.MAX_VALUE); // Makes the test fail.
+        }
+    }
+
+    @Component(properties = @Property(name = "foo", value = "bar2"))
+    public static class Dependency2 implements Dependency {
+        public final static String ENSURE = "CompositeAnnotations.Dependency2";
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Start
+        void start() {
+            System.out.println("Dependency2.start");
+        }
+
+        public void run() {
+            m_sequencer.step();
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraAdapterServiceProperties.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraAdapterServiceProperties.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraAdapterServiceProperties.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraAdapterServiceProperties.java Wed May 14 15:51:25 2014
@@ -0,0 +1,90 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import dm.annotation.api.AdapterService;
+import dm.annotation.api.Component;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * This test validates that an adapter Service may specify some extra service properties
+ * from it's start callback
+ */
+public class ExtraAdapterServiceProperties {
+    public final static String ENSURE = "ExtraAdapterServiceProperties";
+
+    public interface Provider {
+    }
+
+    public interface Provider2 {
+    }
+
+    @Component(properties = {@Property(name = "foo", value = "bar")})
+    public static class ProviderImpl implements Provider {
+    }
+
+    @AdapterService(provides = Provider2.class, properties = {@Property(name = "foo2", value = "bar2")}, adapteeService = Provider.class)
+    public static class Provider2Impl implements Provider2 {
+        protected Provider m_adaptee;
+
+        @Start
+        Map<String, String> start() {
+            return new HashMap<String, String>() {
+                {
+                    put("foo3", "bar3");
+                }
+            };
+        }
+    }
+
+    @Component
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        private volatile Map m_properties;
+
+        @ServiceDependency
+        void bind(Map properties, Provider2 provider2) {
+            m_properties = properties;
+        }
+
+        @Start
+        void start() {
+            System.out.println("provider2 service properties: " + m_properties);
+            if ("bar".equals(m_properties.get("foo"))) {
+                m_sequencer.step(1);
+            }
+
+            if ("bar2".equals(m_properties.get("foo2"))) {
+                m_sequencer.step(2);
+            }
+
+            if ("bar3".equals(m_properties.get("foo3"))) {
+                m_sequencer.step(3);
+            }
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraFactoryServiceProperties.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraFactoryServiceProperties.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraFactoryServiceProperties.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraFactoryServiceProperties.java Wed May 14 15:51:25 2014
@@ -0,0 +1,95 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+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 = FACTORYSET)
+    public static class ProviderImpl implements Provider {
+        @Start
+        Map<String, String> start() {
+            return new HashMap<String, String>() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
+        }
+    }
+
+    @Component
+    public static class ProviderImplFactory {
+        @ServiceDependency(filter = "(" + Component.FACTORY_NAME + "=" + FACTORYSET + ")")
+        volatile Set<Dictionary> m_factory;
+
+        @Start
+        void start() {
+            m_factory.add(new Hashtable() {
+                {
+                    put("foo3", "bar3");
+                }
+            });
+        }
+    }
+
+    @Component
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        private volatile Map m_properties;
+
+        @ServiceDependency
+        void bindProvider(Map properties, Provider m_provider) {
+            m_properties = properties;
+        }
+
+        @Start
+        void start() {
+            System.out.println("provider service properties: " + m_properties);
+            if ("bar".equals(m_properties.get("foo"))) {
+                m_sequencer.step(1);
+            }
+
+            if ("bar2".equals(m_properties.get("foo2"))) {
+                m_sequencer.step(2);
+            }
+
+            if ("bar3".equals(m_properties.get("foo3"))) {
+                m_sequencer.step(3);
+            }
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraServiceProperties.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraServiceProperties.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraServiceProperties.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ExtraServiceProperties.java Wed May 14 15:51:25 2014
@@ -0,0 +1,76 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * This test validates that a basic Service may specify some extra service properties
+ * from it's start callback
+ */
+public class ExtraServiceProperties {
+    public final static String ENSURE = "ExtraServiceProperties";
+    
+    public interface Provider {
+    }
+
+    @Component(properties = {@Property(name = "foo", value = "bar")})
+    public static class ProviderImpl implements Provider {
+        @Start
+        Map<String, String> start() {
+            return new HashMap<String, String>() {
+                {
+                    put("foo2", "bar2");
+                }
+            };
+        }
+    }
+
+    @Component
+    public static class Consumer {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        private volatile Map m_properties;
+
+        @ServiceDependency
+        void bindProvider(Map properties, Provider m_provider) {
+            m_properties = properties;
+        }
+
+        @Start
+        void start() {
+            System.out.println("provider service properties: " + m_properties);
+            if ("bar".equals(m_properties.get("foo"))) {
+                m_sequencer.step(1);
+            }
+
+            if ("bar2".equals(m_properties.get("foo2"))) {
+                m_sequencer.step(2);
+            }
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterAnnotation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterAnnotation.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterAnnotation.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterAnnotation.java Wed May 14 15:51:25 2014
@@ -0,0 +1,160 @@
+/*
+* 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 dm.runtime.it.components;
+
+import java.util.Dictionary;
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+
+import dm.DependencyManager;
+import dm.annotation.api.Component;
+import dm.annotation.api.FactoryConfigurationAdapterService;
+import dm.annotation.api.Inject;
+import dm.annotation.api.Property;
+import dm.annotation.api.Registered;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+public class FactoryConfigurationAdapterAnnotation {
+    public interface ServiceInterface {
+        public void doService();
+    }
+
+    @Component
+    public static class ServiceClient {
+        @ServiceDependency(changed = "changeServiceProvider")
+        void addServiceProvider(Map props, ServiceInterface si) {
+            // props should contain foo=bar, foo2=bar2
+            if (!"bar".equals(props.get("foo"))) {
+                throw new IllegalArgumentException("configuration does not contain foo=bar: " + props);
+            }
+            if (!"bar2".equals(props.get("foo2"))) {
+                throw new IllegalArgumentException("configuration does not contain foo2=bar2: " + props);
+            }
+            si.doService();
+        }
+
+        void changeServiceProvider(Map props, ServiceInterface si) {
+            // props should contain foo=bar, foo2=bar2_modified
+            if (!"bar".equals(props.get("foo"))) {
+                throw new IllegalArgumentException("configuration does not contain foo=bar: " + props);
+            }
+            if (!"bar2_modified".equals(props.get("foo2"))) {
+                throw new IllegalArgumentException("configuration does not contain foo2=bar2: " + props);
+            }
+            si.doService();
+        }
+    }
+
+    /**
+     * This service is instantiated when a factory configuration is created from ConfigAdmin
+     */
+    @FactoryConfigurationAdapterService(factoryPid = "FactoryPidTest", properties = {@Property(name = "foo", value = "bar")}, propagate = true)
+    public static class ServiceProvider implements ServiceInterface {
+        public final static String ENSURE = "FactoryConfigurationAdapterAnnotation.ServiceProvider";
+        
+        @ServiceDependency(filter="(name=" + ENSURE + ")")
+        private volatile Ensure m_sequencer;
+
+        private volatile boolean m_started;
+
+        // Check auto config injections
+        @Inject
+        volatile BundleContext m_bc;
+        BundleContext m_bcNotInjected;
+
+        @Inject
+        volatile DependencyManager m_dm;
+        DependencyManager m_dmNotInjected;
+
+        @Inject
+        volatile dm.Component m_component;
+        dm.Component m_componentNotInjected;
+
+        // Either initial config, or an updated config
+        protected void updated(Dictionary conf) {
+            if (m_started) {
+                // conf should contain foo2=bar2_modified
+                if (!"bar2_modified".equals(conf.get("foo2"))) {
+                    m_sequencer.throwable(new Exception("configuration does not contain foo=bar"));
+                }
+                m_sequencer.step(4);
+            } else {
+                // conf should contain foo2=bar2
+                if (!"bar2".equals(conf.get("foo2"))) {
+                    throw new IllegalArgumentException("configuration does not contain foo2=bar2: " + conf);
+                }
+            }
+        }
+
+        @Start
+        void start() {
+            checkInjectedFields();
+            m_started = true;
+            m_sequencer.step(1);
+        }
+
+        @Registered
+        void registered() {
+            m_sequencer.step(3);
+        }
+
+        // The ServiceClient is invoking our service
+        public void doService() {
+            m_sequencer.step(); /* 2 or 5 */
+        }
+
+        @Stop
+        void stop() {
+            m_sequencer.step(6);
+        }
+
+        private void checkInjectedFields() {
+            if (m_bc == null) {
+                m_sequencer.throwable(new Exception("Bundle Context not injected"));
+                return;
+            }
+            if (m_bcNotInjected != null) {
+                m_sequencer.throwable(new Exception("Bundle Context must not be injected"));
+                return;
+            }
+
+            if (m_dm == null) {
+                m_sequencer.throwable(new Exception("DependencyManager not injected"));
+                return;
+            }
+            if (m_dmNotInjected != null) {
+                m_sequencer.throwable(new Exception("DependencyManager must not be injected"));
+                return;
+            }
+
+            if (m_component == null) {
+                m_sequencer.throwable(new Exception("Component not injected"));
+                return;
+            }
+            if (m_componentNotInjected != null) {
+                m_sequencer.throwable(new Exception("Component must not be injected"));
+                return;
+            }
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterServiceTestWithPublisher.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterServiceTestWithPublisher.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterServiceTestWithPublisher.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryConfigurationAdapterServiceTestWithPublisher.java Wed May 14 15:51:25 2014
@@ -0,0 +1,137 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.FactoryConfigurationAdapterService;
+import dm.annotation.api.Init;
+import dm.annotation.api.LifecycleController;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+/**
+ * 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(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+        
+        volatile Configuration m_conf;
+
+        @ServiceDependency
+        volatile ConfigurationAdmin m_cm;
+        
+        @Start
+        void start() throws IOException {
+            m_conf = m_cm.createFactoryConfiguration(PID, null);
+            m_conf.update(new Hashtable() {
+                {
+                    put("foo3", "bar3");
+                }
+            });
+        }
+        
+        @Stop
+        void stop() throws IOException {
+            m_conf.delete();
+        }
+    }
+
+    @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");
+                }
+            };
+        }
+
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryServiceTestWthPublisher.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryServiceTestWthPublisher.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryServiceTestWthPublisher.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/FactoryServiceTestWthPublisher.java Wed May 14 15:51:25 2014
@@ -0,0 +1,113 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Init;
+import dm.annotation.api.LifecycleController;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * 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");
+                }
+            });
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4050.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4050.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4050.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4050.java Wed May 14 15:51:25 2014
@@ -0,0 +1,153 @@
+/*
+* 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 dm.runtime.it.components;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import dm.DependencyManager;
+import dm.annotation.api.Component;
+import dm.annotation.api.Destroy;
+import dm.annotation.api.Init;
+import dm.annotation.api.Inject;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+public class Felix4050 {
+    public final static String ENSURE = "Felix4050";
+
+    @Component(provides = { A.class })
+    public static class A {
+
+    }
+
+    public interface B {
+        void run();
+    }
+
+    @Component(properties = { @Property(name = "type", value = "b1") })
+    public static class B1 implements B {
+        public void run() {
+        }
+    }
+
+    @Component(provides = {})
+    public static class B2 implements B {
+        @Inject
+        volatile BundleContext _ctx;
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Start
+        void start() {
+            Thread t = new Thread(new Runnable() {
+                public void run() {
+                    try {
+                        Thread.sleep(2000);
+                    }
+                    catch (InterruptedException e) {
+                    }
+                    System.out.println("Registering B2");
+                    ServiceRegistration sr = _ctx.registerService(B.class.getName(), B2.this, new Hashtable() {
+                        {
+                            put("type", "b2");
+                        }
+                    });
+
+                    try {
+                        Thread.sleep(1000);
+                    }
+                    catch (InterruptedException e) {
+                    }
+                }
+            });
+            t.start();
+        }
+
+        public void run() {
+            m_sequencer.step(3);
+        }
+    }
+
+    @Component
+    public static class S {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Inject
+        volatile dm.Component _component;
+
+        volatile A m_a;
+        volatile B m_b;
+
+        void bind(A a) {
+            System.out.println("bind(A): " + a);
+            m_a = a;
+        }
+
+        @ServiceDependency(name = "B")
+        void bind(B b) {
+            System.out.println("bind(B): " + b);
+            m_b = b;
+        }
+
+        @Init
+        Map init() {
+            m_sequencer.step(1);
+            DependencyManager dm = _component.getDependencyManager();
+            _component.add(dm.createServiceDependency().setService(A.class).setRequired(true).setCallbacks("bind", null));
+            return new HashMap() {
+                {
+                    put("B.required", "true");
+                    put("B.filter", "(type=b2)");
+                }
+            };
+        }
+
+        @Start
+        void start() {
+            if (m_a == null) {
+                throw new RuntimeException("A not injected");
+            }
+            if (m_b == null) {
+                throw new RuntimeException("B not injected");
+            }
+            m_sequencer.step(2);
+            m_b.run(); // step(3)
+        }
+
+        @Stop
+        void stop() {
+            m_sequencer.step(4);
+        }
+
+        @Destroy
+        void destroy() {
+            m_sequencer.step(5);
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4357.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4357.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4357.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/Felix4357.java Wed May 14 15:51:25 2014
@@ -0,0 +1,140 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import junit.framework.Assert;
+
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Property;
+import dm.annotation.api.Registered;
+import dm.annotation.api.ServiceDependency;
+import dm.it.Ensure;
+
+/**
+ * Checks support of primitive types for @Property annotation.
+ */
+@Component(properties={
+        @Property(name="v1", value="s"),
+        @Property(name="v2", value={"s1", "s2"}),
+        @Property(name="v3", values={"s1", "s2"}),
+
+        @Property(name="v4", value="1", type=Long.class),
+        @Property(name="v5", longValue=1),
+        @Property(name="v6", longValue={1, 2}),
+        
+        @Property(name="v7", value="1", type=Double.class),
+        @Property(name="v8", doubleValue=1),
+        @Property(name="v9", doubleValue={1, 2}),
+
+        @Property(name="v10", value="1", type=Float.class),
+        @Property(name="v11", floatValue=1),
+        @Property(name="v12", floatValue={1, 2}),
+
+        @Property(name="v13", value="1", type=Integer.class),
+        @Property(name="v14", intValue=1),
+        @Property(name="v15", intValue={1, 2}),
+
+        @Property(name="v16", value="65", type=Byte.class),
+        @Property(name="v17", byteValue=65),
+        @Property(name="v18", byteValue={65, 66}),
+
+        @Property(name="v19", value="A", type=Character.class),
+        @Property(name="v20", charValue='A'),
+        @Property(name="v21", charValue={'A', 'B'}),
+
+        @Property(name="v22", value="true", type=Boolean.class),
+        @Property(name="v23", booleanValue=true),
+        @Property(name="v24", booleanValue={true, false}),
+
+        @Property(name="v25", value="1", type=Short.class),
+        @Property(name="v26", shortValue=1),
+        @Property(name="v27", shortValue={1, 2}),
+        
+        @Property(name="v28", value="65", type=Character.class),
+        @Property(name="v29", charValue=65),
+        @Property(name="v30", charValue={65, 66}),
+    },
+    provides=Felix4357.class
+)
+public class Felix4357 {
+    public final static String ENSURE = "Felix4357";
+    
+    @ServiceDependency(filter = "(name=" + ENSURE + ")")
+    volatile Ensure m_ensure;
+    
+    @Registered
+    void registered(ServiceRegistration sr) {
+        ServiceReference ref = sr.getReference();
+        assertEquals(ref, "v1", "s", 1);
+        assertArrayEquals(ref, "v2", new String[] {"s1", "s2"}, 2);        
+        assertArrayEquals(ref, "v3", new String[] {"s1", "s2"}, 3);                        
+        assertEquals(ref, "v4", new Long(1), 4);
+        assertEquals(ref, "v5", new Long(1), 5);
+        assertArrayEquals(ref, "v6", new Long[] { 1L, 2L } , 6);
+        assertEquals(ref, "v7", new Double(1), 7);
+        assertEquals(ref, "v8", new Double(1), 8);
+        assertArrayEquals(ref, "v9", new Double[] { 1.0, 2.0 } , 9);
+        assertEquals(ref, "v10", new Float(1), 10);
+        assertEquals(ref, "v11", new Float(1), 11);
+        assertArrayEquals(ref, "v12", new Float[] { 1.f, 2.f } , 12);
+        assertEquals(ref, "v13", new Integer(1), 13);
+        assertEquals(ref, "v14", new Integer(1), 14);
+        assertArrayEquals(ref, "v15", new Integer[] { 1, 2 } , 15);
+        assertEquals(ref, "v16", Byte.valueOf("65"), 16);
+        assertEquals(ref, "v17", Byte.valueOf("65"), 17);
+        assertArrayEquals(ref, "v18", new Byte[] { Byte.valueOf("65"), Byte.valueOf("66") } , 18);
+        assertEquals(ref, "v19", Character.valueOf('A'), 19);
+        assertEquals(ref, "v20", Character.valueOf('A'), 20);
+        assertArrayEquals(ref, "v21", new Character[] { 'A', 'B' } , 21);
+        assertEquals(ref, "v22", Boolean.valueOf(true), 22);
+        assertEquals(ref, "v23", Boolean.valueOf(true), 23);
+        assertArrayEquals(ref, "v24", new Boolean[] { true, false } , 24);
+        assertEquals(ref, "v25", Short.valueOf((short) 1), 25);
+        assertEquals(ref, "v26", Short.valueOf((short) 1), 26);
+        assertArrayEquals(ref, "v27", new Short[] { 1, 2 } , 27);
+        assertEquals(ref, "v28", Character.valueOf('A'), 28);
+        assertEquals(ref, "v29", Character.valueOf('A'), 29);
+        assertArrayEquals(ref, "v30", new Character[] { 'A', 'B' } , 30);
+    }
+    
+    void assertEquals(ServiceReference ref, String property, Object expected, int step) {
+        Object value = ref.getProperty(property);
+        Assert.assertNotNull(value);
+        Assert.assertEquals(value.getClass(), expected.getClass());
+        Assert.assertEquals(value, expected);        
+        m_ensure.step(step);
+    }
+    
+    void assertArrayEquals(ServiceReference ref, String property, Object[] expected, int step) {
+        Object values = ref.getProperty(property);
+        Assert.assertNotNull(values);
+        Assert.assertTrue(values.getClass().isArray());
+        Assert.assertEquals(values.getClass(), expected.getClass());
+        Object[] array = (Object[]) values;
+        Assert.assertEquals(array.length, expected.length);
+        for (int i = 0; i < array.length; i ++) {
+            Assert.assertEquals(array[i].getClass(), expected[i].getClass());
+            Assert.assertEquals(array[i], expected[i]);
+        }
+        m_ensure.step(step);
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/MultipleAnnotations.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/MultipleAnnotations.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/MultipleAnnotations.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/MultipleAnnotations.java Wed May 14 15:51:25 2014
@@ -0,0 +1,133 @@
+/*
+* 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 dm.runtime.it.components;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Composition;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.annotation.api.Stop;
+import dm.it.Ensure;
+
+
+public class MultipleAnnotations {
+    public final static String ENSURE = "MultipleAnnotations";
+    
+    public static class Composite {
+        void bind(Ensure seq) {
+            seq.step(2);
+        }
+    }
+
+    @Component
+    public static class ServiceConsumer {
+        @ServiceDependency(filter="(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @ServiceDependency(filter = "(foo=bar)")
+        volatile ServiceInterface m_service;
+
+        @Start
+        void start() {
+            m_sequencer.step(6);
+            m_service.doService();
+        }
+
+        @Stop
+        void stop() {
+            m_sequencer.step(8);
+        }
+    }
+
+    public interface ServiceInterface {
+        public void doService();
+    }
+
+    @Component(properties = {@Property(name = "foo", value = "bar")})
+    public static class ServiceProvider implements ServiceInterface {
+        @ServiceDependency(filter="(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        volatile ServiceProvider2 m_serviceProvider2;
+
+        @ServiceDependency(removed = "unbind")
+        void bind(ServiceProvider2 provider2) {
+            m_serviceProvider2 = provider2;
+        }
+
+        @Start
+        void start() {
+            m_serviceProvider2.step(4);
+            m_sequencer.step(5);
+        }
+
+        @Stop
+        void stop() {
+            m_sequencer.step(9);
+        }
+
+        void unbind(ServiceProvider2 provider2) {
+            m_sequencer.step(10);
+        }
+
+        public void doService() {
+            m_sequencer.step(7);
+        }
+    }
+
+    @Component(provides = {ServiceProvider2.class}, factoryMethod = "create")
+    public static class ServiceProvider2 {
+        final Composite m_composite = new Composite();
+        volatile Ensure m_sequencer;
+
+        static ServiceProvider2 create() {
+            return new ServiceProvider2();
+        }
+
+        @ServiceDependency(required = false, filter = "(foo=bar)") // NullObject
+        volatile Runnable m_runnable;
+
+        @ServiceDependency(service = Ensure.class, filter="(name=" + ENSURE + ")")
+        void bind(Ensure seq) {
+            m_sequencer = seq;
+            m_sequencer.step(1);
+        }
+
+        @Start
+        void start() {
+            m_sequencer.step(3);
+            m_runnable.run(); // NullObject
+        }
+
+        public void step(int step) { // called by ServiceProvider.start() method
+            m_sequencer.step(step);
+        }
+
+        @Stop
+        void stop() {
+            m_sequencer.step(11);
+        }
+
+        @Composition
+        Object[] getComposition() {
+            return new Object[]{this, m_composite};
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/PropagateAnnotation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/PropagateAnnotation.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/PropagateAnnotation.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/PropagateAnnotation.java Wed May 14 15:51:25 2014
@@ -0,0 +1,68 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.util.Map;
+
+import dm.annotation.api.Component;
+import dm.annotation.api.Property;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * Verifies ServiceDependencyservice properties propagation.
+ */
+public class PropagateAnnotation {
+    public final static String ENSURE = "PropagateAnnotation";
+    
+    @Component
+    public static class Consumer {
+        private volatile Map m_producerProps;
+
+        @ServiceDependency
+        void bind(Map props, Producer producer) {
+            m_producerProps = props;
+        }
+
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @Start
+        void start() {
+            m_sequencer.step(1);
+            if ("bar".equals(m_producerProps.get("foo"))) {
+                m_sequencer.step(2);
+            }
+            if ("bar2".equals(m_producerProps.get("foo2"))) {
+                m_sequencer.step(3);
+            }
+        }
+    }
+
+    @Component(provides = {Producer.class}, properties = {@Property(name = "foo", value = "bar")})
+    public static class Producer {
+        @ServiceDependency(propagate = true)
+        volatile Producer2 m_producer;
+    }
+
+    @Component(provides = {Producer2.class}, properties = {@Property(name = "foo2", value = "bar2")})
+    public static class Producer2 {
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ResourceAdapterServiceTestWithPublisher.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ResourceAdapterServiceTestWithPublisher.java?rev=1594622&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ResourceAdapterServiceTestWithPublisher.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.runtime.it/src/dm/runtime/it/components/ResourceAdapterServiceTestWithPublisher.java Wed May 14 15:51:25 2014
@@ -0,0 +1,195 @@
+/*
+ * 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 dm.runtime.it.components;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import junit.framework.Assert;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+
+import dm.ResourceHandler;
+import dm.ResourceUtil;
+import dm.annotation.api.Component;
+import dm.annotation.api.Destroy;
+import dm.annotation.api.Init;
+import dm.annotation.api.Inject;
+import dm.annotation.api.LifecycleController;
+import dm.annotation.api.Property;
+import dm.annotation.api.ResourceAdapterService;
+import dm.annotation.api.ServiceDependency;
+import dm.annotation.api.Start;
+import dm.it.Ensure;
+
+/**
+ * Test a ResourceAdapterService which provides its interface using a @ServiceLifecycle.
+ */
+public class ResourceAdapterServiceTestWithPublisher {
+    public static final String ENSURE = "ResourceAdapterServiceTestWithPublisher";
+
+    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 properties propagated by the resource adapter
+            if ("/path/to/test1.txt".equals(properties.get(ResourceHandler.PATH))) {
+                m_sequencer.step(4);
+            }
+            if ("localhost".equals(properties.get(ResourceHandler.HOST))) {
+                m_sequencer.step(5);
+            }
+        }
+
+        void unbind(Provider provider) {
+            m_sequencer.step(6);
+        }
+    }
+
+    @Component
+    public static class ResourceProvider {
+        @ServiceDependency(filter = "(name=" + ENSURE + ")")
+        volatile Ensure m_sequencer;
+
+        @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")};
+        }
+
+        /**
+         * Handles a new Resource consumer
+         * @param serviceProperties
+         * @param 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 {
+                    filter = m_context.createFilter(filterString);
+                } catch (InvalidSyntaxException e) {
+                    Assert.fail("Could not create filter for resource handler: " + e);
+                    return;
+                }
+            }
+            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]))) {
+                    handler.added(m_resources[i]);
+                }
+            }
+        }
+
+        /**
+         * Remove a Resource consumer.bar
+         * @param handler
+         */
+        public void remove(ResourceHandler handler) {
+            Filter filter;
+            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]))) {
+                    handler.removed(m_resources[i]);
+                }
+            }
+        }
+
+        /**
+         * Our component is being destroyed: notify all our registered Resource consumers that we don't
+         * provide our Resources anymore.
+         */
+        @Destroy
+        public void destroy() {
+            Entry[] handlers;
+            synchronized (m_handlers) {
+                handlers = (Entry[]) m_handlers.entrySet().toArray(new Entry[m_handlers.size()]);
+            }
+            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 {
+        @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;
+
+        // Injected by reflection
+        volatile URL m_resource;
+
+        @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");
+                }
+            };
+        }
+    }
+}