Tabnine Logo
FieldDiffs.setUserUuid
Code IndexAdd Tabnine to your IDE (free)

How to use
setUserUuid
method
in
org.sonar.core.issue.FieldDiffs

Best Java code snippets using org.sonar.core.issue.FieldDiffs.setUserUuid (Showing top 20 results out of 315)

origin: SonarSource/sonarqube

/**
 * Copy a diff from another issue
 */
private static Optional<FieldDiffs> copyFieldDiffOfIssueFromOtherBranch(String issueKey, FieldDiffs c) {
 FieldDiffs result = new FieldDiffs();
 result.setIssueKey(issueKey);
 result.setUserUuid(c.userUuid());
 result.setCreationDate(c.creationDate());
 // Don't copy "file" changelogs as they refer to file uuids that might later be purged
 c.diffs().entrySet().stream().filter(e -> !e.getKey().equals(IssueFieldsSetter.FILE))
  .forEach(e -> result.setDiff(e.getKey(), e.getValue().oldValue(), e.getValue().newValue()));
 if (result.diffs().isEmpty()) {
  return Optional.empty();
 }
 return Optional.of(result);
}
origin: SonarSource/sonarqube

public DefaultIssue setFieldChange(IssueChangeContext context, String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) {
 if (!Objects.equals(oldValue, newValue)) {
  if (currentChange == null) {
   currentChange = new FieldDiffs();
   currentChange.setUserUuid(context.userUuid());
   currentChange.setCreationDate(context.date());
  }
  currentChange.setDiff(field, oldValue, newValue);
 }
 addChange(currentChange);
 return this;
}
origin: SonarSource/sonarqube

 public FieldDiffs toFieldDiffs() {
  return FieldDiffs.parse(changeData)
   .setUserUuid(userUuid)
   .setCreationDate(new Date(getIssueChangeCreationDate()))
   .setIssueKey(issueKey);
 }
}
origin: SonarSource/sonarqube

@Test
public void create_from_diff() {
 FieldDiffs diffs = new FieldDiffs();
 diffs.setDiff("severity", "INFO", "BLOCKER");
 diffs.setUserUuid("user_uuid");
 diffs.setCreationDate(parseDate("2015-01-13"));
 IssueChangeDto dto = IssueChangeDto.of("ABCDE", diffs);
 assertThat(dto.getChangeData()).isEqualTo("severity=INFO|BLOCKER");
 assertThat(dto.getChangeType()).isEqualTo("diff");
 assertThat(dto.getCreatedAt()).isNotNull();
 assertThat(dto.getUpdatedAt()).isNotNull();
 assertThat(dto.getIssueKey()).isEqualTo("ABCDE");
 assertThat(dto.getUserUuid()).isEqualTo("user_uuid");
 assertThat(dto.getIssueChangeCreationDate()).isEqualTo(parseDate("2015-01-13").getTime());
}
origin: SonarSource/sonarqube

@Test
public void create_from_diff_with_created_at() {
 FieldDiffs diffs = new FieldDiffs();
 diffs.setDiff("severity", "INFO", "BLOCKER");
 diffs.setUserUuid("user_uuid");
 diffs.setCreationDate(parseDate("2015-01-13"));
 IssueChangeDto dto = IssueChangeDto.of("ABCDE", diffs);
 assertThat(dto.getIssueChangeCreationDate()).isEqualTo(parseDate("2015-01-13").getTime());
}
origin: SonarSource/sonarqube

@Test
public void return_changelog_not_having_user() {
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(null).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).hasUser()).isFalse();
 assertThat(result.getChangelogList().get(0).hasUserName()).isFalse();
 assertThat(result.getChangelogList().get(0).hasAvatar()).isFalse();
 assertThat(result.getChangelogList().get(0).getDiffsList()).isNotEmpty();
}
origin: SonarSource/sonarqube

@Test
public void return_changelog_on_none_existing_user() {
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid("UNKNOWN").setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).hasUser()).isFalse();
 assertThat(result.getChangelogList().get(0).hasUserName()).isFalse();
 assertThat(result.getChangelogList().get(0).hasAvatar()).isFalse();
 assertThat(result.getChangelogList().get(0).getDiffsList()).isNotEmpty();
}
origin: SonarSource/sonarqube

