Search in sources :

Example 1 with JobConfig

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"));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) JobConfig(com.thoughtworks.go.config.JobConfig) Test(org.junit.Test)

Example 2 with JobConfig

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);
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) Builder(com.thoughtworks.go.domain.builder.Builder) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) JobConfig(com.thoughtworks.go.config.JobConfig) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause)

Example 3 with 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;
}
Also used : JobConfig(com.thoughtworks.go.config.JobConfig)

Example 4 with 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;
}
Also used : JobConfig(com.thoughtworks.go.config.JobConfig)

Example 5 with 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;
}
Also used : JobConfigs(com.thoughtworks.go.config.JobConfigs) JobConfig(com.thoughtworks.go.config.JobConfig)

Aggregations

JobConfig (com.thoughtworks.go.config.JobConfig)10 JobConfigs (com.thoughtworks.go.config.JobConfigs)2 ArtifactPlan (com.thoughtworks.go.config.ArtifactPlan)1 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 ConfigCache (com.thoughtworks.go.config.ConfigCache)1 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1 MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)1 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)1 Builder (com.thoughtworks.go.domain.builder.Builder)1 Test (org.junit.Test)1