1 Reply Latest reply on Aug 21, 2014 3:15 AM by Claus Ibsen

    fails in integration test using pax exam 3.5

    Eric Debar Newbie

      Hi,

       

      I'm trying to implement integration testing using camel/springDM.

       

      With the code below, karaf is installed (with one repeating error), but the camel features is not installed. What wrong with my code ... ?

       

      Thanks for helping me.

      Eric

       

      UPDATE1 : it seems to be related to karaf itself, because when I try to start karaf itself from the prompt, I have the same error as below

      UPDATE2 : when setting karaf version to 2.3.0 it is working, so it seems that the redhat version gives the error

       

      The log :

       

      97% [=====================================================================>  ]2014-08-20 11:05:13,733 | ERROR | -610379-thread-2 | BlueprintContainerImpl           | container.BlueprintContainerImpl  398 | 8 - org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | Unable to start blueprint container for bundle org.apache.karaf.features.management

      javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found

        at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:110)[:2.3.0.redhat-610379]

        at org.apache.aries.blueprint.parser.Parser.getDocumentBuilderFactory(Parser.java:1376)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.blueprint.parser.Parser.parse(Parser.java:203)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.blueprint.parser.Parser.parse(Parser.java:219)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:290)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)[8:org.apache.aries.blueprint.core:1.0.1.redhat-610379]

        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[10:org.apache.aries.util:1.0.1.redhat-610379]

        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[10:org.apache.aries.util:1.0.1.redhat-610379]

        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[10:org.apache.aries.util:1.0.1.redhat-610379]

        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[10:org.apache.aries.util:1.0.1.redhat-610379]

        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[10:org.apache.aries.util:1.0.1.redhat-610379]

        at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

        at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4650)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

        at org.apache.felix.framework.Felix$4.run(Felix.java:2123)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

        at org.apache.felix.framework.Felix$5.run(Felix.java:2167)[org.apache.felix.framework-4.0.3.redhat-610379.jar:]

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_32]

        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_32]

        at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_32]

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_32]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_32]

        at java.lang.Thread.run(Thread.java:662)[:1.6.0_32]

       

       

      100% [========================================================================]

       

      The java code :

       

      package belfius.gert.camel.context.karaf.test;

       

      import static org.ops4j.pax.exam.CoreOptions.*;

      import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*;

      import java.io.File;

      import org.junit.Test;

      import org.junit.runner.RunWith;

      import org.ops4j.pax.exam.Configuration;

      import org.ops4j.pax.exam.Option;

      import org.ops4j.pax.exam.junit.PaxExam;

      import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;

      import org.ops4j.pax.exam.spi.reactors.PerMethod;

      import org.slf4j.Logger;

      import org.slf4j.LoggerFactory;

       

       

      @RunWith(PaxExam.class)

      @ExamReactorStrategy(PerMethod.class)

      public class PaxExamKarafTest {

        private static Logger LOG = LoggerFactory

        .getLogger(PaxExamKarafTest.class);

       

       

        @Configuration

        public Option[] config() {

       

       

        return new Option[] {

        karafDistributionConfiguration().frameworkUrl(maven()

        .groupId("org.apache.karaf").artifactId("apache-karaf")

        .version("2.3.0.redhat-610379").type("zip")).karafVersion("2.3.0.redhat-610379")

        .unpackDirectory(new File("target/exam"))

        .useDeployFolder(false),

        keepRuntimeFolder(),

        features(maven()

        .groupId("org.apache.camel.karaf").artifactId("apache-camel")

        .classifier("features").type("xml").version("2.12.0.redhat-610379"), "camel"),

        };

        }

       

       

        @Test

        public void testAdd() {

        LOG.info("Result of test", "ok");

        }

      }

       

      Maven dependencies :  ${pax-exam-version} = 3.5.0

       

      <!-- testing with pax exam -->
      <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-container-karaf</artifactId>
      <version>${pax-exam-version}</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-junit4</artifactId>
      <version>${pax-exam-version}</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam</artifactId>
      <version>${pax-exam-version}</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>org.ops4j.pax.url</groupId>
      <artifactId>pax-url-aether</artifactId>
      <version>1.6.0</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
      </dependency>