use of com.epam.pipeline.entity.pipeline.Folder 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);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderDaoTest method testCreateAndLoadFolderWithMetadata.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCreateAndLoadFolderWithMetadata() {
Folder folder = getFolder();
// create
folderDao.createFolder(folder);
Map<String, Integer> metadata = new HashMap<>();
metadata.put(CLASS_NAME_1, 1);
folder.setMetadata(metadata);
// add metadata
MetadataEntity metadataEntity = new MetadataEntity();
metadataEntity.setName(TEST_ENTITY_NAME_1);
MetadataClass metadataClass = createMetadataClass();
metadataEntity.setClassEntity(metadataClass);
metadataEntity.setParent(folder);
Map<String, PipeConfValue> data = new HashMap<>();
data.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, DATA_VALUE_1));
metadataEntity.setData(data);
metadataEntityDao.createMetadataEntity(metadataEntity);
Folder loaded = folderDao.loadFolder(folder.getId());
assertEquals(folder.getId(), loaded.getId());
assertEquals(folder.getName(), loaded.getName());
assertEquals(folder.getMetadata(), loaded.getMetadata());
assertNull(folder.getParentId());
Map<String, Integer> loadedMetadata = loaded.getMetadata();
assertTrue(!loadedMetadata.isEmpty() && loadedMetadata.size() == 1);
assertEquals(metadataEntity.getClassEntity().getName(), loadedMetadata.keySet().toArray()[0]);
assertEquals(1, loadedMetadata.get(CLASS_NAME_1).intValue());
}
use of com.epam.pipeline.entity.pipeline.Folder 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);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderDaoTest method createFolderWithParent.
private Folder createFolderWithParent(Folder parent, String name) {
Folder folder = new Folder();
folder.setName(name);
folder.setOwner(TEST_USER);
folder.setParentId(parent.getId());
// create
folderDao.createFolder(folder);
return folder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderDaoTest method getFolder.
public Folder getFolder() {
Folder folder = new Folder();
folder.setName(TEST_NAME);
folder.setOwner(TEST_USER);
// create
folderDao.createFolder(folder);
return folder;
}
Aggregations