Package org.sonar.api.issue.internal

Examples of org.sonar.api.issue.internal.FieldDiffs$Diff


      if (c.isNew()) {
        IssueChangeDto changeDto = IssueChangeDto.of(c);
        mapper.insert(changeDto);
      }
    }
    FieldDiffs diffs = issue.currentChange();
    if (!issue.isNew() && diffs != null) {
      IssueChangeDto changeDto = IssueChangeDto.of(issue.key(), diffs);
      mapper.insert(changeDto);
    }
  }
View Full Code Here


    assertThat(dto.getUserLogin()).isEqualTo("emmerik");
  }

  @Test
  public void create_from_diff() throws Exception {
    FieldDiffs diffs = new FieldDiffs();
    diffs.setDiff("severity", "INFO", "BLOCKER");
    diffs.setUserLogin("emmerik");
    diffs.setCreationDate(DateUtils.parseDate("2014-01-03"));

    IssueChangeDto dto = IssueChangeDto.of("ABCDE", diffs);

    assertThat(dto.getChangeData()).isEqualTo("severity=INFO|BLOCKER");
    assertThat(dto.getChangeType()).isEqualTo("diff");
View Full Code Here

      .setUserLogin("emmerik")
      .setChangeData("Some text")
      .setIssueKey("ABCDE")
      .setIssueChangeCreationDate(new Date());

    FieldDiffs diffs = changeDto.toFieldDiffs();
    assertThat(diffs.userLogin()).isEqualTo("emmerik");
    assertThat(diffs.issueKey()).isEqualTo("ABCDE");
    assertThat(diffs.creationDate()).isNotNull();
  }
View Full Code Here

      .setUserLogin("emmerik")
      .setChangeData("Some text")
      .setIssueKey("ABCDE")
      .setCreatedAt(new Date());

    FieldDiffs diffs = changeDto.toFieldDiffs();
    assertThat(diffs.userLogin()).isEqualTo("emmerik");
    assertThat(diffs.issueKey()).isEqualTo("ABCDE");
    assertThat(diffs.creationDate()).isNotNull();
  }
View Full Code Here

  @CheckForNull
  private Long calculateNewTechnicalDebtValueFromChangelog(@Nullable Long currentTechnicalDebtValue, Issue issue, Date periodDate) {
    List<FieldDiffs> changelog = technicalDebtHistory(issue);
    for (Iterator<FieldDiffs> iterator = changelog.iterator(); iterator.hasNext(); ) {
      FieldDiffs diff = iterator.next();
      Date date = diff.creationDate();
      if (isLesserOrEqual(date, periodDate)) {
        // return new value from the change that is just before the period date
        return subtractNeverNegative(currentTechnicalDebtValue, newValue(diff));
      }
      if (!iterator.hasNext()) {
View Full Code Here

    Date date1 = DateUtils.parseDateTime("2014-02-22T19:10:03+0100");
    Date date2 = DateUtils.parseDateTime("2014-02-23T19:10:03+0100");

    List<User> users = Lists.<User>newArrayList(new DefaultUser().setLogin("john").setName("John"));
    FieldDiffs userChange = new FieldDiffs()
      .setUserLogin("john")
      .setDiff("actionPlan", null, "1.0")
      .setCreationDate(date1);
    FieldDiffs scanChange = new FieldDiffs()
      .setDiff("severity", "INFO", "BLOCKER")
      .setDiff("status", "REOPEN", "RESOLVED")
      .setCreationDate(date2);
    when(issueChangelogService.changelog(issue)).thenReturn(new IssueChangelog(newArrayList(userChange, scanChange), users));
    when(issueChangelogService.formatDiffs(userChange)).thenReturn(newArrayList("Action plan updated to 1.0"));
View Full Code Here

    verify(issueBulkChangeService).execute(any(IssueBulkChangeQuery.class), any(UserSession.class));
  }

  @Test
  public void format_changelog() {
    FieldDiffs fieldDiffs = new FieldDiffs();
    service.formatChangelog(fieldDiffs);
    verify(changelogService).formatDiffs(eq(fieldDiffs));
  }
View Full Code Here

    service = new IssueChangelogService(changeDao, userFinder, issueService, formatter);
  }

  @Test
  public void load_changelog_and_related_users() throws Exception {
    FieldDiffs userChange = new FieldDiffs().setUserLogin("arthur").setDiff("severity", "MAJOR", "BLOCKER");
    FieldDiffs scanChange = new FieldDiffs().setDiff("status", "RESOLVED", "CLOSED");
    when(changeDao.selectChangelogByIssue("ABCDE")).thenReturn(Arrays.asList(userChange, scanChange));
    User arthur = new DefaultUser().setLogin("arthur").setName("Arthur");
    when(userFinder.findByLogins(Arrays.asList("arthur"))).thenReturn(Arrays.asList(arthur));

    when(issueService.getByKey("ABCDE")).thenReturn(new DefaultIssue().setKey("ABCDE"));
View Full Code Here

    assertThat(changelog.user(userChange)).isSameAs(arthur);
  }

  @Test
  public void format_diffs() throws Exception {
    FieldDiffs diffs = new FieldDiffs().setUserLogin("arthur").setDiff("severity", "MAJOR", "BLOCKER");
    MockUserSession.set();
    service.formatDiffs(diffs);
    verify(formatter).format(any(Locale.class), eq(diffs));
  }
View Full Code Here

    formatter = new IssueChangelogFormatter(i18n, durations);
  }

  @Test
  public void format_field_diffs_with_new_and_old_value() {
    FieldDiffs diffs = new FieldDiffs();
    diffs.setDiff("severity", "BLOCKER", "INFO");

    when(i18n.message(DEFAULT_LOCALE, "issue.changelog.field.severity", null)).thenReturn("Severity");
    when(i18n.message(DEFAULT_LOCALE, "issue.changelog.changed_to", null, "Severity", "INFO")).thenReturn("Severity changed to INFO");
    when(i18n.message(DEFAULT_LOCALE, "issue.changelog.was", null, "BLOCKER")).thenReturn("was BLOCKER");
View Full Code Here

TOP

Related Classes of org.sonar.api.issue.internal.FieldDiffs$Diff

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.