Re-structure the test suites, use withiPOJO and OSGi test helpers.
Also update some test to the latest tinybundles.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@939968 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/api/pom.xml b/ipojo/tests/api/pom.xml
index 9b47e54..9378c82 100644
--- a/ipojo/tests/api/pom.xml
+++ b/ipojo/tests/api/pom.xml
@@ -1,6 +1,13 @@
<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>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<groupId>ipojo.tests</groupId>
<artifactId>org.apache.felix.ipojo.tests.api</artifactId>
<packaging>jar</packaging>
@@ -20,6 +27,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -29,24 +37,6 @@
</execution>
</executions>
</plugin>
-
- <!-- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-paxexam-config</id>
- <goals>
- <goal>generate-paxexam-config</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <settings>
- <platform>felix</platform>
- </settings>
- </configuration>
- </plugin> -->
</plugins>
</build>
@@ -54,7 +44,6 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -69,19 +58,16 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.composite</artifactId>
- <version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.manipulator</artifactId>
- <version>1.6.0</version>
</dependency>
<!-- For external handler management -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.handler.whiteboard</artifactId>
- <version>1.4.0</version>
</dependency>
<!--
diff --git a/ipojo/tests/bundleAsiPOJO/tests/pom.xml b/ipojo/tests/bundleAsiPOJO/tests/pom.xml
index 4382341..b55dd13 100644
--- a/ipojo/tests/bundleAsiPOJO/tests/pom.xml
+++ b/ipojo/tests/bundleAsiPOJO/tests/pom.xml
@@ -20,6 +20,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
diff --git a/ipojo/tests/composite/composite-runtime/pom.xml b/ipojo/tests/composite/composite-runtime/pom.xml
index 9f9ca74..9cf023a 100644
--- a/ipojo/tests/composite/composite-runtime/pom.xml
+++ b/ipojo/tests/composite/composite-runtime/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Composite Test Suite</name>
@@ -37,12 +44,15 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -60,7 +70,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -82,7 +91,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/composite/import-export/pom.xml b/ipojo/tests/composite/import-export/pom.xml
index 2ee3f3d..51846fe 100644
--- a/ipojo/tests/composite/import-export/pom.xml
+++ b/ipojo/tests/composite/import-export/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Composite (Service Import/Export) Test Suite</name>
@@ -35,14 +42,17 @@
<version>1.7.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.metadata</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -65,7 +75,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -84,7 +93,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>${pom.version}</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/composite/service-instance/pom.xml b/ipojo/tests/composite/service-instance/pom.xml
index de19e9d..bd6acc6 100644
--- a/ipojo/tests/composite/service-instance/pom.xml
+++ b/ipojo/tests/composite/service-instance/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Composite (Service Instance) Test Suite</name>
@@ -37,14 +44,17 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
@@ -65,7 +75,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -85,7 +94,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/composite/service-providing/pom.xml b/ipojo/tests/composite/service-providing/pom.xml
index 35d970a..eebf766 100644
--- a/ipojo/tests/composite/service-providing/pom.xml
+++ b/ipojo/tests/composite/service-providing/pom.xml
@@ -16,8 +16,15 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
- <modelVersion>4.0.0</modelVersion>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Composite (Service Providing) Test Suite</name>
<artifactId>tests.composite.service.providing</artifactId>
@@ -37,12 +44,15 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -65,7 +75,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -84,7 +93,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/annotations/pom.xml b/ipojo/tests/core/annotations/pom.xml
index 5d091da..4e4501e 100644
--- a/ipojo/tests/core/annotations/pom.xml
+++ b/ipojo/tests/core/annotations/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Annotations Test Suite</name>
@@ -31,16 +38,18 @@
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.metadata
- </artifactId>
- <version>1.4.0</version>
+ <artifactId>org.apache.felix.ipojo.metadata</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
@@ -83,7 +92,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -105,7 +113,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/bad-configurations/pom.xml b/ipojo/tests/core/bad-configurations/pom.xml
index 23f4a62..00d9273 100644
--- a/ipojo/tests/core/bad-configurations/pom.xml
+++ b/ipojo/tests/core/bad-configurations/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Bad Configurations Test Suite</name>
@@ -32,12 +39,15 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -55,7 +65,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/configadmin/pom.xml b/ipojo/tests/core/configadmin/pom.xml
index 1bd6f8e..1c0eb12 100644
--- a/ipojo/tests/core/configadmin/pom.xml
+++ b/ipojo/tests/core/configadmin/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Configuration Admin Management Test Suite</name>
@@ -32,12 +39,15 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -55,7 +65,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/configuration/pom.xml b/ipojo/tests/core/configuration/pom.xml
index 21a7466..f916852 100644
--- a/ipojo/tests/core/configuration/pom.xml
+++ b/ipojo/tests/core/configuration/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Configuration Management Test Suite</name>
@@ -32,14 +39,17 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
@@ -55,7 +65,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/external-handlers/pom.xml b/ipojo/tests/core/external-handlers/pom.xml
index e091b8a..a1cf136 100644
--- a/ipojo/tests/core/external-handlers/pom.xml
+++ b/ipojo/tests/core/external-handlers/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO External Handler Mechanism Test Suite</name>
@@ -32,12 +39,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +54,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/factories/pom.xml b/ipojo/tests/core/factories/pom.xml
index 3f7dbb5..e158755 100644
--- a/ipojo/tests/core/factories/pom.xml
+++ b/ipojo/tests/core/factories/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Factories Test Suite</name>
@@ -32,12 +39,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +54,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/factory-version/pom.xml b/ipojo/tests/core/factory-version/pom.xml
index 037ee3f..186ef3e 100644
--- a/ipojo/tests/core/factory-version/pom.xml
+++ b/ipojo/tests/core/factory-version/pom.xml
@@ -1,5 +1,29 @@
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>tests.core.factory-version</artifactId>
@@ -20,6 +44,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -91,15 +116,13 @@
<version>1.2.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.test.helpers</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
</dependency>
<dependency>
diff --git a/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java
index 9c36963..9db5b2e 100644
--- a/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java
+++ b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java
@@ -1,6 +1,5 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.knopflerfish;
@@ -10,12 +9,11 @@
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
import org.apache.felix.ipojo.tests.core.component.MyComponent;
import org.apache.felix.ipojo.tests.core.service.MyService;
import org.junit.After;
@@ -32,6 +30,8 @@
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class FactoryVersionTest {
@@ -68,7 +68,7 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
// mavenBundle().groupId( "org.ops4j.pax.swissbox" ).artifactId( "pax-swissbox-tinybundles" ).version(asInProject())
),
provision(
@@ -84,18 +84,18 @@
.add(MyComponent.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"ProviderV1")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service")
- .build( asiPOJOBundle(new File(tmp, "provider-v1.jar"), new File("provider-v1.xml"))),
+ .build( withiPOJO(new File(tmp, "provider-v1.jar"), new File("provider-v1.xml"))),
// Component V1.1 (Bundle Version)
newBundle()
.add(MyComponent.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"ProviderV1.1")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service")
.set(Constants.BUNDLE_VERSION, "1.1")
- .build( asiPOJOBundle(new File(tmp, "provider-v1.1.jar"), new File("provider-v1.1.xml"))),
+ .build( withiPOJO(new File(tmp, "provider-v1.1.jar"), new File("provider-v1.1.xml"))),
// Instance declaration
newBundle()
.set(Constants.BUNDLE_SYMBOLICNAME,"Instances")
- .build( asiPOJOBundle(new File(tmp, "instances.jar"), new File("instances.xml")))
+ .build( withiPOJO(new File(tmp, "instances.jar"), new File("instances.xml")))
)
);
return opt;
@@ -147,7 +147,7 @@
@Test
public void testServiceProperty() throws InvalidSyntaxException {
-
+
// Version 1.0
//ServiceReference refv1 = ipojo.getServiceReferenceByName(MyService.class.getName(), "instance-v1");
ServiceReference[] refv1 = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=instance-v1)");
@@ -156,7 +156,7 @@
Assert.assertEquals("1.0", version);
// Version 1.1
- ServiceReference[] refv11 = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=instance-v1.1)");
+ ServiceReference[] refv11 = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=instance-v1.1)");
//ServiceReference refv11 = ipojo.getServiceReferenceByName(MyService.class.getName(), "instance-v1.1");
Assert.assertNotNull(refv11);
String version11 = (String) refv11[0].getProperty("factory.version");
@@ -164,7 +164,7 @@
Assert.assertEquals("1.1", version11);
// No Version
- ServiceReference[] refany = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=instance-any)");
+ ServiceReference[] refany = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=instance-any)");
// ServiceReference refany = ipojo.getServiceReferenceByName(MyService.class.getName(), "instance-any");
Assert.assertNotNull(refany);
@@ -172,7 +172,7 @@
Assert.assertNotNull(any);
// No version set in the factory, so no version.
- ServiceReference[] refmci = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=MyComponentInstance)");
+ ServiceReference[] refmci = context.getAllServiceReferences(MyService.class.getName(), "(instance.name=MyComponentInstance)");
//ServiceReference refmci = ipojo.getServiceReferenceByName(MyService.class.getName(), "MyComponentInstance");
Assert.assertNotNull(refmci);
String mci = (String) refmci[0].getProperty("factory.version");
diff --git a/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/VersionConflictTest.java b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/VersionConflictTest.java
index 9c159dc..1d8de78 100644
--- a/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/VersionConflictTest.java
+++ b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/VersionConflictTest.java
@@ -1,6 +1,5 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.knopflerfish;
@@ -11,6 +10,7 @@
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.io.FileNotFoundException;
@@ -23,8 +23,6 @@
import org.apache.felix.ipojo.handlers.dependency.Dependency;
import org.apache.felix.ipojo.handlers.dependency.DependencyDescription;
import org.apache.felix.ipojo.handlers.dependency.DependencyHandlerDescription;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
import org.apache.felix.ipojo.tests.core.component.MyComponent;
import org.apache.felix.ipojo.tests.core.component.MyCons;
import org.apache.felix.ipojo.tests.core.service.MyService;
@@ -47,6 +45,8 @@
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class VersionConflictTest {
@@ -87,7 +87,7 @@
.build( withBnd()),
new FileOutputStream(f1),
true);
-
+
File f2 = new File(tmp, "service-interface-v2.jar");
StreamUtils.copyStream(
newBundle()
@@ -98,14 +98,14 @@
.build( withBnd()),
new FileOutputStream(f2),
true);
-
+
File c1 = new File(tmp, "component-v1.jar");
StreamUtils.copyStream(
newBundle()
.add(MyComponent.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"ProviderV1")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service; version=\"[1.0.0, 1.0.0]\"")
- .build( asiPOJOBundle(new File("vprovider-v1.xml"))),
+ .build( withiPOJO(new File("vprovider-v1.xml"))),
new FileOutputStream(c1),
true);
@@ -115,7 +115,7 @@
.add(MyComponent.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"ProviderV2")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service; version=\"[2.0.0, 2.0.0]\"")
- .build( asiPOJOBundle(new File("vprovider-v2.xml"))),
+ .build( withiPOJO(new File("vprovider-v2.xml"))),
new FileOutputStream(c2),
true);
@@ -126,10 +126,10 @@
.set(Constants.BUNDLE_SYMBOLICNAME,"MyCons")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service; version=\"[2.0.0, 2.0.0]\"")
.set(Constants.BUNDLE_VERSION, "2.0")
- .build(asiPOJOBundle(new File("cons.xml"))),
+ .build(withiPOJO(new File("cons.xml"))),
new FileOutputStream(cons),
true);
-
+
File consV1 = new File(tmp, "cons-v1.jar");
StreamUtils.copyStream(
newBundle()
@@ -137,10 +137,10 @@
.set(Constants.BUNDLE_SYMBOLICNAME,"MyCons")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service; version=\"[1.0.0, 1.0.0]\"")
.set(Constants.BUNDLE_VERSION, "1.0")
- .build(asiPOJOBundle(new File("cons.xml"))),
+ .build(withiPOJO(new File("cons.xml"))),
new FileOutputStream(consV1),
true);
-
+
Option[] opt = options(
felix(),
equinox(),
@@ -148,8 +148,7 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject()),
- mavenBundle().groupId("org.ops4j.base").artifactId("ops4j-base-lang").versionAsInProject()
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject(), mavenBundle().groupId("org.ops4j.base").artifactId("ops4j-base-lang").versionAsInProject()
// mavenBundle().groupId( "org.ops4j.pax.swissbox" ).artifactId( "pax-swissbox-tinybundles" ).version(asInProject())
),
systemProperty( "url1" ).value( f1.toURI().toURL().toExternalForm() ),
diff --git a/ipojo/tests/core/handler/pom.xml b/ipojo/tests/core/handler/pom.xml
index 881826a..4b15132 100644
--- a/ipojo/tests/core/handler/pom.xml
+++ b/ipojo/tests/core/handler/pom.xml
@@ -1,4 +1,28 @@
-<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">
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>tests.core.handler</artifactId>
@@ -19,6 +43,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -104,18 +129,13 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO
- </artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <scope>test</scope>
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.test.helpers</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <scope>test</scope>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
</dependency>
</dependencies>
diff --git a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java
index 880e689..63d0c8d 100644
--- a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java
+++ b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/DummyHandlerTest.java
@@ -1,12 +1,13 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
+
import java.io.File;
import java.util.HashMap;
@@ -19,7 +20,6 @@
import org.apache.felix.ipojo.Factory;
import org.apache.felix.ipojo.MissingHandlerException;
import org.apache.felix.ipojo.UnacceptableConfiguration;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
import org.apache.felix.ipojo.tests.core.component.DummyImpl;
import org.apache.felix.ipojo.tests.core.handler.DummyHandler;
import org.apache.felix.ipojo.tests.core.service.Dummy;
@@ -38,6 +38,7 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.useradmin.User;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
import aQute.lib.osgi.Constants;
@@ -51,7 +52,7 @@
*/
private static final int NB_MOCK = 10;
-
+
@Inject
private BundleContext context;
@@ -71,19 +72,19 @@
public static Option[] configure() {
Option[] platform = options(CoreOptions.felix());
- Option[] bundles =
+ Option[] bundles =
options(
provision(
newBundle()
- .add(DummyHandler.class)
- .build(asiPOJOBundle(new File("src/test/resources/dummy-handler.xml")))
+ .add(DummyHandler.class)
+ .build(withiPOJO(new File("src/test/resources/dummy-handler.xml")))
),
provision(
newBundle()
.add(Dummy.class)
.add(DummyImpl.class)
.set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.dummy.test")
- .build(asiPOJOBundle(new File("src/test/resources/dummy-component.xml")))
+ .build(withiPOJO(new File("src/test/resources/dummy-component.xml")))
),
provision(
mavenBundle().groupId("org.apache.felix").artifactId("org.osgi.compendium").version("1.4.0")
@@ -100,8 +101,8 @@
@Configuration
public static Option[] configAdminBundle() {
return options(
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").versionAsInProject());
+ mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").versionAsInProject(),
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject());
}
/**
@@ -173,24 +174,24 @@
ServiceRegistration sr = context.registerService(User.class.getName(), service, null);
registrations.put(service, sr);
}
-
+
//verify that the bind method of the handler has been called
for (User user : registrations.keySet()) {
verify(user).getName();
}
-
+
//verify that the unbind has been called
for (User user : registrations.keySet()) {
registrations.get(user).unregister();
verify(user).getType();
}
-
+
//verify no more interaction
for (User user : registrations.keySet()) {
Mockito.verifyNoMoreInteractions(user);
}
}
-
+
/**
* Test if the bind and unbind methods when the bind services are registered before the instance creation
@@ -198,7 +199,7 @@
@Test
public void testDummyTestBindBeforeStart() {
ComponentInstance instance = null;
-
+
Map<User, ServiceRegistration> registrations = new HashMap<User, ServiceRegistration>();
for (int i = 0; i < NB_MOCK; i++) {
@@ -217,18 +218,18 @@
} catch (MissingHandlerException e) {
} catch (ConfigurationException e) {
}
-
+
//verify that the bind method of the handler has been called
for (User user : registrations.keySet()) {
verify(user).getName();
}
-
+
//verify that the unbind has been called
for (User user : registrations.keySet()) {
registrations.get(user).unregister();
verify(user).getType();
}
-
+
//verify no more interaction
for (User user : registrations.keySet()) {
Mockito.verifyNoMoreInteractions(user);
diff --git a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java
index 72e2bd5..d090cc7 100644
--- a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java
+++ b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/IgnoreCaseHandlerSelectionTest.java
@@ -1,6 +1,5 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.knopflerfish;
@@ -9,6 +8,8 @@
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
+
import java.io.File;
@@ -17,8 +18,6 @@
import org.apache.felix.ipojo.HandlerFactory;
import org.apache.felix.ipojo.architecture.Architecture;
import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
import org.apache.felix.ipojo.tests.core.component.MyComponent;
import org.apache.felix.ipojo.tests.core.handler.EmptyHandler;
import org.apache.felix.ipojo.tests.core.service.MyService;
@@ -36,6 +35,8 @@
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;
/**
* Check that the handler selection ignore case.
@@ -73,7 +74,7 @@
File tmp = new File("target/tmp");
tmp.mkdirs();
-
+
Option[] opt = options(
felix(),
equinox(),
@@ -81,14 +82,14 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").versionAsInProject()
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
newBundle()
.add( MyService.class )
.set( Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface" )
.set( Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service" )
- .build( TinyBundles.withBnd() )
+ .build( TinyBundles.withBnd() )
),
provision(
// Components and the handler
@@ -96,11 +97,11 @@
.add(MyComponent.class) // Component Implementation
.add(EmptyHandler.class) // Handler.
.set(Constants.BUNDLE_SYMBOLICNAME,"IgnoreCase")
- .set(Constants.IMPORT_PACKAGE,
+ .set(Constants.IMPORT_PACKAGE,
"org.apache.felix.ipojo.tests.core.service, " +
"org.apache.felix.ipojo, " +
"org.apache.felix.ipojo.metadata")
- .build(asiPOJOBundle(new File(tmp, "ignorecase.jar"), new File("src/test/resources/ignorecase.xml")))));
+ .build(withiPOJO(new File(tmp, "ignorecase.jar"), new File("src/test/resources/ignorecase.xml")))));
return opt;
}
@@ -149,7 +150,7 @@
HandlerDescription desc = arch.getInstanceDescription()
.getHandlerDescription("orG.apAche.feliX.iPOJO.tests.CORE.hAnDlEr:EmPtY"); // Check with the declared name.
-
+
Assert.assertNotNull(desc);
Assert.assertTrue(desc.isValid());
}
diff --git a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java
index 65a3ef1..cdaa5bd 100644
--- a/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java
+++ b/ipojo/tests/core/handler/src/test/java/org/apache/felix/ipojo/tests/core/Tools.java
@@ -1,8 +1,8 @@
package org.apache.felix.ipojo.tests.core;
import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
public class Tools {
diff --git a/ipojo/tests/core/lifecycle-callback/pom.xml b/ipojo/tests/core/lifecycle-callback/pom.xml
index 821f954..c96d996 100644
--- a/ipojo/tests/core/lifecycle-callback/pom.xml
+++ b/ipojo/tests/core/lifecycle-callback/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Lifecycle callback Test Suite</name>
@@ -32,12 +39,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +54,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/lifecycle-controller/pom.xml b/ipojo/tests/core/lifecycle-controller/pom.xml
index 269bfba..3ef699c 100644
--- a/ipojo/tests/core/lifecycle-controller/pom.xml
+++ b/ipojo/tests/core/lifecycle-controller/pom.xml
@@ -16,7 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Lifecycle controller Test Suite</name>
@@ -32,12 +39,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +54,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/logger/pom.xml b/ipojo/tests/core/logger/pom.xml
index c62b7cd..ad44bdb 100644
--- a/ipojo/tests/core/logger/pom.xml
+++ b/ipojo/tests/core/logger/pom.xml
@@ -1,4 +1,29 @@
-<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">
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>tests.core.logger</artifactId>
@@ -19,6 +44,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -28,92 +54,77 @@
</execution>
</executions>
</plugin>
-
- <!-- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-paxexam-config</id>
- <goals>
- <goal>generate-paxexam-config</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <settings>
- <platform>felix</platform>
- </settings>
- </configuration>
- </plugin> -->
</plugins>
</build>
<dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <version>1.0.0</version>
- </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>1.0.0</version>
+ </dependency>
- <!--
+ <!--
Pax Exam API:
-->
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam</artifactId>
- <version>1.2.0</version>
- </dependency>
- <!--
- During runtime Pax Exam will discover the OSGi container to use by
- searching metadata available into classpath. Pax Exam comes with a
- default container that uses [Pax Runner] for implementing the
- container requirements:
- -->
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-default
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <!--
+ During runtime Pax Exam will discover the OSGi container to use by
+ searching metadata available into classpath. Pax Exam comes with a
+ default container that uses [Pax Runner] for implementing the
+ container requirements:
+ -->
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default
</artifactId>
- <version>1.2.0</version>
- </dependency>
- <!--
- If your test code is based on JUnit you will have to have the Junit
- support artifact:
- -->
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit</artifactId>
- <version>1.2.0</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
- <!-- Tinybundles -->
- <dependency>
- <groupId>org.ops4j.pax.swissbox</groupId>
- <artifactId>pax-swissbox-tinybundles</artifactId>
- <version>1.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO</artifactId>
- <version>${pom.version}</version>
- </dependency>
- </dependencies>
+ <version>1.2.0</version>
+ </dependency>
+ <!--
+ If your test code is based on JUnit you will have to have the Junit
+ support artifact:
+ -->
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ <!-- Tinybundles -->
+ <dependency>
+ <groupId>org.ops4j.pax.swissbox</groupId>
+ <artifactId>pax-swissbox-tinybundles</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
+ </dependency>
+</dependencies>
<repositories>
<repository>
diff --git a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/BNDManifestLoggerInfoTest.java b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/BNDManifestLoggerInfoTest.java
index 9fcd1e4..2b706cd 100644
--- a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/BNDManifestLoggerInfoTest.java
+++ b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/BNDManifestLoggerInfoTest.java
@@ -1,6 +1,5 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -9,6 +8,7 @@
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.util.ArrayList;
@@ -31,6 +31,8 @@
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogReaderService;
import org.osgi.service.log.LogService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class BNDManifestLoggerInfoTest {
@@ -43,17 +45,17 @@
private IPOJOHelper ipojo;
private LogReaderService log;
-
+
@Before
public void init() {
osgi = new OSGiHelper(context);
ipojo = new IPOJOHelper(context);
-
+
log = (LogReaderService) osgi.getServiceObject(LogReaderService.class.getName(), null);
if (log == null) {
throw new RuntimeException("No Log Service !");
}
-
+
LogService logs = (LogService) osgi.getServiceObject(LogService.class.getName(), null);
logs.log(LogService.LOG_WARNING, "Ready");
}
@@ -77,8 +79,8 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId( "org.ops4j.pax.swissbox" ).artifactId( "pax-swissbox-tinybundles" ).version(asInProject()),
- mavenBundle().groupId( "org.apache.felix" ).artifactId( "org.apache.felix.log" ).version(asInProject())
+ mavenBundle().groupId( "org.apache.felix" ).artifactId( "org.apache.felix.log" ).version(asInProject()),
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
newBundle()
@@ -94,12 +96,12 @@
.set(Constants.BUNDLE_SYMBOLICNAME,"MyComponent")
.set(Constants.IMPORT_PACKAGE, "*")
.set("IPOJO-log-level", "info")
- .build( asiPOJOBundle(new File(tmp, "provider-with-level-in-manifest.jar"), new File("component.xml")))
+ .build( withiPOJO(new File(tmp, "provider-with-level-in-manifest.jar"), new File("component.xml")))
)
);
return opt;
}
-
+
@Test
public void testMessages() throws InterruptedException {
List<String> messages = getMessages(log.getLog());
diff --git a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/IPOJOHelper.java b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/IPOJOHelper.java
deleted file mode 100644
index 7755c08..0000000
--- a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/IPOJOHelper.java
+++ /dev/null
@@ -1,730 +0,0 @@
-/*
- * 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.tests.core;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManifestMetadataParser;
-import org.apache.felix.ipojo.parser.ParseException;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ManagedServiceFactory;
-
-/**
- * iPOJO Helper.
- * This helper helps getting {@link Factory}, and managing
- * {@link ComponentInstance}.
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-public class IPOJOHelper {
-
- /**
- * The bundle context.
- */
- private BundleContext m_context;
-
-
- /**
- * List of instances.
- */
- private List<ComponentInstance> m_instances;
-
- /**
- * Creates a IPOJOHelper.
- * @param tc the OSGi Test Case
- */
- public IPOJOHelper(BundleContext context) {
- m_context = context;
- m_instances = new ArrayList<ComponentInstance>();
- }
-
- /**
- * Disposes created instances.
- * @see org.apache.felix.ipojo.junit4osgi.Helper#dispose()
- */
- public void dispose() {
- for (int i = 0; i < m_instances.size(); i++) {
- ((ComponentInstance) m_instances.get(i)).dispose();
- }
- m_instances.clear();
- }
-
- /**
- * Gets a created instance from the instance name.
- * @param name the instance name.
- * @return the created {@link ComponentInstance} or <code>null</code>
- * if the instance was not created during the session.
- */
- public ComponentInstance getInstanceByName(String name) {
- for (int i = 0; i < m_instances.size(); i++) {
- if (((ComponentInstance) m_instances.get(i)).getInstanceName()
- .equals(name)) {
- return (ComponentInstance) m_instances.get(i);
- }
- }
- return null;
- }
-
- /**
- * Creates a new component instance with the given name (and empty
- * configuration), from the factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, String instanceName) {
-
- // Create the instance configuration
- Properties configuration = new Properties();
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(bundle, factoryName, configuration);
- }
-
- /**
- * Creates a new component instance with the given configuration, from the
- * factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param configuration the configuration of the component instance to
- * create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, Dictionary configuration) {
-
- // Retrieve the component factory.
- Factory fact = getFactory(bundle, factoryName);
-
- if (fact == null) {
- // Factory not found...
- throw new IllegalArgumentException(
- "Cannot find the component factory (" + factoryName
- + ") in the specified bundle ("
- + bundle.getSymbolicName() + ").");
- }
-
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Cannot create the component instance with the given configuration:"
- + e.getMessage());
- }
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, String instanceName, Dictionary configuration) {
-
- // Add the instance name to the configuration
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(bundle, factoryName, configuration);
- }
-
- /**
- * Creates a new component instance with the given name (and an empty
- * configuration), from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- String instanceName) {
-
- // Create the instance configuration
- Properties configuration = new Properties();
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(serviceContext, factoryName,
- configuration);
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- Dictionary configuration) {
-
- // Retrieve the component factory.
- Factory fact = getFactory(serviceContext, factoryName);
-
- if (fact == null) {
- // Factory not found...
- throw new IllegalArgumentException(
- "Cannot find the component factory (" + factoryName
- + ") in the specified service context.");
- }
-
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Cannot create the component instance with the given configuration: "
- + e.getMessage());
- }
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- String instanceName, Dictionary configuration) {
-
- // Add the instance name to the configuration
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(serviceContext, factoryName,
- configuration);
- }
-
- /**
- * Creates a new component instance with the given name (and empty
- * configuration), from the factory specified in the local bundle.
- *
- * @param factoryName the name of the component factory, defined in the
- * local bundle.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- String instanceName) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, instanceName);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with the given configuration, from the
- * factory specified in the local bundle.
- *
- * @param factoryName the name of the component factory, in the local
- * bundle.
- * @param configuration the configuration of the component instance to
- * create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- Dictionary configuration) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, configuration);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with no configuration, from the factory
- * specified in the local bundle.
- *
- * @param factoryName the name of the component factory, in the local
- * bundle.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, (Dictionary) null);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given bundle.
- *
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- String instanceName, Dictionary configuration) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, instanceName, configuration);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Returns the component factory with the given name in the local bundle.
- *
- * @param factoryName the name of the factory to retrieve.
- * @return the component factory with the given name in the local bundle, or
- * {@code null} if not found.
- */
- public Factory getFactory(String factoryName) {
- return getFactory(m_context.getBundle(), factoryName);
- }
-
- /**
- * Returns the handler factory with the given name in the local bundle.
- *
- * @param factoryName the name of the handler factory to retrieve.
- * @return the handler factory with the given name in the local bundle, or
- * {@code null} if not found.
- */
- public HandlerFactory getHandlerFactory(String factoryName) {
- return getHandlerFactory(m_context.getBundle(), factoryName);
- }
-
- /**
- * Returns the metadata description of the component defined in this bundle.
- *
- * @param component the name of the locally defined component.
- * @return the metadata description of the component with the given name,
- * defined in this given bundle, or {@code null} if not found.
- */
- public Element getMetadata(String component) {
- return getMetadata(m_context.getBundle(), component);
- }
-
- /**
- * Returns the component factory with the given name in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the defined factory.
- * @return the component factory with the given name in the given bundle, or
- * {@code null} if not found.
- */
- public static Factory getFactory(Bundle bundle, String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the component factories services in the bundle.
- refs = bundle.getBundleContext().getServiceReferences(
- Factory.class.getName(),
- "(factory.name=" + factoryName + ")");
- if (refs != null) {
- return (Factory) bundle.getBundleContext().getService(refs[0]);
- }
-
- // Factory not found...
- return null;
-
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get the component factory services: "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the component factory with the given name, registered in the
- * given service context.
- *
- * @param serviceContext the service context in which the factory service is
- * defined.
- * @param factoryName the name of the factory.
- * @return the component factory with the given name, registered in the
- * given service context.
- */
- public static Factory getFactory(ServiceContext serviceContext,
- String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the component factories services in the service
- // context.
- refs = serviceContext.getServiceReferences(Factory.class.getName(),
- "(factory.name=" + factoryName + ")");
- if (refs != null) {
- return (Factory) serviceContext.getService(refs[0]);
- }
- return null;
-
- } catch (InvalidSyntaxException e) {
- System.err.println("Cannot get the factory " + factoryName + " : "
- + e.getMessage());
- return null;
- }
- }
-
- /**
- * Returns the handler factory with the given name in the given bundle.
- *
- * @param bundle the bundle from which the handler factory is defined.
- * @param factoryName the name of the handler factory to retrieve.
- * @return the handler factory with the given name in the given bundle, or
- * {@code null} if not found.
- */
- public static HandlerFactory getHandlerFactory(Bundle bundle,
- String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the handler factories services in the bundle.
- refs = bundle.getBundleContext().getServiceReferences(
- HandlerFactory.class.getName(),
- "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName
- + ")");
- if (refs != null) {
- return (HandlerFactory) bundle.getBundleContext().getService(
- refs[0]);
- }
-
- // Factory not found...
- return null;
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get the handler factory services: "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the metadata description of the component with the given name,
- * defined in the given bundle.
- *
- * @param bundle the bundle from which the component is defined.
- * @param component the name of the defined component.
- * @return the metadata description of the component with the given name,
- * defined in the given bundle, or {@code null} if not found.
- */
- public static Element getMetadata(Bundle bundle, String component) {
-
- // Retrieves the component description from the bundle's manifest.
- String elem = (String) bundle.getHeaders().get("iPOJO-Components");
- if (elem == null) {
- throw new IllegalArgumentException(
- "Cannot find iPOJO-Components descriptor in the specified bundle ("
- + bundle.getSymbolicName()
- + "). Not an iPOJO bundle.");
- }
-
- // Parses the retrieved description and find the component with the
- // given name.
- try {
- Element element = ManifestMetadataParser.parseHeaderMetadata(elem);
- Element[] childs = element.getElements("component");
- for (int i = 0; i < childs.length; i++) {
- String name = childs[i].getAttribute("name");
- String clazz = childs[i].getAttribute("classname");
- if (name != null && name.equalsIgnoreCase(component)) {
- return childs[i];
- }
- if (clazz.equalsIgnoreCase(component)) {
- return childs[i];
- }
- }
-
- // Component not found...
- return null;
-
- } catch (ParseException e) {
- throw new IllegalStateException(
- "Cannot parse the components from specified bundle ("
- + bundle.getSymbolicName() + "): " + e.getMessage());
- }
- }
-
- /**
- * Returns the service object of a service registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which the service is
- * searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the specified bundle, offering the
- * specified interface and matching the given filter.
- */
- public static Object getServiceObject(ServiceContext serviceContext,
- String itf, String filter) {
- ServiceReference ref = getServiceReference(serviceContext, itf, filter);
- if (ref != null) {
- return serviceContext.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the specified bundle, offering
- * the specified interface and matching the given filter.
- */
- public static Object[] getServiceObjects(ServiceContext serviceContext,
- String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = serviceContext.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference registered in the specified service context,
- * offering the specified interface and matching the given filter.
- * If no service is found, {@code null} is returned.
- */
- public static ServiceReference getServiceReference(
- ServiceContext serviceContext, String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs.length != 0) {
- return refs[0];
- } else {
- // No service found
- return null;
- }
- }
-
- /**
- * Returns the service reference of the service registered in the specified
- * service context, offering the specified interface and having the given
- * persistent ID.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service registered in the specified service context, offering
- * the specified interface and having the given persistent ID.
- */
- public static ServiceReference getServiceReferenceByPID(
- ServiceContext serviceContext, String itf, String pid) {
- String filter = "(" + "service.pid" + "=" + pid + ")";
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- throw new IllegalStateException(
- "A service lookup by PID returned several providers ("
- + refs.length + ")" + " for " + itf + " with pid="
- + pid);
- }
- }
-
- /**
- * Returns the service reference of all the services registered in the
- * specified service context, offering the specified interface and matching
- * the given filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references registered in the specified service
- * context, offering the specified interface and matching the given
- * filter. If no service matches, an empty array is returned.
- */
- public static ServiceReference[] getServiceReferences(
- ServiceContext serviceContext, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- // Get all the service references
- refs = serviceContext.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get service references: " + e.getMessage());
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- /**
- * Returns the service reference of a service registered in the specified
- * service context, offering the specified interface and having the given
- * name.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service registered in the specified service context, offering
- * the specified interface and having the given name.
- */
- public static ServiceReference getServiceReferenceByName(
- ServiceContext serviceContext, String itf, String name) {
- String filter = null;
- if (itf.equals(Factory.class.getName())
- || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else if (itf.equals(Architecture.class.getName())) {
- filter = "(" + "architecture.instance" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- return getServiceReference(serviceContext, itf, filter);
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @return <code>true</code> if the service is available in the service
- * context, <code>false</code> otherwise.
- */
- public static boolean isServiceAvailable(ServiceContext sc, String itf) {
- ServiceReference ref = getServiceReference(sc, itf, null);
- return ref != null;
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @param name the service provider name
- * @return <code>true</code> if the service is available in the service
- * context, <code>false</code> otherwise.
- */
- public static boolean isServiceAvailableByName(ServiceContext sc,
- String itf, String name) {
- ServiceReference ref = getServiceReferenceByName(sc, itf, name);
- return ref != null;
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @param pid the pid of the service
- * @return <code>true</code> if the service is available in the service
- * context, <code>false</code> otherwise.
- */
- public static boolean isServiceAvailableByPID(ServiceContext sc,
- String itf, String pid) {
- ServiceReference ref = getServiceReferenceByPID(sc, itf, pid);
- return ref != null;
- }
-
- /**
- * Returns the service reference of a service provided by the specified
- * bundle, offering the specified interface and having the given name.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given name.
- */
- public static ServiceReference getServiceReferenceByName(Bundle bundle,
- String itf, String name) {
- String filter = null;
- if (itf.equals(Factory.class.getName())
- || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else if (itf.equals(Architecture.class.getName())) {
- filter = "(" + "architecture.instance" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- return OSGiHelper.getServiceReference(bundle, itf, filter);
- }
-
- /**
- * Returns the service reference of a service provided by the local bundle,
- * offering the specified interface and having the given name.
- *
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given name.
- */
- public ServiceReference getServiceReferenceByName(String itf, String name) {
- return getServiceReferenceByName(m_context.getBundle(), itf, name);
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @param name the service provider name
- * @return <code>true</code> if the service is available, <code>false</code>
- * otherwise.
- */
- public boolean isServiceAvailableByName(String itf, String name) {
- ServiceReference ref = getServiceReferenceByName(itf, name);
- return ref != null;
- }
-
-}
diff --git a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/ManifestLoggerInfoTest.java b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/ManifestLoggerInfoTest.java
index 1eb453d..7a9e9b7 100644
--- a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/ManifestLoggerInfoTest.java
+++ b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/ManifestLoggerInfoTest.java
@@ -1,12 +1,12 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.util.ArrayList;
@@ -35,6 +35,8 @@
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogReaderService;
import org.osgi.service.log.LogService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class ManifestLoggerInfoTest {
@@ -47,17 +49,17 @@
private IPOJOHelper ipojo;
private LogReaderService log;
-
+
@Before
public void init() {
osgi = new OSGiHelper(context);
ipojo = new IPOJOHelper(context);
-
+
log = (LogReaderService) osgi.getServiceObject(LogReaderService.class.getName(), null);
if (log == null) {
throw new RuntimeException("No Log Service !");
}
-
+
LogService logs = (LogService) osgi.getServiceObject(LogService.class.getName(), null);
logs.log(LogService.LOG_WARNING, "Ready");
}
@@ -80,7 +82,8 @@
provision(
// Runtime.
mavenBundle().groupId( "org.apache.felix" ).artifactId( "org.apache.felix.log" ).version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject())
+ mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
newBundle()
@@ -96,32 +99,32 @@
.set(Constants.BUNDLE_SYMBOLICNAME,"MyComponent")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service")
.set("ipojo-log-level", "info")
- .build( asiPOJOBundle(new File(tmp, "provider-with-level-in-manifest.jar"), new File("component.xml")))
+ .build( withiPOJO(new File(tmp, "provider-with-level-in-manifest.jar"), new File("component.xml")))
)
);
return opt;
}
-
+
@Test
@Ignore //TODO Why we have a classloading issue here ?
public void testMessages() throws InterruptedException, InvalidSyntaxException {
Bundle bundle = osgi.getBundle("MyComponent");
Assert.assertNotNull(bundle);
Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
-
+
ServiceReference r = ipojo.getServiceReferenceByName(Architecture.class.getName(), "org.apache.felix.ipojo.tests.core.component.MyComponent-0");
Assert.assertNotNull(r);
System.out.println(((Architecture) osgi.getServiceObject(r)).getInstanceDescription().getDescription());
-
+
ServiceReference[] refs = context.getAllServiceReferences(null, null);
for (ServiceReference ref : refs) {
System.out.println(ref.getBundle().getBundleId() + " -> " + Arrays.asList((String[]) ref.getProperty(Constants.OBJECTCLASS)));
}
-
-
-
+
+
+
// Assert.assertNotNull(osgi.getServiceObject(MyService.class.getName(), null));
-
+
// osgi.waitForService("org.apache.felix.ipojo.tests.core.service.MyService", null, 5000);
List<String> messages = getMessages(log.getLog());
System.out.println(messages);
diff --git a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/OSGiHelper.java b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/OSGiHelper.java
deleted file mode 100644
index 39cb03d..0000000
--- a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/OSGiHelper.java
+++ /dev/null
@@ -1,456 +0,0 @@
-package org.apache.felix.ipojo.tests.core;
-
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-
-public class OSGiHelper {
-
- /**
- * The bundle context.
- */
- private BundleContext context;
-
- /**
- * List of get references.
- */
- private List<ServiceReference> m_references = new ArrayList<ServiceReference>();
-
- public OSGiHelper(BundleContext context) {
- this.context = context;
- }
-
- public void dispose() {
- // Unget services
- for (int i = 0; i < m_references.size(); i++) {
- context.ungetService((ServiceReference) m_references.get(i));
- }
- m_references.clear();
- }
-
- /**
- * Gets the Bundle Context.
- * @return the bundle context.
- */
- public BundleContext getContext() {
- return context;
- }
-
- /**
- * Returns the service object of a service provided by the specified bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the specified bundle, offering the
- * specified interface and matching the given filter.
- */
- public static Object getServiceObject(Bundle bundle, String itf,
- String filter) {
- ServiceReference ref = getServiceReference(bundle, itf, filter);
- if (ref != null) {
- return bundle.getBundleContext().getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services provided by the specified
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the specified bundle, offering
- * the specified interface and matching the given filter.
- */
- public static Object[] getServiceObjects(Bundle bundle, String itf,
- String filter) {
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = bundle.getBundleContext().getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service provided by the specified
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference provided by the specified bundle, offering
- * the specified interface and matching the given filter. If no
- * service is found, {@code null} is returned.
- */
- public static ServiceReference getServiceReference(Bundle bundle,
- String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs.length != 0) {
- return refs[0];
- } else {
- // No service found
- return null;
- }
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @return <code>true</code> if the service is available, <code>false</code>
- * otherwise.
- */
- public boolean isServiceAvailable(String itf) {
- ServiceReference ref = getServiceReference(itf, null);
- return ref != null;
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @param pid the service pid
- * @return <code>true</code> if the service is available, <code>false</code>
- * otherwise.
- */
- public boolean isServiceAvailableByPID(String itf, String pid) {
- ServiceReference ref = getServiceReferenceByPID(itf, pid);
- return ref != null;
- }
-
- /**
- * Returns the service reference of the service provided by the specified
- * bundle, offering the specified interface and having the given persistent
- * ID.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given persistent ID.
- */
- public static ServiceReference getServiceReferenceByPID(Bundle bundle,
- String itf, String pid) {
- String filter = "(" + "service.pid" + "=" + pid + ")";
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- throw new IllegalStateException(
- "A service lookup by PID returned several providers ("
- + refs.length + ")" + " for " + itf + " with pid="
- + pid);
- }
- }
-
- /**
- * Returns the service reference of all the services provided in the
- * specified bundle, offering the specified interface and matching the given
- * filter.
- *
- * @param bundle the bundle from which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references provided in the specified bundle,
- * offering the specified interface and matching the given filter.
- * If no service matches, an empty array is returned.
- */
- public static ServiceReference[] getServiceReferences(Bundle bundle,
- String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- // Get all the service references
- refs = bundle.getBundleContext().getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get service references: " + e.getMessage());
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- /**
- * Returns the service object of a service provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the local bundle, offering the
- * specified interface and matching the given filter.
- */
- public Object getServiceObject(String itf, String filter) {
- ServiceReference ref = getServiceReference(itf, filter);
- if (ref != null) {
- m_references.add(ref);
- return context.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service object associated with this service reference.
- *
- * @param ref service reference
- * @return the service object.
- */
- public Object getServiceObject(ServiceReference ref) {
- if (ref != null) {
- m_references.add(ref);
- return context.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the local bundle, offering the
- * specified interface and matching the given filter.
- */
- public Object[] getServiceObjects(String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- m_references.add(refs[i]);
- list[i] = context.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference provided by the local bundle, offering the
- * specified interface and matching the given filter. If no service
- * is found, {@code null} is returned.
- */
- public ServiceReference getServiceReference(String itf, String filter) {
- return getServiceReference(context.getBundle(), itf, filter);
- }
-
- /**
- * Returns the service reference of a service provided offering the
- * specified interface.
- *
- * @param itf the interface provided by the searched service.
- * @return a service reference provided by the local bundle, offering the
- * specified interface and matching the given filter. If no service
- * is found, {@code null} is returned.
- */
- public ServiceReference getServiceReference(String itf) {
- return getServiceReference(context.getBundle(), itf, null);
- }
-
- /**
- * Returns the service reference of the service provided by the local
- * bundle, offering the specified interface and having the given persistent
- * ID.
- *
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service provided by the local bundle, offering the specified
- * interface and having the given persistent ID.
- */
- public ServiceReference getServiceReferenceByPID(String itf, String pid) {
- return getServiceReferenceByPID(context.getBundle(), itf, pid);
- }
-
- /**
- * Returns the service reference of all the services provided in the local
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references provided in the local bundle, offering
- * the specified interface and matching the given filter. If no
- * service matches, an empty array is returned.
- */
- public ServiceReference[] getServiceReferences(String itf, String filter) {
- return getServiceReferences(context.getBundle(), itf, filter);
- }
-
- /**
- * Gets the package admin exposed by the framework.
- * Fails if the package admin is not available.
- * @return the package admin service.
- */
- public PackageAdmin getPackageAdmin() {
- PackageAdmin pa = (PackageAdmin) getServiceObject(PackageAdmin.class.getName(), null);
- if (pa == null) {
- fail("No package admin available");
- }
- return pa;
- }
-
- /**
- * Refresh the packages.
- * Fails if the package admin service is not available.
- */
- public void refresh() {
- getPackageAdmin().refreshPackages(null);
- }
-
- /**
- * Waits for a service. Fails on timeout.
- * If timeout is set to 0, it sets the timeout to 10s.
- * @param itf the service interface
- * @param filter the filter
- * @param timeout the timeout
- */
- public void waitForService(String itf, String filter, long timeout) {
- if (timeout == 0) {
- timeout = 10000; // Default 10 secondes.
- }
- ServiceReference[] refs = getServiceReferences(itf, filter);
- long begin = System.currentTimeMillis();
- if (refs.length != 0) {
- return;
- } else {
- while(refs.length == 0) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- // Interrupted
- }
- long now = System.currentTimeMillis();
-
- if ((now - begin) > timeout) {
- fail("Timeout ... no services matching with the request after " + timeout + "ms");
- }
- refs = getServiceReferences(itf, filter);
- }
- }
- }
-
-
- /**
- * Installs a bundle.
- * Fails if the bundle cannot be installed.
- * Be aware that you have to uninstall the bundle yourself.
- * @param url bundle url
- * @return the installed bundle
- */
- public Bundle installBundle(String url) {
- try {
- return context.installBundle(url);
- } catch (BundleException e) {
- fail("Cannot install the bundle " + url + " : " + e.getMessage());
- }
- return null; // Can not happen
- }
-
- /**
- * Installs a bundle.
- * Fails if the bundle cannot be installed.
- * Be aware that you have to uninstall the bundle yourself.
- * @param url bundle url
- * @param stream input stream containing the bundle
- * @return the installed bundle
- */
- public Bundle installBundle(String url, InputStream stream) {
- try {
- return context.installBundle(url, stream);
- } catch (BundleException e) {
- fail("Cannot install the bundle " + url + " : " + e.getMessage());
- }
- return null; // Can not happen
- }
-
- /**
- * Installs and starts a bundle.
- * Fails if the bundle cannot be installed or an error occurs
- * during startup. Be aware that you have to uninstall the bundle
- * yourself.
- * @param url the bundle url
- * @return the Bundle object.
- */
- public Bundle installAndStart(String url) {
- Bundle bundle = installBundle(url);
- try {
- bundle.start();
- } catch (BundleException e) {
- fail("Cannot start the bundle " + url + " : " + e.getMessage());
- }
- return bundle;
- }
-
- /**
- * Installs and starts a bundle.
- * Fails if the bundle cannot be installed or an error occurs
- * during startup. Be aware that you have to uninstall the bundle
- * yourself.
- * @param url the bundle url
- * @param stream input stream containing the bundle
- * @return the Bundle object.
- */
- public Bundle installAndStart(String url, InputStream stream) {
- Bundle bundle = installBundle(url, stream);
- try {
- bundle.start();
- } catch (BundleException e) {
- fail("Cannot start the bundle " + url + " : " + e.getMessage());
- }
- return bundle;
- }
-
- /**
- * Get the bundle by its id.
- * @param bundleId the bundle id.
- * @return the bundle with the given id.
- */
- public Bundle getBundle(long bundleId) {
- return context.getBundle(bundleId);
- }
-
- /**
- * Gets a bundle by its symbolic name.
- * Fails if no bundle matches.
- * @param name the symbolic name of the bundle
- * @return the bundle object.
- */
- public Bundle getBundle(String name) {
- Bundle[] bundles = context.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (name.equals(bundles[i].getSymbolicName())) {
- return bundles[i];
- }
- }
- fail("No bundles with the given symbolic name " + name);
- return null; // should not happen
- }
-
-}
diff --git a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerInfoTest.java b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerInfoTest.java
index 75dbfab..63f2f40 100644
--- a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerInfoTest.java
+++ b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerInfoTest.java
@@ -1,6 +1,5 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -10,6 +9,7 @@
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.util.ArrayList;
@@ -32,6 +32,8 @@
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogReaderService;
import org.osgi.service.log.LogService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class SystemLoggerInfoTest {
@@ -44,17 +46,17 @@
private IPOJOHelper ipojo;
private LogReaderService log;
-
+
@Before
public void init() {
osgi = new OSGiHelper(context);
ipojo = new IPOJOHelper(context);
-
+
log = (LogReaderService) osgi.getServiceObject(LogReaderService.class.getName(), null);
if (log == null) {
throw new RuntimeException("No Log Service !");
}
-
+
LogService logs = (LogService) osgi.getServiceObject(LogService.class.getName(), null);
logs.log(LogService.LOG_WARNING, "Ready");
}
@@ -77,7 +79,7 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId( "org.ops4j.pax.swissbox" ).artifactId( "pax-swissbox-tinybundles" ).version(asInProject()),
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject(),
mavenBundle().groupId( "org.apache.felix" ).artifactId( "org.apache.felix.log" ).version(asInProject())
),
provision(
@@ -93,13 +95,13 @@
.add(MyComponent.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"MyComponent")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service")
- .build( asiPOJOBundle(new File(tmp, "provider.jar"), new File("component.xml")))
+ .build( withiPOJO(new File(tmp, "provider.jar"), new File("component.xml")))
),
systemProperty( "ipojo.log.level" ).value( "info" )
);
return opt;
}
-
+
@Test
public void testMessages() throws InterruptedException {
List<String> messages = getMessages(log.getLog());
diff --git a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerWarningTest.java b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerWarningTest.java
index 5c012a8..cc4fee6 100644
--- a/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerWarningTest.java
+++ b/ipojo/tests/core/logger/src/test/java/org/apache/felix/ipojo/tests/core/SystemLoggerWarningTest.java
@@ -1,6 +1,5 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
@@ -9,6 +8,7 @@
import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.util.ArrayList;
@@ -31,6 +31,8 @@
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogReaderService;
import org.osgi.service.log.LogService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class SystemLoggerWarningTest {
@@ -43,17 +45,17 @@
private IPOJOHelper ipojo;
private LogReaderService log;
-
+
@Before
public void init() {
osgi = new OSGiHelper(context);
ipojo = new IPOJOHelper(context);
-
+
log = (LogReaderService) osgi.getServiceObject(LogReaderService.class.getName(), null);
if (log == null) {
throw new RuntimeException("No Log Service !");
}
-
+
LogService logs = (LogService) osgi.getServiceObject(LogService.class.getName(), null);
logs.log(LogService.LOG_WARNING, "Ready");
}
@@ -77,7 +79,8 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId( "org.apache.felix" ).artifactId( "org.apache.felix.log" ).version(asInProject())
+ mavenBundle().groupId( "org.apache.felix" ).artifactId( "org.apache.felix.log" ).version(asInProject()),
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
newBundle()
@@ -92,13 +95,13 @@
.add(MyComponent.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"MyComponent")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service")
- .build( asiPOJOBundle(new File(tmp, "provider.jar"), new File("component.xml")))
+ .build( withiPOJO(new File(tmp, "provider.jar"), new File("component.xml")))
),
systemProperty( "ipojo.log.level" ).value( "warning" )
);
return opt;
}
-
+
@Test
public void testMessages() throws InterruptedException {
List<String> messages = getMessages(log.getLog());
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml b/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml
index eb4aac8..9b0f4ca 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Service Dependency (Binding Policy) Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -50,6 +54,11 @@
<version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
<groupId>ipojo.tests</groupId>
<artifactId>tests.core.service.dependency</artifactId>
<version>${pom.version}</version>
@@ -60,7 +69,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -79,7 +87,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/service-dependency-comparator/pom.xml b/ipojo/tests/core/service-dependency-comparator/pom.xml
index c4b48b7..0529c5b 100644
--- a/ipojo/tests/core/service-dependency-comparator/pom.xml
+++ b/ipojo/tests/core/service-dependency-comparator/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Service Dependency Comparator Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -54,13 +58,17 @@
<artifactId>tests.core.service.dependency</artifactId>
<version>${pom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -80,7 +88,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/service-dependency-filter/pom.xml b/ipojo/tests/core/service-dependency-filter/pom.xml
index 7ad0199..7936d7e 100644
--- a/ipojo/tests/core/service-dependency-filter/pom.xml
+++ b/ipojo/tests/core/service-dependency-filter/pom.xml
@@ -1,22 +1,28 @@
<!--
- 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
+ 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
+ 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.
+ 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>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Service Dependency (Filter) Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -54,13 +58,17 @@
<artifactId>tests.core.service.dependency</artifactId>
<version>${pom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -79,7 +87,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/service-dependency-optional/pom.xml b/ipojo/tests/core/service-dependency-optional/pom.xml
index d927ecd..46898ce 100644
--- a/ipojo/tests/core/service-dependency-optional/pom.xml
+++ b/ipojo/tests/core/service-dependency-optional/pom.xml
@@ -1,4 +1,28 @@
-<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">
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>tests.core.dependency.optional</artifactId>
@@ -19,6 +43,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -41,15 +66,8 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.annotations</artifactId>
- <version>1.6.0</version>
</dependency>
<!--
- <dependency> <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <version>1.0.0</version> </dependency>
- -->
-
- <!--
Pax Exam API:
-->
<dependency>
@@ -92,15 +110,12 @@
<version>1.2.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO
- </artifactId>
- <version>${pom.version}</version>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.test.helpers</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
</dependency>
</dependencies>
diff --git a/ipojo/tests/core/service-dependency-optional/src/test/java/org/apache/felix/ipojo/test/optional/NullableTransitiveClassloadingTest.java b/ipojo/tests/core/service-dependency-optional/src/test/java/org/apache/felix/ipojo/test/optional/NullableTransitiveClassloadingTest.java
index 6de1cc1..8704a3f 100644
--- a/ipojo/tests/core/service-dependency-optional/src/test/java/org/apache/felix/ipojo/test/optional/NullableTransitiveClassloadingTest.java
+++ b/ipojo/tests/core/service-dependency-optional/src/test/java/org/apache/felix/ipojo/test/optional/NullableTransitiveClassloadingTest.java
@@ -7,6 +7,7 @@
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
@@ -16,9 +17,6 @@
import org.apache.felix.ipojo.MissingHandlerException;
import org.apache.felix.ipojo.UnacceptableConfiguration;
import org.apache.felix.ipojo.optional.MyComponent;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,6 +27,8 @@
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
import aQute.lib.osgi.Constants;
@@ -73,15 +73,15 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
TinyBundles.newBundle()
.add(MyComponent.class)
.set(Constants.IMPORT_PACKAGE, "*")
- .build(BundleAsiPOJO.asiPOJOBundle(new File("src/main/resources/metadata.xml"))
+ .build(withiPOJO(new File("src/main/resources/metadata.xml"))
)
-
+
));
return opt;
@@ -91,7 +91,7 @@
public void testCreation() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
Factory factory = ipojo.getFactory("optional-log-cons");
ComponentInstance ci = factory.createComponentInstance(null);
-
+
ci.dispose();
}
diff --git a/ipojo/tests/core/service-dependency/pom.xml b/ipojo/tests/core/service-dependency/pom.xml
index 33d2a17..609e2ec 100644
--- a/ipojo/tests/core/service-dependency/pom.xml
+++ b/ipojo/tests/core/service-dependency/pom.xml
@@ -1,22 +1,28 @@
<!--
- 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
+ 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
+ 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.
+ 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>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Service Dependency Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/service-providing-inheritance/pom.xml b/ipojo/tests/core/service-providing-inheritance/pom.xml
index 6adf492..0b1b7a0 100644
--- a/ipojo/tests/core/service-providing-inheritance/pom.xml
+++ b/ipojo/tests/core/service-providing-inheritance/pom.xml
@@ -1,4 +1,29 @@
-<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">
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>tests.core.inheritance</artifactId>
@@ -19,6 +44,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -28,24 +54,6 @@
</execution>
</executions>
</plugin>
-
- <!-- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-paxexam-config</id>
- <goals>
- <goal>generate-paxexam-config</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <settings>
- <platform>felix</platform>
- </settings>
- </configuration>
- </plugin> -->
</plugins>
</build>
@@ -58,7 +66,6 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
</dependency>
<!-- Pax Exam API: -->
@@ -128,23 +135,17 @@
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO
- </artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <scope>test</scope>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.test.helpers</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <scope>test</scope>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.annotations</artifactId>
- <version>1.7.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
diff --git a/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/IPOJOHelper.java b/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/IPOJOHelper.java
deleted file mode 100644
index cb08528e..0000000
--- a/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/IPOJOHelper.java
+++ /dev/null
@@ -1,730 +0,0 @@
-/*
- * 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.tests.inheritance;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManifestMetadataParser;
-import org.apache.felix.ipojo.parser.ParseException;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ManagedServiceFactory;
-
-/**
- * iPOJO Helper.
- * This helper helps getting {@link Factory}, and managing
- * {@link ComponentInstance}.
- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-public class IPOJOHelper {
-
- /**
- * The bundle context.
- */
- private BundleContext m_context;
-
-
- /**
- * List of instances.
- */
- private List<ComponentInstance> m_instances;
-
- /**
- * Creates a IPOJOHelper.
- * @param tc the OSGi Test Case
- */
- public IPOJOHelper(BundleContext context) {
- m_context = context;
- m_instances = new ArrayList<ComponentInstance>();
- }
-
- /**
- * Disposes created instances.
- * @see org.apache.felix.ipojo.junit4osgi.Helper#dispose()
- */
- public void dispose() {
- for (int i = 0; i < m_instances.size(); i++) {
- ((ComponentInstance) m_instances.get(i)).dispose();
- }
- m_instances.clear();
- }
-
- /**
- * Gets a created instance from the instance name.
- * @param name the instance name.
- * @return the created {@link ComponentInstance} or <code>null</code>
- * if the instance was not created during the session.
- */
- public ComponentInstance getInstanceByName(String name) {
- for (int i = 0; i < m_instances.size(); i++) {
- if (((ComponentInstance) m_instances.get(i)).getInstanceName()
- .equals(name)) {
- return (ComponentInstance) m_instances.get(i);
- }
- }
- return null;
- }
-
- /**
- * Creates a new component instance with the given name (and empty
- * configuration), from the factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, String instanceName) {
-
- // Create the instance configuration
- Properties configuration = new Properties();
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(bundle, factoryName, configuration);
- }
-
- /**
- * Creates a new component instance with the given configuration, from the
- * factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param configuration the configuration of the component instance to
- * create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, Dictionary configuration) {
-
- // Retrieve the component factory.
- Factory fact = getFactory(bundle, factoryName);
-
- if (fact == null) {
- // Factory not found...
- throw new IllegalArgumentException(
- "Cannot find the component factory (" + factoryName
- + ") in the specified bundle ("
- + bundle.getSymbolicName() + ").");
- }
-
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Cannot create the component instance with the given configuration:"
- + e.getMessage());
- }
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, String instanceName, Dictionary configuration) {
-
- // Add the instance name to the configuration
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(bundle, factoryName, configuration);
- }
-
- /**
- * Creates a new component instance with the given name (and an empty
- * configuration), from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- String instanceName) {
-
- // Create the instance configuration
- Properties configuration = new Properties();
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(serviceContext, factoryName,
- configuration);
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- Dictionary configuration) {
-
- // Retrieve the component factory.
- Factory fact = getFactory(serviceContext, factoryName);
-
- if (fact == null) {
- // Factory not found...
- throw new IllegalArgumentException(
- "Cannot find the component factory (" + factoryName
- + ") in the specified service context.");
- }
-
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Cannot create the component instance with the given configuration: "
- + e.getMessage());
- }
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- String instanceName, Dictionary configuration) {
-
- // Add the instance name to the configuration
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(serviceContext, factoryName,
- configuration);
- }
-
- /**
- * Creates a new component instance with the given name (and empty
- * configuration), from the factory specified in the local bundle.
- *
- * @param factoryName the name of the component factory, defined in the
- * local bundle.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- String instanceName) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, instanceName);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with the given configuration, from the
- * factory specified in the local bundle.
- *
- * @param factoryName the name of the component factory, in the local
- * bundle.
- * @param configuration the configuration of the component instance to
- * create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- Dictionary configuration) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, configuration);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with no configuration, from the factory
- * specified in the local bundle.
- *
- * @param factoryName the name of the component factory, in the local
- * bundle.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, (Dictionary) null);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given bundle.
- *
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- String instanceName, Dictionary configuration) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, instanceName, configuration);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Returns the component factory with the given name in the local bundle.
- *
- * @param factoryName the name of the factory to retrieve.
- * @return the component factory with the given name in the local bundle, or
- * {@code null} if not found.
- */
- public Factory getFactory(String factoryName) {
- return getFactory(m_context.getBundle(), factoryName);
- }
-
- /**
- * Returns the handler factory with the given name in the local bundle.
- *
- * @param factoryName the name of the handler factory to retrieve.
- * @return the handler factory with the given name in the local bundle, or
- * {@code null} if not found.
- */
- public HandlerFactory getHandlerFactory(String factoryName) {
- return getHandlerFactory(m_context.getBundle(), factoryName);
- }
-
- /**
- * Returns the metadata description of the component defined in this bundle.
- *
- * @param component the name of the locally defined component.
- * @return the metadata description of the component with the given name,
- * defined in this given bundle, or {@code null} if not found.
- */
- public Element getMetadata(String component) {
- return getMetadata(m_context.getBundle(), component);
- }
-
- /**
- * Returns the component factory with the given name in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the defined factory.
- * @return the component factory with the given name in the given bundle, or
- * {@code null} if not found.
- */
- public static Factory getFactory(Bundle bundle, String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the component factories services in the bundle.
- refs = bundle.getBundleContext().getServiceReferences(
- Factory.class.getName(),
- "(factory.name=" + factoryName + ")");
- if (refs != null) {
- return (Factory) bundle.getBundleContext().getService(refs[0]);
- }
-
- // Factory not found...
- return null;
-
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get the component factory services: "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the component factory with the given name, registered in the
- * given service context.
- *
- * @param serviceContext the service context in which the factory service is
- * defined.
- * @param factoryName the name of the factory.
- * @return the component factory with the given name, registered in the
- * given service context.
- */
- public static Factory getFactory(ServiceContext serviceContext,
- String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the component factories services in the service
- // context.
- refs = serviceContext.getServiceReferences(Factory.class.getName(),
- "(factory.name=" + factoryName + ")");
- if (refs != null) {
- return (Factory) serviceContext.getService(refs[0]);
- }
- return null;
-
- } catch (InvalidSyntaxException e) {
- System.err.println("Cannot get the factory " + factoryName + " : "
- + e.getMessage());
- return null;
- }
- }
-
- /**
- * Returns the handler factory with the given name in the given bundle.
- *
- * @param bundle the bundle from which the handler factory is defined.
- * @param factoryName the name of the handler factory to retrieve.
- * @return the handler factory with the given name in the given bundle, or
- * {@code null} if not found.
- */
- public static HandlerFactory getHandlerFactory(Bundle bundle,
- String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the handler factories services in the bundle.
- refs = bundle.getBundleContext().getServiceReferences(
- HandlerFactory.class.getName(),
- "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName
- + ")");
- if (refs != null) {
- return (HandlerFactory) bundle.getBundleContext().getService(
- refs[0]);
- }
-
- // Factory not found...
- return null;
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get the handler factory services: "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the metadata description of the component with the given name,
- * defined in the given bundle.
- *
- * @param bundle the bundle from which the component is defined.
- * @param component the name of the defined component.
- * @return the metadata description of the component with the given name,
- * defined in the given bundle, or {@code null} if not found.
- */
- public static Element getMetadata(Bundle bundle, String component) {
-
- // Retrieves the component description from the bundle's manifest.
- String elem = (String) bundle.getHeaders().get("iPOJO-Components");
- if (elem == null) {
- throw new IllegalArgumentException(
- "Cannot find iPOJO-Components descriptor in the specified bundle ("
- + bundle.getSymbolicName()
- + "). Not an iPOJO bundle.");
- }
-
- // Parses the retrieved description and find the component with the
- // given name.
- try {
- Element element = ManifestMetadataParser.parseHeaderMetadata(elem);
- Element[] childs = element.getElements("component");
- for (int i = 0; i < childs.length; i++) {
- String name = childs[i].getAttribute("name");
- String clazz = childs[i].getAttribute("classname");
- if (name != null && name.equalsIgnoreCase(component)) {
- return childs[i];
- }
- if (clazz.equalsIgnoreCase(component)) {
- return childs[i];
- }
- }
-
- // Component not found...
- return null;
-
- } catch (ParseException e) {
- throw new IllegalStateException(
- "Cannot parse the components from specified bundle ("
- + bundle.getSymbolicName() + "): " + e.getMessage());
- }
- }
-
- /**
- * Returns the service object of a service registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which the service is
- * searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the specified bundle, offering the
- * specified interface and matching the given filter.
- */
- public static Object getServiceObject(ServiceContext serviceContext,
- String itf, String filter) {
- ServiceReference ref = getServiceReference(serviceContext, itf, filter);
- if (ref != null) {
- return serviceContext.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the specified bundle, offering
- * the specified interface and matching the given filter.
- */
- public static Object[] getServiceObjects(ServiceContext serviceContext,
- String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = serviceContext.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference registered in the specified service context,
- * offering the specified interface and matching the given filter.
- * If no service is found, {@code null} is returned.
- */
- public static ServiceReference getServiceReference(
- ServiceContext serviceContext, String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs.length != 0) {
- return refs[0];
- } else {
- // No service found
- return null;
- }
- }
-
- /**
- * Returns the service reference of the service registered in the specified
- * service context, offering the specified interface and having the given
- * persistent ID.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service registered in the specified service context, offering
- * the specified interface and having the given persistent ID.
- */
- public static ServiceReference getServiceReferenceByPID(
- ServiceContext serviceContext, String itf, String pid) {
- String filter = "(" + "service.pid" + "=" + pid + ")";
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- throw new IllegalStateException(
- "A service lookup by PID returned several providers ("
- + refs.length + ")" + " for " + itf + " with pid="
- + pid);
- }
- }
-
- /**
- * Returns the service reference of all the services registered in the
- * specified service context, offering the specified interface and matching
- * the given filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references registered in the specified service
- * context, offering the specified interface and matching the given
- * filter. If no service matches, an empty array is returned.
- */
- public static ServiceReference[] getServiceReferences(
- ServiceContext serviceContext, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- // Get all the service references
- refs = serviceContext.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get service references: " + e.getMessage());
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- /**
- * Returns the service reference of a service registered in the specified
- * service context, offering the specified interface and having the given
- * name.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service registered in the specified service context, offering
- * the specified interface and having the given name.
- */
- public static ServiceReference getServiceReferenceByName(
- ServiceContext serviceContext, String itf, String name) {
- String filter = null;
- if (itf.equals(Factory.class.getName())
- || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else if (itf.equals(Architecture.class.getName())) {
- filter = "(" + "architecture.instance" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- return getServiceReference(serviceContext, itf, filter);
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @return <code>true</code> if the service is available in the service
- * context, <code>false</code> otherwise.
- */
- public static boolean isServiceAvailable(ServiceContext sc, String itf) {
- ServiceReference ref = getServiceReference(sc, itf, null);
- return ref != null;
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @param name the service provider name
- * @return <code>true</code> if the service is available in the service
- * context, <code>false</code> otherwise.
- */
- public static boolean isServiceAvailableByName(ServiceContext sc,
- String itf, String name) {
- ServiceReference ref = getServiceReferenceByName(sc, itf, name);
- return ref != null;
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @param pid the pid of the service
- * @return <code>true</code> if the service is available in the service
- * context, <code>false</code> otherwise.
- */
- public static boolean isServiceAvailableByPID(ServiceContext sc,
- String itf, String pid) {
- ServiceReference ref = getServiceReferenceByPID(sc, itf, pid);
- return ref != null;
- }
-
- /**
- * Returns the service reference of a service provided by the specified
- * bundle, offering the specified interface and having the given name.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given name.
- */
- public static ServiceReference getServiceReferenceByName(Bundle bundle,
- String itf, String name) {
- String filter = null;
- if (itf.equals(Factory.class.getName())
- || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else if (itf.equals(Architecture.class.getName())) {
- filter = "(" + "architecture.instance" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- return OSGiHelper.getServiceReference(bundle, itf, filter);
- }
-
- /**
- * Returns the service reference of a service provided by the local bundle,
- * offering the specified interface and having the given name.
- *
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given name.
- */
- public ServiceReference getServiceReferenceByName(String itf, String name) {
- return getServiceReferenceByName(m_context.getBundle(), itf, name);
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @param name the service provider name
- * @return <code>true</code> if the service is available, <code>false</code>
- * otherwise.
- */
- public boolean isServiceAvailableByName(String itf, String name) {
- ServiceReference ref = getServiceReferenceByName(itf, name);
- return ref != null;
- }
-
-}
diff --git a/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/InheritanceTest.java b/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/InheritanceTest.java
index 428b06e..f6a2bd3 100644
--- a/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/InheritanceTest.java
+++ b/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/InheritanceTest.java
@@ -1,15 +1,14 @@
package org.apache.felix.ipojo.tests.inheritance;
-import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
-import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
-
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
@@ -34,6 +33,8 @@
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;
@RunWith( JUnit4TestRunner.class )
public class InheritanceTest {
@@ -68,7 +69,8 @@
equinox(),
provision(
// Runtime.
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject())
+ mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
// Bundle A
provision(
@@ -95,14 +97,14 @@
.set(Constants.BUNDLE_SYMBOLICNAME,"C")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.inheritance.b," +
"org.apache.felix.ipojo.tests.inheritance.a")
- .build( asiPOJOBundle(new File(tmp, "provider.jar"), new File("src/test/resources/provider.xml"))),
+ .build( withiPOJO(new File(tmp, "provider.jar"), new File("src/test/resources/provider.xml"))),
// Component D
newBundle()
.add(D.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"D")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tests.inheritance.b," +
"org.apache.felix.ipojo.tests.inheritance.a")
- .build( asiPOJOBundle(new File(tmp, "cons.jar"), new File("src/test/resources/cons.xml"))))
+ .build( withiPOJO(new File(tmp, "cons.jar"), new File("src/test/resources/cons.xml"))))
);
return opt;
}
@@ -125,27 +127,27 @@
}
}
}
-
+
@Test
public void testArchitecture() {
osgi.waitForService(Architecture.class.getName(), "(architecture.instance=d)", 2000);
ServiceReference ref = ipojo.getServiceReferenceByName(Architecture.class.getName(), "d");
Assert.assertNotNull(ref);
-
+
Architecture arch = (Architecture) osgi.getServiceObject(ref);
-
+
System.out.println(arch.getInstanceDescription().getDescription());
-
+
Assert.assertEquals(ComponentInstance.VALID, arch.getInstanceDescription().getState());
DependencyDescription dd = getDependency(arch, "org.apache.felix.ipojo.tests.inheritance.b.IB");
-
+
Assert.assertTrue(! dd.getServiceReferences().isEmpty());
-
+
ServiceReference dref = (ServiceReference) dd.getServiceReferences().get(0);
Assert.assertEquals(dref.getBundle().getSymbolicName(), "C");
-
+
}
-
+
private DependencyDescription getDependency(Architecture arch, String id) {
DependencyHandlerDescription hd = (DependencyHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:requires");
Assert.assertNotNull(hd);
diff --git a/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/OSGiHelper.java b/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/OSGiHelper.java
deleted file mode 100644
index 4da781a..0000000
--- a/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/OSGiHelper.java
+++ /dev/null
@@ -1,456 +0,0 @@
-package org.apache.felix.ipojo.tests.inheritance;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-import static org.junit.Assert.fail;
-
-
-public class OSGiHelper {
-
- /**
- * The bundle context.
- */
- private BundleContext context;
-
- /**
- * List of get references.
- */
- private List<ServiceReference> m_references = new ArrayList<ServiceReference>();
-
- public OSGiHelper(BundleContext context) {
- this.context = context;
- }
-
- public void dispose() {
- // Unget services
- for (int i = 0; i < m_references.size(); i++) {
- context.ungetService((ServiceReference) m_references.get(i));
- }
- m_references.clear();
- }
-
- /**
- * Gets the Bundle Context.
- * @return the bundle context.
- */
- public BundleContext getContext() {
- return context;
- }
-
- /**
- * Returns the service object of a service provided by the specified bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the specified bundle, offering the
- * specified interface and matching the given filter.
- */
- public static Object getServiceObject(Bundle bundle, String itf,
- String filter) {
- ServiceReference ref = getServiceReference(bundle, itf, filter);
- if (ref != null) {
- return bundle.getBundleContext().getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services provided by the specified
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the specified bundle, offering
- * the specified interface and matching the given filter.
- */
- public static Object[] getServiceObjects(Bundle bundle, String itf,
- String filter) {
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = bundle.getBundleContext().getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service provided by the specified
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference provided by the specified bundle, offering
- * the specified interface and matching the given filter. If no
- * service is found, {@code null} is returned.
- */
- public static ServiceReference getServiceReference(Bundle bundle,
- String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs.length != 0) {
- return refs[0];
- } else {
- // No service found
- return null;
- }
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @return <code>true</code> if the service is available, <code>false</code>
- * otherwise.
- */
- public boolean isServiceAvailable(String itf) {
- ServiceReference ref = getServiceReference(itf, null);
- return ref != null;
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @param pid the service pid
- * @return <code>true</code> if the service is available, <code>false</code>
- * otherwise.
- */
- public boolean isServiceAvailableByPID(String itf, String pid) {
- ServiceReference ref = getServiceReferenceByPID(itf, pid);
- return ref != null;
- }
-
- /**
- * Returns the service reference of the service provided by the specified
- * bundle, offering the specified interface and having the given persistent
- * ID.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given persistent ID.
- */
- public static ServiceReference getServiceReferenceByPID(Bundle bundle,
- String itf, String pid) {
- String filter = "(" + "service.pid" + "=" + pid + ")";
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- throw new IllegalStateException(
- "A service lookup by PID returned several providers ("
- + refs.length + ")" + " for " + itf + " with pid="
- + pid);
- }
- }
-
- /**
- * Returns the service reference of all the services provided in the
- * specified bundle, offering the specified interface and matching the given
- * filter.
- *
- * @param bundle the bundle from which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references provided in the specified bundle,
- * offering the specified interface and matching the given filter.
- * If no service matches, an empty array is returned.
- */
- public static ServiceReference[] getServiceReferences(Bundle bundle,
- String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- // Get all the service references
- refs = bundle.getBundleContext().getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get service references: " + e.getMessage());
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- /**
- * Returns the service object of a service provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the local bundle, offering the
- * specified interface and matching the given filter.
- */
- public Object getServiceObject(String itf, String filter) {
- ServiceReference ref = getServiceReference(itf, filter);
- if (ref != null) {
- m_references.add(ref);
- return context.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service object associated with this service reference.
- *
- * @param ref service reference
- * @return the service object.
- */
- public Object getServiceObject(ServiceReference ref) {
- if (ref != null) {
- m_references.add(ref);
- return context.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the local bundle, offering the
- * specified interface and matching the given filter.
- */
- public Object[] getServiceObjects(String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- m_references.add(refs[i]);
- list[i] = context.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference provided by the local bundle, offering the
- * specified interface and matching the given filter. If no service
- * is found, {@code null} is returned.
- */
- public ServiceReference getServiceReference(String itf, String filter) {
- return getServiceReference(context.getBundle(), itf, filter);
- }
-
- /**
- * Returns the service reference of a service provided offering the
- * specified interface.
- *
- * @param itf the interface provided by the searched service.
- * @return a service reference provided by the local bundle, offering the
- * specified interface and matching the given filter. If no service
- * is found, {@code null} is returned.
- */
- public ServiceReference getServiceReference(String itf) {
- return getServiceReference(context.getBundle(), itf, null);
- }
-
- /**
- * Returns the service reference of the service provided by the local
- * bundle, offering the specified interface and having the given persistent
- * ID.
- *
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service provided by the local bundle, offering the specified
- * interface and having the given persistent ID.
- */
- public ServiceReference getServiceReferenceByPID(String itf, String pid) {
- return getServiceReferenceByPID(context.getBundle(), itf, pid);
- }
-
- /**
- * Returns the service reference of all the services provided in the local
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references provided in the local bundle, offering
- * the specified interface and matching the given filter. If no
- * service matches, an empty array is returned.
- */
- public ServiceReference[] getServiceReferences(String itf, String filter) {
- return getServiceReferences(context.getBundle(), itf, filter);
- }
-
- /**
- * Gets the package admin exposed by the framework.
- * Fails if the package admin is not available.
- * @return the package admin service.
- */
- public PackageAdmin getPackageAdmin() {
- PackageAdmin pa = (PackageAdmin) getServiceObject(PackageAdmin.class.getName(), null);
- if (pa == null) {
- fail("No package admin available");
- }
- return pa;
- }
-
- /**
- * Refresh the packages.
- * Fails if the package admin service is not available.
- */
- public void refresh() {
- getPackageAdmin().refreshPackages(null);
- }
-
- /**
- * Waits for a service. Fails on timeout.
- * If timeout is set to 0, it sets the timeout to 10s.
- * @param itf the service interface
- * @param filter the filter
- * @param timeout the timeout
- */
- public void waitForService(String itf, String filter, long timeout) {
- if (timeout == 0) {
- timeout = 10000; // Default 10 secondes.
- }
- ServiceReference[] refs = getServiceReferences(itf, filter);
- long begin = System.currentTimeMillis();
- if (refs.length != 0) {
- return;
- } else {
- while(refs.length == 0) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- // Interrupted
- }
- long now = System.currentTimeMillis();
-
- if ((now - begin) > timeout) {
- fail("Timeout ... no services matching with the request after " + timeout + "ms");
- }
- refs = getServiceReferences(itf, filter);
- }
- }
- }
-
-
- /**
- * Installs a bundle.
- * Fails if the bundle cannot be installed.
- * Be aware that you have to uninstall the bundle yourself.
- * @param url bundle url
- * @return the installed bundle
- */
- public Bundle installBundle(String url) {
- try {
- return context.installBundle(url);
- } catch (BundleException e) {
- fail("Cannot install the bundle " + url + " : " + e.getMessage());
- }
- return null; // Can not happen
- }
-
- /**
- * Installs a bundle.
- * Fails if the bundle cannot be installed.
- * Be aware that you have to uninstall the bundle yourself.
- * @param url bundle url
- * @param stream input stream containing the bundle
- * @return the installed bundle
- */
- public Bundle installBundle(String url, InputStream stream) {
- try {
- return context.installBundle(url, stream);
- } catch (BundleException e) {
- fail("Cannot install the bundle " + url + " : " + e.getMessage());
- }
- return null; // Can not happen
- }
-
- /**
- * Installs and starts a bundle.
- * Fails if the bundle cannot be installed or an error occurs
- * during startup. Be aware that you have to uninstall the bundle
- * yourself.
- * @param url the bundle url
- * @return the Bundle object.
- */
- public Bundle installAndStart(String url) {
- Bundle bundle = installBundle(url);
- try {
- bundle.start();
- } catch (BundleException e) {
- fail("Cannot start the bundle " + url + " : " + e.getMessage());
- }
- return bundle;
- }
-
- /**
- * Installs and starts a bundle.
- * Fails if the bundle cannot be installed or an error occurs
- * during startup. Be aware that you have to uninstall the bundle
- * yourself.
- * @param url the bundle url
- * @param stream input stream containing the bundle
- * @return the Bundle object.
- */
- public Bundle installAndStart(String url, InputStream stream) {
- Bundle bundle = installBundle(url, stream);
- try {
- bundle.start();
- } catch (BundleException e) {
- fail("Cannot start the bundle " + url + " : " + e.getMessage());
- }
- return bundle;
- }
-
- /**
- * Get the bundle by its id.
- * @param bundleId the bundle id.
- * @return the bundle with the given id.
- */
- public Bundle getBundle(long bundleId) {
- return context.getBundle(bundleId);
- }
-
- /**
- * Gets a bundle by its symbolic name.
- * Fails if no bundle matches.
- * @param name the symbolic name of the bundle
- * @return the bundle object.
- */
- public Bundle getBundle(String name) {
- Bundle[] bundles = context.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (name.equals(bundles[i].getSymbolicName())) {
- return bundles[i];
- }
- }
- fail("No bundles with the given symbolic name " + name);
- return null; // should not happen
- }
-
-}
diff --git a/ipojo/tests/core/service-providing-strategies/pom.xml b/ipojo/tests/core/service-providing-strategies/pom.xml
index c963dbc..6456700 100755
--- a/ipojo/tests/core/service-providing-strategies/pom.xml
+++ b/ipojo/tests/core/service-providing-strategies/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Service Providing Strategy Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -50,6 +54,11 @@
<version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
<artifactId>tests.core.ps</artifactId>
<groupId>ipojo.tests</groupId>
<version>${pom.version}</version>
@@ -60,7 +69,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -79,7 +87,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/core/service-providing/pom.xml b/ipojo/tests/core/service-providing/pom.xml
index 7a0b062..fb26d28 100644
--- a/ipojo/tests/core/service-providing/pom.xml
+++ b/ipojo/tests/core/service-providing/pom.xml
@@ -1,22 +1,29 @@
<!--
- 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
+ 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
+ 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.
+ 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>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Service Providing Test Suite</name>
@@ -32,12 +39,15 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -55,7 +65,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +86,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/handler/eventadmin/pom.xml b/ipojo/tests/handler/eventadmin/pom.xml
index 0fc48a6..5819b1e 100644
--- a/ipojo/tests/handler/eventadmin/pom.xml
+++ b/ipojo/tests/handler/eventadmin/pom.xml
@@ -1,7 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
-<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">
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<groupId>ipojo.tests</groupId>
<version>1.5.0-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>
@@ -15,9 +37,8 @@
<version>1.7.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -34,13 +55,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -55,7 +80,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/handler/temporal/pom.xml b/ipojo/tests/handler/temporal/pom.xml
index adc8fc7..7dc3561 100644
--- a/ipojo/tests/handler/temporal/pom.xml
+++ b/ipojo/tests/handler/temporal/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Temporal Dependency Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,15 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
-
-
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -79,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/handler/transaction/pom.xml b/ipojo/tests/handler/transaction/pom.xml
index 59ad05c..5345de8 100644
--- a/ipojo/tests/handler/transaction/pom.xml
+++ b/ipojo/tests/handler/transaction/pom.xml
@@ -1,5 +1,28 @@
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>tests.transactions</artifactId>
@@ -10,17 +33,14 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo</artifactId>
- <version>1.7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.annotations</artifactId>
- <version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -34,9 +54,8 @@
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.test.helpers</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
</dependency>
<!--
Pax Exam API:
@@ -80,10 +99,9 @@
<artifactId>pax-swissbox-tinybundles</artifactId>
<version>1.2.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO</artifactId>
- <version>${pom.version}</version>
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
@@ -99,6 +117,16 @@
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-service</artifactId>
<version>1.4</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jmxtools</artifactId>
+ <groupId>com.sun.jdmk</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jmxri</artifactId>
+ <groupId>com.sun.jmx</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
@@ -130,6 +158,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestAnnotations.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestAnnotations.java
index f46f7f4..a345a6b 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestAnnotations.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestAnnotations.java
@@ -4,14 +4,12 @@
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.io.InputStream;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.ComponentUsingAnnotations;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -29,6 +27,8 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class TestAnnotations {
@@ -71,13 +71,13 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
InputStream test = TinyBundles.newBundle()
.add(ComponentUsingAnnotations.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"TransactionAnnotationTest")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "annotations.jar"), new File(TEST, "annotation.xml")) );
+ .build( withiPOJO(new File(ROOT, "annotations.jar"), new File(TEST, "annotation.xml")) );
Option[] opt = options(
@@ -87,7 +87,7 @@
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInstallation.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInstallation.java
index 4f0b92a..48aeecd 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInstallation.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInstallation.java
@@ -4,6 +4,7 @@
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import java.io.File;
import java.io.InputStream;
@@ -17,9 +18,6 @@
import org.apache.felix.ipojo.ComponentInstance;
import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -40,6 +38,8 @@
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
@RunWith( JUnit4TestRunner.class )
public class TestInstallation {
@@ -77,7 +77,7 @@
.set(Constants.BUNDLE_SYMBOLICNAME,"Service")
.set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
.build();
-
+
// try {
// StreamUtils.copy(service, new FileOutputStream(new File(ROOT, "service.jar")));
// } catch (Exception e) {
@@ -88,13 +88,13 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"RequiredTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) );
+ .build( withiPOJO(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) );
Option[] opt = options(
@@ -103,7 +103,7 @@
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -120,7 +120,7 @@
.build();
}
});
-
+
return opt;
}
@@ -154,7 +154,7 @@
Assert.assertEquals(ComponentInstance.VALID, under.getState());
ServiceReference[] refs = context.getAllServiceReferences(CheckService.class.getName(), "(instance.name=" + under.getInstanceName() +")");
-
+
// ref = ipojo.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
Assert.assertNotNull(refs);
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInvalidation.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInvalidation.java
index e6c4a69..95323bf 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInvalidation.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestInvalidation.java
@@ -1,6 +1,7 @@
package org.apache.felix.ipojo.transaction.test;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.MavenUtils.asInProject;
@@ -18,9 +19,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +37,8 @@
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;
@RunWith( JUnit4TestRunner.class )
public class TestInvalidation {
@@ -82,13 +82,13 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"RequiredTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) );
+ .build( withiPOJO(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) );
Option[] opt = options(
@@ -97,7 +97,7 @@
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestMandatory.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestMandatory.java
index 69c43e3..f09f283 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestMandatory.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestMandatory.java
@@ -18,9 +18,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +36,9 @@
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 static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
@RunWith( JUnit4TestRunner.class )
public class TestMandatory {
@@ -81,22 +81,22 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"MandatoryTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "mandatory.jar"), new File(TEST, "mandatory.xml")) );
-
-
+ .build( withiPOJO(new File(ROOT, "mandatory.jar"), new File(TEST, "mandatory.xml")) );
+
+
Option[] opt = options(
provision(
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -113,7 +113,7 @@
.build();
}
});
-
+
return opt;
}
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNever.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNever.java
index ac63000..801bdf0 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNever.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNever.java
@@ -18,9 +18,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +36,9 @@
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 static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
@RunWith( JUnit4TestRunner.class )
public class TestNever {
@@ -80,21 +80,21 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"NeverTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "never.jar"), new File(TEST, "never.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "never.jar"), new File(TEST, "never.xml")) );
+
Option[] opt = options(
provision(
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -111,7 +111,7 @@
.build();
}
});
-
+
return opt;
}
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNotSupported.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNotSupported.java
index ad5d311..489c015 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNotSupported.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestNotSupported.java
@@ -18,9 +18,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +36,9 @@
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 static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
@RunWith( JUnit4TestRunner.class )
public class TestNotSupported {
@@ -80,21 +80,21 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"NotSupportedTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "notsupported.jar"), new File(TEST, "notsupported.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "notsupported.jar"), new File(TEST, "notsupported.xml")) );
+
Option[] opt = options(
provision(
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -111,7 +111,7 @@
.build();
}
});
-
+
return opt;
}
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequires.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequires.java
index 4299d2d..7f5984b 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequires.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequires.java
@@ -18,9 +18,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +36,9 @@
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 static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
@RunWith( JUnit4TestRunner.class )
public class TestRequires {
@@ -81,21 +81,21 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"RequiresTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) );
+
Option[] opt = options(
provision(
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -112,7 +112,7 @@
.build();
}
});
-
+
return opt;
}
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequiresNew.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequiresNew.java
index c033233..b9f5166 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequiresNew.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestRequiresNew.java
@@ -18,9 +18,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +36,9 @@
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 static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
@RunWith( JUnit4TestRunner.class )
public class TestRequiresNew {
@@ -70,7 +70,7 @@
public static Option[] configure() {
ROOT.mkdirs();
-
+
InputStream service = TinyBundles.newBundle()
.add(CheckService.class)
.add(Foo.class)
@@ -82,21 +82,21 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"RequiresNewTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "requiresnew.jar"), new File(TEST, "requiresnew.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "requiresnew.jar"), new File(TEST, "requiresnew.xml")) );
+
Option[] opt = options(
provision(
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -113,8 +113,8 @@
.build();
}
});
-
-
+
+
return opt;
}
diff --git a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestSupported.java b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestSupported.java
index 5fb7016..6a3d775 100644
--- a/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestSupported.java
+++ b/ipojo/tests/handler/transaction/src/test/java/org/apache/felix/ipojo/transaction/test/TestSupported.java
@@ -18,9 +18,6 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.test.helpers.IPOJOHelper;
-import org.apache.felix.ipojo.test.helpers.OSGiHelper;
-import org.apache.felix.ipojo.tinybundles.BundleAsiPOJO;
import org.apache.felix.ipojo.transaction.test.component.FooDelegator;
import org.apache.felix.ipojo.transaction.test.component.FooImpl;
import org.apache.felix.ipojo.transaction.test.service.CheckService;
@@ -39,6 +36,9 @@
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 static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOBuilder.withiPOJO;
@RunWith( JUnit4TestRunner.class )
public class TestSupported {
@@ -80,21 +80,21 @@
.add(FooImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) );
+
InputStream test = TinyBundles.newBundle()
.add(FooDelegator.class)
.set(Constants.BUNDLE_SYMBOLICNAME,"SupportedTransactionPropagation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
- .build( BundleAsiPOJO.asiPOJOBundle(new File(ROOT, "supported.jar"), new File(TEST, "supported.xml")) );
-
+ .build( withiPOJO(new File(ROOT, "supported.jar"), new File(TEST, "supported.xml")) );
+
Option[] opt = options(
provision(
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.transaction").version(asInProject()),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.test.helpers").version(asInProject())
+ mavenBundle().groupId("org.ow2.chameleon.testing").artifactId("osgi-helpers").versionAsInProject()
),
provision(
service,
@@ -111,8 +111,8 @@
.build();
}
});
-
-
+
+
return opt;
}
diff --git a/ipojo/tests/handler/whiteboard/pom.xml b/ipojo/tests/handler/whiteboard/pom.xml
index 0a29b53..586b64e 100644
--- a/ipojo/tests/handler/whiteboard/pom.xml
+++ b/ipojo/tests/handler/whiteboard/pom.xml
@@ -1,5 +1,28 @@
-<project>
- <groupId>ipojo.tests</groupId>
+<!--
+ 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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent> <groupId>ipojo.tests</groupId>
<version>1.5.0-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
@@ -12,9 +35,8 @@
<version>1.7.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -26,13 +48,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -44,7 +70,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/manipulator/creation/pom.xml b/ipojo/tests/manipulator/creation/pom.xml
index 6cd1af1..b69c6f4 100644
--- a/ipojo/tests/manipulator/creation/pom.xml
+++ b/ipojo/tests/manipulator/creation/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Creation Manipulation Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/manipulator/manipulation/pom.xml b/ipojo/tests/manipulator/manipulation/pom.xml
index 717c388..a6b2c8f 100644
--- a/ipojo/tests/manipulator/manipulation/pom.xml
+++ b/ipojo/tests/manipulator/manipulation/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Manipulation Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/manipulator/manipulator-java5/pom.xml b/ipojo/tests/manipulator/manipulator-java5/pom.xml
index d60fc48..ff2a824 100644
--- a/ipojo/tests/manipulator/manipulator-java5/pom.xml
+++ b/ipojo/tests/manipulator/manipulator-java5/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Manipulation Test Suite For Java 5</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/manipulator/metadata/pom.xml b/ipojo/tests/manipulator/metadata/pom.xml
index 4aa6c8d..34df90a 100644
--- a/ipojo/tests/manipulator/metadata/pom.xml
+++ b/ipojo/tests/manipulator/metadata/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Manipulation Metadata Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/manipulator/primitives/pom.xml b/ipojo/tests/manipulator/primitives/pom.xml
index 593f14f..b69376f 100644
--- a/ipojo/tests/manipulator/primitives/pom.xml
+++ b/ipojo/tests/manipulator/primitives/pom.xml
@@ -16,7 +16,13 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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">
+ <parent>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>iPOJO Primitive Manipulation Test Suite</name>
@@ -32,12 +38,10 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -49,13 +53,17 @@
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.0.0</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -77,7 +85,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
- <version>1.6.0</version>
<executions>
<execution>
<goals>
diff --git a/ipojo/tests/online-manipulator/pom.xml b/ipojo/tests/online-manipulator/pom.xml
index 085bb02..3729fc9 100644
--- a/ipojo/tests/online-manipulator/pom.xml
+++ b/ipojo/tests/online-manipulator/pom.xml
@@ -1,6 +1,13 @@
<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>ipojo.tests</groupId>
+ <artifactId>ipojo.tests</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.online.manipulator.test</artifactId>
<version>1.5.0-SNAPSHOT</version>
@@ -19,6 +26,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
@@ -28,33 +36,13 @@
</execution>
</executions>
</plugin>
-
- <!--
- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-paxexam-config</id>
- <goals>
- <goal>generate-paxexam-config</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <settings>
- <platform>felix</platform>
- </settings>
- </configuration>
- </plugin> -->
</plugins>
</build>
<dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
+ <dependency>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.2.0</version>
</dependency>
<!--
@@ -63,7 +51,7 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
- <version>1.1.0</version>
+ <version>1.2.0</version>
</dependency>
<!--
During runtime Pax Exam will discover the OSGi container to use by
@@ -75,57 +63,49 @@
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default
</artifactId>
- <version>1.1.0</version>
+ <version>1.2.0</version>
</dependency>
<!--
If your test code is based on JUnit you will have to have the Junit
support artifact:
-->
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
-
- <!-- TinyBundle -->
- <dependency>
- <groupId>org.ops4j.pax.swissbox</groupId>
- <artifactId>pax-swissbox-tinybundles</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.4.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.annotations</artifactId>
- <version>1.6.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.online.manipulator</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.swissbox</groupId>
+ <artifactId>pax-swissbox-tinybundles</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.online.manipulator</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
diff --git a/ipojo/tests/online-manipulator/src/test/java/org/apache/felix/org/apache/felix/ipojo/online/manipulator/test/OnlineManipulatorTest.java b/ipojo/tests/online-manipulator/src/test/java/org/apache/felix/org/apache/felix/ipojo/online/manipulator/test/OnlineManipulatorTest.java
index c10f824..30963d5 100644
--- a/ipojo/tests/online-manipulator/src/test/java/org/apache/felix/org/apache/felix/ipojo/online/manipulator/test/OnlineManipulatorTest.java
+++ b/ipojo/tests/online-manipulator/src/test/java/org/apache/felix/org/apache/felix/ipojo/online/manipulator/test/OnlineManipulatorTest.java
@@ -3,20 +3,18 @@
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
-import static org.ops4j.pax.exam.CoreOptions.knopflerfish;
import static org.ops4j.pax.exam.CoreOptions.frameworks;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.asFile;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.asURL;
+import static org.ops4j.pax.exam.MavenUtils.asInProject;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import org.apache.felix.ipojo.ComponentInstance;
import org.apache.felix.ipojo.architecture.Architecture;
@@ -29,10 +27,13 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.ops4j.io.StreamUtils;
+import org.ops4j.pax.exam.Customizer;
import org.ops4j.pax.exam.Inject;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -79,11 +80,6 @@
// knopflerfish() KF does not export an XML parser.
),
provision(
- mavenBundle()
- .groupId( "org.ops4j.pax.swissbox" )
- .artifactId( "pax-swissbox-tinybundles" )
- .version(asInProject())),
- provision(
mavenBundle()
.groupId("org.apache.felix")
.artifactId("org.apache.felix.ipojo")
@@ -98,17 +94,27 @@
),
provision(
newBundle()
- .addClass( Hello.class )
- .prepare()
+ .add( Hello.class )
.set(Constants.BUNDLE_SYMBOLICNAME,"ServiceInterface")
.set(Constants.EXPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
- .build( asURL() ).toExternalForm()
+ .build()
),
systemProperty( "providerWithMetadata" ).value( providerWithMetadata ),
systemProperty( "providerWithMetadataInMetaInf" ).value( providerWithMetadataInMetaInf ),
systemProperty( "providerWithoutMetadata" ).value( providerWithoutMetadata ),
systemProperty( "consumerWithMetadata").value(consumerWithMetadata),
- systemProperty( "consumerWithoutMetadata").value(consumerWithoutMetadata)
+ systemProperty( "consumerWithoutMetadata").value(consumerWithoutMetadata),
+
+ new Customizer() {
+ @Override
+ public InputStream customizeTestProbe( InputStream testProbe )
+ {
+ return TinyBundles.modifyBundle(testProbe).set(Constants.IMPORT_PACKAGE,
+ "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
+ .build();
+ }
+
+ }
);
@@ -141,12 +147,16 @@
}
@Test
- public void installProviderWithMetadata1() throws BundleException, InvalidSyntaxException, IOException {
+ public void installProviderWithMetadata1() throws BundleException, InvalidSyntaxException, Exception {
String url = context.getProperty("providerWithMetadata");
Assert.assertNotNull(url);
- context.installBundle("ipojo:"+url).start();
+ Bundle bundle = context.installBundle("ipojo:"+url);
+ bundle.start();
assertBundle("Provider");
+
+ Assert.assertNotNull(context.getAllServiceReferences(Hello.class.getName(), null));
+
helper.waitForService(Hello.class.getName(), null, 5000);
assertValidity();
Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
@@ -226,15 +236,16 @@
* @throws IOException
*/
public static String providerWithMetadata() throws IOException {
- return newBundle()
- .addResource("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
- .addClass(MyProvider.class)
- .prepare(
- with()
- .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
- )
- .build( asFile(getTemporaryFile("providerWithMetadata")) ).toURL().toExternalForm();
+ InputStream is = newBundle()
+ .add("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
+ .add(MyProvider.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
+ .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
+ .build();
+
+ File out = getTemporaryFile("providerWithMetadata");
+ StreamUtils.copyStream(is, new FileOutputStream(out), true);
+ return out.toURI().toURL().toExternalForm();
}
/**
@@ -243,15 +254,16 @@
* @throws IOException
*/
public static String providerWithMetadataInMetaInf() throws IOException {
- return newBundle()
- .addResource("META-INF/metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
- .addClass(MyProvider.class)
- .prepare(
- with()
- .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
- )
- .build( asFile(getTemporaryFile("providerWithMetadataInMetaInf")) ).toURL().toExternalForm();
+ InputStream is = newBundle()
+ .add("META-INF/metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
+ .add(MyProvider.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
+ .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
+ .build();
+
+ File out = getTemporaryFile("providerWithMetadataInMetaInf");
+ StreamUtils.copyStream(is, new FileOutputStream(out), true);
+ return out.toURI().toURL().toExternalForm();
}
/**
@@ -260,15 +272,16 @@
* @throws IOException
*/
public static String providerWithoutMetadata() throws IOException {
- String url = newBundle()
+ InputStream is = newBundle()
//.addResource("metadata.xml", this.getClass().getClassLoader().getResource("provider.xml"))
- .addClass(MyProvider.class)
- .prepare(
- with()
- .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
- )
- .build( asFile(getTemporaryFile("providerWithoutMetadata")) ).toURL().toExternalForm();
+ .add(MyProvider.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
+ .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
+ .build();
+
+ File out = getTemporaryFile("providerWithoutMetadata");
+ StreamUtils.copyStream(is, new FileOutputStream(out), true);
+ String url = out.toURI().toURL().toExternalForm();
return url + "!" +OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml");
}
@@ -280,17 +293,16 @@
* @throws IOException
*/
public static String consumerWithMetadata() throws IOException {
- return newBundle()
- .addResource("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml"))
- .addClass(Consumer.class)
+ InputStream is = newBundle()
+ .add("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml"))
+ .add(Consumer.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
+ .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
+ .build();
- .prepare(
- with()
- .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
- )
- .build( asFile(getTemporaryFile("consumerWithMetadata")) ).toURL().toExternalForm();
-
+ File out = getTemporaryFile("consumerWithMetadata");
+ StreamUtils.copyStream(is, new FileOutputStream(out), true);
+ return out.toURI().toURL().toExternalForm();
}
/**
@@ -300,14 +312,15 @@
* @throws IOException
*/
public static String consumerWithoutMetadata() throws IOException {
- String url = newBundle()
- .addClass(Consumer.class)
- .prepare(
- with()
- .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
- )
- .build( asFile(getTemporaryFile("consumerWithoutMetadata")) ).toURL().toExternalForm();
+ InputStream is = newBundle()
+ .add(Consumer.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
+ .set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
+ .build();
+
+ File out = getTemporaryFile("consumerWithoutMetadata");
+ StreamUtils.copyStream(is, new FileOutputStream(out), true);
+ String url = out.toURI().toURL().toExternalForm();
return url + "!" + OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml");
}
diff --git a/ipojo/tests/pom.xml b/ipojo/tests/pom.xml
index ba6e00c..06863e5 100644
--- a/ipojo/tests/pom.xml
+++ b/ipojo/tests/pom.xml
@@ -16,14 +16,89 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
+<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>
<groupId>ipojo.tests</groupId>
<artifactId>ipojo.tests</artifactId>
<version>1.5.0-SNAPSHOT</version>
<name>Apache Felix iPOJO Tests</name>
<packaging>pom</packaging>
-
+
+ <repositories>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <id>ow2.snapshots</id>
+ <name>OW2 Snapshot Repository</name>
+ <url>http://maven.ow2.org/maven2-snapshot/</url>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.api</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.composite</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.handler.whiteboard</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.metadata</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
+ <version>0.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<modules>
<module>manipulator/manipulation</module>
<module>manipulator/metadata</module>
@@ -58,6 +133,22 @@
<module>online-manipulator</module>
</modules>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>1.6.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
<profiles>
<profile>
<id>java5</id>
@@ -92,7 +183,6 @@
<module>integration-tests</module>
</modules>
</profile>
-
</profiles>
-
+
</project>