Search in sources :

Example 1 with HgMaterialUpdater

use of com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater in project gocd by gocd.

the class HgMaterialUpdaterTest method updateTo.

private void updateTo(HgMaterial material, RevisionContext revisionContext, JobResult expectedResult) {
    BuildSession buildSession = newBuildSession();
    JobResult result = buildSession.build(new HgMaterialUpdater(material).updateTo(workingFolder.toString(), revisionContext));
    assertThat(buildInfo(), result, is(expectedResult));
}
Also used : HgMaterialUpdater(com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater) JobResult(com.thoughtworks.go.domain.JobResult) BuildSession(com.thoughtworks.go.buildsession.BuildSession)

Example 2 with HgMaterialUpdater

use of com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater in project gocd by gocd.

the class HgMaterialUpdaterTest method updateTo.

private void updateTo(HgMaterial material, RevisionContext revisionContext, JobResult expectedResult, File workingFolder) {
    BuildSession buildSession = newBuildSession();
    JobResult result = buildSession.build(new HgMaterialUpdater(material).updateTo(workingFolder.toString(), revisionContext));
    assertThat(buildInfo(), result, is(expectedResult));
}
Also used : HgMaterialUpdater(com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater) JobResult(com.thoughtworks.go.domain.JobResult) BuildSession(com.thoughtworks.go.buildsession.BuildSession)

Example 3 with HgMaterialUpdater

use of com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater 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);
}
Also used : GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) P4MaterialUpdater(com.thoughtworks.go.domain.materials.perforce.P4MaterialUpdater) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) TfsMaterial(com.thoughtworks.go.config.materials.tfs.TfsMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) ScmMaterial(com.thoughtworks.go.config.materials.ScmMaterial) GitMaterialUpdater(com.thoughtworks.go.domain.materials.git.GitMaterialUpdater) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) SvnMaterialUpdater(com.thoughtworks.go.domain.materials.svn.SvnMaterialUpdater) TfsMaterial(com.thoughtworks.go.config.materials.tfs.TfsMaterial) HgMaterialUpdater(com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater) TfsMaterialUpdater(com.thoughtworks.go.domain.materials.tfs.TfsMaterialUpdater) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) ScmMaterial(com.thoughtworks.go.config.materials.ScmMaterial) DependencyMaterialRevision(com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)

Aggregations

HgMaterialUpdater (com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater)3 BuildSession (com.thoughtworks.go.buildsession.BuildSession)2 JobResult (com.thoughtworks.go.domain.JobResult)2 PackageMaterial (com.thoughtworks.go.config.materials.PackageMaterial)1 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)1 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)1 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)1 TfsMaterial (com.thoughtworks.go.config.materials.tfs.TfsMaterial)1 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)1 GitMaterialUpdater (com.thoughtworks.go.domain.materials.git.GitMaterialUpdater)1 P4MaterialUpdater (com.thoughtworks.go.domain.materials.perforce.P4MaterialUpdater)1 SvnMaterialUpdater (com.thoughtworks.go.domain.materials.svn.SvnMaterialUpdater)1 TfsMaterialUpdater (com.thoughtworks.go.domain.materials.tfs.TfsMaterialUpdater)1