use of org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription in project gerrit by GerritCodeReview.
the class GitUtil method cloneProject.
public static TestRepository<InMemoryRepository> cloneProject(Project.NameKey project, String uri) throws Exception {
DfsRepositoryDescription desc = new DfsRepositoryDescription("clone of " + project.get());
FS fs = FS.detect();
// Avoid leaking user state into our tests.
fs.setUserHome(null);
InMemoryRepository dest = new InMemoryRepository.Builder().setRepositoryDescription(desc).setFS(fs).build();
Config cfg = dest.getConfig();
cfg.setString("remote", "origin", "url", uri);
cfg.setString("remote", "origin", "fetch", "+refs/heads/*:refs/remotes/origin/*");
TestRepository<InMemoryRepository> testRepo = newTestRepository(dest);
FetchResult result = testRepo.git().fetch().setRemote("origin").call();
String originMaster = "refs/remotes/origin/master";
if (result.getTrackingRefUpdate(originMaster) != null) {
testRepo.reset(originMaster);
}
return testRepo;
}
use of org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription in project gerrit by GerritCodeReview.
the class PublicKeyCheckerTest method setUp.
@Before
public void setUp() {
repo = new InMemoryRepository(new DfsRepositoryDescription("repo"));
store = new PublicKeyStore(repo);
}
use of org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription in project gerrit by GerritCodeReview.
the class PushCertificateCheckerTest method setUp.
@Before
public void setUp() throws Exception {
TestKey key1 = validKeyWithoutExpiration();
TestKey key3 = expiredKey();
repo = new InMemoryRepository(new DfsRepositoryDescription("repo"));
store = new PublicKeyStore(repo);
store.add(key1.getPublicKeyRing());
store.add(key3.getPublicKeyRing());
PersonIdent ident = new PersonIdent("A U Thor", "author@example.com");
CommitBuilder cb = new CommitBuilder();
cb.setAuthor(ident);
cb.setCommitter(ident);
assertEquals(RefUpdate.Result.NEW, store.save(cb));
signedPushConfig = new SignedPushConfig();
signedPushConfig.setCertNonceSeed("sekret");
signedPushConfig.setCertNonceSlopLimit(60 * 24);
checker = newChecker(true);
}
use of org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription in project gerrit by GerritCodeReview.
the class NoteDbUpdateManagerTest method newBatchRefUpdate.
@SafeVarargs
private static BatchRefUpdate newBatchRefUpdate(Consumer<ReceiveCommand>... resultSetters) {
try (Repository repo = new InMemoryRepository(new DfsRepositoryDescription("repo"))) {
BatchRefUpdate bru = repo.getRefDatabase().newBatchUpdate();
for (int i = 0; i < resultSetters.length; i++) {
ReceiveCommand cmd = new ReceiveCommand(ObjectId.fromString(String.format("%039x1", i)), ObjectId.fromString(String.format("%039x2", i)), "refs/heads/branch" + i);
bru.addCommand(cmd);
resultSetters[i].accept(cmd);
}
return bru;
}
}
use of org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription in project gitiles by GerritCodeReview.
the class ServletTest method setUp.
@Before
public void setUp() throws Exception {
MockSystemReader mockSystemReader = new MockSystemReader();
SystemReader.setInstance(mockSystemReader);
DfsRepository r = new InMemoryRepository(new DfsRepositoryDescription("repo"));
repo = new TestRepository<>(r, new RevWalk(r), mockSystemReader);
servlet = TestGitilesServlet.create(repo);
}
Aggregations