use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method shouldFailWithInconsistentData.
@Test(expected = IllegalStateException.class)
public void shouldFailWithInconsistentData() {
Map<String, PipeConfValue> participantData1 = new HashMap<>();
participantData1.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_1));
MetadataEntity participant1 = getEntity(participantClass, PARTICIPANT_ENTITY_ID1, participantData1);
Map<String, PipeConfValue> participantData2 = new HashMap<>();
participantData2.put(TEST_ARGUMENT2, new PipeConfValue(STRING_TYPE, "M"));
MetadataEntity participant2 = getEntity(participantClass, PARTICIPANT_ENTITY_ID2, participantData2);
List<MetadataEntity> entities = new ArrayList<>();
entities.add(participant1);
entities.add(participant2);
MetadataEntityConverter.convert(entities);
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method shouldFailIfFireCloudClassIsNull.
@Test(expected = IllegalArgumentException.class)
public void shouldFailIfFireCloudClassIsNull() {
MetadataClass entityClass = new MetadataClass();
entityClass.setName(PARTICIPANT_TYPE_NAME);
Map<String, PipeConfValue> participantData = new HashMap<>();
participantData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_1));
MetadataEntity participant = getEntity(entityClass, PARTICIPANT_ENTITY_ID1, participantData);
MetadataEntityConverter.convert(Collections.singletonList(participant));
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityReaderTest method getExpectedEntities.
public List<MetadataEntity> getExpectedEntities() {
MetadataEntity sample1 = createSample("s1", "Sample1", "DNA", "p1", "[\"set1\",\"set2\"]");
MetadataEntity sample2 = createSample("s2", "Sample2", "RNA", "p2", "[\"set1\"]");
return Arrays.asList(sample1, sample2);
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataEntityReaderTest method compareResults.
private void compareResults(MetadataParsingResult expected, MetadataParsingResult actual) {
assertEquals(expected.getMetadataClass(), actual.getMetadataClass());
assertEquals(expected.getReferences(), actual.getReferences());
Map<String, MetadataEntity> actualEntities = actual.getEntities();
assertEquals(expected.getEntities().size(), actualEntities.size());
expected.getEntities().forEach((externalId, entity) -> {
assertTrue(actualEntities.containsKey(externalId));
MetadataEntity actualEntity = actualEntities.get(externalId);
assertEquals(entity.getExternalId(), actualEntity.getExternalId());
assertEquals(entity.getName(), actualEntity.getName());
});
}
use of com.epam.pipeline.entity.metadata.MetadataEntity in project cloud-pipeline by epam.
the class MetadataDownloadManagerTest method getInputStreamShouldRetrieveMetadataWriterFromProvider.
@Test
public void getInputStreamShouldRetrieveMetadataWriterFromProvider() {
final List<MetadataEntity> entities = Collections.singletonList(new MetadataEntity());
when(metadataEntityManager.loadMetadataEntityByClassNameAndFolderId(FOLDER_ID, SAMPLE)).thenReturn(entities);
final MetadataWriter metadataWriter = mock(MetadataWriter.class);
when(metadataWriterProvider.getMetadataWriter(any(), any())).thenReturn(metadataWriter);
manager.getInputStream(FOLDER_ID, SAMPLE, TSV);
verify(metadataWriter).writeEntities(eq(SAMPLE), eq(entities));
}
Aggregations