ops4j / org.ops4j.pax.exam2

Pax Exam is a testing framework for OSGi
https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/
Apache License 2.0
84 stars 100 forks source link

It would be nice to be able to load the current maven module as a bundle [PAXEXAM-149] #154

Open ops4j-issues opened 14 years ago

ops4j-issues commented 14 years ago

AlanA created PAXEXAM-149

Sometimes one is building a single bundle. It doesn't make sense to make another maven module just to run PAX Exam to test it. It would be nice to have something like this in the options:

provision(
    mavenBundle().currentModule()
)

Votes: 0, Watches: 0


Referenced issues

is aggregated into:

ops4j-issues commented 14 years ago

Toni Menzel commented

Hi Alan, have a look at http://paxexam.ops4j.org/space/FAQ#FAQ-Whyshouldinotputmyexamtestsinsidemybundleproject%2Fimplementation and make sure you still want/need this kind of feature.

ops4j-issues commented 14 years ago

AlanA commented

I already went through the trouble of hand crafting my maven POM to get BND to do what I want; not a very easy task I might add. Now you want me to duplicate that work by using tinybundles?

ops4j-issues commented 14 years ago

Toni Menzel commented

But did you saw the circle you create when depending on something in your tests that will be available in the future only ? (at packaging phase).
I don't mind implementing this but only problem is: it needs a time machine or custom phases .. both not so appealing. How do you want to have this solved ?

ops4j-issues commented 14 years ago

AlanA commented

Maybe the use of mavenBundle() is confusing things. What if we said we needed:

provision(
    currentModule()
)
ops4j-issues commented 13 years ago

Harald Wellmann commented

@Toni: There is no circular dependency if you configure your POM appropriately.

Let's assume you're building a bundle foo with sources in foo/src/main/java and Pax Exam Tests in foo/src/test/java

Option 1:

If you run the tests in the integration-test phase (and not in the test phase) your bundle has already been packaged, and you can provision it via
reference:target/foo.jar

Option 2:

If your manifest is created manually or if you configure maven-bundle-plugin to create it early, you can even run the tests in the Maven test phase, using reference:target/classes.

See PAXEXAM-255 .