Search in sources :

Example 31 with PipeConfValue

use of com.epam.pipeline.entity.metadata.PipeConfValue 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)

Example 32 with PipeConfValue

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

the class MetadataEntityConverterTest method entitiesShouldBeConverted.

@Test
public void entitiesShouldBeConverted() {
    Map<String, PipeConfValue> participantData1 = new HashMap<>();
    participantData1.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_1));
    participantData1.put(TEST_ARGUMENT2, new PipeConfValue(STRING_TYPE, "F"));
    MetadataEntity participant1 = getEntity(participantClass, PARTICIPANT_ENTITY_ID1, participantData1);
    Map<String, PipeConfValue> participantData2 = new HashMap<>();
    participantData2.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
    participantData2.put(TEST_ARGUMENT2, new PipeConfValue(STRING_TYPE, "M"));
    MetadataEntity participant2 = getEntity(participantClass, PARTICIPANT_ENTITY_ID2, participantData2);
    Map<String, PipeConfValue> sampleData1 = new HashMap<>();
    sampleData1.put(PARTICIPANT_TYPE_NAME, new PipeConfValue(PARTICIPANT_ATTRIBUTE_TYPE, PARTICIPANT_ENTITY_ID1));
    sampleData1.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_1));
    MetadataEntity sample1 = getEntity(sampleClass, SAMPLE_ENTITY_ID1, sampleData1);
    Map<String, PipeConfValue> sampleData2 = new HashMap<>();
    sampleData2.put(PARTICIPANT_TYPE_NAME, new PipeConfValue(PARTICIPANT_ATTRIBUTE_TYPE, PARTICIPANT_ENTITY_ID2));
    sampleData2.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
    MetadataEntity sample2 = getEntity(sampleClass, SAMPLE_ENTITY_ID2, sampleData2);
    Map<String, PipeConfValue> pairData1 = new HashMap<>();
    pairData1.put(PARTICIPANT_TYPE_NAME, new PipeConfValue(PARTICIPANT_ATTRIBUTE_TYPE, PARTICIPANT_ENTITY_ID1));
    pairData1.put(CASE_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, SAMPLE_ENTITY_ID2));
    pairData1.put(CONTROL_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, SAMPLE_ENTITY_ID1));
    pairData1.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, "52"));
    MetadataEntity pair1 = getEntity(pairClass, PAIR_ENTITY_ID1, pairData1);
    Map<String, PipeConfValue> pairData2 = new HashMap<>();
    pairData2.put(PARTICIPANT_TYPE_NAME, new PipeConfValue(PARTICIPANT_ATTRIBUTE_TYPE, PARTICIPANT_ENTITY_ID2));
    pairData2.put(CASE_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, "HCC1954_Tumor_100_gene"));
    pairData2.put(CONTROL_SAMPLE_ARGUMENT, new PipeConfValue(SAMPLE_ATTRIBUTE_TYPE, "HCC1954_Normal_100_gene"));
    pairData2.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
    MetadataEntity pair2 = getEntity(pairClass, PAIR_ENTITY_ID2, pairData2);
    Map<String, PipeConfValue> participantSetData = new HashMap<>();
    participantSetData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
    participantSetData.put(PARTICIPANT_SET_TYPE_NAME, new PipeConfValue("Array[Participant]", "[\"HCC1143_WE\",\"HCC1954_100_gene\"]"));
    MetadataEntity participantSet = getEntity(participantSetClass, "HCC_participants", participantSetData);
    Map<String, PipeConfValue> sampleSetData = new HashMap<>();
    sampleSetData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
    sampleSetData.put(SAMPLE_SET_TYPE_NAME, new PipeConfValue("Array[Sample]", "[\"HCC1143_Tumor_WE\",\"HCC1143_Normal_WE\"]"));
    MetadataEntity sampleSet = getEntity(sampleSetClass, "HCC_samples", sampleSetData);
    Map<String, PipeConfValue> pairSetData = new HashMap<>();
    pairSetData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_2));
    pairSetData.put(PAIR_SET_TYPE_NAME, new PipeConfValue("Array[Pair]", "[\"HCC1143_WE_pair\",\"HCC1954_100_gene_pair\"]"));
    MetadataEntity pairSet = getEntity(pairSetClass, "HCC_pairs", pairSetData);
    List<MetadataEntity> entities = new ArrayList<>();
    entities.add(participant1);
    entities.add(participant2);
    entities.add(sample1);
    entities.add(sample2);
    entities.add(pair1);
    entities.add(pair2);
    entities.add(participantSet);
    entities.add(sampleSet);
    entities.add(pairSet);
    Map<String, String> result = MetadataEntityConverter.convert(entities);
    assertEquals(9, result.size());
    assertEquals("entity:participant_id\tgender\tage" + lineSeparator() + "HCC1143_WE\tF\t52" + lineSeparator() + "HCC1954_100_gene\tM\t46", result.get("participant"));
    assertEquals("entity:sample_id\tparticipant\tage" + lineSeparator() + "HCC1143_Normal_WE\tHCC1143_WE\t52" + lineSeparator() + "HCC1143_Tumor_WE\tHCC1954_100_gene\t46", result.get("sample"));
    assertEquals("entity:pair_id\tcase_sample\tcontrol_sample\tparticipant\tage" + lineSeparator() + "HCC1143_WE_pair\tHCC1143_Tumor_WE\tHCC1143_Normal_WE\tHCC1143_WE\t52" + lineSeparator() + "HCC1954_100_gene_pair\tHCC1954_Tumor_100_gene\tHCC1954_Normal_100_gene\tHCC1954_100_gene\t46", result.get("pair"));
    assertEquals("entity:participant_set_id\tage" + lineSeparator() + "HCC_participants\t46", result.get("participant_set_entity"));
    assertEquals("membership:participant_set_id\tparticipant" + lineSeparator() + "HCC_participants\tHCC1143_WE" + lineSeparator() + "HCC_participants\tHCC1954_100_gene", result.get("participant_set_membership"));
    assertEquals("entity:sample_set_id\tage" + lineSeparator() + "HCC_samples\t46", result.get("sample_set_entity"));
    assertEquals("membership:sample_set_id\tsample" + lineSeparator() + "HCC_samples\tHCC1143_Tumor_WE" + lineSeparator() + "HCC_samples\tHCC1143_Normal_WE", result.get("sample_set_membership"));
    assertEquals("entity:pair_set_id\tage" + lineSeparator() + "HCC_pairs\t46", result.get("pair_set_entity"));
    assertEquals("membership:pair_set_id\tpair" + lineSeparator() + "HCC_pairs\tHCC1143_WE_pair" + lineSeparator() + "HCC_pairs\tHCC1954_100_gene_pair", result.get("pair_set_membership"));
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 33 with PipeConfValue

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

