Been able to figure out the issue. Thx for your help.

I get now another exception with this code. The BundleContext object is
null when I tried to add it to the applicationContext. According to Pax
Exam, it should be injected automatically. Is it process after calling the
constructor of the class ?
I use pax exam 2.6.0

@RunWith(JUnit4TestRunner.class)
public class KieSpringOnKarafTest extends KieSpringIntegrationTestSupport {

    protected static final transient Logger LOG =
LoggerFactory.getLogger(KieSpringOnKarafTest.class);
    protected OsgiBundleXmlApplicationContext applicationContext;

    @Inject
    protected BundleContext bc;

    public KieSpringOnKarafTest () {
        applicationContext = createApplicationContext();
        assertNotNull("Should have created a valid spring context",
applicationContext);
        // applicationContext.setBundleContext(bc); // BundleContext is NULL
        applicationContext.refresh();
    }

    protected OsgiBundleXmlApplicationContext createApplicationContext() {
        return new OsgiBundleXmlApplicationContext(new
String[]{"org/kie/spring/kie-beans.xml"});
    }



On Sun, Jun 9, 2013 at 9:20 PM, Andreas Pieber <[email protected]> wrote:

> to use "versionAsInProject"  you need to add
>
> <build>
>   <plugins>
>     <plugin>
>       <groupId>org.apache.servicemix.tooling</groupId>
>       <artifactId>depends-maven-plugin</artifactId>
>       <version>1.2</version>
>       <executions>
>         <execution>
>           <id>generate-depends-file</id>
>           <goals>
>             <goal>generate-depends-file</goal>
>           </goals>
>         </execution>
>       </executions>
>     </plugin>
>   </plugins>
> </build>
>
>
>
> On Sun, Jun 9, 2013 at 3:56 PM, Charles Moulliard <[email protected]>wrote:
>
>> What do you mean by "extracted" the versions ? SMX doc is not really
>> verbose (
>> http://servicemix.apache.org/docs/4.5.x/developers-guide/writing-tests.html)
>> but my code looks like what we do with camel, karaf, ....
>>
>>
>> On Sun, Jun 9, 2013 at 12:59 PM, Andreas Pieber <[email protected]>wrote:
>>
>>> Have you extracted the versions using the service mix plugin as
>>> described in the documentation? Is the version. Properties generated
>>> correctly?
>>>
>>> Kind regards, Andreas
>>>
>>> On 9 Jun 2013 12:46, "Charles Moulliard" <[email protected]> wrote:
>>> >
>>> > Hi,
>>> >
>>> > I get this pax exam (maven error) in an unit test which was working
>>> previously. Here is also the pom file. What should I do in the pom file
>>> definition to avoid this error (
>>> https://gist.github.com/cmoulliard/49e4ef4c871d48bba550)
>>> >
>>> > java.lang.RuntimeException: Could not resolve version for
>>> groupId:org.apache.karaf artifactId:apache-karaf by reading the dependency
>>> information generated by maven.
>>> > at org.ops4j.pax.exam.MavenUtils.getArtifactVersion(MavenUtils.java:78)
>>> > at org.ops4j.pax.exam.MavenUtils$1.getVersion(MavenUtils.java:100)
>>> > at
>>> org.ops4j.pax.exam.options.MavenArtifactUrlReference.version(MavenArtifactUrlReference.java:110)
>>> > at
>>> org.ops4j.pax.exam.options.MavenArtifactUrlReference.versionAsInProject(MavenArtifactUrlReference.java:118)
>>> >
>>> > Class
>>> >
>>> > import static
>>> org.apache.karaf.tooling.exam.options.KarafDistributionOption.*;
>>> >
>>> > ...
>>> >
>>> >     @Configuration
>>> >     public static Option[] configure() {
>>> >         return new Option[]{
>>> >                 karafDistributionConfiguration().frameworkUrl(
>>> >
>>> maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject())
>>> >
>>> .karafVersion(MavenUtils.getArtifactVersion("org.apache.karaf",
>>> "apache-karaf")).name("Apache Karaf")
>>> >                         .unpackDirectory(new
>>> File("target/exam/unpack/")),
>>> >
>>> >                 keepRuntimeFolder(),
>>> >
>>> > ...
>>> >
>>> > Pom file
>>> >
>>> > Regards,
>>> >
>>> > --
>>> > Charles Moulliard
>>> > Apache Committer / Architect (RedHat)
>>> > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>> >
>>>
>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Reply via email to