use of com.thoughtworks.go.config.EnvironmentsConfig in project gocd by gocd.
the class UpdateEnvironmentsCommandTest method shouldAddAgentToListOfEnvironment.
@Test
public void shouldAddAgentToListOfEnvironment() throws Exception {
String agentUuid = "uuid";
UpdateEnvironmentsCommand command = new UpdateEnvironmentsCommand(agentUuid, "foo, bar, baz");
CruiseConfig cruiseConfig = new GoConfigMother().defaultCruiseConfig();
cruiseConfig.addEnvironment("foo");
cruiseConfig.addEnvironment("bar");
cruiseConfig.addEnvironment("baz");
command.update(cruiseConfig);
EnvironmentsConfig environments = cruiseConfig.getEnvironments();
assertThat(environments.named(new CaseInsensitiveString("foo")).getAgents().getUuids().contains(agentUuid), is(true));
assertThat(environments.named(new CaseInsensitiveString("bar")).getAgents().getUuids().contains(agentUuid), is(true));
assertThat(environments.named(new CaseInsensitiveString("baz")).getAgents().getUuids().contains(agentUuid), is(true));
}
use of com.thoughtworks.go.config.EnvironmentsConfig in project gocd by gocd.
the class UpdateEnvironmentsCommandTest method shouldNotThrowUpIfEnvironmentNameIsInvalid.
@Test
public void shouldNotThrowUpIfEnvironmentNameIsInvalid() throws Exception {
String agentUuid = "uuid";
UpdateEnvironmentsCommand command = new UpdateEnvironmentsCommand(agentUuid, "foo, bar, monkey");
CruiseConfig cruiseConfig = new GoConfigMother().defaultCruiseConfig();
cruiseConfig.addEnvironment("foo");
cruiseConfig.addEnvironment("bar");
command.update(cruiseConfig);
EnvironmentsConfig environments = cruiseConfig.getEnvironments();
assertThat(environments.named(new CaseInsensitiveString("foo")).getAgents().getUuids().contains(agentUuid), is(true));
assertThat(environments.named(new CaseInsensitiveString("bar")).getAgents().getUuids().contains(agentUuid), is(true));
}
use of com.thoughtworks.go.config.EnvironmentsConfig in project gocd by gocd.
the class EnvironmentPipelineValidator method validate.
public void validate(CruiseConfig cruiseConfig) throws Exception {
EnvironmentsConfig environments = cruiseConfig.getEnvironments();
environments.validateContainOnlyPiplines(cruiseConfig.getAllPipelineNames());
}
use of com.thoughtworks.go.config.EnvironmentsConfig in project gocd by gocd.
the class EnvironmentsConfigTest method setUp.
@Before
public void setUp() throws Exception {
configs = new EnvironmentsConfig();
env = new BasicEnvironmentConfig(new CaseInsensitiveString("uat"));
env.addPipeline(new CaseInsensitiveString("deployment"));
env.addAgent("agent-one");
configs.add(env);
}
Aggregations