AbstractDaemonTest: Use exactRef instead of getRefs

Change-Id: I4468985c6cce39c31da8bf4ae043f9cc18f056d1
This commit is contained in:
David Pursehouse 2019-01-15 14:31:58 +09:00
parent 152096b13e
commit 7b78caf742

View File

@ -14,7 +14,6 @@
package com.google.gerrit.acceptance; package com.google.gerrit.acceptance;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_; import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth8.assertThat; import static com.google.common.truth.Truth8.assertThat;
@ -1209,13 +1208,6 @@ public abstract class AbstractDaemonTest {
throws Exception { throws Exception {
TestRepository<?> localRepo = cloneProject(proj); TestRepository<?> localRepo = cloneProject(proj);
GitUtil.fetch(localRepo, "refs/*:refs/*"); GitUtil.fetch(localRepo, "refs/*:refs/*");
ImmutableMap<String, Ref> refs =
localRepo
.getRepository()
.getRefDatabase()
.getRefs()
.stream()
.collect(toImmutableMap(Ref::getName, r -> r));
Map<Branch.NameKey, RevTree> refValues = new HashMap<>(); Map<Branch.NameKey, RevTree> refValues = new HashMap<>();
for (Branch.NameKey b : trees.keySet()) { for (Branch.NameKey b : trees.keySet()) {
@ -1223,7 +1215,7 @@ public abstract class AbstractDaemonTest {
continue; continue;
} }
Ref r = refs.get(b.get()); Ref r = localRepo.getRepository().exactRef(b.get());
assertThat(r).isNotNull(); assertThat(r).isNotNull();
RevWalk rw = localRepo.getRevWalk(); RevWalk rw = localRepo.getRevWalk();
RevCommit c = rw.parseCommit(r.getObjectId()); RevCommit c = rw.parseCommit(r.getObjectId());