Author: alessio.soldano(a)jboss.com
Date: 2008-07-30 10:09:03 -0400 (Wed, 30 Jul 2008)
New Revision: 7952
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/CustomException.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/EndpointImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/WebFaultTestCase.java
Log:
[JBWS-2152] Adding testcase
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/CustomException.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/CustomException.java 2008-07-30
13:54:40 UTC (rev 7951)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/CustomException.java 2008-07-30
14:09:03 UTC (rev 7952)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.jaxws.webfault;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.ws.WebFault;
/**
@@ -33,12 +34,21 @@
public class CustomException extends Exception
{
private Integer number;
+ @XmlTransient
+ private String transientString;
public CustomException(String message, Integer number)
{
super(message);
this.number = number;
}
+
+ public CustomException(String message, Integer number, String transientString)
+ {
+ super(message);
+ this.number = number;
+ this.transientString = transientString;
+ }
public Integer getNumber()
{
@@ -49,4 +59,14 @@
{
this.number = number;
}
+
+ public String getTransientString()
+ {
+ return transientString;
+ }
+
+ public void setTransientString(String transientString)
+ {
+ this.transientString = transientString;
+ }
}
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/EndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/EndpointImpl.java 2008-07-30
13:54:40 UTC (rev 7951)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/EndpointImpl.java 2008-07-30
14:09:03 UTC (rev 7952)
@@ -40,7 +40,7 @@
public void throwCustomException(String input) throws CustomException
{
log.info("throwCustomException: " + input);
- throw new CustomException("This is a @WebFault test", (input != null ?
input.length() : 0));
+ throw new CustomException("This is a @WebFault test", (input != null ?
input.length() : 0), "blah, blah");
}
public void throwSimpleException(String input) throws SimpleException
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/WebFaultTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/WebFaultTestCase.java 2008-07-30
13:54:40 UTC (rev 7951)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/webfault/WebFaultTestCase.java 2008-07-30
14:09:03 UTC (rev 7952)
@@ -46,7 +46,6 @@
{
private String endpointURL = "http://" + getServerHost() +
":8080/jaxws-webfault";
private static final String TARGET_NS =
"http://webfault.jaxws.ws.test.jboss.org/";
- private static final String CUSTOM_FAULT_NS =
"org.jboss.test.ws.jaxws.webfault.exceptions";
public static Test suite()
{
@@ -57,6 +56,8 @@
* Tests whether the @WebFault annotation correctly sets the fault element's name
and namespace
* (the type doesn't depend on @WebFault, see [JBWS-1904] about this)
*
+ * Also tests that the @XmlTransient annotated fields are not included in the wsdl
[JBWS-2152].
+ *
* @throws Exception
*/
public void testWebFaultElement() throws Exception
@@ -108,6 +109,19 @@
if (nameEquals)
{
firstTypeFound = true;
+
+ Element sequence = (Element)DOMUtils.getChildElements(e, new
QName("http://www.w3.org/2001/XMLSchema", "sequence")).next();
+ Iterator<Element> children =
(Iterator<Element>)DOMUtils.getChildElements(sequence, new
QName("http://www.w3.org/2001/XMLSchema", "element"));
+ boolean numberAttributeFound = false;
+ while (children.hasNext())
+ {
+ String name = children.next().getAttribute("name");
+ if ("number".equals(name))
+ numberAttributeFound = true;
+ else if ("transientString".equalsIgnoreCase(name))
+ fail("@XmlTransient fields should not be included.");
+ }
+ assertTrue(numberAttributeFound);
}
nameEquals =
e.getAttribute("name").equals("SimpleException");
if (nameEquals)
@@ -137,6 +151,7 @@
catch (CustomException e)
{
assertEquals(new Integer(5), e.getNumber());
+ assertNull(e.getTransientString());
}
catch (Exception e)
{