Author: alessio.soldano(a)jboss.com
Date: 2008-07-09 10:27:03 -0400 (Wed, 09 Jul 2008)
New Revision: 7809
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionEJB3TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointEJB3Impl.java
Modified:
framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionTestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointImpl.java
Log:
Testing exception handling both with JSE and EJB3 endpoints
Modified: framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml 2008-07-09 12:42:27
UTC (rev 7808)
+++ framework/trunk/testsuite/test/ant-import/build-samples-jaxws.xml 2008-07-09 14:27:03
UTC (rev 7809)
@@ -87,6 +87,7 @@
<war warfile="${tests.output.dir}/test-libs/jaxws-samples-exception.war"
webxml="${tests.output.dir}/test-resources/jaxws/samples/exception/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/exception/server/jaxws/**"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpoint.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointImpl.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/exception/server/UserException.class"/>
@@ -94,6 +95,17 @@
<include
name="org/jboss/test/ws/jaxws/samples/exception/server/jaxws-handlers-server.xml"/>
</classes>
</war>
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-samples-exception.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/jaxws/**"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointEJB3Impl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/UserException.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/ServerHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/exception/server/jaxws-handlers-server.xml"/>
+ </fileset>
+ </jar>
<!-- jaxws-samples-handlerchain -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-handlerchain.war"
webxml="${tests.output.dir}/test-resources/jaxws/samples/handlerchain/WEB-INF/web.xml">
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionEJB3TestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionEJB3TestCase.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionEJB3TestCase.java 2008-07-09
14:27:03 UTC (rev 7809)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.samples.exception;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.jaxws.samples.exception.client.ExceptionEndpoint;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test JAX-WS exception handling with EJB3 endpoints
+ *
+ * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
+ * @author alessio.soldano(a)jboss.com
+ * @version $Revision:1370 $
+ */
+public class ExceptionEJB3TestCase extends ExceptionTestCase
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(ExceptionEJB3TestCase.class,
"jaxws-samples-exception.jar");
+ }
+
+ @Override
+ protected ExceptionEndpoint getProxy() throws Exception
+ {
+ QName serviceName = new QName(targetNS,
"ExceptionEndpointEJB3ImplService");
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-exception/ExceptionEndpointEJB3Impl?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ return service.getPort(ExceptionEndpoint.class);
+ }
+}
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionEJB3TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionTestCase.java 2008-07-09
12:42:27 UTC (rev 7808)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/ExceptionTestCase.java 2008-07-09
14:27:03 UTC (rev 7809)
@@ -44,26 +44,22 @@
*/
public class ExceptionTestCase extends JBossWSTest
{
- private String targetNS =
"http://server.exception.samples.jaxws.ws.test.jboss.org/";
- private ExceptionEndpoint proxy;
+ protected String targetNS =
"http://server.exception.samples.jaxws.ws.test.jboss.org/";
public static Test suite()
{
return new JBossWSTestSetup(ExceptionTestCase.class,
"jaxws-samples-exception.war");
}
- @Override
- protected void setUp() throws Exception
+ protected ExceptionEndpoint getProxy() throws Exception
{
- super.setUp();
-
QName serviceName = new QName(targetNS, "ExceptionEndpointImplService");
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-exception/ExceptionEndpointService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
- proxy = service.getPort(ExceptionEndpoint.class);
+ return service.getPort(ExceptionEndpoint.class);
}
-
+
/*
* 10.2.2.3
*
@@ -85,7 +81,7 @@
{
try
{
- proxy.throwRuntimeException();
+ getProxy().throwRuntimeException();
fail("Expected SOAPFaultException");
}
catch (SOAPFaultException e)
@@ -99,7 +95,7 @@
{
try
{
- proxy.throwSoapFaultException();
+ getProxy().throwSoapFaultException();
fail("Expected SOAPFaultException");
}
catch (SOAPFaultException e)
@@ -116,7 +112,7 @@
{
try
{
- proxy.throwApplicationException();
+ getProxy().throwApplicationException();
fail("Expected UserException");
}
catch (UserException_Exception e)
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.java 2008-07-09
14:27:03 UTC (rev 7809)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.samples.exception.server;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.soap.SOAPFaultException;
+
+public class EndpointImpl
+{
+ public void throwRuntimeException()
+ {
+ throw new RuntimeException("oh no, a runtime exception occured.");
+ }
+
+ public void throwSoapFaultException()
+ {
+ // This should be thrown as-is
+ try
+ {
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPFault fault = factory.createFault("this is a fault string!", new
QName("http://foo", "FooCode"));
+ fault.setFaultActor("mr.actor");
+ fault.addDetail().addChildElement("test");
+ throw new SOAPFaultException(fault);
+ }
+ catch (SOAPException s)
+ {
+ throw new RuntimeException(s);
+ }
+ }
+
+ public void throwApplicationException() throws UserException
+ {
+ throw new UserException("validation", 123, "Some validation
error");
+ }
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointEJB3Impl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointEJB3Impl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointEJB3Impl.java 2008-07-09
14:27:03 UTC (rev 7809)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.samples.exception.server;
+
+import javax.ejb.Stateless;
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+@Stateless
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.exception.server.ExceptionEndpoint")
+@HandlerChain(file = "jaxws-handlers-server.xml")
+public class ExceptionEndpointEJB3Impl extends EndpointImpl implements ExceptionEndpoint
+{
+
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointEJB3Impl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointImpl.java 2008-07-09
12:42:27 UTC (rev 7808)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/exception/server/ExceptionEndpointImpl.java 2008-07-09
14:27:03 UTC (rev 7809)
@@ -23,41 +23,10 @@
import javax.jws.HandlerChain;
import javax.jws.WebService;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPFault;
-import javax.xml.ws.soap.SOAPFaultException;
-
@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.exception.server.ExceptionEndpoint")
@HandlerChain(file = "jaxws-handlers-server.xml")
-public class ExceptionEndpointImpl implements ExceptionEndpoint
+public class ExceptionEndpointImpl extends EndpointImpl implements ExceptionEndpoint
{
- public void throwRuntimeException()
- {
- throw new RuntimeException("oh no, a runtime exception occured.");
- }
-
- public void throwSoapFaultException()
- {
- // This should be thrown as-is
- try
- {
- SOAPFactory factory = SOAPFactory.newInstance();
- SOAPFault fault = factory.createFault("this is a fault string!", new
QName("http://foo", "FooCode"));
- fault.setFaultActor("mr.actor");
- fault.addDetail().addChildElement("test");
- throw new SOAPFaultException(fault);
- }
- catch (SOAPException s)
- {
- throw new RuntimeException(s);
- }
- }
-
- public void throwApplicationException() throws UserException
- {
- throw new UserException("validation", 123, "Some validation
error");
- }
+
}