use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method testLoadActiveServicesByUserInGroup.
@Test
public void testLoadActiveServicesByUserInGroup() {
List<RunSid> runSids = new ArrayList<>();
RunSid runSid = new RunSid();
runSid.setName(GROUP_NAME);
runSid.setIsPrincipal(false);
runSids.add(runSid);
Pipeline testPipeline = getPipeline();
PipelineRun run = createRunWithRunSids(testPipeline.getId(), null, runSids);
PagingRunFilterVO filterVO = new PagingRunFilterVO();
filterVO.setPage(1);
filterVO.setPageSize(TEST_PAGE_SIZE);
PipelineUser user = new PipelineUser();
user.setUserName(TEST_USER);
user.setGroups(Collections.singletonList(GROUP_NAME));
List<PipelineRun> runs = pipelineRunDao.loadActiveServices(filterVO, user);
assertEquals(1, runs.size());
assertEquals(run.getId(), runs.get(0).getId());
assertEquals(1, runs.size());
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method runPipelineWithEntitiesIds.
@Test
public void runPipelineWithEntitiesIds() {
Long entitiesId = 1L;
PipelineRun run = createRunWithEntitiesIds(testPipeline.getId(), TaskStatus.SUCCESS, null, entitiesId);
PipelineRun loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(Collections.singletonList(entitiesId), loadedRun.getEntitiesIds());
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method testLoadActiveServicesByUserIsPrincipal.
@Test
public void testLoadActiveServicesByUserIsPrincipal() {
List<RunSid> runSids = new ArrayList<>();
RunSid runSid1 = new RunSid();
runSid1.setName(TEST_USER);
runSid1.setIsPrincipal(true);
runSids.add(runSid1);
Pipeline testPipeline = getPipeline();
PipelineRun run = createRunWithRunSids(testPipeline.getId(), null, runSids);
PagingRunFilterVO filterVO = new PagingRunFilterVO();
filterVO.setPage(1);
filterVO.setPageSize(TEST_PAGE_SIZE);
PipelineUser user = new PipelineUser();
user.setUserName(TEST_USER);
List<PipelineRun> runs = pipelineRunDao.loadActiveServices(filterVO, user);
assertEquals(1, runs.size());
assertEquals(run.getId(), runs.get(0).getId());
assertEquals(1, runs.size());
int servicesCount = pipelineRunDao.countActiveServices(user);
assertEquals(runs.size(), servicesCount);
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method testLoadByIds.
@Test
public void testLoadByIds() {
PipelineRun run1 = createTestPipelineRun();
createTestPipelineRun();
List<PipelineRun> pipelineRuns = pipelineRunDao.loadPipelineRuns(Collections.singletonList(run1.getId()));
assertEquals(1, pipelineRuns.size());
assertEquals(run1.getId(), pipelineRuns.get(0).getId());
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method pipelineRunShouldContainsCmdTemplateAndActualCmd.
@Test
public void pipelineRunShouldContainsCmdTemplateAndActualCmd() {
PipelineRun run = new PipelineRun();
run.setPipelineId(testPipeline.getId());
run.setVersion("abcdefg");
run.setStartDate(new Date());
run.setEndDate(run.getStartDate());
run.setStatus(TaskStatus.RUNNING);
run.setCommitStatus(CommitStatus.NOT_COMMITTED);
run.setLastChangeCommitTime(new Date());
run.setPodId(TEST_POD_ID);
run.setParams(TEST_PARAMS);
run.setOwner(USER);
String cmdTemplate = "cmdTemplate";
String actualCmd = "ActualCmd";
run.setCmdTemplate(cmdTemplate);
run.setActualCmd(actualCmd);
run.setDockerImage("dockerImage");
pipelineRunDao.createPipelineRun(run);
PipelineRun loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(loadedRun.getCmdTemplate(), cmdTemplate);
assertEquals(loadedRun.getActualCmd(), actualCmd);
}
Aggregations