Harald, thanks for that.  I worked around the Scala, static method thing.

Just to put a bow on things, I'll report how far I got before I had to
turn away.  My plan is to come back and investigate Pax Exam2 and
integration with TestNG.

With the Scala problem out of the way, the probe launched well;
however, with all of its imports marked as optional, I was still
getting a NoClassDefFound...MyOsgiService.  When I used the
tinybundles project to manually set the Import-Package, I was able to
lookup the service, but I didn't try to actually use it.

Anyhow, a lot of my pain was self-inflicted, and I appreciate all the help.

On Tue, Aug 9, 2011 at 12:01 PM, Harald Wellmann <[email protected]> wrote:
> I just did a quick check and deleted the @Configuration annotation from one
> of my tests, and I ended up with a NoClassDefFound similar to yours.
>
> I would have expected Pax Exam to cleanly fail with a
> NoConfigurationFoundException or so, but this is not currently the case - I
> can't think of meaningful use cases without a configuration, but then again,
> who knows...
>
> The JUnit4ClassRunner simply looks for all @Configuration-annotated methods
> and adds them to the Reactor. The reactor is happy to start with an empty
> configuration and only logs a DEBUG level message, which is clearly not
> enough.
>
> So there is an issue for Pax Exam to provide better feedback, but the root
> cause of your problem really seems to be Scala putting the static method in
> the wrong class.
>
> Best regards,
>
> Harald
>
> Am 08.08.2011 20:50, schrieb Samuel Cox:
>>
>> Toni, thanks for that.  I'll search through the source.
>>
>> However, I just noticed something that might be pretty important.
>>
>> If you want a static method in Scala, you have to do something like:
>>
>> class A {
>>   def instanceMethod() = 1
>> }
>>
>> object A {
>>   def staticMethod() = 2
>> }
>>
>> Scala tries  hard to have this end up generating bytecode like:
>>
>> class A {
>>   int instanceMethod() { return 1; }
>>   static int staticMethod() { return 2; }
>> }
>>
>> However, this doesn't always work.  In my case, my @Configuration
>> annotated method is ending up in a class named, ServiceTest$, whereas
>> the actual unit test is named, ServiceTest.  I'm assuming that is
>> going to cause problems...
>>
>>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>

_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to