use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialUpdaterTest method shouldAllowSubmoduleUrlstoChange.
@Test
public void shouldAllowSubmoduleUrlstoChange() throws Exception {
GitSubmoduleRepos submoduleRepos = new GitSubmoduleRepos(temporaryFolder);
String submoduleDirectoryName = "local-submodule";
submoduleRepos.addSubmodule(SUBMODULE, submoduleDirectoryName);
GitMaterial material = new GitMaterial(submoduleRepos.projectRepositoryUrl(), true);
updateTo(material, new RevisionContext(new StringRevision("origin/HEAD")), JobResult.Passed);
submoduleRepos.changeSubmoduleUrl(submoduleDirectoryName);
updateTo(material, new RevisionContext(new StringRevision("origin/HEAD")), JobResult.Passed);
assertThat(console.output(), containsString("Synchronizing submodule url for 'local-submodule'"));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialUpdaterTest method shouldCleanUnversionedFilesInsideSubmodulesBeforeUpdating.
@Test
public void shouldCleanUnversionedFilesInsideSubmodulesBeforeUpdating() throws Exception {
GitSubmoduleRepos submoduleRepos = new GitSubmoduleRepos(temporaryFolder);
String submoduleDirectoryName = "local-submodule";
submoduleRepos.addSubmodule(SUBMODULE, submoduleDirectoryName);
GitMaterial material = new GitMaterial(submoduleRepos.projectRepositoryUrl(), true);
updateTo(material, new RevisionContext(new StringRevision("origin/HEAD")), JobResult.Passed);
File unversionedFile = new File(new File(workingDir, submoduleDirectoryName), "unversioned_file.txt");
FileUtils.writeStringToFile(unversionedFile, "this is an unversioned file. lets see you deleting me.. come on.. I dare you!!!!", UTF_8);
updateTo(material, new RevisionContext(new StringRevision("origin/HEAD")), JobResult.Passed);
assertThat(unversionedFile.exists(), Matchers.is(false));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialUpdaterTest method shouldRemoveSubmoduleFolderFromWorkingDirWhenSubmoduleIsRemovedFromRepo.
@Test
public void shouldRemoveSubmoduleFolderFromWorkingDirWhenSubmoduleIsRemovedFromRepo() throws Exception {
GitSubmoduleRepos submoduleRepos = new GitSubmoduleRepos(temporaryFolder);
submoduleRepos.addSubmodule(SUBMODULE, "sub1");
GitMaterial gitMaterial = new GitMaterial(submoduleRepos.mainRepo().getUrl(), true);
StringRevision revision = new StringRevision("origin/master");
updateTo(gitMaterial, new RevisionContext(revision), JobResult.Passed);
assertThat(new File(workingDir, "sub1"), exists());
submoduleRepos.removeSubmodule("sub1");
updateTo(gitMaterial, new RevisionContext(revision), JobResult.Passed);
assertThat(new File(workingDir, "sub1"), not(exists()));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitMaterialUpdaterTest method failureCommandShouldNotLeakPasswordOnUrl.
@Test
public void failureCommandShouldNotLeakPasswordOnUrl() throws Exception {
GitMaterial material = new GitMaterial("https://foo:foopassword@this.is.absolute.not.exists", true);
updateTo(material, new RevisionContext(new StringRevision("origin/master")), JobResult.Failed);
assertThat(console.output(), containsString("https://foo:******@this.is.absolute.not.exists/"));
assertThat(console.output(), not(containsString("foopassword")));
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class HgMaterialTest method shouldUpdateToDestinationFolder.
@Test
public void shouldUpdateToDestinationFolder() throws Exception {
hgMaterial.setFolder("dest");
updateMaterial(hgMaterial, new StringRevision("0"));
File end2endFolder = new File(workingFolder, "dest/end2end");
assertThat(end2endFolder.exists(), is(true));
}
Aggregations