Search in sources :

Example 51 with Pipeline

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());
    }
}
Also used : Pipeline(com.epam.pipeline.entity.pipeline.Pipeline)

Example 52 with Pipeline

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());
}
Also used : Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 53 with Pipeline

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);
}
Also used : Folder(com.epam.pipeline.entity.pipeline.Folder) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 54 with Pipeline

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());
}
Also used : RestartRun(com.epam.pipeline.entity.pipeline.run.RestartRun) Date(java.util.Date) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) Before(org.junit.Before)

Example 55 with Pipeline

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);
}
Also used : Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) Before(org.junit.Before)

Aggregations

Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)88 Test (org.junit.Test)41 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)25 Transactional (org.springframework.transaction.annotation.Transactional)18 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)16 GitCommitEntry (com.epam.pipeline.entity.git.GitCommitEntry)14 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)13 Revision (com.epam.pipeline.entity.pipeline.Revision)12 Folder (com.epam.pipeline.entity.pipeline.Folder)10 Before (org.junit.Before)9 GitFile (com.epam.pipeline.entity.git.GitFile)8 GitRepositoryEntry (com.epam.pipeline.entity.git.GitRepositoryEntry)7 EnvVarsBuilderTest (com.epam.pipeline.manager.execution.EnvVarsBuilderTest)7 Date (java.util.Date)7 List (java.util.List)7 GitTagEntry (com.epam.pipeline.entity.git.GitTagEntry)6 PipelineUser (com.epam.pipeline.entity.user.PipelineUser)6 IsEmptyString.isEmptyString (org.hamcrest.text.IsEmptyString.isEmptyString)6 Matchers.anyString (org.mockito.Matchers.anyString)6 EntityVO (com.epam.pipeline.controller.vo.EntityVO)5