Search in sources :

Example 1 with DataStorageVO

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

the class FolderDaoTest method addStorage.

private AbstractDataStorage addStorage(Folder folder) {
    // add datastorage
    DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(TEST_DATASTORAGE, TEST_DATASTORAGE, DataStorageType.S3, S3_TEST_DATASTORAGE_PATH, 1, 1, folder.getId(), TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    AbstractDataStorage storage = storageFactory.convertToDataStorage(storageVO);
    storage.setOwner(TEST_USER);
    dataStorageDao.createDataStorage(storage);
    return storage;
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO)

Example 2 with DataStorageVO

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

the class ObjectCreatorUtils method constructDataStorageVO.

public static DataStorageVO constructDataStorageVO(String name, String description, DataStorageType storageType, String path, Long parentFolderId, String mountPoint, String mountOptions) {
    DataStorageVO storageVO = new DataStorageVO();
    if (name != null) {
        storageVO.setName(name);
    }
    if (path != null) {
        storageVO.setPath(path);
    }
    if (description != null) {
        storageVO.setDescription(description);
    }
    if (storageType != null) {
        storageVO.setType(storageType);
    }
    storageVO.setMountOptions(mountOptions);
    storageVO.setMountPoint(mountPoint);
    if (parentFolderId != null) {
        storageVO.setParentFolderId(parentFolderId);
    }
    return storageVO;
}
Also used : DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO)

Example 3 with DataStorageVO

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

the class DataStorageManagerTest method testFailToGenerateSharedURLForNotSharedStorage.

@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testFailToGenerateSharedURLForNotSharedStorage() {
    DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.S3, PATH, STS_DURATION, LTS_DURATION, WITHOUT_PARENT_ID, TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    AbstractDataStorage saved = storageManager.create(storageVO, false, false, false);
    storageManager.generateSharedUrlForStorage(saved.getId());
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with DataStorageVO

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

the class DataStorageManagerTest method testGenerateSharedURLForSharedStorage.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testGenerateSharedURLForSharedStorage() {
    Preference preference = SystemPreferences.BASE_API_SHARED.toPreference();
    preference.setValue(SHARED_BASE_URL_TEMPLATE);
    preferenceManager.update(Collections.singletonList(preference));
    DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.S3, PATH, STS_DURATION, LTS_DURATION, WITHOUT_PARENT_ID, TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    storageVO.setShared(true);
    AbstractDataStorage saved = storageManager.create(storageVO, false, false, false);
    String url = storageManager.generateSharedUrlForStorage(saved.getId());
    Assert.assertEquals(SHARED_BASE_URL + saved.getId(), url);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Preference(com.epam.pipeline.entity.preference.Preference) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with DataStorageVO

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

the class DataStorageManagerTest method saveDataStorageTest.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void saveDataStorageTest() throws Exception {
    DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.S3, PATH, STS_DURATION, LTS_DURATION, WITHOUT_PARENT_ID, TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
    AbstractDataStorage saved = storageManager.create(storageVO, false, false, false);
    AbstractDataStorage loaded = storageManager.load(saved.getId());
    compareDataStorage(saved, loaded);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

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