Pax-exam 4 no felix() method

Course Queries Competitions/Entrance Exams 3 years ago

3.11K 2 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago

 

I had been using the following code snippet for OSGi tests in EclipseLink project with Pax Exam 3.3.0:

@Configuration
public static Option[] config() {
    return options(
            repositories("http://repo1.maven.org/maven2"),
            mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.3.0"),
            mavenBundle().groupId("org.eclipse.persistence").artifactId("org.eclipse.persistence.asm")
                    .version("2.5.1"),
            //JAXB API
            bundle("file:" + PLUGINS_DIR + "javax.xml.bind_2.2.12.v201410011542.jar"),
            //WS API
            bundle("file:" + PLUGINS_DIR + "javax.ws.rs_1.1.1.v20101004-1200.jar"),
            //EclipseLink bundles
            bundle("file:" + PLUGINS_DIR + "org.eclipse.persistence.moxy_2.7.0." + QUALIFIER + ".jar"),
            bundle("file:" + PLUGINS_DIR + "org.eclipse.persistence.core_2.7.0." + QUALIFIER + ".jar"),
            bundle("file:" + PLUGINS_DIR + "org.eclipse.persistence.asm_5.0.1.v201405080102.jar"),

            junitBundles(),
            felix());
}

Now, we switched the build to JDK 8 and I am using Pax Exam 4.4.0, because Pax Exam 3.x does not build with JDK 8. My issue is that Pax Exam 4 no longer provides the convenient org.ops4j.pax.exam.CoreOptions.felix() method. How can I go around this issue? My goal is to run OSGi tests with the least configuration possible.

If I remove the felix() method, I get the following error:

Running org.eclipse.persistence.testing.osgi.OSGiBundleTest
[https://forum.tuteehub.com/tag/main">main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 4.4.0) created.
[https://forum.tuteehub.com/tag/main">main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - creating PaxExam runner for class org.eclipse.persistence.testing.osgi.OSGiBundleTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.167 sec <<< FAILURE!
initializationError(org.eclipse.persistence.testing.osgi.OSGiBundleTest)  Time elapsed: 0.01 sec  <<< ERROR!
org.ops4j.pax.
0 views
0 shares

profilepic.png
manpreet 3 years ago

felix() and other framework options have been deprecated a long time ago, well before Pax Exam 3.3.0, if I remember correctly, so I'm a bit surprised by your version information.

Anyway, if you want to run your tests on Felix, simply make sure that Felix is the only OSGi implementation on your classpath, and that's it. No need for an explicit option.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum