mondrian.rolap.agg
Class MockSegmentCache

java.lang.Object
  extended by mondrian.rolap.agg.MockSegmentCache
All Implemented Interfaces:
SegmentCache

public class MockSegmentCache
extends Object
implements SegmentCache

Mock implementation of SegmentCache that is used for automated testing.

It tries to marshall / unmarshall all SegmentHeader and SegmentBody objects that are sent to it.

Version:
$Id: //open/mondrian/testsrc/main/mondrian/rolap/agg/MockSegmentCache.java#9 $
Author:
LBoudreau

Constructor Summary
MockSegmentCache()
           
 
Method Summary
 Future<Boolean> contains(SegmentHeader header)
          Checks if the cache contains a SegmentBody corresponding to the supplied SegmentHeader.
 Future<Boolean> flush(SegmentHeader.ConstrainedColumn[] region)
          Flushes a dimensionality region from the cache.
 Future<SegmentBody> get(SegmentHeader header)
          Returns a future SegmentBody object once the cache has returned any results, or null of no segment corresponding to the header could be found.
 Future<List<SegmentHeader>> getSegmentHeaders()
          Returns a list of all segments present in the cache.
 Future<Boolean> put(SegmentHeader header, SegmentBody body)
          Stores a segment data in the cache.
 Future<Boolean> remove(SegmentHeader header)
          Removes a segment from the cache.
 void tearDown()
          Tear down and clean up the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockSegmentCache

public MockSegmentCache()
Method Detail

contains

public Future<Boolean> contains(SegmentHeader header)
Description copied from interface: SegmentCache
Checks if the cache contains a SegmentBody corresponding to the supplied SegmentHeader.

Specified by:
contains in interface SegmentCache
Parameters:
header - A header to lookup in the cache.
Returns:
A Future true or a Future false if no corresponding segment could be found in cache.

get

public Future<SegmentBody> get(SegmentHeader header)
Description copied from interface: SegmentCache
Returns a future SegmentBody object once the cache has returned any results, or null of no segment corresponding to the header could be found.

Specified by:
get in interface SegmentCache
Parameters:
header - The header of the segment to find. Consider this as a key.
Returns:
A Future SegmentBody or a Future null if no corresponding segment could be found in cache.

put

public Future<Boolean> put(SegmentHeader header,
                           SegmentBody body)
Description copied from interface: SegmentCache
Stores a segment data in the cache.

Specified by:
put in interface SegmentCache
Parameters:
header - The header of the segment.
body - The segment body to cache.
Returns:
A Future object which returns true or false depending on the success of the caching operation.

getSegmentHeaders

public Future<List<SegmentHeader>> getSegmentHeaders()
Description copied from interface: SegmentCache
Returns a list of all segments present in the cache.

Specified by:
getSegmentHeaders in interface SegmentCache
Returns:
A List of segment headers describing the contents of the cache.

remove

public Future<Boolean> remove(SegmentHeader header)
Description copied from interface: SegmentCache
Removes a segment from the cache.

Specified by:
remove in interface SegmentCache
Parameters:
header - The header of the segment we want to remove.
Returns:
True if the segment was found and removed, false otherwise.

flush

public Future<Boolean> flush(SegmentHeader.ConstrainedColumn[] region)
Description copied from interface: SegmentCache
Flushes a dimensionality region from the cache.

Specified by:
flush in interface SegmentCache
Parameters:
region - The region to flush.
Returns:
True if the operation succeeded, false otherwise.

tearDown

public void tearDown()
Description copied from interface: SegmentCache
Tear down and clean up the cache.

Specified by:
tearDown in interface SegmentCache

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads