Search in sources :

Example 1 with SampleTestRepository

use of org.eclipse.egit.ui.wizards.clone.SampleTestRepository in project egit by eclipse.

the class PushTest method setup.

@Before
public void setup() throws Exception {
    TestUtil.disableProxy();
    remoteRepository = new SampleTestRepository(NUMBER_RANDOM_COMMITS, true);
    localRepoPath = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), "test" + System.nanoTime());
    String branch = Constants.R_HEADS + SampleTestRepository.FIX;
    CloneOperation cloneOperation = new CloneOperation(new URIish(remoteRepository.getUri()), true, null, localRepoPath, branch, "origin", 30);
    cloneOperation.setCredentialsProvider(new UsernamePasswordCredentialsProvider("agitter", "letmein"));
    cloneOperation.run(new NullProgressMonitor());
    file = new File(localRepoPath, SampleTestRepository.A_txt_name);
    assertTrue(file.exists());
    localRepository = Activator.getDefault().getRepositoryCache().lookupRepository(new File(localRepoPath, ".git"));
    assertNotNull(localRepository);
}
Also used : URIish(org.eclipse.jgit.transport.URIish) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) UsernamePasswordCredentialsProvider(org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider) SampleTestRepository(org.eclipse.egit.ui.wizards.clone.SampleTestRepository) File(java.io.File) CloneOperation(org.eclipse.egit.core.op.CloneOperation) Before(org.junit.Before)

Aggregations

File (java.io.File)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 CloneOperation (org.eclipse.egit.core.op.CloneOperation)1 SampleTestRepository (org.eclipse.egit.ui.wizards.clone.SampleTestRepository)1 URIish (org.eclipse.jgit.transport.URIish)1 UsernamePasswordCredentialsProvider (org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider)1 Before (org.junit.Before)1