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

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

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

origin: SonarSource/sonarqube

private Set<String> getFileUuids(List<FieldDiffs> changes) {
 return changes.stream()
  .filter(diffs -> diffs.diffs().containsKey(FILE))
  .flatMap(diffs -> Stream.of(diffs.get(FILE).newValue().toString(), diffs.get(FILE).oldValue().toString()))
  .collect(MoreCollectors.toSet());
}
origin: SonarSource/sonarqube

@CheckForNull
private StatusAndResolutionDiffs parse(FieldDiffs fieldDiffs) {
 FieldDiffs.Diff status = fieldDiffs.get("status");
 if (status == null) {
  return null;
 }
 FieldDiffs.Diff resolution = fieldDiffs.get("resolution");
 if (resolution == null) {
  return new StatusAndResolutionDiffs(Issue.STATUS_CLOSED.equals(status.newValue()), null, null);
 }
 return new StatusAndResolutionDiffs(Issue.STATUS_CLOSED.equals(status.newValue()), (String) resolution.oldValue(), (String) resolution.newValue());
}
origin: SonarSource/sonarqube

@Test
public void get_with_assignee() {
 diffs.setDiff("assignee", "oldAssignee", NAME_WITH_RESERVED_CHARS);
 FieldDiffs.Diff diff = diffs.get("assignee");
 assertThat(diff.oldValue()).isEqualTo("oldAssignee");
 assertThat(diff.newValue()).isEqualTo(NAME_WITH_RESERVED_CHARS);
}
origin: SonarSource/sonarqube

