FELIX-3557 tests for circular dependency behavior
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1350816 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/test/resources/integration_test_circular.xml b/scr/src/test/resources/integration_test_circular.xml
new file mode 100644
index 0000000..2a408c8
--- /dev/null
+++ b/scr/src/test/resources/integration_test_circular.xml
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
+
+ <!-- A, B both 1.1 dynamic. Neither should register or activate -->
+ <scr:component name="1.A.1.1.dynamic"
+ enabled="true"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.A" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.A" />
+ </service>
+ <reference
+ name="b"
+ interface="org.apache.felix.scr.integration.components.circular.B"
+ cardinality="1..1"
+ policy="dynamic"
+ bind="setB"
+ unbind="unsetB"
+ target="(service.pid=1.B.1.1.dynamic)"
+ />
+ <property name="service.pid" value="1.A.1.1.dynamic" />
+ </scr:component>
+ <scr:component name="1.B.1.1.dynamic"
+ enabled="true"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.B" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.B" />
+ </service>
+ <reference
+ name="a"
+ interface="org.apache.felix.scr.integration.components.circular.A"
+ cardinality="1..1"
+ policy="dynamic"
+ bind="setA"
+ unbind="unsetA"
+ target="(service.pid=1.A.1.1.dynamic)"
+ />
+ <property name="service.pid" value="1.B.1.1.dynamic" />
+ </scr:component>
+
+ <!-- A 1.1 dynamic. B 0..n dynamic both immediate. Both should start (A first) and B should have no reference to A -->
+ <scr:component name="2.A.1.1.dynamic"
+ enabled="true"
+ immediate="true"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.A" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.A" />
+ </service>
+ <reference
+ name="b"
+ interface="org.apache.felix.scr.integration.components.circular.B"
+ cardinality="1..1"
+ policy="dynamic"
+ bind="setB"
+ unbind="unsetB"
+ target="(service.pid=2.B.0.n.dynamic)"
+ />
+ <property name="service.pid" value="2.A.1.1.dynamic" />
+ </scr:component>
+ <scr:component name="2.B.0.n.dynamic"
+ enabled="true"
+ immediate="true"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.B" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.B" />
+ </service>
+ <reference
+ name="a"
+ interface="org.apache.felix.scr.integration.components.circular.A"
+ cardinality="0..n"
+ policy="dynamic"
+ bind="setA"
+ unbind="unsetA"
+ target="(service.pid=2.A.1.1.dynamic)"
+ />
+ <property name="service.pid" value="2.B.0.n.dynamic" />
+ </scr:component>
+
+ <!-- A 1.1 dynamic. B 0..n dynamic both immediate. Both should start (B first) and B should have a reference to A -->
+ <scr:component name="3.B.0.n.dynamic"
+ enabled="true"
+ immediate="true"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.B" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.B" />
+ </service>
+ <reference
+ name="a"
+ interface="org.apache.felix.scr.integration.components.circular.A"
+ cardinality="0..n"
+ policy="dynamic"
+ bind="setA"
+ unbind="unsetA"
+ target="(service.pid=3.A.1.1.dynamic)"
+ />
+ <property name="service.pid" value="3.B.0.n.dynamic" />
+ </scr:component>
+ <scr:component name="3.A.1.1.dynamic"
+ enabled="true"
+ immediate="true"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.A" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.A" />
+ </service>
+ <reference
+ name="b"
+ interface="org.apache.felix.scr.integration.components.circular.B"
+ cardinality="1..1"
+ policy="dynamic"
+ bind="setB"
+ unbind="unsetB"
+ target="(service.pid=3.B.0.n.dynamic)"
+ />
+ <property name="service.pid" value="3.A.1.1.dynamic" />
+ </scr:component>
+
+ <!-- A 1.1 dynamic. B 0..n dynamic both delayed. Both should start and B should have no reference to A -->
+ <scr:component name="4.A.1.1.dynamic"
+ enabled="true"
+ immediate="false"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.A" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.A" />
+ </service>
+ <reference
+ name="b"
+ interface="org.apache.felix.scr.integration.components.circular.B"
+ cardinality="1..1"
+ policy="dynamic"
+ bind="setB"
+ unbind="unsetB"
+ target="(service.pid=4.B.0.n.dynamic)"
+ />
+ <property name="service.pid" value="4.A.1.1.dynamic" />
+ </scr:component>
+ <scr:component name="4.B.0.n.dynamic"
+ enabled="true"
+ immediate="false"
+ configuration-policy="ignore">
+ <implementation class="org.apache.felix.scr.integration.components.circular.B" />
+ <service>
+ <provide interface="org.apache.felix.scr.integration.components.circular.B" />
+ </service>
+ <reference
+ name="a"
+ interface="org.apache.felix.scr.integration.components.circular.A"
+ cardinality="0..n"
+ policy="dynamic"
+ bind="setA"
+ unbind="unsetA"
+ target="(service.pid=4.A.1.1.dynamic)"
+ />
+ <property name="service.pid" value="4.B.0.n.dynamic" />
+ </scr:component>
+
+
+</components>