Search in sources :

Example 21 with MetadataEntity

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);
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 22 with MetadataEntity

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));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 23 with MetadataEntity

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);
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity)

Example 24 with MetadataEntity

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());
    });
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity)

Example 25 with MetadataEntity

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));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) MetadataWriter(com.epam.pipeline.manager.metadata.writer.MetadataWriter) 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