Search in sources :

Example 1 with ExcludesFilter

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

the class GoDashboardServiceTest method allEnvironmentsForDashboard_shouldRetrievePipelineGroupsBasedOnDashboardFilters.

@Test
public void allEnvironmentsForDashboard_shouldRetrievePipelineGroupsBasedOnDashboardFilters() {
    DashboardFilter filter = new ExcludesFilter("foo", CaseInsensitiveString.list("pipeline2", "pipeline4"), Collections.emptySet());
    configMother.addPipelineWithGroup(config, "group2", "pipeline4", "stage1A", "job1A1");
    GoDashboardPipeline pipeline4 = pipeline("pipeline4", "group2");
    configMother.addPipelineWithGroup(config, "group2", "pipeline3", "stage1A", "job1A1");
    GoDashboardPipeline pipeline3 = pipeline("pipeline3", "group2");
    configMother.addPipelineWithGroup(config, "group1", "pipeline2", "stage1A", "job1A1");
    GoDashboardPipeline pipeline2 = pipeline("pipeline2", "group1");
    configMother.addPipelineWithGroup(config, "group1", "pipeline1", "stage1A", "job1A1");
    GoDashboardPipeline pipeline1 = pipeline("pipeline1", "group1");
    addPipelinesToCache(pipeline1, pipeline2, pipeline3, pipeline4);
    configMother.addEnvironmentConfig(config, "env1", "pipeline1", "pipeline2");
    configMother.addEnvironmentConfig(config, "env2", "pipeline3", "pipeline4");
    List<GoDashboardEnvironment> envs = allEnvironmentsForDashboard(filter, new Username("user1"));
    assertThat(envs.size(), is(2));
    assertThat(envs.get(0).pipelines(), contains("pipeline1"));
    assertThat(envs.get(1).pipelines(), contains("pipeline3"));
}
Also used : DashboardFilter(com.thoughtworks.go.server.domain.user.DashboardFilter) Username(com.thoughtworks.go.server.domain.Username) ExcludesFilter(com.thoughtworks.go.server.domain.user.ExcludesFilter) Test(org.junit.jupiter.api.Test)

Example 2 with ExcludesFilter

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

the class GoDashboardServiceTest method allPipelineGroupsForDashboard_shouldRetrievePipelineGroupsBasedOnDashboardFilters.

@Test
public void allPipelineGroupsForDashboard_shouldRetrievePipelineGroupsBasedOnDashboardFilters() {
    DashboardFilter filter = new ExcludesFilter("foo", CaseInsensitiveString.list("pipeline2", "pipeline4"), Collections.emptySet());
    configMother.addPipelineWithGroup(config, "group2", "pipeline4", "stage1A", "job1A1");
    GoDashboardPipeline pipeline4 = pipeline("pipeline4", "group2");
    configMother.addPipelineWithGroup(config, "group2", "pipeline3", "stage1A", "job1A1");
    GoDashboardPipeline pipeline3 = pipeline("pipeline3", "group2");
    configMother.addPipelineWithGroup(config, "group1", "pipeline2", "stage1A", "job1A1");
    GoDashboardPipeline pipeline2 = pipeline("pipeline2", "group1");
    configMother.addPipelineWithGroup(config, "group1", "pipeline1", "stage1A", "job1A1");
    GoDashboardPipeline pipeline1 = pipeline("pipeline1", "group1");
    addPipelinesToCache(pipeline1, pipeline2, pipeline3, pipeline4);
    List<GoDashboardPipelineGroup> pipelineGroups = allPipelineGroupsForDashboard(filter, new Username("user1"));
    assertThat(pipelineGroups.size(), is(2));
    assertThat(pipelineGroups.get(0).pipelines(), contains("pipeline1"));
    assertThat(pipelineGroups.get(1).pipelines(), contains("pipeline3"));
}
Also used : DashboardFilter(com.thoughtworks.go.server.domain.user.DashboardFilter) Username(com.thoughtworks.go.server.domain.Username) ExcludesFilter(com.thoughtworks.go.server.domain.user.ExcludesFilter) Test(org.junit.jupiter.api.Test)

Aggregations

Username (com.thoughtworks.go.server.domain.Username)2 DashboardFilter (com.thoughtworks.go.server.domain.user.DashboardFilter)2 ExcludesFilter (com.thoughtworks.go.server.domain.user.ExcludesFilter)2 Test (org.junit.jupiter.api.Test)2