Search in sources :

Example 16 with DataStorageVO

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

the class FolderManagerTest method loadFolderWithPipelineAndStorage.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void loadFolderWithPipelineAndStorage() throws Exception {
    folderManager.create(folder);
    PipelineVO pipelineVO = constructPipelineVO(TEST_NAME, TEST_REPO, folder.getId());
    DataStorageVO storageVO = constructDataStorageVO(TEST_NAME, TEST_DESCRIPTION, DataStorageType.S3, TEST_PATH, STS_DURATION, LTS_DURATION, folder.getId(), TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    Pipeline pipeline = pipelineManager.create(pipelineVO);
    AbstractDataStorage storage = dataStorageManager.create(storageVO, false, false, false);
    Folder loaded = folderManager.load(folder.getId());
    Pipeline loadedPipe = loaded.getPipelines().get(0);
    assertNotNull(loadedPipe);
    assertEquals(pipeline.getId(), loadedPipe.getId());
    assertEquals(pipeline.getName(), loadedPipe.getName());
    assertEquals(pipeline.getParentFolderId(), loadedPipe.getParentFolderId());
    AbstractDataStorage loadedStorage = loaded.getStorages().get(0);
    assertNotNull(loadedStorage);
    assertEquals(storage.getId(), loadedStorage.getId());
    assertEquals(storage.getName(), loadedStorage.getName());
    assertEquals(storage.getParentFolderId(), loadedStorage.getParentFolderId());
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) ObjectCreatorUtils.constructDataStorageVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO) Folder(com.epam.pipeline.entity.pipeline.Folder) ObjectCreatorUtils.constructPipelineVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructPipelineVO) PipelineVO(com.epam.pipeline.controller.vo.PipelineVO) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with DataStorageVO

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

the class FolderManagerTest method deleteFolderAfterMovingPipelineAndStorage.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void deleteFolderAfterMovingPipelineAndStorage() throws Exception {
    folderManager.create(folder);
    PipelineVO pipelineVO = constructPipelineVO(TEST_NAME, TEST_REPO, folder.getId());
    DataStorageVO storageVO = constructDataStorageVO(TEST_NAME, TEST_DESCRIPTION, DataStorageType.S3, TEST_PATH, STS_DURATION, LTS_DURATION, folder.getId(), TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    Pipeline pipeline = pipelineManager.create(pipelineVO);
    AbstractDataStorage storage = dataStorageManager.create(storageVO, false, false, false);
    pipelineVO.setId(pipeline.getId());
    pipelineVO.setParentFolderId(null);
    pipelineManager.update(pipelineVO);
    storageVO.setParentFolderId(null);
    storageVO.setId(storage.getId());
    dataStorageManager.update(storageVO);
    folderManager.delete(folder.getId());
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) ObjectCreatorUtils.constructDataStorageVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO) ObjectCreatorUtils.constructPipelineVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructPipelineVO) PipelineVO(com.epam.pipeline.controller.vo.PipelineVO) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 18 with DataStorageVO

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

the class FolderManagerTest method generateDataStorage.

private void generateDataStorage(Long parentId) {
    DataStorageVO dataStorageVO = constructDataStorageVO(generateRandomString(10), TEST_DESCRIPTION, DataStorageType.S3, generateRandomString(10), STS_DURATION, LTS_DURATION, parentId, TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    dataStorageManager.create(dataStorageVO, true, true, false);
}
Also used : DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) ObjectCreatorUtils.constructDataStorageVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO)

Aggregations

DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)18 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)14 Test (org.junit.Test)14 Transactional (org.springframework.transaction.annotation.Transactional)14 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)10 ObjectCreatorUtils.constructDataStorageVO (com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO)5 Folder (com.epam.pipeline.entity.pipeline.Folder)3 Preference (com.epam.pipeline.entity.preference.Preference)3 PipelineVO (com.epam.pipeline.controller.vo.PipelineVO)2 StoragePolicy (com.epam.pipeline.entity.datastorage.StoragePolicy)2 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)2 ObjectCreatorUtils.constructPipelineVO (com.epam.pipeline.manager.ObjectCreatorUtils.constructPipelineVO)2