Add the bundleAsiPOJO tinybundles extension to the iPOJO Tests
Use the latest pax:exam
Add a test on version conflict
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@789099 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/api/pom.xml b/ipojo/tests/api/pom.xml
index 2417d4e..ba01660 100644
--- a/ipojo/tests/api/pom.xml
+++ b/ipojo/tests/api/pom.xml
@@ -6,7 +6,7 @@
<packaging>jar</packaging>
<version>1.3.0-SNAPSHOT</version>
<name>org.apache.felix.ipojo.tests.api</name>
-
+
<build>
<plugins>
<plugin>
@@ -29,7 +29,7 @@
</execution>
</executions>
</plugin>
-
+
<!-- <plugin>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>maven-paxexam-plugin</artifactId>
@@ -48,8 +48,8 @@
</configuration>
</plugin> -->
</plugins>
- </build>
-
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -71,21 +71,21 @@
<artifactId>org.apache.felix.ipojo.manipulator</artifactId>
<version>1.3.0-SNAPSHOT</version>
</dependency>
-
+
<!-- For external handlermanagement -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.handler.whiteboard</artifactId>
<version>1.3.0-SNAPSHOT</version>
- </dependency>
-
+ </dependency>
+
<!--
Pax Exam API:
-->
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<!--
During runtime Pax Exam will discover the OSGi container to use by
@@ -97,7 +97,7 @@
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default
</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<!--
If your test code is based on JUnit you will have to have the Junit
@@ -106,7 +106,7 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -116,7 +116,7 @@
<scope>test</scope>
</dependency>
</dependencies>
-
+
<repositories>
<repository>
<id>ops4j.releases</id>
diff --git a/ipojo/tests/bundleAsiPOJO/bundleAsiPOJO/pom.xml b/ipojo/tests/bundleAsiPOJO/bundleAsiPOJO/pom.xml
new file mode 100644
index 0000000..4629898
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/bundleAsiPOJO/pom.xml
@@ -0,0 +1,47 @@
+<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>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO</artifactId>
+ <packaging>jar</packaging>
+ <version>1.3.0-SNAPSHOT</version>
+ <name>BundleAsiPOJO</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <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.manipulator</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/tests/bundleAsiPOJO/bundleAsiPOJO/src/main/java/org/apache/felix/ipojo/tinybundles/BundleAsiPOJO.java b/ipojo/tests/bundleAsiPOJO/bundleAsiPOJO/src/main/java/org/apache/felix/ipojo/tinybundles/BundleAsiPOJO.java
new file mode 100644
index 0000000..ee37e3d
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/bundleAsiPOJO/src/main/java/org/apache/felix/ipojo/tinybundles/BundleAsiPOJO.java
@@ -0,0 +1,68 @@
+package org.apache.felix.ipojo.tinybundles;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.felix.ipojo.manipulator.Pojoization;
+import org.ops4j.pax.swissbox.tinybundles.core.BundleAs;
+import org.ops4j.pax.swissbox.tinybundles.core.targets.BundleAsFile;
+
+
+public class BundleAsiPOJO implements BundleAs<URL> {
+
+ private File m_metadata;
+ private File m_file;
+
+
+ public static BundleAs<URL> asiPOJOBundle(File file, File metadata) {
+ return (new BundleAsiPOJO(file, metadata));
+ }
+
+ public BundleAsiPOJO (File file, File metadata) {
+ m_metadata = metadata;
+ m_file = file;
+ if (! metadata.exists()) {
+ throw new RuntimeException("METADATA NOT FOUND");
+ }
+ }
+
+ public URL make(InputStream arg0) {
+ Pojoization pojoizator = new Pojoization();
+ try {
+ File fout = File.createTempFile( "tinybundle_", ".jar" );
+ fout.deleteOnExit();
+ File out = new BundleAsFile(fout).make(arg0);
+ pojoizator.pojoization(out, m_file, m_metadata);
+
+
+ List<String> list = (List<String>) pojoizator.getErrors();
+ if (list != null && ! list.isEmpty()) {
+ for (String s : list) {
+ System.err.println("[ERROR]" + s);
+ }
+ throw new RuntimeException("Errors occurs during pojoization " + list);
+ }
+
+ list = (List<String>) pojoizator.getWarnings();
+ if (list != null && ! list.isEmpty()) {
+ for (String s : list) {
+ System.err.println("[WARNING]" + s);
+ }
+ }
+ return m_file.toURL();
+ } catch (Exception e) {
+ List<String> list = (List<String>) pojoizator.getErrors();
+ if (list != null) {
+ for (String s : list) {
+ System.err.println(s);
+ }
+ }
+ e.printStackTrace();
+ throw new RuntimeException(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/ipojo/tests/bundleAsiPOJO/pom.xml b/ipojo/tests/bundleAsiPOJO/pom.xml
new file mode 100644
index 0000000..7b4384b
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/pom.xml
@@ -0,0 +1,50 @@
+<!--
+ 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>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>BundleAsiPOJO</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <name>Apache Felix iPOJO TinyBundles Extension</name>
+ <packaging>pom</packaging>
+
+ <profiles>
+ <profile>
+ <id>java5</id>
+ <activation>
+ <jdk>1.5</jdk>
+ </activation>
+ <modules>
+ <module>bundleAsiPOJO</module>
+ <module>tests</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>java6</id>
+ <activation>
+ <jdk>1.6</jdk>
+ </activation>
+ <modules>
+ <module>bundleAsiPOJO</module>
+ <module>tests</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
\ No newline at end of file
diff --git a/ipojo/tests/bundleAsiPOJO/tests/consumer.xml b/ipojo/tests/bundleAsiPOJO/tests/consumer.xml
new file mode 100644
index 0000000..c7f6d94
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/consumer.xml
@@ -0,0 +1,3 @@
+<ipojo>
+<instance component="org.apache.felix.ipojo.pax.tinybundles.tests.impl.Consumer"/>
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/tests/bundleAsiPOJO/tests/pom.xml b/ipojo/tests/bundleAsiPOJO/tests/pom.xml
new file mode 100644
index 0000000..5b86599
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/pom.xml
@@ -0,0 +1,127 @@
+<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>org.apache.felix.ipojo.tinybundle.bundleAsiPOJO.test</artifactId>
+ <packaging>jar</packaging>
+ <version>0.9.0-SNAPSHOT</version>
+ <name>bundleAsiPOJO Tests</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </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>
+
+ <!--
+ Pax Exam API:
+ -->
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>0.6.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>0.6.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>0.6.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.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+
+ </dependencies>
+
+
+
+
+ <repositories>
+ <repository>
+ <id>ops4j.releases</id>
+ <name>OPS4J Release</name>
+ <url> http://repository.ops4j.org/maven2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+</project>
diff --git a/ipojo/tests/bundleAsiPOJO/tests/provider.xml b/ipojo/tests/bundleAsiPOJO/tests/provider.xml
new file mode 100644
index 0000000..a76b7cb
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/provider.xml
@@ -0,0 +1,6 @@
+<ipojo>
+<component classname="org.apache.felix.ipojo.pax.tinybundles.tests.impl.MyProvider">
+ <provides/>
+</component>
+<instance component="org.apache.felix.ipojo.pax.tinybundles.tests.impl.MyProvider"/>
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/pax/tinybundles/tests/impl/Consumer.java b/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/pax/tinybundles/tests/impl/Consumer.java
new file mode 100644
index 0000000..d8380bc
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/pax/tinybundles/tests/impl/Consumer.java
@@ -0,0 +1,17 @@
+package org.apache.felix.ipojo.pax.tinybundles.tests.impl;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.tinybundles.tests.service.Hello;
+
+@Component
+public class Consumer {
+
+ @Requires
+ private Hello hello;
+
+ public Consumer() {
+ System.out.println(hello.sayHello());
+ }
+
+}
diff --git a/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/pax/tinybundles/tests/impl/MyProvider.java b/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/pax/tinybundles/tests/impl/MyProvider.java
new file mode 100644
index 0000000..cd79dee
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/pax/tinybundles/tests/impl/MyProvider.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.pax.tinybundles.tests.impl;
+
+import org.apache.felix.ipojo.tinybundles.tests.service.Hello;
+
+public class MyProvider implements Hello {
+
+ public String sayHello() {
+ return "Hello";
+ }
+
+}
diff --git a/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/tinybundles/tests/service/Hello.java b/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/tinybundles/tests/service/Hello.java
new file mode 100644
index 0000000..2fbe424
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/src/main/java/org/apache/felix/ipojo/tinybundles/tests/service/Hello.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.tinybundles.tests.service;
+
+public interface Hello {
+
+ public String sayHello();
+
+}
diff --git a/ipojo/tests/bundleAsiPOJO/tests/src/test/java/org/apache/felix/ipojo/tinybundles/tests/BundleCreationTest.java b/ipojo/tests/bundleAsiPOJO/tests/src/test/java/org/apache/felix/ipojo/tinybundles/tests/BundleCreationTest.java
new file mode 100644
index 0000000..2584125
--- /dev/null
+++ b/ipojo/tests/bundleAsiPOJO/tests/src/test/java/org/apache/felix/ipojo/tinybundles/tests/BundleCreationTest.java
@@ -0,0 +1,142 @@
+package org.apache.felix.ipojo.tinybundles.tests;
+
+import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
+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.asURL;
+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.net.MalformedURLException;
+
+import org.apache.felix.ipojo.pax.tinybundles.tests.impl.Consumer;
+import org.apache.felix.ipojo.pax.tinybundles.tests.impl.MyProvider;
+import org.apache.felix.ipojo.tinybundles.tests.service.Hello;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+
+@RunWith( JUnit4TestRunner.class )
+public class BundleCreationTest {
+
+
+ @Inject
+ BundleContext context;
+
+ @Configuration
+ public static Option[] configure()
+ {
+
+
+ File metaProv = new File("provider.xml");
+ if (! metaProv.exists()) {
+ Assert.fail("No provider file");
+ }
+
+ return options(
+ provision(
+ mavenBundle()
+ .groupId( "org.ops4j.pax.tinybundles" )
+ .artifactId( "pax-tinybundles-core" )
+ .version( "0.5.0-SNAPSHOT" )),
+ provision(
+ mavenBundle()
+ .groupId("org.apache.felix")
+ .artifactId("org.apache.felix.ipojo")
+ .version("1.3.0-SNAPSHOT")
+ ),
+ provision(
+ newBundle()
+ .addClass( Hello.class )
+ .prepare()
+ .set(Constants.BUNDLE_SYMBOLICNAME,"ServiceInterface")
+ .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.tinybundles.tests.service")
+ .build( asURL() ).toExternalForm()
+ ),
+ provision(
+ newBundle()
+ .addClass(MyProvider.class)
+ .prepare(
+ with()
+ .set(Constants.BUNDLE_SYMBOLICNAME,"Provider")
+ .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.tinybundles.tests.service")
+ )
+ .build( asiPOJOBundle(new File("provider.jar"), new File("provider.xml")) ).toExternalForm()
+ ),
+ provision(newBundle()
+ .addClass(Consumer.class)
+ .prepare(
+ with()
+ .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
+ .set(Constants.IMPORT_PACKAGE,
+ "org.apache.felix.ipojo.tinybundles.tests.service"))
+ .build(
+ asiPOJOBundle(new File("cons.jar"),
+ new File("consumer.xml")))
+ .toExternalForm())
+
+ );
+ }
+
+ @Test
+ public void creation() throws MalformedURLException, BundleException, InvalidSyntaxException {
+ assertBundle("ServiceInterface");
+// createServiceProvider();
+ assertBundle("Provider");
+ assertBundle("Consumer");
+
+ dumpBundles();
+ dumpServices();
+ // Check service
+ Assert.assertNotNull(context.getAllServiceReferences(Hello.class.getName(), null));
+
+ }
+
+
+ private void dumpServices() throws InvalidSyntaxException {
+ ServiceReference[] refs = context.getAllServiceReferences(null, null);
+ System.out.println(" === Services === ");
+ for (ServiceReference ref : refs) {
+ String[] itf = (String[]) ref.getProperty(Constants.OBJECTCLASS);
+ System.out.println(itf[0]);
+ }
+ System.out.println("====");
+ }
+
+ private void dumpBundles() throws InvalidSyntaxException {
+ Bundle[] bundles = context.getBundles();
+ System.out.println(" === Bundles === ");
+ for (Bundle bundle : bundles) {
+ String sn = bundle.getSymbolicName();
+ System.out.println(sn);
+ }
+ System.out.println("====");
+ }
+
+ private void assertBundle(String sn) {
+ for (Bundle bundle :context.getBundles()) {
+ if (bundle.getSymbolicName().equals(sn)
+ && bundle.getState() == Bundle.ACTIVE) {
+ return;
+ }
+
+ }
+ Assert.fail("Cannot find the bundle " + sn);
+ }
+
+
+
+}
diff --git a/ipojo/tests/core/factory-version/cons.xml b/ipojo/tests/core/factory-version/cons.xml
new file mode 100644
index 0000000..8d63da4
--- /dev/null
+++ b/ipojo/tests/core/factory-version/cons.xml
@@ -0,0 +1,6 @@
+<ipojo>
+ <component name="cons" classname="org.apache.felix.ipojo.tests.core.component.MyCons">
+ <requires field="services"/>
+ </component>
+ <instance component="cons" name="mycons"/>
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/tests/core/factory-version/pom.xml b/ipojo/tests/core/factory-version/pom.xml
index af28557..40390e0 100644
--- a/ipojo/tests/core/factory-version/pom.xml
+++ b/ipojo/tests/core/factory-version/pom.xml
@@ -62,7 +62,7 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<!--
During runtime Pax Exam will discover the OSGi container to use by
@@ -74,7 +74,7 @@
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default
</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<!--
If your test code is based on JUnit you will have to have the Junit
@@ -83,7 +83,7 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -93,16 +93,16 @@
<scope>test</scope>
</dependency>
<!-- Tinybundles -->
- <dependency>
- <groupId>org.ops4j.pax.tinybundles</groupId>
- <artifactId>pax-tinybundles-core</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.pax.exam.target</artifactId>
- <version>0.9.0-SNAPSHOT</version>
- </dependency>
+ <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.3.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<repositories>
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 0148684..f5432c4 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,13 +1,13 @@
package org.apache.felix.ipojo.tests.core;
-import static org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO.asiPOJOBundle;
+import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
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.tinybundles.core.TinyBundles.asURL;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.newBundle;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.asURL;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
@@ -60,7 +60,7 @@
provision(
// Runtime.
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo").version(asInProject()),
- mavenBundle().groupId( "org.ops4j.pax.tinybundles" ).artifactId( "pax-tinybundles-core" ).version(asInProject())
+ mavenBundle().groupId( "org.ops4j.pax.swissbox" ).artifactId( "pax-swissbox-tinybundles" ).version(asInProject())
),
provision(
newBundle()
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
new file mode 100644
index 0000000..c2461dc
--- /dev/null
+++ b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/VersionConflictTest.java
@@ -0,0 +1,300 @@
+package org.apache.felix.ipojo.tests.core;
+
+import static org.apache.felix.ipojo.tinybundles.BundleAsiPOJO.asiPOJOBundle;
+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.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.MavenUtils.asInProject;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.asFile;
+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.net.MalformedURLException;
+
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+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.tests.core.component.MyComponent;
+import org.apache.felix.ipojo.tests.core.component.MyCons;
+import org.apache.felix.ipojo.tests.core.service.MyService;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+@RunWith( JUnit4TestRunner.class )
+public class VersionConflictTest {
+
+ @Inject
+ private BundleContext context;
+
+ private OSGiHelper osgi;
+
+ private IPOJOHelper ipojo;
+
+ @Before
+ public void init() {
+ osgi = new OSGiHelper(context);
+ ipojo = new IPOJOHelper(context);
+ }
+
+ @After
+ public void stop() {
+ ipojo.dispose();
+ osgi.dispose();
+ }
+
+
+ @Configuration
+ public static Option[] configure() throws MalformedURLException {
+
+ File tmp = new File("target/tmp");
+ tmp.mkdirs();
+
+ String url1 = // Version 1
+ newBundle()
+ .addClass( MyService.class )
+ .prepare()
+ .set(Constants.BUNDLE_SYMBOLICNAME,"ServiceInterfaceV1")
+ .set(Constants.BUNDLE_VERSION, "1.0.0")
+ .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service; version=\"1.0.0\"")
+ .build( asFile(new File(tmp, "ServiceInterfaceV1.jar"))).toURL().toExternalForm();
+
+ String url2 = // Version 2
+ newBundle()
+ .addClass( MyService.class )
+ .prepare()
+ .set(Constants.BUNDLE_SYMBOLICNAME,"ServiceInterfaceV2")
+ .set(Constants.BUNDLE_VERSION, "2.0.0")
+ .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.tests.core.service; version=\"2.0.0\"")
+ .build( asFile(new File(tmp, "ServiceInterfaceV2.jar"))).toURL().toExternalForm();
+
+
+ String c1 = newBundle()
+ .addClass(MyComponent.class)
+ .prepare(
+ with()
+ .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(tmp, "vprovider-v1.jar"), new File("vprovider-v1.xml"))).toExternalForm();
+
+ String c2 = newBundle()
+ .addClass(MyComponent.class)
+ .prepare(
+ with()
+ .set(Constants.BUNDLE_SYMBOLICNAME,"ProviderV2")
+ .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(tmp, "vprovider-v2.0.jar"), new File("vprovider-v2.xml"))).toExternalForm();
+
+ String cons = newBundle()
+ .addClass(MyCons.class)
+ .prepare(
+ with()
+ .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(tmp, "cons.jar"), new File("cons.xml"))).toExternalForm();
+
+
+ String consV1 = newBundle()
+ .addClass(MyCons.class)
+ .prepare(
+ with()
+ .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(tmp, "consv1.jar"), new File("cons.xml"))).toExternalForm();
+
+ Option[] opt = options(
+ 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())
+ ),
+ systemProperty( "url1" ).value( url1 ),
+ systemProperty( "url2" ).value( url2 ),
+
+ systemProperty( "c1" ).value( c1 ),
+ systemProperty( "c2" ).value( c2 ),
+ systemProperty( "cons" ).value( cons ),
+ systemProperty( "consV1" ).value( consV1 )
+
+
+
+ );
+ return opt;
+ }
+
+ @Test
+ public void deployBundlesAtRuntime() throws MalformedURLException, BundleException, InvalidSyntaxException {
+
+ Bundle b1 = context.installBundle(context.getProperty("url1"));
+ b1.start();
+
+
+ Bundle b3 = context.installBundle(context.getProperty("c1"));
+ b3.start();
+
+ Bundle b2 = context.installBundle(context.getProperty("url2"));
+ b2.start();
+
+ Bundle b4 = context.installBundle(context.getProperty("c2"));
+ b4.start();
+
+ Bundle b5 = context.installBundle(context.getProperty("cons"));
+ b5.start();
+
+
+ Bundle[] bundles = context.getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ System.out.println("bundle " + bundles[i].getSymbolicName() + " : " + (bundles[i].getState() == Bundle.ACTIVE));
+ //Assert.assertEquals(bundles[i].getSymbolicName() + " is not active", Bundle.ACTIVE, bundles[i].getState());
+ }
+
+
+ PackageAdmin pa = osgi.getPackageAdmin();
+ Bundle b = pa.getBundles("ServiceInterfaceV1", null)[0];
+ ExportedPackage[] packages = pa.getExportedPackages(b);
+ if (packages == null) {
+ System.out.println("Packages ServiceInterfaceV1 : " + 0);
+ } else {
+ System.out.println("Packages ServiceInterfaceV1 : " + packages.length);
+ for (ExportedPackage p : packages) {
+ System.out.println("Package : " + p.getName() + " - " + p.getVersion().toString());
+ }
+ }
+ b = pa.getBundles("ServiceInterfaceV2", null)[0];
+ packages = pa.getExportedPackages(b);
+ System.out.println("Packages ServiceInterfaceV2 : " + packages.length);
+ for (ExportedPackage p : packages) {
+ System.out.println("Package : " + p.getName() + " - " + p.getVersion().toString());
+ }
+
+ osgi.waitForService(Architecture.class.getName(), "(architecture.instance=mycons)", 2000);
+
+ // Check that the two services are provided.
+ ServiceReference[] refs = context.getAllServiceReferences(MyService.class.getName(), null);
+ Assert.assertNotNull(refs);
+ Assert.assertEquals(2, refs.length);
+
+ ServiceReference refv1 = ipojo.getServiceReferenceByName(Architecture.class.getName(), "mycons");
+ Assert.assertNotNull(refv1);
+ Architecture arch = (Architecture) osgi.getServiceObject(refv1);
+
+ HandlerDescription desc = arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:requires");
+ Assert.assertNotNull(desc);
+
+ DependencyHandlerDescription d = (DependencyHandlerDescription) desc;
+ Assert.assertNotNull(d.getDependencies());
+ Assert.assertEquals(1, d.getDependencies().length);
+
+ DependencyDescription dep = d.getDependencies()[0];
+ Assert.assertEquals(Dependency.RESOLVED, dep.getState());
+
+ Assert.assertEquals(1, dep.getServiceReferences().size());
+ ServiceReference r = (ServiceReference) dep.getServiceReferences().get(0);
+ Assert.assertEquals("provider", r.getProperty("factory.name"));
+ Assert.assertEquals("2.0", r.getProperty("factory.version"));
+ }
+
+ @Test
+ public void deployBundlesAtRuntimeV1() throws MalformedURLException, BundleException, InvalidSyntaxException {
+
+ Bundle b1 = context.installBundle(context.getProperty("url1"));
+ b1.start();
+
+
+ Bundle b3 = context.installBundle(context.getProperty("c1"));
+ b3.start();
+
+ Bundle b2 = context.installBundle(context.getProperty("url2"));
+ b2.start();
+
+ Bundle b4 = context.installBundle(context.getProperty("c2"));
+ b4.start();
+
+ Bundle b5 = context.installBundle(context.getProperty("consV1"));
+ b5.start();
+
+
+ Bundle[] bundles = context.getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ System.out.println("bundle " + bundles[i].getSymbolicName() + " : " + (bundles[i].getState() == Bundle.ACTIVE));
+ //Assert.assertEquals(bundles[i].getSymbolicName() + " is not active", Bundle.ACTIVE, bundles[i].getState());
+ }
+
+
+ PackageAdmin pa = osgi.getPackageAdmin();
+ Bundle b = pa.getBundles("ServiceInterfaceV1", null)[0];
+ ExportedPackage[] packages = pa.getExportedPackages(b);
+ if (packages == null) {
+ System.out.println("Packages ServiceInterfaceV1 : " + 0);
+ } else {
+ System.out.println("Packages ServiceInterfaceV1 : " + packages.length);
+ for (ExportedPackage p : packages) {
+ System.out.println("Package : " + p.getName() + " - " + p.getVersion().toString());
+ }
+ }
+ b = pa.getBundles("ServiceInterfaceV2", null)[0];
+ packages = pa.getExportedPackages(b);
+ System.out.println("Packages ServiceInterfaceV2 : " + packages.length);
+ for (ExportedPackage p : packages) {
+ System.out.println("Package : " + p.getName() + " - " + p.getVersion().toString());
+ }
+
+ osgi.waitForService(Architecture.class.getName(), "(architecture.instance=mycons)", 2000);
+
+ // Check that the two services are provided.
+ ServiceReference[] refs = context.getAllServiceReferences(MyService.class.getName(), null);
+ Assert.assertNotNull(refs);
+ Assert.assertEquals(2, refs.length);
+
+ ServiceReference refv1 = ipojo.getServiceReferenceByName(Architecture.class.getName(), "mycons");
+ Assert.assertNotNull(refv1);
+ Architecture arch = (Architecture) osgi.getServiceObject(refv1);
+
+ HandlerDescription desc = arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:requires");
+ Assert.assertNotNull(desc);
+
+ DependencyHandlerDescription d = (DependencyHandlerDescription) desc;
+ Assert.assertNotNull(d.getDependencies());
+ Assert.assertEquals(1, d.getDependencies().length);
+
+ DependencyDescription dep = d.getDependencies()[0];
+ Assert.assertEquals(Dependency.RESOLVED, dep.getState());
+
+ Assert.assertEquals(1, dep.getServiceReferences().size());
+ ServiceReference r = (ServiceReference) dep.getServiceReferences().get(0);
+
+ Assert.assertEquals("provider", r.getProperty("factory.name"));
+ Assert.assertEquals("1.0", r.getProperty("factory.version"));
+ }
+
+
+
+
+
+
+}
diff --git a/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/component/MyCons.java b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/component/MyCons.java
new file mode 100644
index 0000000..e15d422
--- /dev/null
+++ b/ipojo/tests/core/factory-version/src/test/java/org/apache/felix/ipojo/tests/core/component/MyCons.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.tests.core.component;
+
+import org.apache.felix.ipojo.tests.core.service.MyService;
+
+public class MyCons {
+
+ private MyService[] services;
+
+ public MyCons() {
+ System.out.println("Bound to " + services.length);
+ }
+
+}
diff --git a/ipojo/tests/core/factory-version/vprovider-v1.xml b/ipojo/tests/core/factory-version/vprovider-v1.xml
new file mode 100644
index 0000000..283beba
--- /dev/null
+++ b/ipojo/tests/core/factory-version/vprovider-v1.xml
@@ -0,0 +1,6 @@
+<ipojo>
+ <component name="provider" classname="org.apache.felix.ipojo.tests.core.component.MyComponent" version="1.0">
+ <provides/>
+ </component>
+ <instance component="provider" version="1.0"/>
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/tests/core/factory-version/vprovider-v2.xml b/ipojo/tests/core/factory-version/vprovider-v2.xml
new file mode 100644
index 0000000..599a32b
--- /dev/null
+++ b/ipojo/tests/core/factory-version/vprovider-v2.xml
@@ -0,0 +1,7 @@
+<ipojo>
+ <component name="provider" classname="org.apache.felix.ipojo.tests.core.component.MyComponent" version="2.0">
+ <provides/>
+ </component>
+ <instance component="provider" version="2.0"/>
+
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/tests/handler/transaction/pom.xml b/ipojo/tests/handler/transaction/pom.xml
index 5f49bb0..d2c75d8 100644
--- a/ipojo/tests/handler/transaction/pom.xml
+++ b/ipojo/tests/handler/transaction/pom.xml
@@ -6,7 +6,6 @@
<packaging>jar</packaging>
<version>1.3.0-SNAPSHOT</version>
<name>iPOJO Transaction Handler Test Suite</name>
- <url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -39,7 +38,7 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<!--
During runtime Pax Exam will discover the OSGi container to use by
@@ -51,7 +50,7 @@
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default
</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<!--
If your test code is based on JUnit you will have to have the Junit
@@ -60,7 +59,7 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
- <version>0.4.0</version>
+ <version>0.6.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -71,14 +70,14 @@
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.pax.exam.target</artifactId>
- <version>0.9.0-SNAPSHOT</version>
+ <groupId>org.ops4j.pax.swissbox</groupId>
+ <artifactId>pax-swissbox-tinybundles</artifactId>
+ <version>1.0.0</version>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.tinybundles</groupId>
- <artifactId>pax-tinybundles-core</artifactId>
- <version>0.5.0-SNAPSHOT</version>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.tinybundles.bundleAsiPOJO</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
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 30aa3e7..a7a9658 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
@@ -5,13 +5,13 @@
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.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -25,7 +25,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -97,9 +97,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 e1b3a8d..b957c7c 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -19,7 +19,7 @@
import org.apache.felix.ipojo.ComponentInstance;
import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -33,7 +33,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -41,74 +41,74 @@
@RunWith( JUnit4TestRunner.class )
public class TestInstallation {
-
+
@Inject
private BundleContext context;
-
+
private OSGiHelper osgi;
-
+
private IPOJOHelper ipojo;
-
+
public static final File ROOT = new File("target/tmp");
public static final File TEST = new File("src/test/resources");
-
+
@Before
public void init() {
osgi = new OSGiHelper(context);
ipojo = new IPOJOHelper(context);
}
-
+
@After
public void stop() {
ipojo.dispose();
osgi.dispose();
}
-
+
@Configuration
- public static Option[] configure() {
+ public static Option[] configure() {
ROOT.mkdirs();
URL service = TinyBundles.newBundle()
.addClass(CheckService.class)
.addClass(Foo.class)
- .prepare(
+ .prepare(
with()
.set(Constants.BUNDLE_SYMBOLICNAME,"Service")
.set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
)
.build( TinyBundles.asURL());
-
+
String fooimpl = TinyBundles.newBundle()
.addClass(FooImpl.class)
- .prepare(
+ .prepare(
with()
.set(Constants.BUNDLE_SYMBOLICNAME,"Foo Provider")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service")
)
.build( new BundleAsiPOJO(new File(ROOT, "FooImpl.jar"), new File(TEST, "foo.xml")) ).toExternalForm();
-
+
String test = TinyBundles.newBundle()
.addClass(FooDelegator.class)
- .prepare(
+ .prepare(
with()
.set(Constants.BUNDLE_SYMBOLICNAME,"Required Transaction Propgatation")
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.transaction.test.service, javax.transaction")
)
.build( new BundleAsiPOJO(new File(ROOT, "requires.jar"), new File(TEST, "requires.xml")) ).toExternalForm();
-
-
+
+
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
@@ -118,36 +118,36 @@
;
return opt;
}
-
+
@Test
public void install() throws NotSupportedException, SystemException, IllegalStateException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
Bundle[] bundles = context.getBundles();
for (Bundle b : bundles) {
Assert.assertTrue(b.getSymbolicName(), b.getState() == Bundle.ACTIVE);
}
-
+
// Transaction Service available
osgi.isServiceAvailable(TransactionManager.class.getName());
TransactionManager tm = (TransactionManager) osgi.getServiceObject(TransactionManager.class.getName(), null);
tm.begin();
Assert.assertNotNull(tm.getTransaction());
tm.commit();
-
+
tm.begin();
Assert.assertNotNull(tm.getTransaction());
tm.rollback();
-
+
// Handler exposed
ServiceReference ref = osgi.getServiceReference(HandlerFactory.class.getName(), "(&(handler.name=transaction)(handler.namespace=org.apache.felix.ipojo.transaction))");
Assert.assertNotNull(ref);
-
+
// Create an install of the components
ComponentInstance prov = ipojo.createComponentInstance("org.apache.felix.ipojo.transaction.test.component.FooImpl");
ComponentInstance under = ipojo.createComponentInstance("requires-ok");
-
+
Assert.assertEquals(ComponentInstance.VALID, prov.getState());
Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
+
ref = ipojo.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
Assert.assertNotNull(ref);
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 490fc9b..548df24 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -108,9 +108,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 bc5eef1..03d2e43 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -107,9 +107,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 3e38b54..609f9f5 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -106,9 +106,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 7c98681..bd07984 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -106,9 +106,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 781e0dd..5dfd591 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -107,9 +107,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 00805ed..b7a231b 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -107,9 +107,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
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 7a2e6e2..b2eea67 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
@@ -5,7 +5,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.ops4j.pax.tinybundles.core.TinyBundles.with;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.net.URL;
@@ -20,7 +20,7 @@
import javax.transaction.TransactionManager;
import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.pax.exam.target.BundleAsiPOJO;
+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;
@@ -34,7 +34,7 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -106,9 +106,9 @@
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.ops4j.pax.tinybundles" )
- .artifactId( "pax-tinybundles-core" )
- .version( "0.5.0-SNAPSHOT" ),
+ .groupId( "org.ops4j.pax.swissbox" )
+ .artifactId( "pax-swissbox-tinybundles" )
+ .version(asInProject()),
bundle(service.toExternalForm()),
bundle(fooimpl),
bundle(test)
diff --git a/ipojo/tests/online-manipulator/pom.xml b/ipojo/tests/online-manipulator/pom.xml
index ca02a04..4b89c93 100644
--- a/ipojo/tests/online-manipulator/pom.xml
+++ b/ipojo/tests/online-manipulator/pom.xml
@@ -28,7 +28,7 @@
</execution>
</executions>
</plugin>
-
+
<!--
<plugin>
<groupId>org.ops4j.pax.exam</groupId>
@@ -48,15 +48,15 @@
</configuration>
</plugin> -->
</plugins>
- </build>
-
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.2.0</version>
</dependency>
-
+
<!--
Pax Exam API:
-->
@@ -93,19 +93,19 @@
<type>jar</type>
<scope>test</scope>
</dependency>
-
-
+
+
<!-- TinyBundle -->
<dependency>
- <groupId>org.ops4j.pax.tinybundles</groupId>
- <artifactId>pax-tinybundles-core</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.pax.exam.target</artifactId>
- <version>0.9.0-SNAPSHOT</version>
- </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.3.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
@@ -121,6 +121,6 @@
<artifactId>org.apache.felix.ipojo</artifactId>
<version>1.3.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 63c42b0..f119499 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
@@ -4,15 +4,14 @@
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.frameworks;
-import static org.ops4j.pax.exam.CoreOptions.knopflerfish;
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.CoreOptions.systemProperty;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.asFile;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.asURL;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.newBundle;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.with;
+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.swissbox.tinybundles.core.TinyBundles.newBundle;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.with;
import java.io.File;
import java.io.IOException;
@@ -42,35 +41,35 @@
@RunWith( JUnit4TestRunner.class )
public class OnlineManipulatorTest {
-
-
+
+
private static File TMP = new File("target/tmp-bundle");
-
+
@Inject
BundleContext context;
private OSGiHelper helper;
-
+
/*
* <groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.online.manipulator</artifactId>
<version>1.3.0-SNAPSHOT</version>
-
+
*/
-
+
@Configuration
public static Option[] configure() throws IOException
{
-
-
+
+
String providerWithMetadata = providerWithMetadata();
String providerWithMetadataInMetaInf = providerWithMetadataInMetaInf();
String providerWithoutMetadata = providerWithoutMetadata();
String consumerWithMetadata = consumerWithMetadata();
String consumerWithoutMetadata = consumerWithoutMetadata();
-
+
return options(
frameworks(
felix(),
@@ -81,13 +80,13 @@
.groupId( "org.ops4j.pax.tinybundles" )
.artifactId( "pax-tinybundles-core" )
.version( "0.5.0-SNAPSHOT" )),
- provision(
+ provision(
mavenBundle()
.groupId("org.apache.felix")
.artifactId("org.apache.felix.ipojo")
.version("1.3.0-SNAPSHOT")
),
-
+
provision(
mavenBundle()
.groupId("org.apache.felix")
@@ -108,22 +107,22 @@
systemProperty( "consumerWithMetadata").value(consumerWithMetadata),
systemProperty( "consumerWithoutMetadata").value(consumerWithoutMetadata)
);
-
-
+
+
}
-
+
@Before
public void before() {
helper = new OSGiHelper(context);
}
-
+
@After
public void after() {
helper.dispose();
}
-
+
private static File getTemporaryFile(String name) throws IOException {
if (! TMP.exists()) {
TMP.mkdirs();
@@ -135,22 +134,22 @@
file.delete();
}
file.deleteOnExit();
- return file;
+ return file;
}
-
+
@Test
public void installProviderWithMetadata1() throws BundleException, InvalidSyntaxException, IOException {
String url = context.getProperty("providerWithMetadata");
Assert.assertNotNull(url);
context.installBundle("ipojo:"+url).start();
-
+
assertBundle("Provider");
helper.waitForService(Hello.class.getName(), null, 5000);
assertValidity();
Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
}
-
-
+
+
@Test
public void installProviderWithMetadata2() throws BundleException, InvalidSyntaxException, IOException {
@@ -162,7 +161,7 @@
assertValidity();
Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
}
-
+
@Test
public void installProviderWithoutMetadata() throws BundleException, InvalidSyntaxException, IOException {
String url = context.getProperty("providerWithoutMetadata");
@@ -173,14 +172,14 @@
assertValidity();
Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
}
-
+
@Test
public void installConsumerWithMetadata() throws BundleException, InvalidSyntaxException, IOException {
String url = context.getProperty("providerWithoutMetadata");
Assert.assertNotNull(url);
context.installBundle("ipojo:"+url).start();
assertBundle("Provider");
-
+
String url2 = context.getProperty("consumerWithMetadata");
Assert.assertNotNull(url);
context.installBundle("ipojo:"+url2).start();
@@ -195,7 +194,7 @@
assertValidity();
Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
}
-
+
@Test
public void installConsumerWithoutMetadata() throws BundleException, InvalidSyntaxException, IOException {
String url = context.getProperty("providerWithMetadataInMetaInf");
@@ -213,69 +212,69 @@
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
- }
+ }
assertValidity();
Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
}
-
+
/**
* Gets a regular bundle containing metadata file
* @return the url of the bundle
- * @throws IOException
+ * @throws IOException
*/
public static String providerWithMetadata() throws IOException {
return newBundle()
.addResource("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
.addClass(MyProvider.class)
- .prepare(
+ .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();
}
-
+
/**
* Gets a regular bundle containing metadata file in the META-INF directory
* @return the url of the bundle
- * @throws IOException
+ * @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(
+ .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();
}
-
+
/**
* Gets a provider bundle which does not contain the metadata file.
* @return the url of the bundle + metadata
- * @throws IOException
+ * @throws IOException
*/
public static String providerWithoutMetadata() throws IOException {
String url = newBundle()
//.addResource("metadata.xml", this.getClass().getClassLoader().getResource("provider.xml"))
.addClass(MyProvider.class)
- .prepare(
+ .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();
-
+
return url + "!" +OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml");
}
-
+
/**
* Gets a consumer bundle using annotation containing the instance
* declaration in the metadata.
* @return the url of the bundle
- * @throws IOException
+ * @throws IOException
*/
public static String consumerWithMetadata() throws IOException {
return newBundle()
@@ -288,14 +287,14 @@
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
)
.build( asFile(getTemporaryFile("consumerWithMetadata")) ).toURL().toExternalForm();
-
+
}
-
+
/**
* Gets a consumer bundle using annotation that does not contain
* metadata
* @return the url of the bundle + metadata
- * @throws IOException
+ * @throws IOException
*/
public static String consumerWithoutMetadata() throws IOException {
String url = newBundle()
@@ -306,12 +305,12 @@
.set(Constants.IMPORT_PACKAGE, "org.apache.felix.org.apache.felix.ipojo.online.manipulator.test.service")
)
.build( asFile(getTemporaryFile("consumerWithoutMetadata")) ).toURL().toExternalForm();
-
+
return url + "!" + OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml");
}
-
-
-
+
+
+
public void dumpServices() throws InvalidSyntaxException {
ServiceReference[] refs = context.getAllServiceReferences(null, null);
System.out.println(" === Services === ");
@@ -321,7 +320,7 @@
}
System.out.println("====");
}
-
+
public void dumpBundles() throws InvalidSyntaxException {
Bundle[] bundles = context.getBundles();
System.out.println(" === Bundles === ");
@@ -331,18 +330,18 @@
}
System.out.println("====");
}
-
+
private void assertBundle(String sn) {
for (Bundle bundle :context.getBundles()) {
if (bundle.getSymbolicName().equals(sn)
&& bundle.getState() == Bundle.ACTIVE) {
return;
}
-
+
}
Assert.fail("Cannot find the bundle " + sn);
}
-
+
private void assertValidity() {
try {
ServiceReference[] refs = context.getServiceReferences(Architecture.class.getName(), null);
@@ -355,9 +354,9 @@
} catch (InvalidSyntaxException e) {
Assert.fail(e.getMessage());
}
-
+
}
-
-
+
+
}
diff --git a/ipojo/tests/pom.xml b/ipojo/tests/pom.xml
index 46830e5..5cc2c9a 100644
--- a/ipojo/tests/pom.xml
+++ b/ipojo/tests/pom.xml
@@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ipojo.tests</groupId>
<artifactId>ipojo.tests</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<name>Apache Felix iPOJO Tests</name>
<packaging>pom</packaging>
@@ -60,6 +60,7 @@
<jdk>1.5</jdk>
</activation>
<modules>
+ <module>bundleAsiPOJO</module>
<module>core/annotations</module>
<module>manipulator/manipulator-java5</module>
<module>handler/transaction</module>
@@ -71,6 +72,7 @@
<jdk>1.6</jdk>
</activation>
<modules>
+ <module>bundleAsiPOJO</module>
<module>core/annotations</module>
<module>manipulator/manipulator-java5</module>
<module>handler/transaction</module>