Author: asoldano
Date: 2014-11-26 06:35:37 -0500 (Wed, 26 Nov 2014)
New Revision: 19113
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java
Log:
More tests converted...
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -23,61 +23,61 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
*/
+(a)RunWith(Arquillian.class)
public class AsyncClientTestCase extends JBossWSTest
{
- private final String endpointAddress = "http://" + getServerHost() +
":8080/jaxws-cxf-asyncclient";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-asyncclient.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.asyncclient.EndpointImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/asyncclient/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-asyncclient.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.asyncclient.EndpointImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/asyncclient/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(AsyncClientTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testAsycClienWithHCAddress() throws Exception
{
Endpoint proxy = initPort();
BindingProvider provider = (BindingProvider)proxy;
Map<String, Object> requestContext = provider.getRequestContext();
- requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" +
endpointAddress);
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" +
baseURL);
assertEquals("Echo:1000", proxy.echo(1000));
}
+ @Test
+ @RunAsClient
public void testAsycClienWithMsgProp() throws Exception
{
Endpoint proxy = initPort();
@@ -87,6 +87,8 @@
assertEquals("Echo:1000", proxy.echo(1000));
}
+ @Test
+ @RunAsClient
public void testAsycClienAsyncOperation() throws Exception
{
Endpoint proxy = initPort();
@@ -96,6 +98,8 @@
assertEquals("Echo:1000", proxy.echoAsync(1000).get());
}
+ @Test
+ @RunAsClient
public void testAysncClientWithPolicy () throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -119,11 +123,9 @@
private Endpoint initPort() throws Exception {
QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient",
"EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint proxy = service.getPort(Endpoint.class);
return proxy;
}
-
-
}
\ No newline at end of file
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.bus;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceFeature;
-
-import junit.framework.Test;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.stack.cxf.client.UseNewBusFeature;
-import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A testcase for verifying proper behaviour of the UseNewBusFeature on
- * JAXWS Service creation.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 28-Aug-2013
- *
- */
-public class BusReuseTestCase extends JBossWSTest
-{
- public final String WSDL_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-cxf-bus-wsdl";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(BusReuseTestCase.class, DeploymentArchives.SERVER +
", " + DeploymentArchives.SERVER_2);
- }
-
- public void testReuse() throws Exception
- {
- //odd wsdl GETs return WSDL doc with invalid soap:address
- //even wsdl GETs return WSDL doc with valid soap:address
- final String wsdl1 = readWsdl(WSDL_ADDRESS); //invalid
- final String wsdl2 = readWsdl(WSDL_ADDRESS); //valid
- final String wsdl3 = readWsdl(WSDL_ADDRESS); //invalid
- final String wsdl4 = readWsdl(WSDL_ADDRESS); //valid
- assertEquals(wsdl1, wsdl3);
- assertEquals(wsdl2, wsdl4);
- assertFalse(wsdl1.equals(wsdl2));
-
- Bus bus = BusFactory.newInstance().createBus();
- try {
- BusFactory.setThreadDefaultBus(bus);
- Endpoint port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature());
//invalid
- try {
- performInvocation(port);
- fail("Failure expected, as the wsdl soap:address is not valid!");
- } catch (WebServiceException wse) {
-
assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
- }
-
- port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //valid
- try {
- performInvocation(port);
- fail("Failure expected, as the WSDLManager for the bus will return the
invalid wsdl");
- } catch (WebServiceException wse) {
-
assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
- }
-
- port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //invalid
-
- port = getPort(WSDL_ADDRESS, bus, new UseNewBusFeature()); //valid
- //the port should now actually be built against the valid wsdl
- //as a new bus should have been started (with a new WSDLManager)
- //so the invocation is expected to succeed
- performInvocation(port);
-
- port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //invalid
-
- port = getPort(WSDL_ADDRESS, bus, new UseNewBusFeature(false)); //valid
- try {
- performInvocation(port);
- fail("Failure expected, as the WSDLManager for the bus will return the
invalid wsdl (disabled feature used)");
- } catch (WebServiceException wse) {
-
assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
- }
- } finally {
- bus.shutdown(true);
- }
- }
-
- private String readWsdl(String addr) throws Exception {
- return IOUtils.readAndCloseStream(new URL(addr).openStream());
- }
-
- protected static void performInvocation(Endpoint endpoint)
- {
- String result = endpoint.echo("Alessio");
- assert ("Alessio".equals(result));
- }
-
- protected static Endpoint getPort(String wsdlAddr, Bus currentThreadBus,
WebServiceFeature... features) throws MalformedURLException
- {
- QName serviceName = new QName("http://org.jboss.ws/bus",
"EndpointService");
- Service service = Service.create(new URL(wsdlAddr), serviceName, features);
- //check the current thread bus has not changed (even if we used the
UseNewBusFeature)
- assertEquals(currentThreadBus, BusFactory.getThreadDefaultBus(false));
- QName portQName = new QName("http://org.jboss.ws/bus",
"EndpointPort");
- return (Endpoint) service.getPort(portQName, Endpoint.class);
- }
-}
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
(rev 0)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -0,0 +1,304 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.bus;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.jboss.arquillian.container.test.api.Deployer;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.ws.common.IOUtils;
+import org.jboss.wsf.stack.cxf.client.UseNewBusFeature;
+import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * A testcase for verifying proper behaviour of the UseNewBusFeature on
+ * JAXWS Service creation.
+ *
+ * A test case that verifies a client running inside and endpoint business method
+ * does not use the deployment bus.
+ *
+ * A test case that verifies Bus references do not leak into EJB3 clients
+ *
+ * A test case that verifies Bus references do not leak into servlet clients
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 28-Aug-2013
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class BusTestCase extends JBossWSTest
+{
+ private static final String SERVER = "jaxws-cxf-bus";
+ private static final String WSDL_SERVER = "jaxws-cxf-bus-wsdl";
+ private static final String SERVLET_CLIENT_DEP =
"jaxws-cxf-bus-servlet-client";
+ private static final String EJB3_CLIENT_DEP = "jaxws-cxf-bus-ejb3-client";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @ArquillianResource
+ Deployer deployer;
+
+ @Deployment(name = SERVER, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVER +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n" +
"Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.ClientEndpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.ClientEndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EndpointImpl.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/META-INF/permissions.xml"), "permissions.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/WEB-INF/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = WSDL_SERVER, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, WSDL_SERVER +
".war");
+ archive.addManifest()
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/InvalidAddressEndpoint.wsdl"),
"InvalidAddressEndpoint.wsdl")
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/ValidAddressEndpoint.wsdl"),
"ValidAddressEndpoint.wsdl")
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.WSDLServlet.class);
+ return archive;
+ }
+
+ @Deployment(name = SERVLET_CLIENT_DEP, testable = false, managed = false)
+ public static WebArchive createDeployment3() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVLET_CLIENT_DEP +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services
export,com.sun.xml.messaging.saaj services\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.AbstractClient.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.BusTestException.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EndpointService.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.ServletClient.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/WEB-INF-client/wsdl/Endpoint.wsdl"),
"wsdl/Endpoint.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/WEB-INF-client/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = EJB3_CLIENT_DEP, testable = false, managed = false)
+ public static JavaArchive createDeployment4() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class, EJB3_CLIENT_DEP +
".jar");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.AbstractClient.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.BusTestException.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EJB3Client.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EJB3ClientRemoteInterface.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EndpointService.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/META-INF/permissions.xml"), "permissions.xml")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/bus/META-INF/wsdl/Endpoint.wsdl"), "wsdl/Endpoint.wsdl");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(WSDL_SERVER)
+ public void testReuse() throws Exception
+ {
+ //odd wsdl GETs return WSDL doc with invalid soap:address
+ //even wsdl GETs return WSDL doc with valid soap:address
+ final String wsdl1 = readWsdl(baseURL); //invalid
+ final String wsdl2 = readWsdl(baseURL); //valid
+ final String wsdl3 = readWsdl(baseURL); //invalid
+ final String wsdl4 = readWsdl(baseURL); //valid
+ assertEquals(wsdl1, wsdl3);
+ assertEquals(wsdl2, wsdl4);
+ assertFalse(wsdl1.equals(wsdl2));
+
+ Bus bus = BusFactory.newInstance().createBus();
+ try {
+ BusFactory.setThreadDefaultBus(bus);
+ Endpoint port = getPort(baseURL, bus, new UseThreadBusFeature()); //invalid
+ try {
+ performInvocation(port);
+ fail("Failure expected, as the wsdl soap:address is not valid!");
+ } catch (WebServiceException wse) {
+
assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
+ }
+
+ port = getPort(baseURL, bus, new UseThreadBusFeature()); //valid
+ try {
+ performInvocation(port);
+ fail("Failure expected, as the WSDLManager for the bus will return the
invalid wsdl");
+ } catch (WebServiceException wse) {
+
assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
+ }
+
+ port = getPort(baseURL, bus, new UseThreadBusFeature()); //invalid
+
+ port = getPort(baseURL, bus, new UseNewBusFeature()); //valid
+ //the port should now actually be built against the valid wsdl
+ //as a new bus should have been started (with a new WSDLManager)
+ //so the invocation is expected to succeed
+ performInvocation(port);
+
+ port = getPort(baseURL, bus, new UseThreadBusFeature()); //invalid
+
+ port = getPort(baseURL, bus, new UseNewBusFeature(false)); //valid
+ try {
+ performInvocation(port);
+ fail("Failure expected, as the WSDLManager for the bus will return the
invalid wsdl (disabled feature used)");
+ } catch (WebServiceException wse) {
+
assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
+ }
+ } finally {
+ bus.shutdown(true);
+ }
+ }
+
+ private String readWsdl(URL addr) throws Exception {
+ return IOUtils.readAndCloseStream(addr.openStream());
+ }
+
+ protected static void performInvocation(Endpoint endpoint)
+ {
+ String result = endpoint.echo("Alessio");
+ assert ("Alessio".equals(result));
+ }
+
+ protected static Endpoint getPort(URL wsdlAddr, Bus currentThreadBus,
WebServiceFeature... features) throws MalformedURLException
+ {
+ QName serviceName = new QName("http://org.jboss.ws/bus",
"EndpointService");
+ Service service = Service.create(wsdlAddr, serviceName, features);
+ //check the current thread bus has not changed (even if we used the
UseNewBusFeature)
+ assertEquals(currentThreadBus, BusFactory.getThreadDefaultBus(false));
+ QName portQName = new QName("http://org.jboss.ws/bus",
"EndpointPort");
+ return (Endpoint) service.getPort(portQName, Endpoint.class);
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testBusLeakageInServletClient() throws Exception
+ {
+ deployer.deploy(SERVLET_CLIENT_DEP);
+ try
+ {
+ final String host = baseURL.getHost();
+ final String clientAddress = baseURL.getProtocol() + "://" + host +
":" + baseURL.getPort() + "/jaxws-cxf-bus-servlet-client";
+ URL url = new URL(clientAddress + "?method=testBusCreation");
+ assertEquals("OK testBusCreation",
IOUtils.readAndCloseStream(url.openStream()));
+
+ url = new URL(clientAddress + "?method=testSOAPConnection&host=" +
host);
+ assertEquals("OK testSOAPConnection",
IOUtils.readAndCloseStream(url.openStream()));
+
+ url = new URL(clientAddress + "?method=testWebServiceRef");
+ assertEquals("OK testWebServiceRef",
IOUtils.readAndCloseStream(url.openStream()));
+
+ url = new URL(clientAddress + "?method=testWebServiceClient&host="
+ host);
+ assertEquals("OK testWebServiceClient",
IOUtils.readAndCloseStream(url.openStream()));
+ }
+ finally
+ {
+ deployer.undeploy(SERVLET_CLIENT_DEP);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testBusLeakageInEJB3Client() throws Exception
+ {
+ deployer.deploy(EJB3_CLIENT_DEP);
+ InitialContext iniCtx = null;
+ try
+ {
+ String host = getServerHost();
+ iniCtx = getServerInitialContext();
+ Object obj =
iniCtx.lookup("ejb:/jaxws-cxf-bus-ejb3-client//EJB3Client!" +
EJB3ClientRemoteInterface.class.getName());
+ EJB3ClientRemoteInterface ejb3Remote = (EJB3ClientRemoteInterface)obj;
+ ejb3Remote.testBusCreation();
+ ejb3Remote.testSOAPConnection(host);
+ ejb3Remote.testWebServiceClient(host);
+ ejb3Remote.testWebServiceRef();
+ }
+ finally
+ {
+ if (iniCtx != null)
+ {
+ iniCtx.close();
+ }
+ deployer.undeploy(EJB3_CLIENT_DEP);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testClient() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testClient("Foo", getServerHost()));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testCachedPort() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testCachedPort("Foo",
getServerHost()));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testCachedService() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testCachedService("Foo",
getServerHost()));
+ }
+
+ private ClientEndpoint getPort() throws Exception {
+ URL wsdlURL = new URL(baseURL +
"ClientEndpointService/ClientEndpoint?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/bus",
"ClientEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ QName portQName = new QName("http://org.jboss.ws/bus",
"ClientEndpointPort");
+ return (ClientEndpoint) service.getPort(portQName, ClientEndpoint.class);
+ }
+
+}
Property changes on:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.bus;
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A test case that verifies a client running inside and endpoint business method
- * does not use the deployment bus.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 13-Jun-2012
- *
- */
-public class ClientEndpointBusTestCase extends JBossWSTest
-{
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-cxf-bus/ClientEndpointService/ClientEndpoint";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(ClientEndpointBusTestCase.class,
DeploymentArchives.SERVER);
- }
-
- public void testClient() throws Exception
- {
- ClientEndpoint port = getPort();
- assertEquals("Foo", port.testClient("Foo", getServerHost()));
- }
-
- public void testCachedPort() throws Exception
- {
- ClientEndpoint port = getPort();
- assertEquals("Foo", port.testCachedPort("Foo",
getServerHost()));
- }
-
- public void testCachedService() throws Exception
- {
- ClientEndpoint port = getPort();
- assertEquals("Foo", port.testCachedService("Foo",
getServerHost()));
- }
-
- private ClientEndpoint getPort() throws Exception {
- URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- QName serviceName = new QName("http://org.jboss.ws/bus",
"ClientEndpointService");
- Service service = Service.create(wsdlURL, serviceName);
- QName portQName = new QName("http://org.jboss.ws/bus",
"ClientEndpointPort");
- return (ClientEndpoint) service.getPort(portQName, ClientEndpoint.class);
- }
-}
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.bus;
-
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A test case that verifies Bus references do not leak into EJB3 clients
- *
- * @author alessio.soldano(a)jboss.com
- * @since 05-Oct-2010
- *
- */
-public class EJB3ClientBusTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(EJB3ClientBusTestCase.class,
DeploymentArchives.SERVER);
- }
-
- public void testSingleDeploy() throws Exception
- {
- deploy(DeploymentArchives.EJB3_CLIENT);
- InitialContext iniCtx = null;
- try
- {
- String host = getServerHost();
- iniCtx = getServerInitialContext();
- Object obj =
iniCtx.lookup("ejb:/jaxws-cxf-bus-ejb3-client//EJB3Client!" +
EJB3ClientRemoteInterface.class.getName());
- EJB3ClientRemoteInterface ejb3Remote = (EJB3ClientRemoteInterface)obj;
- ejb3Remote.testBusCreation();
- ejb3Remote.testSOAPConnection(host);
- ejb3Remote.testWebServiceClient(host);
- ejb3Remote.testWebServiceRef();
- }
- finally
- {
- if (iniCtx != null)
- {
- iniCtx.close();
- }
- undeploy(DeploymentArchives.EJB3_CLIENT);
- }
- }
-}
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, 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.bus;
-
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A test case that verifies Bus references do not leak into servlet clients
- *
- * @author alessio.soldano(a)jboss.com
- * @since 01-Mar-2011
- *
- */
-public class ServletClientBusTestCase extends JBossWSTest
-{
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-cxf-bus-servlet-client";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(ServletClientBusTestCase.class,
DeploymentArchives.SERVER);
- }
-
- public void testSingleDeploy() throws Exception
- {
- deploy(DeploymentArchives.SERVLET_CLIENT);
- try
- {
- URL url = new URL(TARGET_ENDPOINT_ADDRESS +
"?method=testBusCreation");
- assertEquals("OK testBusCreation",
IOUtils.readAndCloseStream(url.openStream()));
-
- url = new URL(TARGET_ENDPOINT_ADDRESS +
"?method=testSOAPConnection&host=" + getServerHost());
- assertEquals("OK testSOAPConnection",
IOUtils.readAndCloseStream(url.openStream()));
-
- url = new URL(TARGET_ENDPOINT_ADDRESS + "?method=testWebServiceRef");
- assertEquals("OK testWebServiceRef",
IOUtils.readAndCloseStream(url.openStream()));
-
- url = new URL(TARGET_ENDPOINT_ADDRESS +
"?method=testWebServiceClient&host=" + getServerHost());
- assertEquals("OK testWebServiceClient",
IOUtils.readAndCloseStream(url.openStream()));
- }
- finally
- {
- undeploy(DeploymentArchives.SERVLET_CLIENT);
- }
- }
-}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,71 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.catalog;
-import junit.framework.Test;
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.catalog.OASISCatalogManager;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.FileAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import java.io.File;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.LinkedList;
-import java.util.List;
-
/**
* User: rsearls
* Date: 7/9/14
*/
+(a)RunWith(Arquillian.class)
public class OasisCatalogHelloWSTestCase extends JBossWSTest
{
- private final String endpointAddress = "http://" + getServerHost() +
":8080/jaxws-cxf-catalog/HelloService";
-
- public static BaseDeployment<?>[] createDeployments() {
-
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-catalog.war") {
{
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloRequest.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWsImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.class)
- .add(new FileAsset(new File(JBossWSTestHelper.getTestResourcesDir() +
- "/jaxws/cxf/catalog/META-INF/jax-ws-catalog.xml")),
- "META-INF/jax-ws-catalog.xml")
-
- // stnd file locations required for successful deployment
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"),
"wsdl/HelloService.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"),
"wsdl/Hello_schema1.xsd")
-
- // sever side catalog maps to these files.
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"),
"wsdl/foo/HelloService.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"),
"wsdl/foo/Hello_schema1.xsd")
-
- ;
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-catalog.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloRequest.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWsImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.class)
+ .add(new FileAsset(new File(JBossWSTestHelper.getTestResourcesDir() +
+ "/jaxws/cxf/catalog/META-INF/jax-ws-catalog.xml")),
"META-INF/jax-ws-catalog.xml")
+ // stnd file locations required for successful deployment
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"),
"wsdl/HelloService.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"),
"wsdl/Hello_schema1.xsd")
+ // sever side catalog maps to these files.
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"),
"wsdl/foo/HelloService.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"),
"wsdl/foo/Hello_schema1.xsd");
+ writeToDisk(archive);
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(OasisCatalogHelloWSTestCase.class,
- JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testCatalogOnClientSide() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -83,7 +99,7 @@
QName serviceName = new QName(
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
OASISCatalogManager catalogManager =
bus.getExtension(OASISCatalogManager.class);
@@ -98,6 +114,8 @@
}
}
+ @Test
+ @RunAsClient
public void testCatalogInJbosswsCxfClientJar() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -107,7 +125,7 @@
QName serviceName = new QName(
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
// jbossws-cxf-client.Jar is on the classpath by default.
@@ -125,6 +143,8 @@
}
+ @Test
+ @RunAsClient
public void testCatalogOnServerSide() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -134,7 +154,7 @@
QName serviceName = new QName(
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
HelloWs proxy = service.getPort(HelloWs.class);
HelloRequest helloReq = new HelloRequest();
@@ -145,4 +165,10 @@
bus.shutdown(true);
}
}
+
+ public static void writeToDisk(WebArchive archive)
+ {
+ File file = new File(JBossWSTestHelper.getTestArchiveDir(), archive.getName());
+ archive.as(ZipExporter.class).exportTo(file, true);
+ }
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -23,8 +23,6 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import java.util.concurrent.Future;
import javax.xml.namespace.QName;
@@ -32,13 +30,17 @@
import javax.xml.ws.Response;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Asynchronous web services test case with endpoint impl making
@@ -47,32 +49,28 @@
* @author alessio.soldano(a)jboss.com
* @since 21-Jun-2012
*/
+(a)RunWith(Arquillian.class)
public class ContinuationsTestCase extends JBossWSTest
{
- private String endpointAddress = "http://" + getServerHost() +
":8080/jaxws-cxf-continuations";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-cxf-continuations.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.continuations.EndpointImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/continuations/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-continuations.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.continuations.EndpointImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/continuations/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(ContinuationsTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testAsyncEndpoint() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/continuations",
"EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint proxy = service.getPort(Endpoint.class);
final String user = "Kermit";
@@ -80,10 +78,12 @@
assertEquals(user + " (ASYNC)", proxy.echoAsync(user).get());
}
+ @Test
+ @RunAsClient
public void testAsyncEndpointUsingHandler() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/continuations",
"EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint proxy = service.getPort(Endpoint.class);
final String user = "Kermit";
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -23,18 +23,21 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.ws.common.IOUtils;
import org.jboss.wsf.stack.cxf.client.ProviderImpl;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test required endorsing when using the CXF stack
@@ -42,49 +45,56 @@
* @author alessio.soldano(a)jboss.com
* @since 02-Jun-2010
*/
+(a)RunWith(Arquillian.class)
public class EndorseTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-endorse.war") {
{
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services
export\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.Helper.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/endorse/WEB-INF/web.xml"));
- }
- });
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-cxf-endorse-no-export.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.Helper.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/endorse/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ private static final String ENDORSE_DEP= "jaxws-cxf-endorse";
+ private static final String ENDORSE_NO_EXPORT_DEP=
"jaxws-cxf-endorse-no-export";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = ENDORSE_DEP, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, ENDORSE_DEP +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services
export\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/endorse/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(EndorseTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
+ @Deployment(name = ENDORSE_NO_EXPORT_DEP, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, ENDORSE_NO_EXPORT_DEP +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/endorse/WEB-INF/web.xml"));
+ return archive;
}
-
+
public void testClientSide()
{
Helper.verifyCXF();
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(ENDORSE_DEP)
public void testServerSide() throws Exception
{
- runServerTest(new URL("http://" + getServerHost() +
":8080/jaxws-cxf-endorse?provider=" + ProviderImpl.class.getName()));
+ runServerTest(new URL(baseURL + "?provider=" +
ProviderImpl.class.getName()));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(ENDORSE_NO_EXPORT_DEP)
public void testServerSideNoExport() throws Exception
{
- runServerTest(new URL("http://" + getServerHost() +
":8080/jaxws-cxf-endorse-no-export?provider=" + ProviderImpl.class.getName()));
+ runServerTest(new URL(baseURL + "?provider=" +
ProviderImpl.class.getName()));
}
private static void runServerTest(URL url) throws Exception {
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -23,70 +23,72 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployer;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
-import org.jboss.wsf.test.JBossWSTestSetup;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author Magesh Kumar B <mageshbk(a)jboss.com> (C) 2011 Red Hat Inc.
*/
+(a)RunWith(Arquillian.class)
public class EndpointTestCase extends JBossWSTest
{
- private static String publishURL = "http://" + getServerHost() +
":18080/HelloWorldService";
+ private static final String DEP = "jaxws-cxf-endpoint";
+ //TODO! figure out proper way for getting the address
+ private static String publishURL = "http://" + getServerHost() +
":48084/HelloWorldService";
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-endpoint.war") {
{
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.common\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorldImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.TestServlet.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/endpoint/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
- }
+ @ArquillianResource
+ Deployer deployer;
- public static Test suite()
- {
- return new JBossWSTestSetup(EndpointTestCase.class, "");
- }
+ @Deployment(name = DEP, testable = false, managed = false)
+ public static WebArchive createDeployment()
+ {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n" +
"Dependencies: org.jboss.ws.common\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorldImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.TestServlet.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/endpoint/WEB-INF/web.xml"));
+ return archive;
+ }
- public void testClassLoader() throws Exception
- {
- final String deploymentName =
JBossWSTestHelper.writeToFile(createDeployments());
- deploy(deploymentName);
- HelloWorld port = this.getProxy(publishURL);
- String classLoader1 = port.getClassLoader();
- String deploymentClassLoader1 = port.getDeploymentClassLoader();
- undeploy(deploymentName);
- assertEquals(classLoader1, deploymentClassLoader1);
- deploy(deploymentName);
- port = this.getProxy(publishURL);
- String classLoader2 = port.getClassLoader();
- String deploymentClassLoader2 = port.getDeploymentClassLoader();
- undeploy(deploymentName);
- assertEquals(classLoader2, deploymentClassLoader2);
- assertFalse(classLoader1.equals(classLoader2));
- }
+ @Test
+ @RunAsClient
+ public void testClassLoader() throws Exception
+ {
+ deployer.deploy(DEP);
+ HelloWorld port = this.getProxy(publishURL);
+ String classLoader1 = port.getClassLoader();
+ String deploymentClassLoader1 = port.getDeploymentClassLoader();
+ deployer.undeploy(DEP);
+ assertEquals(classLoader1, deploymentClassLoader1);
+ deployer.deploy(DEP);
+ port = this.getProxy(publishURL);
+ String classLoader2 = port.getClassLoader();
+ String deploymentClassLoader2 = port.getDeploymentClassLoader();
+ deployer.undeploy(DEP);
+ assertEquals(classLoader2, deploymentClassLoader2);
+ assertFalse(classLoader1.equals(classLoader2));
+ }
- private HelloWorld getProxy(String publishURL) throws Exception
- {
- URL wsdlURL = new URL(publishURL + "?wsdl");
- QName qname = new QName("http://org.jboss.ws/jaxws/cxf/endpoint",
"HelloWorldService");
- Service service = Service.create(wsdlURL, qname);
- return (HelloWorld)service.getPort(HelloWorld.class);
- }
+ private HelloWorld getProxy(String publishURL) throws Exception
+ {
+ URL wsdlURL = new URL(publishURL + "?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/cxf/endpoint",
"HelloWorldService");
+ Service service = Service.create(wsdlURL, qname);
+ return (HelloWorld) service.getPort(HelloWorld.class);
+ }
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -40,7 +40,7 @@
public void init(ServletConfig config) throws ServletException
{
String hostName =
toIPv6URLFormat(System.getProperty("jboss.bind.address",
"localhost"));
- String serviceURL = "http://" + hostName +
":18080/HelloWorldService";
+ String serviceURL = "http://" + hostName +
":48084/HelloWorldService";
_endpoint = Endpoint.publish(serviceURL, new
HelloWorldImpl(Thread.currentThread().getContextClassLoader()));
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -25,48 +25,46 @@
import java.io.File;
import java.io.PrintWriter;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+(a)RunWith(Arquillian.class)
public class FastInfosetTestCase extends JBossWSTest
{
- private String endpointURl = "http://" + getServerHost() +
":8080/jaxws-cxf-fastinfoset/HelloWorldService/HelloWorldImpl";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-fastinfoset.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorldImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/fastinfoset/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-fastinfoset.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorldImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/fastinfoset/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(FastInfosetTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testInfoset() throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -79,7 +77,7 @@
bus.getInInterceptors().add(new LoggingInInterceptor(pwIn));
bus.getOutInterceptors().add(new LoggingOutInterceptor(pwOut));
- URL wsdlURL = new URL(endpointURl + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"HelloWorldService/HelloWorldImpl?wsdl");
QName serviceName = new
QName("http://org.jboss.ws/jaxws/cxf/fastinfoset",
"HelloWorldService");
Service service = Service.create(wsdlURL, serviceName, new
UseThreadBusFeature());
QName portQName = new
QName("http://org.jboss.ws/jaxws/cxf/fastinfoset",
"HelloWorldImplPort");
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, 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.gzip;
-
-import java.io.File;
-
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSTestHelper;
-
-public final class DeploymentArchives
-{
- public static final String SERVER = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-cxf-gzip.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorldImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/gzip/WEB-INF/web.xml"));
- }
- });
-
- public static final String CLIENT = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-cxf-gzip-client.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services,org.apache.cxf.impl\n"))
-
.addClass(org.jboss.test.ws.jaxws.cxf.gzip.GZIPEnforcingInInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.Helper.class)
- .addClass(org.jboss.wsf.test.ClientHelper.class)
- .addClass(org.jboss.wsf.test.TestServlet.class);
- }
- });
-
- private DeploymentArchives() {
- //NO OP
- }
-}
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, 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.gzip;
-
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * This covers the same tests of GZIPTestCase but runs them via a Servlet client
- *
- * @author alessio.soldano(a)jboss.com
- * @since 01-Apr-2011
- *
- */
-public class GZIPServletTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(GZIPServletTestCase.class, DeploymentArchives.SERVER
+ ", " + DeploymentArchives.CLIENT);
- }
-
- public void testGZIPUsingFeatureOnBus() throws Exception
- {
- assertEquals("1",
runTestInContainer("testGZIPUsingFeatureOnBus"));
- }
-
- public void testGZIPUsingFeatureOnClient() throws Exception
- {
- assertEquals("1",
runTestInContainer("testGZIPUsingFeatureOnClient"));
- }
-
- public void testGZIPServerSideOnlyInterceptorOnClient() throws Exception
- {
- assertEquals("1",
runTestInContainer("testGZIPServerSideOnlyInterceptorOnClient"));
- }
-
- public void testFailureGZIPServerSideOnlyInterceptorOnClient() throws Exception
- {
- assertEquals("1",
runTestInContainer("testFailureGZIPServerSideOnlyInterceptorOnClient"));
- }
-
- public void testGZIPServerSideOnlyInterceptorsOnBus() throws Exception
- {
- assertEquals("1",
runTestInContainer("testGZIPServerSideOnlyInterceptorsOnBus"));
- }
-
- public void testFailureGZIPServerSideOnlyInterceptorsOnBus() throws Exception
- {
- assertEquals("1",
runTestInContainer("testFailureGZIPServerSideOnlyInterceptorsOnBus"));
- }
-
- private String runTestInContainer(String test) throws Exception
- {
- URL url = new URL("http://" + getServerHost()
- +
":8080/jaxws-cxf-gzip-client?path=/jaxws-cxf-gzip/HelloWorldService/HelloWorldImpl&method="
+ test
- + "&helper=" + Helper.class.getName());
- return IOUtils.readAndCloseStream(url.openStream());
- }
-}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java 2014-11-24
16:27:07 UTC (rev 19112)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java 2014-11-26
11:35:37 UTC (rev 19113)
@@ -21,10 +21,22 @@
*/
package org.jboss.test.ws.jaxws.cxf.gzip;
-import junit.framework.Test;
+import java.io.File;
+import java.net.URL;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.ws.common.IOUtils;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*
@@ -32,51 +44,148 @@
* @since 15-Sep-2010
*
*/
+(a)RunWith(Arquillian.class)
public class GZIPTestCase extends JBossWSTest
{
- private String gzipFeatureEndpointURL = "http://" + getServerHost() +
":8080/jaxws-cxf-gzip/HelloWorldService/HelloWorldImpl";
+ private static final String DEP = "jaxws-cxf-gzip";
+ private static final String CLIENT_DEP = "jaxws-cxf-gzip-client";
+ @ArquillianResource
+ private URL baseURL;
+
private Helper helper;
+
+ @Deployment(name = DEP, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorldImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/gzip/WEB-INF/web.xml"));
+ return archive;
+ }
- public static Test suite()
+ @Deployment(name = CLIENT_DEP, testable = false)
+ public static WebArchive createClientDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, CLIENT_DEP +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services,org.apache.cxf.impl\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.GZIPEnforcingInInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.Helper.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class);
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPUsingFeatureOnBus() throws Exception
{
- return new JBossWSCXFTestSetup(GZIPTestCase.class, DeploymentArchives.SERVER);
+ assertEquals("1",
runTestInContainer("testGZIPUsingFeatureOnBus"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPUsingFeatureOnClient() throws Exception
+ {
+ assertEquals("1",
runTestInContainer("testGZIPUsingFeatureOnClient"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPServerSideOnlyInterceptorOnClient() throws Exception
+ {
+ assertEquals("1",
runTestInContainer("testGZIPServerSideOnlyInterceptorOnClient"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerFailureGZIPServerSideOnlyInterceptorOnClient() throws
Exception
+ {
+ assertEquals("1",
runTestInContainer("testFailureGZIPServerSideOnlyInterceptorOnClient"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPServerSideOnlyInterceptorsOnBus() throws Exception
+ {
+ assertEquals("1",
runTestInContainer("testGZIPServerSideOnlyInterceptorsOnBus"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerFailureGZIPServerSideOnlyInterceptorsOnBus() throws
Exception
+ {
+ assertEquals("1",
runTestInContainer("testFailureGZIPServerSideOnlyInterceptorsOnBus"));
+ }
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL(baseURL +
"?path=/jaxws-cxf-gzip/HelloWorldService/HelloWorldImpl&method=" + test
+ + "&helper=" + Helper.class.getName());
+ return IOUtils.readAndCloseStream(url.openStream());
+ }
+
private Helper getHelper()
{
if (helper == null)
{
- helper = new Helper(gzipFeatureEndpointURL);
+ helper = new Helper(baseURL + "HelloWorldService/HelloWorldImpl");
}
return helper;
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPUsingFeatureOnBus() throws Exception
{
assertTrue(getHelper().testGZIPUsingFeatureOnBus());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPUsingFeatureOnClient() throws Exception
{
assertTrue(getHelper().testGZIPUsingFeatureOnClient());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPServerSideOnlyInterceptorOnClient() throws Exception
{
assertTrue(getHelper().testGZIPServerSideOnlyInterceptorOnClient());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testFailureGZIPServerSideOnlyInterceptorOnClient() throws Exception
{
assertTrue(getHelper().testFailureGZIPServerSideOnlyInterceptorOnClient());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPServerSideOnlyInterceptorsOnBus() throws Exception
{
assertTrue(getHelper().testGZIPServerSideOnlyInterceptorsOnBus());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testFailureGZIPServerSideOnlyInterceptorsOnBus() throws Exception
{
assertTrue(getHelper().testFailureGZIPServerSideOnlyInterceptorsOnBus());