Start factoring out PatchSet accesses into a PatchSetUtil class

Replaces the simplest get calls in most callers that didn't require
substantial refactoring. Doesn't actually read notedb yet because
there is no notedb support for patch sets yet.

Change-Id: I7ef198dd1257b833a3a4b21180f5012f6fdc56d4
This commit is contained in:
Dave Borowitz
2016-01-14 15:00:59 -05:00
parent 5d926ca2ba
commit 3ecfd76674
43 changed files with 365 additions and 183 deletions

View File

@@ -40,6 +40,7 @@ import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.EditInfo;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.AnonymousUser;
@@ -58,10 +59,12 @@ import com.google.gerrit.server.index.ChangeIndexer;
import com.google.gerrit.server.notedb.NotesMigration;
import com.google.gerrit.server.project.ProjectCache;
import com.google.gerrit.server.project.Util;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gerrit.server.query.change.InternalChangeQuery;
import com.google.gerrit.testutil.ConfigSuite;
import com.google.gerrit.testutil.TempFileUtil;
import com.google.gson.Gson;
import com.google.gwtorm.server.OrmException;
import com.google.gwtorm.server.SchemaFactory;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -164,6 +167,9 @@ public abstract class AbstractDaemonTest {
@GerritPersonIdent
protected Provider<PersonIdent> serverIdent;
@Inject
protected ChangeData.Factory changeDataFactory;
protected TestRepository<InMemoryRepository> testRepo;
protected GerritServer server;
protected TestAccount admin;
@@ -624,4 +630,8 @@ public abstract class AbstractDaemonTest {
}
})).containsExactly((Object[])expected).inOrder();
}
protected PatchSet getPatchSet(PatchSet.Id psId) throws OrmException {
return changeDataFactory.create(db, psId.getParentKey()).patchSet(psId);
}
}