Author: alessio.soldano(a)jboss.com
Date: 2012-04-02 06:29:21 -0400 (Mon, 02 Apr 2012)
New Revision: 16075
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/DummyProvider.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/Helper.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/JaxWsSpiProviderTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/TestServlet.java
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/META-INF/
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/META-INF/services/
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/META-INF/services/javax.xml.ws.spi.Provider
Modified:
shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3477] Adding testcase
Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-04-02
03:38:19 UTC (rev 16074)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-04-02
10:29:21 UTC (rev 16075)
@@ -1160,6 +1160,26 @@
</webinf>
</war>
+ <!-- jaxws-jbws3437 -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws3477.war"
needxmlfile="false">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/jbws3477/TestServlet.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws3477/Helper.class"/>
+ </classes>
+ </war>
+
+ <!-- jaxws-jbws3477-custom-provider -->
+ <war
warfile="${tests.output.dir}/test-libs/jaxws-jbws3477-custom-provider.war"
needxmlfile="false">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/jbws3477/TestServlet.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws3477/Helper.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jbws3477/DummyProvider.class"/>
+ </classes>
+ <classes dir="${tests.output.dir}/test-resources/jaxws/jbws3477">
+ <include name="META-INF/services/*"/>
+ </classes>
+ </war>
+
<!-- jaxws-as3581 -->
<war warfile="${tests.output.dir}/test-libs/jaxws-as3581.war"
webxml="${tests.output.dir}/test-resources/jaxws/as3581/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/DummyProvider.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/DummyProvider.java
(rev 0)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/DummyProvider.java 2012-04-02
10:29:21 UTC (rev 16075)
@@ -0,0 +1,82 @@
+/*
+ * 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.jbws3477;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.spi.ServiceDelegate;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import org.w3c.dom.Element;
+
+public class DummyProvider extends javax.xml.ws.spi.Provider
+{
+ @Override
+ public ServiceDelegate createServiceDelegate(URL wsdlDocumentLocation, QName
serviceName, Class serviceClass)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Endpoint createEndpoint(String bindingId, Object implementor)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Endpoint createAndPublishEndpoint(String address, Object implementor)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public EndpointReference readEndpointReference(Source eprInfoset)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T getPort(EndpointReference endpointReference, Class<T>
serviceEndpointInterface,
+ WebServiceFeature... features)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public W3CEndpointReference createW3CEndpointReference(String address, QName
serviceName, QName portName,
+ List<Element> metadata, String wsdlDocumentLocation, List<Element>
referenceParameters)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/Helper.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/Helper.java
(rev 0)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/Helper.java 2012-04-02
10:29:21 UTC (rev 16075)
@@ -0,0 +1,42 @@
+/*
+ * 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.jbws3477;
+
+import javax.xml.ws.spi.Provider;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Apr-2012
+ *
+ */
+public class Helper
+{
+ public static void verifyJaxWsSpiProvider(String expectedProviderClass)
+ {
+ Provider provider = Provider.provider();
+ String clazz = provider.getClass().getName();
+ if (!clazz.equals(expectedProviderClass)) {
+ throw new RuntimeException("Expected " + expectedProviderClass +
" but got " + clazz);
+ }
+ }
+}
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/JaxWsSpiProviderTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/JaxWsSpiProviderTestCase.java
(rev 0)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/JaxWsSpiProviderTestCase.java 2012-04-02
10:29:21 UTC (rev 16075)
@@ -0,0 +1,87 @@
+/*
+ * 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.jbws3477;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test JAXWS Spi Provider customization on AS 7
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Apr-2012
+ */
+public class JaxWsSpiProviderTestCase extends JBossWSTest
+{
+ private String defaultProvider;
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JaxWsSpiProviderTestCase.class,
"jaxws-jbws3477-custom-provider.war,jaxws-jbws3477.war");
+ }
+
+ protected void setUp() {
+ if (isIntegrationCXF()) {
+ defaultProvider = "org.jboss.wsf.stack.cxf.client.ProviderImpl";
+ }
+ else if (isIntegrationNative()) {
+ defaultProvider = "org.jboss.ws.core.jaxws.spi.ProviderImpl";
+ }
+ }
+
+ public void testClientSide()
+ {
+ Helper.verifyJaxWsSpiProvider(defaultProvider);
+ }
+
+ /**
+ * Checks the default JAXWS SPI Provider is used (on AS7 that's controlled by the
jboss jaxws api, which internally loads org.jboss.ws.jaxws-client module)
+ *
+ * @throws Exception
+ */
+ public void testServerSideDefaultProvider() throws Exception
+ {
+ runServerTest(new URL("http://" + getServerHost() +
":8080/jaxws-jbws3477?provider=" + defaultProvider));
+ }
+
+ /**
+ * Checks the JAXWS SPI Provider implementation can be overridden on a per-application
basis in AS7
+ *
+ * @throws Exception
+ */
+ public void testServerSideProviderCustomization() throws Exception
+ {
+ runServerTest(new URL("http://" + getServerHost() +
":8080/jaxws-jbws3477-custom-provider?provider=org.jboss.test.ws.jaxws.jbws3477.DummyProvider"));
+ }
+
+ private static void runServerTest(URL url) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ String retStr = br.readLine();
+ assertEquals("OK", retStr);
+ }
+}
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/TestServlet.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/TestServlet.java
(rev 0)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws3477/TestServlet.java 2012-04-02
10:29:21 UTC (rev 16075)
@@ -0,0 +1,59 @@
+/*
+ * 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.jbws3477;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Apr-2012
+ *
+ */
+@WebServlet(name = "TestServlet", urlPatterns = "/*")
+public class TestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ String expectedProvider = req.getParameter("provider");
+ StringBuilder out = new StringBuilder();
+ try {
+ Helper.verifyJaxWsSpiProvider(expectedProvider);
+ out.append("OK");
+ } catch (Throwable t) {
+ t.printStackTrace();
+ out.append(t.getClass().getName());
+ out.append(": ");
+ out.append(t.getMessage());
+ }
+ res.getWriter().print(out.toString());
+ }
+}
Added:
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/META-INF/services/javax.xml.ws.spi.Provider
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/META-INF/services/javax.xml.ws.spi.Provider
(rev 0)
+++
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/jbws3477/META-INF/services/javax.xml.ws.spi.Provider 2012-04-02
10:29:21 UTC (rev 16075)
@@ -0,0 +1 @@
+org.jboss.test.ws.jaxws.jbws3477.DummyProvider
\ No newline at end of file