Author: alessio.soldano(a)jboss.com
Date: 2013-05-08 11:53:16 -0400 (Wed, 08 May 2013)
New Revision: 17539
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorld.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorldImpl.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/ServletTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/WEB-INF/jboss-deployment-structure.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/cxf.xml
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBWS-3607] Adding testcase
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2013-05-08
15:51:40 UTC (rev 17538)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2013-05-08
15:53:16 UTC (rev 17539)
@@ -102,6 +102,27 @@
</manifest>
</war>
+ <!-- jaxws-cxf-in_container_client -->
+ <war
warfile="${tests.output.dir}/test-libs/jaxws-cxf-in_container_client.war"
needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorld*.class"/>
+ </classes>
+ </war>
+ <war
warfile="${tests.output.dir}/test-libs/jaxws-cxf-in_container_client-client.war"
needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorld.class"/>
+ <include
name="org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.class"/>
+ <include name="org/jboss/wsf/test/TestServlet.class"/>
+ <include name="org/jboss/wsf/test/ClientHelper.class"/>
+ </classes>
+ <classes
dir="${tests.output.dir}/test-resources/jaxws/cxf/in_container_client/">
+ <include name="cxf.xml"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/cxf/in_container_client/WEB-INF">
+ <include name="jboss-deployment-structure.xml"/>
+ </webinf>
+ </war>
+
<!-- jaxws-cxf-mixtype-->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-mixtype.war"
webxml="${tests.output.dir}/test-resources/jaxws/cxf/mixtype/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorld.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorld.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorld.java 2013-05-08
15:53:16 UTC (rev 17539)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.in_container_client;
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace =
"http://org.jboss.ws/jaxws/cxf/in_container_client")
+public interface HelloWorld
+{
+ String echo(String input);
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorldImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorldImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/HelloWorldImpl.java 2013-05-08
15:53:16 UTC (rev 17539)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.in_container_client;
+
+import javax.jws.WebService;
+
+@WebService
+(
+ serviceName = "HelloWorldService",
+ endpointInterface =
"org.jboss.test.ws.jaxws.cxf.in_container_client.HelloWorld",
+ targetNamespace = "http://org.jboss.ws/jaxws/cxf/in_container_client"
+)
+public class HelloWorldImpl implements HelloWorld
+{
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/Helper.java 2013-05-08
15:53:16 UTC (rev 17539)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.in_container_client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
+import org.jboss.wsf.test.ClientHelper;
+
+public class Helper implements ClientHelper
+{
+ private String targetEndpointURL;
+ private Logger log = Logger.getLogger(Helper.class);
+
+ public Helper()
+ {
+
+ }
+
+ public Helper(String endpointURL)
+ {
+ setTargetEndpoint(endpointURL);
+ }
+
+ public boolean test() throws Exception
+ {
+ BusFactory factory = BusFactory.newInstance();
+ if (!(factory instanceof JBossWSBusFactory)) { //check jbossws-cxf integration is
on
+ log.error("Expected instance of " + JBossWSBusFactory.class + "
but got: " + factory.getClass());
+ return false;
+ }
+ Bus bus = ((JBossWSBusFactory)factory).createBus("cxf.xml"); //force
Spring bus construction
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ HelloWorld port = getPort();
+ return ("foo".equals(port.echo("foo")));
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+
+ }
+
+ private HelloWorld getPort() throws MalformedURLException
+ {
+ URL wsdlURL = new URL(targetEndpointURL + "?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/jaxws/cxf/in_container_client",
"HelloWorldService");
+ Service service = Service.create(wsdlURL, serviceName);
+ QName portQName = new
QName("http://org.jboss.ws/jaxws/cxf/in_container_client",
"HelloWorldImplPort");
+ return (HelloWorld) service.getPort(portQName, HelloWorld.class);
+ }
+
+ @Override
+ public void setTargetEndpoint(String address)
+ {
+ this.targetEndpointURL = address;
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/ServletTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/ServletTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/in_container_client/ServletTestCase.java 2013-05-08
15:53:16 UTC (rev 17539)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.in_container_client;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * A testcase for verifying a cxf.xml Spring descriptor based Bus can
+ * successfully be created and used in a in-container client.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 08-May-2013
+ *
+ */
+public class ServletTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(ServletTestCase.class,
"jaxws-cxf-in_container_client.war, jaxws-cxf-in_container_client-client.war");
+ }
+
+ public void test() throws Exception
+ {
+ assertEquals("1", runTestInContainer("test"));
+ }
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL("http://" + getServerHost()
+ +
":8080/jaxws-cxf-in_container_client-client?path=/jaxws-cxf-in_container_client/HelloWorldService&method="
+ test
+ + "&helper=" + Helper.class.getName());
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ return br.readLine();
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/WEB-INF/jboss-deployment-structure.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/WEB-INF/jboss-deployment-structure.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/WEB-INF/jboss-deployment-structure.xml 2013-05-08
15:53:16 UTC (rev 17539)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
+ <deployment>
+ <dependencies>
+ <module name="org.jboss.ws.cxf.jbossws-cxf-client"
services="import" />
+ <module name="org.apache.cxf.impl">
+ <imports>
+ <include path="META-INF"/>
+ <include path="META-INF/cxf"/>
+ </imports>
+ </module>
+ <module name="org.springframework.spring">
+ <imports>
+ <include path="META-INF"/>
+ </imports>
+ </module>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
\ No newline at end of file
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/cxf.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/cxf.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/in_container_client/cxf.xml 2013-05-08
15:53:16 UTC (rev 17539)
@@ -0,0 +1,10 @@
+<beans
xmlns="http://www.springframework.org/schema/beans"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="cxf.default.workqueue"
class="org.apache.cxf.workqueue.AutomaticWorkQueueImpl">
+ <property name="name" value="cxf.default.workqueue"/>
+ <property name="queueSize" value="10"/>
+ </bean>
+
+</beans>
\ No newline at end of file