From 163c8c4853fb692e6735d286139525162d07097f Mon Sep 17 00:00:00 2001 From: Thomas Diesler Date: Fri, 15 Sep 2017 12:01:03 +0200 Subject: [PATCH] [resolves #2036] Add support for component xmlrpc [resolves #2049] Add support for dataformat xmlrpc --- catalog/src/main/resources/component.roadmap | 2 +- catalog/src/main/resources/dataformat.roadmap | 6 +- docs/guide/components/camel-xmlrpc.adoc | 5 + docs/guide/components/index.adoc | 2 + docs/guide/dataformats/index.adoc | 1 + .../apache/camel/component/main/module.xml | 1 + feature/pack/etc/smartics/camel-modules.xml | 15 +++ feature/pack/etc/smartics/other-modules.xml | 13 ++ feature/pack/etc/smartics/skipped-modules.xml | 7 +- feature/pack/pom.xml | 4 + .../apache/camel/component/main/module.xml | 1 + .../camel/component/xmlrpc/main/module.xml | 16 +++ .../apache/ws/commons/util/main/module.xml | 13 ++ .../test/xmlrpc/XmlRpcIntegrationTest.java | 117 ++++++++++++++++++ .../classloading/exported-path-patterns.txt | 1 + .../resources/classloading/exported-paths.txt | 11 ++ patch/etc/baseline/module-list.txt | 4 + 17 files changed, 212 insertions(+), 7 deletions(-) create mode 100644 docs/guide/components/camel-xmlrpc.adoc create mode 100644 feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/xmlrpc/main/module.xml create mode 100644 feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/ws/commons/util/main/module.xml create mode 100644 itests/standalone/basic/src/test/java/org/wildfly/camel/test/xmlrpc/XmlRpcIntegrationTest.java diff --git a/catalog/src/main/resources/component.roadmap b/catalog/src/main/resources/component.roadmap index 7ecc35a671..b599d8a92e 100644 --- a/catalog/src/main/resources/component.roadmap +++ b/catalog/src/main/resources/component.roadmap @@ -138,6 +138,7 @@ velocity vertx vm weather +xmlrpc xmlsecurity xquery xslt @@ -223,7 +224,6 @@ spring-ws #1476 stomp #2033 string-template #2034 telegram #2035 -xmlrpc #2036 xmpp #2037 yammer #2038 diff --git a/catalog/src/main/resources/dataformat.roadmap b/catalog/src/main/resources/dataformat.roadmap index 6ba1448213..d34baef40e 100644 --- a/catalog/src/main/resources/dataformat.roadmap +++ b/catalog/src/main/resources/dataformat.roadmap @@ -29,14 +29,13 @@ syslog tarfile tidyMarkup xmlBeans +xmlrpc xstream yaml-snakeyaml zip zipfile [planned] - -[undecided] boon #2039 hessian #2040 ical #2041 @@ -47,7 +46,8 @@ univocity-csv #2045 univocity-fixed #2046 univocity-tsv #2047 xmljson #2048 -xmlrpc #2049 + +[undecided] [rejected] diff --git a/docs/guide/components/camel-xmlrpc.adoc b/docs/guide/components/camel-xmlrpc.adoc new file mode 100644 index 0000000000..7241572f2e --- /dev/null +++ b/docs/guide/components/camel-xmlrpc.adoc @@ -0,0 +1,5 @@ +### camel-xmlrpc + +The http://camel.apache.org/xmlrpc.html[xmlrpc,window=_blank] +component provides a dataformat for xml, which allows serialization and deserialization of request messages and response message using the https://ws.apache.org/xmlrpc[Apache XmlRpc,window=_blank] binary dataformat. You can also invoke the XMLRPC Service through the camel-xmlrpc producer. + diff --git a/docs/guide/components/index.adoc b/docs/guide/components/index.adoc index 6282c3292c..f6c4306773 100644 --- a/docs/guide/components/index.adoc +++ b/docs/guide/components/index.adoc @@ -234,6 +234,8 @@ include::camel-vertx.adoc[] include::camel-weather.adoc[] +include::camel-xmlrpc.adoc[] + include::camel-xstream.adoc[] include::camel-zendesk.adoc[] diff --git a/docs/guide/dataformats/index.adoc b/docs/guide/dataformats/index.adoc index 10fcbe59ba..6ada67a2cd 100644 --- a/docs/guide/dataformats/index.adoc +++ b/docs/guide/dataformats/index.adoc @@ -23,6 +23,7 @@ The following lists supported Data Formats * https://github.com/apache/camel/blob/master/components/camel-tarfile/src/main/docs/tarfile-dataformat.adoc[Tarfile,window=_blank] * http://camel.apache.org/tidymarkup.html[TidyMarkup,window=_blank] * http://camel.apache.org/xmlbeans.html[XmlBeans,window=_blank] +* http://camel.apache.org/xmlrpc.html[XmlRpc,window=_blank] * http://camel.apache.org/xml-security-component.html[XMLSecurity,window=_blank] * http://camel.apache.org/xstream.html[XStream,window=_blank] * http://camel.apache.org/yaml-data-format.html[YAML,window=_blank] diff --git a/feature/pack/etc/managed/wildfly/modules/system/layers/fuse/org/apache/camel/component/main/module.xml b/feature/pack/etc/managed/wildfly/modules/system/layers/fuse/org/apache/camel/component/main/module.xml index 0d7dc45f28..4126d9b1a7 100644 --- a/feature/pack/etc/managed/wildfly/modules/system/layers/fuse/org/apache/camel/component/main/module.xml +++ b/feature/pack/etc/managed/wildfly/modules/system/layers/fuse/org/apache/camel/component/main/module.xml @@ -182,6 +182,7 @@ + diff --git a/feature/pack/etc/smartics/camel-modules.xml b/feature/pack/etc/smartics/camel-modules.xml index c7f7aa6e0f..e686826334 100644 --- a/feature/pack/etc/smartics/camel-modules.xml +++ b/feature/pack/etc/smartics/camel-modules.xml @@ -2119,6 +2119,21 @@ + + + + + + + + + + + + + + + diff --git a/feature/pack/etc/smartics/other-modules.xml b/feature/pack/etc/smartics/other-modules.xml index 8c2cf549bf..6761f5a6e5 100644 --- a/feature/pack/etc/smartics/other-modules.xml +++ b/feature/pack/etc/smartics/other-modules.xml @@ -893,6 +893,19 @@ + + + + + + + + + + + + + diff --git a/feature/pack/etc/smartics/skipped-modules.xml b/feature/pack/etc/smartics/skipped-modules.xml index 3477f37864..5eb91498cb 100644 --- a/feature/pack/etc/smartics/skipped-modules.xml +++ b/feature/pack/etc/smartics/skipped-modules.xml @@ -152,6 +152,10 @@ + + + + @@ -209,9 +213,6 @@ - - - diff --git a/feature/pack/pom.xml b/feature/pack/pom.xml index 6b227829f7..92785be68d 100644 --- a/feature/pack/pom.xml +++ b/feature/pack/pom.xml @@ -619,6 +619,10 @@ org.apache.camel camel-xmlbeans + + org.apache.camel + camel-xmlrpc + org.apache.camel camel-xmlsecurity diff --git a/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/main/module.xml b/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/main/module.xml index 0d7dc45f28..4126d9b1a7 100644 --- a/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/main/module.xml +++ b/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/main/module.xml @@ -182,6 +182,7 @@ + diff --git a/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/xmlrpc/main/module.xml b/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/xmlrpc/main/module.xml new file mode 100644 index 0000000000..82317defa4 --- /dev/null +++ b/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/camel/component/xmlrpc/main/module.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/ws/commons/util/main/module.xml b/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/ws/commons/util/main/module.xml new file mode 100644 index 0000000000..31f901fcd6 --- /dev/null +++ b/feature/pack/src/main/resources/modules/system/layers/fuse/org/apache/ws/commons/util/main/module.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/itests/standalone/basic/src/test/java/org/wildfly/camel/test/xmlrpc/XmlRpcIntegrationTest.java b/itests/standalone/basic/src/test/java/org/wildfly/camel/test/xmlrpc/XmlRpcIntegrationTest.java new file mode 100644 index 0000000000..e53f52afc9 --- /dev/null +++ b/itests/standalone/basic/src/test/java/org/wildfly/camel/test/xmlrpc/XmlRpcIntegrationTest.java @@ -0,0 +1,117 @@ +/* + * #%L + * Wildfly Camel :: Testsuite + * %% + * Copyright (C) 2013 - 2014 RedHat + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +package org.wildfly.camel.test.xmlrpc; + +import org.apache.camel.CamelContext; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.xmlrpc.XmlRpcRequestImpl; +import org.apache.camel.dataformat.xmlrpc.XmlRpcDataFormat; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.xmlrpc.XmlRpcRequest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.wildfly.extension.camel.CamelAware; + +@CamelAware +@RunWith(Arquillian.class) +public class XmlRpcIntegrationTest { + + @Deployment + public static JavaArchive createDeployment() { + return ShrinkWrap.create(JavaArchive.class, "camel-xmlrpc-tests"); + } + + @Test + public void testRequestMessage() throws Exception { + + CamelContext camelctx = new DefaultCamelContext(); + camelctx.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + + XmlRpcDataFormat request = new XmlRpcDataFormat(); + request.setRequest(true); + + from("direct:request") + .marshal(request) + .to("log:marshalRequestMessage") + .unmarshal(request) + .to("log:unmarshalRequestMessage") + .to("mock:request"); + } + }); + + camelctx.start(); + try { + ProducerTemplate template = camelctx.createProducerTemplate(); + MockEndpoint mock = camelctx.getEndpoint("mock:request", MockEndpoint.class); + mock.expectedMessageCount(1); + XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[]{"you", 2}), XmlRpcRequest.class); + Assert.assertNotNull(result); + Assert.assertEquals("Get a wrong request operation name", "greet", result.getMethodName()); + Assert.assertEquals("Get a wrong request parameter size", 2, result.getParameterCount()); + Assert.assertEquals("Get a wrong request parameter", 2, result.getParameter(1)); + mock.assertIsSatisfied(); + } finally { + camelctx.stop(); + } + } + + @Test + public void testResponseMessage() throws Exception { + + CamelContext camelctx = new DefaultCamelContext(); + camelctx.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + + XmlRpcDataFormat response = new XmlRpcDataFormat(); + response.setRequest(false); + + from("direct:response") + .marshal(response) + .to("log:marshalResponseMessage") + .unmarshal(response) + .to("log:unmarshalResonseMessage") + .to("mock:response"); + + } + }); + + camelctx.start(); + try { + ProducerTemplate template = camelctx.createProducerTemplate(); + MockEndpoint mock = camelctx.getEndpoint("mock:response", MockEndpoint.class); + mock.expectedBodiesReceived("GreetMe from XmlRPC"); + template.sendBody("direct:response", "GreetMe from XmlRPC"); + mock.assertIsSatisfied(); + } finally { + camelctx.stop(); + } + } +} diff --git a/itests/standalone/extra/src/test/resources/classloading/exported-path-patterns.txt b/itests/standalone/extra/src/test/resources/classloading/exported-path-patterns.txt index a820777151..6522836149 100644 --- a/itests/standalone/extra/src/test/resources/classloading/exported-path-patterns.txt +++ b/itests/standalone/extra/src/test/resources/classloading/exported-path-patterns.txt @@ -55,6 +55,7 @@ ^org/apache/xmlbeans/impl/schema ^org/apache/xmlbeans/impl/values ^org/apache/zookeeper(.*) + ^org/apache/xmlrpc(.*) ^org/asynchttpclient(.*) ^org/codehaus/groovy(.*) ^org/dozer(.*) diff --git a/itests/standalone/extra/src/test/resources/classloading/exported-paths.txt b/itests/standalone/extra/src/test/resources/classloading/exported-paths.txt index a5b105e549..b066cea92b 100644 --- a/itests/standalone/extra/src/test/resources/classloading/exported-paths.txt +++ b/itests/standalone/extra/src/test/resources/classloading/exported-paths.txt @@ -1017,6 +1017,8 @@ org/apache/camel/component/vertx org/apache/camel/component/weather org/apache/camel/component/weather/geolocation org/apache/camel/component/weather/http +org/apache/camel/component/xmlrpc +org/apache/camel/component/xmlrpc/converter org/apache/camel/component/xmlsecurity org/apache/camel/component/xmlsecurity/api org/apache/camel/component/xmlsecurity/processor @@ -1056,6 +1058,7 @@ org/apache/camel/dataformat/soap org/apache/camel/dataformat/soap/name org/apache/camel/dataformat/tagsoup org/apache/camel/dataformat/tarfile +org/apache/camel/dataformat/xmlrpc org/apache/camel/dataformat/xmlsecurity org/apache/camel/dataformat/xstream org/apache/camel/dataformat/zipfile @@ -1451,6 +1454,14 @@ org/apache/olingo/odata2/core/uri/expression org/apache/xmlbeans org/apache/xmlbeans/impl/schema org/apache/xmlbeans/impl/values +org/apache/xmlrpc +org/apache/xmlrpc/client +org/apache/xmlrpc/client/util +org/apache/xmlrpc/common +org/apache/xmlrpc/jaxb +org/apache/xmlrpc/parser +org/apache/xmlrpc/serializer +org/apache/xmlrpc/util org/apache/zookeeper org/apache/zookeeper/client org/apache/zookeeper/common diff --git a/patch/etc/baseline/module-list.txt b/patch/etc/baseline/module-list.txt index a0692c1c67..844e5a7313 100644 --- a/patch/etc/baseline/module-list.txt +++ b/patch/etc/baseline/module-list.txt @@ -251,6 +251,9 @@ /org/apache/camel/component/vertx/main/vertx-core-3.4.1.jar /org/apache/camel/component/weather/main/camel-weather-2.19.3.jar /org/apache/camel/component/xmlbeans/main/camel-xmlbeans-2.19.3.jar +/org/apache/camel/component/xmlrpc/main/camel-xmlrpc-2.19.3.jar +/org/apache/camel/component/xmlrpc/main/xmlrpc-client-3.1.3.jar +/org/apache/camel/component/xmlrpc/main/xmlrpc-common-3.1.3.jar /org/apache/camel/component/xmlsecurity/main/camel-xmlsecurity-2.19.3.jar /org/apache/camel/component/xstream/main/camel-xstream-2.19.3.jar /org/apache/camel/component/zendesk/main/async-http-client-1.9.31.jar @@ -342,6 +345,7 @@ /org/apache/sshd/main/sshd-core-0.14.0.jar /org/apache/ws/commons/axiom/axiom-api/main/axiom-api-1.2.14.jar /org/apache/ws/commons/axiom/axiom-impl/main/axiom-impl-1.2.14.jar +/org/apache/ws/commons/util/main/ws-commons-util-1.0.2.jar /org/apache/xbean/spring/main/xbean-spring-4.5.jar /org/apache/xmlbeans/main/xmlbeans-2.6.0.jar /org/apache/zookeeper/main/curator-client-2.7.1.jar