This is an automated email from the ASF dual-hosted git repository.
nnag pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new eb8e1d2 GEODE-4467: Removed instances of singleton usage
eb8e1d2 is described below
commit eb8e1d233c277955c2c0c66643d24698e3063ca8
Author: nabarun <[email protected]>
AuthorDate: Mon Feb 12 16:51:57 2018 -0800
GEODE-4467: Removed instances of singleton usage
* Removed CacheFactory.getAnyInstance() from PRQueryDUnitHelper and
PRColocatedEquiJoinDUnitTest
* Removed GemFireCacheImpl.getInstance() from
PRBasicIndexCreationDeadlockDUnitTest
---
.../PRBasicIndexCreationDeadlockDUnitTest.java | 19 +++++++------------
.../partitioned/PRColocatedEquiJoinDUnitTest.java | 13 ++++++-------
.../cache/query/partitioned/PRQueryDUnitHelper.java | 9 +++++----
3 files changed, 18 insertions(+), 23 deletions(-)
diff --git
a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
index d8b08d9..32c2b71 100644
---
a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRBasicIndexCreationDeadlockDUnitTest.java
@@ -15,10 +15,10 @@
package org.apache.geode.cache.query.partitioned;
import static org.apache.geode.cache.query.Utils.createPortfoliosAndPositions;
-import static org.junit.Assert.*;
import java.io.File;
+import org.apache.logging.log4j.Logger;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -30,13 +30,12 @@ import
org.apache.geode.cache.query.internal.index.IndexUtils;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegionDUnitTestCase;
+import org.apache.geode.internal.logging.LogService;
import org.apache.geode.test.dunit.AsyncInvocation;
import org.apache.geode.test.dunit.Host;
import org.apache.geode.test.dunit.ThreadUtils;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.Wait;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
/**
@@ -46,12 +45,6 @@ import
org.apache.geode.test.junit.categories.DistributedTest;
public class PRBasicIndexCreationDeadlockDUnitTest extends
PartitionedRegionDUnitTestCase
{
- /**
- * constructor
- *
- * @param name
- */
-
public PRBasicIndexCreationDeadlockDUnitTest() {
super();
}
@@ -69,6 +62,8 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
PartitionedRegionDUni
}
}
+ private static final Logger logger = LogService.getLogger();
+
PRQueryDUnitHelper PRQHelp = new PRQueryDUnitHelper();
final String name = "PartionedPortfolios";
@@ -121,7 +116,7 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
PartitionedRegionDUni
@Override
public void run2() throws CacheException {
- GemFireCacheImpl.getInstance().close();
+ PRQueryDUnitHelper.getCache().close();
}
});
@@ -129,7 +124,7 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
PartitionedRegionDUni
@Override
public void run2() throws CacheException {
- GemFireCacheImpl.getInstance().close();
+ PRQueryDUnitHelper.getCache().close();
}
});
@@ -228,7 +223,7 @@ public class PRBasicIndexCreationDeadlockDUnitTest extends
PartitionedRegionDUni
@Override
public synchronized void hook(int spot) throws RuntimeException {
- GemFireCacheImpl.getInstance().getLogger().fine("IndexUtilTestHook is
set");
+ logger.debug("IndexUtilTestHook is set");
switch (spot) {
case 0:
hooked = true;
diff --git
a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
index a77e17a..93f6332 100644
---
a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
@@ -17,8 +17,11 @@
*/
package org.apache.geode.cache.query.partitioned;
-import static org.apache.geode.cache.query.Utils.*;
-import static org.junit.Assert.*;
+import static
org.apache.geode.cache.query.Utils.createNewPortfoliosAndPositions;
+import static org.apache.geode.cache.query.Utils.createPortfoliosAndPositions;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.DataInput;
import java.io.DataOutput;
@@ -36,7 +39,6 @@ import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheException;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.PartitionAttributes;
import org.apache.geode.cache.PartitionAttributesFactory;
import org.apache.geode.cache.Region;
@@ -54,7 +56,6 @@ import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.RegionNotFoundException;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.data.Portfolio;
-import
org.apache.geode.cache.query.partitioned.PRQueryDUnitHelper.TestQueryFunction;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.distributed.ConfigurationProperties;
import org.apache.geode.distributed.internal.ReplyException;
@@ -67,8 +68,6 @@ import org.apache.geode.test.dunit.IgnoredException;
import org.apache.geode.test.dunit.LogWriterUtils;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.Wait;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
import org.apache.geode.test.junit.categories.FlakyTest;
@@ -1575,7 +1574,7 @@ public class PRColocatedEquiJoinDUnitTest extends
PartitionedRegionDUnitTestCase
@Override
public void execute(FunctionContext context) {
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
QueryService queryService = cache.getQueryService();
ArrayList allQueryResults = new ArrayList();
String qstr = (String) context.getArguments();
diff --git
a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
index 6daefcd..6391a32 100755
---
a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
+++
b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
@@ -14,7 +14,10 @@
*/
package org.apache.geode.cache.query.partitioned;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.Serializable;
@@ -35,7 +38,6 @@ import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheException;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.EntryExistsException;
@@ -2446,9 +2448,8 @@ public class PRQueryDUnitHelper implements Serializable {
@Override
public void execute(FunctionContext context) {
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
QueryService queryService = cache.getQueryService();
- ArrayList allQueryResults = new ArrayList();
String qstr = (String) context.getArguments();
try {
Query query = queryService.newQuery(qstr);
--
To stop receiving notification emails like this one, please contact
[email protected].