Hi,

Did you deploy the integration-test-common bundle to your container? You need 
something like
maven("MyGroupId", "integration-test-common", "0.1.0") in your @Configuration 
setup, and you can drop the @ProbeBuilder.

The CommonConfigurationFactory class is loaded at runtime in the container via 
the OSGi classloader system. Your test class is deployed by PaxExam as separate 
bundle in that container (that bundle is called the probe). The line 
probe.addTest(CommonConfigurationFactory.class) does not add the 
CommonConfigurationFactory  class to the container - it configures the probe to 
execute that class as test as well - and implicitly tries to load the class 
from somewhere.

You may expect OSGi to throw a unresolved constraint error. However, the test 
probe has an "Import: *" header (or something like that), making 
ClassNotFoundExceptions rise instead.

Hope that helped,
Benjamin

-----Original Message-----
From: xav [mailto:[email protected]] 
Sent: Dienstag, 29. April 2014 15:13
To: [email protected]
Subject: Re: integrating test with pax-exam

Hi all,

after much work on the subject, I send a feedback to resolve my issue, perhaps, 
there is something better, but I shared my work.
So
I have a module with a class to build my configuration for pax-exam for all of 
my project:

name:CommonConfigurationFactory

in my module where I want to use it
I add the following dependencie:
<dependency>
  <groupId>MyGroupeId</groupId>
  <artifactId>integration-test-common</artifactId>
  <version>0.1.0</version>
  <scope>test</scope>
</dependency>

And to use it in my classTest

@ProbeBuilder
    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
        probe.addTest(CommonConfigurationFactory.class);
        return probe;
    }

    @Configuration
    public Option[] config() {
        return OptionUtils.combine(this.createCommonConfiguration(),
this.createTestConfiguration());
    }

where CommonConfigurationFactory is the abstract class for the common 
configuration and createTestConfiguration is the method to add the module 
specific test configuration.

Regards





--
View this message in context: 
http://karaf.922171.n3.nabble.com/integrating-test-with-pax-exam-tp4032704p4033000.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to