Author: alessio.soldano(a)jboss.com
Date: 2012-09-04 12:28:07 -0400 (Tue, 04 Sep 2012)
New Revision: 16695
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/schemavalidation/META-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/schemavalidation/META-INF/jaxws-client-config.xml
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java
Log:
[JBWS-3500] Yet another test, but using client configuration
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2012-09-04
15:42:53 UTC (rev 16694)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2012-09-04
16:28:07 UTC (rev 16695)
@@ -91,6 +91,11 @@
<include name="validatingClient.wsdl" />
</zipfileset>
</war>
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-samples-schemavalidation-client.jar">
+ <metainf
dir="${tests.output.dir}/test-resources/jaxws/samples/schemavalidation/META-INF">
+ <include name="jaxws-client-config.xml" />
+ </metainf>
+ </jar>
<!-- jaxws-samples-wsa -->
<war
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java 2012-09-04
15:42:53 UTC (rev 16694)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java 2012-09-04
16:28:07 UTC (rev 16695)
@@ -30,6 +30,7 @@
import junit.framework.Test;
import org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse;
+import org.jboss.ws.api.configuration.ClientConfigUtil;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
@@ -46,7 +47,7 @@
public static Test suite()
{
- return new JBossWSCXFTestSetup(SchemaValidationTestCase.class,
"jaxws-samples-schemavalidation.war");
+ return new JBossWSCXFTestSetup(SchemaValidationTestCase.class,
"jaxws-samples-schemavalidation.war,jaxws-samples-schemavalidation-client.jar");
}
public void testSchemaValidationEndpoint() throws Exception
@@ -100,4 +101,23 @@
assertTrue("not respect to enumration error is expected",
e.getMessage().contains("is not facet-valid with respect to enumeration"));
}
}
+
+ public void testClientSideSchemaValidationUsingConfiguration() throws Exception
+ {
+ QName serviceName = new
QName("http://jboss.org/schemavalidation",
"HelloService");
+ URL wsdlURL =
getResourceURL("jaxws/samples/schemavalidation/validatingClient.wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ Hello proxy = (Hello)service.getPort(new
QName("http://jboss.org/schemavalidation", "HelloPort"),
Hello.class);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+ ClientConfigUtil.setConfigProperties(proxy,
"META-INF/jaxws-client-config.xml", "Test Validating Client Config");
//enable client side schema validation
+ HelloResponse hr = proxy.helloRequest("JBoss");
+ assertNotNull(hr);
+ assertEquals(2, hr.getReturn());
+ try {
+ proxy.helloRequest("number");
+ fail("validation error is expected");
+ } catch (Exception e) {
+ assertTrue("not respect to enumration error is expected",
e.getMessage().contains("is not facet-valid with respect to enumeration"));
+ }
+ }
}
\ No newline at end of file
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/schemavalidation/META-INF/jaxws-client-config.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/schemavalidation/META-INF/jaxws-client-config.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/schemavalidation/META-INF/jaxws-client-config.xml 2012-09-04
16:28:07 UTC (rev 16695)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0
schema/jbossws-jaxws-config_4_0.xsd">
+
+ <client-config>
+ <config-name>Test Validating Client Config</config-name>
+ <property>
+ <property-name>schema-validation-enabled</property-name>
+ <property-value>true</property-value>
+ </property>
+ </client-config>
+
+</jaxws-config>
\ No newline at end of file