Repository: camel Updated Branches: refs/heads/master fa9b6e5ef -> 30545df97
[CAMEL-6939] Fixing failing tests Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96c98452 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96c98452 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96c98452 Branch: refs/heads/master Commit: 96c984520b6a7d2e45ffe7877811ec342977bcc6 Parents: fa9b6e5 Author: Grzegorz Grzybek <gr.grzy...@gmail.com> Authored: Fri Jun 27 11:30:11 2014 +0200 Committer: Grzegorz Grzybek <gr.grzy...@gmail.com> Committed: Fri Jun 27 12:24:43 2014 +0200 ---------------------------------------------------------------------- .../osgi/blueprint/CamelBlueprint4Test.java | 1 + .../osgi/core/xslt/XsltBlueprintRouteTest.java | 1 + .../itest/osgi/disruptor/DisruptorTest.java | 23 ++++++-------------- .../osgi/disruptor/vm/DisruptorVmTest.java | 7 +++++- .../camel/itest/osgi/groovy/GroovyTest.java | 14 ++++++++++-- .../itest/osgi/jaxb/JaxbDataFormatTest.java | 11 +++++++++- .../itest/osgi/script/GroovyScriptOsgiTest.java | 11 +++++++++- 7 files changed, 47 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java index b5389d2..0d43e89 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java @@ -107,6 +107,7 @@ public class CamelBlueprint4Test extends OSGiBlueprintTestSupport { .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-19.xml")) .add("org/apache/camel/itest/osgi/blueprint/example.xsl", OSGiBlueprintTestSupport.class.getResource("example.xsl")) .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle19") + .set(Constants.DYNAMICIMPORT_PACKAGE, "*") .build()).noStart(), bundle(newBundle() http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/xslt/XsltBlueprintRouteTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/xslt/XsltBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/xslt/XsltBlueprintRouteTest.java index 2a37435..4f1b991 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/xslt/XsltBlueprintRouteTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/xslt/XsltBlueprintRouteTest.java @@ -81,6 +81,7 @@ public class XsltBlueprintRouteTest extends OSGiBlueprintTestSupport { .add("OSGI-INF/blueprint/test.xml", XsltBlueprintRouteTest.class.getResource("XsltBlueprintRouter.xml")) .add("transform.xsl", XsltBlueprintRouteTest.class.getResource("transform.xsl")) .set(Constants.BUNDLE_SYMBOLICNAME, "XsltBlueprintRouteTest") + .set(Constants.DYNAMICIMPORT_PACKAGE, "*") .build(withBnd())).noStart() ); http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/DisruptorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/DisruptorTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/DisruptorTest.java index 5961674..941d609 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/DisruptorTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/DisruptorTest.java @@ -20,6 +20,8 @@ import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; +import org.apache.karaf.tooling.exam.options.KarafDistributionConfigurationFileExtendOption; +import org.apache.karaf.tooling.exam.options.KarafDistributionOption; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Option; @@ -52,27 +54,16 @@ public class DisruptorTest extends OSGiIntegrationTestSupport { template.sendBody("disruptor:foo", "Hello World"); assertMockEndpointsSatisfied(); } - - @Test - public void testCamelContextName() throws Exception { - // should get the context name with osgi bundle id - String name1 = context.getName(); - - CamelContext context2 = createCamelContext(); - String name2 = context2.getName(); - assertNotSame(name1, name2); - - String id = "" + bundleContext.getBundle().getBundleId(); - assertTrue(name1.startsWith(id)); - assertTrue(name2.startsWith(id)); - } - @Configuration public static Option[] configure() { Option[] options = combine( getDefaultCamelKarafOptions(), - // using the features to install the other camel components + // disruptor requires sun.misc packages + new KarafDistributionConfigurationFileExtendOption("etc/jre.properties", "jre-1.6", ",sun.misc"), + new KarafDistributionConfigurationFileExtendOption("etc/jre.properties", "jre-1.7", ",sun.misc"), + new KarafDistributionConfigurationFileExtendOption("etc/jre.properties", "jre-1.8", ",sun.misc"), + // using the features to install the other camel components loadCamelFeatures("camel-disruptor")); return options; http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/vm/DisruptorVmTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/vm/DisruptorVmTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/vm/DisruptorVmTest.java index dcc7f70..42aea26 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/vm/DisruptorVmTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/disruptor/vm/DisruptorVmTest.java @@ -18,6 +18,7 @@ package org.apache.camel.itest.osgi.disruptor.vm; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; +import org.apache.karaf.tooling.exam.options.KarafDistributionConfigurationFileExtendOption; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Option; @@ -69,7 +70,11 @@ public class DisruptorVmTest extends OSGiIntegrationTestSupport { public static Option[] configure() { Option[] options = combine( getDefaultCamelKarafOptions(), - // using the features to install the other camel components + // disruptor requires sun.misc packages + new KarafDistributionConfigurationFileExtendOption("etc/jre.properties", "jre-1.6", ",sun.misc"), + new KarafDistributionConfigurationFileExtendOption("etc/jre.properties", "jre-1.7", ",sun.misc"), + new KarafDistributionConfigurationFileExtendOption("etc/jre.properties", "jre-1.8", ",sun.misc"), + // using the features to install the other camel components loadCamelFeatures("camel-disruptor")); return options; http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/groovy/GroovyTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/groovy/GroovyTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/groovy/GroovyTest.java index b524746..8c51a73 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/groovy/GroovyTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/groovy/GroovyTest.java @@ -16,9 +16,11 @@ */ package org.apache.camel.itest.osgi.groovy; +import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; +import org.apache.karaf.tooling.exam.options.KarafDistributionOption; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Option; @@ -38,7 +40,15 @@ public class GroovyTest extends OSGiIntegrationTestSupport { template.sendBody("direct:groovy", "Hello"); result.assertIsSatisfied(); } - + + @Override + protected CamelContext createCamelContext() throws Exception { + CamelContext context = super.createCamelContext(); + // without this, "groovy.lang.*" classes will be loaded by classloader of camel-spring bundle + context.setApplicationContextClassLoader(this.getClass().getClassLoader()); + return context; + } + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { @@ -51,7 +61,7 @@ public class GroovyTest extends OSGiIntegrationTestSupport { public static Option[] configure() { Option[] options = combine( getDefaultCamelKarafOptions(), - // using the features to install the other camel components + // using the features to install the other camel components loadCamelFeatures("camel-groovy")); return options; http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java index a4f5d81..23ecbe0 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java @@ -16,10 +16,12 @@ */ package org.apache.camel.itest.osgi.jaxb; +import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.converter.jaxb.JaxbDataFormat; import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; +import org.apache.karaf.tooling.exam.options.KarafDistributionOption; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Option; @@ -40,6 +42,13 @@ public class JaxbDataFormatTest extends OSGiIntegrationTestSupport { }; } + @Override + protected CamelContext createCamelContext() throws Exception { + CamelContext context = super.createCamelContext(); + context.setApplicationContextClassLoader(this.getClass().getClassLoader()); + return context; + } + @Test public void testSendMessage() throws Exception { MockEndpoint mock = getMandatoryEndpoint("mock:bar", MockEndpoint.class); @@ -59,7 +68,7 @@ public class JaxbDataFormatTest extends OSGiIntegrationTestSupport { public static Option[] configure() { Option[] options = combine( getDefaultCamelKarafOptions(), - // using the features to install the other camel components + // using the features to install the other camel components loadCamelFeatures("camel-jaxb")); return options; http://git-wip-us.apache.org/repos/asf/camel/blob/96c98452/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/script/GroovyScriptOsgiTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/script/GroovyScriptOsgiTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/script/GroovyScriptOsgiTest.java index 120b45b..bea39a2 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/script/GroovyScriptOsgiTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/script/GroovyScriptOsgiTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.itest.osgi.script; +import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; @@ -48,7 +49,15 @@ public class GroovyScriptOsgiTest extends OSGiIntegrationTestSupport { assertMockEndpointsSatisfied(); } - + + @Override + protected CamelContext createCamelContext() throws Exception { + CamelContext context = super.createCamelContext(); + // without this, "groovy.lang.*" classes will be loaded by classloader of camel-spring bundle + context.setApplicationContextClassLoader(this.getClass().getClassLoader()); + return context; + } + @Configuration public static Option[] configure() { Option[] options = combine(