Author: nthaker
Date: Fri Aug 27 18:52:17 2010
New Revision: 990229
URL: http://svn.apache.org/viewvc?rev=990229&view=rev
Log:
Test case to make sure no payload is returned in response when a user returns
empty Source from Provider<Source> api.
As per JAX-WS 2.2 spec update empty Source can be created by using default
constructor for Source example Source s = new StreamSource(). I am adding this
test to verify that the function is already working and that we don't regress
that in future.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/source/SourceProvider.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java?rev=990229&r1=990228&r2=990229&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java
Fri Aug 27 18:52:17 2010
@@ -262,7 +262,25 @@ public class SourceProviderTests extends
}
}
+ public void testProviderEmptySource() throws Exception {
+ TestLogger.logger.debug("---------------------------------------");
+ TestLogger.logger.debug("test: " + getName());
+
+ Dispatch<Source> dispatch = getDispatch();
+ String request = "<test>ReturnEmpty</test>";
+ Source requestSource = getSource(request);
+ try {
+ requestSource = getSource(request);
+ Source responseSource = dispatch.invoke(requestSource);
+ //Expecting empty response payload back. Nothing underneath soap
body.
+ assertNull(responseSource);
+ }catch(Exception e){
+ e.printStackTrace();
+ fail("Caught exception " + e);
+ }
+
+ }
public void testTwoElementsString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
TestLogger.logger.debug("test: " + getName());
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/source/SourceProvider.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/source/SourceProvider.java?rev=990229&r1=990228&r2=990229&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/source/SourceProvider.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/source/SourceProvider.java
Fri Aug 27 18:52:17 2010
@@ -82,7 +82,10 @@ public class SourceProvider implements P
text = userFault;
} else if (text != null && text.contains("ReturnNull")) {
return null;
- }
+ }else if (text!=null && text.contains("ReturnEmpty")){
+ TestLogger.logger.debug(">> Return Empty Source: \n" + text);
+ return new StreamSource();
+ }
ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes());