You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2011/01/14 08:00:21 UTC
svn commit: r1058867 - in /cxf/trunk/systests/jaxws/src/test:
java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
resources/wsdl_systest_jaxws/request.xsd
Author: ffang
Date: Fri Jan 14 07:00:21 2011
New Revision: 1058867
URL: http://svn.apache.org/viewvc?rev=1058867&view=rev
Log:
[CXF-3233]adding a testcase clearly demostrate shemavalidation works for outgoing message
Modified:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java?rev=1058867&r1=1058866&r2=1058867&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java Fri Jan 14 07:00:21 2011
@@ -57,6 +57,9 @@ public class SchemaValidationClientServe
Map<String, Object> map = new HashMap<String, Object>();
map.put("schema-validation-enabled", Boolean.TRUE);
ep.setProperties(map);
+ ((EndpointImpl)ep).setWsdlLocation("wsdl_systest_jaxws/schemaValidation.wsdl");
+ ((EndpointImpl)ep).setServiceName(new QName(
+ "http://cxf.apache.org/jaxws/schemavalidation", "service"));
((EndpointImpl)ep).getInInterceptors().add(new LoggingInInterceptor());
((EndpointImpl)ep).getOutInterceptors().add(new LoggingOutInterceptor());
ep.publish(address);
@@ -92,12 +95,22 @@ public class SchemaValidationClientServe
updateAddressPort(greeter, PORT);
RequestIdType requestId = new RequestIdType();
- requestId.setId("ffang");
+ requestId.setId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
CkRequestType request = new CkRequestType();
request.setRequest(requestId);
((BindingProvider)greeter).getRequestContext().put("schema-validation-enabled", Boolean.TRUE);
CkResponseType response = greeter.ckR(request);
assertEquals(response.getProduct().get(0).getAction().getStatus(), 4);
+
+ try {
+ requestId.setId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeez");
+ request.setRequest(requestId);
+ greeter.ckR(request);
+ fail("should catch marshall exception as the invalid outgoing message per schema");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().contains("Marshalling Error"));
+ assertTrue(e.getMessage().contains("is not facet-valid with respect to pattern"));
+ }
}
Modified: cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd?rev=1058867&r1=1058866&r2=1058867&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd (original)
+++ cxf/trunk/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd Fri Jan 14 07:00:21 2011
@@ -22,10 +22,15 @@
</xsd:attribute>
</xsd:complexType>
<xsd:simpleType name="GUIDType">
- <xsd:restriction base="xsd:string">
+ <!--xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
- </xsd:restriction>
- </xsd:simpleType>
+ </xsd:restriction-->
+ <xsd:restriction base="xsd:token">
+ <xsd:length value="36" />
+ <xsd:pattern
+ value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" />
+ </xsd:restriction>
+ </xsd:simpleType>
<xsd:complexType name="ckRequestType">
<xsd:sequence>