Package org.gitective.core.stat

Examples of org.gitective.core.stat.CommitCalendar


  /**
   * Test an empty calendar
   */
  @Test
  public void emptyCalendar() {
    CommitCalendar calendar = new CommitCalendar(new UserCommitActivity[0]);
    assertEquals(0, calendar.getCount());

    assertEquals(0, calendar.getDayCount(0));
    assertEquals(0, calendar.getHourCount(0));
    assertEquals(0, calendar.getMonthCount(0));

    assertNotNull(calendar.getYears());
    assertEquals(0, calendar.getYears().length);

    assertNotNull(calendar.getDays());
    assertEquals(YearCommitActivity.DAYS, calendar.getDays().length);
    for (int day : calendar.getDays())
      assertEquals(0, day);

    assertNotNull(calendar.getMonths());
    assertEquals(YearCommitActivity.MONTHS, calendar.getMonths().length);
    for (int month : calendar.getMonths())
      assertEquals(0, month);

    assertNotNull(calendar.getHours());
    assertEquals(YearCommitActivity.HOURS, calendar.getHours().length);
    for (int hour : calendar.getHours())
      assertEquals(0, hour);
  }
View Full Code Here


    CommitHistogramFilter filter = new AuthorHistogramFilter();
    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(filter).find();

    CommitCalendar cal = new CommitCalendar(filter.getHistogram()
        .getUserActivity());
    assertEquals(1, cal.getCount());

    GregorianCalendar commitTime = new GregorianCalendar();
    int month = commitTime.get(Calendar.MONTH);
    int day = commitTime.get(Calendar.DAY_OF_MONTH) - 1;
    int hour = commitTime.get(Calendar.HOUR_OF_DAY);
    commitTime.setTime(commit.getAuthorIdent().getWhen());
    assertEquals(1, cal.getDayCount(day));
    assertEquals(1, cal.getMonthCount(month));
    assertEquals(1, cal.getHourCount(hour));

    assertEquals(1, cal.getDays()[day]);
    assertEquals(1, cal.getMonths()[month]);
    assertEquals(1, cal.getHours()[hour]);

    assertEquals(1, cal.getYears().length);
    YearCommitActivity year = cal.getYears()[0];
    assertEquals(1, year.getCount());
    assertEquals(commitTime.get(Calendar.YEAR), year.getYear());
    assertNotNull(year.getMonths());
    assertEquals(1, year.getMonths()[month]);
    assertEquals(1, year.getMonthCount(Month.month(month)));
View Full Code Here

TOP

Related Classes of org.gitective.core.stat.CommitCalendar

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.