use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class MaterialsTest method shouldGenerateNoopCommandWhenCleanUpIsCalled_hasOneMaterialUseBaseFolderReturnsTrue.
@Test
public void shouldGenerateNoopCommandWhenCleanUpIsCalled_hasOneMaterialUseBaseFolderReturnsTrue() throws Exception {
Materials materials = new Materials();
materials.add(new GitMaterial("http://some-url.com", "some-branch"));
assertThat(materials.cleanUpCommand("foo"), is(BuildCommand.noop()));
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class MaterialsTest method shouldReturnExistingGitMaterialFromMaterialsIfItContainsOne.
@Test
public void shouldReturnExistingGitMaterialFromMaterialsIfItContainsOne() {
Materials materials = new Materials();
GitMaterial existingMaterial = new GitMaterial("foo");
materials.add(existingMaterial);
assertThat(materials.getGitMaterial(), is(sameInstance(existingMaterial)));
}
use of com.thoughtworks.go.config.materials.git.GitMaterial 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);
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class MaterialsTest method shouldGenerateCleanupCommandForRemovingJunkFoldersWhenCleanUpIsCalled_hasOneMaterialUseBaseFolderReturnsFalse.
@Test
public void shouldGenerateCleanupCommandForRemovingJunkFoldersWhenCleanUpIsCalled_hasOneMaterialUseBaseFolderReturnsFalse() throws Exception {
Materials materials = new Materials();
GitMaterial gitMaterial = new GitMaterial("http://some-url.com", "some-branch", "some-folder");
materials.add(gitMaterial);
BuildCommand command = materials.cleanUpCommand("basedir");
assertThat(command.getName(), is("cleandir"));
assertThat(command.getStringArg("path"), is("basedir"));
assertThat(command.getArrayArg("allowed"), is(new String[] { "some-folder", "cruise-output" }));
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class GitTestRepo method createMaterial.
public GitMaterial createMaterial(String dest) {
GitMaterial gitMaterial = new GitMaterial(this.projectRepositoryUrl());
gitMaterial.setFolder(dest);
return gitMaterial;
}
Aggregations