forked from wildfly-extras/wildfly-camel
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[resolves wildfly-extras#2036] Add support for component xmlrpc
[resolves wildfly-extras#2049] Add support for dataformat xmlrpc
- Loading branch information
Showing
17 changed files
with
212 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...in/resources/modules/system/layers/fuse/org/apache/camel/component/xmlrpc/main/module.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module xmlns="urn:jboss:module:1.1" name="org.apache.camel.component.xmlrpc"> | ||
<resources> | ||
<artifact name="${org.apache.camel:camel-xmlrpc}" /> | ||
<artifact name="${org.apache.xmlrpc:xmlrpc-client}" /> | ||
<artifact name="${org.apache.xmlrpc:xmlrpc-common}" /> | ||
</resources> | ||
<dependencies> | ||
<module name="javax.api" /> | ||
<module name="org.apache.ws.commons.util" /> | ||
<module name="org.slf4j" /> | ||
<module name="javax.xml.bind.api" /> | ||
<module name="org.apache.camel.core" /> | ||
<module name="org.apache.commons.httpclient" /> | ||
</dependencies> | ||
</module> |
13 changes: 13 additions & 0 deletions
13
.../src/main/resources/modules/system/layers/fuse/org/apache/ws/commons/util/main/module.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module xmlns="urn:jboss:module:1.1" name="org.apache.ws.commons.util"> | ||
<properties> | ||
<property name="jboss.api" value="private" /> | ||
</properties> | ||
<resources> | ||
<artifact name="${org.apache.ws.commons.util:ws-commons-util}" /> | ||
</resources> | ||
<dependencies> | ||
<module name="javax.api" /> | ||
<module name="org.apache.xerces" /> | ||
</dependencies> | ||
</module> |
117 changes: 117 additions & 0 deletions
117
...s/standalone/basic/src/test/java/org/wildfly/camel/test/xmlrpc/XmlRpcIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters