You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 22:05:20 UTC
svn commit: r1075147 [20/23] - in /aries/tags/blueprint-0.3: ./
blueprint-annotation-api/ blueprint-annotation-api/src/
blueprint-annotation-api/src/main/ blueprint-annotation-api/src/main/java/
blueprint-annotation-api/src/main/java/org/ blueprint-ann...
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/cache.xsd
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/cache.xsd?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/cache.xsd (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/cache.xsd Sun Feb 27 21:05:07 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ 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.
+-->
+<xsd:schema xmlns="http://cache.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://cache.org"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0.0">
+
+ <xsd:element name="lru-cache">
+ <xsd:complexType>
+ <xsd:attribute name="id" type="xsd:string"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="operation">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string"/>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-bad-id-ref.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-bad-id-ref.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-bad-id-ref.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-bad-id-ref.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ default-availability="mandatory" >
+
+ <bean id="badIdRef" class="org.apache.aries.blueprint.pojos.BeanD">
+ <property name="name">
+ <idref component-id="doesnotexist"/>
+ </property>
+ </bean>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-circular.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-circular.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-circular.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-circular.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="a" class="org.apache.aries.blueprint.pojos.PojoCircular">
+ <property name="circular" ref="b"/>
+ </bean>
+
+ <bean id="b" class="org.apache.aries.blueprint.pojos.PojoCircular">
+ <property name="circular" ref="a"/>
+ </bean>
+
+ <bean id="c" class="org.apache.aries.blueprint.pojos.PojoCircular" init-method = "init">
+ <property name="circular" ref="d"/>
+ </bean>
+
+ <bean id="d" class="org.apache.aries.blueprint.pojos.PojoCircular">
+ <property name="circular" ref="c"/>
+ </bean>
+
+
+
+ <bean id="serviceBean" class="org.apache.aries.blueprint.pojos.PojoB">
+ <property name="uri" value="urn:myuri" />
+ </bean>
+
+ <bean id="listener" class="org.apache.aries.blueprint.pojos.PojoListener">
+ <property name="service" ref="service" />
+ </bean>
+
+ <service id="service" ref="serviceBean" interface="org.apache.aries.blueprint.pojos.PojoB">
+ <service-properties>
+ <entry key="key1" value="value1"/>
+ <entry key="key2" value="value2"/>
+ </service-properties>
+ <registration-listener ref="listener"
+ registration-method="register"
+ unregistration-method="unregister"/>
+ </service>
+
+ <!-- for prototype cycle tests -->
+
+ <bean id="circularPrototype" class="org.apache.aries.blueprint.pojos.PojoCircular" scope = "prototype">
+ <property name="circular" ref="circularPrototype"/>
+ </bean>
+
+ <bean id="circularPrototypeDriver" class="org.apache.aries.blueprint.pojos.PojoCircular" scope = "prototype">
+ <property name="circular" ref="circularPrototypeDriver"/>
+ </bean>
+
+ <!-- for dynamic cycle tests (blueprintContainer.getComponentInstance()) -->
+
+ <bean id="recursiveConstructor" class="org.apache.aries.blueprint.pojos.PojoRecursive">
+ <argument ref="blueprintContainer"/>
+ <argument value="recursiveConstructor"/>
+ <argument value="1"/>
+ </bean>
+
+ <bean id="recursiveSetter" class="org.apache.aries.blueprint.pojos.PojoRecursive">
+ <argument ref="blueprintContainer"/>
+ <argument value="recursiveSetter"/>
+ <property name="foo" value="1"/>
+ </bean>
+
+ <bean id="recursiveInitMethod" class="org.apache.aries.blueprint.pojos.PojoRecursive" init-method = "init">
+ <argument ref="blueprintContainer"/>
+ <argument value="recursiveInitMethod"/>
+ </bean>
+
+ <!-- for breaking dependency cycle tests -->
+
+ <bean id="c1" class="org.apache.aries.blueprint.pojos.PojoCircular">
+ <argument ref="c2"/>
+ </bean>
+
+ <bean id="c2" class="org.apache.aries.blueprint.pojos.PojoCircular">
+ <argument ref="c3"/>
+ </bean>
+
+ <bean id="c3" class="org.apache.aries.blueprint.pojos.PojoCircular">
+ <property name="circular" ref="c1"/>
+ </bean>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-constructor.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-constructor.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-constructor.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-constructor.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ default-availability="mandatory" >
+
+ <bean id="pojoB" class="org.apache.aries.blueprint.pojos.PojoB">
+ <argument value="urn:myuri" />
+ <argument value="10" />
+ </bean>
+
+ <bean id="pojoA" class="org.apache.aries.blueprint.pojos.PojoA">
+ <argument ref="pojoB" />
+ <property name="number">
+ <value type="java.math.BigInteger">10</value>
+ </property>
+ </bean>
+
+ <bean id="pojoC" class="org.apache.aries.blueprint.pojos.PojoB" factory-method = "createStatic" >
+ <argument><value type="int">15</value></argument>
+ <argument value="urn:myuri" />
+ </bean>
+
+ <bean id="pojoD" class="org.apache.aries.blueprint.pojos.PojoB" factory-method = "createStatic" >
+ <argument value="15" index = "1" />
+ <argument value="urn:myuri" index = "0" />
+ </bean>
+
+ <bean id="pojoE" factory-method = "createDynamic" factory-ref = "pojoB" >
+ <argument><value type="int">20</value></argument>
+ <argument value="urn:myuri" />
+ </bean>
+
+ <bean id="multipleInt" class="org.apache.aries.blueprint.pojos.Multiple">
+ <argument type="int" value="123"/>
+ </bean>
+
+ <bean id="multipleInteger" class="org.apache.aries.blueprint.pojos.Multiple">
+ <argument type="java.lang.Integer" value="123"/>
+ </bean>
+
+ <bean id="multipleString" class="org.apache.aries.blueprint.pojos.Multiple">
+ <argument type="java.lang.String" value="123"/>
+ </bean>
+
+ <bean id="multipleStringConvertable" class="org.apache.aries.blueprint.pojos.Multiple">
+ <argument value="hello"/>
+ </bean>
+
+ <bean id="multipleFactory1" class="org.apache.aries.blueprint.pojos.Multiple"
+ factory-method = "create" >
+ <argument value="hello"/>
+ <argument value="1234"/>
+ </bean>
+
+ <bean id="multipleFactory2" class="org.apache.aries.blueprint.pojos.Multiple"
+ factory-method = "create" >
+ <argument value="helloCreate"/>
+ <argument value="yes"/>
+ </bean>
+
+ <bean id="multipleFactoryNull" class="org.apache.aries.blueprint.pojos.Multiple"
+ factory-method = "create" >
+ <argument value="helloNull"/>
+ <argument><null/></argument>
+ </bean>
+
+ <bean id="multipleFactoryTypedNull" class="org.apache.aries.blueprint.pojos.Multiple"
+ factory-method = "create" >
+ <argument value="hello"/>
+ <argument type = "java.lang.Boolean"><null/></argument>
+ </bean>
+
+ <bean id="mapConstruction" class="org.apache.aries.blueprint.pojos.Multiple">
+ <argument>
+ <map>
+ <entry key="a" value="b"/>
+ </map>
+ </argument>
+ </bean>
+
+ <bean id="propsConstruction" class="org.apache.aries.blueprint.pojos.Multiple">
+ <argument>
+ <props>
+ <prop key="a" value="b"/>
+ </props>
+ </argument>
+ </bean>
+
+ <bean id="booleanPrim" class="org.apache.aries.blueprint.pojos.BeanF">
+ <argument><value type="boolean">no</value></argument>
+ </bean>
+
+ <bean id="booleanWrapped" class="org.apache.aries.blueprint.pojos.BeanF">
+ <argument type="java.lang.Boolean" value="no" />
+ </bean>
+
+</blueprint>
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-custom-nodes.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-custom-nodes.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-custom-nodes.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-custom-nodes.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cache="http://cache.org">
+
+ <cache:lru-cache id="myCache" />
+
+ <bean id="fooService" class="FooServiceImpl" cache:cache-return-values="true">
+ <cache:operation name="getVolatile" />
+
+ <property name="myProp" value="12" />
+ </bean>
+
+ <bean id="barService" class="BarServiceImpl">
+ <property name="localCache">
+ <cache:lru-cache />
+ </property>
+ </bean>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-depends-on.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-depends-on.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-depends-on.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-depends-on.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="c" class="org.apache.aries.blueprint.pojos.BeanC" depends-on="d" init-method="init" destroy-method="destroy"/>
+
+ <bean id="d" class="org.apache.aries.blueprint.pojos.BeanD" init-method="init" destroy-method="destroy"/>
+
+ <bean id="e" class="org.apache.aries.blueprint.pojos.BeanE" init-method="init" destroy-method="destroy">
+ <argument ref="c"/>
+ </bean>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-generics.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-generics.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-generics.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-generics.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ default-availability="mandatory" >
+
+ <bean id="method" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+ <property name="list">
+ <list>
+ <value>10</value>
+ <value>20</value>
+ <value>50</value>
+ </list>
+ </property>
+ <property name="set">
+ <set>
+ <value>1000</value>
+ <value>2000</value>
+ <value>5000</value>
+ </set>
+ </property>
+ <property name="map">
+ <map>
+ <entry key="1" value="yes"/>
+ <entry key="2" value="no" />
+ <entry>
+ <key><value>5</value></key>
+ <value>true</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <bean id="constructorList" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+ <argument type="java.util.List">
+ <list>
+ <value>10</value>
+ <value>20</value>
+ <value>50</value>
+ </list>
+ </argument>
+ </bean>
+
+ <bean id="constructorSet" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+ <argument type="java.util.Set">
+ <set>
+ <value>1000</value>
+ <value>2000</value>
+ <value>5000</value>
+ </set>
+ </argument>
+ </bean>
+
+ <bean id="constructorMap" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+ <argument>
+ <map>
+ <entry key="1" value="yes"/>
+ <entry key="2" value="no" />
+ <entry>
+ <key><value>5</value></key>
+ <value>true</value>
+ </entry>
+ </map>
+ </argument>
+ </bean>
+
+ <bean id="genericPojoFactory" class="org.apache.aries.blueprint.pojos.PrimaveraFactory" />
+ <bean id="genericPojo" factory-ref="genericPojoFactory" factory-method="getObject">
+ <property name="property" value="string" />
+ </bean>
+
+ <bean id="doubleGenericPojo" factory-ref="genericPojoFactory" factory-method="getObject">
+ <property name="property" value="stringToo" />
+ </bean>
+
+</blueprint>
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-simple-component.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-simple-component.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-simple-component.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-simple-component.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="pojoA" class="org.apache.aries.blueprint.pojos.PojoA" depends-on=" pojoB pojoC ">
+ <argument value="val0"/>
+ <argument ref="val1" />
+ <argument>
+ <description>null value</description>
+ <null/>
+ </argument>
+ <argument type="java.lang.String">
+ <value>val3</value>
+ </argument>
+ <argument>
+ <array>
+ <value>val0</value>
+ <bean class="java.lang.String"/>
+ <null/>
+ </array>
+ </argument>
+ <argument>
+ <ref component-id="pojoB"/>
+ </argument>
+ <property name="prop1" ref="pojoB"/>
+ <property name="prop2" value="value" />
+ <property name="prop3">
+ <description>property</description>
+ <value>val</value>
+ </property>
+ </bean>
+
+ <bean id="pojoB" class="org.apache.aries.blueprint.pojos.PojoA" init-method="initPojo" >
+ <argument index = "1" value="val0"/>
+ <argument index = "0" ref="val1" />
+ </bean>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-wiring.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-wiring.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-wiring.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test-wiring.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
+ default-availability="mandatory" >
+
+ <type-converters>
+ <bean id="converter1" class="org.apache.aries.blueprint.pojos.ConverterA">
+ <property name="bundle" ref="blueprintBundleContext" />
+ </bean>
+ </type-converters>
+
+ <service id="service1" ref="pojoB" interface="org.apache.aries.blueprint.pojos.PojoB">
+ <service-properties>
+ <entry key="key1" value="value1"/>
+ <entry key="key2" value="value2"/>
+ </service-properties>
+ </service>
+
+ <bean id="pojoC" class="org.apache.aries.blueprint.pojos.PojoB" scope = "prototype">
+ <property name="uri" value="urn:myuri" />
+ <property name="objects">
+ <list>
+ <value>list value</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="pojoB" class="org.apache.aries.blueprint.pojos.PojoB" init-method = "init" destroy-method = "destroy" >
+ <property name="uri" value="urn:myuri" />
+ </bean>
+
+ <bean id="pojoA" class="org.apache.aries.blueprint.pojos.PojoA">
+ <property name="pojob" ref="pojoB"/>
+ <property name="map">
+ <map>
+ <entry key="key" value="val"/>
+ <entry key-ref="pojoB" value-ref="pojoB" />
+ <entry>
+ <key><value type="java.lang.Integer">5</value></key>
+ <value type="java.net.URI">http://geronimo.apache.org</value>
+ </entry>
+ </map>
+ </property>
+ <property name="set">
+ <set value-type="java.net.URI">
+ <value type="java.lang.String">set value</value>
+ <ref component-id="pojoB" />
+ <value>http://geronimo.apache.org</value>
+ </set>
+ </property>
+ <property name="list">
+ <list>
+ <value>list value</value>
+ <ref component-id="pojoC" />
+ <value type="java.lang.Integer">55</value>
+ <value type="java.net.URI">http://geronimo.apache.org</value>
+ <ref component-id="pojoC" />
+ </list>
+ </property>
+ <property name="props">
+ <props>
+ <prop key="key1" value="value1" />
+ <prop key="2" value="value2" />
+ <prop key="foo">bar</prop>
+ </props>
+ </property>
+ <property name="array">
+ <array>
+ <value>list value</value>
+ <ref component-id="pojoB" />
+ <value type="java.lang.Integer">55</value>
+ <value type="java.net.URI">http://geronimo.apache.org</value>
+ </array>
+ </property>
+ <property name="intArray">
+ <array>
+ <value>1</value>
+ <value>50</value>
+ <value>100</value>
+ </array>
+ </property>
+ <property name="numberArray">
+ <array>
+ <value type="int">1</value>
+ <value type="java.math.BigInteger">50</value>
+ <value type="java.lang.Long">100</value>
+ <value type="int">200</value>
+ </array>
+ </property>
+ <property name="number">
+ <value type="java.math.BigInteger">10</value>
+ </property>
+ </bean>
+
+ <bean id="compound" class="org.apache.aries.blueprint.pojos.PojoB">
+ <property name="bean.name" value="hello bean property" />
+ </bean>
+
+ <bean id="goodIdRef" class="org.apache.aries.blueprint.pojos.BeanD">
+ <property name="name">
+ <idref component-id="pojoA"/>
+ </property>
+ </bean>
+
+ <bean id="FITestBean" ext:field-injection="true" class="org.apache.aries.blueprint.pojos.FITestBean">
+ <property name="attr" value="value" />
+ <property name="upperCaseAttr" value="is_lower" />
+ <property name="bean.name" value="aName" />
+ </bean>
+
+ <bean id="FIFailureTestBean" class="org.apache.aries.blueprint.pojos.FITestBean">
+ <property name="attr" value="value" />
+ </bean>
+
+ <bean id="FIFailureTest2Bean" class="org.apache.aries.blueprint.pojos.FITestBean" ext:field-injection="false">
+ <property name="attr" value="value" />
+ </bean>
+
+ <bean id="ambiguousViaInt" class="org.apache.aries.blueprint.pojos.AmbiguousPojo">
+ <property name="sum" value="5" />
+ </bean>
+
+ <bean id="ambiguousViaList" class="org.apache.aries.blueprint.pojos.AmbiguousPojo">
+ <property name="sum">
+ <list>
+ <value>3</value>
+ <value>4</value>
+ </list>
+ </property>
+ </bean>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-core/src/test/resources/test.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ default-availability="mandatory">
+
+ <description>
+ This is a parsing test application
+ </description>
+
+ <type-converters>
+ <bean class="org.apache.aries.blueprint.pojos.ConverterA"/>
+ <ref component-id="converterB"/>
+ </type-converters>
+
+ <bean id="pojoA" class="org.apache.aries.blueprint.pojos.PojoA">
+ <property name="pojob" ref="pojoB"/>
+ </bean>
+
+ <bean id="pojoAcns" class="org.apache.aries.blueprint.pojos.PojoA">
+ <argument ref="pojoB"/>
+ </bean>
+
+ <bean id="pojoB" class="org.apache.aries.blueprint.pojos.PojoB">
+ <property name="uri" value="urn:myuri"/>
+ </bean>
+
+ <bean id="pojoBcns" class="org.apache.aries.blueprint.pojos.PojoB">
+ <argument value="urn:myuri"/>
+ </bean>
+
+ <bean id="converterB" class="org.apache.aries.blueprint.pojos.ConverterB"/>
+
+ <reference id="refA" filter="(key=prop)" interface="org.apache.aries.blueprint.pojos.InterfaceA"/>
+
+ <reference id="refB" availability="optional">
+ <interfaces>
+ <value>org.apache.aries.blueprint.pojos.InterfaceA</value>
+ </interfaces>
+ <listener ref="listenerA" bind-method="bind" unbind-method="unbind"/>
+ </reference>
+
+ <service interface="org.apache.aries.blueprint.pojos.InterfaceA" ref="pojoA"/>
+
+ <bean id="listenerA" class="org.apache.aries.blueprint.pojos.ListenerA"/>
+
+ <reference-list availability="optional" member-type="service-object"/>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/blueprint-0.3/blueprint-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-itests/pom.xml?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-itests/pom.xml (added)
+++ aries/tags/blueprint-0.3/blueprint-itests/pom.xml Sun Feb 27 21:05:07 2011
@@ -0,0 +1,222 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint</artifactId>
+ <version>0.3</version>
+ </parent>
+
+ <artifactId>org.apache.aries.blueprint.itests</artifactId>
+ <name>Apache Aries Blueprint iTests</name>
+ <description>
+ Integration tests using the standalone blueprint-bundle for the implementation
+ and blueprint-sample for the blueprint application to be tested.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.sample</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testbundleb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit-extender-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.runner</groupId>
+ <artifactId>pax-runner-no-jcl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.proxy</groupId>
+ <artifactId>org.apache.aries.proxy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.quiesce</groupId>
+ <artifactId>org.apache.aries.quiesce.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testquiescebundle</artifactId>
+ <version>${project.version}</version>
+ <type>bundle</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ <version>${project.version}</version>
+ <type>bundle</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.cm</artifactId>
+ <version>${project.version}</version>
+ <type>bundle</type>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <excludes>
+ <exclude>**/*$*</exclude>
+ <exclude>**/Abstract*.java</exclude>
+ </excludes>
+ <includes>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>maven-paxexam-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ <configuration>
+ <outputFile>${project.build.directory}/test-classes/META-INF/maven/dependencies.properties</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>ci-build-profile</id>
+ <activation>
+ <property>
+ <name>maven.repo.local</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--
+ when the local repo location has been specified, we need to pass
+ on this information to PAX mvn url
+ -->
+ <argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Added: aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java (added)
+++ aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java Sun Feb 27 21:05:07 2011
@@ -0,0 +1,299 @@
+/*
+ * 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.aries.blueprint.itests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.*;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Currency;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.aries.blueprint.sample.Account;
+import org.apache.aries.blueprint.sample.AccountFactory;
+import org.apache.aries.blueprint.sample.Bar;
+import org.apache.aries.blueprint.sample.Foo;
+import org.junit.After;
+import org.junit.Before;
+import org.ops4j.pax.exam.CoreOptions;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.util.tracker.ServiceTracker;
+
+public abstract class AbstractIntegrationTest {
+
+ public static final long DEFAULT_TIMEOUT = 60000;
+
+ private List<ServiceTracker> srs;
+
+ @Before
+ public void setUp() {
+ srs = new ArrayList<ServiceTracker>();
+ }
+
+ @After
+ public void tearDown() throws Exception{
+ for (ServiceTracker st : srs) {
+ if (st != null) {
+ st.close();
+ }
+ }
+ }
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ protected BlueprintContainer getBlueprintContainerForBundle(String symbolicName) throws Exception {
+ return getBlueprintContainerForBundle(symbolicName, DEFAULT_TIMEOUT);
+ }
+
+ protected BlueprintContainer getBlueprintContainerForBundle(String symbolicName, long timeout) throws Exception {
+ return getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=" + symbolicName + ")", timeout);
+ }
+
+ protected BlueprintContainer getBlueprintContainerForBundle(BundleContext bc, String symbolicName, long timeout) throws Exception {
+ return getOsgiService(bc, BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=" + symbolicName + ")", timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type, long timeout) {
+ return getOsgiService(type, null, timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, null, DEFAULT_TIMEOUT);
+ }
+
+ protected <T> T getOsgiService(BundleContext bc, Class<T> type, String filter, long timeout) {
+ ServiceTracker tracker = null;
+ try {
+ String flt;
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")";
+ } else {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))";
+ }
+ } else {
+ flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ Filter osgiFilter = FrameworkUtil.createFilter(flt);
+ tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter, null);
+ tracker.open();
+
+ // add tracker to the list of trackers we close at tear down
+ srs.add(tracker);
+ Object svc = type.cast(tracker.waitForService(timeout));
+ if (svc == null) {
+ throw new RuntimeException("Gave up waiting for service " + flt);
+ }
+ return type.cast(svc);
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
+ return getOsgiService(null, type, filter, timeout);
+ }
+
+ protected Bundle installBundle(String groupId, String artifactId) throws Exception {
+ MavenArtifactProvisionOption mvnUrl = mavenBundle(groupId, artifactId);
+ return bundleContext.installBundle(mvnUrl.getURL());
+ }
+
+ protected Bundle getInstalledBundle(String symbolicName) {
+ for (Bundle b : bundleContext.getBundles()) {
+ if (b.getSymbolicName().equals(symbolicName)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
+ }
+
+ public static MavenArtifactProvisionOption mavenBundleInTest(String groupId, String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).version(getArtifactVersion(groupId, artifactId));
+ }
+
+ //TODO getArtifactVersion and getFileFromClasspath are borrowed and modified from pax-exam. They should be moved back ASAP.
+ public static String getArtifactVersion( final String groupId,
+ final String artifactId )
+ {
+ final Properties dependencies = new Properties();
+ try
+ {
+ InputStream in = getFileFromClasspath("META-INF/maven/dependencies.properties");
+ try {
+ dependencies.load(in);
+ } finally {
+ in.close();
+ }
+ final String version = dependencies.getProperty( groupId + "/" + artifactId + "/version" );
+ if( version == null )
+ {
+ throw new RuntimeException(
+ "Could not resolve version. Do you have a dependency for " + groupId + "/" + artifactId
+ + " in your maven project?"
+ );
+ }
+ return version;
+ }
+ catch( IOException e )
+ {
+ // TODO throw a better exception
+ throw new RuntimeException(
+ "Could not resolve version. Did you configured the plugin in your maven project?"
+ + "Or maybe you did not run the maven build and you are using an IDE?"
+ );
+ }
+ }
+
+ private static InputStream getFileFromClasspath( final String filePath )
+ throws FileNotFoundException
+ {
+ try
+ {
+ URL fileURL = AbstractIntegrationTest.class.getClassLoader().getResource( filePath );
+ if( fileURL == null )
+ {
+ throw new FileNotFoundException( "File [" + filePath + "] could not be found in classpath" );
+ }
+ return fileURL.openStream();
+ }
+ catch (IOException e)
+ {
+ throw new FileNotFoundException( "File [" + filePath + "] could not be found: " + e.getMessage() );
+ }
+ }
+
+
+ protected static Option[] updateOptions(Option[] options) {
+ // We need to add pax-exam-junit here when running with the ibm
+ // jdk to avoid the following exception during the test run:
+ // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
+ if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+ Option[] ibmOptions = options(
+ wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit"))
+ );
+ options = combine(ibmOptions, options);
+ }
+
+ return options;
+ }
+
+ protected void testBlueprintContainer(Bundle bundle) throws Exception {
+ testBlueprintContainer(bundleContext, bundle);
+ }
+
+
+ protected void testBlueprintContainer(BundleContext bc, Bundle bundle) throws Exception {
+ BlueprintContainer blueprintContainer = getBlueprintContainerForBundle(
+ bc == null ? bundleContext : bc, "org.apache.aries.blueprint.sample",
+ DEFAULT_TIMEOUT);
+ assertNotNull(blueprintContainer);
+
+ Object obj = blueprintContainer.getComponentInstance("bar");
+ assertNotNull(obj);
+ assertEquals(Bar.class, obj.getClass());
+ Bar bar = (Bar) obj;
+ assertNotNull(bar.getContext());
+ assertEquals("Hello FooBar", bar.getValue());
+ assertNotNull(bar.getList());
+ assertEquals(2, bar.getList().size());
+ assertEquals("a list element", bar.getList().get(0));
+ assertEquals(Integer.valueOf(5), bar.getList().get(1));
+ obj = blueprintContainer.getComponentInstance("foo");
+ assertNotNull(obj);
+ assertEquals(Foo.class, obj.getClass());
+ Foo foo = (Foo) obj;
+ assertEquals(5, foo.getA());
+ assertEquals(10, foo.getB());
+ assertSame(bar, foo.getBar());
+ assertEquals(Currency.getInstance("PLN"), foo.getCurrency());
+ assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"),
+ foo.getDate());
+
+ assertTrue(foo.isInitialized());
+ assertFalse(foo.isDestroyed());
+
+ obj = getOsgiService(bc == null ? bundleContext : bc, Foo.class, null, DEFAULT_TIMEOUT);
+ assertNotNull(obj);
+ assertEquals(obj, foo);
+
+ obj = blueprintContainer.getComponentInstance("accountOne");
+ assertNotNull(obj);
+ Account account = (Account)obj;
+ assertEquals(1, account.getAccountNumber());
+
+ obj = blueprintContainer.getComponentInstance("accountTwo");
+ assertNotNull(obj);
+ account = (Account)obj;
+ assertEquals(2, account.getAccountNumber());
+
+ obj = blueprintContainer.getComponentInstance("accountThree");
+ assertNotNull(obj);
+ account = (Account)obj;
+ assertEquals(3, account.getAccountNumber());
+
+ obj = blueprintContainer.getComponentInstance("accountFactory");
+ assertNotNull(obj);
+ AccountFactory accountFactory = (AccountFactory)obj;
+ assertEquals("account factory", accountFactory.getFactoryName());
+
+ bundle.stop();
+
+ Thread.sleep(1000);
+
+ try {
+ blueprintContainer = getBlueprintContainerForBundle(bc == null ? bundleContext : bc,
+ "org.apache.aries.blueprint.sample", 1);
+ fail("BlueprintContainer should have been unregistered");
+ } catch (Exception e) {
+ // Expected, as the module container should have been unregistered
+ }
+
+ assertTrue(foo.isInitialized());
+ assertTrue(foo.isDestroyed());
+ }
+
+}
Added: aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractMultiBundleTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractMultiBundleTest.java?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractMultiBundleTest.java (added)
+++ aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/AbstractMultiBundleTest.java Sun Feb 27 21:05:07 2011
@@ -0,0 +1,189 @@
+/*
+ * 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.aries.blueprint.itests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.aries.blueprint.BeanProcessor;
+import org.apache.aries.blueprint.testbundlea.NSHandlerOne;
+import org.apache.aries.blueprint.testbundlea.NSHandlerTwo;
+import org.apache.aries.blueprint.testbundlea.ProcessableBean;
+import org.apache.aries.blueprint.testbundlea.ProcessableBean.Phase;
+import org.apache.aries.blueprint.testbundleb.TestBean;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.Bundle;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+
+public class AbstractMultiBundleTest extends AbstractIntegrationTest{
+
+ private void checkInterceptorLog(String []expected, List<String> log){
+ assertNotNull("interceptor log should not be null",log);
+ System.out.println("Log:");
+ for(String entry: log){
+ System.out.println(""+entry);
+ }
+ assertEquals("interceptor log size does not match expected size",expected.length,log.size());
+
+ List<String> extra=new ArrayList<String>();
+ boolean[] found = new boolean[expected.length];
+ for(String s : log){
+ boolean used=false;
+ for(int i=0; i<expected.length; i++){
+ if(s.startsWith(expected[i])){
+ found[i]=true;
+ used=true;
+ }
+ }
+ if(!used){
+ extra.add(s);
+ }
+ }
+ if(extra.size()!=0){
+ String extraFormatted="{";
+ for(String e:extra){
+ extraFormatted+=e+" ";
+ }
+ extraFormatted+="}";
+ fail("surplus interceptor invocations present in invocation log "+extraFormatted);
+ }
+ for(int i=0; i<found.length; i++){
+ assertTrue("interceptor invocation "+expected[i]+" not found",found[i]);
+ }
+ }
+
+ protected void doCommonMultiBundleTest() throws Exception {
+
+ //bundlea provides the ns handlers, bean processors, interceptors etc for this test.
+ Bundle bundlea = getInstalledBundle("org.apache.aries.blueprint.testbundlea");
+ assertNotNull(bundlea);
+ bundlea.start();
+
+ //bundleb makes use of the extensions provided by bundlea
+ Bundle bundleb = getInstalledBundle("org.apache.aries.blueprint.testbundleb");
+ assertNotNull(bundleb);
+ bundleb.start();
+
+ //bundleb's container will hold the beans we need to query to check the function
+ //provided by bundlea functioned as expected
+ BlueprintContainer beanContainer =
+ getBlueprintContainerForBundle( bundleContext , "org.apache.aries.blueprint.testbundleb", DEFAULT_TIMEOUT);
+ assertNotNull(beanContainer);
+
+ //TestBeanA should have the values below, no interference should be present from other sources.
+ Object obj1 = beanContainer.getComponentInstance("TestBeanA");
+ assertTrue(obj1 instanceof TestBean);
+ TestBean testBeanA = (TestBean)obj1;
+ org.junit.Assert.assertEquals("RED", testBeanA.getRed());
+ org.junit.Assert.assertEquals("GREEN", testBeanA.getGreen());
+ org.junit.Assert.assertEquals("BLUE", testBeanA.getBlue());
+
+ //TestBeanB tests that a custom ns handler is able to inject custom components to the blueprint,
+ //and modify existing components, and use injected components as modifications.
+ Object obj2 = beanContainer.getComponentInstance("TestBeanB");
+ assertTrue(obj2 instanceof TestBean);
+ TestBean testBeanB = (TestBean)obj2;
+ //value should be set in via the added passthroughmetadata via the nshandler.
+ org.junit.Assert.assertEquals("ONE_VALUE", testBeanB.getRed());
+ org.junit.Assert.assertEquals("GREEN", testBeanB.getGreen());
+ org.junit.Assert.assertEquals("BLUE", testBeanB.getBlue());
+
+ //TestBeanC tests that custom ns handlers can add interceptors to beans.
+ Object obj3 = beanContainer.getComponentInstance("TestBeanC");
+ assertTrue(obj3 instanceof TestBean);
+ TestBean testBeanC = (TestBean)obj3;
+
+ //handlers are in bundlea, with its own container.
+ BlueprintContainer handlerContainer =
+ getBlueprintContainerForBundle( bundleContext , "org.apache.aries.blueprint.testbundlea", DEFAULT_TIMEOUT);
+ assertNotNull(handlerContainer);
+
+ Object ns1 = handlerContainer.getComponentInstance("NSHandlerOne");
+ assertTrue(ns1 instanceof NSHandlerOne);
+
+ Object ns2 = handlerContainer.getComponentInstance("NSHandlerTwo");
+ assertTrue(ns2 instanceof NSHandlerTwo);
+ NSHandlerTwo nstwo = (NSHandlerTwo)ns2;
+
+ //now we have a handle to the nshandler2, we can query what it 'saw', and ensure
+ //that the interceptors are functioning as expected.
+ List<String> log = nstwo.getLog();
+
+ //TestBeanC has the interceptor configured, and is injected to OtherBeanA & OtherBeanB
+ //which then uses the injected bean during their init method call, to invoke a method
+ checkInterceptorLog(new String[] {
+ "PRECALL:TestBeanC:methodToInvoke:[RED]:",
+ "POSTCALL[true]:TestBeanC:methodToInvoke:[RED]:",
+ "PRECALL:TestBeanC:methodToInvoke:[BLUE]:",
+ "POSTCALL[false]:TestBeanC:methodToInvoke:[BLUE]:"
+ }, log);
+
+ //invoking GREEN is hardwired to cause an exception response, we do this
+ //from here to ensure the exception occurs and is visible as expected
+ RuntimeException re=null;
+ try{
+ testBeanC.methodToInvoke("GREEN");
+ }catch(RuntimeException e){
+ re=e;
+ }
+ assertNotNull("invocation of Green did not cause an exception as expected",re);
+
+ //Exception responses should be intercepted too, test for the POSTCALLWITHEXCEPTION log entry.
+ log = nstwo.getLog();
+ checkInterceptorLog(new String[] {
+ "PRECALL:TestBeanC:methodToInvoke:[RED]:",
+ "POSTCALL[true]:TestBeanC:methodToInvoke:[RED]:",
+ "PRECALL:TestBeanC:methodToInvoke:[BLUE]:",
+ "POSTCALL[false]:TestBeanC:methodToInvoke:[BLUE]:",
+ "PRECALL:TestBeanC:methodToInvoke:[GREEN]:",
+ "POSTCALLEXCEPTION[java.lang.RuntimeException: MATCHED ON GREEN (GREEN)]:TestBeanC:methodToInvoke:[GREEN]:"
+ }, log);
+
+ //ProcessedBean is a test to ensure that BeanProcessors are called..
+ //The test has the BeanProcessor look for ProcessableBeans, and log itself with them
+ Object obj4 = beanContainer.getComponentInstance("ProcessedBean");
+ assertTrue(obj4 instanceof ProcessableBean);
+ ProcessableBean pb = (ProcessableBean)obj4;
+
+ //Note, the BeanProcessor exists in the same container as the beans it processes!!
+ Object bp = beanContainer.getComponentInstance("http://ns.handler.three/BeanProcessor");
+ assertNotNull(bp);
+ assertTrue(bp instanceof BeanProcessor);
+ assertEquals(1,pb.getProcessedBy().size());
+ //check we were invoked..
+ assertEquals(pb.getProcessedBy().get(0),bp);
+ //check invocation for each phase.
+ assertEquals(pb.getProcessedBy(Phase.BEFORE_INIT).get(0),bp);
+ assertEquals(pb.getProcessedBy(Phase.AFTER_INIT).get(0),bp);
+ //destroy invocation will only occur at tear down.. TODO, how to test after teardown.
+ //assertEquals(pb.getProcessedBy(Phase.BEFORE_DESTROY).get(0),bp);
+ //assertEquals(pb.getProcessedBy(Phase.AFTER_DESTROY).get(0),bp);
+ }
+}
Added: aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java (added)
+++ aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java Sun Feb 27 21:05:07 2011
@@ -0,0 +1,144 @@
+/*
+ * 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.aries.blueprint.itests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.framework.CompositeBundle;
+import org.osgi.service.framework.CompositeBundleFactory;
+
+/**
+ * This test is based on the BlueprintContainerBTCustomizerTest. but this test starts the
+ * blueprint sample before the blueprint bundle is started so going a slightly
+ * different code path
+ *
+ */
+@RunWith(JUnit4TestRunner.class)
+public class BlueprintContainer2BTCustomizerTest extends AbstractIntegrationTest {
+
+ @Test
+ public void test() throws Exception {
+ // Create a config to check the property placeholder
+ ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+ Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
+ Hashtable props = new Hashtable();
+ props.put("key.b", "10");
+ cf.update(props);
+
+
+ ServiceReference sr = bundleContext.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
+ if (sr != null) {
+ // install blueprint.sample into the composite context
+ CompositeBundleFactory cbf = (CompositeBundleFactory)bundleContext.getService(sr);
+
+ Map<String, String> frameworkConfig = new HashMap<String, String>();
+ // turn on the line below to enable telnet localhost 10000 to the child framework osgi console
+ // frameworkConfig.put("osgi.console", "10000");
+
+ // construct composite bundle information
+ Map<String, String> compositeManifest = new HashMap<String, String>();
+ compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, "test-composite");
+ compositeManifest.put(Constants.BUNDLE_VERSION, "1.0.0");
+ // this import-package is used by the blueprint.sample
+ compositeManifest.put(Constants.IMPORT_PACKAGE, "org.osgi.service.blueprint;version=\"[1.0.0,2.0.0)\", org.osgi.service.blueprint.container;version=1.0");
+ // this export-package is used by pax junit runner as it needs to see the blueprint sample package
+ // for the test after the blueprint sample is started.
+ compositeManifest.put(Constants.EXPORT_PACKAGE, "org.apache.aries.blueprint.sample");
+
+ CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
+
+ BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext();
+ // install the blueprint sample onto the framework associated with the composite bundle
+ MavenArtifactProvisionOption mapo = mavenBundleInTest("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample");
+ // let's use input stream to avoid invoking mvn url handler which isn't avail in the child framework.
+ InputStream is = new URL(mapo.getURL()).openStream();
+ Bundle bundle = compositeBundleContext.installBundle(mapo.getURL(), is);
+ assertNotNull(bundle);
+
+ // start the composite bundle then the blueprint sample
+ cb.start();
+ bundle.start();
+
+ // start the blueprint bundle and it should detect the previously started blueprint sample
+ Bundle blueprintBundle = getInstalledBundle("org.apache.aries.blueprint");
+ blueprintBundle.start();
+ Thread.sleep(2000);
+
+ // do the test
+ testBlueprintContainer(compositeBundleContext, bundle);
+
+ // unget the service
+ bundleContext.ungetService(sr);
+ }
+ }
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix Config Admin
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ // Felix mvn url handler
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+
+ // this is how you set the default log level when using pax logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+ mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
+ mavenBundle("asm", "asm-all"),
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint").noStart(),
+ // don't install the blueprint sample here as it will be installed onto the same framework as the blueprint core bundle
+ // mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+// org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+
+ equinox().version("3.5.0")
+ );
+
+ options = updateOptions(options);
+ return options;
+ }
+
+}
Added: aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java (added)
+++ aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java Sun Feb 27 21:05:07 2011
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.itests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.util.Hashtable;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.Bundle;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+/**
+ * this test is based on blueprint container test, but this test starts the
+ * blueprint sample before the blueprint bundle is started so going a slightly
+ * different code path
+ *
+ */
+@RunWith(JUnit4TestRunner.class)
+public class BlueprintContainer2Test extends AbstractIntegrationTest {
+
+ @Test
+ public void test() throws Exception {
+ // Create a config to check the property placeholder
+ ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+ Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
+ Hashtable props = new Hashtable();
+ props.put("key.b", "10");
+ cf.update(props);
+
+ Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+ Bundle blueprintBundle = getInstalledBundle("org.apache.aries.blueprint");
+ assertNotNull(bundle);
+
+ bundle.start();
+ blueprintBundle.start();
+
+ // do the test
+ testBlueprintContainer(bundle);
+ }
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix Config Admin
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ // Felix mvn url handler
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+
+ // this is how you set the default log level when using pax logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+ mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
+ mavenBundle("asm", "asm-all"),
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint").noStart(),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+// org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+
+ equinox().version("3.5.0")
+ );
+ options = updateOptions(options);
+ return options;
+ }
+
+}
Added: aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java?rev=1075147&view=auto
==============================================================================
--- aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java (added)
+++ aries/tags/blueprint-0.3/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java Sun Feb 27 21:05:07 2011
@@ -0,0 +1,151 @@
+/*
+ * 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.aries.blueprint.itests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.framework.CompositeBundle;
+import org.osgi.service.framework.CompositeBundleFactory;
+
+/**
+ * This test is based on the BlueprintContainerTest. The difference is that in this test,
+ * the blueprint sample is installed into a child framework that is associated with a composite
+ * bundle created from CompositeBundleFactory. This test only runs when the CompositeBundleFactory
+ * service is avail in the OSGi service registry.
+ *
+ */
+@RunWith(JUnit4TestRunner.class)
+public class BlueprintContainerBTCustomizerTest extends AbstractIntegrationTest {
+
+ @Test
+ public void test() throws Exception {
+ // Create a config to check the property placeholder
+ ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+ Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
+ Hashtable props = new Hashtable();
+ props.put("key.b", "10");
+ cf.update(props);
+
+
+ ServiceReference sr = bundleContext.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
+ if (sr != null) {
+ // install blueprint.sample into the composite context
+ CompositeBundleFactory cbf = (CompositeBundleFactory)bundleContext.getService(sr);
+
+ Map<String, String> frameworkConfig = new HashMap<String, String>();
+ // turn on the line below to enable telnet localhost 10000 to the child framework osgi console
+ // frameworkConfig.put("osgi.console", "10000");
+
+ // construct composite bundle information
+ Map<String, String> compositeManifest = new HashMap<String, String>();
+ compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, "test-composite");
+ compositeManifest.put(Constants.BUNDLE_VERSION, "1.0.0");
+ // this import-package is used by the blueprint.sample
+ compositeManifest.put(Constants.IMPORT_PACKAGE, "org.osgi.service.blueprint;version=\"[1.0.0,2.0.0)\", org.osgi.service.blueprint.container;version=1.0");
+ // this export-package is used by pax junit runner as it needs to see the blueprint sample package
+ // for the test after the blueprint sample is started.
+ compositeManifest.put(Constants.EXPORT_PACKAGE, "org.apache.aries.blueprint.sample");
+
+ CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
+
+ BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext();
+ // install the blueprint sample onto the framework associated with the composite bundle
+ MavenArtifactProvisionOption mapo = mavenBundleInTest("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample");
+ // let's use input stream to avoid invoking mvn url handler which isn't avail in the child framework.
+ InputStream is = new URL(mapo.getURL()).openStream();
+ Bundle bundle = compositeBundleContext.installBundle(mapo.getURL(), is);
+ assertNotNull(bundle);
+
+ // start the composite bundle then the blueprint sample
+ cb.start();
+ bundle.start();
+
+ // do the test
+ testBlueprintContainer(compositeBundleContext, bundle);
+
+ // unget the service
+ bundleContext.ungetService(sr);
+
+ }
+ }
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix Config Admin
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ // Felix mvn url handler
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+
+ // this is how you set the default log level when using pax logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+ mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
+ mavenBundle("asm", "asm-all"),
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+ // don't install the blueprint sample here as it will be installed onto the same framework as the blueprint core bundle
+ //mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+// org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+
+ /* For debugging, uncomment the next two lines */
+// vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
+// waitForFrameworkStartup(),
+
+ /* For debugging, uncomment the next two lines
+ and add these imports:
+ import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+ import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+ */
+ equinox().version("3.5.1")
+ );
+ options = updateOptions(options);
+ return options;
+ }
+
+}