Search in sources :

Example 6 with PagingRunFilterVO

use of com.epam.pipeline.controller.vo.PagingRunFilterVO in project cloud-pipeline by epam.

the class PipelineRunDaoTest method testLoadActiveServicesByOwner.

@Test
public void testLoadActiveServicesByOwner() {
    PipelineRun run = createTestPipelineRun();
    PagingRunFilterVO filterVO = new PagingRunFilterVO();
    filterVO.setPage(1);
    filterVO.setPageSize(TEST_PAGE_SIZE);
    PipelineUser user = new PipelineUser();
    user.setUserName(USER);
    List<PipelineRun> runs = pipelineRunDao.loadActiveServices(filterVO, user);
    assertEquals(1, runs.size());
    assertEquals(run.getId(), runs.get(0).getId());
    assertEquals(1, runs.size());
}
Also used : PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) PipelineUser(com.epam.pipeline.entity.user.PipelineUser) PagingRunFilterVO(com.epam.pipeline.controller.vo.PagingRunFilterVO) EnvVarsBuilderTest(com.epam.pipeline.manager.execution.EnvVarsBuilderTest) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test)

Example 7 with PagingRunFilterVO

use of com.epam.pipeline.controller.vo.PagingRunFilterVO in project cloud-pipeline by epam.

the class PipelineRunManagerTest method testResolveProjectFiltering.

@Test
@WithMockUser(roles = "ADMIN")
public void testResolveProjectFiltering() {
    Folder project = new Folder();
    project.setId(1L);
    Folder child = new Folder();
    project.setId(2L);
    project.getChildFolders().add(child);
    Pipeline pipeline1 = new Pipeline();
    pipeline1.setId(2L);
    project.getPipelines().add(pipeline1);
    Pipeline pipeline2 = new Pipeline();
    pipeline2.setId(3L);
    child.getPipelines().add(pipeline2);
    RunConfiguration configuration1 = new RunConfiguration();
    configuration1.setId(4L);
    project.getConfigurations().add(configuration1);
    RunConfiguration configuration2 = new RunConfiguration();
    configuration2.setId(5L);
    child.getConfigurations().add(configuration2);
    when(folderManager.load(project.getId())).thenReturn(project);
    PagingRunFilterVO filterVO = new PagingRunFilterVO();
    filterVO.setProjectIds(Collections.singletonList(project.getId()));
    PipelineRunFilterVO.ProjectFilter projectFilter = pipelineRunManager.resolveProjectFiltering(filterVO);
    Assert.assertEquals(2, projectFilter.getPipelineIds().size());
    Assert.assertEquals(2, projectFilter.getConfigurationIds().size());
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) PagingRunFilterVO(com.epam.pipeline.controller.vo.PagingRunFilterVO) Folder(com.epam.pipeline.entity.pipeline.Folder) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) PipelineRunFilterVO(com.epam.pipeline.controller.vo.PipelineRunFilterVO) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test)

Aggregations

PagingRunFilterVO (com.epam.pipeline.controller.vo.PagingRunFilterVO)7 Test (org.junit.Test)7 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)6 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)6 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)6 EnvVarsBuilderTest (com.epam.pipeline.manager.execution.EnvVarsBuilderTest)6 PipelineUser (com.epam.pipeline.entity.user.PipelineUser)5 RunSid (com.epam.pipeline.entity.pipeline.run.parameter.RunSid)4 ArrayList (java.util.ArrayList)4 PipelineRunFilterVO (com.epam.pipeline.controller.vo.PipelineRunFilterVO)3 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)2 CommitStatus (com.epam.pipeline.entity.pipeline.CommitStatus)2 RunInstance (com.epam.pipeline.entity.pipeline.RunInstance)2 TaskStatus (com.epam.pipeline.entity.pipeline.TaskStatus)2 DateUtils (com.epam.pipeline.entity.utils.DateUtils)2 EnvVarsBuilder (com.epam.pipeline.manager.execution.EnvVarsBuilder)2 SystemParams (com.epam.pipeline.manager.execution.SystemParams)2 BigDecimal (java.math.BigDecimal)2 LocalDate (java.time.LocalDate)2 LocalDateTime (java.time.LocalDateTime)2