Search in sources :

Example 1 with P4MaterialUpdater

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));
}
Also used : JobResult(com.thoughtworks.go.domain.JobResult) BuildSession(com.thoughtworks.go.buildsession.BuildSession) P4MaterialUpdater(com.thoughtworks.go.domain.materials.perforce.P4MaterialUpdater)

Example 2 with P4MaterialUpdater

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);
}
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

P4MaterialUpdater (com.thoughtworks.go.domain.materials.perforce.P4MaterialUpdater)2 BuildSession (com.thoughtworks.go.buildsession.BuildSession)1 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 JobResult (com.thoughtworks.go.domain.JobResult)1 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)1 GitMaterialUpdater (com.thoughtworks.go.domain.materials.git.GitMaterialUpdater)1 HgMaterialUpdater (com.thoughtworks.go.domain.materials.mercurial.HgMaterialUpdater)1 SvnMaterialUpdater (com.thoughtworks.go.domain.materials.svn.SvnMaterialUpdater)1 TfsMaterialUpdater (com.thoughtworks.go.domain.materials.tfs.TfsMaterialUpdater)1