use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class OncotreeTestConfig method setupMockVersion.
private Version setupMockVersion() {
Version mockVersion = new Version();
mockVersion = new Version();
mockVersion.setVersion("mockversion");
return mockVersion;
}
use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class MainTypesApi method mainTypesGet.
@ApiOperation(value = "Return all available main tumor types.", notes = "")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Nested tumor types object"), @ApiResponse(code = 404, message = "Could not find maintypes"), @ApiResponse(code = 503, message = "Required data source unavailable") })
@RequestMapping(value = "", produces = { "application/json" }, method = RequestMethod.GET)
public Iterable<String> mainTypesGet(@ApiParam(value = "The version of tumor types. For example, " + VersionUtil.DEFAULT_VERSION + ". Please see the versions api documentation for released versions.") @RequestParam(value = "version", required = false) String version) {
Version v = (version == null) ? versionUtil.getDefaultVersion() : versionUtil.getVersion(version);
Map<String, TumorType> tumorTypes = cacheUtil.getTumorTypesByVersion(v);
Set<TumorType> tumorTypesSet = tumorTypesUtil.flattenTumorTypes(tumorTypes, version);
return mainTypesUtil.getMainTypesByTumorTypes(tumorTypesSet);
}
use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class OncoTreePersistentCache method getOncoTreeVersionsFromPersistentCacheBackup.
@Cacheable(value = "oncoTreeVersionsEHCache", key = "#root.target.ONCOTREE_VERSIONS_CACHE_KEY", unless = "#result==null")
private synchronized ArrayList<Version> getOncoTreeVersionsFromPersistentCacheBackup() throws Exception {
CacheManager cacheManager = null;
Cache<String, ArrayList<Version>> cache = null;
ArrayList<Version> versions = null;
try {
cacheManager = getCacheManager(BACKUP_CACHE_CONFIG_FILENAME);
cache = cacheManager.getCache(ONCOTREE_VERSIONS_CACHE);
versions = cache.get(ONCOTREE_VERSIONS_CACHE_KEY);
} finally {
if (cacheManager != null) {
// closes all caches it knows about
cacheManager.close();
}
}
return versions;
}
use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class VersionUtilTest method testEmptyVersionQuery.
@Test(expected = InvalidVersionException.class)
public void testEmptyVersionQuery() throws Exception {
String testVersionName = "";
Version returnedVersion = versionUtil.getVersion(testVersionName);
fail("expected exception (InvalidVersionException) did not get thrown");
}
use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class VersionUtilTest method testSuccessfulVersionQuery.
@Test
public void testSuccessfulVersionQuery() throws Exception {
String testVersionName = expectedVersionMap.keySet().iterator().next();
Version expectedVersion = expectedVersionMap.get(testVersionName);
Version returnedVersion = versionUtil.getVersion(testVersionName);
int failureCount = 0;
StringBuilder failureReport = new StringBuilder();
failureCount = failureCount + failuresInReturnedVersionComparison(testVersionName, expectedVersion, returnedVersion, failureReport);
if (failureCount > 0) {
fail(Integer.toString(failureCount) + " failed test conditions. Details follow... " + failureReport.toString());
}
return;
}
Aggregations