use of com.google.gerrit.extensions.common.RobotCommentInfo in project gerrit by GerritCodeReview.
the class ChangesRestApiBindingsIT method fixEndpoints.
@Test
public void fixEndpoints() throws Exception {
String changeId = createChange("Subject", FILENAME, "content").getChangeId();
RobotCommentInput robotCommentInput = new RobotCommentInput();
robotCommentInput.robotId = "happyRobot";
robotCommentInput.robotRunId = "1";
robotCommentInput.line = 1;
robotCommentInput.message = "nit: trailing whitespace";
robotCommentInput.path = FILENAME;
FixReplacementInfo fixReplacementInfo = new FixReplacementInfo();
fixReplacementInfo.path = FILENAME;
fixReplacementInfo.replacement = "some replacement code";
fixReplacementInfo.range = createRange(1, 1, 1, 2);
FixSuggestionInfo fixSuggestionInfo = new FixSuggestionInfo();
fixSuggestionInfo.fixId = "An ID which must be overwritten.";
fixSuggestionInfo.description = "A description for a suggested fix.";
fixSuggestionInfo.replacements = ImmutableList.of(fixReplacementInfo);
robotCommentInput.fixSuggestions = ImmutableList.of(fixSuggestionInfo);
ReviewInput reviewInput = new ReviewInput();
reviewInput.robotComments = Collections.singletonMap(robotCommentInput.path, ImmutableList.of(robotCommentInput));
reviewInput.message = "robot comment test";
gApi.changes().id(changeId).current().review(reviewInput);
List<RobotCommentInfo> robotCommentInfos = gApi.changes().id(changeId).current().robotCommentsAsList();
List<String> fixIds = getFixIds(robotCommentInfos);
String fixId = Iterables.getOnlyElement(fixIds);
RestApiCallHelper.execute(adminRestSession, FIX_ENDPOINTS, changeId, "current", fixId);
}
use of com.google.gerrit.extensions.common.RobotCommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method robotCommentIsCreatedWithProperty.
@Test
public void robotCommentIsCreatedWithProperty() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().addProperty("key", "value").create();
RobotCommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
assertThat(comment).properties().containsExactly("key", "value");
}
use of com.google.gerrit.extensions.common.RobotCommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method robotCommentIsCreatedWithUrl.
@Test
public void robotCommentIsCreatedWithUrl() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().url("url").create();
RobotCommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
assertThat(comment).url().isEqualTo("url");
}
use of com.google.gerrit.extensions.common.RobotCommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method robotCommentIsCreatedWithRobotRunId.
@Test
public void robotCommentIsCreatedWithRobotRunId() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().robotId("robot-run-id").create();
RobotCommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
assertThat(comment).robotId().isEqualTo("robot-run-id");
}
Aggregations