public class CQTest extends Object
| Constructor and Description |
|---|
CQTest() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
addEntry(com.gemstone.gemfire.cache.Region aRegion)
Add a new entry to the given region.
|
protected void |
checkForLastIteration()
Check if we have run for the desired length of time.
|
protected void |
concVerify()
Create a region snapshot from one vm's point of view, while any other
threads in this or the same the vm also executing this method will
compare to that snapshot.
|
protected void |
destroyEntry(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalDestroy)
Destroy an entry in the given region.
|
protected void |
doConcOpsAndVerify()
Do random operations and verification for concurrent tests.
|
protected void |
doEntryOperations(com.gemstone.gemfire.cache.Region aRegion)
Do random entry operations on the given region ending either with
minTaskGranularityMS or numOpsPerTask.
|
protected void |
doRandomOp(com.gemstone.gemfire.cache.Region aRegion) |
protected void |
doRROpsAndVerify()
Do random operations and verification for serial round robin test.
|
protected Map |
generateBorderCaseQueries(int maxPathLength)
Generate a series of queries the query against border case values (min/max) based on the given
parameters.
|
protected Map |
generateCharacterQueries(String fieldName,
int maxPathLength)
Generate a series of queries based on the given parameters.
|
protected Map |
generateNullQueries(int maxPathLength)
Generate a series of queries against null values based on the given parameters.
|
protected Map |
generateNumericQueries(String fieldName,
long minValue,
long maxValue,
int maxPathLength)
Generate a series of queries based on the given parameters.
|
Map |
generateQueries(int maxQueryDepth)
Initialize the queries to be used in the test by putting them in the queryMap
|
protected Map |
generateStringQueries(String fieldName,
int maxPathLength)
Generate a series of queries based on the given parameters.
|
protected static String |
getComparatorInQuery(String queryStr)
Given a query string, return the comparator in it.
|
protected static int |
getDepthInQuery(String queryStr)
Return the depth of the query in queryStr.
|
static Object |
getExistingKey(com.gemstone.gemfire.cache.Region aRegion,
boolean uniqueKeys,
int numThreads)
Return a random key currently in the given region.
|
protected List |
getExpectedResults(String queryStr)
Return a Set of expected results of the given queryStr using
regionSnapshot as the basis of determining what to expect.
|
protected static String |
getFieldInQuery(String queryStr)
Given a query string, return the field in it being queried
(the last field in the path).
|
protected void |
getKey(com.gemstone.gemfire.cache.Region aRegion)
Get an existing key in the given region if one is available,
otherwise get a new key.
|
protected Object |
getNewKey()
Return a new key, never before used in the test.
|
protected void |
getNewKey(com.gemstone.gemfire.cache.Region aRegion)
Get a new key in the given region.
|
protected String |
getNextQueryName()
Return a unique query name.
|
protected int |
getOperation(Long whichPrm)
Get a random operation using the given hydra parameter.
|
protected int |
getOperation(com.gemstone.gemfire.cache.Region reg)
Get an operation to perform on the region
|
protected static String |
getPathInQuery(String queryStr)
Given a query string, return the query path.
|
protected String |
getQueryPath(String fieldName,
int maxPathLength)
Given a field name and maximum path depth, return a random path
to the field.
|
static String |
getReadableQueryString(String queryStr)
Returns the given query string with addition information if
necessary to make it more readable, such as converting any
characters to their byte equivalent (to aid with debugging).
|
protected static String |
getValueToCompareInQuery(String queryStr)
Given a query string, return the value being compared to.
|
protected void |
HAController()
While other threads are doing ops, stop or close the region of servers
(not clients), reinstate the servers/regions, pause and verify.
|
protected void |
HADoEntryOps()
Do entry ops and handle disconnects or cache closes.
|
protected void |
handleException(Exception anExcept)
Handle an exception thrown by doing general operations during HA.
|
static void |
HydraTask_doConcOpsAndVerify()
Hydra task method for concurrent tests with verification.
|
static void |
HydraTask_doRROpsAndVerify()
Hydra task method for serial round robin tests.
|
static void |
HydraTask_executeCQsAndVerify()
Hydra task method to execute all the registered CQs and verify
results.
|
static void |
HydraTask_HAController()
Hydra task method to control VMs going down/up one at a time.
|
static void |
HydraTask_HADoEntryOps()
Hydra task method to do random entry operations.
|
static void |
HydraTask_initializeAccessorServer1()
Creates and initializes a bridge server.
|
static void |
HydraTask_initializeAccessorServer2()
Creates and initializes a bridge server.
|
static void |
HydraTask_initializeBridgeServer()
Creates and initializes a bridge server.
|
static void |
HydraTask_initializeClient()
Creates and initializes the singleton instance of CQTest in a client.
|
static void |
HydraTask_initializeClient1()
Creates and initializes the singleton instance of CQTest in a client.
|
static void |
HydraTask_initializeClient2()
Creates and initializes the singleton instance of CQTest in a client.
|
static void |
HydraTask_initializeDataHostServer()
Creates and initializes a bridge server.
|
static void |
HydraTask_initializeServer1()
Creates and initializes a bridge server.
|
static void |
HydraTask_initializeServer2()
Creates and initializes a bridge server.
|
static void |
HydraTask_load() |
static void |
HydraTask_loadToUpperThreshold()
Hydra task method to load the region with N entries, specified by
CQUtilPrms.upperThreshold.
|
static void |
HydraTask_missingJarTest()
Test for missing antlr.jar.
|
static void |
HydraTask_recordLoadToBB()
Hydra task method to follow HydraTask_loadToUpperThreshold to
get the current state of the region recorded to the BB for
serial tests.
|
void |
initializeCQs()
Initialize (create) the continuous queries for this test
|
void |
initializeInstance()
Initialize instance fields of this test class
|
void |
initializeQueryService() |
com.gemstone.gemfire.cache.Region |
initializeRegion(String regDescriptName)
Create a region with the given region description name.
|
protected void |
invalidateEntry(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalInvalidate)
Invalidate an entry in the given region.
|
protected void |
loadToUpperThreshold()
Load the region with N entries, specified by CQUtilPrms.upperThreshold.
|
protected static void |
logExecutionNumber()
Log the execution number of this serial task.
|
protected void |
modifyValue(com.gemstone.gemfire.cache.Region aRegion)
Modifies an existing value in an entry in the given region, but does not
do a put.
|
protected void |
recordLoadToBB()
Record the state of the region to the blackbloard for serial tests.
|
protected static void |
registerInterest(com.gemstone.gemfire.cache.Region aRegion)
Register interest with ALL_KEYS, and InterestPolicyResult = KEYS_VALUES
which is equivalent to a full GII.
|
protected void |
restoreRegionSnapshot()
restoreRegionSnapshot() - restore this VMs internal RegionSnapshot (HashMap) after a tx failure during commit.
|
static boolean |
satisfiesQuery(String queryStr,
QueryObject qo)
Return true of the given qo satisfies the queryStr, false otherwise.
|
protected void |
saveRegionSnapshot()
saveRegionSnapshot() - save this VMs internal RegionSnapshot (HashMap) in case of tx failure during commit.
|
protected void |
updateEntry(com.gemstone.gemfire.cache.Region aRegion)
Update an existing entry in the given region.
|
protected void |
verify(com.gemstone.gemfire.cache.query.CqQuery cq,
com.gemstone.gemfire.cache.query.SelectResults sr)
Verifies that for a given CQ, the following are all consistent with each other:
1) expected results derived from the regionSnapshot
2) selectResults
3) gatherMap
|
protected void |
verifyQuery(String cqName)
Verify the query with the given name
|
protected void |
verifyQueryResults()
Verify the result of the CQs registered for this VM.
|
protected void |
verifyRegionContents()
Verify the state of the region and the regionSnapshot.
|
public static CQTest testInstance
public static CQTestVersionHelper versionHelperInstance
protected static final String VmIDStr
protected static final String ThreadIDStr
protected long minTaskGranularitySec
protected long minTaskGranularityMS
protected int numOpsPerTask
public boolean isBridgeConfiguration
public boolean isBridgeClient
protected int numThreadsInClients
public com.gemstone.gemfire.cache.Region aRegion
protected com.gemstone.gemfire.cache.query.QueryService qService
public HydraThreadLocal uniqueKeyIndex
protected boolean isSerialExecution
protected boolean highAvailability
protected int upperThreshold
protected int lowerThreshold
protected boolean uniqueKeys
public int queryDepth
protected int numQueriesPerClientVM
public Map queryMap
protected int secondsToRun
protected boolean cacheIsClosed
protected boolean disconnected
protected int numThreadsInThisVM
protected static boolean CQsOn
protected boolean useDeltaObjects
protected boolean isOldClient
protected Map regionSnapshot
protected Map txRegionSnapshot
protected static final int ENTRY_ADD_OPERATION
protected static final int ENTRY_DESTROY_OPERATION
protected static final int ENTRY_INVALIDATE_OPERATION
protected static final int ENTRY_LOCAL_DESTROY_OPERATION
protected static final int ENTRY_LOCAL_INVALIDATE_OPERATION
protected static final int ENTRY_UPDATE_OPERATION
protected static final int ENTRY_GET_OPERATION
protected static final int ENTRY_GET_NEW_OPERATION
protected static final int ENTRY_MODIFY_VALUE
protected static final String getCallbackPrefix
protected static final String createCallbackPrefix
protected static final String updateCallbackPrefix
protected static final String invalidateCallbackPrefix
protected static final String destroyCallbackPrefix
protected static final String regionInvalidateCallbackPrefix
protected static final String regionDestroyCallbackPrefix
protected static volatile MethodCoordinator concVerifyCoordinator
public static void HydraTask_initializeClient()
public static void HydraTask_initializeClient1()
public static void HydraTask_initializeClient2()
public static void HydraTask_initializeBridgeServer()
public static void HydraTask_initializeAccessorServer1()
public static void HydraTask_initializeAccessorServer2()
public static void HydraTask_initializeServer1()
public static void HydraTask_initializeServer2()
public static void HydraTask_initializeDataHostServer()
public static void HydraTask_missingJarTest()
public com.gemstone.gemfire.cache.Region initializeRegion(String regDescriptName)
regDescriptName - The name of a region description.public void initializeQueryService()
public void initializeInstance()
public void initializeCQs()
public static void HydraTask_doRROpsAndVerify()
public static void HydraTask_load()
public static void HydraTask_doConcOpsAndVerify()
public static void HydraTask_executeCQsAndVerify()
public static void HydraTask_HADoEntryOps()
public static void HydraTask_HAController()
public static void HydraTask_loadToUpperThreshold()
public static void HydraTask_recordLoadToBB()
protected Map generateNumericQueries(String fieldName, long minValue, long maxValue, int maxPathLength)
fieldName - The name of the field to query on.minValue - Choose a random value between minValue and maxValue to query against.maxValue - Choose a random value between minValue and maxValue to query against.pathLength - Choose a random value between 1 and pathLength to generate the
query path. For example, 1 might be "anInt = 1", 2 might be
"aQueryObject.anInt = 1", etc.protected Map generateStringQueries(String fieldName, int maxPathLength)
fieldName - The name of the field to query on.pathLength - Choose a random value between 1 and pathLength to generate the
query path. For example, 1 might be "aString = "abc"", 2 might be
"aQueryObject.aString = "def"", etc.protected Map generateCharacterQueries(String fieldName, int maxPathLength)
fieldName - The name of the field to query on.pathLength - Choose a random value between 1 and pathLength to generate the
query path. For example, 1 might be "aCharacter = "a"", 2 might be
"aQueryObject.aCharacter = "d"", etc.protected Map generateBorderCaseQueries(int maxPathLength)
fieldName - The name of the field to query on.pathLength - Choose a random value between 1 and pathLength to generate the
query path. For example, 1 might be "anInt = 1", 2 might be
"aQueryObject.anInt = 1", etc.protected Map generateNullQueries(int maxPathLength)
pathLength - Choose a random value between 1 and pathLength to generate the
query path. For example, 1 might be "anInteger = NULL", 2 might be
"aQueryObject.anInteger = NULL", etc.public Map generateQueries(int maxQueryDepth)
protected String getQueryPath(String fieldName, int maxPathLength)
fieldName - The name of the field the path should end with.maxPathLength - The maximum path length to return.protected void doRROpsAndVerify()
protected void doConcOpsAndVerify()
protected void HAController()
protected void HADoEntryOps()
protected void doEntryOperations(com.gemstone.gemfire.cache.Region aRegion)
protected void doRandomOp(com.gemstone.gemfire.cache.Region aRegion)
protected int getOperation(com.gemstone.gemfire.cache.Region reg)
reg - The region to get an operation for.protected void loadToUpperThreshold()
protected void recordLoadToBB()
protected Object addEntry(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to use for adding a new entry.protected void invalidateEntry(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalInvalidate)
aRegion - The region to use for invalidating an entry.isLocalInvalidate - True if the invalidate should be local, false otherwise.protected void destroyEntry(com.gemstone.gemfire.cache.Region aRegion,
boolean isLocalDestroy)
aRegion - The region to use for destroying an entry.isLocalDestroy - True if the destroy should be local, false otherwise.protected void updateEntry(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to use for updating an entry.protected void modifyValue(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to use for updating an entry.protected void getKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to use for getting an entry.protected void getNewKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to use for getting an entry.protected Object getNewKey()
protected static void logExecutionNumber()
protected static void registerInterest(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to register interest on.protected void concVerify()
protected void verify(com.gemstone.gemfire.cache.query.CqQuery cq,
com.gemstone.gemfire.cache.query.SelectResults sr)
cq - The cq to check results for.sr - The SelectResults for the cq.protected void verifyRegionContents()
protected void verifyQueryResults()
protected void verifyQuery(String cqName)
protected static String getPathInQuery(String queryStr)
queryStr - A string containing a query.Returns - a string containing the path being queried, or null
if none.protected static String getFieldInQuery(String queryStr)
queryStr - A string containing a query.Returns - a string containing the field being queried, or null
if none.protected static String getComparatorInQuery(String queryStr)
queryStr - A string containing a query.Returns - a string containing the comparator, or null
if none.protected static String getValueToCompareInQuery(String queryStr)
queryStr - A string containing a query.Returns - a string containing the value being comparied, or null
if none.protected static int getDepthInQuery(String queryStr)
queryStr - A string containing a query.protected List getExpectedResults(String queryStr)
queryStr - A string containing a query.public static boolean satisfiesQuery(String queryStr, QueryObject qo)
queryStr - A string containing a query.qo - The QueryObject to test against the query.protected int getOperation(Long whichPrm)
whichPrm - A hydra parameter which specifies random operations.public static Object getExistingKey(com.gemstone.gemfire.cache.Region aRegion, boolean uniqueKeys, int numThreads)
aRegion - The region to use for getting an existing key.uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.protected String getNextQueryName()
public static String getReadableQueryString(String queryStr)
queryStr - A query string.protected void checkForLastIteration()
protected void handleException(Exception anExcept)
protected void saveRegionSnapshot()
protected void restoreRegionSnapshot()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.