public class QueryTest extends Object
EventBB and EventCountersBB to keep track of what has
happened and to validate that what has happened is expected. It requires that
the regions that it tests be distributed and mirrored.| Modifier and Type | Class and Description |
|---|---|
static class |
QueryTest.QueryObserverImpl |
| Constructor and Description |
|---|
QueryTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addObject(com.gemstone.gemfire.cache.Region aRegion,
boolean logAddition) |
protected void |
checkEventCounters()
Must overridden in a subclass
|
protected void |
compareQueryResultsBetweenIndexRegions() |
void |
compareQueryResultsWithoutAndWithIndexes(Object[][] r,
int len,
boolean checkOrder,
String[] queries) |
protected void |
createCacheFromXml(String xmlFilename)
Creates the cache based on the given xmlFile
|
protected void |
createIndex_task() |
protected void |
createIndex() |
protected void |
createRootRegions()
Creates the root region in the
Cache used in this test according to
the configuration in a RegionDefinition. |
protected void |
destroyObject(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalDestroy) |
protected void |
doCountQuery(boolean logAddition)
Executes the query over the region
|
protected void |
doEntryAndQueryOperations() |
protected void |
doPdxStringQuery() |
protected void |
doQuery(boolean logAddition)
Executes the query over the region
|
protected com.gemstone.gemfire.cache.CacheListener |
getCacheListener()
Returns the
CacheListener that is installed on regions created
by this test. |
protected int |
getNumNames(com.gemstone.gemfire.cache.Region aRegion,
boolean hasValueOnly)
Given a region, return the number of names in the region and any of its
subregions.
|
protected int |
getNumVMsWithListeners() |
protected Object |
getObjectToAdd(String name)
Creates a new object with the given
name to add to a region. |
protected int |
getOperation(Long whichPrm,
boolean disallowLocalEntryOps)
Return a random operation from the hydra parameter specified by whichPrm.
|
protected Object |
getUpdateObject(String name)
Returns the "updated" value of the object with the given
name. |
protected void |
handleRegionDestroyedException(com.gemstone.gemfire.cache.Region aRegion,
com.gemstone.gemfire.cache.RegionDestroyedException anException)
Called when the test gets a RegionDestroyedException.
|
static void |
HydraTask_closeTask_writeQueryStats_To_Blackboard() |
static void |
HydraTask_compareQueryResultsBetweenIndexRegions() |
static void |
HydraTask_doEntryAndQueryOperations()
Performs randomly selected operations (add, invalidate, etc.) on the root
region based on the weightings in
QueryPrms#entryOperations. |
static void |
HydraTask_endTask_verifyQueryStats_With_Blackboard() |
static void |
HydraTask_endTask() |
static void |
HydraTask_initialize_clientCache() |
static void |
HydraTask_initialize_withIndexTestHook() |
static void |
HydraTask_initialize_xml()
Creates and initializes the singleton instance of
QueryTest in this VM. |
static void |
HydraTask_initialize()
Creates and initializes the singleton instance of
QueryTest in this VM. |
static void |
HydraTask_iterate() |
static void |
HydraTask_load()
Load the regions under test with numToLoad entries spread across all the
regions.
|
static void |
HydraTask_populateRegions()
Populate regions with maxObjects number of region entries.
|
static void |
HydraTask_printBB() |
void |
initialize_clientCache() |
void |
initialize() |
void |
initialize(String xmlFilename) |
protected void |
invalidateObject(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalInvalidate) |
protected Object[] |
iterateRegion(com.gemstone.gemfire.cache.Region aRegion,
boolean allowZeroKeys,
boolean allowZeroNonNullValues)
Used for end task validation, iterate the keys/values in the given region,
checking that the key/value match according to the test strategy.
|
protected static void |
logExecutionNumber() |
protected String |
randRgn() |
protected void |
readObject(com.gemstone.gemfire.cache.Region aRegion)
Fetches (reads) the value of a randomly selected entry in the given region.
|
protected void |
removeIndex() |
protected void |
updateObject(com.gemstone.gemfire.cache.Region aRegion)
Updates the "first" entry in a given region
|
protected void |
updateObject(com.gemstone.gemfire.cache.Region aRegion,
Object name)
Updates the entry with the given key (
name) in the given
region. |
protected void |
validateQueryLimit(Object result)
If
queryLimit is specified then validate that the limit was
obeyed. |
void |
verifyCountQueryResults()
Verifies the count(*) query results for serial query tests.
|
protected void |
verifyObjectDestroyed(com.gemstone.gemfire.cache.Region aRegion,
Object key)
Verify that the given key in the given region is destroyed (has no
key/value).
|
protected void |
verifyObjectInvalidated(com.gemstone.gemfire.cache.Region aRegion,
Object key)
Verify that the given key in the given region is invalid (has a null
value).
|
protected static QueryTest queryTest
protected static final int ADD_OPERATION
protected static final int UPDATE_OPERATION
protected static final int INVALIDATE_OPERATION
protected static final int DESTROY_OPERATION
protected static final int READ_OPERATION
protected static final int LOCAL_INVALIDATE_OPERATION
protected static final int LOCAL_DESTROY_OPERATION
protected static final int QUERY_OPERATION
protected static final int CREATE_INDEX_OPERATION
protected static final int REMOVE_INDEX_OPERATION
protected static final int COUNT_QUERY_OPERATION
protected static final int PDXSTRING_QUERY_OPERATION
public static final String ID_COMPACT_RANGE_INDEX
public static final String STATUS_COMPACT_RANGE_INDEX
public static final String ID_HASH_INDEX
public static final String STATUS_HASH_INDEX
public static final String ID_RANGE_INDEX
public static final String STATUS_RANGE_INDEX
public static final String MAP_RANGE_INDEX_1
public static final String MAP_RANGE_INDEX_2
protected static final String enumWhereClause1
protected static final String enumWhereClause2
protected static boolean pdxReadSerialized
protected static boolean statisticsWrittenToBB
protected static HydraThreadLocal origClassLoader
protected int numOfRegions
protected boolean isSerialExecution
protected boolean isCarefulValidation
protected boolean ignoreQueryExecTimeOutException
protected int queryLimit
public static final int MILLIS_TO_WAIT
protected int numVMs
protected long minTaskGranularitySec
protected long minTaskGranularityMS
protected RandomValues randomValues
protected boolean useEvictionController
protected int maxObjects
protected com.gemstone.gemfire.distributed.DistributedLockService distLockService
protected boolean isMirrored
protected int[][] countQueryResults
public com.gemstone.gemfire.cache.client.Pool pool
protected static final String createCallbackPrefix
protected static final String updateCallbackPrefix
protected static final String invalidateCallbackPrefix
protected static final String destroyCallbackPrefix
protected static AtomicLong numQueries
protected static String LOCK_SERVICE_NAME
protected static String LOCK_NAME
public static final String REGION_NAME
protected static final String REGION_WITHOUT_INDEX
public static void HydraTask_initialize()
QueryTest in this VM.public static void HydraTask_initialize_xml()
QueryTest in this VM.public static void HydraTask_initialize_clientCache()
public void initialize_clientCache()
public void initialize()
public void initialize(String xmlFilename)
HydraTask_initialize()public static void HydraTask_initialize_withIndexTestHook()
public static void HydraTask_load()
public static void HydraTask_populateRegions()
public static void HydraTask_doEntryAndQueryOperations()
QueryPrms#entryOperations. The
operations will continue to be performed until the
minimum task granularity
has been reached.public static void HydraTask_compareQueryResultsBetweenIndexRegions()
protected void doEntryAndQueryOperations()
#HydraTask_doEntryOperationsprotected void compareQueryResultsBetweenIndexRegions()
public void compareQueryResultsWithoutAndWithIndexes(Object[][] r, int len, boolean checkOrder, String[] queries)
protected void createIndex()
protected void createIndex_task()
protected void removeIndex()
protected void addObject(com.gemstone.gemfire.cache.Region aRegion,
boolean logAddition)
protected void invalidateObject(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalInvalidate)
protected void destroyObject(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalDestroy)
protected void updateObject(com.gemstone.gemfire.cache.Region aRegion)
protected void updateObject(com.gemstone.gemfire.cache.Region aRegion,
Object name)
name) in the given
region.protected void readObject(com.gemstone.gemfire.cache.Region aRegion)
protected void doQuery(boolean logAddition)
protected void doCountQuery(boolean logAddition)
protected void doPdxStringQuery()
protected void validateQueryLimit(Object result)
queryLimit is specified then validate that the limit was
obeyed. For tests that don't use a limit this is a noop. Bail out early if
the query returns a Tomen instead of a collection.result - the query results to checkTestException - if(results.size() > queryLimit)protected String randRgn()
protected void checkEventCounters()
protected Object getObjectToAdd(String name)
name to add to a region.BaseValueHolder,
RandomValuesprotected Object getUpdateObject(String name)
name.protected com.gemstone.gemfire.cache.CacheListener getCacheListener()
CacheListener that is installed on regions created
by this test.ETListenerprotected int getNumVMsWithListeners()
protected void createRootRegions()
Cache used in this test according to
the configuration in a RegionDefinition.public static void HydraTask_closeTask_writeQueryStats_To_Blackboard()
throws Throwable
Throwablepublic static void HydraTask_endTask_verifyQueryStats_With_Blackboard()
throws Throwable
Throwableprotected void createCacheFromXml(String xmlFilename)
protected Object[] iterateRegion(com.gemstone.gemfire.cache.Region aRegion, boolean allowZeroKeys, boolean allowZeroNonNullValues)
aRegion - - the region to iterate.allowZeroKeys - - If the number of keys in the region is 0, then allow it if this
is true, otherwise log an error to the return string.allowZeroNonNullValues - - If the number of non-null values in the region is 0, then allow
it if this is true, otherwise log an error to the return string.protected int getOperation(Long whichPrm, boolean disallowLocalEntryOps)
whichPrm - - the hydra parameter that is a list of operationsdisallowLocalEntryOps - - if true, then do not return localInvalidate or localDestroy.
This is used for regions that are mirrored, since localInvalidate
and localDestroy are disallowed for mirrored regions.protected static void logExecutionNumber()
protected void handleRegionDestroyedException(com.gemstone.gemfire.cache.Region aRegion,
com.gemstone.gemfire.cache.RegionDestroyedException anException)
aRegion - - the region that supposedly was destroyed and triggered the
RegionDestroyedExceptionanException - - the exception that was thrown.protected int getNumNames(com.gemstone.gemfire.cache.Region aRegion,
boolean hasValueOnly)
aRegion - The region to use to determin the number of names.hasValueOnly - True if the number of names returned should only include those
names that return containsValueForKey true, false if all names
should be counted.protected void verifyObjectInvalidated(com.gemstone.gemfire.cache.Region aRegion,
Object key)
aRegion - The region containing keykey - The key that should have a null valueprotected void verifyObjectDestroyed(com.gemstone.gemfire.cache.Region aRegion,
Object key)
aRegion - The region contains the destroyed keykey - The destroyed keypublic void verifyCountQueryResults()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.