public class QueryTest
extends java.lang.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 |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
ADD_OPERATION |
protected static int |
COUNT_QUERY_OPERATION |
protected int[][] |
countQueryResults |
protected static int |
CREATE_INDEX_OPERATION |
protected static java.lang.String |
createCallbackPrefix |
protected static int |
DESTROY_OPERATION |
protected static java.lang.String |
destroyCallbackPrefix |
protected com.gemstone.gemfire.distributed.DistributedLockService |
distLockService |
protected static java.lang.String |
enumWhereClause1 |
protected static java.lang.String |
enumWhereClause2 |
static java.lang.String |
ID_COMPACT_RANGE_INDEX |
static java.lang.String |
ID_HASH_INDEX |
static java.lang.String |
ID_RANGE_INDEX |
protected boolean |
ignoreQueryExecTimeOutException |
protected static int |
INVALIDATE_OPERATION |
protected static java.lang.String |
invalidateCallbackPrefix |
protected boolean |
isCarefulValidation |
protected boolean |
isMirrored |
protected boolean |
isSerialExecution |
protected static int |
LOCAL_DESTROY_OPERATION |
protected static int |
LOCAL_INVALIDATE_OPERATION |
protected static java.lang.String |
LOCK_NAME |
protected static java.lang.String |
LOCK_SERVICE_NAME |
static java.lang.String |
MAP_RANGE_INDEX_1 |
static java.lang.String |
MAP_RANGE_INDEX_2 |
protected int |
maxObjects |
static int |
MILLIS_TO_WAIT |
protected long |
minTaskGranularityMS |
protected long |
minTaskGranularitySec |
protected int |
numOfRegions |
protected static java.util.concurrent.atomic.AtomicLong |
numQueries |
protected int |
numVMs |
protected static HydraThreadLocal |
origClassLoader |
protected static boolean |
pdxReadSerialized |
protected static int |
PDXSTRING_QUERY_OPERATION |
com.gemstone.gemfire.cache.client.Pool |
pool |
protected static int |
QUERY_OPERATION |
protected int |
queryLimit |
protected static QueryTest |
queryTest |
protected RandomValues |
randomValues |
protected static int |
READ_OPERATION |
static java.lang.String |
REGION_NAME |
protected static java.lang.String |
REGION_WITHOUT_INDEX |
protected static int |
REMOVE_INDEX_OPERATION |
protected static boolean |
statisticsWrittenToBB |
static java.lang.String |
STATUS_COMPACT_RANGE_INDEX |
static java.lang.String |
STATUS_HASH_INDEX |
static java.lang.String |
STATUS_RANGE_INDEX |
protected static int |
UPDATE_OPERATION |
protected static java.lang.String |
updateCallbackPrefix |
protected boolean |
useEvictionController |
| 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(java.lang.Object[][] r,
int len,
boolean checkOrder,
java.lang.String[] queries) |
protected void |
createCacheFromXml(java.lang.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 java.lang.Object |
getObjectToAdd(java.lang.String name)
Creates a new object with the given
name to add to a region. |
protected int |
getOperation(java.lang.Long whichPrm,
boolean disallowLocalEntryOps)
Return a random operation from the hydra parameter specified by whichPrm.
|
protected java.lang.Object |
getUpdateObject(java.lang.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(java.lang.String xmlFilename) |
protected void |
invalidateObject(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalInvalidate) |
protected java.lang.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 java.lang.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,
java.lang.Object name)
Updates the entry with the given key (
name) in the given
region. |
protected void |
validateQueryLimit(java.lang.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,
java.lang.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,
java.lang.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 java.lang.String ID_COMPACT_RANGE_INDEX
public static final java.lang.String STATUS_COMPACT_RANGE_INDEX
public static final java.lang.String ID_HASH_INDEX
public static final java.lang.String STATUS_HASH_INDEX
public static final java.lang.String ID_RANGE_INDEX
public static final java.lang.String STATUS_RANGE_INDEX
public static final java.lang.String MAP_RANGE_INDEX_1
public static final java.lang.String MAP_RANGE_INDEX_2
protected static final java.lang.String enumWhereClause1
protected static final java.lang.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 java.lang.String createCallbackPrefix
protected static final java.lang.String updateCallbackPrefix
protected static final java.lang.String invalidateCallbackPrefix
protected static final java.lang.String destroyCallbackPrefix
protected static java.util.concurrent.atomic.AtomicLong numQueries
protected static java.lang.String LOCK_SERVICE_NAME
protected static java.lang.String LOCK_NAME
public static final java.lang.String REGION_NAME
protected static final java.lang.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(java.lang.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(java.lang.Object[][] r,
int len,
boolean checkOrder,
java.lang.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,
java.lang.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(java.lang.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 java.lang.String randRgn()
protected void checkEventCounters()
protected java.lang.Object getObjectToAdd(java.lang.String name)
name to add to a region.BaseValueHolder,
RandomValuesprotected java.lang.Object getUpdateObject(java.lang.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_printBB()
throws java.lang.Throwable
java.lang.Throwablepublic static void HydraTask_iterate()
throws java.lang.Throwable
java.lang.Throwablepublic static void HydraTask_closeTask_writeQueryStats_To_Blackboard()
throws java.lang.Throwable
java.lang.Throwablepublic static void HydraTask_endTask_verifyQueryStats_With_Blackboard()
throws java.lang.Throwable
java.lang.Throwablepublic static void HydraTask_endTask()
throws java.lang.Throwable
java.lang.Throwableprotected void createCacheFromXml(java.lang.String xmlFilename)
protected java.lang.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(java.lang.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,
java.lang.Object key)
aRegion - The region containing keykey - The key that should have a null valueprotected void verifyObjectDestroyed(com.gemstone.gemfire.cache.Region aRegion,
java.lang.Object key)
aRegion - The region contains the destroyed keykey - The destroyed keypublic void verifyCountQueryResults()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.