Move repository registration out of AbstractDaemonTest#cloneProject
By moving out the repository registration, we can get the registered URI which can be used to connect to the repository for both fetch and push. This makes it possible to clone a remote repository to another remote repository in the integration test and both of them are managed by GitRepositoryManager. Change-Id: Ic941ae184249bb9521da52350ae45b24cfe5f8c9
This commit is contained in:
@@ -494,12 +494,22 @@ public abstract class AbstractDaemonTest {
|
||||
|
||||
protected TestRepository<InMemoryRepository> cloneProject(
|
||||
Project.NameKey p, TestAccount testAccount) throws Exception {
|
||||
return GitUtil.cloneProject(p, registerRepoConnection(p, testAccount));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a repository connection over the test protocol.
|
||||
*
|
||||
* @return a URI string that can be used to connect to this repository for both fetch and push.
|
||||
* */
|
||||
protected String registerRepoConnection(
|
||||
Project.NameKey p, TestAccount testAccount) throws Exception {
|
||||
InProcessProtocol.Context ctx =
|
||||
new InProcessProtocol.Context(
|
||||
reviewDbProvider, identifiedUserFactory, testAccount.getId(), p);
|
||||
Repository repo = repoManager.openRepository(p);
|
||||
toClose.add(repo);
|
||||
return GitUtil.cloneProject(p, inProcessProtocol.register(ctx, repo).toString());
|
||||
return inProcessProtocol.register(ctx, repo).toString();
|
||||
}
|
||||
|
||||
protected void afterTest() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user