use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldAddEnvironmentVariablesToEnvironmentVariableContextFrom2Parts.
@Test
public void shouldAddEnvironmentVariablesToEnvironmentVariableContextFrom2Parts() throws Exception {
pairEnvironmentConfig.get(0).addEnvironmentVariable("variable-name1", "variable-value1");
pairEnvironmentConfig.get(1).addEnvironmentVariable("variable-name2", "variable-value2");
EnvironmentVariableContext context = pairEnvironmentConfig.createEnvironmentContext();
assertThat(context.getProperty("variable-name1"), is("variable-value1"));
assertThat(context.getProperty("variable-name2"), is("variable-value2"));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class EnvironmentVariableConfigTest method shouldAddPlainTextEnvironmentVariableToContext.
@Test
public void shouldAddPlainTextEnvironmentVariableToContext() {
String key = "key";
String plainText = "plainText";
EnvironmentVariableConfig environmentVariableConfig = new EnvironmentVariableConfig(goCipher, key, plainText, false);
EnvironmentVariableContext context = new EnvironmentVariableContext();
environmentVariableConfig.addTo(context);
assertThat(context.getProperty(key), is(plainText));
assertThat(context.getPropertyForDisplay(key), is(plainText));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class EnvironmentVariableConfigTest method shouldAddSecureEnvironmentVariableToContext.
@Test
public void shouldAddSecureEnvironmentVariableToContext() throws InvalidCipherTextException {
String key = "key";
String plainText = "plainText";
String cipherText = "encrypted";
when(goCipher.encrypt(plainText)).thenReturn(cipherText);
when(goCipher.decrypt(cipherText)).thenReturn(plainText);
EnvironmentVariableConfig environmentVariableConfig = new EnvironmentVariableConfig(goCipher, key, plainText, true);
EnvironmentVariableContext context = new EnvironmentVariableContext();
environmentVariableConfig.addTo(context);
assertThat(context.getProperty(key), is(plainText));
assertThat(context.getPropertyForDisplay(key), is(EnvironmentVariableContext.EnvironmentVariable.MASK_VALUE));
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class MergeEnvironmentConfig method createEnvironmentContext.
@Override
public EnvironmentVariableContext createEnvironmentContext() {
EnvironmentVariableContext context = new EnvironmentVariableContext(EnvironmentVariableContext.GO_ENVIRONMENT_NAME, CaseInsensitiveString.str(this.name()));
this.getVariables().addTo(context);
return context;
}
use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.
the class BuildWorkTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
agentIdentifier = new AgentIdentifier("localhost", "127.0.0.1", "uuid");
environmentVariableContext = new EnvironmentVariableContext();
artifactManipulator = new GoArtifactsManipulatorStub();
new SystemEnvironment().setProperty("serviceUrl", SERVER_URL);
buildRepository = new com.thoughtworks.go.remote.work.BuildRepositoryRemoteStub();
}
Aggregations