aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2012-08-17 06:45:55 (EDT)
committerThomas Becker2012-08-17 06:45:55 (EDT)
commitb0537707e3cde3e4fdaac715642c30f07090a46b (patch)
treea2f0a7db5c2f5e35a8a9242c2e750a6e9850a1b1
parente7cad67ace16e006bd05745f3e78c875d0b3c669 (diff)
downloadorg.eclipse.jetty.project-b0537707e3cde3e4fdaac715642c30f07090a46b.zip
org.eclipse.jetty.project-b0537707e3cde3e4fdaac715642c30f07090a46b.tar.gz
org.eclipse.jetty.project-b0537707e3cde3e4fdaac715642c30f07090a46b.tar.bz2
jetty-9: Small HttpManyWaysToCommitTest fixes
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java
index e6cd68c..bf5593a 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java
@@ -31,7 +31,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.log.Log;
@@ -77,7 +76,6 @@ public class HttpManyWaysToCommitTest
((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(true);
}
- /* ------------------------------------------------------------ */
@After
public void tearDown() throws Exception
{
@@ -181,9 +179,6 @@ public class HttpManyWaysToCommitTest
Response response = executeRequest();
- // This assertion is currently red. However I think it should be green. Nothing has been flushed to the
- // client yet, when we throw an exception in the handler. So I expect HttpChannel to send a 500.
- // Fails in HttpConnection line 619/620
assertThat("response code is 500", response.getCode(), is("500"));
}
@@ -213,7 +208,8 @@ public class HttpManyWaysToCommitTest
assertThat("response code is 200", response.getCode(), is("200"));
- // assertHeader(response, "transfer-encoding", "chunked");
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked");
}
@Test
@@ -225,7 +221,8 @@ public class HttpManyWaysToCommitTest
Response response = executeRequest();
assertThat("response code is 200", response.getCode(), is("200"));
- // assertHeader(response, "transfer-encoding", "chunked");
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked");
}
private class ExplicitFlushHandler extends ThrowExceptionOnDemandHandler
@@ -254,7 +251,8 @@ public class HttpManyWaysToCommitTest
Response response = executeRequest();
assertThat("response code is 200", response.getCode(), is("200"));
- // assertHeader(response, "transfer-encoding", "chunked");
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked");
}
@Test
@@ -266,7 +264,8 @@ public class HttpManyWaysToCommitTest
Response response = executeRequest();
assertThat("response code is 200", response.getCode(), is("200"));
- // assertHeader(response, "transfer-encoding", "chunked");
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked");
}
private class SetHandledAndFlushWithoutContentHandler extends ThrowExceptionOnDemandHandler
@@ -294,7 +293,8 @@ public class HttpManyWaysToCommitTest
Response response = executeRequest();
assertThat("response code is 200", response.getCode(), is("200"));
- // assertHeader(response, "transfer-encoding", "chunked"); // HTTP/1.0 does not do chunked. it will just send content and close
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked"); // HTTP/1.0 does not do chunked. it will just send content and close
}
@Test
@@ -306,7 +306,8 @@ public class HttpManyWaysToCommitTest
Response response = executeRequest();
assertThat("response code is 200", response.getCode(), is("200"));
- // assertHeader(response, "transfer-encoding", "chunked"); // TODO HTTP/1.0 does not do chunked
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked"); // TODO HTTP/1.0 does not do chunked
}
private class WriteFlushWriteMoreHandler extends ThrowExceptionOnDemandHandler
@@ -469,7 +470,6 @@ public class HttpManyWaysToCommitTest
assertThat("response code is 200", response.getCode(), is("200"));
//TODO: jetty ignores setContentLength and sends transfer-encoding header. Correct?
- // assertHeader(response,"transfer-encoding","chunked");
}
@Test
@@ -512,7 +512,8 @@ public class HttpManyWaysToCommitTest
assertThat("response code is 200", response.getCode(), is("200"));
assertResponseBody(response, "foobar");
// TODO: once flushed setting contentLength is ignored and chunked is used. Correct?
- // assertHeader(response,"transfer-encoding","chunked");
+ if ("HTTP/1.1".equals(httpVersion))
+ assertHeader(response, "transfer-encoding", "chunked");
}
@Test
@@ -538,7 +539,7 @@ public class HttpManyWaysToCommitTest
{
baseRequest.setHandled(true);
response.getWriter().write("foobar");
- response.setContentLength(3);
+ response.setContentLength(3);
super.handle(target, baseRequest, request, response);
}
}