Get more of the osgi tests passing.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/133be338 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/133be338 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/133be338 Branch: refs/heads/master Commit: 133be3383dab5d990c34e2a841ea3357cedf82ec Parents: 24758af Author: Daniel Kulp <dk...@apache.org> Authored: Fri Aug 22 12:34:32 2014 -0400 Committer: Daniel Kulp <dk...@apache.org> Committed: Fri Aug 22 12:56:10 2014 -0400 ---------------------------------------------------------------------- tests/camel-itest-osgi/pom.xml | 22 ++++----- .../osgi/blueprint/CamelBlueprint4Test.java | 4 ++ .../itest/osgi/cxf/CxfBeanSpringRouteTest.java | 1 + .../itest/osgi/cxf/CxfProxyExampleTest.java | 18 +++---- .../cxf/blueprint/CxfBlueprintRouterTest.java | 52 +++++++++----------- 5 files changed, 46 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/133be338/tests/camel-itest-osgi/pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/pom.xml b/tests/camel-itest-osgi/pom.xml index f95115e..ca89992 100644 --- a/tests/camel-itest-osgi/pom.xml +++ b/tests/camel-itest-osgi/pom.xml @@ -39,6 +39,17 @@ <dependencies> <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-junit4</artifactId> <scope>test</scope> @@ -77,17 +88,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-broker</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/camel/blob/133be338/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 8a3e619..bebe4f2 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 @@ -26,6 +26,8 @@ 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.PerSuite; import org.ops4j.pax.tinybundles.core.TinyBundles; import org.osgi.framework.Constants; @@ -35,6 +37,7 @@ import static org.ops4j.pax.exam.OptionUtils.combine; * @version */ @RunWith(PaxExam.class) +@ExamReactorStrategy(PerSuite.class) public class CamelBlueprint4Test extends OSGiBlueprintTestSupport { @Test @@ -126,6 +129,7 @@ public class CamelBlueprint4Test extends OSGiBlueprintTestSupport { .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-13.xml")) .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle22") .add(TestRouteBuilder.class) + .set(Constants.EXPORT_PACKAGE, TestRouteBuilder.class.getPackage().getName()) .build(TinyBundles.withBnd())).noStart(), // using the features to install the camel components http://git-wip-us.apache.org/repos/asf/camel/blob/133be338/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java index 265a464..17d142b 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java @@ -74,6 +74,7 @@ public class CxfBeanSpringRouteTest extends OSGiIntegrationSpringTestSupport { .add(org.apache.camel.itest.osgi.cxf.jaxrs.testbean.CustomerServiceResource.class) .add(org.apache.camel.itest.osgi.cxf.jaxrs.testbean.Order.class) .add(org.apache.camel.itest.osgi.cxf.jaxrs.testbean.Product.class) + .set("Export-Package", "org.apache.camel.itest.osgi.cxf.jaxrs.testbean") .build(TinyBundles.withBnd()))//, //vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006") ); http://git-wip-us.apache.org/repos/asf/camel/blob/133be338/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java index 4b42a28..3f5d23d 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java @@ -37,16 +37,9 @@ import static org.ops4j.pax.exam.OptionUtils.combine; @RunWith(PaxExam.class) public class CxfProxyExampleTest extends OSGiIntegrationSpringTestSupport { - protected static ReportIncidentEndpoint createCXFClient() { - // we use CXF to create a client for us as its easier than JAXWS and works - JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); - factory.setServiceClass(ReportIncidentEndpoint.class); - factory.setAddress("http://localhost:9080/camel-itest-osgi/webservices/incident"); - return (ReportIncidentEndpoint) factory.create(); - } - @Test public void testCxfProxy() throws Exception { + // create input parameter InputReportIncident input = new InputReportIncident(); input.setIncidentId("123"); @@ -59,7 +52,11 @@ public class CxfProxyExampleTest extends OSGiIntegrationSpringTestSupport { input.setPhone("12345678"); // create the webservice client and send the request - ReportIncidentEndpoint client = createCXFClient(); + // we use CXF to create a client for us as its easier than JAXWS and works + JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); + factory.setServiceClass(ReportIncidentEndpoint.class); + factory.setAddress("http://localhost:9080/camel-itest-osgi/webservices/incident"); + ReportIncidentEndpoint client = factory.create(ReportIncidentEndpoint.class); OutputReportIncident out = client.reportIncident(input); // assert we got a OK back @@ -81,7 +78,7 @@ public class CxfProxyExampleTest extends OSGiIntegrationSpringTestSupport { getDefaultCamelKarafOptions(), // using the features to install the camel components - loadCamelFeatures("camel-http", "camel-cxf"), + loadCamelFeatures("camel-http", "cxf", "camel-cxf"), // need to install the generated src as the pax-exam doesn't wrap this bundles provision(TinyBundles.bundle() @@ -90,6 +87,7 @@ public class CxfProxyExampleTest extends OSGiIntegrationSpringTestSupport { .add(org.apache.camel.example.reportincident.ReportIncidentEndpoint.class) .add(org.apache.camel.example.reportincident.ReportIncidentEndpointService.class) .add(org.apache.camel.example.reportincident.ObjectFactory.class) + .set("Export-Package", "org.apache.camel.example.reportincident") .build(TinyBundles.withBnd()))); return options; http://git-wip-us.apache.org/repos/asf/camel/blob/133be338/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java index 882e4ee..a839a03 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java @@ -16,8 +16,6 @@ */ package org.apache.camel.itest.osgi.cxf.blueprint; -import java.io.InputStream; - import org.apache.camel.CamelContext; import org.apache.camel.example.reportincident.InputReportIncident; import org.apache.camel.example.reportincident.OutputReportIncident; @@ -97,33 +95,27 @@ public class CxfBlueprintRouterTest extends OSGiBlueprintTestSupport { @Configuration public static Option[] configure() throws Exception { - try { - InputStream ins = TinyBundles.bundle() - .add("OSGI-INF/blueprint/test.xml", CxfBlueprintRouterTest.class.getResource("CxfBlueprintRouter.xml")) - .add("WSDL/report_incident.wsdl", CxfBlueprintRouterTest.class.getResource("/report_incident.wsdl")) - .add(org.apache.camel.example.reportincident.InputReportIncident.class) - .add(org.apache.camel.example.reportincident.OutputReportIncident.class) - .add(org.apache.camel.example.reportincident.ReportIncidentEndpoint.class) - .add(org.apache.camel.example.reportincident.ReportIncidentEndpointService.class) - .add(org.apache.camel.example.reportincident.ObjectFactory.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "CxfBlueprintRouterTest") - .set(Constants.DYNAMICIMPORT_PACKAGE, "*") - .build(TinyBundles.withBnd()); - - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the camel components - loadCamelFeatures( - "camel-blueprint", "camel-cxf"), - - bundle(ins).noStart() - - ); - - return options; - } catch (Throwable ite) { - ite.printStackTrace(); - throw new RuntimeException(ite); - } + Option[] options = combine( + getDefaultCamelKarafOptions(), + // using the features to install the camel components + loadCamelFeatures( + "camel-blueprint", "camel-cxf"), + + bundle(TinyBundles.bundle() + .add("OSGI-INF/blueprint/test.xml", CxfBlueprintRouterTest.class.getResource("CxfBlueprintRouter.xml")) + .add("WSDL/report_incident.wsdl", CxfBlueprintRouterTest.class.getResource("/report_incident.wsdl")) + .add(org.apache.camel.example.reportincident.InputReportIncident.class) + .add(org.apache.camel.example.reportincident.OutputReportIncident.class) + .add(org.apache.camel.example.reportincident.ReportIncidentEndpoint.class) + .add(org.apache.camel.example.reportincident.ReportIncidentEndpointService.class) + .add(org.apache.camel.example.reportincident.ObjectFactory.class) + .set("Export-Package", "org.apache.camel.example.reportincident") + .set(Constants.BUNDLE_SYMBOLICNAME, "CxfBlueprintRouterTest") + .set(Constants.DYNAMICIMPORT_PACKAGE, "*") + .build(TinyBundles.withBnd())).noStart() + + ); + + return options; } }