You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/02/26 11:48:13 UTC
svn commit: r1450123 [3/9] - in
/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/felix/
src/main/java/org/apach...
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata.xml?rev=1450123&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata.xml Tue Feb 26 10:48:11 2013
@@ -0,0 +1,1064 @@
+<ipojo>
+<!--
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"
+ xmlns="org.apache.felix.ipojo"
+ -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.FooProviderType1"
+ name="FooProviderType-1" architecture="true">
+ <provides />
+ </component>
+
+ <!-- Simple Dependencies -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="SimpleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="VoidCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ObjectCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="RefCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="BothCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="MapCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DictCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedSimpleCheckServiceProvider" architecture="true">
+ <requires field="fs" />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedVoidCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedObjectCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedRefCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedBothCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedMapCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedDictCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DoubleCheckServiceProvider" architecture="true">
+ <requires>
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <requires field="fs" proxy="true"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedDoubleCheckServiceProvider" architecture="true">
+ <requires>
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <requires field="fs" />
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MObjectCheckServiceProvider" architecture="true">
+ <requires>
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MRefCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MBothCheckServiceProvider" architecture="true">
+ <requires>
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MMapCheckServiceProvider" architecture="true">
+ <requires>
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MDictCheckServiceProvider" architecture="true">
+ <requires>
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Simple & Optional Dependencies -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="SimpleOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" id="FooService" proxy="false"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="SimpleOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false" />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="VoidOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="VoidOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ObjectOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ObjectOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="RefOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="RefOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="BothOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="MapOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DictOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedSimpleOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" id="FooService"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedVoidOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedObjectOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedRefOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedBothOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedMapOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ProxiedDictOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="BothOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="MapOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DictOptionalNoNullableCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" nullable="false">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MObjectOptionalCheckServiceProvider" architecture="true">
+ <requires optional="true">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MRefOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MBothOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MMapOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="MDictOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+
+ <!-- Simple & Optional Dependencies with default-implementation -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DISimpleOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl" />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DIVoidOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DIObjectOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DIRefOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DIBothOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DIMapOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DIDictOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="DIMObjectOptionalCheckServiceProvider" architecture="true">
+ <requires optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="DIMRefOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="DIMBothOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="DIMMapOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodCheckServiceProvider"
+ name="DIMDictOptionalCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ optional="true"
+ default-implementation="org.apache.felix.ipojo.runtime.core.test.components.FooServiceDefaultImpl">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Multiple Dependencies -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="SimpleMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedSimpleMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" />
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="VoidMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedVoidMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ObjectMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedObjectMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="RefMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedRefMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="BothMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedBothMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="MapMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedMapMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="DictMultipleCheckServiceProvider" architecture="true" >
+ <requires field="fs" proxy="false">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedDictMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MObjectMultipleCheckServiceProvider" architecture="true">
+ <requires aggregate="true">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MRefMultipleCheckServiceProvider" architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ aggregate="true">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MBothMultipleCheckServiceProvider" architecture="true">
+ <requires aggregate="true">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MMapMultipleCheckServiceProvider" architecture="true">
+ <requires aggregate="true">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MDictMultipleCheckServiceProvider" architecture="true">
+ <requires aggregate="true">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Multiple & Optional Dependencies -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="SimpleOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" proxy="false"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="VoidOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ObjectOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="RefOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" proxy="false">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedSimpleOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedVoidOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedObjectOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MultipleCheckService"
+ name="ProxiedRefOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MObjectOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires aggregate="true" optional="true">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.MethodMultipleCheckService"
+ name="MRefOptionalMultipleCheckServiceProvider"
+ architecture="true">
+ <requires
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"
+ aggregate="true" optional="true">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Aggregate dependency as List -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.ListCheckService"
+ name="SimpleListCheckServiceProvider" architecture="true">
+ <requires proxy="false"
+ field="fs" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.ListCheckService"
+ name="OptionalListCheckServiceProvider"
+ architecture="true">
+ <requires proxy="false"
+ specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true" />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.ListCheckService"
+ name="ProxiedSimpleListCheckServiceProvider" architecture="true">
+ <requires field="fs" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.ListCheckService"
+ name="ProxiedOptionalListCheckServiceProvider"
+ architecture="true">
+ <requires specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true" />
+ <provides />
+ </component>
+
+ <!-- Aggregate dependency as Vector -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.VectorCheckService"
+ name="SimpleVectorCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="objectBind"/>
+ <callback type="unbind" method="objectUnbind"/>
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.VectorCheckService"
+ name="OptionalVectorCheckServiceProvider"
+ architecture="true">
+ <requires specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true" />
+ <provides />
+ </component>
+
+ <!-- Aggregate dependency as Set -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.SetCheckService"
+ name="SimpleSetCheckServiceProvider" architecture="true">
+ <requires proxy="false" field="fs" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.SetCheckService"
+ name="OptionalSetCheckServiceProvider"
+ architecture="true">
+ <requires proxy="false" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true" />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.SetCheckService"
+ name="ProxiedSimpleSetCheckServiceProvider" architecture="true">
+ <requires field="fs" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.SetCheckService"
+ name="ProxiedOptionalSetCheckServiceProvider"
+ architecture="true">
+ <requires specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true" />
+ <provides />
+ </component>
+
+ <!-- Aggregate dependency as Collection -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CollectionCheckService"
+ name="SimpleCollectionCheckServiceProvider" architecture="true">
+ <requires field="fs" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" proxy="false"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CollectionCheckService"
+ name="ProxiedSimpleCollectionCheckServiceProvider" architecture="true">
+ <requires field="fs" specification="org.apache.felix.ipojo.runtime.core.test.services.FooService"/>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CollectionCheckService"
+ name="OptionalCollectionCheckServiceProvider"
+ architecture="true">
+ <requires specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true"
+ proxy="false"
+ />
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CollectionCheckService"
+ name="ProxiedOptionalCollectionCheckServiceProvider"
+ architecture="true">
+ <requires specification="org.apache.felix.ipojo.runtime.core.test.services.FooService" field="fs" optional="true"
+ proxy="false"
+ />
+ <provides />
+ </component>
+
+
+ <!-- Modify method test -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.FooProviderType2"
+ name="FooProviderType-Updatable" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" value="foo"/>
+ </provides>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="VoidModifyCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ <callback type="modified" method="voidModify"/>
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="ObjectModifyCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ <callback type="modified" method="objectModify" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="RefModifyCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ <callback type="modified" method="refModify" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="BothModifyCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ <callback type="modified" method="bothModify" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="MapModifyCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="propertiesMapBind" />
+ <callback type="unbind" method="propertiesMapUnbind" />
+ <callback type="modified" method="propertiesMapModify" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.CheckServiceProvider"
+ name="DictModifyCheckServiceProvider" architecture="true">
+ <requires field="fs">
+ <callback type="bind" method="propertiesDictionaryBind" />
+ <callback type="unbind" method="propertiesDictionaryUnbind" />
+ <callback type="modified" method="propertiesDictionaryModify" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Proxy Tests -->
+ <component classname="org.apache.felix.ipojo.runtime.core.test.components.proxy.CheckServiceDelegator">
+ <provides/>
+ <requires field="fs" optional="true"/>
+ </component>
+ <component classname="org.apache.felix.ipojo.runtime.core.test.components.proxy.CheckServiceGetAndDelegate">
+ <provides/>
+ <requires field="fs" optional="true"/>
+ </component>
+ <component classname="org.apache.felix.ipojo.runtime.core.test.components.proxy.CheckServiceNoDelegate">
+ <provides/>
+ <requires field="fs" optional="true"/>
+ <callback transition="validate" method="start"/>
+ <callback transition="invalidate" method="stop"/>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.proxy.CheckServiceUsingStringService"
+ immediate="true">
+ <provides/>
+ <requires field="string"/>
+ <requires field="map"/>
+ </component>
+
+ <!-- Inner + Proxy mix -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.inner.C1">
+ <provides/>
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.inner.C2">
+ <provides specifications="org.apache.felix.ipojo.runtime.core.test.components.inner.C2"/>
+ <requires field="c1"/>
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.test.components.inner.C3">
+ <provides specifications="org.apache.felix.ipojo.runtime.core.test.components.inner.C3"/>
+ <requires field="c2"/>
+ </component>
+
+</ipojo>
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java?rev=1450123&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java Tue Feb 26 10:48:11 2013
@@ -0,0 +1,254 @@
+package org.apache.felix.ipojo.runtime.core.test.dependencies;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+/**
+ * Bootstrap the test from this project
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class Common {
+
+ @Inject
+ BundleContext bc;
+
+ protected OSGiHelper osgiHelper;
+ protected IPOJOHelper ipojoHelper;
+
+ Bundle testedBundle;
+
+ @Configuration
+ public Option[] config() throws MalformedURLException {
+ Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ root.setLevel(Level.INFO);
+
+ return options(
+ cleanCaches(),
+ ipojoBundles(),
+ junitBundles(),
+ testedBundle(),
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+ );
+ }
+
+ @Before
+ public void commonSetUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+
+ testedBundle = osgiHelper.getBundle("test.bundle");
+
+ // Dump OSGi Framework information
+ String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
+ if (vendor == null) {
+ vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
+ }
+ String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
+ System.out.println("OSGi Framework : " + vendor + " - " + version);
+
+ // Wait for stability.
+ waitForStability(bc);
+ }
+
+ /**
+ * Waits for stability:
+ * <ul>
+ * <li>all bundles are activated
+ * <li>service count is stable
+ * </ul>
+ * If the stability can't be reached after a specified time,
+ * the method throws a {@link IllegalStateException}.
+ *
+ * @param context the bundle context
+ * @throws IllegalStateException when the stability can't be reach after a several attempts.
+ */
+ private void waitForStability(BundleContext context) throws IllegalStateException {
+ // Wait for bundle initialization.
+ boolean bundleStability = getBundleStability(context);
+ int count = 0;
+ while (!bundleStability && count < 500) {
+ try {
+ Thread.sleep(5);
+ } catch (InterruptedException e) {
+ // Interrupted
+ }
+ count++;
+ bundleStability = getBundleStability(context);
+ }
+
+ if (count == 500) {
+ System.out.println("Bundle stability isn't reached after 500 tries");
+ dumpBundles(context);
+ throw new IllegalStateException("Cannot reach the bundle stability");
+ }
+
+ boolean serviceStability = false;
+ count = 0;
+ int count1 = 0;
+ int count2 = 0;
+ while (!serviceStability && count < 500) {
+ try {
+ ServiceReference[] refs = context.getServiceReferences((String) null, null);
+ count1 = refs.length;
+ Thread.sleep(500);
+ refs = context.getServiceReferences((String) null, null);
+ count2 = refs.length;
+ serviceStability = count1 == count2;
+ } catch (Exception e) {
+ System.err.println(e);
+ serviceStability = false;
+ // Nothing to do, while recheck the condition
+ }
+ count++;
+ }
+
+ if (count == 500) {
+ System.err.println("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
+ dumpBundles(context);
+ throw new IllegalStateException("Cannot reach the service stability");
+ }
+
+ }
+
+ /**
+ * Are bundle stables.
+ *
+ * @param bc the bundle context
+ * @return <code>true</code> if every bundles are activated.
+ */
+ private boolean getBundleStability(BundleContext bc) {
+ boolean stability = true;
+ Bundle[] bundles = bc.getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ stability = stability && (bundles[i].getState() == Bundle.ACTIVE);
+ }
+ return stability;
+ }
+
+ /**
+ * Prints the bundle list.
+ *
+ * @param bc the bundle context.
+ */
+ public void dumpBundles(BundleContext bc) {
+ System.out.println("Bundles:");
+ Bundle[] bundles = bc.getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ System.out.println(bundles[i].getSymbolicName() + " - " + bundles[i].getState());
+ }
+ }
+
+
+ @After
+ public void commonTearDown() {
+ osgiHelper.dispose();
+ ipojoHelper.dispose();
+ }
+
+ public CompositeOption ipojoBundles() {
+ return new DefaultCompositeOption(
+ mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
+ mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject());
+ }
+
+ public CompositeOption eventadmin() {
+ return new DefaultCompositeOption(
+ mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.3.0"),
+ mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin",
+ "1.8.0").versionAsInProject());
+ }
+
+ public Option testedBundle() throws MalformedURLException {
+ File out = new File("target/bundles/bundle.jar");
+ if (out.exists()) {
+ return bundle(out.toURI().toURL().toExternalForm());
+ }
+
+ TinyBundle tested = TinyBundles.bundle();
+
+ // We look inside target/classes to find the class and resources
+ File classes = new File("target/classes");
+ Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
+ List<File> services = new ArrayList<File>();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ // By convention we export of .services and .service package
+ if (file.getName().endsWith("services") || file.getName().endsWith("service")) {
+ services.add(file);
+ }
+ } else {
+ // We need to compute the path
+ String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1);
+ tested.add(path, file.toURI().toURL());
+ System.out.println(file.getName() + " added to " + path);
+ }
+ }
+
+ // We export 'inner'
+ String export = "org.apache.felix.ipojo.runtime.core.test.components.inner";
+ for (File file : services) {
+ if (export.length() > 0) {
+ export += ", ";
+ }
+ String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1);
+ String packageName = path.replace('/', '.');
+ export += packageName;
+ }
+
+ System.out.println("Exported packages : " + export);
+
+ InputStream inputStream = tested
+ .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
+ .set(Constants.IMPORT_PACKAGE, "*")
+ .set(Constants.EXPORT_PACKAGE, export)
+ .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
+
+ try {
+ org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
+ return bundle(out.toURI().toURL().toExternalForm());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Cannot compute the url of the manipulated bundle");
+ } catch (IOException e) {
+ throw new RuntimeException("Cannot write of the manipulated bundle");
+ }
+ }
+
+ public BundleContext getContext() {
+ return bc;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java?rev=1450123&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java Tue Feb 26 10:48:11 2013
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.dependencies.di;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.runtime.core.test.dependencies.Common;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestDelayedOptionalDependencies extends Common {
+
+ ComponentInstance instance1, instance2, instance3, instance4, instance5;
+
+ ComponentInstance fooProvider;
+
+ @Before
+ public void setUp() {
+ try {
+ Properties prov = new Properties();
+ prov.put("instance.name", "FooProvider");
+ fooProvider = ipojoHelper.getFactory("FooProviderType-1").createComponentInstance(prov);
+
+ Properties i1 = new Properties();
+ i1.put("instance.name", "Simple");
+ instance1 = ipojoHelper.getFactory("DISimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+ instance1.stop();
+
+ Properties i2 = new Properties();
+ i2.put("instance.name", "Void");
+ instance2 = ipojoHelper.getFactory("DIVoidOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2.stop();
+
+ Properties i3 = new Properties();
+ i3.put("instance.name", "Object");
+ instance3 = ipojoHelper.getFactory("DIObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3.stop();
+
+ Properties i4 = new Properties();
+ i4.put("instance.name", "Ref");
+ instance4 = ipojoHelper.getFactory("DIRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4.stop();
+
+ Properties i5 = new Properties();
+ i5.put("instance.name", "Both");
+ instance5 = ipojoHelper.getFactory("DIBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5.stop();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ @After
+ public void tearDown() {
+ instance1.dispose();
+ instance2.dispose();
+ instance3.dispose();
+ instance4.dispose();
+ instance5.dispose();
+ fooProvider.dispose();
+ instance1 = null;
+ instance2 = null;
+ instance3 = null;
+ instance4 = null;
+ instance5 = null;
+ fooProvider = null;
+ }
+
+ @Test
+ public void testSimple() {
+ instance1.start();
+
+ ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check architecture availability", arch_ref);
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ ServiceReference cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
+ Properties props = cs.getProps();
+
+ // Check properties
+ assertTrue("check CheckService invocation - 1", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation - 1", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation - 1", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation - 1", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation - 1", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation - 1", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+ assertNotNull("Check FS invocation (object) - 1", props.get("object"));
+ assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
+ assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, a provider is here
+ assertEquals("check void bind invocation - 2", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation - 2", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation - 2", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation - 2", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation - 2", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation - 2", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+ assertNull("Check FS invocation (object) - 2", props.get("object"));
+ assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 5);
+ assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 5);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 5.0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+
+ instance1.stop();
+ }
+
+ @Test
+ public void testVoid() {
+ instance2.start();
+ ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check architecture availability", arch_ref);
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ ServiceReference cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
+ Properties props = cs.getProps();
+ // Check properties
+ assertTrue("check CheckService invocation - 1", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation - 1", ((Integer) props.get("voidB")).intValue(), 1);
+ assertEquals("check void unbind callback invocation - 1", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation - 1", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation - 1", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation - 1", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+ assertNotNull("Check FS invocation (object) - 1", props.get("object"));
+ assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
+ assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -2", ((Integer) props.get("voidB")).intValue(), 1);
+ assertEquals("check void unbind callback invocation -2", ((Integer) props.get("voidU")).intValue(), 1);
+ assertEquals("check object bind callback invocation -2", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -2", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -2", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -2", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+ assertNull("Check FS invocation (object) - 2", props.get("object"));
+ assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 5);
+ assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 5);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 5.0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+
+ instance2.stop();
+ }
+
+ @Test
+ public void testObject() {
+ instance3.start();
+ ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance3.getInstanceName());
+ assertNotNull("Check architecture availability", arch_ref);
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ ServiceReference cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
+ Properties props = cs.getProps();
+ // Check properties
+ assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -1", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -1", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -1", ((Integer) props.get("objectB")).intValue(), 1);
+ assertEquals("check object unbind callback invocation -1", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -1", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -1", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -2", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -2", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -2", ((Integer) props.get("objectB")).intValue(), 1);
+ assertEquals("check object unbind callback invocation -2", ((Integer) props.get("objectU")).intValue(), 1);
+ assertEquals("check ref bind callback invocation -2", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -2", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+
+ instance3.stop();
+ }
+
+ @Test
+ public void testRef() {
+ instance4.start();
+
+ ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance4.getInstanceName());
+ assertNotNull("Check architecture availability", arch_ref);
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ ServiceReference cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance4.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
+ Properties props = cs.getProps();
+ // Check properties
+ assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -1", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -1", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -1", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -1", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -1", ((Integer) props.get("refB")).intValue(), 1);
+ assertEquals("check ref unbind callback invocation -1", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -2", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -2", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -2", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -2", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -2", ((Integer) props.get("refB")).intValue(), 1);
+ assertEquals("check ref unbind callback invocation -2", ((Integer) props.get("refU")).intValue(), 1);
+ assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+
+ instance4.stop();
+ }
+
+ @Test
+ public void testBoth() {
+ instance5.start();
+
+ ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance5.getInstanceName());
+ assertNotNull("Check architecture availability", arch_ref);
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ ServiceReference cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance5.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
+ Properties props = cs.getProps();
+ // Check properties
+ assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -1", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -1", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -1", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -1", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -1", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -1", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 1);
+ assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ //Check properties
+ assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -2", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -2", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -2", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -2", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -2", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -2", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 1);
+ assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 1);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+
+ instance4.stop();
+ }
+
+}