Search in sources :

Example 41 with MetadataEntity

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

the class MetadataEntityConverterTest method shouldFailIfPairWithoutParticipantAttribute.

@Test(expected = IllegalArgumentException.class)
public void shouldFailIfPairWithoutParticipantAttribute() {
    Map<String, PipeConfValue> pairData = new HashMap<>();
    pairData.put(CASE_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, SAMPLE_ENTITY_ID2));
    pairData.put(CONTROL_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, SAMPLE_ENTITY_ID1));
    MetadataEntity pair = getEntity(pairClass, PAIR_ENTITY_ID1, pairData);
    MetadataEntityConverter.convert(Collections.singletonList(pair));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 42 with MetadataEntity

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

the class MetadataEntityConverterTest method shouldFailIfPairWithoutCaseSampleAttribute.

@Test(expected = IllegalArgumentException.class)
public void shouldFailIfPairWithoutCaseSampleAttribute() {
    Map<String, PipeConfValue> pairData = new HashMap<>();
    pairData.put(PARTICIPANT_TYPE_NAME, new PipeConfValue(PARTICIPANT_TYPE_NAME, PARTICIPANT_ENTITY_ID1));
    pairData.put(CONTROL_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, SAMPLE_ENTITY_ID1));
    MetadataEntity pair = getEntity(pairClass, PAIR_ENTITY_ID1, pairData);
    MetadataEntityConverter.convert(Collections.singletonList(pair));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 43 with MetadataEntity

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

the class MetadataDownloadManagerTest method getInputStreamShouldReadFromWriterThatWasPassedToMetadataWriter.

@Test
public void getInputStreamShouldReadFromWriterThatWasPassedToMetadataWriter() {
    final List<MetadataEntity> entities = Collections.singletonList(new MetadataEntity());
    when(metadataEntityManager.loadMetadataEntityByClassNameAndFolderId(FOLDER_ID, SAMPLE)).thenReturn(entities);
    final MetadataWriter metadataWriter = mock(MetadataWriter.class);
    final ArgumentCaptor<Writer> writerCaptor = ArgumentCaptor.forClass(Writer.class);
    when(metadataWriterProvider.getMetadataWriter(writerCaptor.capture(), any())).thenReturn(metadataWriter);
    doAnswer(invocation -> writeMessageAndReturnNothing(writerCaptor.getValue(), "message")).when(metadataWriter).writeEntities(any(), any());
    final InputStream actualInputStream = manager.getInputStream(FOLDER_ID, SAMPLE, TSV);
    Assert.assertEquals("message", inputStreamAsString(actualInputStream));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) InputStream(java.io.InputStream) MetadataWriter(com.epam.pipeline.manager.metadata.writer.MetadataWriter) MetadataWriter(com.epam.pipeline.manager.metadata.writer.MetadataWriter) Writer(java.io.Writer) Test(org.junit.Test)

Example 44 with MetadataEntity

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

the class MetadataWriterTest method entity.

private MetadataEntity entity(final String entityClass, final String id, final Map<String, PipeConfValue> data) {
    final MetadataEntity metadataEntity = new MetadataEntity();
    metadataEntity.setExternalId(id);
    metadataEntity.setData(data);
    final MetadataClass metadataClass = new MetadataClass();
    metadataClass.setName(entityClass);
    metadataEntity.setClassEntity(metadataClass);
    return metadataEntity;
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass)

Example 45 with MetadataEntity

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

the class MetadataEntityConverterTest method shouldFailIfSampleWithoutParticipantAttribute.

@Test(expected = IllegalArgumentException.class)
public void shouldFailIfSampleWithoutParticipantAttribute() {
    Map<String, PipeConfValue> sampleData = new HashMap<>();
    sampleData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_1));
    MetadataEntity sample = getEntity(sampleClass, SAMPLE_ENTITY_ID1, sampleData);
    MetadataEntityConverter.convert(Collections.singletonList(sample));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Aggregations

MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)48 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)22 Test (org.junit.Test)22 Transactional (org.springframework.transaction.annotation.Transactional)14 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)12 Folder (com.epam.pipeline.entity.pipeline.Folder)10 HashMap (java.util.HashMap)9 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)7 List (java.util.List)7 Map (java.util.Map)6 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)5 IOException (java.io.IOException)5 MetadataReadingException (com.epam.pipeline.exception.MetadataReadingException)4 FolderManager (com.epam.pipeline.manager.pipeline.FolderManager)4 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 Propagation (org.springframework.transaction.annotation.Propagation)4 AclClass (com.epam.pipeline.entity.security.acl.AclClass)3 com.epam.pipeline.manager.metadata.parser (com.epam.pipeline.manager.metadata.parser)3