I'm currently trying but with mild results.
I tried this:
public static CompositeOption junitBundles() {
return new DefaultCompositeOption(new JUnitBundlesOption(),
systemProperty("pax.exam.invoker").value("junit"),
bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.hamcrest.core.link"),
wrappedBundle(bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link"))
.imports(
"org.easymock",
"org.easymock.internal;poweruser=true",
"org.easymock.internal.matchers;poweruser=true")
);
}
But get "java.lang.IllegalStateException: Unknown protocol: wrap"
Any idea?
On Wednesday, December 28, 2016 at 9:59:19 AM UTC-5, Henri Tremblay wrote:
>
> Thanks. I will try to wrap everything.
>
> In fact, I'm testing OSGi. I have an attribute that is supposed to allow
> poweruser to access EasyMock internal packages. This was done to allow
> compatibility for framework like PowerMock when using EasyMock in OSGi.
> However, normal use should not use these packages. My other solution would
> be to expose everything.
>
> On Wednesday, December 28, 2016 at 3:06:42 AM UTC-5, Achim Nierbeck wrote:
>>
>> hmm ... might be exotic, as Pax-Exam is more an integration test suit.
>> If you want to test the functionality of your code, usually you don't
>> need OSGi therefore a unit test itself is enough.
>> With Pax-Exam you can make sure the wiring of your bundles and the
>> functionality of your code inside an OSGi environment is fully functional.
>> Some tests only work when the complete environment is accessible, like
>> gogo shell commands etc.
>>
>> At [1], you'll find the definition for the junit bundles used inside
>> pax-exam.
>>
>> The wrapping of the junitBundles() dosn't work, you'll need to wrap each
>> of the corresponding bundles.
>>
>> regards, Achim
>>
>> [1] -
>> https://github.com/ops4j/org.ops4j.pax.tipi/blob/master/junit-4.12/pom.xml
>>
>> 2016-12-28 4:55 GMT+01:00 Henri Tremblay <[email protected]>:
>>
>>> Thanks. I was pretty much there but I can't wrappedBundle(junitBundles
>>> ())
>>>
>>> So I guess I need to wrap one of the 3 bundles inside the junitBundles.
>>> Probably bundle(
>>> "link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link"). I will
>>> try tonight but will be happy if there is an easier way.
>>>
>>> But is my use-case that exotic? I thought it was pretty classic.
>>>
>>> On Tuesday, December 27, 2016 at 5:31:00 PM UTC-5, Achim Nierbeck wrote:
>>>>
>>>> Hi,
>>>>
>>>> you can wrap the junit bundle and add those export declarations to it.
>>>> [1]
>>>>
>>>> Just make sure you don't have the junit configuration [2] in your
>>>> project, as that will collide with your own custom declaration.
>>>>
>>>> Hope this helps, Achim
>>>>
>>>>
>>>> [1] -
>>>> https://ops4j1.jira.com/wiki/display/PAXEXAM4/Configuration+Options#ConfigurationOptions-wrappedBundle
>>>> [2] -
>>>> https://ops4j1.jira.com/wiki/display/PAXEXAM4/Configuration+Options#ConfigurationOptions-junitBundles
>>>>
>>>> 2016-12-27 22:34 GMT+01:00 Henri Tremblay <[email protected]>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I've been fighting for a bunch of hours now so I hope someone can help
>>>>> me.
>>>>>
>>>>> I've trying to test EasyMock OSGi configuration with Pax-Exam.
>>>>> Everything works fine except one thing.
>>>>>
>>>>> I need to export a conditional package from the JUnit bundle. With an
>>>>> attribute.
>>>>>
>>>>> Normally I would import like this in my MANIFEST.MF:
>>>>>
>>>>> org.easymock.internal;poweruser=true
>>>>>
>>>>> I have no idea how to do that.
>>>>>
>>>>> With Pax-Exam 4.
>>>>>
>>>>> Thanks for your help,
>>>>> Henri
>>>>>
>>>>> --
>>>>> --
>>>>> ------------------
>>>>> OPS4J - http://www.ops4j.org - [email protected]
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "OPS4J" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Apache Member
>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>> Committer & Project Lead
>>>> blog <http://notizblog.nierbeck.de/>
>>>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>>>
>>>> Software Architect / Project Manager / Scrum Master
>>>>
>>>> --
>>> --
>>> ------------------
>>> OPS4J - http://www.ops4j.org - [email protected]
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Apache Member
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
>> & Project Lead
>> blog <http://notizblog.nierbeck.de/>
>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>
>> Software Architect / Project Manager / Scrum Master
>>
>>
--
--
------------------
OPS4J - http://www.ops4j.org - [email protected]
---
You received this message because you are subscribed to the Google Groups
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.