use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class BuildWorkEnvironmentVariablesTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
dir = temporaryFolder.newFolder("someFolder");
environmentVariableContext = new EnvironmentVariableContext();
svnRepoFixture = new SvnRepoFixture("../common/src/test/resources/data/svnrepo", temporaryFolder);
svnRepoFixture.createRepository();
command = new SvnCommand(null, svnRepoFixture.getEnd2EndRepoUrl());
pipelineConfig = PipelineConfigMother.createPipelineConfig(PIPELINE_NAME, STAGE_NAME, JOB_NAME);
svnMaterial = SvnMaterial.createSvnMaterialWithMock(command);
dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("upstream1"), new CaseInsensitiveString(STAGE_NAME));
dependencyMaterialWithName = new DependencyMaterial(new CaseInsensitiveString("upstream2"), new CaseInsensitiveString(STAGE_NAME));
dependencyMaterialWithName.setName(new CaseInsensitiveString("dependency_material_name"));
setupHgRepo();
p4Fixture = new P4Fixture();
p4Material = getP4Material();
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class BuildersTest method shouldNotBuildIfTheJobIsCanceled.
@Test
public void shouldNotBuildIfTheJobIsCanceled() throws Exception {
StubGoPublisher goPublisher = new StubGoPublisher();
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
CommandBuilder builder = new CommandBuilder("echo", "hello", new File("."), new RunIfConfigs(FAILED), new com.thoughtworks.go.domain.builder.StubBuilder(), "");
Builders builders = new Builders(Collections.singletonList(builder), goPublisher, null, null, null);
builders.setIsCancelled(true);
builders.build(environmentVariableContext, "utf-8");
assertThat(goPublisher.getMessage(), is(""));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class BuildersTest method shouldNotSetAsCurrentBuilderIfNotRun.
@Test
public void shouldNotSetAsCurrentBuilderIfNotRun() throws Exception {
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
Builder builder = new CommandBuilder("echo", "", new File("."), new RunIfConfigs(FAILED), null, "");
Builders builders = new Builders(Collections.singletonList(builder), null, null, null, null);
builders.setIsCancelled(true);
builders.build(environmentVariableContext, "utf-8");
Builders expected = new Builders(Collections.singletonList(builder), null, null, null, null);
expected.setIsCancelled(true);
assertThat(builders, is(expected));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class BuildersTest method shouldNotCancelAnythingIfAllBuildersHaveRun.
@Test
public void shouldNotCancelAnythingIfAllBuildersHaveRun() throws Exception {
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
Builder builder = new StubBuilder(new RunIfConfigs(ANY));
Builders builders = new Builders(Collections.singletonList(builder), new StubGoPublisher(), null, null, null);
builders.build(environmentVariableContext, "utf-8");
builders.cancel(environmentVariableContext, "utf-8");
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class EnvironmentVariableContextTest method shouldPopulateEnvironmentForMaterialUsingDest.
@Test
public void shouldPopulateEnvironmentForMaterialUsingDest() throws IOException {
SvnMaterial svn = MaterialsMother.svnMaterial();
svn.setFolder("svn-dir");
MaterialRevision revision = new MaterialRevision(svn, ModificationsMother.oneModifiedFile("revision1"));
MaterialRevisions materialRevisions = new MaterialRevisions(revision);
EnvironmentVariableContext context = new EnvironmentVariableContext();
context.setProperty("GO_SERVER_URL", SystemEnvironment.getProperty("serviceUrl"), false);
jobIdentifier().populateEnvironmentVariables(context);
materialRevisions.populateEnvironmentVariables(context, temporaryFolder.newFolder());
assertThat(context.getProperty("GO_REVISION_SVN_DIR"), is("revision1"));
}
Aggregations