@Test
public void set_new_assignee() {
 boolean updated = underTest.setNewAssignee(issue, "user_uuid", context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isEqualTo("user_uuid");
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isEqualTo("user_uuid");
}
origin: SonarSource/sonarqube

@Test
public void set_resolution() {
 boolean updated = underTest.setResolution(issue, "OPEN", context);
 assertThat(updated).isTrue();
 assertThat(issue.resolution()).isEqualTo("OPEN");
 FieldDiffs.Diff diff = issue.currentChange().get(RESOLUTION);
 assertThat(diff.oldValue()).isNull();
 assertThat(diff.newValue()).isEqualTo("OPEN");
 assertThat(issue.mustSendNotifications()).isTrue();
}
origin: SonarSource/sonarqube

@Test
public void set_manual_severity() {
 issue.setSeverity("BLOCKER");
 boolean updated = underTest.setManualSeverity(issue, "MINOR", context);
 assertThat(updated).isTrue();
 assertThat(issue.severity()).isEqualTo("MINOR");
 assertThat(issue.manualSeverity()).isTrue();
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(SEVERITY);
 assertThat(diff.oldValue()).isEqualTo("BLOCKER");
 assertThat(diff.newValue()).isEqualTo("MINOR");
}
origin: SonarSource/sonarqube

@Test
public void set_past_severity() {
 issue.setSeverity("BLOCKER");
 boolean updated = underTest.setPastSeverity(issue, "INFO", context);
 assertThat(updated).isTrue();
 assertThat(issue.severity()).isEqualTo("BLOCKER");
 assertThat(issue.mustSendNotifications()).isFalse();
 FieldDiffs.Diff diff = issue.currentChange().get(SEVERITY);
 assertThat(diff.oldValue()).isEqualTo("INFO");
 assertThat(diff.newValue()).isEqualTo("BLOCKER");
}
origin: SonarSource/sonarqube

@Test
public void update_severity() {
 issue.setSeverity("BLOCKER");
 boolean updated = underTest.setSeverity(issue, "MINOR", context);
 assertThat(updated).isTrue();
 assertThat(issue.severity()).isEqualTo("MINOR");
 assertThat(issue.mustSendNotifications()).isFalse();
 FieldDiffs.Diff diff = issue.currentChange().get(SEVERITY);
 assertThat(diff.oldValue()).isEqualTo("BLOCKER");
 assertThat(diff.newValue()).isEqualTo("MINOR");
}
origin: SonarSource/sonarqube

@Test
public void set_new_author() {
 boolean updated = underTest.setNewAuthor(issue, "simon", context);
 assertThat(updated).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get("author");
 assertThat(diff.oldValue()).isNull();
 assertThat(diff.newValue()).isEqualTo("simon");
 assertThat(issue.mustSendNotifications()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void set_new_attribute_value() {
 boolean updated = underTest.setAttribute(issue, "JIRA", "FOO-123", context);
 assertThat(updated).isTrue();
 assertThat(issue.attribute("JIRA")).isEqualTo("FOO-123");
 assertThat(issue.currentChange().diffs()).hasSize(1);
 assertThat(issue.currentChange().get("JIRA").oldValue()).isNull();
 assertThat(issue.currentChange().get("JIRA").newValue()).isEqualTo("FOO-123");
 assertThat(issue.mustSendNotifications()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void set_severity() {
 boolean updated = underTest.setSeverity(issue, "BLOCKER", context);
 assertThat(updated).isTrue();
 assertThat(issue.severity()).isEqualTo("BLOCKER");
 assertThat(issue.manualSeverity()).isFalse();
 assertThat(issue.mustSendNotifications()).isFalse();
 FieldDiffs.Diff diff = issue.currentChange().get(SEVERITY);
 assertThat(diff.oldValue()).isNull();
 assertThat(diff.newValue()).isEqualTo("BLOCKER");
}
origin: SonarSource/sonarqube

@Test
public void set_status() {
 boolean updated = underTest.setStatus(issue, "OPEN", context);
 assertThat(updated).isTrue();
 assertThat(issue.status()).isEqualTo("OPEN");
 FieldDiffs.Diff diff = issue.currentChange().get(STATUS);
 assertThat(diff.oldValue()).isNull();
 assertThat(diff.newValue()).isEqualTo("OPEN");
 assertThat(issue.mustSendNotifications()).isTrue();
}
origin: SonarSource/sonarqube

@Test
public void set_author() {
 boolean updated = underTest.setAuthorLogin(issue, "eric", context);
 assertThat(updated).isTrue();
 assertThat(issue.authorLogin()).isEqualTo("eric");
 FieldDiffs.Diff diff = issue.currentChange().get("author");
 assertThat(diff.oldValue()).isNull();
 assertThat(diff.newValue()).isEqualTo("eric");
 assertThat(issue.mustSendNotifications()).isFalse();
}
origin: SonarSource/sonarqube

@Test
public void set_past_technical_debt_without_previous_value() {
 Duration newDebt = Duration.create(15 * 8 * 60);
 issue.setEffort(newDebt);
 boolean updated = underTest.setPastEffort(issue, null, context);
 assertThat(updated).isTrue();
 assertThat(issue.effort()).isEqualTo(newDebt);
 assertThat(issue.mustSendNotifications()).isFalse();
 FieldDiffs.Diff diff = issue.currentChange().get(TECHNICAL_DEBT);
 assertThat(diff.oldValue()).isNull();
 assertThat(diff.newValue()).isEqualTo(15L * 8 * 60);
}
origin: SonarSource/sonarqube

@Test
public void set_past_technical_debt() {
 Duration newDebt = Duration.create(15 * 8 * 60);
 Duration previousDebt = Duration.create(10 * 8 * 60);
 issue.setEffort(newDebt);
 boolean updated = underTest.setPastEffort(issue, previousDebt, context);
 assertThat(updated).isTrue();
 assertThat(issue.effort()).isEqualTo(newDebt);
 assertThat(issue.mustSendNotifications()).isFalse();
 FieldDiffs.Diff diff = issue.currentChange().get(TECHNICAL_DEBT);
 assertThat(diff.oldValue()).isEqualTo(10L * 8 * 60);
 assertThat(diff.newValue()).isEqualTo(15L * 8 * 60);
}
origin: SonarSource/sonarqube

@Test
public void assign() {
 UserDto user = newUserDto().setLogin("emmerik").setName("Emmerik");
 boolean updated = underTest.assign(issue, user, context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isEqualTo(user.getUuid());
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isEqualTo(user.getName());
}
origin: SonarSource/sonarqube

@Test
public void change_assignee() {
 UserDto user = newUserDto().setLogin("emmerik").setName("Emmerik");
 issue.setAssigneeUuid("user_uuid");
 boolean updated = underTest.assign(issue, user, context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isEqualTo(user.getUuid());
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isEqualTo(user.getName());
}
origin: SonarSource/sonarqube

@Test
public void unassign() {
 issue.setAssigneeUuid("user_uuid");
 boolean updated = underTest.assign(issue, null, context);
 assertThat(updated).isTrue();
 assertThat(issue.assignee()).isNull();
 assertThat(issue.mustSendNotifications()).isTrue();
 FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
 assertThat(diff.oldValue()).isEqualTo(UNUSED);
 assertThat(diff.newValue()).isNull();
}
origin: SonarSource/sonarqube

@Test
public void set_past_technical_debt_with_null_new_value() {
 issue.setEffort(null);
 Duration previousDebt = Duration.create(10 * 8 * 60);
 boolean updated = underTest.setPastEffort(issue, previousDebt, context);
 assertThat(updated).isTrue();
 assertThat(issue.effort()).isNull();
 assertThat(issue.mustSendNotifications()).isFalse();
 FieldDiffs.Diff diff = issue.currentChange().get(TECHNICAL_DEBT);
 assertThat(diff.oldValue()).isEqualTo(10L * 8 * 60);
 assertThat(diff.newValue()).isNull();
}
origin: SonarSource/sonarqube

@Test
public void unset_attribute() {
 issue.setAttribute("JIRA", "FOO-123");
 boolean updated = underTest.setAttribute(issue, "JIRA", null, context);
 assertThat(updated).isTrue();
 assertThat(issue.attribute("JIRA")).isNull();
 assertThat(issue.currentChange().diffs()).hasSize(1);
 assertThat(issue.currentChange().get("JIRA").oldValue()).isEqualTo("FOO-123");
 assertThat(issue.currentChange().get("JIRA").newValue()).isNull();
 assertThat(issue.mustSendNotifications()).isFalse();
}
org.sonar.core.issueFieldDiffsget

Popular methods of FieldDiffs

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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