You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/06/03 19:56:52 UTC
[6/7] incubator-geode git commit: Convert junit3 to junit4 and
cleanup tests.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7e9d4a62/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
index c4042da..1eaa1f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUMRShuffleIteratorsJUnitTest.java
@@ -21,6 +21,19 @@
*/
package com.gemstone.gemfire.cache.query.functional;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.query.CacheUtils;
import com.gemstone.gemfire.cache.query.Index;
@@ -36,30 +49,11 @@ import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.*;
-
-import junit.framework.TestCase;
-
-/**
- *
- */
@Category(IntegrationTest.class)
public class IUMRShuffleIteratorsJUnitTest {
-
@Before
- public void setUp() throws java.lang.Exception {
+ public void setUp() throws Exception {
CacheUtils.startCache();
Region r1 = CacheUtils.createRegion("portfolios", Portfolio.class);
for(int i=0;i<4;i++){
@@ -83,41 +77,33 @@ public class IUMRShuffleIteratorsJUnitTest {
for(int i=0;i<4;i++){
r3.put(new Integer(i), new Address("411001","Pune",str,ph));
}
-
}
@After
- public void tearDown() throws java.lang.Exception {
+ public void tearDown() throws Exception {
CacheUtils.closeCache();
}
@Test
public void testQueryWithNOIndexes1() throws Exception {
- // Object r = new Object();
CacheUtils.getQueryService();
+
String queries[] = {
"select distinct * from /portfolios p, /employees e",
"Select distinct * from /portfolios pf,/employees e where pf.status='active'"
-
};
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- q.execute();
- if(observer.isIndexesUsed){
- fail("Index is uesd");
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ q.execute();
+ if(observer.isIndexesUsed){
+ fail("Index is uesd");
}
}
-
}//end of test 1
@Test
@@ -128,41 +114,31 @@ public class IUMRShuffleIteratorsJUnitTest {
String queries[] = {
"Select distinct * from /portfolios pf,/employees e where pf.status='active'"
-
};
+
//Execute Queries without Indexes
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- r[i][0] = q.execute();
- } catch (Exception e) {
- e.printStackTrace();
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ r[i][0] = q.execute();
}
//Create Index and Execute the Queries
qs.createIndex("statusIndex", IndexType.FUNCTIONAL,"status","/portfolios");
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
-
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- r[i][1] = q.execute();
- if(!observer.isIndexesUsed){
- fail("Index is NOT uesd");
- }
- CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
-
- Iterator itr = observer.indexesUsed.iterator();
- assertEquals("statusIndex",itr.next().toString());
-
- } catch (Exception e) {
- e.printStackTrace();
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ r[i][1] = q.execute();
+ if(!observer.isIndexesUsed){
+ fail("Index is NOT uesd");
}
+ CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
+
+ Iterator itr = observer.indexesUsed.iterator();
+ assertEquals("statusIndex",itr.next().toString());
}
//Verifying the query results
StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -181,39 +157,27 @@ public class IUMRShuffleIteratorsJUnitTest {
//Execute Queries without Indexes
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- r[i][0] = q.execute();
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ r[i][0] = q.execute();
}
//Create Index andExecute the Queries
qs.createIndex("nameIndex", IndexType.FUNCTIONAL,"e.name","/employees e");
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
-
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- r[i][1] = q.execute();
-
- if(!observer.isIndexesUsed){
- fail("Index is NOT uesd");
- //Test fails here. Index on second region is not getting used.
- }
- CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
- Iterator itr = observer.indexesUsed.iterator();
- assertEquals("nameIndex",itr.next().toString());
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ r[i][1] = q.execute();
+
+ if(!observer.isIndexesUsed){
+ fail("Index is NOT uesd");
+ //Test fails here. Index on second region is not getting used.
}
+ CacheUtils.log("*****************IndexUsed::"+observer.IndexName);
+ Iterator itr = observer.indexesUsed.iterator();
+ assertEquals("nameIndex",itr.next().toString());
}
//Verifying the query results
StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -226,21 +190,18 @@ public class IUMRShuffleIteratorsJUnitTest {
Object r[][] = new Object[9][2];
QueryService qs;
qs = CacheUtils.getQueryService();
+
String queries[] = {
//Test Case No. IUMR002
"Select distinct * from /portfolios pf, /employees e where e.name ='empName' and pf.status='active'",
};
+
//Execute Query without Indexes
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- r[i][0] = q.execute();
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ r[i][0] = q.execute();
}
//Create Indexes and Execute Queries
@@ -249,41 +210,34 @@ public class IUMRShuffleIteratorsJUnitTest {
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
-
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- r[i][1] = q.execute();
- if(!observer.isIndexesUsed){
- fail("Index is NOT uesd");
- }
- int indxs = observer.indexesUsed.size();
- CacheUtils.log("***********Indexes Used :::: "+indxs+" IndexName::"+observer.IndexName);
- if(indxs!=2){
- fail("FAILED: Both The Indexes should be used. Presently only "+indxs+" Index(es) is used");
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ r[i][1] = q.execute();
+ if(!observer.isIndexesUsed){
+ fail("Index is NOT uesd");
+ }
+ int indxs = observer.indexesUsed.size();
+ CacheUtils.log("***********Indexes Used :::: "+indxs+" IndexName::"+observer.IndexName);
+ if(indxs!=2){
+ fail("FAILED: Both The Indexes should be used. Presently only "+indxs+" Index(es) is used");
+ }
- Iterator itr = observer.indexesUsed.iterator();
- String temp;
+ Iterator itr = observer.indexesUsed.iterator();
+ String temp;
- while(itr.hasNext()){
- temp = itr.next().toString();
+ while(itr.hasNext()){
+ temp = itr.next().toString();
- if(temp.equals("nameIndex")){
- break;
- }else if(temp.equals("statusIndex")){
- break;
- }else{
- fail("indices used do not match with those which are expected to be used" +
- "<nameIndex> and <statusIndex> were expected but found " +itr.next());
- }
+ if(temp.equals("nameIndex")){
+ break;
+ }else if(temp.equals("statusIndex")){
+ break;
+ }else{
+ fail("indices used do not match with those which are expected to be used" +
+ "<nameIndex> and <statusIndex> were expected but found " +itr.next());
}
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
}
}
//Verifying the query results
@@ -303,20 +257,14 @@ public class IUMRShuffleIteratorsJUnitTest {
"select distinct * from /address a, /portfolios p, /employees e, a.street s where s.street ='DPStreet1'",
//Scenario B: Only Index on the first region in the Query is used
//"select distinct * from /address a, /portfolios p, /employees e, a.street s where p.status='active' and s.street ='DPStreet1'",
-
};
+
//Execute queries without Indexes
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- r [i][0]= q.execute();
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ r [i][0]= q.execute();
}
//Create Indexes and Execute the queries
qs.createIndex("nameIndex", IndexType.FUNCTIONAL,"e.name","/employees e");
@@ -324,25 +272,18 @@ public class IUMRShuffleIteratorsJUnitTest {
qs.createIndex("streetIndex", IndexType.FUNCTIONAL,"s.street","/address a, a.street s");
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- r [i][1]= q.execute();
- if(!observer.isIndexesUsed){
- fail("Index is NOT uesd");
- }
- int indxs = observer.indexesUsed.size();
- CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
- Iterator itr = observer.indexesUsed.iterator();
- assertEquals("streetIndex",itr.next().toString());
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ r [i][1]= q.execute();
+ if(!observer.isIndexesUsed){
+ fail("Index is NOT uesd");
}
-
+ int indxs = observer.indexesUsed.size();
+ CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
+ Iterator itr = observer.indexesUsed.iterator();
+ assertEquals("streetIndex",itr.next().toString());
}
//Verifying the query results
StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -359,42 +300,31 @@ public class IUMRShuffleIteratorsJUnitTest {
"select distinct * from /address itr1,itr1.phoneNo itr2,itr1.street itr3 where itr2.mobile>333",
"select distinct * from /address itr1,itr1.street itr2,itr1.phoneNo itr3 where itr3.mobile>333",
};
+
//Execute the query without index
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- r[i][0] = q.execute();
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ r[i][0] = q.execute();
}
//Create index and Execute the query
qs.createIndex("mobileIndex",IndexType.FUNCTIONAL,"itr2.mobile","/address itr1,itr1.phoneNo itr2,itr1.street itr3");
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- r[i][1] = q.execute();
- if(!observer.isIndexesUsed){
- fail("Index is NOT uesd");
- }
- int indxs = observer.indexesUsed.size();
- CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
-
- Iterator itr = observer.indexesUsed.iterator();
- assertEquals("mobileIndex",itr.next().toString());
-
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ r[i][1] = q.execute();
+ if(!observer.isIndexesUsed){
+ fail("Index is NOT uesd");
}
+ int indxs = observer.indexesUsed.size();
+ CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
+
+ Iterator itr = observer.indexesUsed.iterator();
+ assertEquals("mobileIndex",itr.next().toString());
}
//Verifying the query results
StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
@@ -414,15 +344,9 @@ public class IUMRShuffleIteratorsJUnitTest {
//Execute queries without Indexes
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- r [i][0]= q.execute();
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ r [i][0]= q.execute();
}
//Create Indexes and Execute the queries
qs.createIndex("nameIndex", IndexType.FUNCTIONAL,"e.name","/employees e");
@@ -430,54 +354,51 @@ public class IUMRShuffleIteratorsJUnitTest {
qs.createIndex("streetIndex", IndexType.FUNCTIONAL,"s.street","/address a, a.street s");
for (int i = 0; i < queries.length; i++) {
Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries[i]);
- CacheUtils.getLogger().info("Executing query: " + queries[i]);
- QueryObserverImpl observer = new QueryObserverImpl();
- QueryObserverHolder.setInstance(observer);
- r [i][1]= q.execute();
- if(!observer.isIndexesUsed){
- fail("Index is NOT uesd");
- }
- int indxs = observer.indexesUsed.size();
- CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
-
- Iterator itr = observer.indexesUsed.iterator();
- String temp;
-
- while(itr.hasNext()){
- temp = itr.next().toString();
-
- if(temp.equals("streetIndex")){
- break;
- }else if(temp.equals("statusIndex")){
- break;
- }else{
- fail("indices used do not match with those which are expected to be used" +
- "<streetIndex> and <statusIndex> were expected but found " +itr.next());
- }
+ q = CacheUtils.getQueryService().newQuery(queries[i]);
+ CacheUtils.getLogger().info("Executing query: " + queries[i]);
+ QueryObserverImpl observer = new QueryObserverImpl();
+ QueryObserverHolder.setInstance(observer);
+ r [i][1]= q.execute();
+ if(!observer.isIndexesUsed){
+ fail("Index is NOT uesd");
+ }
+ int indxs = observer.indexesUsed.size();
+ CacheUtils.log("*******************Indexes Used::: "+indxs+" IndexName::"+observer.IndexName);
+
+ Iterator itr = observer.indexesUsed.iterator();
+ String temp;
+
+ while(itr.hasNext()){
+ temp = itr.next().toString();
+
+ if(temp.equals("streetIndex")){
+ break;
+ }else if(temp.equals("statusIndex")){
+ break;
+ }else{
+ fail("indices used do not match with those which are expected to be used" +
+ "<streetIndex> and <statusIndex> were expected but found " +itr.next());
}
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(q.getQueryString());
}
-
}
//Verifying the query results
StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
ssORrs.CompareQueryResultsWithoutAndWithIndexes(r,queries.length,queries);
} //end of test7
- class QueryObserverImpl extends QueryObserverAdapter{
+ private static class QueryObserverImpl extends QueryObserverAdapter {
+
boolean isIndexesUsed = false;
ArrayList indexesUsed = new ArrayList();
String IndexName;
+
+ @Override
public void beforeIndexLookup(Index index, int oper, Object key) {
IndexName = index.getName();
indexesUsed.add(index.getName());
}
+ @Override
public void afterIndexLookup(Collection results) {
if(results != null){
isIndexesUsed = true;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7e9d4a62/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
index 3a2d9da..8f02f63 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
@@ -16,14 +16,10 @@
*/
package com.gemstone.gemfire.cache.query.functional;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.File;
-import junit.framework.Assert;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -49,25 +45,21 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-/**
-*
-*/
@Category(IntegrationTest.class)
-public class IndexCreationDeadLockJUnitTest
-{
- protected boolean testFailed = false;
+public class IndexCreationDeadLockJUnitTest {
+
+ private static final String indexName = "queryTest";
- protected String cause = "";
+ private boolean testFailed = false;
- boolean exceptionInCreatingIndex = false;
+ private String cause = "";
- Region region;
+ private boolean exceptionInCreatingIndex = false;
- final String indexName = "queryTest";
+ private Region region;
@Before
- public void setUp() throws java.lang.Exception
- {
+ public void setUp() throws Exception {
CacheUtils.startCache();
this.testFailed = false;
this.cause = "";
@@ -83,25 +75,21 @@ public class IndexCreationDeadLockJUnitTest
}
@After
- public void tearDown() throws java.lang.Exception
- {
- try{
- this.region.localDestroyRegion();
- }catch(RegionDestroyedException rde) {
- //Ignore
- }
+ public void tearDown() throws Exception {
+ try{
+ this.region.localDestroyRegion();
+ }catch(RegionDestroyedException rde) {
+ //Ignore
+ }
CacheUtils.closeCache();
}
/**
* Tests Index creation and maintenance deadlock scenario for in memory region
- *
*/
@Test
- public void testIndexCreationDeadLock() throws Exception
- {
-
+ public void testIndexCreationDeadLock() throws Exception {
simulateDeadlockScenario();
assertFalse(this.cause, this.testFailed);
assertFalse("Index creation failed", this.exceptionInCreatingIndex);
@@ -111,8 +99,7 @@ public class IndexCreationDeadLockJUnitTest
* Tests Index creation and maintenance deadlock scenario for Persistent only disk region
*/
@Test
- public void testIndexCreationDeadLockForDiskOnlyRegion()
- {
+ public void testIndexCreationDeadLockForDiskOnlyRegion() {
this.region.destroyRegion();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -132,14 +119,11 @@ public class IndexCreationDeadLockJUnitTest
assertFalse("Index creation failed", this.exceptionInCreatingIndex);
}
-
/**
* Tests Index creation and maintenance deadlock scenario for a region with stats enabled
- *
*/
@Test
- public void testIndexCreationDeadLockForStatsEnabledRegion()
- {
+ public void testIndexCreationDeadLockForStatsEnabledRegion() {
this.region.destroyRegion();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -157,8 +141,7 @@ public class IndexCreationDeadLockJUnitTest
* Tests inability to create index on a region which overflows to disk *
*/
@Test
- public void testIndexCreationDeadLockForOverflowToDiskRegion()
- {
+ public void testIndexCreationDeadLockForOverflowToDiskRegion() {
this.region.destroyRegion();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -181,7 +164,6 @@ public class IndexCreationDeadLockJUnitTest
}
private void simulateDeadlockScenario() {
-
Thread th = new IndexCreationDeadLockJUnitTest.PutThread("put thread");
th.start();
ThreadUtils.join(th, 60 * 1000);
@@ -190,8 +172,7 @@ public class IndexCreationDeadLockJUnitTest
/**
* following thread will perform the operations of data population and index creation.
*/
- public class HelperThread extends Thread
- {
+ private class HelperThread extends Thread {
public HelperThread(String thName) {
super(thName);
@@ -201,8 +182,8 @@ public class IndexCreationDeadLockJUnitTest
+ thName);
}
- public void run()
- {
+ @Override
+ public void run() {
try {
System.out
@@ -227,19 +208,17 @@ public class IndexCreationDeadLockJUnitTest
/**
* thread to put the entries in region
*/
- public class PutThread extends Thread
- {
+ private class PutThread extends Thread {
public PutThread(String thName) {
super(thName);
System.out
.println("--------------------- Thread started ------------------------- "
+ thName);
-
}
- public void run()
- {
+ @Override
+ public void run() {
try {
System.out
.println("--------------------- Populating Data -------------------------");
@@ -275,12 +254,12 @@ public class IndexCreationDeadLockJUnitTest
/**
* make the update to wait for a while before updatation to simulate the deadlock condiction
*/
- public class BeforeUpdateCallBack extends CacheWriterAdapter
- {
+ private class BeforeUpdateCallBack extends CacheWriterAdapter {
+
int cnt = 0;
- public void beforeCreate(EntryEvent event) throws CacheWriterException
- {
+ @Override
+ public void beforeCreate(EntryEvent event) throws CacheWriterException {
cnt++;
if (cnt == 10) {
System.out