You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/02/23 20:39:14 UTC
[cxf] 02/03: Added test case to excercise
ReflectionServiceFactoryBean validation capabilities
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit a4a5098f5c8683604e84f594d95f2a041f01da6b
Author: reta <dr...@gmail.com>
AuthorDate: Tue Feb 23 15:37:24 2021 -0500
Added test case to excercise ReflectionServiceFactoryBean validation capabilities
(cherry picked from commit 1afeaf7dc2b62c7a53cfc6b6253514ef80d312eb)
---
.../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();