summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-http-runtime/src/test
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-08-27 14:24:14 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2008-08-27 14:24:14 +0000
commitbfa022e51868d981c7219eb7e67b65d94b7c8623 (patch)
treed8893b137f0ad1e4c22b1c5332be458f41d89eea /java/sca/modules/binding-http-runtime/src/test
parent2c189e0a7d056a9d76b2244f5dcc1a2804b7d9aa (diff)
TUSCANY-2516: Apply pacth from Dan Becker for HTTP binding should support etag and if-modified headers
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@689492 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-http-runtime/src/test')
-rw-r--r--java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java9
-rw-r--r--java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java6
-rw-r--r--java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java3
3 files changed, 11 insertions, 7 deletions
diff --git a/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java b/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java
index bc87dd2f93..e5cad080a6 100644
--- a/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java
+++ b/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
+import java.text.MessageFormat;
import junit.framework.TestCase;
@@ -54,7 +55,7 @@ public class HTTPBindingTestCase extends TestCase {
REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
private static final String REQUEST3_HEADER =
- "GET /httpget/test HTTP/1.0\n" + "Host: localhost\n"
+ "GET /httpget/{0} HTTP/1.0\n" + "Host: localhost\n"
+ "Content-Type: text/xml\n"
+ "Connection: close\n"
+ "Content-Length: ";
@@ -97,11 +98,13 @@ public class HTTPBindingTestCase extends TestCase {
public void testGetImplementation() throws Exception {
Socket client = new Socket("127.0.0.1", HTTP_PORT);
OutputStream os = client.getOutputStream();
- os.write(REQUEST3.getBytes());
+ int index = 0;
+ String request = MessageFormat.format( REQUEST3, index );
+ os.write( request.getBytes());
os.flush();
String document = read(client);
- assertTrue(document.indexOf("<body><p>uh oh</body>") != -1);
+ assertTrue(document.indexOf("<body><p>item=" + index) != -1);
}
/**
diff --git a/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java b/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java
index 0e0360d821..0df279dedd 100644
--- a/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java
+++ b/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java
@@ -30,9 +30,9 @@ import java.io.InputStream;
public class TestGetImpl {
public InputStream get(String id) {
-
- return new ByteArrayInputStream("<html><body><p>uh oh</body></html>".getBytes());
-
+ System.out.println( "DOB: TestGetImpl id=" + id );
+ return new ByteArrayInputStream(("<html><body><p>item=" + id + "</body></html>").getBytes());
+
}
}
diff --git a/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java b/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java
index 1cfc02a473..11945c8cd1 100644
--- a/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java
+++ b/java/sca/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -42,7 +43,7 @@ public class TestServiceImpl implements Servlet {
}
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- //HttpServletResponse httpResponse = (HttpServletResponse)response;
+ //HttpServletResponse httpResponse = (HttpServletResponse)response;
response.getOutputStream().print("<html><body><p>hey</body></html>");
}