use of com.epam.pipeline.controller.vo.DataStorageVO in project cloud-pipeline by epam.
the class DataStorageManagerTest method updateDataStorageTest.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void updateDataStorageTest() throws Exception {
Folder folder = new Folder();
folder.setName("testfolder");
folderManager.create(folder);
DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.S3, PATH, STS_DURATION, LTS_DURATION, folder.getId(), TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
AbstractDataStorage saved = storageManager.create(storageVO, false, false, false);
Folder newFolder = new Folder();
newFolder.setName("newtestfolder");
folderManager.create(newFolder);
// test that we can change parent folder for storage
storageVO.setId(saved.getId());
storageVO.setParentFolderId(newFolder.getId());
storageManager.update(storageVO);
AbstractDataStorage loaded = storageManager.load(saved.getId());
assertDataStorageAccordingToUpdateStorageVO(storageVO, loaded);
// test that we can change description for storage
storageVO.setDescription(CHANGED);
storageManager.update(storageVO);
loaded = storageManager.load(saved.getId());
assertDataStorageAccordingToUpdateStorageVO(storageVO, loaded);
}
use of com.epam.pipeline.controller.vo.DataStorageVO in project cloud-pipeline by epam.
the class DataStorageManagerTest method testFailCreateStorageWithRootMountPoint.
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testFailCreateStorageWithRootMountPoint() {
DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.NFS, PATH, WITHOUT_PARENT_ID, "/", TEST_MOUNT_OPTIONS);
storageManager.create(storageVO, false, false, false);
}
use of com.epam.pipeline.controller.vo.DataStorageVO in project cloud-pipeline by epam.
the class DataStorageManagerTest method testFailCreateOfStorageWithForbiddenMountPoint.
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testFailCreateOfStorageWithForbiddenMountPoint() {
DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.NFS, PATH, WITHOUT_PARENT_ID, FORBIDDEN_MOUNT_POINT, TEST_MOUNT_OPTIONS);
storageManager.create(storageVO, false, false, false);
}
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, Integer stsDuration, Integer ltsDuration, Long parentFolderId, String mountPoint, String mountOptions) {
DataStorageVO storageVO = constructDataStorageVO(name, description, storageType, path, parentFolderId, mountPoint, mountOptions);
StoragePolicy policy = new StoragePolicy();
if (stsDuration != null) {
policy.setShortTermStorageDuration(stsDuration);
}
if (ltsDuration != null) {
policy.setLongTermStorageDuration(ltsDuration);
}
storageVO.setStoragePolicy(policy);
return storageVO;
}
use of com.epam.pipeline.controller.vo.DataStorageVO in project cloud-pipeline by epam.
the class DataStorageManagerTest method testFailCreateOfStorageWithForbiddenMountPointWildCard.
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testFailCreateOfStorageWithForbiddenMountPointWildCard() {
Preference preference = SystemPreferences.DATA_STORAGE_NFS_MOUNT_BLACK_LIST.toPreference();
preference.setValue(SystemPreferences.DATA_STORAGE_NFS_MOUNT_BLACK_LIST.getDefaultValue() + makeSysIndependentPath(",/runs/*"));
preferenceManager.update(Collections.singletonList(preference));
DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.NFS, PATH, WITHOUT_PARENT_ID, FORBIDDEN_MOUNT_POINT_2, TEST_MOUNT_OPTIONS);
storageManager.create(storageVO, false, false, false);
}
Aggregations