Search in sources :

Example 56 with BuildCause

use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.

the class PipelineScheduleQueueIntegrationTest method shouldPersistTriggerTimeEnvironmentVariable.

@Test
public void shouldPersistTriggerTimeEnvironmentVariable() {
    PipelineConfig pipelineConfig = fixture.pipelineConfig();
    pipelineConfig.setVariables(env("blahVariable", "blahValue"));
    BuildCause cause = modifySomeFilesAndTriggerAs(pipelineConfig, "cruise-developer");
    EnvironmentVariables environmentVariables = new EnvironmentVariables();
    environmentVariables.add(new EnvironmentVariable("blahVariable", "blahOverride"));
    cause.addOverriddenVariables(environmentVariables);
    saveRev(cause);
    queue.schedule(fixture.pipelineName, cause);
    Pipeline pipeline = queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider());
    assertThat(pipeline.scheduleTimeVariables(), is(new EnvironmentVariables(Arrays.asList(new EnvironmentVariable("blahVariable", "blahOverride")))));
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 57 with BuildCause

use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.

the class PipelineScheduleQueueIntegrationTest method shouldReturnNullIfBuildCauseIsTrumped.

@Test
public void shouldReturnNullIfBuildCauseIsTrumped() throws Exception {
    PipelineConfig pipelineConfig = fixture.pipelineConfig();
    BuildCause cause = modifySomeFiles(pipelineConfig, ModificationsMother.currentRevision());
    queue.schedule(fixture.pipelineName, cause);
    queue.finishSchedule(fixture.pipelineName, cause, cause);
    assertThat(queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider()), is(nullValue()));
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 58 with BuildCause

use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.

the class PipelineScheduleQueueIntegrationTest method shouldBeCanceledWhenSameBuildCause.

@Test
public void shouldBeCanceledWhenSameBuildCause() throws Exception {
    PipelineConfig pipelineConfig = fixture.pipelineConfig();
    BuildCause cause = modifySomeFiles(pipelineConfig, ModificationsMother.currentRevision());
    queue.finishSchedule(fixture.pipelineName, cause, cause);
    queue.schedule(fixture.pipelineName, cause);
    assertThat(fixture.pipelineName, is(scheduledOn(queue)));
    assertThat(queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider()), is(nullValue()));
    assertThat(fixture.pipelineName, is(not(scheduledOn(queue))));
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 59 with BuildCause

use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.

the class PipelineScheduleQueueIntegrationTest method shouldReturnNullWhenPipelineConfigOriginDoesNotMatchBuildCauseRevision.

@Test
public void shouldReturnNullWhenPipelineConfigOriginDoesNotMatchBuildCauseRevision() {
    PipelineConfig pipelineConfig = fixture.pipelineConfig();
    BuildCause cause = modifySomeFilesAndTriggerAs(pipelineConfig, "cruise-developer");
    MaterialConfig materialConfig = pipelineConfig.materialConfigs().first();
    cause.getMaterialRevisions().findRevisionFor(materialConfig);
    pipelineConfig.setOrigins(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "123"), "plug"));
    saveRev(cause);
    queue.schedule(fixture.pipelineName, cause);
    Pipeline pipeline = queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider());
    assertThat(pipeline, is(nullValue()));
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 60 with BuildCause

use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.

the class PipelineScheduleQueueIntegrationTest method shouldReturnToBeScheduledBuildCauseIfExists.

@Test
public void shouldReturnToBeScheduledBuildCauseIfExists() {
    BuildCause beforeSchedule = queue.toBeScheduled().get(fixture.pipelineName);
    assertThat(beforeSchedule, is(nullValue()));
    BuildCause buildCause = BuildCause.createWithEmptyModifications();
    queue.schedule(fixture.pipelineName, buildCause);
    BuildCause afterSchedule = queue.toBeScheduled().get(fixture.pipelineName);
    assertThat(afterSchedule, is(buildCause));
}
Also used : BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Aggregations

BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)158 Test (org.junit.Test)115 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)33 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)32 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)31 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)31 TimeProvider (com.thoughtworks.go.util.TimeProvider)28 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)21 Modification (com.thoughtworks.go.domain.materials.Modification)21 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)16 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)16 ValueStreamMapPresentationModel (com.thoughtworks.go.server.presentation.models.ValueStreamMapPresentationModel)16 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)14 Date (java.util.Date)14 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)13 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)12 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)11 Username (com.thoughtworks.go.server.domain.Username)10 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)10 Builder (com.thoughtworks.go.domain.builder.Builder)9