use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class ConfigRepoConfigTest method validate_shouldNotAllowDisabledAutoUpdate.
@Test
public void validate_shouldNotAllowDisabledAutoUpdate() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
GoConfigMother mother = new GoConfigMother();
SvnMaterialConfig svn = new SvnMaterialConfig("url", false);
svn.setAutoUpdate(false);
ConfigRepoConfig configRepoConfig = new ConfigRepoConfig(svn, "plug");
cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
configRepoConfig.validate(null);
assertThat(configRepoConfig.errors().isEmpty(), is(false));
assertThat(configRepoConfig.errors().on(ConfigRepoConfig.AUTO_UPDATE), is("Configuration repository material url must have autoUpdate enabled"));
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class ConfigRepoConfigTest method validate_shouldNotAllowPipelineWithSameRepositoryAndDisabledAutoUpdate.
@Test
public void validate_shouldNotAllowPipelineWithSameRepositoryAndDisabledAutoUpdate() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
GoConfigMother mother = new GoConfigMother();
MaterialConfigs materialConfigs = new MaterialConfigs();
SvnMaterialConfig svn = new SvnMaterialConfig("url", false);
svn.setAutoUpdate(false);
materialConfigs.add(svn);
ConfigRepoConfig configRepoConfig = new ConfigRepoConfig(svn, "plug");
cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
PipelineConfig pipeline1 = mother.addPipeline(cruiseConfig, "badpipe", "build", materialConfigs, "build");
configRepoConfig.validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline1));
assertThat(svn.errors().isEmpty(), is(false));
assertThat(svn.errors().on(ScmMaterialConfig.AUTO_UPDATE), is("Material of type Subversion (url) is specified as a configuration repository and pipeline material with disabled autoUpdate. All copies of this material must have autoUpdate enabled or configuration repository must be removed"));
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class AgentsEntityConfigUpdateCommandTest method setUp.
@Before
public void setUp() throws Exception {
result = new HttpLocalizedOperationResult();
currentUser = new Username(new CaseInsensitiveString("user"));
cruiseConfig = new GoConfigMother().defaultCruiseConfig();
goConfigService = mock(GoConfigService.class);
agentInstances = mock(AgentInstances.class);
uuids = new ArrayList<>();
environmentsToAdd = new ArrayList<>();
environmentsToRemove = new ArrayList<>();
resourcesToAdd = new ArrayList<>();
resourcesToRemove = new ArrayList<>();
triState = TriState.TRUE;
when(goConfigService.getEnvironments()).thenReturn(cruiseConfig.getEnvironments());
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class ConfigMaterialUpdaterIntegrationTest method shouldParseAndLoadValidPartialConfig.
@Test
public void shouldParseAndLoadValidPartialConfig() throws Exception {
String fileName = "pipe1.gocd.xml";
GoConfigMother mother = new GoConfigMother();
PipelineConfig pipelineConfig = mother.cruiseConfigWithOnePipelineGroup().getAllPipelineConfigs().get(0);
configTestRepo.addPipelineToRepositoryAndPush(fileName, pipelineConfig);
materialUpdateService.updateMaterial(material);
// time for messages to pass through all services
waitForMaterialNotInProgress();
PartialConfig partial = goRepoConfigDataSource.latestPartialConfigForMaterial(materialConfig);
assertNotNull(partial);
assertThat(partial.getGroups().get(0).size(), is(1));
assertThat(partial.getGroups().get(0).get(0), is(pipelineConfig));
}
use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.
the class ConfigMaterialUpdaterIntegrationTest method shouldCheckoutNewMaterial.
@Test
public void shouldCheckoutNewMaterial() throws Exception {
GoConfigMother mother = new GoConfigMother();
PipelineConfig pipelineConfig = mother.cruiseConfigWithOnePipelineGroup().getAllPipelineConfigs().get(0);
configTestRepo.addPipelineToRepositoryAndPush("pipe1.gocd.xml", pipelineConfig);
materialUpdateService.updateMaterial(material);
// time for messages to pass through all services
waitForMaterialNotInProgress();
File flyweightDir = materialRepository.folderFor(material);
Assert.assertThat(flyweightDir.exists(), is(true));
Assert.assertThat(new File(flyweightDir, "pipe1.gocd.xml").exists(), is(true));
}
Aggregations