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