You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/04/28 16:51:48 UTC
[02/13] 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/PRQueryPerfDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryPerfDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryPerfDUnitTest.java
deleted file mode 100755
index c67cefe..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryPerfDUnitTest.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.query.partitioned;
-
-import java.io.Serializable;
-
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.cache.query.data.PortfolioData;
-import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-
-/**
- *This tests executes an array of queries to be executed over the PR ,
- * benchmarking them over the time taken by the same when executed over the
- * Local Region
- * The performance difference is reported for scenarios
- * encompassing various permutations of the PR attributes
- * like Redundancy / No. of D.S / No. of Accessors etc
- *
- */
-
-public class PRQueryPerfDUnitTest extends PartitionedRegionDUnitTestCase {
- public static final int SLEEP = 0;
-
- /**
- * Constructor
- *
- * @param name
- */
-
- public PRQueryPerfDUnitTest(String name) {
- super(name);
- }
-
- int totalNumBuckets = 100;
-
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
-
- final String name = "Portfolios";
-
- final String localName = "LocalPortfolios";
-
- final int cnt = 0, cntDest = 5000;
-
- /**
- * A nuthing test to make DUnit happy.
- * The rest of these tests shouldn't be run
- * as part of our CruiseControl or precheckin
- * since they don't assert any behavior.
- */
- public void testNuthin() {}
-
- /**
- * This tests executes an array of queries to be executed over the PR ,
- * benchmarking them over the time taken by the same when executed over the
- * Local Region with
- * One Accessor
- * One Datastore
- * Redundancy =0
- *
- */
- public void norun_testBenchmarkingQueryingOneAccessorOneDS_Redundancy0()
- throws Exception
- {
-
- LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
- log.info("BenchMarking PR Querying Test Started*****");
- Host host = Host.getHost(0);
-
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
-
- int redundancy = 0;
-
- try {
- setVMInfoLogLevel();
-
- // Creating Accessor PR's on the participating VM's
- log.info("Creating Accessor node on VM0");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
- log.info("Successfully Created Accessor node on VM0");
-
- log.info("Creating Datastores across VM1");
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- log.info("Successfully Created Datastores on VM1");
-
- // creating a local region on one of the JVM's
- log.info("Creating Local Region on VM0");
- vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
- log.info("Successfully Created Local Region on VM0");
-
- // Generating portfolio object array to be populated across the PR's & Local
- // Regions
-
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
-
- // Putting the data into the accessor node
- log.info("Inserting Portfolio data through the accessor node");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
- cnt, cntDest));
- log.info("Successfully Inserted Portfolio data through the accessor node");
-
- // Putting the same data in the local region created
- log
- .info("Inserting Portfolio data on local node VM0 for result " +
- "set comparison");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
- portfolio, cnt, cntDest));
- log
- .info("Successfully Inserted Portfolio data on local node VM0 for" +
- " result set comparison");
-
- ResultsObject perfR = new ResultsObject();
- perfR.OperationDescription = "PR with 1 Accessor, 1 D.S., Redundancy =0,";
- perfR.NumberOfAccessors = 1;
- perfR.NumberOfDataStores = 1;
- perfR.redundancy = 0;
-
- if (SLEEP > 0) {
- Thread.sleep(SLEEP);
- }
-
- // querying the VM for data
- log.info("Querying on VM0 both on PR Region & local, also comparing the " +
- "Results sets from both");
- vm0.invoke(PRQHelp.PRQueryingVsLocalQuerying(name, localName, perfR));
-
- log.info("Benchmarking Querying between PR & local ENDED*****");
- }
- finally {
- resetVMLogLevel();
- }
-}
-
-
- /**
- * This tests executes an array of queries to be executed over the PR ,
- * benchmarking them over the time taken by the same when executed over the
- * Local Region with
- * One Accessor
- * Two Datastore
- * Redundancy =0
- *
- */
-
-
- public void norun_testBenchmarkingQueryingOneAccessorTwoDS_Redundancy0()
- throws Exception
- {
- LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
-
- log.info("BenchMarking PR Querying Test Started*****");
- Host host = Host.getHost(0);
-
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- VM vm2 = host.getVM(2);
-
- int redundancy = 0;
-
- try {
- setVMInfoLogLevel();
-
- // Creating Accessor PR's on the participating VM's
- log.info("Creating Accessor node on VM0");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
- log.info("Successfully Created Accessor node on VM0");
-
- log.info("Creating Datastores across VM1 , VM2");
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- log.info("Successfully Created Datastores on VM1 , VM2");
-
- // creating a local region on one of the JVM's
- log.info("Creating Local Region on VM0");
- vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
- log.info("Successfully Created Local Region on VM0");
-
- // Generating portfolio object array to be populated across the PR's & Local
- // Regions
-
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
-
- // Putting the data into the accessor node
- log.info("Inserting Portfolio data through the accessor node");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
- cnt, cntDest));
- log.info("Successfully Inserted Portfolio data through the accessor node");
-
- // Putting the same data in the local region created
- log
- .info("Inserting Portfolio data on local node VM0 for result set comparison");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
- portfolio, cnt, cntDest));
- log.info("Successfully Inserted Portfolio data on local node VM0 for " +
- "result set comparison");
-
- ResultsObject perfR = new ResultsObject();
- perfR.OperationDescription = "PR with 1 Accessor, 2 D.S., Redundancy=0";
- perfR.NumberOfAccessors = 1;
- perfR.NumberOfDataStores = 2;
- perfR.redundancy = 0;
-
- if (SLEEP > 0) {
- Thread.sleep(SLEEP);
- }
-
-
- // querying the VM for data
- log.info("Querying on VM0 both on PR Region & local, also comparing the " +
- "results sets from both");
- vm0.invoke(PRQHelp.PRQueryingVsLocalQuerying(name, localName, perfR));
-
- log.info("Benchmarking Querying between PR & local ENDED*****");
- }
- finally {
- resetVMLogLevel();
- }
- }
-
-
- /**
- * This tests executes an array of queries to be executed over the PR ,
- * benchmarking them over the time taken by the same when executed over the
- * Local Region with One Accessor Two Datastore Redundancy =1
- *
- */
-
- public void norun_testBenchmarkingQueryingOneAccessorTwoDS_D_ACK_Redundancy1()
- throws Exception
- {
- LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
- log.info("BenchMarking PR Querying Test Started*****");
- Host host = Host.getHost(0);
-
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- VM vm2 = host.getVM(2);
-
- int redundancy = 1;
-
- try {
- setVMInfoLogLevel();
-
- // Creating Accessor PR's on the participating VM'sw
- log.info("Creating Accessor node on VM0");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
- log.info("Successfully Created Accessor node on VM0");
-
- log.info("Creating Datastores across VM1 , VM2");
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- log.info("Successfully Created Datastores on VM1 , VM2");
-
- // creating a local region on one of the JVM's
- log.info("Creating Local Region on VM0");
- vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
- log.info("Successfully Created Local Region on VM0");
-
- // Generating portfolio object array to be populated across the PR's & Local
- // Regions
-
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
-
- // Putting the data into the accessor node
- log.info("Inserting Portfolio data through the accessor node");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
- cnt, cntDest));
- log.info("Successfully Inserted Portfolio data through the accessor node");
-
- // Putting the same data in the local region created
- log.info("Inserting Portfolio data on local node VM0 for result " +
- "set comparison");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
- portfolio, cnt, cntDest));
- log.info("Successfully Inserted Portfolio data on local node VM0 for " +
- "result set comparison");
-
- ResultsObject perfR = new ResultsObject();
- perfR.OperationDescription = "PR with 1 Accessor, 2 D.S., Redundancy=1";
- perfR.NumberOfAccessors = 1;
- perfR.NumberOfDataStores = 2;
- perfR.redundancy = 1;
-
- if (SLEEP > 0) {
- Thread.sleep(SLEEP);
- }
-
- // querying the VM for data
- log.info("Querying on VM0 both on PR Region & local, also comparing the " +
- "results sets from both");
- vm0.invoke(PRQHelp.PRQueryingVsLocalQuerying(name, localName, perfR));
-
- log.info("Benchmarking Querying between PR & local ENDED*****");
- }
- finally {
- resetVMLogLevel();
- }
- }
-
- /**
- * This tests executes an array of queries to be executed over the PR ,
- * benchmarking them over the time taken by the same when executed over the
- * Local Region with One Accessor Three Datastore Redundancy =1
- *
- */
-
- public void norun_testBenchmarkingQueryingOneAccessorThreeDS_Redundancy1()
- throws Exception
- {
- LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
- log.info("BenchMarking PR Querying Test Started*****");
- 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);
-
- int redundancy = 1;
-
- try {
- setVMInfoLogLevel();
-
- // Creating Accessor PR's on the participating VM's
- log.info("Creating Accessor node on VM0");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
- log.info("Successfully Created Accessor node on VM0");
-
- log.info("Creating Datastores across VM1 , VM2 , VM3");
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
-
- log.info("Successfully Created Datastores on VM1 , VM2 ,VM3");
-
- // creating a local region on one of the JVM's
- log.info("Creating Local Region on VM0");
- vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
- log.info("Successfully Created Local Region on VM0");
-
- // Generating portfolio object array to be populated across the PR's & Local
- // Regions
-
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
-
- // Putting the data into the accessor node
- log.info("Inserting Portfolio data through the accessor node");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
- cnt, cntDest));
- log.info("Successfully Inserted Portfolio data through the accessor node");
-
- // Putting the same data in the local region created
- log.info("Inserting Portfolio data on local node VM0 for result set comparison");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
- portfolio, cnt, cntDest));
- log.info("Successfully Inserted Portfolio data on local node VM0 for " +
- "result set comparison");
-
- ResultsObject perfR = new ResultsObject();
- perfR.OperationDescription = "PR with 1 Accessor, 3 D.S., Redundancy=1";
- perfR.NumberOfAccessors = 1;
- perfR.NumberOfDataStores = 3;
- perfR.redundancy = 1;
-
- if (SLEEP > 0) {
- Thread.sleep(SLEEP);
- }
-
-
- // querying the VM for data
- log.info("Querying on VM0 both on PR Region & local, also comparing the " +
- "results sets from both");
- vm0.invoke(PRQHelp.PRQueryingVsLocalQuerying(name, localName, perfR));
-
- log.info("Benchmarking Querying between PR & local ENDED*****");
- }
- finally {
- resetVMLogLevel();
- }
- }
-
-
- /**
- * This tests executes an array of queries to be executed over the PR ,
- * benchmarking them over the time taken by the same when executed over the
- * Local Region with One Accessor Three Datastore Redundancy =2
- *
- */
-
- public void norun_testBenchmarkingQueryingOneAccessorThreeDS_Redundancy2()
- throws Exception
- {
- LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
- log.info("BenchMarking PR Querying Test Started*****");
- 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);
-
- int redundancy = 2;
-
- try {
- setVMInfoLogLevel();
-
- // Creating Accessor PR's on the participating VM's
- log.info("Creating Accessor node on VM0");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
- log.info("Successfully Created Accessor node on VM0");
-
- log.info("Creating Datastores across VM1 , VM2 , VM3");
- vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
- vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy));
-
- log.info("Successfully Created Datastores on VM1 , VM2 , VM3");
-
- // creating a local region on one of the JVM's
- log.info("Creating Local Region on VM0");
- vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
- log.info("Successfully Created Local Region on VM0");
-
- // Generating portfolio object array to be populated across the PR's & Local
- // Regions
-
- final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
-
- // Putting the data into the accessor node
- log.info("Inserting Portfolio data through the accessor node");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
- cnt, cntDest));
- log.info("Successfully Inserted Portfolio data through the accessor node");
-
- // Putting the same data in the local region created
- log.info("Inserting Portfolio data on local node VM0 for result set comparison");
- vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
- portfolio, cnt, cntDest));
- log.info("Successfully Inserted Portfolio data on local node VM0 for " +
- "result set comparison");
-
- ResultsObject perfR = new ResultsObject();
- perfR.OperationDescription = "PR with 1 Accessor, 3 D.S., Redundancy=2";
- perfR.NumberOfAccessors = 1;
- perfR.NumberOfDataStores = 3;
- perfR.redundancy = 2;
-
- if (SLEEP > 0) {
- Thread.sleep(SLEEP);
- }
-
-
- // querying the VM for data
- log.info("Querying on VM0 both on PR Region & local, also comparing the " +
- "results sets from both");
- vm0.invoke(PRQHelp.PRQueryingVsLocalQuerying(name, localName, perfR));
-
- log.info("Benchmarking Querying between PR & local ENDED*****");
- }
- finally {
- resetVMLogLevel();
- }
- }
-
- /*
- * Inner class to for the ResultObject , displaying various attributes of the
- * Performance Report
- */
- class ResultsObject implements Serializable {
- String OperationDescription;
- long QueryingTimeLocal;
- long QueryingTimePR;
- int NumberOfDataStores = 0;
- int NumberOfAccessors = 0;
- int redundancy = 0;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionCloseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionCloseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionCloseDUnitTest.java
index 5240ebc..c8975db 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionCloseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionCloseDUnitTest.java
@@ -24,6 +24,8 @@ package com.gemstone.gemfire.cache.query.partitioned;
*
*/
+import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
@@ -50,21 +52,21 @@ public class PRQueryRegionCloseDUnitTest extends PartitionedRegionDUnitTestCase
*/
public PRQueryRegionCloseDUnitTest(String name) {
-
super(name);
}
- static Properties props = new Properties();
+ public void setCacheInVMs(VM... vms) {
+ for (VM vm : vms) {
+ vm.invoke(() -> PRQueryDUnitHelper.setCache(getCache()));
+ }
+ }
- int totalNumBuckets = 100;
int threadSleepTime = 500;
- int querySleepTime = 2000;
-
int queryTestCycle = 10;
- PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
+ PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "Portfolios";
@@ -98,7 +100,7 @@ public class PRQueryRegionCloseDUnitTest 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);
@@ -107,7 +109,7 @@ public class PRQueryRegionCloseDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRQueryRegionCloseDUnitTest#testPRWithRegionCloseInOneDatastoreWithoutDelay: Creating Accessor node on VM0");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionCloseDUnitTest#testPRWithRegionCloseInOneDatastoreWithoutDelay: Successfully Created Accessor node on VM0");
@@ -116,9 +118,9 @@ public class PRQueryRegionCloseDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRQueryRegionCloseDUnitTest#testPRWithRegionCloseInOneDatastoreWithoutDelay: 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(
"PRQueryRegionCloseDUnitTest#testPRWithRegionCloseInOneDatastoreWithoutDelay: Successfully Created PR on VM1 , VM2");
@@ -128,7 +130,7 @@ public class PRQueryRegionCloseDUnitTest extends PartitionedRegionDUnitTestCase
.info(
"PRQueryRegionCloseDUnitTest#testPRWithRegionCloseInOneDatastoreWithoutDelay: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionCloseDUnitTest#testPRWithRegionCloseInOneDatastoreWithoutDelay: Successfully Created Local Region on VM0");
@@ -136,7 +138,7 @@ public class PRQueryRegionCloseDUnitTest 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()
@@ -175,7 +177,7 @@ public class PRQueryRegionCloseDUnitTest extends PartitionedRegionDUnitTestCase
int k = (random.nextInt(vmList.size()));
if( 0 != k ) {
((VM)(vmList.get(k))).invoke(PRQHelp.getCacheSerializableRunnableForRegionClose(
- name, redundancy));
+ name, redundancy, PortfolioData.class));
Wait.pause(threadSleepTime);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionDestroyedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionDestroyedDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionDestroyedDUnitTest.java
index 40bac7b..1892be9 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionDestroyedDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRegionDestroyedDUnitTest.java
@@ -24,6 +24,8 @@ package com.gemstone.gemfire.cache.query.partitioned;
*
*/
+import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
@@ -53,18 +55,12 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
super(name);
}
-
- static Properties props = new Properties();
-
- int totalNumBuckets = 100;
-
- int threadSleepTime = 500;
-
- int querySleepTime = 2000;
-
- 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 = "Portfolios";
@@ -98,7 +94,7 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
-
+ setCacheInVMs(vm0,vm1,vm2,vm3);
List vmList = new LinkedList();
vmList.add(vm1);
vmList.add(vm2);
@@ -108,7 +104,7 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithRegionDestroyInOneDatastoreWithDelay: Creating Accessor node on VM0");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name,
- redundancy));
+ redundancy, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithRegionDestroyInOneDatastoreWithDelay: Successfully Created Accessor node on VM0");
@@ -117,11 +113,11 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithRegionDestroyInOneDatastoreWithDelay: Creating PR's across all 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));
LogWriterUtils.getLogWriter()
@@ -133,7 +129,7 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithRegionDestroyInOneDatastoreWithDelay: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithRegionDestroyInOneDatastoreWithDelay: Successfully Created Local Region on VM0");
@@ -141,7 +137,7 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
// 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
@@ -192,7 +188,7 @@ public class PRQueryRegionDestroyedDUnitTest extends PartitionedRegionDUnitTestC
int k = (random.nextInt(vmList.size()));
((VM)(vmList.get(k))).invoke(PRQHelp.getCacheSerializableRunnableForRegionClose(
- name, redundancy));
+ name, redundancy, PortfolioData.class));
ThreadUtils.join(async0, 30 * 1000);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
index a112e2a..2fc1bc5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
@@ -19,6 +19,8 @@
*/
package com.gemstone.gemfire.cache.query.partitioned;
+import static com.gemstone.gemfire.cache.query.Utils.createPortfolioData;
+
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
@@ -66,17 +68,13 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
super(name);
}
- static Properties props = new Properties();
-
- int totalNumBuckets = 100;
-
- int threadSleepTime = 500;
-
- int querySleepTime = 2000;
-
- 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";
@@ -114,7 +112,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0,vm1);
List vmList = new LinkedList();
vmList.add(vm1);
vmList.add(vm0);
@@ -136,7 +134,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -144,7 +142,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
// 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()
@@ -244,7 +242,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0,vm1);
List vmList = new LinkedList();
vmList.add(vm1);
vmList.add(vm0);
@@ -266,7 +264,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -274,7 +272,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
// 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()
@@ -375,7 +373,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0,vm1);
List vmList = new LinkedList();
vmList.add(vm1);
vmList.add(vm0);
@@ -397,7 +395,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -405,7 +403,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
// 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()
@@ -508,7 +506,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
-
+ setCacheInVMs(vm0,vm1);
List vmList = new LinkedList();
vmList.add(vm1);
vmList.add(vm0);
@@ -530,7 +528,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -538,7 +536,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
// 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()
@@ -652,7 +650,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
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(vm0);
@@ -677,7 +675,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
- .getCacheSerializableRunnableForLocalRegionCreation(localName));
+ .getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -685,7 +683,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
// 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()
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6fb84d96/geode-core/src/test/java/com/gemstone/gemfire/management/QueryDataDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/QueryDataDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/QueryDataDUnitTest.java
index 10caa3c..ad26a05 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/QueryDataDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/QueryDataDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.management;
+import static com.gemstone.gemfire.cache.query.Utils.createPortfoliosAndPositions;
+
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
@@ -111,8 +113,6 @@ public class QueryDataDUnitTest extends ManagementTestBase {
static String repRegionName4 = "TestRepRegion4"; // default name
static String localRegionName = "TestLocalRegion"; // default name
- private static PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper("");
-
public static String[] queries = new String[] {
"select * from /" + PartitionedRegionName1 + " where ID>=0",
"Select * from /" + PartitionedRegionName1 + " r1, /" + PartitionedRegionName2 + " r2 where r1.ID = r2.ID",
@@ -203,7 +203,7 @@ public class QueryDataDUnitTest extends ManagementTestBase {
public void fillValuesInRegions() {
// Create common Portflios and NewPortfolios
- final Portfolio[] portfolio = PRQHelp.createPortfoliosAndPositions(cntDest);
+ final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
// Fill local region
managedNode1.invoke(getCacheSerializableRunnableForPRPuts(localRegionName, portfolio, cnt, cntDest));