Search in sources :

Example 1 with MetadataEntityVO

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);
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) HashMap(java.util.HashMap) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) PasswordGenerator.generateRandomString(com.epam.pipeline.utils.PasswordGenerator.generateRandomString) Folder(com.epam.pipeline.entity.pipeline.Folder) MetadataEntityVO(com.epam.pipeline.controller.vo.metadata.MetadataEntityVO) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with MetadataEntityVO

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;
}
Also used : MetadataEntityVO(com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)

Example 3 with MetadataEntityVO

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;
}
Also used : MetadataEntityVO(com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)

Aggregations

MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)3 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)1 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)1 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)1 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)1 Folder (com.epam.pipeline.entity.pipeline.Folder)1 PasswordGenerator.generateRandomString (com.epam.pipeline.utils.PasswordGenerator.generateRandomString)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 Transactional (org.springframework.transaction.annotation.Transactional)1