use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.
the class HashtagsIT method addAndRemove.
@Test
public void addAndRemove() throws Exception {
// Adding and remove hashtags in a single request performs correctly.
PushOneCommit.Result r = createChange();
addHashtags(r, "tag1", "tag2");
HashtagsInput input = new HashtagsInput();
input.add = Sets.newHashSet("tag3", "tag4");
input.remove = Sets.newHashSet("tag1");
change(r).setHashtags(input);
assertThatGet(r).containsExactly("tag2", "tag3", "tag4");
assertMessage(r, "Hashtags added: tag3, tag4\nHashtag removed: tag1");
// Adding and removing the same hashtag actually removes it.
addHashtags(r, "tag1", "tag2");
input = new HashtagsInput();
input.add = Sets.newHashSet("tag3", "tag4");
input.remove = Sets.newHashSet("tag3");
change(r).setHashtags(input);
assertThatGet(r).containsExactly("tag1", "tag2", "tag4");
assertMessage(r, "Hashtag removed: tag3");
}
use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method bySubmitRuleResult.
@Test
public void bySubmitRuleResult() throws Exception {
if (getSchemaVersion() < 68) {
assertMissingField(ChangeField.SUBMIT_RULE_RESULT);
return;
}
try (Registration registration = extensionRegistry.newRegistration().add(new FakeSubmitRule())) {
TestRepository<Repo> repo = createProject("repo");
Change change = insert(repo, newChange(repo));
// The fake submit rule exports its ruleName as "FakeSubmitRule"
assertQuery("rule:FakeSubmitRule");
// FakeSubmitRule returns true if change has one or more hashtags.
HashtagsInput hashtag = new HashtagsInput();
hashtag.add = ImmutableSet.of("Tag1");
gApi.changes().id(change.getId().get()).setHashtags(hashtag);
assertQuery("rule:FakeSubmitRule", change);
assertQuery("rule:FakeSubmitRule=OK", change);
assertQuery("rule:FakeSubmitRule=NOT_READY");
}
}
Aggregations