Search in sources :

Example 6 with HgTestRepo

use of com.thoughtworks.go.helper.HgTestRepo in project gocd by gocd.

the class HgMaterialTest method setUp.

@Before
public void setUp() throws Exception {
    hgTestRepo = new HgTestRepo("hgTestRepo1", temporaryFolder);
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo.projectRepositoryUrl());
    workingFolder = temporaryFolder.newFolder("workingFolder");
    outputStreamConsumer = inMemoryConsumer();
}
Also used : HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) Before(org.junit.Before)

Example 7 with HgTestRepo

use of com.thoughtworks.go.helper.HgTestRepo in project gocd by gocd.

the class HgMaterialUpdaterTest method shouldDeleteAndRecheckoutDirectoryWhenUrlChanges.

@Test
public void shouldDeleteAndRecheckoutDirectoryWhenUrlChanges() throws Exception {
    updateTo(hgMaterial, new RevisionContext(REVISION_0), JobResult.Passed);
    File shouldBeRemoved = new File(workingFolder, "shouldBeRemoved");
    shouldBeRemoved.createNewFile();
    assertThat(shouldBeRemoved.exists(), is(true));
    String repositoryUrl = new HgTestRepo(temporaryFolder).projectRepositoryUrl();
    HgMaterial material = MaterialsMother.hgMaterial(repositoryUrl);
    updateTo(material, new RevisionContext(REVISION_2), JobResult.Passed);
    assertThat(material.getUrl(), not(hgMaterial.getUrl()));
    assert (MaterialUrl.sameUrl(material.getUrl(), repositoryUrl));
    assertThat(shouldBeRemoved.exists(), is(false));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) StringContains.containsString(org.hamcrest.core.StringContains.containsString) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) File(java.io.File) Test(org.junit.Test)

Example 8 with HgTestRepo

use of com.thoughtworks.go.helper.HgTestRepo in project gocd by gocd.

the class HgMultipleMaterialsTest method createRepo.

@Before
public void createRepo() throws IOException {
    repo = new HgTestRepo(temporaryFolder);
    pipelineDir = temporaryFolder.newFolder("working-dir");
}
Also used : HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) Before(org.junit.Before)

Example 9 with HgTestRepo

use of com.thoughtworks.go.helper.HgTestRepo in project gocd by gocd.

the class HgMaterialTest method shouldRefreshWorkingFolderWhenRepositoryChanged.

@Test
public void shouldRefreshWorkingFolderWhenRepositoryChanged() throws Exception {
    new HgCommand(null, workingFolder, "default", hgTestRepo.url().forCommandline(), null).clone(inMemoryConsumer(), hgTestRepo.url());
    File testFile = createNewFileInWorkingFolder();
    HgTestRepo hgTestRepo2 = new HgTestRepo("hgTestRepo2", temporaryFolder);
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo2.projectRepositoryUrl());
    hgMaterial.latestModification(workingFolder, new TestSubprocessExecutionContext());
    String workingUrl = new HgCommand(null, workingFolder, "default", hgTestRepo.url().forCommandline(), null).workingRepositoryUrl().outputAsString();
    assertThat(workingUrl, is(hgTestRepo2.projectRepositoryUrl()));
    assertThat(testFile.exists(), is(false));
}
Also used : HgCommand(com.thoughtworks.go.domain.materials.mercurial.HgCommand) StringContains.containsString(org.hamcrest.core.StringContains.containsString) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) File(java.io.File) Test(org.junit.Test)

Example 10 with HgTestRepo

use of com.thoughtworks.go.helper.HgTestRepo in project gocd by gocd.

the class HgMaterialUpdaterTest method setUp.

@Before
public void setUp() throws Exception {
    hgTestRepo = new HgTestRepo("hgTestRepo1", temporaryFolder);
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo.projectRepositoryUrl());
    workingFolder = temporaryFolder.newFolder("workingFolder");
}
Also used : HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) Before(org.junit.Before)

Aggregations

HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)13 Before (org.junit.Before)7 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)3 File (java.io.File)3 StringContains.containsString (org.hamcrest.core.StringContains.containsString)3 Test (org.junit.Test)3 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)2 RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)2 ConfigTestRepo (com.thoughtworks.go.helper.ConfigTestRepo)2 GoDiskSpaceMonitor (com.thoughtworks.go.server.cronjob.GoDiskSpaceMonitor)2 MDUPerformanceLogger (com.thoughtworks.go.server.perf.MDUPerformanceLogger)2 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 Filter (com.thoughtworks.go.config.materials.Filter)1 IgnoredFiles (com.thoughtworks.go.config.materials.IgnoredFiles)1 Materials (com.thoughtworks.go.config.materials.Materials)1 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)1 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)1