Search in sources :

Example 51 with AbstractDataStorage

use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.

the class DataStorageDaoTest method shouldReturnStorageWithParents.

@Test
public void shouldReturnStorageWithParents() {
    Folder childFolder = new Folder();
    childFolder.setName("childFolder");
    childFolder.setOwner(TEST_OWNER);
    childFolder.setParentId(testFolder.getId());
    folderDao.createFolder(childFolder);
    s3Bucket.setParentFolderId(childFolder.getId());
    dataStorageDao.createDataStorage(s3Bucket);
    Collection<AbstractDataStorage> storages = dataStorageDao.loadAllWithParents(1, 10);
    assertThat(storages).hasSize(1).containsOnly(s3Bucket).extracting(AbstractDataStorage::getParent).containsOnly(childFolder).extracting(Folder::getParent).containsOnly(testFolder);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Folder(com.epam.pipeline.entity.pipeline.Folder) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 52 with AbstractDataStorage

use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.

the class DataStorageDaoTest method shouldLoadExistingS3StorageByPath.

@Test
public void shouldLoadExistingS3StorageByPath() {
    dataStorageDao.createDataStorage(s3Bucket);
    AbstractDataStorage loaded = dataStorageDao.loadDataStorageByNameOrPath(TEST_STORAGE_PATH, TEST_STORAGE_PATH);
    validateS3Storage(loaded, s3Bucket);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 53 with AbstractDataStorage

use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.

the class DataStorageDaoTest method shouldReturnStorageByPathAndParent.

@Test
public void shouldReturnStorageByPathAndParent() {
    dataStorageDao.createDataStorage(s3Bucket);
    AbstractDataStorage loaded = dataStorageDao.loadDataStorageByNameAndParentId(s3Bucket.getPath(), testFolder.getId());
    validateS3Storage(loaded, s3Bucket);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 54 with AbstractDataStorage

use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.

the class FolderDaoTest method testCreateAndLoadFolderWithConfigurations.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCreateAndLoadFolderWithConfigurations() {
    Folder folder = getFolder();
    AbstractDataStorage storage = addStorage(folder);
    RunConfiguration configuration = addConfiguration(folder);
    Folder loaded = folderDao.loadFolder(folder.getId());
    assertEquals(folder.getId(), loaded.getId());
    assertEquals(folder.getName(), loaded.getName());
    assertNull(folder.getParentId());
    checkStorageIsPresent(storage, loaded);
    checkConfigIsPresent(configuration, loaded);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) Folder(com.epam.pipeline.entity.pipeline.Folder) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 55 with AbstractDataStorage

use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.

the class DataStorageManagerTest method testCreateENSDataStorage.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testCreateENSDataStorage() {
    DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.NFS, PATH, 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

AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)62 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)22 Test (org.junit.Test)22 Transactional (org.springframework.transaction.annotation.Transactional)18 Folder (com.epam.pipeline.entity.pipeline.Folder)13 DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)11 ArrayList (java.util.ArrayList)7 List (java.util.List)6 EntityVO (com.epam.pipeline.controller.vo.EntityVO)5 StoragePolicy (com.epam.pipeline.entity.datastorage.StoragePolicy)5 Service (org.springframework.stereotype.Service)5 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)4 UpdateDataStorageItemVO (com.epam.pipeline.controller.vo.data.storage.UpdateDataStorageItemVO)3 DataStorageDownloadFileUrl (com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl)3 DataStorageException (com.epam.pipeline.entity.datastorage.DataStorageException)3 DataStorageFile (com.epam.pipeline.entity.datastorage.DataStorageFile)3 DataStorageLink (com.epam.pipeline.entity.pipeline.run.parameter.DataStorageLink)3 ObjectCreatorUtils.constructDataStorageVO (com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO)3 IOException (java.io.IOException)3 MessageConstants (com.epam.pipeline.common.MessageConstants)2