Search in sources :

Example 1 with EnvironmentsConfig

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));
}
Also used : CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) EnvironmentsConfig(com.thoughtworks.go.config.EnvironmentsConfig) Test(org.junit.Test)

Example 2 with EnvironmentsConfig

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));
}
Also used : CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) EnvironmentsConfig(com.thoughtworks.go.config.EnvironmentsConfig) Test(org.junit.Test)

Example 3 with EnvironmentsConfig

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());
}
Also used : EnvironmentsConfig(com.thoughtworks.go.config.EnvironmentsConfig)

Example 4 with EnvironmentsConfig

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);
}
Also used : BasicEnvironmentConfig(com.thoughtworks.go.config.BasicEnvironmentConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) EnvironmentsConfig(com.thoughtworks.go.config.EnvironmentsConfig) Before(org.junit.Before)

Aggregations

EnvironmentsConfig (com.thoughtworks.go.config.EnvironmentsConfig)4 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)2 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)2 Test (org.junit.Test)2 BasicEnvironmentConfig (com.thoughtworks.go.config.BasicEnvironmentConfig)1 Before (org.junit.Before)1