use of com.thoughtworks.go.helper.GoConfigMother 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.helper.GoConfigMother in project gocd by gocd.
the class UpdateSCMConfigCommandTest method setup.
@Before
public void setup() throws Exception {
initMocks(this);
result = new HttpLocalizedOperationResult();
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
scm = new SCM("id", new PluginConfiguration("plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("key"), new ConfigurationValue("value"))));
scm.setName("material");
scms = new SCMs();
scms.add(scm);
cruiseConfig.setSCMs(scms);
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class UpdateTemplateConfigCommandTest method setup.
@Before
public void setup() {
initMocks(this);
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
result = new HttpLocalizedOperationResult();
pipelineTemplateConfig = new PipelineTemplateConfig(new CaseInsensitiveString("template"), StageConfigMother.oneBuildPlanWithResourcesAndMaterials("stage", "job"));
authorization = new Authorization(new AdminsConfig(new AdminUser(new CaseInsensitiveString("user"))));
pipelineTemplateConfig.setAuthorization(authorization);
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class GoConfigPipelinePermissionsAuthorityTest method setUp.
@Before
public void setUp() throws Exception {
configService = mock(GoConfigService.class);
service = new GoConfigPipelinePermissionsAuthority(configService);
configMother = new GoConfigMother();
config = GoConfigMother.defaultCruiseConfig();
pluginRoleUsersStore = PluginRoleUsersStore.instance();
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class AddEnvironmentCommandTest method setup.
@Before
public void setup() throws Exception {
initMocks(this);
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
environmentName = new CaseInsensitiveString("Dev");
environmentConfig = new BasicEnvironmentConfig(environmentName);
result = new HttpLocalizedOperationResult();
actionFailed = LocalizedMessage.string("ENV_ADD_FAILED");
}
Aggregations