reduced verbosity of tests reporting errors

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2064 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-07-02 15:53:01 +00:00
parent f9640c4116
commit f16dcd8cad
5 changed files with 34 additions and 18 deletions

View File

@ -394,7 +394,7 @@ public class HttpConnection implements Connection
_handling=true;
setCurrentConnection(this);
while (more_in_buffer)
while (more_in_buffer && _endp.isOpen())
{
try
{

View File

@ -33,14 +33,6 @@ public class LocalConnector extends AbstractConnector
return this;
}
/**
* @deprecated Not needed anymore, as there is no need to reopen the connector to reset its state
*/
@Deprecated
public void reopen()
{
}
public String getResponses(String requests) throws Exception
{
return getResponses(requests, false);
@ -121,7 +113,7 @@ public class LocalConnector extends AbstractConnector
boolean leaveOpen = keepOpen;
try
{
while (endPoint.getIn().length() > 0)
while (endPoint.getIn().length() > 0 && endPoint.isOpen())
{
while (true)
{

View File

@ -50,7 +50,8 @@ public class HttpConnectionTest
server = new Server();
connector = new LocalConnector();
server.addConnector(connector);
connector.setHeaderBufferSize(1024);
connector.setRequestHeaderSize(1024);
connector.setResponseHeaderSize(1024);
server.setHandler(new DumpHandler());
server.start();
}
@ -491,7 +492,6 @@ public class HttpConnectionTest
response=connector.getResponses("CONNECT www.webtide.com:8080 HTTP/1.1\n"+
"Host: myproxy:8888\015\012"+
"\015\012");
System.err.println("RESPONSE:"+response);
offset = checkContains(response,offset,"HTTP/1.1 200");
}

View File

@ -252,9 +252,7 @@ public class ServletTest extends TestCase
ByteArrayBuffer out = new ByteArrayBuffer(4096);
out.put(request0.getBytes("iso8859-1"));
String responses = tester.getResponses(out).toString();
System.err.println(responses);
int offset = responses.indexOf("HTTP/1.1 500");
assertTrue(offset>=0);
offset = responses.indexOf("Content-Length: ",offset);

View File

@ -171,7 +171,16 @@ public abstract class RFC2616BaseTest
response = http.request(req1);
response.assertStatus("3.6 Transfer Coding / Bad 400",HttpStatus.BAD_REQUEST_400);
}
/**
* Test Transfer Codings
*
* @see <a href="http://tools.ietf.org/html/rfc2616#section-3.6">RFC 2616 (section 3.6)</a>
*/
@Test
public void test3_6_2() throws Throwable
{
// Chunked
StringBuffer req2 = new StringBuffer();
req2.append("GET /echo/R1 HTTP/1.1\n");
@ -215,9 +224,17 @@ public abstract class RFC2616BaseTest
response = responses.get(2); // Response 3
response.assertStatusOK("3.6.1 Transfer Codings / Response 3 Code");
response.assertNoBody("3.6.1 Transfer Codings / No Body");
}
/**
* Test Transfer Codings
*
* @see <a href="http://tools.ietf.org/html/rfc2616#section-3.6">RFC 2616 (section 3.6)</a>
*/
@Test
public void test3_6_3() throws Throwable
{
// Chunked
StringBuffer req3 = new StringBuffer();
req3.append("POST /echo/R1 HTTP/1.1\n");
req3.append("Host: localhost\n");
@ -261,8 +278,17 @@ public abstract class RFC2616BaseTest
response.assertStatusOK("3.6.1 Transfer Codings / Response 3 Code");
response.assertNoBody("3.6.1 Transfer Codings / No Body");
// Chunked and keep alive
}
/**
* Test Transfer Codings
*
* @see <a href="http://tools.ietf.org/html/rfc2616#section-3.6">RFC 2616 (section 3.6)</a>
*/
@Test
public void test3_6_4() throws Throwable
{
// Chunked and keep alive
StringBuffer req4 = new StringBuffer();
req4.append("GET /echo/R1 HTTP/1.1\n");
req4.append("Host: localhost\n");