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));
}
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));
}
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));
}
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;
}
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));
}
Aggregations