Author: jboynes
Date: Sat Mar 11 12:54:47 2006
New Revision: 385165
URL: http://svn.apache.org/viewcvs?rev=385165&view=rev
Log:
add test for xml returned from a webservice call
status code is not set, see TUSCANY-117
Modified:
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
Modified:
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java?rev=385165&r1=385164&r2=385165&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java
(original)
+++
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java
Sat Mar 11 12:54:47 2006
@@ -174,7 +174,7 @@
private String contentType;
private int status;
private Map headers = new HashMap();
- private ServletOutputStream outputStream = new MockOutputStream();
+ private MockOutputStream outputStream = new MockOutputStream();
public boolean isCommitted() {
return false;
@@ -254,6 +254,10 @@
public void write(int b) throws IOException {
os.write(b);
+ }
+
+ public String toString() {
+ return os.toString();
}
}
}
Modified:
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java?rev=385165&r1=385164&r2=385165&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
(original)
+++
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
Sat Mar 11 12:54:47 2006
@@ -46,7 +46,6 @@
// define our test servlet
StandardWrapper wrapper = new StandardWrapper();
wrapper.setServletClass(TestServlet.class.getName());
-// wrapper.setLoader(loader);
ctx.addChild(wrapper);
host.addChild(ctx);
@@ -79,19 +78,25 @@
Wrapper wrapper = (Wrapper)
ctx.findChild("TuscanyAxis2EntryPointServlet");
assertNotNull("No webservice wrapper present", wrapper);
request.setContext(ctx);
- request.setRequestURI("/services/epName");
+ request.setRequestURI("/services/HelloWorldService");
request.setWrapper(wrapper);
request.setContentType("text/xml");
String xml = "<soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:q0=\"http://helloworldaxis.samples.tuscany.apache.org\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
"<soapenv:Body>\n" +
"<q0:getGreetings>\n" +
- "<q0:in0>hello</q0:in0>\n" +
+ "<q0:in0>World</q0:in0>\n" +
"</q0:getGreetings>\n" +
"</soapenv:Body>\n" +
"</soapenv:Envelope>\n";
request.setStream(new MockInputStream(xml.getBytes("UTF-8")));
host.invoke(request, response);
+ xml = "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header
/><soapenv:Body><helloworldaxis:getGreetingsResponse
xmlns:helloworldaxis=\"http://helloworldaxis.samples.tuscany.apache.org\">\n" +
+ " <helloworldaxis:getGreetingsReturn>Hello
World</helloworldaxis:getGreetingsReturn>\n" +
+
"</helloworldaxis:getGreetingsResponse></soapenv:Body></soapenv:Envelope>";
+ assertEquals(xml, response.getOutputStream().toString());
+ // FIXME TUSCANY-117 shouldn't the status be 200 rather than 0
+// assertEquals(200, response.getStatus());
host.removeChild(ctx);
}