Issue #113 - fix to failing tests
removed tests for %B and %b which have been removed in favor of %O adjusted the NcsaRequestLogTest to only test ExtendedNCSA format Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
b97c80b3c1
commit
8aa3655c55
|
@ -188,34 +188,6 @@ public class CustomRequestLogTest
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogResponseSize() throws Exception
|
||||
{
|
||||
testHandlerServerStart("ResponseSize: %B");
|
||||
|
||||
_connector.getResponse("GET / HTTP/1.0\n\n");
|
||||
String log = _entries.poll(5,TimeUnit.SECONDS);
|
||||
assertThat(log, is("ResponseSize: 0"));
|
||||
|
||||
_connector.getResponse("GET / HTTP/1.0\nEcho: hello world\n\n");
|
||||
log = _entries.poll(5,TimeUnit.SECONDS);
|
||||
assertThat(log, is("ResponseSize: 11"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogResponseSizeCLF() throws Exception
|
||||
{
|
||||
testHandlerServerStart("ResponseSize: %b");
|
||||
|
||||
_connector.getResponse("GET / HTTP/1.0\n\n");
|
||||
String log = _entries.poll(5,TimeUnit.SECONDS);
|
||||
assertThat(log, is("ResponseSize: -"));
|
||||
|
||||
_connector.getResponse("GET / HTTP/1.0\nEcho: hello world\n\n");
|
||||
log = _entries.poll(5,TimeUnit.SECONDS);
|
||||
assertThat(log, is("ResponseSize: 11"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogBytesSent() throws Exception
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
|||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -52,7 +53,6 @@ import org.junit.jupiter.params.provider.MethodSource;
|
|||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
public class NcsaRequestLogTest
|
||||
|
@ -69,14 +69,12 @@ public class NcsaRequestLogTest
|
|||
switch (logType)
|
||||
{
|
||||
case "customNCSA":
|
||||
_log = new CustomRequestLog(writer, CustomRequestLog.NCSA_FORMAT);
|
||||
_log = new CustomRequestLog(writer, CustomRequestLog.EXTENDED_NCSA_FORMAT);
|
||||
break;
|
||||
case "NCSA":
|
||||
{
|
||||
AbstractNCSARequestLog logNCSA = new AbstractNCSARequestLog(writer);
|
||||
logNCSA.setExtended(true);
|
||||
logNCSA.setLogLatency(true);
|
||||
logNCSA.setLogCookies(true);
|
||||
_log = logNCSA;
|
||||
break;
|
||||
}
|
||||
|
@ -354,7 +352,7 @@ public class NcsaRequestLogTest
|
|||
_connector.getResponse("GET http://[:1]/foo HTTP/1.1\nReferer: http://other.site\n\n");
|
||||
String log = _entries.poll(5,TimeUnit.SECONDS);
|
||||
assertThat(log,containsString("GET http://[:1]/foo "));
|
||||
assertThat(log,containsString(" 400 50 \"http://other.site\" \"-\" - "));
|
||||
assertThat(log,containsString(" 400 50 \"http://other.site\" \"-\""));
|
||||
}
|
||||
|
||||
@ParameterizedTest()
|
||||
|
@ -367,7 +365,7 @@ public class NcsaRequestLogTest
|
|||
_connector.getResponse("GET http://[:1]/foo HTTP/1.1\nReferer: http://other.site\nUser-Agent: Mozilla/5.0 (test)\n\n");
|
||||
String log = _entries.poll(5,TimeUnit.SECONDS);
|
||||
assertThat(log,containsString("GET http://[:1]/foo "));
|
||||
assertThat(log,containsString(" 400 50 \"http://other.site\" \"Mozilla/5.0 (test)\" - "));
|
||||
assertThat(log,containsString(" 400 50 \"http://other.site\" \"Mozilla/5.0 (test)\""));
|
||||
}
|
||||
|
||||
|
||||
|
@ -490,9 +488,6 @@ public class NcsaRequestLogTest
|
|||
startServer();
|
||||
makeRequest(requestPath);
|
||||
assertRequestLog(expectedLogEntry, _log);
|
||||
|
||||
if (!(testHandler instanceof HelloHandler))
|
||||
assertThat(errors,contains(requestPath));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue