Example #1
0
 private RolapCube lookupCube(String cubeName) {
   Connection connection = TestContext.instance().getConnection();
   for (Cube cube : connection.getSchema().getCubes()) {
     if (cube.getName().equals(cubeName)) {
       return (RolapCube) cube;
     }
   }
   return null;
 }
Example #2
0
 protected RolapStar.Measure getMeasure(String cube, String measureName) {
   final Connection connection = getFoodMartConnection();
   final boolean fail = true;
   Cube salesCube = connection.getSchema().lookupCube(cube, fail);
   Member measure =
       salesCube
           .getSchemaReader(null)
           .getMemberByUniqueName(Util.parseIdentifier(measureName), fail);
   return RolapStar.getStarMeasure(measure);
 }
Example #3
0
  private void clearCache(RolapCube cube) {
    // Clear the cache for the Sales cube, so the query runs as if
    // for the first time. (TODO: Cleaner way to do this.)
    final Cube salesCube = getConnection().getSchema().lookupCube("Sales", true);
    RolapHierarchy hierarchy =
        (RolapHierarchy)
            salesCube.lookupHierarchy(new Id.NameSegment("Store", Id.Quoting.UNQUOTED), false);
    SmartMemberReader memberReader = (SmartMemberReader) hierarchy.getMemberReader();
    MemberCacheHelper cacheHelper = memberReader.cacheHelper;
    cacheHelper.mapLevelToMembers.cache.clear();
    cacheHelper.mapMemberToChildren.cache.clear();

    // Flush the cache, to ensure that the query gets executed.
    cube.clearCachedAggregations(true);

    CacheControl cacheControl = getConnection().getCacheControl(null);
    final CacheControl.CellRegion measuresRegion = cacheControl.createMeasuresRegion(cube);
    cacheControl.flush(measuresRegion);
  }