SubmitByMergeAlwaysIT: Test ref-updated event for multiple changes

Update the submitMultipleChanges test to confirm that only a single
ref-updated event is emitted when multiple changes are submitted by
merge.

Change-Id: I63f7a14cf425578a2f2a82036b95eecf87737b02
This commit is contained in:
David Pursehouse
2016-06-08 16:43:54 +09:00
parent 6c97cbb07e
commit 4bc0dbccd3
2 changed files with 51 additions and 16 deletions

View File

@@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.eclipse.jgit.lib.Constants.R_HEADS;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
@@ -94,6 +95,15 @@ public class EventRecorder {
return (RefUpdatedEvent) e;
}
public ImmutableList<RefEvent> getRefUpdates(String project, String refName,
int expectedSize) {
String key = key(RefUpdatedEvent.TYPE, project, refName);
assertThat(recordedEvents).containsKey(key);
Collection<RefEvent> events = recordedEvents.get(key);
assertThat(events).hasSize(expectedSize);
return ImmutableList.copyOf(events);
}
public ChangeMergedEvent getOneChangeMerged(String project, String branch,
final String changeNumber) throws Exception {
String key = key(ChangeMergedEvent.TYPE, project,