You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ag...@apache.org on 2016/05/03 23:45:36 UTC
[22/60] [abbrv] incubator-geode git commit: GEODE-1059:
PRQueryDUnitHelper no longer inherits PartitionedRegionDUnitTestCase class
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
index 6782dee..ecfbfae 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
@@ -16,14 +16,12 @@
*/
package com.gemstone.gemfire.cache.query.partitioned;
+import static com.gemstone.gemfire.cache.query.Utils.createPortfoliosAndPositions;
+
import java.io.File;
-import java.util.Collection;
-import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.query.Index;
import com.gemstone.gemfire.cache.query.data.Portfolio;
-import com.gemstone.gemfire.cache.query.data.PortfolioData;
import com.gemstone.gemfire.cache.query.internal.index.IndexManager.TestHook;
import com.gemstone.gemfire.cache.query.internal.index.IndexUtils;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
@@ -31,7 +29,6 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
@@ -52,12 +49,19 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
public PRBasicIndexCreationDeadlockDUnitTest(String name) {
super(name);
}
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
+ public void setCacheInVMsUsingXML(String xmlFile, VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> GemFireCacheImpl.testCacheXml = PRQHelp.findFile(xmlFile));
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
- // int totalNumBuckets = 131;
-
- int queryTestCycle = 10;
-
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "PartionedPortfolios";
@@ -77,11 +81,11 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
- Class valueConstraint = Portfolio.class;
+ setCacheInVMs(vm0,vm1);
final String fileName1 = "PRPersistentIndexCreation_1.xml";
final String fileName2 = "PRPersistentIndexCreation_2.xml";
-
+ setCacheInVMsUsingXML(fileName1, vm0);
+ setCacheInVMsUsingXML(fileName1, vm1);
final File dir1 = new File("overflowData1");
final File dir2 = new File("overflowData2");
@@ -97,11 +101,11 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
success = (dir2).mkdir();
}
});
-
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name, fileName1));
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name, fileName2));
+
+ vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name));
+ vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name));
- final Portfolio[] portfoliosAndPositions = PRQHelp.createPortfoliosAndPositions(100);
+ final Portfolio[] portfoliosAndPositions = createPortfoliosAndPositions(100);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPutsKeyValue(name, portfoliosAndPositions,
@@ -130,7 +134,7 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
public void run2() throws CacheException {
GemFireCacheImpl.testCacheXml = PRQHelp.findFile(fileName1);
IndexUtils.testHook = new IndexUtilTestHook();
- PRQHelp.getCache();
+ getCache();
}
});
@@ -161,7 +165,7 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
@Override
public void run2() throws CacheException {
GemFireCacheImpl.testCacheXml = PRQHelp.findFile(fileName2);
- PRQHelp.getCache();
+ getCache();
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
index d020ef6..7b93734 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicMultiIndexCreationDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache.query.partitioned;
+import static com.gemstone.gemfire.cache.query.Utils.*;
+
import java.util.ArrayList;
import java.util.Collection;
@@ -46,12 +48,12 @@ public class PRBasicMultiIndexCreationDUnitTest extends
public PRBasicMultiIndexCreationDUnitTest(String name) {
super(name);
}
-
- // int totalNumBuckets = 131;
-
- int queryTestCycle = 10;
-
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "PartionedPortfolios";
@@ -73,12 +75,12 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
LogWriterUtils.getLogWriter().info(
"PRBasicIndexCreationDUnitTest.testPRBasicIndexCreate started ....");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
// Creating local region on vm0 to compare the results of query.
// vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(localName,
// Scope.DISTRIBUTED_ACK, redundancy));
@@ -87,13 +89,13 @@ public class PRBasicMultiIndexCreationDUnitTest extends
LogWriterUtils.getLogWriter()
.info("PRBasicIndexCreationDUnitTest : creating all the prs ");
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -134,21 +136,21 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
LogWriterUtils.getLogWriter().info(
"PRBasicIndexCreation.testPRMultiIndexCreation Test Started");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm1.invoke(PRQHelp
- .getCacheSerializableRunnableForPRCreate(name, redundancy));
+ .getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm2.invoke(PRQHelp
- .getCacheSerializableRunnableForPRCreate(name, redundancy));
+ .getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm3.invoke(PRQHelp
- .getCacheSerializableRunnableForPRCreate(name, redundancy));
+ .getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -221,20 +223,20 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
// final String fileName = "PRIndexCreation.xml";
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name,
+ // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
// fileName));
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testCreatePartitionedRegionThroughXMLAndAPI started ");
// creating all the prs
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
ArrayList<String> names = new ArrayList<String>();
names.add("PrIndexOnStatus");
@@ -250,9 +252,9 @@ public class PRBasicMultiIndexCreationDUnitTest extends
// adding a new node to an already existing system.
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
// putting some data in.
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -273,22 +275,21 @@ public class PRBasicMultiIndexCreationDUnitTest extends
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-// VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm3);
// final String fileName = "PRIndexCreation.xml";
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name,
+ // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
// fileName));
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testCreatePartitionedIndexWithNoAliasAfterPuts started ");
// creating all the prs
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
ArrayList<String> names = new ArrayList<String>();
names.add("PrIndexOnStatus");
@@ -302,16 +303,8 @@ public class PRBasicMultiIndexCreationDUnitTest extends
vm1.invoke(PRQHelp.getCacheSerializableRunnableForDefineIndex(name, names, exps));
- //vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name,
- // "PrIndexOnId", "p.ID", "p"));
-
- //vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name,
- // "PrIndexOnPKID", "p.pkid", "p"));
-// adding a new node to an already existing system.
- //vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- // Scope.DISTRIBUTED_ACK, redundancy));
// putting some data in.
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -330,33 +323,21 @@ public class PRBasicMultiIndexCreationDUnitTest extends
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-// VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
- // final String fileName = "PRIndexCreation.xml";
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name,
- // fileName));
+ setCacheInVMs(vm0,vm1,vm3);
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testCreatePartitionedIndexWithNoAliasBeforePuts started ");
// creating all the prs
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
-
- // vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name,
- // "PrIndexOnId", "p.ID", "p"));
+ redundancy, PortfolioData.class));
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name,
- // "PrIndexOnPKID", "p.pkid", "p"));
- // adding a new node to an already existing system.
- // vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- // Scope.DISTRIBUTED_ACK, redundancy));
// putting some data in.
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -373,42 +354,8 @@ public class PRBasicMultiIndexCreationDUnitTest extends
vm1.invoke(PRQHelp.getCacheSerializableRunnableForDefineIndex(name, names, exps));
- /*
- vm1.invoke(new CacheSerializableRunnable("IndexCreationOnPosition") {
- public void run2(){
- try {
- Cache cache = getCache();
- QueryService qs = cache.getQueryService();
- Region region = cache.getRegion(name);
- LogWriter logger = cache.getLogger();
- // logger.info("Test Creating index with Name : [ "+indexName+" ] " +
- // "IndexedExpression : [ "+indexedExpression+" ] Alias : [ "+alias+" ] FromClause : [ "+region.getFullPath() + " " + alias+" ] " );
- Index parIndex = qs.createIndex("IndexOnPotionMktValue", IndexType.FUNCTIONAL, "pVal.mktValue"
- ,region.getFullPath()+" pf, pf.positions pVal TYPE Position", "import parReg.\"query\".Position;");
- logger.info(
- "Index creted on partitioned region : " + parIndex);
- logger.info(
- "Number of buckets indexed in the partitioned region locally : "
- + "" + ((PartitionedIndex)parIndex).getNumberOfIndexedBucket()
- + " and remote buckets indexed : "
- + ((PartitionedIndex)parIndex).getNumRemoteBucketsIndexed());
- /*
- * assertEquals("Max num of buckets in the partiotion regions and
- * the " + "buckets indexed should be equal",
- * ((PartitionedRegion)region).getTotalNumberOfBuckets(),
- * (((PartionedIndex)parIndex).getNumberOfIndexedBucket()+((PartionedIndex)parIndex).getNumRemtoeBucketsIndexed()));
- * should put all the assetion in a seperate function.
- */
- /* }
- catch (Exception ex) {
- fail("Creating Index in this vm failed : ", ex);
- }
-
- }
- });*/
vm0.invoke(PRQHelp.getCacheSerializableRunnableForIndexCreationCheck(name));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForIndexCreationCheck(name));
- // vm2.invoke(PRQHelp.getCacheSerializableRunnableForIndexCreationCheck(name));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForIndexCreationCheck(name));
}
@@ -422,21 +369,18 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
- // final String fileName = "PRIndexCreation.xml";
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name,
- // fileName));
+ setCacheInVMs(vm0,vm1,vm2,vm3);
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testPartitionedIndexUsageWithPRQuery started ");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
ArrayList<String> names = new ArrayList<String>();
names.add("PrIndexOnID");
@@ -446,20 +390,20 @@ public class PRBasicMultiIndexCreationDUnitTest extends
vm0.invoke(PRQHelp.getCacheSerializableRunnableForDefineIndex(name, names, exps));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRQueryAndCompareResults(
name, localName));
// validation on index usage with queries over a pr
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck(name));
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck(name));
- vm2.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck(name));
- vm3.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck(name));
+ vm0.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck());
+ vm1.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck());
+ vm2.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck());
+ vm3.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck());
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testPartitionedIndexUsageWithPRQuery done ");
@@ -474,32 +418,27 @@ public class PRBasicMultiIndexCreationDUnitTest extends
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
+ setCacheInVMs(vm0,vm1);
- // final String fileName = "PRIndexCreation.xml";
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name,
- // fileName));
-
int redundancy = 1;
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testPartitionedIndexCreationDuringPersistentRecovery started ");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPersistentPRCreate(name,
- redundancy, PRQHelp.valueConstraint));
+ redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPersistentPRCreate(name,
- redundancy, PRQHelp.valueConstraint));
-// vm2.invoke(PRQHelp.getCacheSerializableRunnableForPersistentPRCreate(name,
-// redundancy, PRQHelp.valueConstraint));
-
-
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ redundancy, PortfolioData.class));
+
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
//Restart a single member
vm0.invoke(PRQHelp.getCacheSerializableRunnableForCloseCache());
+ setCacheInVMs(vm0);
AsyncInvocation regionCreateFuture = vm0.invokeAsync(PRQHelp.getCacheSerializableRunnableForPersistentPRCreate(name,
- redundancy, PRQHelp.valueConstraint));
+ redundancy, PortfolioData.class));
//Ok, I want to do this in parallel
ArrayList<String> names = new ArrayList<String>();
@@ -515,7 +454,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
indexCreateFuture.getResult(20 * 1000);
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRQueryAndCompareResults(
@@ -523,7 +462,6 @@ public class PRBasicMultiIndexCreationDUnitTest extends
// validation on index usage with queries over a pr
//The indexes may not have been completely created yet, because the buckets
//may still be recovering from disk.
-// vm0.invoke(PRQHelp.getCacheSerializableRunnableForIndexUsageCheck(name));
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testPartitionedIndexCreationDuringPersistentRecovery done ");
@@ -541,18 +479,18 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
LogWriterUtils.getLogWriter()
.info(
"PRBasicIndexCreationDUnitTest.testPartitionedQueryWithIndexOnIdBug37089 started ");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
ArrayList<String> names = new ArrayList<String>();
names.add("PrIndexOnID");
@@ -562,11 +500,11 @@ public class PRBasicMultiIndexCreationDUnitTest extends
vm0.invoke(PRQHelp.getCacheSerializableRunnableForDefineIndex(name, names, exps));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRQueryAndCompareResults(
@@ -586,9 +524,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-// VM vm2 = host.getVM(2);
-// VM vm3 = host.getVM(3);
- // closeAllCache();
+ setCacheInVMs(vm0,vm1);
final String fileName = "PRIndexCreation.xml";
LogWriterUtils.getLogWriter().info(
"PRBasicIndexCreation.testCreatePartitionedIndexThroughXML started");
@@ -596,35 +532,12 @@ public class PRBasicMultiIndexCreationDUnitTest extends
"Starting and initializing partitioned regions and indexes using xml");
LogWriterUtils.getLogWriter().info(
"Starting a pr asynchronously using an xml file name : " + fileName);
- // AsyncInvocation asyInvk0 = vm0.invokeAsync(PRQHelp
- // .getCacheSerializableRunnableForPRCreateThrougXML(name, fileName));
- // AsyncInvocation asyInvk1 = vm1.invokeAsync(PRQHelp
- // .getCacheSerializableRunnableForPRCreateThrougXML(name, fileName));
- // asyInvk1.join();
- // if (asyInvk1.exceptionOccurred()) {
- // fail("asyInvk1 failed", asyInvk1.getException());
- // }
- // asyInvk0.join();
- // if (asyInvk0.exceptionOccurred()) {
- // fail("asyInvk0 failed", asyInvk0.getException());
- // }
- // printing all the indexes are created.
- //vm0.invoke(PRQHelp.getCacheSerializableRunnableForIndexCreationCheck(name));
- //vm1.invoke(PRQHelp.getCacheSerializableRunnableForIndexCreationCheck(name));
- /*
- <index name="index8">
- <functional from-clause="/PartionedPortfolios.keys k" expression="k" />
- </index> */
- // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreateThrougXML(name, fileName));
-
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
-// vm0.invoke(PRQHelp
-// .getCacheSerializableRunnableForLocalRegionCreation(localName));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ redundancy, PortfolioData.class));
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -643,12 +556,9 @@ public class PRBasicMultiIndexCreationDUnitTest extends
vm1.invoke(PRQHelp.getCacheSerializableRunnableForDefineIndex(name, names, exps, fromClause));
- //vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(localName,
- // "index8","k", "/LocalPortfolios.keys k" , ""));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
-
-
+
LogWriterUtils.getLogWriter().info(
"PRBasicIndexCreation.testCreatePartitionedIndexThroughXML is done " );
@@ -664,18 +574,19 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
+ setCacheInVMs(vm0,vm1,vm2,vm3);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
// create more vms to host data.
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -706,14 +617,15 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
+ setCacheInVMs(vm0,vm1,vm2,vm3);
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -728,9 +640,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
// create an accessor vm.
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
-
-
+ redundancy, PortfolioData.class));
}
/**
@@ -760,7 +670,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
// Creating PR's on the participating VM's
LogWriterUtils.getLogWriter()
.info(
@@ -790,7 +700,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfoliosAndPositions = PRQHelp.createPortfoliosAndPositions(totalDataSize);
+ final Portfolio[] portfoliosAndPositions = createPortfoliosAndPositions(totalDataSize);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPutsKeyValue(name, portfoliosAndPositions,
@@ -861,7 +771,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
// Creating PR's on the participating VM's
LogWriterUtils.getLogWriter()
.info(
@@ -891,7 +801,7 @@ public class PRBasicMultiIndexCreationDUnitTest extends
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfoliosAndPositions = PRQHelp.createPortfoliosAndPositions(totalDataSize);
+ final Portfolio[] portfoliosAndPositions = createPortfoliosAndPositions(totalDataSize);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPutsKeyValue(name, portfoliosAndPositions,
@@ -937,7 +847,6 @@ public class PRBasicMultiIndexCreationDUnitTest extends
public void testIndexQueryingWithOrderByLimit() throws Exception
{
- int dataSize = 10;
int step = 2;
int totalDataSize = 90;
final int i = 0;
@@ -952,7 +861,7 @@ public void testIndexQueryingWithOrderByLimit() throws Exception
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
// Creating PR's on the participating VM's
LogWriterUtils.getLogWriter()
.info(
@@ -982,7 +891,7 @@ public void testIndexQueryingWithOrderByLimit() throws Exception
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfoliosAndPositions = PRQHelp.createPortfoliosAndPositions(totalDataSize);
+ final Portfolio[] portfoliosAndPositions = createPortfoliosAndPositions(totalDataSize);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPutsKeyValue(name, portfoliosAndPositions,
@@ -1060,6 +969,4 @@ public void testIndexQueryingWithOrderByLimit() throws Exception
.info(
"PRQueryDUnitTest#testPRDAckCreationAndQuerying : *Querying PR's with DACK Test ENDED*****");
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
index 44cec38..bbe3c90 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicQueryDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache.query.partitioned;
+import static com.gemstone.gemfire.cache.query.Utils.*;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.query.Index;
@@ -49,11 +51,13 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
super(name);
}
- int totalNumBuckets = 100;
-
- int queryTestCycle = 10;
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "Portfolios";
@@ -75,7 +79,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0, vm1);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -87,11 +91,9 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the Accessor node in the PR");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
// Creating local region on vm0 to compare the results of query.
-// vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(localName,
-// Scope.DISTRIBUTED_ACK, redundancy));
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName));
+ vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the Accessor node in the PR");
@@ -101,7 +103,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRQBasicQueryDUnitTest:testPRBasicQuerying ----- Creating the Datastore node in the PR");
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
@@ -114,7 +116,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
@@ -146,7 +148,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
-
+ setCacheInVMs(vm0, vm1, vm2);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRCountStarQuery: Querying PR Test with DACK Started");
@@ -160,8 +162,6 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
redundancy, Portfolio.class));
// Creating local region on vm0 to compare the results of query.
-// vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(localName,
-// Scope.DISTRIBUTED_ACK, redundancy));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, Portfolio.class));
LogWriterUtils.getLogWriter()
.info(
@@ -189,7 +189,7 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest+100);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest+100);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest+100));
@@ -225,12 +225,12 @@ public class PRBasicQueryDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0, vm1);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
vm1.invoke(PRQHelp
.getCacheSerializableRunnableForPRCreate(name, redundancy, Portfolio.class));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
index 33ca1ac..bdbaeb3 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRBasicRemoveIndexDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache.query.partitioned;
+import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+
import com.gemstone.gemfire.cache.query.data.PortfolioData;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
import com.gemstone.gemfire.test.dunit.Host;
@@ -35,8 +37,14 @@ public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase
public PRBasicRemoveIndexDUnitTest (String name) {
super(name);
}
+
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
/**
* Name of the partitioned region for the test.
@@ -67,19 +75,19 @@ public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0, vm1, vm2, vm3);
LogWriterUtils.getLogWriter().info(
"PRBasicRemoveIndexDUnitTest.testPRBasicIndexCreate test now starts ....");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(start, end);
+ final PortfolioData[] portfolio = createPortfolioData(start, end);
// Putting the data into the PR's created
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
start, end));
@@ -110,18 +118,18 @@ public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0, vm1, vm2, vm3);
LogWriterUtils.getLogWriter().info(
"PRBasicRemoveIndexDUnitTest.testPRBasicIndexCreate test now starts ....");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(start, end);
+ redundancy, PortfolioData.class));
+ final PortfolioData[] portfolio = createPortfolioData(start, end);
// Putting the data into the PR's created
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
start, end));
@@ -134,8 +142,5 @@ public class PRBasicRemoveIndexDUnitTest extends PartitionedRegionDUnitTestCase
// remove indexes
vm1.invoke(PRQHelp.getCacheSerializableRunnableForRemoveIndex(name, true));
-
-
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
index 25c2393..f86b94e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
@@ -19,6 +19,8 @@
*/
package com.gemstone.gemfire.cache.query.partitioned;
+import static com.gemstone.gemfire.cache.query.Utils.*;
+
import java.util.ArrayList;
import parReg.query.unittest.NewPortfolio;
@@ -68,7 +70,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
int queryTestCycle = 10;
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "Portfolios1";
@@ -88,7 +90,11 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
public PRColocatedEquiJoinDUnitTest(String name) {
super(name);
}
-
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
/**
* A very basic dunit test that <br>
* 1. Creates two PR Data Stores with redundantCopies = 1.
@@ -100,7 +106,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
{
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -146,8 +152,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -179,7 +185,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
IgnoredException.addIgnoredException("UnsupportedOperationException");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -259,8 +265,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -383,7 +389,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -433,8 +439,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -472,7 +478,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -520,8 +526,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -559,7 +565,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
{
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -604,8 +610,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -643,7 +649,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -693,8 +699,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -732,7 +738,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -779,8 +785,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -818,7 +824,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
{
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -863,8 +869,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -902,7 +908,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -950,8 +956,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -989,7 +995,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1036,8 +1042,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -1076,7 +1082,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0, vm1);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1124,8 +1130,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -1233,7 +1239,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1283,8 +1289,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -1316,7 +1322,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1366,8 +1372,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -1398,7 +1404,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1448,8 +1454,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final Portfolio[] newPortfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final Portfolio[] newPortfolio = createPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -1480,7 +1486,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-
+ setCacheInVMs(vm0);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1533,8 +1539,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio,
cnt, cntDest));
@@ -1577,7 +1583,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0, vm1);
LogWriterUtils.getLogWriter()
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
@@ -1611,8 +1617,8 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
- final NewPortfolio[] newPortfolio = PRQHelp.createNewPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
+ final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRInvalidQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRInvalidQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRInvalidQueryDUnitTest.java
index aa7f1fe..4fa2b5a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRInvalidQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRInvalidQueryDUnitTest.java
@@ -22,6 +22,8 @@ package com.gemstone.gemfire.cache.query.partitioned;
* that they generate various Exceptions
*/
+import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+
import com.gemstone.gemfire.cache.query.data.PortfolioData;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
import com.gemstone.gemfire.test.dunit.Host;
@@ -42,9 +44,15 @@ public class PRInvalidQueryDUnitTest extends PartitionedRegionDUnitTestCase
super(name);
}
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
+
int totalNumBuckets = 100;
- PRQueryDUnitHelper prq = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper prq = new PRQueryDUnitHelper();
final String name = "Portfolios";
@@ -73,7 +81,7 @@ public class PRInvalidQueryDUnitTest extends PartitionedRegionDUnitTestCase
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0, vm1, vm2, vm3);
// Creting PR's on the participating VM's
// Creating Accessor node on the VM
@@ -81,7 +89,7 @@ public class PRInvalidQueryDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRInvalidQueryDUnitTest#testPRDAckCreationAndQueryingWithInvalidQuery: Creating the Accessor node in the PR");
vm0.invoke(prq.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRInvalidQueryDUnitTest#testPRDAckCreationAndQueryingWithInvalidQuery: Successfully created the Accessor node in the PR");
@@ -91,11 +99,11 @@ public class PRInvalidQueryDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRInvalidQueryDUnitTest#testPRDAckCreationAndQueryingWithInvalidQuery: Creating the Datastore node in the PR");
vm1.invoke(prq.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(prq.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm3.invoke(prq.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRInvalidQueryDUnitTest#testPRDAckCreationAndQueryingWithInvalidQuery: Successfully Created the Datastore node in the PR");
@@ -107,7 +115,7 @@ public class PRInvalidQueryDUnitTest extends PartitionedRegionDUnitTestCase
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final PortfolioData[] portfolio = prq.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm0.invoke(prq.getCacheSerializableRunnableForPRPuts(name, portfolio, i, i
@@ -124,8 +132,8 @@ public class PRInvalidQueryDUnitTest extends PartitionedRegionDUnitTestCase
final String invalidQuery = "Invalid Query";
// querying the VM for data
- vm0.invoke(prq.getCacheSerializableRunnableForPRInvalidQuery(name,
- invalidQuery));
+ vm0.invoke(prq.getCacheSerializableRunnableForPRInvalidQuery(name
+ ));
LogWriterUtils.getLogWriter()
.info(
"PRInvalidQueryDUnitTest#testPRDAckCreationAndQueryingWithInvalidQuery: *****Querying PR's Test with Expected Invalid Query Exception *****");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryCacheCloseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryCacheCloseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryCacheCloseDUnitTest.java
index af53e11..97021f5 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryCacheCloseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryCacheCloseDUnitTest.java
@@ -14,15 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.gemstone.gemfire.cache.query.partitioned;
+/**
+ * This test tests the PR query behaviour with respect to cache closure
+ * happening on one of the data stores. PR is configured with redundantCopies =
+ * 1, and cache close is done randomly on one of the data stores and then
+ * recreated, thus avoiding any data loss.
+ *
+ */
+
+import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.Random;
-import org.junit.experimental.categories.Category;
-
import com.gemstone.gemfire.cache.query.data.PortfolioData;
import com.gemstone.gemfire.internal.cache.ForceReattemptException;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
@@ -33,31 +42,32 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-/**
- * This test tests the PR query behaviour with respect to cache closure
- * happening on one of the data stores. PR is configured with redundantCopies =
- * 1, and cache close is done randomly on one of the data stores and then
- * recreated, thus avoiding any data loss.
- */
-public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
+public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase
+{
+
+ /**
+ * constructor *
+ *
+ * @param name
+ */
public PRQueryCacheCloseDUnitTest(String name) {
+
super(name);
}
-
- static Properties props = new Properties();
-
- int totalNumBuckets = 100;
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
int threadSleepTime = 500;
- int querySleepTime = 2000;
-
int queryTestCycle = 10;
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "Portfolios";
@@ -90,7 +100,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
VM accessor = host.getVM(0);
VM datastore1 = host.getVM(1);
VM datastore2 = host.getVM(2);
-
+ setCacheInVMs(accessor, datastore1, datastore2);
List vmList = new LinkedList();
vmList.add(datastore1);
vmList.add(datastore2);
@@ -101,7 +111,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Creating Accessor node on VM0");
accessor.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Successfully Created Accessor node on VM0");
@@ -110,9 +120,9 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Creating PR's across all VM1 , VM2");
datastore1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
datastore2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Successfully Created PR on VM1 , VM2");
@@ -122,7 +132,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Creating Local Region on VM0");
accessor.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Successfully Created Local Region on VM0");
@@ -130,7 +140,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
LogWriterUtils.getLogWriter()
@@ -167,8 +177,12 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithDelay: Calling for cache close on either of the Datastores VM1 , VM2 at random and then recreating the cache, with a predefined Delay ");
for (int j = 0; j < queryTestCycle; j++) {
int k = (random.nextInt(vmList.size()));
+ LogWriterUtils.getLogWriter().info("PROperationWithQueryDUnitTest#getCacheSerializableRunnableForCacheClose: Closing cache");
+ ((VM)vmList.get(k)).invoke(() -> closeCache());
+ LogWriterUtils.getLogWriter().info("PROperationWithQueryDUnitTest#getCacheSerializableRunnableForCacheClose: Cache Closed");
+ setCacheInVMs(((VM)vmList.get(k)));
((VM)(vmList.get(k))).invoke(PRQHelp.getCacheSerializableRunnableForCacheClose(
- name, redundancy));
+ name, redundancy, PortfolioData.class));
Wait.pause(threadSleepTime);
}
ThreadUtils.join(async0, 5 * 60 * 1000);
@@ -208,7 +222,6 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
* 6. then recreates the PR on the same VM <br>
* 7. Verfies the size , type , contents of both the resultSets Obtained <br>
*/
- @Category(FlakyTest.class) // GEODE-1239: uses PRQueryDUnitHelper, uses Random, async actions, time sensitive, complex retry loop, thread unsafe test hook
public void testPRWithCacheCloseInOneDatastoreWithoutDelay() throws Exception
{
LogWriterUtils.getLogWriter()
@@ -218,7 +231,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
-
+ setCacheInVMs(vm0, vm1, vm2);
List vmList = new LinkedList();
vmList.add(vm1);
vmList.add(vm2);
@@ -228,7 +241,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Creating Accessor node on VM0");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Successfully Created Accessor node on VM0");
@@ -237,9 +250,9 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Creating PR's across all VM1 , VM2");
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Successfully Created PR on VM1 , VM2");
@@ -249,7 +262,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Successfully Created Local Region on VM0");
@@ -263,7 +276,7 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
// Generating portfolio object array to be populated across the PR's & Local
// Regions
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
+ final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
LogWriterUtils.getLogWriter()
.info(
@@ -300,8 +313,12 @@ public class PRQueryCacheCloseDUnitTest extends PartitionedRegionDUnitTestCase {
"PRQueryCacheCloseDUnitTest#testPRWithCacheCloseInOneDatastoreWithoutDelay: Calling for cache close on either of the Datastores VM1 , VM2 at random and then recreating the cache, with no delay ");
for (int j = 0; j < queryTestCycle; j++) {
int k = (random.nextInt(vmList.size()));
+ LogWriterUtils.getLogWriter().info("PROperationWithQueryDUnitTest#getCacheSerializableRunnableForCacheClose: Closing cache");
+ ((VM)vmList.get(k)).invoke(() -> closeCache());
+ LogWriterUtils.getLogWriter().info("PROperationWithQueryDUnitTest#getCacheSerializableRunnableForCacheClose: Cache Closed");
+ setCacheInVMs(((VM)vmList.get(k)));
((VM)(vmList.get(k))).invoke(PRQHelp.getCacheSerializableRunnableForCacheClose(
- name, redundancy));
+ name, redundancy, PortfolioData.class));
}
ThreadUtils.join(async0, 5 * 60 * 1000);