the class MetadataEntityReaderTest method createSample.

private MetadataEntity createSample(String id, String name, String type, String patient, String pairs) {
    MetadataEntity sample = new MetadataEntity();
    sample.setClassEntity(metadataClass);
    sample.setParent(parent);
    sample.setExternalId(id);
    Map<String, PipeConfValue> data = new HashMap<>();
    data.put("name", new PipeConfValue(EntityTypeField.DEFAULT_TYPE, name));
    data.put("type", new PipeConfValue(EntityTypeField.DEFAULT_TYPE, type));
    data.put("patient", new PipeConfValue("Participant:ID", patient));
    data.put("pairs", new PipeConfValue("Array[Pair]", pairs));
    sample.setData(data);
    return sample;
}
Also used : MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue)

Example 34 with PipeConfValue

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

the class BucketPostProcessorImplTest method shouldHandleCPURL.

@Test
public void shouldHandleCPURL() {
    PipeConfValue value = new PipeConfValue(bucketPostProcessor.supportedType(), CP_PATH_ORIGINAL);
    bucketPostProcessor.process(PARAM_NAME, value);
    assertEquals(CP_PATH_NORMALIZED, value.getValue());
}
Also used : PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.Test)

Example 35 with PipeConfValue

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

the class BucketPostProcessorImplTest method shouldHandleS3URL.

@Test
public void shouldHandleS3URL() {
    PipeConfValue value = new PipeConfValue(bucketPostProcessor.supportedType(), S3_PATH_ORIGINAL);
    bucketPostProcessor.process(PARAM_NAME, value);
    assertEquals(S3_PATH_NORMALIZED, value.getValue());
}
Also used : PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Test(org.junit.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