Search in sources :

Example 96 with Change

use of com.google.gerrit.entities.Change in project gerrit by GerritCodeReview.

the class EventJsonTest method changeAbandonedEvent.

@Test
public void changeAbandonedEvent() {
    Change change = newChange();
    ChangeAbandonedEvent event = new ChangeAbandonedEvent(change);
    event.change = asChangeAttribute(change);
    event.abandoner = newAccount("abandoner");
    event.reason = "some reason";
    assertThatJsonMap(event).isEqualTo(ImmutableMap.builder().put("abandoner", ImmutableMap.builder().put("name", event.abandoner.get().name).put("email", event.abandoner.get().email).put("username", event.abandoner.get().username).build()).put("reason", "some reason").put("change", ImmutableMap.builder().put("project", PROJECT).put("branch", BRANCH).put("id", CHANGE_ID).put("number", CHANGE_NUM_DOUBLE).put("url", URL).put("commitMessage", COMMIT_MESSAGE).put("createdOn", TS1).put("status", NEW.name()).build()).put("project", PROJECT).put("refName", REF).put("changeKey", map("id", CHANGE_ID)).put("type", "change-abandoned").put("eventCreatedOn", TS2).build());
}
Also used : Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Example 97 with Change

use of com.google.gerrit.entities.Change in project gerrit by GerritCodeReview.

the class EventJsonTest method topicChangedEvent.

@Test
public void topicChangedEvent() {
    Change change = newChange();
    TopicChangedEvent event = new TopicChangedEvent(change);
    event.change = asChangeAttribute(change);
    assertThatJsonMap(event).isEqualTo(ImmutableMap.builder().put("change", ImmutableMap.builder().put("project", PROJECT).put("branch", BRANCH).put("id", CHANGE_ID).put("number", CHANGE_NUM_DOUBLE).put("url", URL).put("commitMessage", COMMIT_MESSAGE).put("createdOn", TS1).put("status", NEW.name()).build()).put("project", PROJECT).put("refName", REF).put("changeKey", map("id", CHANGE_ID)).put("type", "topic-changed").put("eventCreatedOn", TS2).build());
}
Also used : Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Example 98 with Change

use of com.google.gerrit.entities.Change in project gerrit by GerritCodeReview.

the class EventJsonTest method patchSetCreatedEvent.

@Test
public void patchSetCreatedEvent() {
    Change change = newChange();
    PatchSetCreatedEvent event = new PatchSetCreatedEvent(change);
    event.change = asChangeAttribute(change);
    event.uploader = newAccount("uploader");
    assertThatJsonMap(event).isEqualTo(ImmutableMap.builder().put("uploader", ImmutableMap.builder().put("name", event.uploader.get().name).put("email", event.uploader.get().email).put("username", event.uploader.get().username).build()).put("change", ImmutableMap.builder().put("project", PROJECT).put("branch", BRANCH).put("id", CHANGE_ID).put("number", CHANGE_NUM_DOUBLE).put("url", URL).put("commitMessage", COMMIT_MESSAGE).put("createdOn", TS1).put("status", NEW.name()).build()).put("project", PROJECT).put("refName", REF).put("changeKey", map("id", CHANGE_ID)).put("type", "patchset-created").put("eventCreatedOn", TS2).build());
}
Also used : Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Example 99 with Change

use of com.google.gerrit.entities.Change in project gerrit by GerritCodeReview.

the class EventJsonTest method hashtagsChangedEvent.

@Test
public void hashtagsChangedEvent() {
    Change change = newChange();
    HashtagsChangedEvent event = new HashtagsChangedEvent(change);
    event.change = asChangeAttribute(change);
    event.editor = newAccount("editor");
    event.added = new String[] { "added" };
    event.removed = new String[] { "removed" };
    event.hashtags = new String[] { "hashtags" };
    assertThatJsonMap(event).isEqualTo(ImmutableMap.builder().put("editor", ImmutableMap.builder().put("name", event.editor.get().name).put("email", event.editor.get().email).put("username", event.editor.get().username).build()).put("added", list("added")).put("removed", list("removed")).put("hashtags", list("hashtags")).put("change", ImmutableMap.builder().put("project", PROJECT).put("branch", BRANCH).put("id", CHANGE_ID).put("number", CHANGE_NUM_DOUBLE).put("url", URL).put("commitMessage", COMMIT_MESSAGE).put("createdOn", TS1).put("status", NEW.name()).build()).put("project", PROJECT).put("refName", REF).put("changeKey", map("id", CHANGE_ID)).put("type", "hashtags-changed").put("eventCreatedOn", TS2).build());
}
Also used : Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Example 100 with Change

use of com.google.gerrit.entities.Change in project gerrit by GerritCodeReview.

the class EventJsonTest method changeMergedEvent.

@Test
public void changeMergedEvent() {
    Change change = newChange();
    ChangeMergedEvent event = new ChangeMergedEvent(change);
    event.change = asChangeAttribute(change);
    assertThatJsonMap(event).isEqualTo(ImmutableMap.builder().put("change", ImmutableMap.builder().put("project", PROJECT).put("branch", BRANCH).put("id", CHANGE_ID).put("number", CHANGE_NUM_DOUBLE).put("url", URL).put("commitMessage", COMMIT_MESSAGE).put("createdOn", TS1).put("status", NEW.name()).build()).put("project", PROJECT).put("refName", REF).put("changeKey", map("id", CHANGE_ID)).put("type", "change-merged").put("eventCreatedOn", TS2).build());
}
Also used : Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Aggregations

Change (com.google.gerrit.entities.Change)659 Test (org.junit.Test)510 PatchSet (com.google.gerrit.entities.PatchSet)167 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)165 ObjectId (org.eclipse.jgit.lib.ObjectId)113 Repo (com.google.gerrit.testing.InMemoryRepositoryManager.Repo)112 RevCommit (org.eclipse.jgit.revwalk.RevCommit)88 Account (com.google.gerrit.entities.Account)83 CommentInfo (com.google.gerrit.extensions.common.CommentInfo)72 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)66 List (java.util.List)64 ImmutableList (com.google.common.collect.ImmutableList)63 ChangeData (com.google.gerrit.server.query.change.ChangeData)60 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)58 PatchSetApproval (com.google.gerrit.entities.PatchSetApproval)56 Instant (java.time.Instant)54 Project (com.google.gerrit.entities.Project)52 StorageException (com.google.gerrit.exceptions.StorageException)50 Ref (org.eclipse.jgit.lib.Ref)49 HumanComment (com.google.gerrit.entities.HumanComment)46