use of org.icgc.dcc.song.server.utils.StudyGenerator in project SONG by overture-stack.
the class ExportServiceTest method generateData.
/**
* Generate {@code numStudies} studies and for each study generate {@code numAnalysisPerStudy} analyses, and put
* everything in a map, where the keys are studyIds and the values are all the analyses for that study
*/
private Map<String, List<? extends Analysis>> generateData(Class<? extends Analysis> analysisClass, int numStudies, int numAnalysesPerStudy, boolean includeAnalysisId, boolean includeOtherIds) {
val studyGenerator = createStudyGenerator(studyService, randomGenerator);
val map = Maps.<String, List<? extends Analysis>>newHashMap();
for (int s = 0; s < numStudies; s++) {
val studyId = studyGenerator.createRandomStudy();
val analysisGenerator = createAnalysisGenerator(studyId, analysisService, randomGenerator);
val analyses = range(0, numAnalysesPerStudy).boxed().map(x -> analysisGenerator.createDefaultRandomAnalysis(analysisClass)).peek(x -> massageAnalysisInplace(x, includeAnalysisId, includeOtherIds)).collect(toImmutableList());
map.put(studyId, analyses);
}
return ImmutableMap.copyOf(map);
}
Aggregations