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 12:02:58 UTC
svn commit: r1450130 [3/4] - in
/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies:
./ 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/apache/fel...
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/main/resources/metadata.xml?rev=1450130&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/main/resources/metadata.xml Tue Feb 26 11:02:56 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-policies/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-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java?rev=1450130&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/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-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java Tue Feb 26 11:02:56 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-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/comparator/TestComparator.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/comparator/TestComparator.java?rev=1450130&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/comparator/TestComparator.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/comparator/TestComparator.java Tue Feb 26 11:02:56 2013
@@ -0,0 +1,139 @@
+package org.apache.felix.ipojo.runtime.core.test.dependencies.comparator;
+
+import org.apache.felix.ipojo.ComponentInstance;
+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.assertNotNull;
+
+public class TestComparator extends Common {
+
+ String gradeFactory = "COMPARATOR-gradedFooProvider";
+ String dynamic = "COMPARATOR-DynamicCheckService";
+ String dynamicpriority = "COMPARATOR-DynamicPriorityCheckService";
+
+
+ ComponentInstance dynInstance;
+ ComponentInstance dpInstance;
+
+ @Before
+ public void setUp() {
+ dynInstance = ipojoHelper.createComponentInstance(dynamic, (Properties) null);
+ dpInstance = ipojoHelper.createComponentInstance(dynamicpriority, (Properties) null);
+ }
+
+ @After
+ public void tearDown() {
+ ipojoHelper.dispose();
+ }
+
+ @Test
+ public void testDynamic() {
+ createGrade(1);
+ ComponentInstance grade2 = createGrade(2);
+
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), dynInstance.getInstanceName());
+ assertNotNull("CS availability", ref);
+
+ CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties result = cs.getProps();
+ int fsGrade = ((Integer) result.get("fs")).intValue();
+ int fs2Grade = ((Integer) result.get("fs2")).intValue();
+ int[] fssGrades = (int[]) result.get("fss");
+
+ assertEquals("fs grade -1", 2, fsGrade);
+ assertEquals("fs2 grade -1", 2, fs2Grade);
+ assertEquals("fss grade size -1", 2, fssGrades.length);
+
+
+ assertEquals("fss grade[0] -1", 2, fssGrades[0]);
+ assertEquals("fss grade[1] -1", 1, fssGrades[1]);
+
+ createGrade(3);
+ result = cs.getProps();
+ fsGrade = ((Integer) result.get("fs")).intValue();
+ fs2Grade = ((Integer) result.get("fs2")).intValue();
+ fssGrades = (int[]) result.get("fss");
+
+ assertEquals("fs grade -2", 2, fsGrade);
+ assertEquals("fs2 grade -2", 2, fs2Grade);
+ assertEquals("fss grade size -2", 3, fssGrades.length);
+ assertEquals("fss grade[0] -2", 2, fssGrades[0]);
+ assertEquals("fss grade[1] -2", 1, fssGrades[1]);
+ assertEquals("fss grade[2] -2", 3, fssGrades[2]);
+
+ grade2.stop();
+
+ result = cs.getProps();
+ fsGrade = ((Integer) result.get("fs")).intValue();
+ fs2Grade = ((Integer) result.get("fs2")).intValue();
+ fssGrades = (int[]) result.get("fss");
+
+ assertEquals("fs grade -3", 3, fsGrade);
+ assertEquals("fs2 grade -3", 3, fs2Grade);
+ assertEquals("fss grade size -3", 2, fssGrades.length);
+ assertEquals("fss grade[0] -3", 1, fssGrades[0]);
+ assertEquals("fss grade[1] -3", 3, fssGrades[1]);
+ }
+
+ @Test
+ public void testDynamicPriority() {
+ createGrade(1);
+ ComponentInstance grade2 = createGrade(2);
+
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), dpInstance.getInstanceName());
+ assertNotNull("CS availability", ref);
+
+ CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties result = cs.getProps();
+ int fsGrade = ((Integer) result.get("fs")).intValue();
+ int fs2Grade = ((Integer) result.get("fs2")).intValue();
+ int[] fssGrades = (int[]) result.get("fss");
+
+ assertEquals("fs grade -1", 2, fsGrade);
+ assertEquals("fs2 grade -1", 2, fs2Grade);
+ assertEquals("fss grade size -1", 2, fssGrades.length);
+ assertEquals("fss grade[0] -1", 2, fssGrades[0]);
+ assertEquals("fss grade[1] -1", 1, fssGrades[1]);
+
+ createGrade(3);
+ result = cs.getProps();
+ fsGrade = ((Integer) result.get("fs")).intValue();
+ fs2Grade = ((Integer) result.get("fs2")).intValue();
+ fssGrades = (int[]) result.get("fss");
+
+ assertEquals("fs grade -2", 3, fsGrade);
+ assertEquals("fs2 grade -2", 3, fs2Grade);
+ assertEquals("fss grade size -2", 3, fssGrades.length);
+ assertEquals("fss grade[0] -2", 3, fssGrades[0]);
+ assertEquals("fss grade[1] -2", 2, fssGrades[1]);
+ assertEquals("fss grade[2] -2", 1, fssGrades[2]);
+
+ grade2.stop();
+
+ result = cs.getProps();
+ fsGrade = ((Integer) result.get("fs")).intValue();
+ fs2Grade = ((Integer) result.get("fs2")).intValue();
+ fssGrades = (int[]) result.get("fss");
+
+ assertEquals("fs grade -3", 3, fsGrade);
+ assertEquals("fs2 grade -3", 3, fs2Grade);
+ assertEquals("fss grade size -3", 2, fssGrades.length);
+ assertEquals("fss grade[0] -3", 3, fssGrades[0]);
+ assertEquals("fss grade[1] -3", 1, fssGrades[1]);
+ }
+
+ private ComponentInstance createGrade(int grade) {
+ Properties props = new Properties();
+ props.put("grade", new Integer(grade));
+ return ipojoHelper.createComponentInstance(gradeFactory, props);
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestDynamicPriority.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestDynamicPriority.java?rev=1450130&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestDynamicPriority.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestDynamicPriority.java Tue Feb 26 11:02:56 2013
@@ -0,0 +1,165 @@
+/*
+ * 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.policies;
+
+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.apache.felix.ipojo.runtime.core.test.services.FooService;
+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 TestDynamicPriority extends Common {
+
+ ComponentInstance instance1, instance3;
+ ComponentInstance fooProvider;
+ ComponentInstance fooProvider2;
+
+ @Before
+ public void setUp() {
+ try {
+ Properties prov = new Properties();
+ prov.put("instance.name", "FooProvider-1");
+ prov.put("service.ranking", "1");
+ fooProvider = ipojoHelper.getFactory("RankedFooProviderType").createComponentInstance(prov);
+ fooProvider.stop();
+
+ Properties prov2 = new Properties();
+ prov2.put("instance.name", "FooProvider-2");
+ prov2.put("service.ranking", "0");
+ fooProvider2 = ipojoHelper.getFactory("RankedFooProviderType").createComponentInstance(prov2);
+ fooProvider2.stop();
+
+ Properties i1 = new Properties();
+ i1.put("instance.name", "Simple");
+ instance1 = ipojoHelper.getFactory("DPSimpleCheckServiceProvider").createComponentInstance(i1);
+
+ Properties i3 = new Properties();
+ i3.put("instance.name", "Object");
+ instance3 = ipojoHelper.getFactory("DPObjectCheckServiceProvider").createComponentInstance(i3);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ }
+
+ @After
+ public void tearDown() {
+ instance1.dispose();
+ instance3.dispose();
+ fooProvider.dispose();
+ fooProvider2.dispose();
+ instance1 = null;
+ instance3 = null;
+ fooProvider = null;
+ fooProvider2 = null;
+ }
+
+ @Test
+ public void testSimple() {
+ 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 invalidity - 1", id.getState() == ComponentInstance.INVALID);
+
+ fooProvider.start();
+ fooProvider2.start();
+
+ 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);
+ // Check grade
+ Integer grade = (Integer) cs.getProps().get("int");
+ assertEquals("Check first grade", 1, grade.intValue());
+
+ fooProvider.stop(); // Turn off the best provider.
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ // Check grade
+ grade = (Integer) cs.getProps().get("int");
+ assertEquals("Check second grade", 0, grade.intValue());
+
+ fooProvider.start(); // Turn on the best provider.
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+
+ cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ // Check grade
+ grade = (Integer) cs.getProps().get("int");
+ assertEquals("Check third grade", 1, grade.intValue());
+
+
+ // Increase the second provider grade.
+ ServiceReference fs_ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider2.getInstanceName());
+ assertNotNull("Check foo service (2) reference", fs_ref);
+ FooService fs = (FooService) getContext().getService(fs_ref);
+
+ fs.foo(); // Increase the grade (now = 2)
+
+ cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ // Check grade
+ grade = (Integer) cs.getProps().get("int");
+ assertEquals("Check fourth grade", 2, grade.intValue());
+
+ // Increase the other provider grade.
+ fs_ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider.getInstanceName());
+ assertNotNull("Check foo service (1) reference", fs_ref);
+ fs = (FooService) getContext().getService(fs_ref);
+ fs.foo(); //(grade = 3)
+
+ cs_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check CheckService availability", cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
+ // Check grade
+ grade = (Integer) cs.getProps().get("int");
+ assertEquals("Check fifth grade", 3, grade.intValue());
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(fs_ref);
+ fooProvider.stop();
+ fooProvider2.stop();
+ }
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMethodOptionalDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMethodOptionalDependencies.java?rev=1450130&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMethodOptionalDependencies.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMethodOptionalDependencies.java Tue Feb 26 11:02:56 2013
@@ -0,0 +1,275 @@
+/*
+ * 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.policies;
+
+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 org.junit.Assert.*;
+
+public class TestStaticMethodOptionalDependencies extends Common {
+
+ ComponentInstance 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);
+ fooProvider.stop();
+
+ Properties i3 = new Properties();
+ i3.put("instance.name", "Object");
+ instance3 = ipojoHelper.getFactory("StaticMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+
+ Properties i4 = new Properties();
+ i4.put("instance.name", "Ref");
+ instance4 = ipojoHelper.getFactory("StaticMRefOptionalCheckServiceProvider").createComponentInstance(i4);
+
+ Properties i5 = new Properties();
+ i5.put("instance.name", "Both");
+ instance5 = ipojoHelper.getFactory("StaticMBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @After
+ public void tearDown() {
+ instance3.dispose();
+ instance4.dispose();
+ instance5.dispose();
+ fooProvider.dispose();
+ instance3 = null;
+ instance4 = null;
+ instance5 = null;
+ fooProvider = null;
+ }
+
+ @Test
+ public void testObject() {
+
+ 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
+ assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
+ 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);
+
+ fooProvider.start();
+
+ 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(), 0);
+ assertEquals("check both unbind callback invocation -2", ((Integer) props.get("bothU")).intValue(), 0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -3", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -3", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -3", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -3", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -3", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -3", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation -3", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation -3", ((Integer) props.get("bothU")).intValue(), 0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ }
+
+ @Test
+ public void testRef() {
+ 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
+ assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
+ 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);
+
+ fooProvider.start();
+
+ 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(), 0);
+ assertEquals("check both unbind callback invocation -2", ((Integer) props.get("bothU")).intValue(), 0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -3", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -3", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -3", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -3", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -3", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -3", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation -3", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation -3", ((Integer) props.get("bothU")).intValue(), 0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ }
+
+ @Test
+ public void testBoth() {
+ 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
+ assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
+ 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);
+
+ fooProvider.start();
+
+ 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(), 0);
+ assertEquals("check both unbind callback invocation -2", ((Integer) props.get("bothU")).intValue(), 0);
+
+ fooProvider.stop();
+
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+
+ cs = (CheckService) getContext().getService(cs_ref);
+ props = cs.getProps();
+ // Check properties
+ assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
+ assertEquals("check void bind invocation -3", ((Integer) props.get("voidB")).intValue(), 0);
+ assertEquals("check void unbind callback invocation -3", ((Integer) props.get("voidU")).intValue(), 0);
+ assertEquals("check object bind callback invocation -3", ((Integer) props.get("objectB")).intValue(), 0);
+ assertEquals("check object unbind callback invocation -3", ((Integer) props.get("objectU")).intValue(), 0);
+ assertEquals("check ref bind callback invocation -3", ((Integer) props.get("refB")).intValue(), 0);
+ assertEquals("check ref unbind callback invocation -3", ((Integer) props.get("refU")).intValue(), 0);
+ assertEquals("check both bind callback invocation -3", ((Integer) props.get("bothB")).intValue(), 0);
+ assertEquals("check both unbind callback invocation -3", ((Integer) props.get("bothU")).intValue(), 0);
+
+ id = null;
+ cs = null;
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ }
+
+}