Author: ningjiang Date: Mon Sep 6 01:11:16 2010 New Revision: 992919 URL: http://svn.apache.org/viewvc?rev=992919&view=rev Log: Fixed the faild unit tests of camel-cxf with CXF 2.3-SNAPSHOT
Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java?rev=992919&r1=992918&r2=992919&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java (original) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java Mon Sep 6 01:11:16 2010 @@ -41,8 +41,9 @@ public class CxfConsumerProviderTest ext protected static final String REQUEST_MESSAGE = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"test/service\">" + "<soapenv:Header/><soapenv:Body><ser:ping/></soapenv:Body></soapenv:Envelope>"; - protected static final String RESPONSE_MESSAGE = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" - + "<soap:Body><pong xmlns=\"test/service\" /></soap:Body></soap:Envelope>"; + protected static final String RESPONSE_MESSAGE_BEGINE = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + + "<soap:Body><pong xmlns=\"test/service\""; + protected static final String RESPONSE_MESSAGE_END = "/></soap:Body></soap:Envelope>"; protected static final String RESPONSE = "<pong xmlns=\"test/service\"/>"; @@ -72,7 +73,8 @@ public class CxfConsumerProviderTest ext // call the service with right post message String response = template.requestBody(SIMPLE_ENDPOINT_ADDRESS, REQUEST_MESSAGE, String.class); - assertEquals("Get a wrong response ", RESPONSE_MESSAGE, response); + assertTrue("Get a wrong response ", response.startsWith(RESPONSE_MESSAGE_BEGINE)); + assertTrue("Get a wrong response ", response.endsWith(RESPONSE_MESSAGE_END)); try { response = template.requestBody(SIMPLE_ENDPOINT_ADDRESS, null, String.class); fail("Excpetion to get exception here"); @@ -81,7 +83,8 @@ public class CxfConsumerProviderTest ext } response = template.requestBody(SIMPLE_ENDPOINT_ADDRESS, REQUEST_MESSAGE, String.class); - assertEquals("Get a wrong response ", RESPONSE_MESSAGE, response); + assertTrue("Get a wrong response ", response.startsWith(RESPONSE_MESSAGE_BEGINE)); + assertTrue("Get a wrong response ", response.endsWith(RESPONSE_MESSAGE_END)); } Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java?rev=992919&r1=992918&r2=992919&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java (original) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java Mon Sep 6 01:11:16 2010 @@ -46,10 +46,13 @@ public class CxfRawMessageRouterTest ext client.echo("hello world"); assertMockEndpointsSatisfied(); Map context = (Map)result.assertExchangeReceived(0).getIn().getHeaders().get("ResponseContext"); - Map protocalHeaders = (Map) context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS"); - assertTrue("Should get the content type", protocalHeaders.get("content-type").toString().startsWith("[text/xml; charset=")); + Map protocalHeaders = (Map) context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS"); + assertTrue("Should get a right content type", protocalHeaders.get("content-type").toString().startsWith("[text/xml;")); + assertTrue("Should get a right context type with a charset", protocalHeaders.get("content-type").toString().indexOf("charset=") > 0); assertEquals("Should get the response code ", context.get("org.apache.cxf.message.Message.RESPONSE_CODE"), 200); - assertTrue("Should get the content type", result.assertExchangeReceived(0).getIn().getHeaders().get("content-type").toString().startsWith("text/xml; charset=")); + assertTrue("Should get the content type", result.assertExchangeReceived(0).getIn().getHeaders().get("content-type").toString().startsWith("text/xml;")); + assertTrue("Should get the content type", result.assertExchangeReceived(0).getIn().getHeaders().get("content-type").toString().indexOf("charset=") > 0); + } @Test