Update to newest osgi-helpers
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1478662 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/pom.xml
index a0d705f..c55a442 100644
--- a/ipojo/manipulator/manipulator-it/pom.xml
+++ b/ipojo/manipulator/manipulator-it/pom.xml
@@ -205,7 +205,7 @@
<dependency>
<groupId>org.ow2.chameleon.testing</groupId>
<artifactId>osgi-helpers</artifactId>
- <version>0.6.0</version>
+ <version>0.6.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@@ -396,4 +396,13 @@
</build>
</profile>
</profiles>
+
+ <repositories>
+ <!-- Temporal addition of this repository until the osgi-helper are released -->
+ <!-- TODO remove this before the release -->
+ <repository>
+ <id>ow2.snapshots</id>
+ <url>http://repository.ow2.org/nexus/content/repositories/snapshots/</url>
+ </repository>
+ </repositories>
</project>
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
deleted file mode 100644
index 089cd1d..0000000
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
+++ /dev/null
@@ -1,302 +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.runtime.core;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-/**
- * Bootstrap the test from this project
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-public class Common {
-
- @Inject
- BundleContext bc;
-
- OSGiHelper osgiHelper;
- IPOJOHelper ipojoHelper;
-
- @Configuration
- public Option[] config() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.INFO);
-
- return options(
- cleanCaches(),
- ipojoBundles(),
- junitBundles(),
- testedBundle(),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
- );
- }
-
- public static Option junitAndMockitoBundles() {
- return new DefaultCompositeOption(
- // Repository required to load harmcrest (OSGi-fied version).
- repository("http://repository.springsource.com/maven/bundles/external").id(
- "com.springsource.repository.bundles.external"),
-
- // Mockito without Hamcrest and Objenesis
- mavenBundle("org.mockito", "mockito-core", "1.9.5"),
-
- // Hamcrest with a version matching the range expected by Mockito
- mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
-
- // Objenesis with a version matching the range expected by Mockito
- wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
- .exports("*;version=1.2"),
-
- // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
- // 4.9 which does not match the Mockito import.
- CoreOptions.junitBundles(),
-
- /*
- * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
- * java.lang.LinkageError: loader constraint violation in interface itable initialization:
- * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
- * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
- * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
- * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
- * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
- * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
- * proxy/Callback used in the signature
- *
- * So we disable the bootdelegation.
- */
- frameworkProperty("felix.bootdelegation.implicit").value("false")
- );
- }
-
-
- @Before
- public void commonSetUp() {
- grace(500);
- osgiHelper = new OSGiHelper(bc);
- ipojoHelper = new IPOJOHelper(bc);
-
- // Dump OSGi Framework information
- String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
- if (vendor == null) {
- vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
- }
- String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
- System.out.println("OSGi Framework : " + vendor + " - " + version);
-
- waitForStability(bc);
- }
-
- @After
- public void commonTearDown() {
- ipojoHelper.dispose();
- osgiHelper.dispose();
- grace(500);
- }
-
- public static void grace(int time) {
- try {
- Thread.sleep(time);
- } catch (InterruptedException e) {
- // Ignore it.
- }
- }
-
- public CompositeOption ipojoBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- // harmcrest-all
- //mavenBundle("de.twentyeleven.skysail", "org.hamcrest.hamcrest-all-osgi").versionAsInProject(),
- // configuration admin
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject()
- );
- }
-
- public Option testedBundle() throws MalformedURLException {
- File out = new File("target/tested/bundle.jar");
- if (out.exists()) {
- return bundle(out.toURI().toURL().toExternalForm());
- }
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List<File> services = new ArrayList<File>();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getAbsolutePath().contains("/services") || file.getAbsolutePath().contains("/service")) {
- services.add(file);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- tested.add(path, file.toURI().toURL());
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- // We export components.
- String export = "org.apache.felix.ipojo.runtime.core.components";
- for (File file : services) {
- if (export.length() > 0) { export += ", "; }
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- String packageName = path.replace('/', '.');
- export += packageName;
- }
-
- System.out.println("Exported packages : " + export);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
- .set(Constants.IMPORT_PACKAGE, "*")
- .set(Constants.EXPORT_PACKAGE, export)
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
- public void assertContains(String s, String[] arrays, String object) {
- for (String suspect : arrays) {
- if (object.equals(suspect)) {
- return;
- }
- }
- fail("Assertion failed : " + s);
- }
-
- /**
- * Waits for stability:
- * <ul>
- * <li>all bundles are activated
- * <li>service count is stable
- * </ul>
- * If the stability can't be reached after a specified time,
- * the method throws a {@link IllegalStateException}.
- * @param context the bundle context
- * @throws IllegalStateException when the stability can't be reach after a several attempts.
- */
- private void waitForStability(BundleContext context) throws IllegalStateException {
- // Wait for bundle initialization.
- boolean bundleStability = getBundleStability(context);
- int count = 0;
- while (!bundleStability && count < 500) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- // Interrupted
- }
- count++;
- bundleStability = getBundleStability(context);
- }
-
- if (count == 500) {
- System.err.println("Bundle stability isn't reached after 500 tries");
- throw new IllegalStateException("Cannot reach the bundle stability");
- }
-
- boolean serviceStability = false;
- count = 0;
- int count1 = 0;
- int count2 = 0;
- while (! serviceStability && count < 500) {
- try {
- ServiceReference[] refs = context.getServiceReferences((String) null, null);
- count1 = refs.length;
- Thread.sleep(500);
- refs = context.getServiceReferences((String) null, null);
- count2 = refs.length;
- serviceStability = count1 == count2;
- } catch (Exception e) {
- System.err.println(e);
- serviceStability = false;
- // Nothing to do, while recheck the condition
- }
- count++;
- }
-
- if (count == 500) {
- System.err.println("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
- throw new IllegalStateException("Cannot reach the service stability");
- }
- }
-
- /**
- * Are bundle stables.
- * @param bc the bundle context
- * @return <code>true</code> if every bundles are activated.
- */
- private boolean getBundleStability(BundleContext bc) {
- boolean stability = true;
- Bundle[] bundles = bc.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- stability = stability && (bundles[i].getState() == Bundle.ACTIVE);
- }
- return stability;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java
index 31aa3b1..3834a6a 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java
@@ -27,7 +27,10 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import java.util.Arrays;
+import java.util.List;
import java.util.Properties;
import static junit.framework.Assert.assertEquals;
@@ -36,7 +39,7 @@
/**
* Check the different method to create POJO object.
*/
-public class TestPOJOCreation extends Common {
+public class TestPOJOCreation extends BaseTest {
private ComponentInstance ci_lazzy;
private ComponentInstance ci_immediate;
@@ -58,6 +61,11 @@
private Architecture lazzyArchSingM;
private Architecture lazzyArchSevM;
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
@Before
public void setUp() {
String factName = "ManipulationCreation-FooProviderType-1";
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java
index a32f7eb..ba5e815 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java
@@ -24,12 +24,13 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-public class TestSeveralConstructor extends Common {
+public class TestSeveralConstructor extends BaseTest {
private ComponentInstance ci, ci2, ci3;
@@ -38,7 +39,6 @@
ci = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.SeveralConstructors");
ci2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructor");
ci3 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructorWithParentClass");
-
}
@Test
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
deleted file mode 100644
index 953346f..0000000
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
+++ /dev/null
@@ -1,303 +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.runtime.core;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-/**
- * Bootstrap the test from this project
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-public class Common {
-
- @Inject
- BundleContext bc;
-
- protected OSGiHelper osgiHelper;
- protected IPOJOHelper ipojoHelper;
- protected Bundle testedBundle;
-
- @Configuration
- public Option[] config() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.INFO);
-
- return options(
- cleanCaches(),
- ipojoBundles(),
- junitBundles(),
- testedBundle(),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
- );
- }
-
- public static Option junitAndMockitoBundles() {
- return new DefaultCompositeOption(
- // Repository required to load harmcrest (OSGi-fied version).
- repository("http://repository.springsource.com/maven/bundles/external").id(
- "com.springsource.repository.bundles.external"),
-
- // Mockito without Hamcrest and Objenesis
- mavenBundle("org.mockito", "mockito-core", "1.9.5"),
-
- // Hamcrest with a version matching the range expected by Mockito
- mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
-
- // Objenesis with a version matching the range expected by Mockito
- wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
- .exports("*;version=1.2"),
-
- // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
- // 4.9 which does not match the Mockito import.
- CoreOptions.junitBundles(),
-
- /*
- * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
- * java.lang.LinkageError: loader constraint violation in interface itable initialization:
- * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
- * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
- * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
- * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
- * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
- * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
- * proxy/Callback used in the signature
- *
- * So we disable the bootdelegation.
- */
- frameworkProperty("felix.bootdelegation.implicit").value("false")
- );
- }
-
-
- @Before
- public void commonSetUp() {
- grace(500);
- osgiHelper = new OSGiHelper(bc);
- ipojoHelper = new IPOJOHelper(bc);
-
- testedBundle = osgiHelper.getBundle("test.bundle");
-
- // Dump OSGi Framework information
- String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
- if (vendor == null) {
- vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
- }
- String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
- System.out.println("OSGi Framework : " + vendor + " - " + version);
-
- waitForStability(bc);
- }
-
- @After
- public void commonTearDown() {
- ipojoHelper.dispose();
- osgiHelper.dispose();
- grace(500);
- }
-
- public CompositeOption ipojoBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- // configuration admin
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject()
- );
- }
-
- public static void grace(int time) {
- try {
- Thread.sleep(time);
- } catch (InterruptedException e) {
- // Ignore it.
- }
- }
-
- public Option testedBundle() throws MalformedURLException {
- File out = new File("target/tested/bundle.jar");
- if (out.exists()) {
- return bundle(out.toURI().toURL().toExternalForm());
- }
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List<File> services = new ArrayList<File>();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getAbsolutePath().contains("/services") || file.getAbsolutePath().contains("/service")) {
- services.add(file);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- tested.add(path, file.toURI().toURL());
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- // We export components.
- String export = "org.apache.felix.ipojo.runtime.core.components";
- for (File file : services) {
- if (export.length() > 0) { export += ", "; }
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- String packageName = path.replace('/', '.');
- export += packageName;
- }
-
- System.out.println("Exported packages : " + export);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
- .set(Constants.IMPORT_PACKAGE, "*")
- .set(Constants.EXPORT_PACKAGE, export)
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
- public void assertContains(String s, String[] arrays, String object) {
- for (String suspect : arrays) {
- if (object.equals(suspect)) {
- return;
- }
- }
- fail("Assertion failed : " + s);
- }
-
- /**
- * Waits for stability:
- * <ul>
- * <li>all bundles are activated
- * <li>service count is stable
- * </ul>
- * If the stability can't be reached after a specified time,
- * the method throws a {@link IllegalStateException}.
- * @param context the bundle context
- * @throws IllegalStateException when the stability can't be reach after a several attempts.
- */
- private void waitForStability(BundleContext context) throws IllegalStateException {
- // Wait for bundle initialization.
- boolean bundleStability = getBundleStability(context);
- int count = 0;
- while (!bundleStability && count < 500) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- // Interrupted
- }
- count++;
- bundleStability = getBundleStability(context);
- }
-
- if (count == 500) {
- System.err.println("Bundle stability isn't reached after 500 tries");
- throw new IllegalStateException("Cannot reach the bundle stability");
- }
-
- boolean serviceStability = false;
- count = 0;
- int count1 = 0;
- int count2 = 0;
- while (! serviceStability && count < 500) {
- try {
- ServiceReference[] refs = context.getServiceReferences((String) null, null);
- count1 = refs.length;
- Thread.sleep(500);
- refs = context.getServiceReferences((String) null, null);
- count2 = refs.length;
- serviceStability = count1 == count2;
- } catch (Exception e) {
- System.err.println(e);
- serviceStability = false;
- // Nothing to do, while recheck the condition
- }
- count++;
- }
-
- if (count == 500) {
- System.err.println("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
- throw new IllegalStateException("Cannot reach the service stability");
- }
- }
-
- /**
- * Are bundle stables.
- * @param bc the bundle context
- * @return <code>true</code> if every bundles are activated.
- */
- private boolean getBundleStability(BundleContext bc) {
- boolean stability = true;
- Bundle[] bundles = bc.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- stability = stability && (bundles[i].getState() == Bundle.ACTIVE);
- }
- return stability;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java
index 7668a06..d469c59 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java
@@ -26,6 +26,7 @@
import org.apache.felix.ipojo.runtime.core.services.BarService;
import org.apache.felix.ipojo.runtime.core.services.FooService;
import org.junit.Test;
+import org.ow2.chameleon.testing.helpers.BaseTest;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;
@@ -33,11 +34,11 @@
/**
* Check manipulation metadata written in the manifest.
*/
-public class TestManipulationMetadata extends Common {
+public class TestManipulationMetadata extends BaseTest {
@Test
public void testGetMetadata() {
- String header = (String) testedBundle.getHeaders().get("iPOJO-Components");
+ String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parseHeaderMetadata(header);
@@ -212,7 +213,7 @@
}
private Element getManipulationForComponent(String comp_name) {
- String header = (String) testedBundle.getHeaders().get("iPOJO-Components");
+ String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parseHeaderMetadata(header);
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java
index d1b1b9c..87907d0 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java
@@ -26,11 +26,12 @@
import org.apache.felix.ipojo.runtime.core.services.FooService;
import org.junit.Before;
import org.junit.Test;
+import org.ow2.chameleon.testing.helpers.BaseTest;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;
-public class TestManipulationMetadataAPI extends Common {
+public class TestManipulationMetadataAPI extends BaseTest {
PojoMetadata FooProviderType1, FooBarProviderType1, FooProviderTypeDyn, PrimitiveManipulationTester, SimpleMultipleCheckServiceProvider;
@@ -54,7 +55,7 @@
@Test
public void testGetMetadata() {
- String header = (String) testedBundle.getHeaders().get("iPOJO-Components");
+ String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parseHeaderMetadata(header);
@@ -276,7 +277,7 @@
private PojoMetadata getManipulationMetadataForComponent(String comp_name) {
- String header = (String) testedBundle.getHeaders().get("iPOJO-Components");
+ String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parseHeaderMetadata(header);
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
deleted file mode 100644
index 57e7497..0000000
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
+++ /dev/null
@@ -1,301 +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.runtime.core;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-/**
- * Bootstrap the test from this project
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-public class Common {
-
- @Inject
- BundleContext bc;
-
- OSGiHelper osgiHelper;
- IPOJOHelper ipojoHelper;
-
- @Configuration
- public Option[] config() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.INFO);
-
- return options(
- cleanCaches(),
- ipojoBundles(),
- junitBundles(),
- testedBundle(),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
- );
- }
-
- public static Option junitAndMockitoBundles() {
- return new DefaultCompositeOption(
- // Repository required to load harmcrest (OSGi-fied version).
- repository("http://repository.springsource.com/maven/bundles/external").id(
- "com.springsource.repository.bundles.external"),
-
- // Mockito without Hamcrest and Objenesis
- mavenBundle("org.mockito", "mockito-core", "1.9.5"),
-
- // Hamcrest with a version matching the range expected by Mockito
- mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
-
- // Objenesis with a version matching the range expected by Mockito
- wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
- .exports("*;version=1.2"),
-
- // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
- // 4.9 which does not match the Mockito import.
- CoreOptions.junitBundles(),
-
- /*
- * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
- * java.lang.LinkageError: loader constraint violation in interface itable initialization:
- * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
- * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
- * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
- * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
- * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
- * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
- * proxy/Callback used in the signature
- *
- * So we disable the bootdelegation.
- */
- frameworkProperty("felix.bootdelegation.implicit").value("false")
- );
- }
-
-
- @Before
- public void commonSetUp() {
- osgiHelper = new OSGiHelper(bc);
- ipojoHelper = new IPOJOHelper(bc);
-
- // Dump OSGi Framework information
- String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
- if (vendor == null) {
- vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
- }
- String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
- System.out.println("OSGi Framework : " + vendor + " - " + version);
-
- waitForStability(bc);
- }
-
- @After
- public void commonTearDown() {
- ipojoHelper.dispose();
- osgiHelper.dispose();
- grace(500);
- }
-
- public static void grace(int time) {
- try {
- Thread.sleep(time);
- } catch (InterruptedException e) {
- // Ignore it.
- }
- }
-
- public CompositeOption ipojoBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- // harmcrest-all
- //mavenBundle("de.twentyeleven.skysail", "org.hamcrest.hamcrest-all-osgi").versionAsInProject(),
- // configuration admin
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject()
- );
- }
-
- public Option testedBundle() throws MalformedURLException {
- File out = new File("target/tested/bundle.jar");
- if (out.exists()) {
- return bundle(out.toURI().toURL().toExternalForm());
- }
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List<File> services = new ArrayList<File>();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getAbsolutePath().contains("/services") || file.getAbsolutePath().contains("/service")) {
- services.add(file);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- tested.add(path, file.toURI().toURL());
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- // We export components.
- String export = "org.apache.felix.ipojo.runtime.core.components";
- for (File file : services) {
- if (export.length() > 0) { export += ", "; }
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- String packageName = path.replace('/', '.');
- export += packageName;
- }
-
- System.out.println("Exported packages : " + export);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
- .set(Constants.IMPORT_PACKAGE, "*")
- .set(Constants.EXPORT_PACKAGE, export)
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
- public void assertContains(String s, String[] arrays, String object) {
- for (String suspect : arrays) {
- if (object.equals(suspect)) {
- return;
- }
- }
- fail("Assertion failed : " + s);
- }
-
- /**
- * Waits for stability:
- * <ul>
- * <li>all bundles are activated
- * <li>service count is stable
- * </ul>
- * If the stability can't be reached after a specified time,
- * the method throws a {@link IllegalStateException}.
- * @param context the bundle context
- * @throws IllegalStateException when the stability can't be reach after a several attempts.
- */
- private void waitForStability(BundleContext context) throws IllegalStateException {
- // Wait for bundle initialization.
- boolean bundleStability = getBundleStability(context);
- int count = 0;
- while (!bundleStability && count < 500) {
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- // Interrupted
- }
- count++;
- bundleStability = getBundleStability(context);
- }
-
- if (count == 500) {
- System.err.println("Bundle stability isn't reached after 500 tries");
- throw new IllegalStateException("Cannot reach the bundle stability");
- }
-
- boolean serviceStability = false;
- count = 0;
- int count1 = 0;
- int count2 = 0;
- while (! serviceStability && count < 500) {
- try {
- ServiceReference[] refs = context.getServiceReferences((String) null, null);
- count1 = refs.length;
- Thread.sleep(1000);
- refs = context.getServiceReferences((String) null, null);
- count2 = refs.length;
- serviceStability = count1 == count2;
- } catch (Exception e) {
- System.err.println(e);
- serviceStability = false;
- // Nothing to do, while recheck the condition
- }
- count++;
- }
-
- if (count == 500) {
- System.err.println("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
- throw new IllegalStateException("Cannot reach the service stability");
- }
- }
-
- /**
- * Are bundle stables.
- * @param bc the bundle context
- * @return <code>true</code> if every bundles are activated.
- */
- private boolean getBundleStability(BundleContext bc) {
- boolean stability = true;
- Bundle[] bundles = bc.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- stability = stability && (bundles[i].getState() == Bundle.ACTIVE);
- }
- return stability;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java
index c74ca69..df3b085 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java
@@ -23,16 +23,18 @@
import org.apache.felix.ipojo.runtime.core.components.SubMarker;
import org.junit.Before;
import org.junit.Test;
+import org.ow2.chameleon.testing.helpers.BaseTest;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-public class TestAnnotationProcessing extends Common {
+public class TestAnnotationProcessing extends BaseTest {
private Class clazz;
@@ -46,6 +48,10 @@
}
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
@Test
public void testAnnotationOnMethod() {
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java
index 7b3a615..b929a86 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java
@@ -22,11 +22,15 @@
import org.apache.felix.ipojo.runtime.core.services.Plop;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+
+import java.util.Arrays;
+import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-public class TestDuplicateMethods extends Common {
+public class TestDuplicateMethods extends BaseTest {
@Test
@@ -39,4 +43,9 @@
assertEquals("Check result", "plop", o);
ipojoHelper.dispose();
}
+
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java
index 4bd15f6..1f7ba93 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java
@@ -26,6 +26,10 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+
+import java.util.Arrays;
+import java.util.List;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -33,7 +37,7 @@
/**
* Test exception handling. POJO exception must be propagated.
*/
-public class TestExceptionHandling extends Common {
+public class TestExceptionHandling extends BaseTest {
private ComponentInstance ci_lazzy;
@@ -88,4 +92,9 @@
}
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java
index 6d4faaf..c7ae3c2 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java
@@ -25,14 +25,16 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;
-public class TestGenericList extends Common {
+public class TestGenericList extends BaseTest {
ComponentInstance foo1, foo2;
ComponentInstance checker;
@@ -76,4 +78,9 @@
assertEquals("Check size - 3", 1, list.size());
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java
index 67c3f8c..bc8c635 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java
@@ -26,7 +26,10 @@
import org.apache.felix.ipojo.runtime.core.services.FooService;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import java.util.Arrays;
+import java.util.List;
import java.util.Properties;
import static junit.framework.Assert.assertEquals;
@@ -35,7 +38,7 @@
/**
* Check the getComponentInstance method on a POJO
*/
-public class TestGetComponentInstance extends Common {
+public class TestGetComponentInstance extends BaseTest {
/**
* Check if a pojo can correctly be cast in POJO.
@@ -90,4 +93,9 @@
assertNull("FS available, but component instance stopped", ref);
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
index aa427cf..9563ba4 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
@@ -26,14 +26,17 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-public class TestNestedClasses extends Common {
+public class TestNestedClasses extends BaseTest {
private ComponentInstance instance;
private CheckService service;
@@ -212,4 +215,9 @@
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
index 7108638..84b659b 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
@@ -24,6 +24,10 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+
+import java.util.Arrays;
+import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;
@@ -31,7 +35,7 @@
/**
* Check the manipulation of primitive type (boxed and unboxed).
*/
-public class TestPrimitiveTypes extends Common {
+public class TestPrimitiveTypes extends BaseTest {
PrimitiveManipulationTestService prim;
@@ -104,5 +108,10 @@
assertEquals("Check - 2", prim.getChar(), 'b');
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
index f9ff330..28cc0e7 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
@@ -25,6 +25,10 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+
+import java.util.Arrays;
+import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.*;
@@ -33,7 +37,7 @@
* Check the manipulation of primitive type (boxed and unboxed).
* The targeted implementation contains numbers in the package and class name.
*/
-public class TestPrimitiveTypesWithNumberInNames extends Common {
+public class TestPrimitiveTypesWithNumberInNames extends BaseTest {
PrimitiveManipulationTestService prim;
@@ -109,4 +113,9 @@
assertEquals("Check - 2", prim.getChar(), 'b');
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
index ab8addb..c4c879e 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
@@ -28,13 +28,16 @@
import org.ops4j.pax.exam.TestProbeBuilder;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import java.util.Arrays;
+import java.util.List;
import java.util.Properties;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-public class TestSwitches extends Common {
+public class TestSwitches extends BaseTest {
private ComponentInstance instance;
private CheckService service;
@@ -75,5 +78,10 @@
assertEquals(properties.get("switchOnEnumRed"), "RED");
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java
index dd5570f..8a6732e 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java
@@ -25,14 +25,17 @@
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import java.util.Arrays;
+import java.util.List;
import java.util.Properties;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-public class TestTypeBoxing extends Common {
+public class TestTypeBoxing extends BaseTest {
ComponentInstance instance; // Instance under test
@@ -73,4 +76,9 @@
assertEquals("Check - 2", prim.getLong(), 2);
}
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+ }
+
}