@Test
public void return_changelog_when_no_new_value() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", null).setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).getDiffsList().get(0).hasNewValue()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void return_changelog_on_user_without_email() {
 UserDto user = db.users().insertUser(UserTesting.newUserDto("john", "John", null));
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).getUser()).isNotNull().isEqualTo(user.getLogin());
 assertThat(result.getChangelogList().get(0).getUserName()).isNotNull().isEqualTo(user.getName());
 assertThat(result.getChangelogList().get(0).hasAvatar()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void return_changelog_when_no_old_value() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", null, "BLOCKER").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).getDiffsList().get(0).hasOldValue()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void return_changelog() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).getUser()).isNotNull().isEqualTo(user.getLogin());
 assertThat(result.getChangelogList().get(0).getUserName()).isNotNull().isEqualTo(user.getName());
 assertThat(result.getChangelogList().get(0).getAvatar()).isNotNull().isEqualTo("93942e96f5acd83e2e047ad8fe03114d");
 assertThat(result.getChangelogList().get(0).getCreationDate()).isNotEmpty();
 assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue).containsOnly(tuple("severity", "MAJOR", "BLOCKER"));
}
origin: SonarSource/sonarqube

.setCreationDate(diffDate)
.setIssueKey("short")
.setUserUuid("user_uuid")
.setDiff("file", "uuidA1", "uuidB1"));
.setCreationDate(diffDate)
.setIssueKey("short")
.setUserUuid("user_uuid")
.setDiff("severity", "MINOR", "MAJOR")
.setDiff("file", "uuidA2", "uuidB2"));
origin: SonarSource/sonarqube

@Test
public void return_empty_changelog_when_not_member() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(0);
}
origin: SonarSource/sonarqube

@Test
public void replace_technical_debt_key_by_effort() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("technicalDebt", "10", "20").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue).containsOnly(tuple("effort", "10", "20"));
}
origin: SonarSource/sonarqube

@Test
public void return_many_changelog() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto,
  new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()),
  new FieldDiffs().setDiff("status", "RESOLVED", "CLOSED").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(2);
}
origin: SonarSource/sonarqube

@Test
public void return_multiple_diffs() {
 UserDto user = insertUser();
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid())
  .setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date())
  .setDiff("status", "RESOLVED", "CLOSED").setCreationDate(new Date()));
 ChangelogWsResponse result = call(issueDto.getKey());
 assertThat(result.getChangelogList()).hasSize(1);
 assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue)
  .containsOnly(tuple("severity", "MAJOR", "BLOCKER"), tuple("status", "RESOLVED", "CLOSED"));
}
origin: SonarSource/sonarqube

@Test
public void test_example() {
 UserDto user = db.users().insertUser(newUserDto("john.smith", "John Smith", "john@smith.com"));
 IssueDto issueDto = db.issues().insertIssue(newIssue());
 userSession.logIn("john")
  .addMembership(db.getDefaultOrganization())
  .addProjectPermission(USER, project, file);
 db.issues().insertFieldDiffs(issueDto, new FieldDiffs()
  .setUserUuid(user.getUuid())
  .setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date())
  .setCreationDate(DateUtils.parseDateTime("2014-03-04T23:03:44+0100")));
 String result = tester.newRequest().setParam("issue", issueDto.getKey()).execute().getInput();
 assertJson(result).isSimilarTo(getClass().getResource("changelog-example.json"));
}
origin: SonarSource/sonarqube

.setCurrentChange(new FieldDiffs()
 .setIssueKey("ISSUE")
 .setUserUuid("john_uuid")
 .setDiff("technicalDebt", null, 1L)
 .setCreationDate(new Date(NOW))))
origin: SonarSource/sonarqube

new FieldDiffs()
 .setIssueKey("ISSUE")
 .setUserUuid("john_uuid")
 .setDiff("technicalDebt", null, 1L)
 .setCreationDate(new Date(NOW))))
origin: org.sonarsource.sonarqube/sonar-core

public DefaultIssue setFieldChange(IssueChangeContext context, String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) {
 if (!Objects.equals(oldValue, newValue)) {
  if (currentChange == null) {
   currentChange = new FieldDiffs();
   currentChange.setUserUuid(context.userUuid());
   currentChange.setCreationDate(context.date());
  }
  currentChange.setDiff(field, oldValue, newValue);
 }
 addChange(currentChange);
 return this;
}
org.sonar.core.issueFieldDiffssetUserUuid

Popular methods of FieldDiffs

  • setCreationDate
  • creationDate
  • diffs
  • setDiff
  • <init>
  • get
  • userUuid
  • parse
  • setIssueKey
  • toEncodedString
  • containsCharToEscape
  • decode
  • containsCharToEscape,
  • decode,
  • decodeField,
  • encodeField,
  • isEncoded,
  • issueKey,
  • serialize,
  • shouldEncode,
  • toString

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now