use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class P4MaterialTestBase method shouldLogRepoInfoToConsoleOutWithoutFolder.
@Test
void shouldLogRepoInfoToConsoleOutWithoutFolder() {
P4Material p4Material = p4Fixture.material(VIEW);
updateMaterial(p4Material, new StringRevision("2"));
String message = format("Start updating %s at revision %s from %s", "files", "2", p4Material.getUrl());
assertThat(outputconsumer.getStdOut()).contains(message);
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class P4MaterialTestBase method shouldCleanOutRepoWhenViewChanges.
@Test
void shouldCleanOutRepoWhenViewChanges() {
P4Material p4Material = p4Fixture.material(VIEW);
updateMaterial(p4Material, new StringRevision("2"));
assertThat(clientFolder.listFiles()).hasSize(8);
P4Material otherMaterial = p4Fixture.material("//depot/lib/... //something/...");
updateMaterial(otherMaterial, new StringRevision("2"));
assertThat(clientFolder.listFiles()).hasSize(2);
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class GitRepoContainingSubmodule method changeSubmoduleUrl.
public void changeSubmoduleUrl(String submoduleName) throws Exception {
File newSubmodule = createRepo("new-submodule");
addAndCommitNewFile(newSubmodule, "new", "make a commit");
git(remoteRepoDir).changeSubmoduleUrl(submoduleName, newSubmodule.getAbsolutePath());
git(remoteRepoDir).submoduleSync();
git(new File(remoteRepoDir, "local-submodule")).fetch(inMemoryConsumer());
git(new File(remoteRepoDir, "local-submodule")).resetHard(inMemoryConsumer(), new StringRevision("origin/master"));
git(remoteRepoDir).add(new File(".gitmodules"));
git(remoteRepoDir).add(new File("local-submodule"));
git(remoteRepoDir).commit("change submodule url");
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class BackupServiceIntegrationTest method shouldBackupConfigRepository.
@Test
public void shouldBackupConfigRepository(@TempDir Path temporaryFolder) throws IOException {
configHelper.addPipeline("too-unique-to-be-present", "stage-name");
ServerBackup backup = backupService.startBackup(admin);
assertThat(backup.isSuccessful(), is(true));
assertThat(backup.getMessage(), is("Backup was generated successfully."));
File repoZip = backedUpFile("config-repo.zip");
File repoDir = TempDirUtils.createTempDirectoryIn(temporaryFolder, "expanded-config-repo-backup").toFile();
new ZipUtil().unzip(repoZip, repoDir);
File cloneDir = TempDirUtils.createTempDirectoryIn(temporaryFolder, "cloned-config-repo-backup").toFile();
GitMaterial git = new GitMaterial(repoDir.getAbsolutePath());
List<Modification> modifications = git.latestModification(cloneDir, subprocessExecutionContext);
String latestChangeRev = modifications.get(0).getRevision();
git.checkout(cloneDir, new StringRevision(latestChangeRev), subprocessExecutionContext);
assertThat(FileUtils.readFileToString(new File(cloneDir, "cruise-config.xml"), UTF_8).indexOf("too-unique-to-be-present"), greaterThan(0));
StringRevision revision = new StringRevision(latestChangeRev + "~1");
git.updateTo(new InMemoryStreamConsumer(), cloneDir, new RevisionContext(revision), subprocessExecutionContext);
assertThat(FileUtils.readFileToString(new File(cloneDir, "cruise-config.xml"), UTF_8).indexOf("too-unique-to-be-present"), is(-1));
// Workaround issue with deletion of symlinks via JUnit TempDir by pre-deleting
FileUtils.deleteQuietly(cloneDir);
}
use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.
the class ModificationsTest method shouldReturnRevisionsWithoutSpecifiedRevision.
@Test
public void shouldReturnRevisionsWithoutSpecifiedRevision() {
final Modification modification1 = new Modification(new Date(), "1", "MOCK_LABEL-12", null);
final Modification modification2 = new Modification(new Date(), "2", "MOCK_LABEL-12", null);
List<Modification> modifications = new ArrayList<>();
modifications.add(modification1);
modifications.add(modification2);
List<Modification> filtered = Modifications.filterOutRevision(modifications, new StringRevision("1"));
assertThat(filtered.size(), is(1));
assertThat(filtered.get(0), is(modification2));
}
Aggregations