use of com.thoughtworks.go.domain.materials.perforce.P4MaterialUpdater in project gocd by gocd.
the class P4MaterialUpdaterTestBase method updateTo.
protected void updateTo(P4Material material, RevisionContext revisionContext, JobResult expectedResult) {
BuildSession buildSession = newBuildSession();
JobResult result = buildSession.build(new P4MaterialUpdater(material).updateTo(workingDir.toString(), revisionContext));
assertThat(buildInfo(), result, is(expectedResult));
}
use of com.thoughtworks.go.domain.materials.perforce.P4MaterialUpdater in project gocd by gocd.
the class MaterialRevisions method updateToCommand.
public BuildCommand updateToCommand(String baseDir) {
List<BuildCommand> commands = new ArrayList<>();
for (MaterialRevision revision : revisions) {
Material material = revision.getMaterial();
if (material instanceof ScmMaterial) {
if (material instanceof GitMaterial) {
GitMaterialUpdater updater = new GitMaterialUpdater((GitMaterial) material);
commands.add(updater.updateTo(baseDir, revision.toRevisionContext()));
} else if (material instanceof HgMaterial) {
HgMaterialUpdater updater = new HgMaterialUpdater((HgMaterial) material);
commands.add(updater.updateTo(baseDir, revision.toRevisionContext()));
} else if (material instanceof SvnMaterial) {
SvnMaterialUpdater updater = new SvnMaterialUpdater((SvnMaterial) material);
commands.add(updater.updateTo(baseDir, revision.toRevisionContext()));
} else if (material instanceof PackageMaterial) {
// do nothing
} else if (material instanceof TfsMaterial) {
TfsMaterialUpdater updater = new TfsMaterialUpdater((TfsMaterial) material);
commands.add(updater.updateTo(baseDir, revision.toRevisionContext()));
} else if (material instanceof P4Material) {
P4MaterialUpdater updater = new P4MaterialUpdater((P4Material) material);
commands.add(updater.updateTo(baseDir, revision.toRevisionContext()));
} else {
commands.add(BuildCommand.fail("%s Material is not supported for new build command agent", material.getTypeForDisplay()));
}
}
}
return BuildCommand.compose(commands);
}
Aggregations