use of com.epam.pipeline.controller.vo.metadata.MetadataEntityVO in project cloud-pipeline by epam.
the class FolderManagerTest method shouldCloneFolderWithMetadataEntities.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void shouldCloneFolderWithMetadataEntities() {
Folder sourceFolder = new Folder();
sourceFolder.setName(FOLDER_TO_CLONE);
folderManager.create(sourceFolder);
Map<String, PipeConfValue> metadata = new HashMap<>();
metadata.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, DATA_VALUE_1));
MetadataClass metadataClass = metadataEntityManager.createMetadataClass(TEST_NAME);
MetadataEntityVO metadataEntity = new MetadataEntityVO();
metadataEntity.setParentId(sourceFolder.getId());
metadataEntity.setClassName(metadataClass.getName());
metadataEntity.setClassId(metadataClass.getId());
metadataEntity.setData(metadata);
metadataEntity.setEntityName(TEST_NAME);
MetadataEntity expectedMetadata = metadataEntityManager.updateMetadataEntity(metadataEntity);
Folder childSourceFolder = new Folder();
childSourceFolder.setName(CHILD_FOLDER_TO_CLONE);
childSourceFolder.setParentId(sourceFolder.getId());
folderManager.create(childSourceFolder);
metadataEntity.setParentId(childSourceFolder.getId());
metadataEntityManager.updateMetadataEntity(metadataEntity);
Folder destinationFolder = new Folder();
destinationFolder.setName(TEST_NAME);
folderManager.create(destinationFolder);
folderManager.cloneFolder(sourceFolder.getId(), destinationFolder.getId(), TEST_CLONE_PREFIX);
destinationFolder = folderManager.loadByNameOrId(TEST_NAME);
destinationFolder = folderManager.load(destinationFolder.getId());
Folder clonedFolder = destinationFolder.getChildFolders().get(0);
MetadataEntity clonedMetadata = metadataEntityManager.loadMetadataEntityByClassNameAndFolderId(clonedFolder.getId(), metadataClass.getName()).get(0);
assertMetadataEntity(expectedMetadata, clonedMetadata);
Folder clonedChildFolder = clonedFolder.getChildFolders().get(0);
clonedMetadata = metadataEntityManager.loadMetadataEntityByClassNameAndFolderId(clonedChildFolder.getId(), metadataClass.getName()).get(0);
assertMetadataEntity(expectedMetadata, clonedMetadata);
}
use of com.epam.pipeline.controller.vo.metadata.MetadataEntityVO in project cloud-pipeline by epam.
the class ObjectCreatorUtils method createMetadataEntityVo.
public static MetadataEntityVO createMetadataEntityVo(Long classId, Long parentId, String name, String externalId, Map<String, PipeConfValue> data) {
MetadataEntityVO vo = new MetadataEntityVO();
vo.setClassId(classId);
vo.setEntityName(name);
vo.setExternalId(externalId);
vo.setParentId(parentId);
vo.setData(data);
return vo;
}
use of com.epam.pipeline.controller.vo.metadata.MetadataEntityVO in project cloud-pipeline by epam.
the class MetadataUploadManagerTest method createEntityVO.
private MetadataEntityVO createEntityVO(Long parentId, Long classId, String externalId) {
MetadataEntityVO vo = new MetadataEntityVO();
vo.setParentId(parentId);
vo.setClassId(classId);
vo.setExternalId(externalId);
return vo;
}
Aggregations