use of org.icgc.dcc.song.server.model.entity.Study in project SONG by overture-stack.
the class EntityTest method testStudy.
@Test
public void testStudy() {
val study1 = new Study();
study1.setDescription("a");
study1.setName("b");
study1.setOrganization("c");
study1.setStudyId("d");
val study1_same = Study.create("d", "b", "c", "a");
assertEntitiesEqual(study1, study1_same, true);
val study2 = Study.create("a1", "b1", "c1", "d1");
assertEntitiesNotEqual(study1, study2);
study1.setInfo("key1", "f5c9381090a53c54358feb2ba5b7a3d7");
study1_same.setInfo("key2", "6329334b-dcd5-53c8-98fd-9812ac386d30");
assertEntitiesNotEqual(study1, study1_same);
// Test getters
assertThat(study1.getDescription()).isEqualTo("a");
assertThat(study1.getName()).isEqualTo("b");
assertThat(study1.getOrganization()).isEqualTo("c");
assertThat(study1.getStudyId()).isEqualTo("d");
assertInfoKVPair(study1, "key1", "f5c9381090a53c54358feb2ba5b7a3d7");
}
use of org.icgc.dcc.song.server.model.entity.Study in project SONG by overture-stack.
the class AnalysisServiceTest method testGetAnalysisAndIdSearch.
@Test
public void testGetAnalysisAndIdSearch() {
val studyGenerator = createStudyGenerator(studyService, randomGenerator);
val studyId = studyGenerator.createRandomStudy();
val analysisGenerator = createAnalysisGenerator(studyId, service, payloadGenerator);
val numAnalysis = 10;
val sraMap = Maps.<String, SequencingReadAnalysis>newHashMap();
val vcaMap = Maps.<String, VariantCallAnalysis>newHashMap();
val expectedAnalyses = Sets.<Analysis>newHashSet();
for (int i = 1; i <= numAnalysis; i++) {
if (i % 2 == 0) {
val sra = analysisGenerator.createDefaultRandomSequencingReadAnalysis();
assertThat(sraMap.containsKey(sra.getAnalysisId())).isFalse();
sraMap.put(sra.getAnalysisId(), sra);
expectedAnalyses.add(sra);
} else {
val vca = analysisGenerator.createDefaultRandomVariantCallAnalysis();
assertThat(sraMap.containsKey(vca.getAnalysisId())).isFalse();
vcaMap.put(vca.getAnalysisId(), vca);
expectedAnalyses.add(vca);
}
}
assertThat(expectedAnalyses).hasSize(numAnalysis);
assertThat(sraMap.keySet().size() + vcaMap.keySet().size()).isEqualTo(numAnalysis);
val expectedVCAs = newHashSet(vcaMap.values());
val expectedSRAs = newHashSet(sraMap.values());
assertThat(expectedSRAs).hasSize(sraMap.keySet().size());
assertThat(expectedVCAs).hasSize(vcaMap.keySet().size());
val actualAnalyses = service.getAnalysis(studyId);
val actualSRAs = actualAnalyses.stream().filter(x -> resolveAnalysisType(x.getAnalysisType()) == SEQUENCING_READ).collect(toSet());
val actualVCAs = actualAnalyses.stream().filter(x -> resolveAnalysisType(x.getAnalysisType()) == VARIANT_CALL).collect(toSet());
assertThat(actualSRAs).hasSize(sraMap.keySet().size());
assertThat(actualVCAs).hasSize(vcaMap.keySet().size());
assertThat(actualSRAs).containsAll(expectedSRAs);
assertThat(actualVCAs).containsAll(expectedVCAs);
// Do a study-wide idSearch and verify the response effectively has the same
// number of results as the getAnalysis method
val searchedAnalyses = service.idSearch(studyId, createIdSearchRequest(null, null, null, null));
assertThat(searchedAnalyses).hasSameSizeAs(expectedAnalyses);
assertThat(searchedAnalyses).containsOnlyElementsOf(expectedAnalyses);
}
Aggregations