use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class PipelineConfigSaveValidationContextTest method shouldReturnNullIfMatchingMaterialConfigIsNotFound.
@Test
public void shouldReturnNullIfMatchingMaterialConfigIsNotFound() throws Exception {
CruiseConfig cruiseConfig = new GoConfigMother().cruiseConfigWithPipelineUsingTwoMaterials();
PipelineConfigSaveValidationContext context = PipelineConfigSaveValidationContext.forChain(true, "group", cruiseConfig);
assertThat(context.getAllMaterialsByFingerPrint("does_not_exist"), is(nullValue()));
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class PatchEnvironmentCommandTest method setup.
@Before
public void setup() throws Exception {
initMocks(this);
pipelinesToAdd = new ArrayList<>();
pipelinesToRemove = new ArrayList<>();
agentsToAdd = new ArrayList<>();
agentsToRemove = new ArrayList<>();
envVarsToAdd = new ArrayList<>();
envVarsToRemove = new ArrayList<>();
result = new HttpLocalizedOperationResult();
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
environmentName = new CaseInsensitiveString("Dev");
environmentConfig = new BasicEnvironmentConfig(environmentName);
cruiseConfig.addEnvironment(environmentConfig);
pipelineConfig = new PipelineConfig();
String pipelineName = "pipeline-1";
pipelineConfig.setName(pipelineName);
cruiseConfig.addPipeline("First-Group", pipelineConfig);
agentConfig = new AgentConfig("uuid-1");
cruiseConfig.agents().add(agentConfig);
actionFailed = LocalizedMessage.string("ENV_UPDATE_FAILED", environmentConfig.name());
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class TemplateConfigCommandTest method setup.
@Before
public void setup() {
initMocks(this);
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class UpdateConfigRepoCommandTest method setup.
@Before
public void setup() throws Exception {
initMocks(this);
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
oldConfigRepoId = "old-repo";
newConfigRepoId = "new-repo";
oldConfigRepo = new ConfigRepoConfig(new GitMaterialConfig("foo.git", "master"), "json-plugin", oldConfigRepoId);
newConfigRepo = new ConfigRepoConfig(new GitMaterialConfig("bar.git", "master"), "yaml-plugin", newConfigRepoId);
result = new HttpLocalizedOperationResult();
md5 = "md5";
cruiseConfig.getConfigRepos().add(oldConfigRepo);
actionFailed = LocalizedMessage.string("RESOURCE_UPDATE_FAILED", "Config repo", oldConfigRepoId);
}
use of com.thoughtworks.go.helper.GoConfigMother 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));
}
Aggregations