Search in sources :

Example 1 with RefUpdatedEvent

use of com.google.gerrit.server.events.RefUpdatedEvent in project gerrit by GerritCodeReview.

the class EventRecorder method assertRefUpdatedEvents.

public void assertRefUpdatedEvents(String project, String branch, String... expected) throws Exception {
    ImmutableList<RefUpdatedEvent> events = getRefUpdatedEvents(project, branch, expected.length / 2);
    int i = 0;
    for (RefUpdatedEvent event : events) {
        RefUpdateAttribute actual = event.refUpdate.get();
        String oldRev = expected[i] == null ? ObjectId.zeroId().name() : expected[i];
        String newRev = expected[i + 1] == null ? ObjectId.zeroId().name() : expected[i + 1];
        assertThat(actual.oldRev).isEqualTo(oldRev);
        assertThat(actual.newRev).isEqualTo(newRev);
        i += 2;
    }
}
Also used : RefUpdateAttribute(com.google.gerrit.server.data.RefUpdateAttribute) RefUpdatedEvent(com.google.gerrit.server.events.RefUpdatedEvent)

Example 2 with RefUpdatedEvent

use of com.google.gerrit.server.events.RefUpdatedEvent in project gerrit by GerritCodeReview.

the class EventRecorder method assertRefUpdatedEvents.

public void assertRefUpdatedEvents(String project, String branch, RevCommit... expected) throws Exception {
    ImmutableList<RefUpdatedEvent> events = getRefUpdatedEvents(project, branch, expected.length / 2);
    int i = 0;
    for (RefUpdatedEvent event : events) {
        RefUpdateAttribute actual = event.refUpdate.get();
        String oldRev = expected[i] == null ? ObjectId.zeroId().name() : expected[i].name();
        String newRev = expected[i + 1] == null ? ObjectId.zeroId().name() : expected[i + 1].name();
        assertThat(actual.oldRev).isEqualTo(oldRev);
        assertThat(actual.newRev).isEqualTo(newRev);
        i += 2;
    }
}
Also used : RefUpdateAttribute(com.google.gerrit.server.data.RefUpdateAttribute) RefUpdatedEvent(com.google.gerrit.server.events.RefUpdatedEvent)

Aggregations

RefUpdateAttribute (com.google.gerrit.server.data.RefUpdateAttribute)2 RefUpdatedEvent (com.google.gerrit.server.events.RefUpdatedEvent)2