Package org.archive.wayback.core

Examples of org.archive.wayback.core.CaptureSearchResults


//        closest.setHttpCode("200");
//        // closest.captureTimestamp != wbRequest.replayTimestamp
//        closest.setCaptureTimestamp("20100601000000");
        // Resource below has originalUrl="http://test.example.com/", which is different from
        // wbRequest.requestUrl above. originalUrl shall be reflected to resultant redirect URL.
        CaptureSearchResults results = setupCaptures(
                0,
                createTestHtmlResource("20100601000000", "hogheogehoge\n".getBytes("UTF-8"))
                );
        // handleRequest()
        // calls handleReplay()
View Full Code Here


        // make sure wbRequesat.requestUrl, replayTimestamp are set up.
        setReplayRequest(wbRequest, "http://test.example.com/", "20100601000000");
       
        // there's capture with timestamp exactly requested for.
        Resource payloadResource = createTestHtmlResource("20100601000000", "hogheogehoge\n".getBytes("UTF-8"));
        CaptureSearchResults results = setupCaptures(
                0,
                payloadResource
                );
        CaptureSearchResult closest = results.getClosest();
       
        // when closest's timestamp == request's timestamp,
        // it gets ReplayRenderer with replay.getRenderer(wbRequest, closest, httpHeaderResource, payloadResource),
        // and calls renderResource() on it.
        EasyMock.expect(replay.getRenderer(wbRequest, closest, payloadResource, payloadResource)).andReturn(replayRenderer);
View Full Code Here

        setReplayRequest(wbRequest, "http://www.example.com/", "20100601000000");
        // closest SearchResult has isDuplicateDigest() == true.
        byte[] payload = "hogehogehogehoge\n".getBytes("UTF-8");
        Resource payloadResource = createTestHtmlResource("20100501000001", payload);
        Resource headerResource = createTestRevisitResource("20100601000000", payload.length, true);
        CaptureSearchResults results = setupCaptures(1, payloadResource, headerResource);

        CaptureSearchResult previous = results.getResults().get(0);
        CaptureSearchResult closest = results.getClosest();
//        previous.setFile("aaa.warc.gz");
//        previous.setOffset(0);
        closest.flagDuplicateDigest(previous); // right? TODO: could be done in setupCaptures()
        assertTrue(closest.isDuplicateDigest());
        assertTrue(closest.getDuplicatePayloadFile() != null);
View Full Code Here

        // to have isAnyEmbeddedContext() return true - any of cSSContext, iMGContext, jSContext
        // frameWrapperContext, iFrameWrapperContext, objectEmbedContext has the same effect.
        wbRequest.setCSSContext(true);
        assertTrue(wbRequest.isAnyEmbeddedContext());
       
        CaptureSearchResults results = setupCaptures(
                1,
                createTestHtmlResource("http://test.example.com/style.css",
                        "20100501000000", "hogheogehoge\n".getBytes("UTF-8")),
                createTest502Resource()
                );
        CaptureSearchResult closest = results.getClosest();
        assertTrue(closest.isHttpError());
       
        // or wbRequest.setBestLatestReplayRequest();
        final String expectedRedirectURI = "/web/20100501000000cs_/http://test.example.com/style.css";
        httpResponse.setHeader("Location", expectedRedirectURI);
View Full Code Here

        // calls handleQuery()
        // - calls queryIndex(), which calls collection.resourceIndex.query(),
        //     which returns CaptureSearchResults
        //   (unexpected object from queryIndex() results in WaybackException("Unknown index format").
        //    this is considered to be a programming/configuration error. not tested.)
        CaptureSearchResults results = new CaptureSearchResults();
        CaptureSearchResult result = new CaptureSearchResult();
        results.setClosest(result);
        EasyMock.expect(resourceIndex.query(wbRequest)).andReturn(results);
        // - calls MementoUtils.printTimemapResponse(results, wbRequest, httpResponse) instead
        //     if wbRequst.isMementoTimemapRequest() (N/A here) (TODO: can we move this to
        //     QueryRenderer implementation?)
        // - calls query.renderCaptureResults(...)
View Full Code Here

       
        // make sure wbRequesat.requestUrl, replayTimestamp are set up.
        setReplayRequest(wbRequest, "http://www.example.com/", "20100601000000");
        assertFalse(wbRequest.isMementoTimegate());
        Resource payloadResource = createTestHtmlResource("20100601000000", "hogehogehogehoge\n".getBytes("UTF-8"));
        CaptureSearchResults results = setupCaptures(
                0,
                payloadResource
                );
        CaptureSearchResult closest = results.getClosest();
       
        // when closest's timestamp == request's timestamp,
        // it gets ReplayRenderer with replay.getRenderer(wbRequest, closest, httpHeaderResource, payloadResource),
        // and calls renderResource() on it.
        EasyMock.expect(replay.getRenderer(wbRequest, closest, payloadResource, payloadResource)).andReturn(replayRenderer);
