[cxf] branch master updated: Added test case to excercise ReflectionServiceFactoryBean validation capabilities

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch master updated: Added test case to excercise ReflectionServiceFactoryBean validation capabilities

reta
This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 1afeaf7  Added test case to excercise ReflectionServiceFactoryBean validation capabilities
1afeaf7 is described below

commit 1afeaf7dc2b62c7a53cfc6b6253514ef80d312eb
Author: reta <[hidden email]>
AuthorDate: Tue Feb 23 15:37:24 2021 -0500

    Added test case to excercise ReflectionServiceFactoryBean validation capabilities
---
 .../java/org/apache/cxf/jaxws/GreeterTest.java     | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/GreeterTest.java b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/GreeterTest.java
index eb44100..5190cd2 100644
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/GreeterTest.java
+++ b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/GreeterTest.java
@@ -37,8 +37,46 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 public class GreeterTest extends AbstractJaxWsTest {
+    @Test
+    public void testEndpointValidate() throws Exception {
+        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
+        URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
+        assertNotNull(resource);
+        bean.setWsdlURL(resource.toString());
+        bean.setBus(bus);
+        bean.setServiceClass(GreeterImpl.class);
+        bean.setValidate(true);
+        
+        GreeterImpl greeter = new GreeterImpl();
+        BeanInvoker invoker = new BeanInvoker(greeter);
 
 
+        Service service = bean.create();
+
+        assertEquals("SOAPService", service.getName().getLocalPart());
+        assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI());
+
+        ServerFactoryBean svr = new ServerFactoryBean();
+        svr.setBus(bus);
+        svr.setServiceFactory(bean);
+        svr.setInvoker(invoker);
+
+        svr.create();
+
+        Node response = invoke("http://localhost:9000/SoapContext/SoapPort",
+                           LocalTransportFactory.TRANSPORT_ID,
+                           "GreeterMessage.xml");
+
+        assertEquals(1, greeter.getInvocationCount());
+
+        assertNotNull(response);
+
+        addNamespace("h", "http://apache.org/hello_world_soap_http/types");
+
+        assertValid("/s:Envelope/s:Body", response);
+        assertValid("//h:sayHiResponse", response);
+    }
+
     @Test
     public void testEndpoint() throws Exception {
         ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();