use of com.thoughtworks.go.config.JobConfig in project gocd by gocd.
the class ArtifactPlanTest method validate_shouldFailIfSourceIsEmpty.
@Test
public void validate_shouldFailIfSourceIsEmpty() {
ArtifactPlan artifactPlan = new ArtifactPlan(null, "bar");
artifactPlan.validate(ConfigSaveValidationContext.forChain(new JobConfig("jobname")));
assertThat(artifactPlan.errors().on(ArtifactPlan.SRC), is("Job 'jobname' has an artifact with an empty source"));
}
use of com.thoughtworks.go.config.JobConfig 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.JobConfig in project gocd by gocd.
the class JobRepresenter method fromJSON.
public static JobConfig fromJSON(JsonReader jsonReader) {
JobRepresenter.jsonReader = jsonReader;
JobConfig jobConfig = new JobConfig();
jsonReader.readCaseInsensitiveStringIfPresent("name", jobConfig::setName);
setRunInstanceCount(jobConfig);
setTimeout(jobConfig);
jsonReader.readStringIfPresent("elastic_profile_id", jobConfig::setElasticProfileId);
setArtifacts(jobConfig);
jobConfig.setVariables(EnvironmentVariableRepresenter.fromJSONArray(jsonReader));
setResources(jobConfig);
jobConfig.setTabs(TabConfigRepresenter.fromJSONArray(jsonReader));
jobConfig.setTasks(TaskRepresenter.fromJSONArray(jsonReader));
return jobConfig;
}
use of com.thoughtworks.go.config.JobConfig in project gocd by gocd.
the class JobRepresenter method fromJSON.
public static JobConfig fromJSON(JsonReader jsonReader) {
JobRepresenter.jsonReader = jsonReader;
JobConfig jobConfig = new JobConfig();
jsonReader.readCaseInsensitiveStringIfPresent("name", jobConfig::setName);
setRunInstanceCount(jobConfig);
setTimeout(jobConfig);
jsonReader.readStringIfPresent("elastic_profile_id", jobConfig::setElasticProfileId);
setArtifacts(jobConfig);
jobConfig.setVariables(EnvironmentVariableRepresenter.fromJSONArray(jsonReader));
setResources(jobConfig);
jobConfig.setTabs(TabConfigRepresenter.fromJSONArray(jsonReader));
jobConfig.setTasks(TaskRepresenter.fromJSONArray(jsonReader));
return jobConfig;
}
use of com.thoughtworks.go.config.JobConfig in project gocd by gocd.
the class PipelineServiceTest method jobs.
private JobConfigs jobs() {
JobConfigs configs = new JobConfigs();
configs.add(new JobConfig("job"));
return configs;
}
Aggregations