use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class OncotreeTestConfig method oncoTreeAdditionalVersionRepositoryMockResponse.
@Bean
public ArrayList<Version> oncoTreeAdditionalVersionRepositoryMockResponse() {
ArrayList<Version> oncoTreeAdditionalVersionRepositoryMockResponse = new ArrayList<Version>(oncoTreeVersionRepositoryMockResponse());
Version nextVersion = new Version();
nextVersion.setVersion("test_version");
nextVersion.setGraphURI("urn:x-evn-master:test_version");
nextVersion.setDescription("This is just another test OncoTree version for testing cache updates");
oncoTreeAdditionalVersionRepositoryMockResponse.add(nextVersion);
return oncoTreeAdditionalVersionRepositoryMockResponse;
}
use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class VersionUtilTest method testUnmatchedVersionQuery.
@Test(expected = InvalidVersionException.class)
public void testUnmatchedVersionQuery() throws Exception {
String testVersionName = "THIS_STRING_IS_VERY_UNLIKELY_TO_EVER_BE_USED_FOR_THE_NAME_OF_AN_ACTUAL_ONCOTREE_VERSION";
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 testFullVersionList.
@Test
public void testFullVersionList() throws Exception {
List<Version> versionsFromUtil = versionUtil.getVersions();
Map<String, Version> returnedVersionMap = new HashMap<>(versionsFromUtil.size());
for (Version version : versionsFromUtil) {
returnedVersionMap.put(version.getVersion(), version);
}
int failureCount = 0;
StringBuilder failureReport = new StringBuilder();
for (String versionName : expectedVersionMap.keySet()) {
Version expectedVersion = expectedVersionMap.get(versionName);
Version returnedVersion = returnedVersionMap.get(versionName);
failureCount = failureCount + failuresInReturnedVersionComparison(versionName, expectedVersion, returnedVersion, failureReport);
}
if (expectedVersionMap.size() != returnedVersionMap.size()) {
failureReport.append("mismatch between returned version list (size:" + Integer.toString(returnedVersionMap.size()) + ") and expected version list (size:" + Integer.toString(expectedVersionMap.size()) + ")");
failureCount = failureCount + 1;
}
if (failureCount > 0) {
fail(Integer.toString(failureCount) + " failed test conditions. Details follow... " + failureReport.toString());
}
return;
}
use of org.mskcc.oncotree.model.Version in project oncotree by cBioPortal.
the class VersionUtilTest method testNullVersionQuery.
@Test(expected = InvalidVersionException.class)
public void testNullVersionQuery() throws Exception {
String testVersionName = null;
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 TumorTypesTxtApi method tumorTypesTxtGet.
@Deprecated
@ApiOperation(value = "Tumor Types in plain text format.", notes = "Return all available tumor types.", response = Void.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Tumor types text file."), @ApiResponse(code = 404, message = "Could not find tumor types text file"), @ApiResponse(code = 503, message = "Required data source unavailable") })
@RequestMapping(value = "", produces = { TEXT_PLAIN_VALUE }, method = RequestMethod.GET)
public InputStreamResource tumorTypesTxtGet(@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) {
Map<String, TumorType> tumorTypes = new HashMap<>();
Version v = (version == null) ? versionUtil.getDefaultVersion() : versionUtil.getVersion(version);
tumorTypes = cacheUtil.getTumorTypesByVersion(v);
InputStream inputStream = tumorTypesUtil.getTumorTypeInputStream(tumorTypes);
InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
return inputStreamResource;
}
Aggregations