diff options
Diffstat (limited to 'java/sca/modules/binding-http-runtime/src/test')
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>"); } |