Author: ffang
Date: Fri Jan 14 07:10:42 2011
New Revision: 1058872
URL: http://svn.apache.org/viewvc?rev=1058872&view=rev
Log:
Merged revisions 1058867 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1058867 | ffang | 2011-01-14 15:00:21 +0800 (δΊ”, 14 1 2011) | 1 line
[CXF-3233]adding a testcase clearly demostrate shemavalidation works for
outgoing message
........
Modified:
cxf/branches/2.3.x-fixes/ (props changed)
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java?rev=1058872&r1=1058871&r2=1058872&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
(original)
+++
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/SchemaValidationClientServerTest.java
Fri Jan 14 07:10:42 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/branches/2.3.x-fixes/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
URL:
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd?rev=1058872&r1=1058871&r2=1058872&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
(original)
+++
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/resources/wsdl_systest_jaxws/request.xsd
Fri Jan 14 07:10:42 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>