Make itest karaf run as latest karaf has some rbac changes that causes pax-exam 
to not work and crash the JVM. Adjust the code so it can compile with karaf 4.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d5855254
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d5855254
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d5855254

Branch: refs/heads/master
Commit: d5855254c22e274501f5af7d633bae52757959b4
Parents: e095075
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sat Mar 12 09:07:09 2016 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Mar 12 10:31:26 2016 +0100

----------------------------------------------------------------------
 parent/pom.xml                                         |  4 ++--
 tests/camel-itest-karaf/pom.xml                        |  8 +++++++-
 .../apache/camel/itest/karaf/AbstractFeatureTest.java  | 13 +++----------
 3 files changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d5855254/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2197a8b..7b64bde 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -346,8 +346,8 @@
     <jzlib-version>1.1.3</jzlib-version>
     <jzlib-bundle-version>1.1.3_2</jzlib-bundle-version>
     <kafka-version>0.9.0.1</kafka-version>
-    <karaf-version>2.4.4</karaf-version>
-    <karaf3-version>3.0.5</karaf3-version>
+    <karaf-version>2.4.3</karaf-version>
+    <karaf3-version>3.0.6</karaf3-version>
     <karaf4-version>4.0.4</karaf4-version>
     <kie-version>6.3.0.Final</kie-version>
     <krati-version>0.4.9</krati-version>

http://git-wip-us.apache.org/repos/asf/camel/blob/d5855254/tests/camel-itest-karaf/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/pom.xml b/tests/camel-itest-karaf/pom.xml
index 5fbb379..5248385 100644
--- a/tests/camel-itest-karaf/pom.xml
+++ b/tests/camel-itest-karaf/pom.xml
@@ -180,7 +180,7 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <forkCount>1</forkCount>
-                   <reuseForks>false</reuseForks>
+                           <reuseForks>false</reuseForks>
                     <systemPropertyVariables>
                         <karafVersion>${karaf-version}</karafVersion>
                     </systemPropertyVariables>
@@ -224,6 +224,12 @@
                 <karaf-version>${karaf3-version}</karaf-version>
             </properties>
         </profile>
+        <profile>
+        <id>karaf4</id>
+            <properties>
+                <karaf-version>${karaf4-version}</karaf-version>
+            </properties>
+        </profile>
     </profiles>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/d5855254/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
 
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
index 524198b..2c1acb5 100644
--- 
a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
+++ 
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
@@ -23,17 +23,14 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
-
 import javax.inject.Inject;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
 import org.apache.camel.impl.DefaultRouteContext;
 import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.osgi.CamelContextFactory;
-
 import org.junit.After;
 import org.junit.Before;
-
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption;
@@ -44,7 +41,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.junit.Assert.assertNotNull;
-
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
@@ -130,10 +126,8 @@ public abstract class AbstractFeatureTest {
     protected CamelContext createCamelContext() throws Exception {
         LOG.info("Creating the CamelContext ...");
         setThreadContextClassLoader();
-        CamelContextFactory factory = new CamelContextFactory();
-        factory.setBundleContext(bundleContext);
-        LOG.info("Get the bundleContext is " + bundleContext);
-        return factory.createContext();
+        OsgiDefaultCamelContext camel = new 
OsgiDefaultCamelContext(bundleContext);
+        return camel;
     }
 
     protected void setThreadContextClassLoader() {
@@ -249,7 +243,6 @@ public abstract class AbstractFeatureTest {
             // we need INFO logging otherwise we cannot see what happens
             new LogLevelOption(LogLevelOption.LogLevel.INFO),
 
-
             // install the cxf jaxb spec as the karaf doesn't provide it by 
default
             KarafDistributionOption.features(getCamelKarafFeatureUrl(), 
features)
         };

Reply via email to