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;
}
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;
}
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());
}
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);
}
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);
}
Aggregations