You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/05/06 04:02:34 UTC
svn commit: r653667 - in
/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf:
CxfConsumerTest.java HelloService.java HelloServiceImpl.java
Author: ningjiang
Date: Mon May 5 19:02:32 2008
New Revision: 653667
URL: http://svn.apache.org/viewvc?rev=653667&view=rev
Log:
Added test to show how to return the Boolean response from camel-cxf endpoint
Modified:
activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloService.java
activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java?rev=653667&r1=653666&r2=653667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java Mon May 5 19:02:32 2008
@@ -38,6 +38,7 @@
private static final String SIMPLE_ENDPOINT_URI = "cxf://" + SIMPLE_ENDPOINT_ADDRESS
+ "?serviceClass=org.apache.camel.component.cxf.HelloService";
private static final String ECHO_OPERATION = "echo";
+ private static final String ECHO_BOOLEAN_OPERATION = "echoBoolean";
private static final String TEST_MESSAGE = "Hello World!";
// START SNIPPET: example
@@ -51,7 +52,13 @@
List parameter = in.getBody(List.class);
// Get the operation name
String operation = (String)in.getHeader(CxfConstants.OPERATION_NAME);
- String result = operation + " " + (String)parameter.get(0);
+ Object result = null;
+ if (operation.equals(ECHO_OPERATION)) {
+ result = operation + " " + (String)parameter.get(0);
+ }
+ if (operation.equals(ECHO_BOOLEAN_OPERATION)) {
+ result = (Boolean)parameter.get(0);
+ }
// Put the result back
exchange.getOut().setBody(result);
}
@@ -71,7 +78,11 @@
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo("hello world");
- assertEquals("we should get the right answer from router", result, "echo hello world");
+ assertEquals("We should get the echo string result from router", result, "echo hello world");
+
+ Boolean bool = client.echoBoolean(Boolean.TRUE);
+ assertNotNull("The result should not be null", bool);
+ assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
}
Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloService.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloService.java?rev=653667&r1=653666&r2=653667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloService.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloService.java Mon May 5 19:02:32 2008
@@ -20,8 +20,10 @@
String sayHello();
void ping();
-
+
int getInvocationCount();
String echo(String text);
+
+ Boolean echoBoolean(Boolean bool);
}
\ No newline at end of file
Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java?rev=653667&r1=653666&r2=653667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java Mon May 5 19:02:32 2008
@@ -42,6 +42,10 @@
return "hello";
}
+ public Boolean echoBoolean(Boolean bool) {
+ return bool;
+ }
+
}