Adapt events-eiffel for stable-3.7
* Fix test sccFromChangeRevCommitThatIsNotCurrent that used
timestamp of current patchset when it was suppose to use
timestamp of the previous patchset.
Solves: Jira GER-2089
Change-Id: I1ec536724fb40c6c09a02c33772bba949e984754
diff --git a/src/test/java/com/googlesource/gerrit/plugins/eventseiffel/mapping/EventMappingIT.java b/src/test/java/com/googlesource/gerrit/plugins/eventseiffel/mapping/EventMappingIT.java
index 344646f..59080cd 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/eventseiffel/mapping/EventMappingIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/eventseiffel/mapping/EventMappingIT.java
@@ -21,6 +21,7 @@
import com.google.common.collect.Lists;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.TestPlugin;
+import com.google.gerrit.entities.PatchSet;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.api.changes.RevisionApi;
@@ -126,17 +127,19 @@
@Test
public void sccFromChangeRevCommit() throws Exception {
PushOneCommit.Result res = createChange();
- sccFromChangeRevCommit(res);
+ PatchSet ps = res.getPatchSet();
+ sccFromChangeRevCommit(res, ps);
}
@Test
public void sccFromChangeRevCommitThatIsNotCurrent() throws Exception {
PushOneCommit.Result res = createChange();
+ PatchSet ps = res.getPatchSet();
amendChange(res.getChangeId());
- sccFromChangeRevCommit(res);
+ sccFromChangeRevCommit(res, ps);
}
- private void sccFromChangeRevCommit(PushOneCommit.Result result) throws Exception {
+ private void sccFromChangeRevCommit(PushOneCommit.Result result, PatchSet ps) throws Exception {
EiffelSourceChangeCreatedEventInfo event =
mapper.toScc(result.getCommit(), project.get(), "master", PARENT_UUIDS);
@@ -148,8 +151,7 @@
String.valueOf(result.getPatchSetId().changeId().get()),
project.get(),
result.getCommit().getName());
- assertSccMeta(
- event.meta, Long.valueOf(result.getChange().currentPatchSet().createdOn().toEpochMilli()));
+ assertSccMeta(event.meta, Long.valueOf(ps.createdOn().toEpochMilli()));
assertSccLinks(event.links);
}