Search in sources :

Example 41 with PipeConfValue

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

the class MetadataEntityMapperTest method shouldMapMetadataEntity.

@Test
void shouldMapMetadataEntity() throws IOException {
    MetadataEntityMapper mapper = new MetadataEntityMapper();
    MetadataClass metadataClass = new MetadataClass(1L, "Sample");
    MetadataEntity metadataEntity = new MetadataEntity();
    metadataEntity.setClassEntity(metadataClass);
    metadataEntity.setId(1L);
    metadataEntity.setExternalId("external");
    metadataEntity.setParent(new Folder(1L));
    metadataEntity.setName(TEST_NAME);
    metadataEntity.setData(Collections.singletonMap(TEST_KEY, new PipeConfValue("string", TEST_VALUE)));
    EntityContainer<MetadataEntity> container = EntityContainer.<MetadataEntity>builder().entity(metadataEntity).permissions(PERMISSIONS_CONTAINER).build();
    XContentBuilder contentBuilder = mapper.map(container);
    verifyMetadataEntity(metadataEntity, EXPECTED_METADATA, contentBuilder);
    verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder);
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) MapperVerificationUtils.verifyMetadataEntity(com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyMetadataEntity) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Folder(com.epam.pipeline.entity.pipeline.Folder) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)41 Test (org.junit.Test)24 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)21 HashMap (java.util.HashMap)11 Transactional (org.springframework.transaction.annotation.Transactional)11 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)9 EntityVO (com.epam.pipeline.controller.vo.EntityVO)9 Folder (com.epam.pipeline.entity.pipeline.Folder)9 MetadataEntry (com.epam.pipeline.entity.metadata.MetadataEntry)8 FolderWithMetadata (com.epam.pipeline.entity.metadata.FolderWithMetadata)5 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)5 PasswordGenerator.generateRandomString (com.epam.pipeline.utils.PasswordGenerator.generateRandomString)5 Map (java.util.Map)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)3 MessageConstants (com.epam.pipeline.common.MessageConstants)2 MessageHelper (com.epam.pipeline.common.MessageHelper)2 MetadataVO (com.epam.pipeline.controller.vo.MetadataVO)2 BaseEntity (com.epam.pipeline.entity.BaseEntity)2