Author: bvahdat
Date: Fri Jun 8 16:21:03 2012
New Revision: 1348140
URL: http://svn.apache.org/viewvc?rev=1348140&view=rev
Log:
Merged revisions 1348138 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1348138 | bvahdat | 2012-06-08 18:09:21 +0200 (Fr, 08 Jun 2012) | 1 line
CAMEL-5234: SpringWebServiceProducer should make use of IN for the response
if the exchange is not OUT capable. Thanks to Claus Ibsen for reviewing the
provided patch.
........
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerLocalRouteTest-context.xml
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1348138
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.9.x/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java?rev=1348140&r1=1348139&r2=1348140&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
(original)
+++
camel/branches/camel-2.9.x/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
Fri Jun 8 16:21:03 2012
@@ -61,6 +61,8 @@ public class SpringWebserviceProducer ex
if (ExchangeHelper.isOutCapable(exchange)) {
exchange.getOut().copyFrom(exchange.getIn());
exchange.getOut().setBody(body);
+ } else {
+ exchange.getIn().setBody(body);
}
}
Modified:
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java?rev=1348140&r1=1348139&r2=1348140&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
(original)
+++
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
Fri Jun 8 16:21:03 2012
@@ -19,6 +19,8 @@ package org.apache.camel.component.sprin
import javax.xml.transform.Source;
import org.apache.camel.EndpointInject;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.StringSource;
@@ -26,6 +28,7 @@ import org.apache.camel.component.mock.M
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -41,7 +44,10 @@ public class ProducerLocalRouteTest exte
@EndpointInject(uri = "mock:result")
private MockEndpoint resultEndpoint;
- @Test()
+ @EndpointInject(uri = "mock:inOnly")
+ private MockEndpoint inOnlyEndpoint;
+
+ @Test
public void consumeStockQuoteWebserviceWithDefaultTemplate() throws
Exception {
Object result =
template.requestBody("direct:stockQuoteWebserviceWithDefaultTemplate",
xmlRequestForGoogleStockQuote);
@@ -49,7 +55,7 @@ public class ProducerLocalRouteTest exte
assertTrue(result instanceof Source);
}
- @Test()
+ @Test
public void consumeStockQuoteWebserviceAndPreserveHeaders() throws
Exception {
resultEndpoint.expectedHeaderReceived("helloHeader", "hello world!");
@@ -59,7 +65,7 @@ public class ProducerLocalRouteTest exte
resultEndpoint.assertIsSatisfied();
}
- @Test()
+ @Test
public void consumeStockQuoteWebservice() throws Exception {
Object result = template.requestBody("direct:stockQuoteWebservice",
xmlRequestForGoogleStockQuote);
@@ -67,7 +73,7 @@ public class ProducerLocalRouteTest exte
assertTrue(result instanceof Source);
}
- @Test()
+ @Test
public void consumeStockQuoteWebserviceWithCamelStringSourceInput() throws
Exception {
Object result = template.requestBody("direct:stockQuoteWebservice",
new StringSource(xmlRequestForGoogleStockQuote));
@@ -75,7 +81,7 @@ public class ProducerLocalRouteTest exte
assertTrue(result instanceof Source);
}
- @Test()
+ @Test
public void consumeStockQuoteWebserviceWithNonDefaultMessageFactory()
throws Exception {
Object result =
template.requestBody("direct:stockQuoteWebserviceWithNonDefaultMessageFactory",
xmlRequestForGoogleStockQuote);
@@ -83,7 +89,7 @@ public class ProducerLocalRouteTest exte
assertTrue(result instanceof Source);
}
- @Test()
+ @Test
public void consumeStockQuoteWebserviceAndConvertResult() throws Exception
{
Object result =
template.requestBody("direct:stockQuoteWebserviceAsString",
xmlRequestForGoogleStockQuote);
@@ -93,7 +99,7 @@ public class ProducerLocalRouteTest exte
assertTrue(resultMessage.contains("Google Inc."));
}
- @Test()
+ @Test
public void consumeStockQuoteWebserviceAndProvideEndpointUriByHeader()
throws Exception {
Object result =
template.requestBodyAndHeader("direct:stockQuoteWebserviceWithoutDefaultUri",
xmlRequestForGoogleStockQuote,
SpringWebserviceConstants.SPRING_WS_ENDPOINT_URI,
stockQuoteWebserviceUri);
@@ -103,4 +109,25 @@ public class ProducerLocalRouteTest exte
String resultMessage = (String) result;
assertTrue(resultMessage.contains("Google Inc."));
}
+
+ @Test
+ public void consumeStockQuoteWebserviceInOnly() throws Exception {
+ inOnlyEndpoint.expectedExchangePattern(ExchangePattern.InOnly);
+ inOnlyEndpoint.expectedMessageCount(1);
+
+ template.sendBodyAndHeader("direct:stockQuoteWebserviceInOnly",
xmlRequestForGoogleStockQuote, "foo", "bar");
+
+ inOnlyEndpoint.assertIsSatisfied();
+
+ Message in = inOnlyEndpoint.getReceivedExchanges().get(0).getIn();
+
+ Object result = in.getBody();
+ assertNotNull(result);
+ assertTrue(result instanceof String);
+ String resultMessage = (String) result;
+ assertTrue(resultMessage.contains("Google Inc."));
+
+ Object bar = in.getHeader("foo");
+ assertEquals("The header value should have been preserved", "bar",
bar);
+ }
}
Modified:
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerLocalRouteTest-context.xml
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerLocalRouteTest-context.xml?rev=1348140&r1=1348139&r2=1348140&view=diff
==============================================================================
---
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerLocalRouteTest-context.xml
(original)
+++
camel/branches/camel-2.9.x/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerLocalRouteTest-context.xml
Fri Jun 8 16:21:03 2012
@@ -52,6 +52,13 @@
<to
uri="spring-ws:http://dummy?webServiceTemplate=#webServiceTemplate&soapAction=http://www.stockquotes.edu/GetQuote"/>
<convertBodyTo type="java.lang.String"/>
</route>
+ <route>
+ <from uri="direct:stockQuoteWebserviceInOnly"/>
+ <setExchangePattern pattern="InOnly"/>
+ <to
uri="spring-ws:http://localhost?webServiceTemplate=#webServiceTemplate&soapAction=http://www.stockquotes.edu/GetQuote"/>
+ <convertBodyTo type="java.lang.String"/>
+ <to uri="mock:inOnly" />
+ </route>
<!-- consumer route (providing the actual web service) -->
<route>
<from
uri="spring-ws:soapaction:http://www.stockquotes.edu/GetQuote?endpointMapping=#endpointMapping"/>