Search in sources :

Example 11 with FolderWithMetadata

use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.

the class FolderDaoTest method createObjectMetadata.

private List<FolderWithMetadata> createObjectMetadata(List<Folder> folders) {
    Map<String, PipeConfValue> data = new HashMap<>();
    data.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, DATA_VALUE_1));
    MetadataEntry metadataToSave = new MetadataEntry();
    List<FolderWithMetadata> foldersWithMetadata = new ArrayList<>();
    folders.forEach(folder -> {
        metadataToSave.setEntity(new EntityVO(folder.getId(), AclClass.FOLDER));
        metadataToSave.setData(data);
        metadataDao.registerMetadataItem(metadataToSave);
        FolderWithMetadata folderWithMetadata = convertToFolderWithMetadata(folder);
        folderWithMetadata.setData(data);
        foldersWithMetadata.add(folderWithMetadata);
    });
    return foldersWithMetadata;
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) MetadataEntry(com.epam.pipeline.entity.metadata.MetadataEntry) FolderWithMetadata(com.epam.pipeline.entity.metadata.FolderWithMetadata)

Example 12 with FolderWithMetadata

use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.

the class FolderApiServiceTest method createTemplateAndGetProject.

private void createTemplateAndGetProject() {
    Folder folder = new Folder();
    folder.setName(FOLDER_NAME);
    folder.setParentId(parent.getId());
    when(folderManager.create(folder)).thenReturn(folder);
    folderApiService.create(folder);
    when(folderManager.createFromTemplate(anyObject(), anyString())).thenReturn(folder);
    folderApiService.createFromTemplate(folder, "template");
    FolderWithMetadata folderWithMetadata = new FolderWithMetadata();
    folderWithMetadata.setId(parent.getId());
    when(folderManager.getProject(anyLong(), anyObject())).thenReturn(folderWithMetadata);
    folderApiService.getProject(folderWithMetadata.getId(), AclClass.FOLDER);
}
Also used : Folder(com.epam.pipeline.entity.pipeline.Folder) FolderWithMetadata(com.epam.pipeline.entity.metadata.FolderWithMetadata)

Aggregations

FolderWithMetadata (com.epam.pipeline.entity.metadata.FolderWithMetadata)12 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)5 AclClass (com.epam.pipeline.entity.security.acl.AclClass)5 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)4 Folder (com.epam.pipeline.entity.pipeline.Folder)4 Test (org.junit.Test)4 BaseEntity (com.epam.pipeline.entity.BaseEntity)3 MetadataEntityManager (com.epam.pipeline.manager.metadata.MetadataEntityManager)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 MessageConstants (com.epam.pipeline.common.MessageConstants)2 MessageHelper (com.epam.pipeline.common.MessageHelper)2 EntityVO (com.epam.pipeline.controller.vo.EntityVO)2 AbstractSecuredEntity (com.epam.pipeline.entity.AbstractSecuredEntity)2 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)2 MetadataEntry (com.epam.pipeline.entity.metadata.MetadataEntry)2 PipelineStart (com.epam.pipeline.entity.pipeline.run.PipelineStart)2 FolderManagerTest.initFolderWithMetadata (com.epam.pipeline.manager.pipeline.FolderManagerTest.initFolderWithMetadata)2