You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cs...@apache.org on 2012/04/23 19:10:16 UTC

svn commit: r1329336 - /camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java

Author: cschneider
Date: Mon Apr 23 17:10:16 2012
New Revision: 1329336

URL: http://svn.apache.org/viewvc?rev=1329336&view=rev
Log:
Fixing test failure and making a little more obvious what the test does

Modified:
    camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java?rev=1329336&r1=1329335&r2=1329336&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java (original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java Mon Apr 23 17:10:16 2012
@@ -32,24 +32,27 @@ public class CxfOperationExceptionTest e
     protected AbstractXmlApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml");
     }
-    
+
+    @Override
+    public boolean isCreateCamelContextPerClass() {
+        return true;
+    }
+
     protected void doPostSetup() throws Exception {
         //clean up the default bus for template to use
         BusFactory.setDefaultBus(null);
     }
 
+    /**
+     * Calling an invalid URL on a running server. So we expect a 404 response in the CamelExecutionException
+     */
     @Test(expected = CamelExecutionException.class)
     public void testRestServerDirectlyAddCustomer() {
         Customer input = new Customer();
         input.setName("Donald Duck");
 
-        // we cannot convert directly to Customer as we need camel-jaxb
-        String response = template.requestBodyAndHeader("cxfrs:http://localhost:9002/customerservice/customers?throwExceptionOnFailure=true", input,
+        template.requestBodyAndHeader("cxfrs:http://localhost:9002/wrongurl?throwExceptionOnFailure=true", input,
             Exchange.HTTP_METHOD, "POST", String.class);
-
-        assertNotNull(response);
-        assertTrue(response.endsWith("<name>Donald Duck</name></Customer>"));
-        
     }
 
     @Test
@@ -57,11 +60,10 @@ public class CxfOperationExceptionTest e
         Customer input = new Customer();
         input.setName("Donald Duck");
 
-        // we cannot convert directly to Customer as we need camel-jaxb
-        String response = template.requestBodyAndHeader("cxfrs:http://localhost:9002/customerservice/customers?throwExceptionOnFailure=false", input,
+        String response = template.requestBodyAndHeader("cxfrs:http://localhost:9002/wrongurl?throwExceptionOnFailure=false", input,
             Exchange.HTTP_METHOD, "POST", String.class);
 
         assertNotNull(response);
-        assertTrue(response.contains("Problem accessing /customerservice/customers"));
+        assertTrue(response.contains("Problem accessing /wrongurl"));
     }
 }