Author: ffang
Date: Wed Aug 14 03:48:50 2013
New Revision: 1513720
URL: http://svn.apache.org/r1513720
Log:
[CXF-5169]add a DISPATCH side test
Added:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/resources/GreetMeDocLiteralSOAPBodyReqExceedMaxLength.xml
Modified:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
Modified:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=1513720&r1=1513719&r2=1513720&view=diff
==============================================================================
---
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
(original)
+++
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
Wed Aug 14 03:48:50 2013
@@ -62,6 +62,7 @@ import org.apache.cxf.BusFactory;
import org.apache.cxf.binding.soap.saaj.SAAJUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.jaxws.DispatchImpl;
+import org.apache.cxf.message.Message;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -862,6 +863,34 @@ public class DispatchClientServerTest ex
assertTrue("Expected: " + expected,
StaxUtils.toString(streamSourceResp3).contains(expected3));
}
+
+ @Test
+ public void testStreamSourcePAYLOADWithSchemaValidation() throws Exception
{
+
+ URL wsdl =
getClass().getResource("/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl");
+ assertNotNull(wsdl);
+
+ SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
+ assertNotNull(service);
+ Dispatch<StreamSource> disp = service.createDispatch(PORT_NAME,
StreamSource.class,
+
Service.Mode.PAYLOAD);
+ disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:"
+ + greeterPort
+ +
"/SOAPDispatchService/SoapDispatchPort");
+ disp.getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED,
Boolean.TRUE);
+ InputStream is =
getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReqExceedMaxLength.xml");
+ StreamSource streamSourceReq = new StreamSource(is);
+ assertNotNull(streamSourceReq);
+ try {
+ disp.invoke(streamSourceReq);
+ fail("Should have thrown an exception");
+ } catch (Exception ex) {
+ // expected
+ assertTrue(ex.getMessage().contains("cvc-maxLength-valid"));
+ }
+ }
+
@Test
public void testStAXSourcePAYLOAD() throws Exception {
Added:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/resources/GreetMeDocLiteralSOAPBodyReqExceedMaxLength.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/resources/GreetMeDocLiteralSOAPBodyReqExceedMaxLength.xml?rev=1513720&view=auto
==============================================================================
---
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/resources/GreetMeDocLiteralSOAPBodyReqExceedMaxLength.xml
(added)
+++
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/resources/GreetMeDocLiteralSOAPBodyReqExceedMaxLength.xml
Wed Aug 14 03:48:50 2013
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+--><ns4:greetMe
xmlns:ns4="http://apache.org/hello_world_soap_http/types"><ns4:requestType>TestSOAPInputMessage
with exceed the max length restriction so that we should get an schema
validation exception</ns4:requestType></ns4:greetMe>
Modified:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java?rev=1513720&r1=1513719&r2=1513720&view=diff
==============================================================================
---
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
(original)
+++
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
Wed Aug 14 03:48:50 2013
@@ -154,8 +154,7 @@ public class ProviderClientServerTest ex
}
try {
- String ret = greeter.greetMe("exceed maxLength");
- System.out.println("the ret is " + ret);
+ greeter.greetMe("exceed maxLength");
fail("Should have thrown an exception");
} catch (Exception ex) {
//expected