Search in sources :

Example 6 with MaterialForScheduling

use of com.thoughtworks.go.server.domain.MaterialForScheduling in project gocd by gocd.

the class PipelineTriggerServiceIntegrationTest method shouldReturnErrorIfThePipelineBeingScheduledDoesNotContainTheMaterialsSetInRequest.

@Test
public void shouldReturnErrorIfThePipelineBeingScheduledDoesNotContainTheMaterialsSetInRequest() {
    assertThat(triggerMonitor.isAlreadyTriggered(pipelineName), is(false));
    PipelineScheduleOptions pipelineScheduleOptions = new PipelineScheduleOptions();
    MaterialForScheduling material = new MaterialForScheduling("non-existant-material", "r1");
    pipelineScheduleOptions.getMaterials().add(material);
    pipelineTriggerService.schedule(pipelineName, pipelineScheduleOptions, admin, result);
    assertThat(result.isSuccess(), is(false));
    assertThat(result.fullMessage(), is(String.format("Request to schedule pipeline rejected { Pipeline '%s' does not contain the following material(s): [non-existant-material]. }", pipelineName)));
    assertThat(result.httpCode(), is(422));
    assertThat(triggerMonitor.isAlreadyTriggered(pipelineName), is(false));
}
Also used : MaterialForScheduling(com.thoughtworks.go.server.domain.MaterialForScheduling) PipelineScheduleOptions(com.thoughtworks.go.server.domain.PipelineScheduleOptions) Test(org.junit.Test)

Aggregations

MaterialForScheduling (com.thoughtworks.go.server.domain.MaterialForScheduling)6 PipelineScheduleOptions (com.thoughtworks.go.server.domain.PipelineScheduleOptions)6 Test (org.junit.Test)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)4 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)2 JsonReader (com.thoughtworks.go.api.representers.JsonReader)1 EnvironmentVariableConfig (com.thoughtworks.go.config.EnvironmentVariableConfig)1 EnvironmentVariablesConfig (com.thoughtworks.go.config.EnvironmentVariablesConfig)1 GoCipher (com.thoughtworks.go.security.GoCipher)1 MaterialUpdateSuccessfulMessage (com.thoughtworks.go.server.materials.MaterialUpdateSuccessfulMessage)1 ArrayList (java.util.ArrayList)1