View Full Code Here

        // make sure wbRequesat.requestUrl, replayTimestamp are set up.
        setReplayRequest(wbRequest, "http://www.example.com/", "20100601123456");
        assertFalse(wbRequest.isMementoTimegate());
       
        Resource payloadResource = createTestHtmlResource("20100601000000", "hogehogehogehoge\n".getBytes("UTF-8"));
        CaptureSearchResults results = setupCaptures(0, payloadResource);
        // handleRequest()
        // calls handleReplay()
        // - calls checkInterstitialRedirect()
        // - calls selfRedirectCanonicalizer.urlStringToKey(requestURL) if non-null
        // - calls queryIndex(), which calls collection.resourceIndex.query(wbRequest)
View Full Code Here

        // calls handleQuery()
        // - calls queryIndex(), which calls collection.resourceIndex.query(),
        //     which returns CaptureSearchResults
        //   (unexpected object from queryIndex() results in WaybackException("Unknown index format").
        //    this is considered to be a programming/configuration error. not tested.)
        CaptureSearchResults results = new CaptureSearchResults();
        CaptureSearchResult result = new CaptureSearchResult();
        results.setClosest(result);
        EasyMock.expect(resourceIndex.query(wbRequest)).andReturn(results);
        // - calls MementoUtils.printTimemapResponse(results, wbRequest, httpResponse) instead
        //     if wbRequst.isMementoTimemapRequest() (N/A here) (TODO: can we move this to
        //     QueryRenderer implementation?)
        // - calls query.renderCaptureResults(...)
View Full Code Here

      CaptureSearchResult result = new FastCaptureSearchResult();
     
      r = this.getLiveWebResource(result, urlString);
     
      if (r != null) {       
        CaptureSearchResults results = new CaptureSearchResults();
        results.addSearchResult(result);
     
        wbRequest.setReplayTimestamp(result.getCaptureTimestamp());
         
        inner.getReplay().getRenderer(wbRequest, result, r).renderResource(httpRequest, httpResponse, wbRequest, result, r,
            inner.getUriConverter(), results)
View Full Code Here

  static Partitioner<Partition<CaptureSearchResult>> partitionPartitioner =
    new Partitioner<Partition<CaptureSearchResult>>(partitionMap);
 
  public BubbleCalendarData(UIResults results) {
    this.results = results;
    CaptureSearchResults cResults = results.getCaptureResults();
    WaybackRequest wbRequest = results.getWbRequest();
    StringFormatter fmt = wbRequest.getFormatter();
    String searchUrl =
      UrlOperations.stripDefaultPortFromUrl(wbRequest.getRequestUrl());

    searchUrlForHTML = fmt.escapeHtml(searchUrl);
    searchUrlForJS = fmt.escapeJavaScript(searchUrl);
    firstResultDate = cResults.getFirstResultDate();
    firstResultReplayUrl = fmt.escapeHtml(results.resultToReplayUrl(cResults.getResults().getFirst()));
    lastResultDate = cResults.getLastResultDate();
    lastResultReplayUrl = fmt.escapeHtml(results.resultToReplayUrl(cResults.getResults().getLast()));
    Date searchStartDate = wbRequest.getStartDate();
    Date searchEndDate = wbRequest.getEndDate();
    months = capturePartitioner.getRange(monthSize,searchStartDate,searchEndDate);
    years =  partitionPartitioner.getRange(yearSize,searchStartDate,searchEndDate);

   
    // To build the graph, we need to break all the results into 1 month
    // partitions, so partition all the results into the months:
    capturePartitioner.populate(months,cResults.iterator());
   
    // To fill in the calendar, we need to break the current year into day
    // sized partitions, so first partition those months into years:
    partitionPartitioner.populate(years,months.iterator());
    // find the active year:
    Partition<Partition<CaptureSearchResult>> activeYear = null;
    for(Partition<Partition<CaptureSearchResult>> year : years) {
      if(year.isContainsClosest()) {
        activeYear = year;
        break;
      }
    }
    // if there's no activeYear, something is quite wrong...
    // TODO: check anyways:
    if (activeYear == null) {
      activeYear = years.get(years.size() - 1);
    }
    String yearStr = fmt.format("{0,date,yyyy}",activeYear.getStart());
    yearNum = Integer.parseInt(yearStr);

    // now unroll the months in the active year into day-sized partitions:
    List<Partition<CaptureSearchResult>> days =
      capturePartitioner.getRange(daySize,
          activeYear.getStart(),activeYear.getEnd());
    for(Partition<CaptureSearchResult> month : activeYear.list()) {
      capturePartitioner.populate(days,month.iterator());
    }
    // finally, spool the days of the current year into 12 month-sized
    // partitions:
    monthsByDay = partitionPartitioner.getRange(monthSize, activeYear.getStart(), activeYear.getEnd());
    partitionPartitioner.populate(monthsByDay,days.iterator());
    dataStartMSSE = years.get(0).getStart().getTime();
    dataEndMSSE = years.get(years.size()-1).getEnd().getTime();
    numResults = cResults.getMatchingCount();
  }
View Full Code Here

TOP

Related Classes of org.archive.wayback.core.CaptureSearchResults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.