Search in sources :

Example 1 with HashtagsInput

use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.

the class HashtagsIT method addHashtags.

private void addHashtags(PushOneCommit.Result r, String... toAdd) throws Exception {
    HashtagsInput input = new HashtagsInput();
    input.add = Sets.newHashSet(toAdd);
    change(r).setHashtags(input);
}
Also used : HashtagsInput(com.google.gerrit.extensions.api.changes.HashtagsInput)

Example 2 with HashtagsInput

use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.

the class HashtagsIT method removeHashtags.

private void removeHashtags(PushOneCommit.Result r, String... toRemove) throws Exception {
    HashtagsInput input = new HashtagsInput();
    input.remove = Sets.newHashSet(toRemove);
    change(r).setHashtags(input);
}
Also used : HashtagsInput(com.google.gerrit.extensions.api.changes.HashtagsInput)

Example 3 with HashtagsInput

use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.

the class AbstractQueryChangesTest method addHashtags.

private void addHashtags(Change.Id changeId, String... hashtags) throws Exception {
    HashtagsInput in = new HashtagsInput();
    in.add = ImmutableSet.copyOf(hashtags);
    gApi.changes().id(changeId.get()).setHashtags(in);
}
Also used : HashtagsInput(com.google.gerrit.extensions.api.changes.HashtagsInput)

Example 4 with HashtagsInput

use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.

the class AttentionSetIT method reviewersAreNotAddedForNoReasonBecauseOfAnUpdate.

@Test
public void reviewersAreNotAddedForNoReasonBecauseOfAnUpdate() throws Exception {
    PushOneCommit.Result r = createChange();
    // implictly adds the user to the attention set when adding as reviewer
    change(r).addReviewer(user.email());
    change(r).attention(user.id().toString()).remove(new AttentionSetInput("removed"));
    HashtagsInput hashtagsInput = new HashtagsInput();
    hashtagsInput.add = ImmutableSet.of("tag");
    change(r).setHashtags(hashtagsInput);
    AttentionSetUpdate attentionSet = Iterables.getOnlyElement(r.getChange().attentionSet());
    assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
    assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
    assertThat(attentionSet).hasReasonThat().isEqualTo("removed");
}
Also used : HashtagsInput(com.google.gerrit.extensions.api.changes.HashtagsInput) AttentionSetInput(com.google.gerrit.extensions.api.changes.AttentionSetInput) AttentionSetUpdate(com.google.gerrit.entities.AttentionSetUpdate) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 5 with HashtagsInput

use of com.google.gerrit.extensions.api.changes.HashtagsInput in project gerrit by GerritCodeReview.

the class GetMetaDiffIT method metaDiff.

@Test
public void metaDiff() throws Exception {
    PushOneCommit.Result ch = createChange();
    ChangeApi chApi = gApi.changes().id(ch.getChangeId());
    chApi.topic(TOPIC);
    ChangeInfo oldInfo = chApi.get();
    chApi.topic(TOPIC + "-2");
    chApi.setHashtags(new HashtagsInput(ImmutableSet.of(HASHTAG)));
    ChangeInfo newInfo = chApi.get();
    ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, newInfo.metaRevId);
    assertThat(difference.added().topic).isEqualTo(newInfo.topic);
    assertThat(difference.added().hashtags).isNotNull();
    assertThat(difference.added().hashtags).containsExactly(HASHTAG);
    assertThat(difference.removed().topic).isEqualTo(oldInfo.topic);
    assertThat(difference.removed().hashtags).isNull();
}
Also used : ChangeInfoDifference(com.google.gerrit.extensions.common.ChangeInfoDifference) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) HashtagsInput(com.google.gerrit.extensions.api.changes.HashtagsInput) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Aggregations

HashtagsInput (com.google.gerrit.extensions.api.changes.HashtagsInput)7 Test (org.junit.Test)4 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)3 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)3 Registration (com.google.gerrit.acceptance.ExtensionRegistry.Registration)1 FakeSubmitRule (com.google.gerrit.acceptance.FakeSubmitRule)1 AttentionSetUpdate (com.google.gerrit.entities.AttentionSetUpdate)1 Change (com.google.gerrit.entities.Change)1 AttentionSetInput (com.google.gerrit.extensions.api.changes.AttentionSetInput)1 ChangeApi (com.google.gerrit.extensions.api.changes.ChangeApi)1 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)1 ChangeInfoDifference (com.google.gerrit.extensions.common.ChangeInfoDifference)1 Repo (com.google.gerrit.testing.InMemoryRepositoryManager.Repo)1