Author: alessio.soldano(a)jboss.com
Date: 2012-04-02 06:32:07 -0400 (Mon, 02 Apr 2012)
New Revision: 16076
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/endorse/META-INF/MANIFEST.MF-no-export
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/Helper.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/TestServlet.java
Log:
[JBWS-3477] A bit of refactoring to the jbossws-cxf endorse testcase
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-04-02
10:29:21 UTC (rev 16075)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-04-02
10:32:07 UTC (rev 16076)
@@ -88,7 +88,17 @@
<include
name="org/jboss/test/ws/jaxws/cxf/endorse/Helper.class"/>
</classes>
</war>
-
+
+ <!-- jaxws-cxf-endorse-no-export -->
+ <war
warfile="${tests.output.dir}/test-libs/jaxws-cxf-endorse-no-export.war"
+
manifest="${tests.output.dir}/test-resources/jaxws/cxf/endorse/META-INF/MANIFEST.MF-no-export"
+
webxml="${tests.output.dir}/test-resources/jaxws/cxf/endorse/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/endorse/TestServlet.class"/>
+ <include
name="org/jboss/test/ws/jaxws/cxf/endorse/Helper.class"/>
+ </classes>
+ </war>
+
<!-- jaxws-cxf-endpoint -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-endpoint.war"
webxml="${tests.output.dir}/test-resources/jaxws/cxf/endpoint/WEB-INF/web.xml">
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java 2012-04-02
10:29:21 UTC (rev 16075)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java 2012-04-02
10:32:07 UTC (rev 16076)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -27,6 +27,7 @@
import junit.framework.Test;
+import org.jboss.wsf.stack.cxf.client.ProviderImpl;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
@@ -38,23 +39,29 @@
*/
public class EndorseTestCase extends JBossWSTest
{
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-cxf-endorse";
-
public static Test suite()
{
- return new JBossWSCXFTestSetup(EndorseTestCase.class,
"jaxws-cxf-endorse.war");
+ return new JBossWSCXFTestSetup(EndorseTestCase.class,
"jaxws-cxf-endorse.war,jaxws-cxf-endorse-no-export.war");
}
public void testClientSide()
{
- Helper.verify();
+ Helper.verifyCXF();
}
public void testServerSide() throws Exception
{
- URL url = new URL(TARGET_ENDPOINT_ADDRESS + "?echo=HelloWorld");
+ runServerTest(new URL("http://" + getServerHost() +
":8080/jaxws-cxf-endorse?provider=" + ProviderImpl.class.getName()));
+ }
+
+ public void testServerSideNoExport() throws Exception
+ {
+ runServerTest(new URL("http://" + getServerHost() +
":8080/jaxws-cxf-endorse-no-export?provider=" + ProviderImpl.class.getName()));
+ }
+
+ private static void runServerTest(URL url) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String retStr = br.readLine();
- assertEquals("HelloWorld", retStr);
+ assertEquals("OK", retStr);
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/Helper.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/Helper.java 2012-04-02
10:29:21 UTC (rev 16075)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/Helper.java 2012-04-02
10:32:07 UTC (rev 16076)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -26,6 +26,7 @@
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.spi.Provider;
import org.apache.cxf.BusFactory;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory;
@@ -38,7 +39,7 @@
*/
public class Helper
{
- public static void verify()
+ public static void verifyCXF()
{
//check BusFactory customization; this is required by the JBWS-CXF Configurer
integration (HTTPConduit customization, JAXBIntros, ...)
BusFactory factory = BusFactory.newInstance();
@@ -62,4 +63,13 @@
}
return obj;
}
+
+ 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);
+ }
+ }
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/TestServlet.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/TestServlet.java 2012-04-02
10:29:21 UTC (rev 16075)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/TestServlet.java 2012-04-02
10:32:07 UTC (rev 16076)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -41,8 +41,18 @@
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
- String inStr = req.getParameter("echo");
- Helper.verify();
- res.getWriter().print(inStr);
+ String expectedProvider = req.getParameter("provider");
+ StringBuilder out = new StringBuilder();
+ try {
+ Helper.verifyCXF();
+ 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:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/endorse/META-INF/MANIFEST.MF-no-export
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/endorse/META-INF/MANIFEST.MF-no-export
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/endorse/META-INF/MANIFEST.MF-no-export 2012-04-02
10:32:07 UTC (rev 16076)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services
\ No newline at end of file