use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class MessageTest method encodeAndDecodeAssignWorkWithDifferentBuilders.
@Test
public void encodeAndDecodeAssignWorkWithDifferentBuilders() throws Exception {
File workingDir = new File(CruiseConfig.WORKING_BASE_DIR + "pipelineName");
Materials materials = MaterialsMother.defaultMaterials();
MaterialRevisions revisions = ModificationsMother.modifyOneFile(materials, ModificationsMother.nextRevision());
BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
List<Builder> builder = new ArrayList<>();
builder.add(new CommandBuilder("command", "args", workingDir, new RunIfConfigs(), new NullBuilder(), "desc"));
builder.add(new BuilderForKillAllChildTask());
builder.add(new CommandBuilderWithArgList("command", new String[] { "arg1", "arg2" }, workingDir, new RunIfConfigs(), new NullBuilder(), "desc"));
builder.add(new FetchArtifactBuilder(new RunIfConfigs(), new NullBuilder(), "desc", jobPlan().getIdentifier(), "srcdir", "dest", new FileHandler(workingDir, "src"), new ChecksumFileHandler(workingDir)));
BuildAssignment assignment = BuildAssignment.create(jobPlan(), buildCause, builder, workingDir, new EnvironmentVariableContext(), new ArtifactStores());
BuildWork work = new BuildWork(assignment, "utf-8");
byte[] msg = MessageEncoding.encodeMessage(new Message(Action.assignWork, MessageEncoding.encodeWork(work)));
Message decodedMsg = MessageEncoding.decodeMessage(new ByteArrayInputStream(msg));
BuildWork decodedWork = (BuildWork) MessageEncoding.decodeWork(decodedMsg.getData());
assertThat(decodedWork.getAssignment().getJobIdentifier().getPipelineName(), is("pipelineName"));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldAddDeduplicatedEnvironmentVariablesToEnvironmentVariableContextFrom2Parts.
@Test
public void shouldAddDeduplicatedEnvironmentVariablesToEnvironmentVariableContextFrom2Parts() throws Exception {
pairEnvironmentConfig.get(0).addEnvironmentVariable("variable-name1", "variable-value1");
pairEnvironmentConfig.get(1).addEnvironmentVariable("variable-name1", "variable-value1");
assertThat(pairEnvironmentConfig.getVariables().size(), is(1));
EnvironmentVariableContext context = pairEnvironmentConfig.createEnvironmentContext();
assertThat(context.getProperty("variable-name1"), is("variable-value1"));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class EnvironmentConfigTestBase method shouldAddEnvironmentNameToEnvironmentVariableContext.
@Test
public void shouldAddEnvironmentNameToEnvironmentVariableContext() throws Exception {
EnvironmentConfig another = new BasicEnvironmentConfig(new CaseInsensitiveString("other"));
EnvironmentVariableContext context = another.createEnvironmentContext();
assertThat(context.getProperty(EnvironmentVariableContext.GO_ENVIRONMENT_NAME), is("other"));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class EnvironmentConfigTestBase method shouldAddEnvironmentVariablesToEnvironmentVariableContext.
@Test
public void shouldAddEnvironmentVariablesToEnvironmentVariableContext() throws Exception {
EnvironmentConfig another = new BasicEnvironmentConfig(new CaseInsensitiveString("other"));
another.addEnvironmentVariable("variable-name", "variable-value");
EnvironmentVariableContext context = another.createEnvironmentContext();
assertThat(context.getProperty("variable-name"), is("variable-value"));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class AgentStatusReportingTest method before.
@Before
public void before() {
agentIdentifier = new AgentIdentifier("localhost", "127.0.0.1", "uuid");
environmentVariableContext = new EnvironmentVariableContext();
artifactManipulator = new GoArtifactsManipulatorStub();
buildRepository = new com.thoughtworks.go.remote.work.BuildRepositoryRemoteStub();
this.agentRuntimeInfo = new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
}
Aggregations