public class ArchivalUrlRequestParserTest
extends junit.framework.TestCase
ArchivalUrlRequestParser.
This class tests entire ArchivalUrlRequestParser, including its sub-component
classes: ReplayRequestParser, PathDatePrefixQueryRequestParser
PathDateRangeQueryRequestParser, PathPrefixDatePrefixQueryRequestParser,
PathPrefixDateRangeQueryRequestParser and DatelessReplayRequestParser.| Constructor and Description |
|---|
ArchivalUrlRequestParserTest() |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toStringassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, failprotected void setUp()
throws Exception
setUp in class junit.framework.TestCaseExceptionprotected javax.servlet.http.HttpServletRequest getRequestMock(String requestURI, String query)
protected WaybackRequest parse(String url) throws BadQueryException, BetterRequestException
public void testDatePathPrefix()
throws Exception
this is interpreted as replay request for the URL including trailing "*". That sounds inconsistent with other cases. (BTW, resultant time-redirect URL has no trailing "*" - there's a special handling happening somewhere.) Should this be interpreted as URL-query for the specific date?
Exceptionpublic void testDatePrefix()
throws Exception
PathDatePreofixQueryRequestParser.Exceptionpublic void testDatePrefixEncoded()
throws Exception
PathDatePrefixQueryRequestParser:
URL is recognized even when "*" is %-encoded.
this is a desired behavior to be implemented (assertion is disabled). see issue WWM-110
Exceptionpublic void testPathDateRange()
throws Exception
PathDateRangeQueryRequestParser.
date range and specific path. date range becomes start and end timestamps. but it doesn't set replayTimestamp (it should, for consistency?)
Exceptionpublic void testPathDateRangeEncoded()
throws Exception
PathDateRangeQueryRequestParser, %-encoded version.Exceptionpublic void testPathPrefixDatePrefix()
throws Exception
PathPrefixDatePrefixQueryRequestParser.
this is a URL query with (optional) single timestamp date range. timestamp, if non-empty, becomes start and end.
Exceptionpublic void testPathPrefixDatePrefixEncoded()
throws Exception
PathPrefixDatePrefixQueryRequestParser.
%-encoded timestamp.
Exceptionpublic void testPathPrefixDateRange()
throws Exception
PathPrefixDateRangeQueryRequestParser.
explicit timestamp range and trailing "*" in URL. this is a URL-query request, timestamp range becomes start and end timestamp.
timerange without "*" is not recognized. it could be.
Exceptionpublic void testPathPrefixdateRangeEncoded()
throws Exception
PathPrefixDateRangeQueryRequestParser,
%-encoded version.Exceptionprotected void checkPathDateless(WaybackRequest wbr, String requestUrl)
public void testPathDateless()
throws Exception
DatelessReplayRequestParser.
It also reads Replay/AchorDate from Accept-Date/Accept-Timestamp HTTP headers (Accept-Date is part of Memento protocol). This test is included here, even though it has some Memento-related code, because core part of processing is for Archival-URL.
One notable difference from with-timestamp request is that
WaybackRequest.isBestLatestReplayRequest() is set to true, which used
in several places for unclear purpose. This flag is not set in other
RequestParser's, even if request is asking for the best latest capture.
Probably flag's semantics is slightly different from what its name suggests.
As this pattern of requests come from URL that escaped Archival-URL rewriting process, it runs extra check on it. Test includes a few negative cases for non-URL paths.
Exceptionpublic void testPathDatelessWithDateHeader()
throws Exception
Exceptionpublic void testPathological()
throws Exception
Exceptionpublic void testTimeMapRequest()
throws Exception
TimeMapRequestParserExceptionCopyright © 2005–2015 IIPC. All rights reserved.