use of com.epam.pipeline.entity.datastorage.AbstractDataStorage 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.entity.datastorage.AbstractDataStorage 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.entity.datastorage.AbstractDataStorage 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.entity.datastorage.AbstractDataStorage 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);
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage 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);
}
Aggregations