use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineRunDaoTest method runPipelineWithRunSids.
@Test
public void runPipelineWithRunSids() {
List<RunSid> runSids = new ArrayList<>();
RunSid runSid1 = new RunSid();
runSid1.setName(TEST_USER);
runSid1.setIsPrincipal(true);
runSids.add(runSid1);
RunSid runSid2 = new RunSid();
runSid2.setName(GROUP_NAME);
runSid2.setIsPrincipal(false);
runSids.add(runSid2);
Pipeline testPipeline = getPipeline();
PipelineRun run = createRunWithRunSids(testPipeline.getId(), null, runSids);
PipelineRun loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertTrue(runSids.equals(loadedRun.getRunSids()));
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineRunDaoTest method searchGroupingRun.
@Test
public void searchGroupingRun() {
Pipeline testPipeline = getPipeline();
PipelineRun parent = createRun(testPipeline.getId(), null, TaskStatus.SUCCESS, null);
PipelineRun child = createRun(testPipeline.getId(), null, TaskStatus.SUCCESS, parent.getId());
PipelineRun lonely = createRun(testPipeline.getId(), null, TaskStatus.SUCCESS, null);
PagingRunFilterVO filterVO = new PagingRunFilterVO();
filterVO.setPage(1);
filterVO.setPageSize(TEST_PAGE_SIZE);
filterVO.setStatuses(Collections.singletonList(TaskStatus.SUCCESS));
List<PipelineRun> runs = pipelineRunDao.searchPipelineGroups(filterVO, null);
assertEquals(2, runs.size());
assertEquals(lonely.getId(), runs.get(0).getId());
assertEquals(parent.getId(), runs.get(1).getId());
assertEquals(1, runs.get(1).getChildRuns().size());
assertEquals(child.getId(), runs.get(1).getChildRuns().get(0).getId());
assertEquals(2L, pipelineRunDao.countRootRuns(filterVO, null).longValue());
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class RunStatusDaoTest method setup.
@Before
public void setup() {
testPipeline = new Pipeline();
testPipeline.setName(TEST_NAME);
testPipeline.setRepository(TEST_REPOSITORY);
testPipeline.setOwner(TEST_NAME);
pipelineDao.createPipeline(testPipeline);
testRun = ObjectCreatorUtils.createPipelineRun(1L, testPipeline.getId(), null);
pipelineRunDao.createPipelineRun(testRun);
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineDaoTest method assertPipelineWithParameters.
private void assertPipelineWithParameters(List<Pipeline> expected, Integer pageNum, Integer pageSize) {
Set<Pipeline> loaded = pipelineDao.loadAllPipelinesWithParents(pageNum, pageSize);
assertEquals(expected.size(), loaded.size());
Map<Long, Pipeline> expectedMap = expected.stream().collect(Collectors.toMap(Pipeline::getId, Function.identity()));
loaded.forEach(pipeline -> {
Pipeline expectedPipeline = expectedMap.get(pipeline.getId());
assertEquals(expectedPipeline.getName(), pipeline.getName());
Folder expectedParent = expectedPipeline.getParent();
Folder actualParent = pipeline.getParent();
while (expectedParent != null) {
assertEquals(expectedParent.getId(), actualParent.getId());
expectedParent = expectedParent.getParent();
actualParent = actualParent.getParent();
}
});
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineDaoTest method shouldLoadPipelineWithFolders.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void shouldLoadPipelineWithFolders() {
Folder root = buildFolder(null);
root.setParentId(0L);
Folder folder = buildFolder(root.getId());
folder.setParent(root);
Folder parent = buildFolder(folder.getId());
parent.setParent(folder);
Pipeline pipeline = getPipeline(TEST_NAME);
pipeline.setParentFolderId(parent.getId());
pipelineDao.createPipeline(pipeline);
Pipeline loaded = pipelineDao.loadPipelineWithParents(pipeline.getId());
verifyFolderTree(loaded.getParent(), parent);
}
Aggregations