use of com.thoughtworks.go.config.ConfigCache in project gocd by gocd.
the class BuildWorkTest method createBuildWorkWithJobPlan.
private void createBuildWorkWithJobPlan(JobPlan jobPlan) throws Exception {
CruiseConfig cruiseConfig = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).loadConfigHolder(FileUtil.readToEnd(IOUtils.toInputStream(ConfigFileFixture.withJob(CMD_NOT_EXIST)))).config;
JobConfig jobConfig = cruiseConfig.jobConfigByName(PIPELINE_NAME, STAGE_NAME, JOB_PLAN_NAME, true);
final Stage stage = StageMother.custom(STAGE_NAME, new JobInstance(JOB_PLAN_NAME));
BuildCause buildCause = BuildCause.createWithEmptyModifications();
final Pipeline pipeline = new Pipeline(PIPELINE_NAME, buildCause, stage);
List<Builder> builder = builderFactory.buildersForTasks(pipeline, jobConfig.getTasks(), resolver);
BuildAssignment buildAssignment = BuildAssignment.create(jobPlan, BuildCause.createWithEmptyModifications(), builder, pipeline.defaultWorkingFolder());
buildWork = new BuildWork(buildAssignment);
}
use of com.thoughtworks.go.config.ConfigCache in project gocd by gocd.
the class BaseConfigXmlWriterTest method setup.
@Before
public void setup() {
output = new ByteArrayOutputStream();
ConfigCache configCache = new ConfigCache();
xmlWriter = new MagicalGoConfigXmlWriter(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
xmlLoader = new MagicalGoConfigXmlLoader(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
}
use of com.thoughtworks.go.config.ConfigCache in project gocd by gocd.
the class EntityHashingServiceTest method setUp.
@Before
public void setUp() {
this.goConfigService = mock(GoConfigService.class);
this.goCache = mock(GoCache.class);
this.configCache = new ConfigCache();
this.registry = ConfigElementImplementationRegistryMother.withNoPlugins();
this.entityHashingService = new EntityHashingService(this.goConfigService, this.goCache, configCache, registry);
}
use of com.thoughtworks.go.config.ConfigCache in project gocd by gocd.
the class GoConfigAdministrationControllerIntegrationTest method shouldConflictWhenGivenMd5IsDifferent.
@Test
public void shouldConflictWhenGivenMd5IsDifferent() throws Exception {
configHelper.addPipeline("pipeline", "stage", "build1", "build2");
controller.getCurrentConfigXml("crapy_md5", response);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new MagicalGoConfigXmlWriter(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).write(goConfigDao.loadForEditing(), os, true);
assertValidContentAndStatus(SC_CONFLICT, "text/plain; charset=utf-8", CONFIG_CHANGED_PLEASE_REFRESH);
assertThat(response.getHeader(XmlAction.X_CRUISE_CONFIG_MD5), is(goConfigDao.md5OfConfigFile()));
}
use of com.thoughtworks.go.config.ConfigCache in project gocd by gocd.
the class GoConfigAdministrationControllerIntegrationTest method shouldGetConfigAsXml.
@Test
public void shouldGetConfigAsXml() throws Exception {
configHelper.addPipeline("pipeline", "stage", "build1", "build2");
controller.getCurrentConfigXml(null, response);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new MagicalGoConfigXmlWriter(new ConfigCache(), registry).write(goConfigDao.loadForEditing(), os, true);
assertValidContentAndStatus(SC_OK, "text/xml", os.toString());
assertThat(response.getHeader(XmlAction.X_CRUISE_CONFIG_MD5), is(goConfigDao.md5OfConfigFile()));
}
Aggregations