Search in sources :

Example 1 with Metadata

use of org.icgc.dcc.song.server.model.Metadata in project SONG by overture-stack.

the class AnalysisServiceTest method testCreateAndUpdate.

@Test
public void testCreateAndUpdate() {
    val created = analysisGenerator.createDefaultRandomSequencingReadAnalysis();
    val analysisId = created.getAnalysisId();
    assertThat(created.getAnalysisId()).isEqualTo(analysisId);
    assertThat(created.getAnalysisState()).isEqualTo("UNPUBLISHED");
    assertThat(created.getAnalysisType()).isEqualTo("sequencingRead");
    assertThat(created.getSample().size()).isEqualTo(1);
    val sample = created.getSample().get(0);
    val experiment = ((SequencingReadAnalysis) created).getExperiment();
    assertThat(experiment).isNotNull();
    assertThat(experiment.getAlignmentTool().equals("BigWrench"));
    val expectedMetadata = new Metadata();
    expectedMetadata.setInfo("marginOfError", "0.01%");
    assertThat(experiment.getInfo()).isEqualTo(expectedMetadata.getInfo());
    // test update
    ;
    val change = "ModifiedToolName";
    experiment.setAlignmentTool(change);
    service.updateAnalysis(DEFAULT_STUDY_ID, created);
    val gotBack = service.read(analysisId);
    val experiment2 = ((SequencingReadAnalysis) gotBack).getExperiment();
    assertThat(experiment2.getAlignmentTool()).isEqualTo(change);
    log.info(format("Created '%s'", toJson(created)));
}
Also used : lombok.val(lombok.val) SequencingReadAnalysis(org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis) Metadata(org.icgc.dcc.song.server.model.Metadata) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 2 with Metadata

use of org.icgc.dcc.song.server.model.Metadata in project SONG by overture-stack.

the class EntityTest method testMetadata.

@Test
public void testMetadata() {
    val metadata1 = new Metadata();
    metadata1.setInfo("key1", "f5c9381090a53c54358feb2ba5b7a3d7");
    val metadata1_same = new Metadata();
    metadata1_same.setInfo("key1", "f5c9381090a53c54358feb2ba5b7a3d7");
    assertEntitiesEqual(metadata1, metadata1_same, true);
    val metadata2 = new Metadata();
    metadata2.setInfo("key2", "6329334b-dcd5-53c8-98fd-9812ac386d30");
    assertEntitiesNotEqual(metadata1, metadata2);
    metadata2.addInfo(metadata1.getInfoAsString());
    assertThat(metadata2.getInfo().has("key1")).isTrue();
    assertThat(metadata2.getInfo().path("key1").textValue()).isEqualTo("f5c9381090a53c54358feb2ba5b7a3d7");
    metadata2.setInfo("something that is not json");
    assertThat(metadata2.getInfo().has("info")).isTrue();
    assertThat(metadata2.getInfo().path("info").textValue()).isEqualTo("something that is not json");
}
Also used : lombok.val(lombok.val) Metadata(org.icgc.dcc.song.server.model.Metadata) Test(org.junit.Test)

Aggregations

lombok.val (lombok.val)2 Metadata (org.icgc.dcc.song.server.model.Metadata)2 Test (org.junit.Test)2 SequencingReadAnalysis (org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1