use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class HgMaterialDockerTest method shouldNotRefreshWorkingDirectoryIfPasswordIsNotSetInHgrcFileButIsAvailableInMaterialUrl.
@Test
public void shouldNotRefreshWorkingDirectoryIfPasswordIsNotSetInHgrcFileButIsAvailableInMaterialUrl() throws Exception {
HgMaterial material = new HgMaterial("http://user1:password@localhost:9999", null);
final List<Modification> modifications = material.latestModification(workingFolder, new TestSubprocessExecutionContext());
final File unversionedFile = new File(workingFolder, "unversioned.txt");
FileUtils.writeStringToFile(unversionedFile, "something", UTF_8);
assertTrue(unversionedFile.exists());
material.modificationsSince(workingFolder, new StringRevision(modifications.get(0).getRevision()), new TestSubprocessExecutionContext());
assertTrue(unversionedFile.exists());
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class GitMaterialShallowCloneTest method shouldNotUnshallowOnServerSideIfShallowClonePropertyIsOnAndRepoIsAlreadyShallow.
@Test
public void shouldNotUnshallowOnServerSideIfShallowClonePropertyIsOnAndRepoIsAlreadyShallow() {
SystemEnvironment mockSystemEnvironment = mock(SystemEnvironment.class);
GitMaterial material = new GitMaterial(repo.projectRepositoryUrl(), true);
when(mockSystemEnvironment.get(SystemEnvironment.GO_SERVER_SHALLOW_CLONE)).thenReturn(true);
material.modificationsSince(workingDir, REVISION_4, new TestSubprocessExecutionContext(mockSystemEnvironment, false));
assertThat(localRepoFor(material).isShallow(), is(true));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class GitMaterialShallowCloneTest method shouldUnshallowServerSideRepoCompletelyOnRetrievingModificationsSincePreviousRevision.
@Test
public void shouldUnshallowServerSideRepoCompletelyOnRetrievingModificationsSincePreviousRevision() {
SystemEnvironment mockSystemEnvironment = mock(SystemEnvironment.class);
GitMaterial material = new GitMaterial(repo.projectRepositoryUrl(), true);
when(mockSystemEnvironment.get(SystemEnvironment.GO_SERVER_SHALLOW_CLONE)).thenReturn(false);
material.modificationsSince(workingDir, REVISION_4, new TestSubprocessExecutionContext(mockSystemEnvironment, true));
assertThat(localRepoFor(material).isShallow(), is(false));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class GitTestRepo method addFileAndAmend.
public List<Modification> addFileAndAmend(String fileName, String message) throws IOException {
File newFile = new File(gitRepo, fileName);
newFile.createNewFile();
new GitCommand(null, gitRepo, GitMaterialConfig.DEFAULT_BRANCH, false, new HashMap<>(), null).add(newFile);
new GitCommandWithAmend(null, gitRepo, GitMaterialConfig.DEFAULT_BRANCH, false, new HashMap<>()).commitWithAmend(message, gitRepo);
return createMaterial().latestModification(temporaryFolder.newFolder(), new TestSubprocessExecutionContext());
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class GitTestRepo method addFileAndPush.
public List<Modification> addFileAndPush(String fileName, String message) throws IOException {
File newFile = new File(gitRepo, fileName);
newFile.createNewFile();
new GitCommand(null, gitRepo, GitMaterialConfig.DEFAULT_BRANCH, false, new HashMap<>(), null).add(newFile);
new GitCommand(null, gitRepo, GitMaterialConfig.DEFAULT_BRANCH, false, new HashMap<>(), null).commit(message);
return createMaterial().latestModification(temporaryFolder.newFolder(), new TestSubprocessExecutionContext());
}
Aggregations