use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class GitManager method createOrRenameFolder.
public GitCommitEntry createOrRenameFolder(Long id, PipelineSourceItemVO folderVO) throws GitClientException {
String folderName = FilenameUtils.getName(folderVO.getPath());
Assert.isTrue(GitUtils.checkGitNaming(folderName), messageHelper.getMessage(MessageConstants.ERROR_INVALID_FOLDER_NAME, folderName));
Pipeline pipeline = pipelineManager.load(id, true);
if (folderVO.getPreviousPath() == null) {
// Previous path is missing: creating update
return createFolder(pipeline, folderVO.getPath(), folderVO.getLastCommitId(), folderVO.getComment());
} else {
// else: renaming update
return renameFolder(pipeline, folderVO.getPreviousPath(), folderVO.getPath(), folderVO.getLastCommitId(), folderVO.getComment());
}
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineDaoTest method testCreatePipeline.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCreatePipeline() {
Pipeline pipeline = getPipeline(TEST_NAME);
pipelineDao.createPipeline(pipeline);
List<Pipeline> result = pipelineDao.loadAllPipelines();
assertEquals(1, result.size());
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineDaoTest method testLoadAllPipelinesWithFolderTree.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadAllPipelinesWithFolderTree() {
Pipeline rootPipeline = getPipeline("ROOT_PIPELINE");
pipelineDao.createPipeline(rootPipeline);
assertNull(rootPipeline.getParentFolderId());
Folder rootFolder = getFolder();
folderDao.createFolder(rootFolder);
Pipeline pipeline1 = getPipeline("PIPELINE1");
pipeline1.setParentFolderId(rootFolder.getId());
pipeline1.setParent(rootFolder);
pipelineDao.createPipeline(pipeline1);
Folder doNotConsider = new Folder();
doNotConsider.setName("NOT_CONSIDER");
doNotConsider.setOwner(TEST_USER);
folderDao.createFolder(doNotConsider);
Folder folder1 = getFolder();
folder1.setParentId(rootFolder.getId());
folder1.setParent(rootFolder);
folderDao.createFolder(folder1);
Folder folder2 = getFolder();
folder2.setParentId(folder1.getId());
folder2.setParent(folder1);
folderDao.createFolder(folder2);
Folder folder3 = getFolder();
folder3.setParentId(folder2.getId());
folder3.setParent(folder2);
folderDao.createFolder(folder3);
Pipeline pipeline2 = getPipeline("PIPELINE2");
pipeline2.setParentFolderId(folder3.getId());
pipeline2.setParent(folder3);
pipelineDao.createPipeline(pipeline2);
List<Pipeline> expected = Stream.of(rootPipeline, pipeline1, pipeline2).collect(Collectors.toList());
assertPipelineWithParameters(expected, null, null);
assertPipelineWithParameters(expected, 1, 3);
expected = Stream.of(rootPipeline, pipeline1).collect(Collectors.toList());
assertPipelineWithParameters(expected, 1, 2);
expected = Stream.of(pipeline2).collect(Collectors.toList());
assertPipelineWithParameters(expected, 2, 2);
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class RestartRunDaoTest method setup.
@Before
public void setup() {
testPipeline = new Pipeline();
testPipeline.setName(TEST_NAME);
testPipeline.setRepository(TEST_REPOSITORY);
testPipeline.setOwner(TEST_NAME);
pipelineDao.createPipeline(testPipeline);
Long pipelineId = testPipeline.getId();
createPipelineRun(TEST_RUN_ID_1, pipelineId, null);
restartRun1 = new RestartRun();
restartRun1.setParentRunId(TEST_RUN_ID_1);
restartRun1.setRestartedRunId(TEST_RUN_ID_2);
restartRun1.setDate(new Date());
createPipelineRun(TEST_RUN_ID_2, pipelineId, TEST_RUN_ID_1);
restartRun2 = new RestartRun();
restartRun2.setParentRunId(TEST_RUN_ID_2);
restartRun2.setRestartedRunId(TEST_RUN_ID_3);
restartRun2.setDate(new Date());
createPipelineRun(TEST_RUN_ID_3, pipelineId, TEST_RUN_ID_2);
restartRun3 = new RestartRun();
restartRun3.setParentRunId(TEST_RUN_ID_3);
restartRun3.setRestartedRunId(TEST_RUN_ID_4);
restartRun3.setDate(new Date());
createPipelineRun(TEST_RUN_ID_5, pipelineId, null);
restartRun4 = new RestartRun();
restartRun4.setParentRunId(TEST_RUN_ID_5);
restartRun4.setRestartedRunId(TEST_RUN_ID_6);
restartRun4.setDate(new Date());
}
use of com.epam.pipeline.entity.pipeline.Pipeline in project cloud-pipeline by epam.
the class PipelineRunDaoTest method setup.
@Before
public void setup() {
testPipeline = new Pipeline();
testPipeline.setName("Test");
testPipeline.setRepository("///");
testPipeline.setOwner(TEST_USER);
pipelineDao.createPipeline(testPipeline);
}
Aggregations