Examples of PageHistory


Examples of com.cloudera.recordbreaker.analyzer.PageHistory

     * when there is a valid FID and a valid filesystem
     */
    public FilePageDisplay(String name, final String fidStr) {
      super(name);
      FishEye fe = FishEye.getInstance();
      final PageHistory history = PageHistory.get();
      final List<JoinPair> joinPairs = new ArrayList<JoinPair>();
      List<Long> historyFids = history.getRecentFids();
      List<String> historyPaths = history.getRecentPaths();
      for (int i = 0; i < historyFids.size(); i++) {
        joinPairs.add(new JoinPair("" + historyFids.get(i), historyPaths.get(i)));
      }

      if (fe.hasFSAndCrawl()) {
        if (fidStr != null) {
          try {
            this.fid = Long.parseLong(fidStr);
            final FileSummary fs = new FileSummary(fe.getAnalyzer(), fid);
            final long fsFid = fid;
            final String fsPath = fs.getPath().toString();
           
            FSAnalyzer fsa = fe.getAnalyzer();
            FileSummaryData fsd = fsa.getFileSummaryData(fid);
            DataDescriptor dd = fsd.getDataDescriptor();
            List<TypeGuessSummary> tgses = fs.getTypeGuesses();
           
            add(new Label("filetitle", fs.getFname()));
            add(new ExternalLink("filesubtitlelink", urlFor(FilesPage.class, new PageParameters("targetdir=" + fs.getPath().getParent().toString())).toString(), fs.getPath().getParent().toString()));
            // Set up the download file link
            IResourceStream hadoopfsStream = new AbstractResourceStreamWriter() {
                public void write(Response output) {
                  WebResponse weboutput = (WebResponse) output;
                  try {
                    BufferedInputStream in = new BufferedInputStream(new FileSummary(FishEye.getInstance().getAnalyzer(), fid).getRawBytes());
                    try {
                      byte buf[] = new byte[4096];
                      int contentLen = -1;
                      while ((contentLen = in.read(buf)) >= 0) {
                        weboutput.write(buf, 0, contentLen);
                      }
                    } finally {
                      try {
                        in.close();
                      } catch (IOException iex) {
                      }
                    }
                  } catch (IOException iex) {
                    iex.printStackTrace();
                  }
                }
                public Bytes length() {
                  return Bytes.bytes(new FileSummary(FishEye.getInstance().getAnalyzer(), fid).getSize());
                }
              };
            ResourceStreamResource resourceStream = new ResourceStreamResource(hadoopfsStream);
            resourceStream.setContentDisposition(ContentDisposition.ATTACHMENT);
            resourceStream.setFileName(fs.getFname());
            add(new ResourceLink<File>("downloadlink", resourceStream));

            // querySupported container holds queryform
            // queryUnsupported container holds an error message
            final boolean querySupported = dd.isHiveSupported() && fe.isQueryServerAvailable(false);
            final boolean hasJoins = joinPairs.size() > 0;
            add(new WebMarkupContainer("querySupported") {
                {
                  setOutputMarkupPlaceholderTag(true);
                  setVisibilityAllowed(querySupported);
                  add(new QueryForm("queryform", new ValueMap(), fid));
                  history.visitNewPage(fsFid, fsPath);

                  // Add support for join-choices here
                  add(new WebMarkupContainer("hasJoins") {
                      {
                        setOutputMarkupPlaceholderTag(true);
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

  @Test
  public void pageDirectoryWithNoResultsShouldShowNoHistory() throws Exception {
    addPageDirectory("SomePage");
    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("SomePage");
    assertNull(pageHistory);
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

  @Test
  public void pageDirectoryWithOneResultShouldShowOneHistoryRecord() throws Exception {
    addPageDirectoryWithOneResult("SomePage", "20090418123103_1_2_3_4");

    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("SomePage");
    assertEquals(1, pageHistory.getFailures());
    assertEquals(0, pageHistory.getPasses());

    Date date = dateFormat.parse("20090418123103");
    assertEquals(date, pageHistory.getMinDate());
    assertEquals(date, pageHistory.getMaxDate());
    assertEquals(1, pageHistory.size());
    TestResultRecord testSummary = pageHistory.get(date);
    assertEquals(date, testSummary.getDate());
    assertEquals(new TestSummary(1, 2, 3, 4), testSummary);
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

    File pageDirectory = addPageDirectory("SomePage");
    addTestResult(pageDirectory, "20090418000000_1_0_0_0");
    addTestResult(pageDirectory, "20090419000000_1_1_0_0");
    addTestResult(pageDirectory, "20090417000000_1_0_0_1");
    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("SomePage");
    assertEquals(3, pageHistory.size());
    assertEquals(dateFormat.parse("20090417000000"), pageHistory.getMinDate());
    assertEquals(dateFormat.parse("20090419000000"), pageHistory.getMaxDate());
    assertEquals(1, pageHistory.getPasses());
    assertEquals(2, pageHistory.getFailures());
    assertEquals(new TestSummary(1, 0, 0, 0), pageHistory.get(dateFormat.parse("20090418000000")));
    assertEquals(new TestSummary(1, 1, 0, 0), pageHistory.get(dateFormat.parse("20090419000000")));
    assertEquals(new TestSummary(1, 0, 0, 1), pageHistory.get(dateFormat.parse("20090417000000")));
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

    File pageDirectory = addPageDirectory("SomePage");
    for (String fileName : testResultFilenames)
      addTestResult(pageDirectory, fileName);

    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("SomePage");
    BarGraph barGraph = pageHistory.getBarGraph();
    return barGraph;
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

    addTestResult(pageDirectory, "20090602000000_1_0_0_0_0_0"); //bad
    addTestResult(pageDirectory, "bad_file_page_thing");        //bad

    makeResponse();
    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("SomePage");
    assertEquals(3, pageHistory.size());
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

    File pageDirectory = addPageDirectory("SomePage");
    addTestResult(pageDirectory, "20090614000000_1_0_0_0");
    addTestResult(pageDirectory, "20090615000000_1_0_0_0");

    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("SomePage");
    assertEquals(2, pageHistory.size());
    responder.deleteTestHistoryOlderThanDays(1);
    history.readHistoryDirectory(resultsDirectory);
    pageHistory = history.getPageHistory("SomePage");
    assertEquals(1, pageHistory.size());
    assertNotNull(pageHistory.get(makeDate("20090615000000")));
    assertNull(pageHistory.get(makeDate("20090614000000")));
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

  public void pageHistoryShouldHaveStatsForOneTestIfOnePageHistoryFileIsPresent() throws Exception {
    File pageDirectory = addPageDirectory("TestPage");
    addTestResult(pageDirectory, "20090418123103_1_2_3_4");

    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("TestPage");
    assertEquals(1, pageHistory.size());
    assertEquals(7, pageHistory.maxAssertions());
    SortedSet<Date> dates = pageHistory.datesInChronologicalOrder();
    assertEquals(1, dates.size());
    Date date = dateFormat.parse("20090418123103");
    assertEquals(date, dates.first());
    PageHistory.PassFailBar passFailBar = pageHistory.getPassFailBar(date, 50);
    assertEquals(1, passFailBar.getPass());
    assertEquals(6, passFailBar.getFail());
    assertEquals(7, passFailBar.getPassUnits());
    assertEquals(43, passFailBar.getFailUnits());
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

    File pageDirectory = addPageDirectory("TestPage");
    addTestResult(pageDirectory, "20090503110451_6_5_3_1");
    addTestResult(pageDirectory, "20090418123103_1_2_3_4");

    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("TestPage");
    assertEquals(2, pageHistory.size());
    assertEquals(12, pageHistory.maxAssertions());
    SortedSet<Date> dates = pageHistory.datesInChronologicalOrder();
    assertEquals(2, dates.size());
    Date date1 = dateFormat.parse("20090418123103");
    Date date2 = dateFormat.parse("20090503110451");
    Date[] dateArray = dates.toArray(new Date[dates.size()]);
    assertEquals(date1, dateArray[1]);
    assertEquals(date2, dateArray[0]);
    PageHistory.PassFailBar passFailBar = pageHistory.getPassFailBar(date1, 50);
    assertEquals(1, passFailBar.getPass());
    assertEquals(6, passFailBar.getFail());
    assertEquals(4, passFailBar.getPassUnits());
    assertEquals(25, passFailBar.getFailUnits());
    passFailBar = pageHistory.getPassFailBar(date2, 50);
    assertEquals(6, passFailBar.getPass());
    assertEquals(6, passFailBar.getFail());
    assertEquals(25, passFailBar.getPassUnits());
    assertEquals(25, passFailBar.getFailUnits());
  }
View Full Code Here

Examples of fitnesse.reporting.history.PageHistory

  private PageHistory.PassFailBar computePassFailBarFor(int right, int wrong, int ignores, int exceptions) throws IOException, ParseException {
    File pageDirectory = addPageDirectory("TestPage");
    addTestResult(pageDirectory, String.format("20090503110451_%d_%d_%d_%d", right, wrong, ignores, exceptions));
    history.readHistoryDirectory(resultsDirectory);
    PageHistory pageHistory = history.getPageHistory("TestPage");
    Date date = dateFormat.parse("20090503110451");
    PageHistory.PassFailBar passFailBar = pageHistory.getPassFailBar(date, 50);
    return passFailBar;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.