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();
}
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));
}
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");
}
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));
}
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");
}
Aggregations