Search in sources :

Example 1 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldLoadACertainNumberOfPipelines.

@Test
public void shouldLoadACertainNumberOfPipelines() throws Exception {
    Pipeline pipeline = pipelineOne.createdPipelineWithAllStagesPassed();
    configHelper.setViewPermissionForGroup("group1", "anyone");
    PipelineInstanceModels history = pipelineHistoryService.findPipelineInstances(pipelineOne.pipelineName, "latest", 3, "anyone");
    assertThat(history.get(0).getName(), is(pipeline.getName()));
    assertThat(history.get(0).getLabel(), is(pipeline.getLabel()));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 2 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldNotLoadPipelinesThatTheUserDoesNotHavePermissionToSee.

@Test
public void shouldNotLoadPipelinesThatTheUserDoesNotHavePermissionToSee() throws Exception {
    configHelper.addSecurityWithAdminConfig();
    configHelper.setViewPermissionForGroup("group1", "foo");
    PipelineInstanceModels history = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 1), "non-admin-user");
    assertThat(history.size(), is(0));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 3 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldUnderstandIfEmptyPipelineHasNoNewModifications.

@Test
public void shouldUnderstandIfEmptyPipelineHasNoNewModifications() throws Exception {
    configHelper.setViewPermissionForGroup("group1", "anyone");
    PipelineInstanceModels models = pipelineHistoryService.findPipelineInstances(pipelineOne.pipelineName, "latest", 3, "anyone");
    PipelineInstanceModel emptyModel = models.get(0);
    assertThat(emptyModel.hasNewRevisions(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) EmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel) Test(org.junit.Test)

Example 4 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldMakePipelineInstanceCanRunFalseWhenFirstStageIsRunning.

@Test
public void shouldMakePipelineInstanceCanRunFalseWhenFirstStageIsRunning() throws Exception {
    pipelineOne.createPipelineWithFirstStageScheduled();
    configHelper.setViewPermissionForGroup("group1", "anyone");
    PipelineInstanceModels pipelineInstanceModels = pipelineHistoryService.findPipelineInstances(pipelineOne.pipelineName, "latest", 1, "anyone");
    assertThat(pipelineInstanceModels.get(0).getCanRun(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 5 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistory.

@Test
public void shouldLoadPipelineHistory() throws Exception {
    pipelineOne.createdPipelineWithAllStagesPassed();
    PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
    assertThat(history.size(), is(1));
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat(stageHistory.size(), is(3));
    for (StageInstanceModel stageHistoryItem : stageHistory) {
        assertThat(stageHistoryItem.isScheduled(), is(true));
        assertThat(stageHistoryItem.getCanRun(), is(true));
    }
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) Test(org.junit.Test)

Aggregations

PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)50 Test (org.junit.Test)20 Test (org.junit.jupiter.api.Test)20 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)14 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)10 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 PipelineInstanceModels.createPipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels)5 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 Document (org.dom4j.Document)3 XmlWriterContext (com.thoughtworks.go.domain.XmlWriterContext)2 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 PipelineNotFoundException (com.thoughtworks.go.config.PipelineNotFoundException)1 StageConfig (com.thoughtworks.go.config.StageConfig)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1