Search in sources :

Example 21 with TumorType

use of org.mskcc.oncotree.model.TumorType in project oncotree by cBioPortal.

the class CacheUtilTest method testGetTumorTypesByVersion.

@Test
public void testGetTumorTypesByVersion() {
    Map<String, TumorType> returnedTumorTypes = cacheUtil.getTumorTypesByVersion(legacyVersion);
    // there is only one node in returnedTumorTypes, and it is the TISSUE node, everything else is a child of that node
    String rootTumorTypeCode = returnedTumorTypes.keySet().iterator().next();
    TumorType rootTumorType = returnedTumorTypes.get(rootTumorTypeCode);
    assertEquals("TISSUE", rootTumorTypeCode);
    assertEquals("TISSUE", rootTumorType.getCode());
    assertEquals(32, rootTumorType.getChildren().size());
    // legacy version should have no history, no revocations, no precursors
    assertNoHistoryInChildren(rootTumorType.getChildren());
    assertNoRevocationsInChildren(rootTumorType.getChildren());
    assertNoPrecursorsInChildren(rootTumorType.getChildren());
    returnedTumorTypes = cacheUtil.getTumorTypesByVersion(latestVersion);
    // test latest version has a history in one node
    Boolean foundHistory = Boolean.FALSE;
    foundHistory = assertHistoryInChildren(returnedTumorTypes, foundHistory);
    assertTrue("Failed to find history for 'SS'", foundHistory);
    // test revocations in latest version
    Boolean foundRevocations = Boolean.FALSE;
    foundRevocations = assertRevocationsInChildren(returnedTumorTypes, foundRevocations);
    assertTrue("Failed to find revocations for 'URMM'", foundRevocations);
    // test precursors in latest version
    Boolean foundPrecursors = Boolean.FALSE;
    foundPrecursors = assertPrecursorsInChildren(returnedTumorTypes, foundPrecursors);
    assertTrue("Failed to find precursors for 'CLLSLL'", foundPrecursors);
}
Also used : TumorType(org.mskcc.oncotree.model.TumorType) Test(org.junit.Test)

Example 22 with TumorType

use of org.mskcc.oncotree.model.TumorType in project oncotree by cBioPortal.

the class CacheUtilTest method assertNoHistoryInChildren.

private void assertNoHistoryInChildren(Map<String, TumorType> tumorTypes) {
    for (TumorType tumorType : tumorTypes.values()) {
        assertEquals("Node " + tumorType.getCode() + " name: " + tumorType.getName() + " has history", 0, tumorType.getHistory().size());
        assertNoHistoryInChildren(tumorType.getChildren());
    }
}
Also used : TumorType(org.mskcc.oncotree.model.TumorType)

Aggregations

TumorType (org.mskcc.oncotree.model.TumorType)22 InvalidOncoTreeDataException (org.mskcc.oncotree.error.InvalidOncoTreeDataException)3 Version (org.mskcc.oncotree.model.Version)3 OncoTreeNode (org.mskcc.oncotree.topbraid.OncoTreeNode)3 ApiOperation (io.swagger.annotations.ApiOperation)2 ApiResponses (io.swagger.annotations.ApiResponses)2 Test (org.junit.Test)2 MSKConcept (org.mskcc.oncotree.crosswalk.MSKConcept)2 TopBraidException (org.mskcc.oncotree.topbraid.TopBraidException)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 InputStream (java.io.InputStream)1 Deprecated (java.lang.Deprecated)1 HashMap (java.util.HashMap)1 InvalidQueryException (org.mskcc.oncotree.error.InvalidQueryException)1 InvalidVersionException (org.mskcc.oncotree.error.InvalidVersionException)1 InputStreamResource (org.springframework.core.io.InputStreamResource)1