Search in sources :

Example 6 with AbstractDataStorage

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

the class DataStorageDaoTest method shouldReturnStorageWithoutParentAsRoot.

@Test
public void shouldReturnStorageWithoutParentAsRoot() {
    AbstractDataStorage rootBucket = s3Bucket;
    rootBucket.setParentFolderId(null);
    dataStorageDao.createDataStorage(rootBucket);
    AbstractDataStorage storageInFolder = ObjectCreatorUtils.clone(s3Bucket);
    storageInFolder.setParentFolderId(testFolder.getId());
    dataStorageDao.createDataStorage(storageInFolder);
    assertThat(dataStorageDao.loadRootDataStorages()).hasSize(1).doesNotContain(storageInFolder).contains(rootBucket);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 7 with AbstractDataStorage

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

the class DataStorageDaoTest method shouldLoadExistingNFSStorageById.

@Test
public void shouldLoadExistingNFSStorageById() {
    dataStorageDao.createDataStorage(nfsStorage);
    AbstractDataStorage loaded = dataStorageDao.loadDataStorage(nfsStorage.getId());
    validateNFSStorage(loaded, nfsStorage);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 8 with AbstractDataStorage

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

the class DataStorageDaoTest method shouldNotReturnStorageByPathWithWrongParent.

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

Example 9 with AbstractDataStorage

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

the class DataStorageDaoTest method shouldReturnStorageByNameAndParent.

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

Example 10 with AbstractDataStorage

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

the class FolderDaoTest method testCreateAndLoadFolderWithStorages.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCreateAndLoadFolderWithStorages() {
    Folder folder = getFolder();
    // add datastorage
    AbstractDataStorage storage = addStorage(folder);
    Folder loaded = folderDao.loadFolder(folder.getId());
    assertEquals(folder.getId(), loaded.getId());
    assertEquals(folder.getName(), loaded.getName());
    assertNull(folder.getParentId());
    checkStorageIsPresent(storage, loaded);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Folder(com.epam.pipeline.entity.pipeline.Folder) 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