Search in sources :

Example 16 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class InitHandlerTest method testInitEmptyRepoMissingMaster.

@Test
public void testInitEmptyRepoMissingMaster() throws Exception {
    String projectName = "AnyProjectName";
    TestRepository testRepository = createAndShare(projectName);
    selectProject(projectName);
    clickInit();
    bot.button("Yes").click();
    fillDialog(MASTER_BRANCH_MISSING);
    bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing));
    bot.button("Yes").click();
    bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
    Repository localRepository = testRepository.getRepository();
    GitFlowRepository gitFlowRepository = new GitFlowRepository(localRepository);
    GitFlowConfig config = gitFlowRepository.getConfig();
    assertEquals(DEVELOP_BRANCH, localRepository.getBranch());
    assertEquals(MASTER_BRANCH_MISSING, config.getMaster());
    assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix());
    assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix());
    assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix());
    assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix());
    assertNotNull(localRepository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH));
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) TestRepository(org.eclipse.egit.core.test.TestRepository) Repository(org.eclipse.jgit.lib.Repository) GitFlowConfig(org.eclipse.egit.gitflow.GitFlowConfig) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Example 17 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class InitHandlerTest method createAndShare.

private TestRepository createAndShare(String projectName) throws Exception {
    IProgressMonitor progressMonitor = new NullProgressMonitor();
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IProject project = root.getProject(projectName);
    project.create(progressMonitor);
    project.open(progressMonitor);
    TestUtil.waitForJobs(50, 5000);
    File gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    TestRepository testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());
    TestUtil.waitForJobs(50, 5000);
    return testRepository;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) TestRepository(org.eclipse.egit.core.test.TestRepository) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) File(java.io.File) IProject(org.eclipse.core.resources.IProject)

Example 18 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class CommitMessageBuilderTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
    testRepository = new TestRepository(gitDir);
    testRepository.connect(project.getProject());
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) File(java.io.File) Before(org.junit.Before)

Example 19 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class GitSubscriberMergeContextTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    iProject = project.project;
    testRepo = new TestRepository(gitDir);
    testRepo.connect(iProject);
    repo = RepositoryMapping.getMapping(iProject).getRepository();
    // make initial commit
    try (Git git = new Git(repo)) {
        git.commit().setAuthor("JUnit", "junit@jgit.org").setMessage("Initial commit").call();
    }
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) Git(org.eclipse.jgit.api.Git) Before(org.junit.Before)

Example 20 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class GitSubscriberResourceMappingContextTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    iProject = project.project;
    testRepo = new TestRepository(gitDir);
    testRepo.connect(iProject);
    repo = RepositoryMapping.getMapping(iProject).getRepository();
    // make initial commit
    try (Git git = new Git(repo)) {
        git.commit().setAuthor("JUnit", "junit@jgit.org").setMessage("Initial commit").call();
    }
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) Git(org.eclipse.jgit.api.Git) Before(org.junit.Before)

Aggregations

TestRepository (org.eclipse.egit.core.test.TestRepository)45 Before (org.junit.Before)36 File (java.io.File)28 IFile (org.eclipse.core.resources.IFile)15 Git (org.eclipse.jgit.api.Git)6 TestProject (org.eclipse.egit.core.test.TestProject)5 Repository (org.eclipse.jgit.lib.Repository)5 Test (org.junit.Test)5 IProject (org.eclipse.core.resources.IProject)4 CloneOperation (org.eclipse.egit.core.op.CloneOperation)3 URIish (org.eclipse.jgit.transport.URIish)3 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)2 RefUpdate (org.eclipse.jgit.lib.RefUpdate)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 IFolder (org.eclipse.core.resources.IFolder)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1