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, toString
assertEquals, 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, fail
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected 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?
Exception
public void testDatePrefix() throws Exception
PathDatePreofixQueryRequestParser
.Exception
public 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
Exception
public 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?)
Exception
public void testPathDateRangeEncoded() throws Exception
PathDateRangeQueryRequestParser
, %-encoded version.Exception
public void testPathPrefixDatePrefix() throws Exception
PathPrefixDatePrefixQueryRequestParser
.
this is a URL query with (optional) single timestamp date range. timestamp, if non-empty, becomes start and end.
Exception
public void testPathPrefixDatePrefixEncoded() throws Exception
PathPrefixDatePrefixQueryRequestParser
.
%-encoded timestamp.
Exception
public 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.
Exception
public void testPathPrefixdateRangeEncoded() throws Exception
PathPrefixDateRangeQueryRequestParser
,
%-encoded version.Exception
protected 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.
Exception
public void testPathDatelessWithDateHeader() throws Exception
Exception
public void testPathological() throws Exception
Exception
public void testTimeMapRequest() throws Exception
TimeMapRequestParser
Exception
Copyright © 2005–2015 IIPC. All rights reserved.