You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/09 20:15:16 UTC
[48/70] [abbrv] [partial] incubator-geode git commit: GEODE-837:
update tests from JUnit3 to JUnit4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
index dfde1a6..fdd5b50 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
@@ -16,31 +16,48 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
-import com.gemstone.gemfire.cache.query.*;
+import com.gemstone.gemfire.cache.query.CqAttributes;
+import com.gemstone.gemfire.cache.query.CqAttributesFactory;
+import com.gemstone.gemfire.cache.query.CqEvent;
+import com.gemstone.gemfire.cache.query.CqException;
+import com.gemstone.gemfire.cache.query.CqExistsException;
+import com.gemstone.gemfire.cache.query.CqListener;
+import com.gemstone.gemfire.cache.query.IndexExistsException;
+import com.gemstone.gemfire.cache.query.IndexNameConflictException;
+import com.gemstone.gemfire.cache.query.QueryTestUtils;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
import com.gemstone.gemfire.cache.query.internal.index.CompactRangeIndex;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Iterator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-public class HelperTestCase extends CacheTestCase {
+@Category(DistributedTest.class)
+public class HelperTestCase extends JUnit4CacheTestCase {
- public HelperTestCase(String name) {
- super(name);
- }
-
protected void createPartitionRegion(VM vm, final String regionName, final Class valueConstraint) {
vm.invoke(new SerializableCallable() {
public Object call() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByDUnitImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByDUnitImpl.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByDUnitImpl.java
index 05f3ba1..0dbe297 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByDUnitImpl.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByDUnitImpl.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.query.Index;
import com.gemstone.gemfire.cache.query.IndexExistsException;
@@ -28,14 +37,15 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
-public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
+public abstract class NonDistinctOrderByDUnitImpl extends JUnit4CacheTestCase {
- public NonDistinctOrderByDUnitImpl(String name) {
- super(name);
+ public NonDistinctOrderByDUnitImpl() {
+ super();
}
protected abstract NonDistinctOrderByTestImplementation createTestInstance();
+ @Test
public void testOrderByWithIndexResultDefaultProjection() throws Exception {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
@@ -48,6 +58,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testOrderByWithIndexResultWithProjection() throws Exception {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
@@ -60,6 +71,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testMultiColOrderByWithIndexResultDefaultProjection()
throws Exception {
Host host = Host.getHost(0);
@@ -73,6 +85,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testMultiColOrderByWithIndexResultWithProjection()
throws Exception {
Host host = Host.getHost(0);
@@ -86,6 +99,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testMultiColOrderByWithMultiIndexResultDefaultProjection()
throws Exception {
Host host = Host.getHost(0);
@@ -99,6 +113,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testMultiColOrderByWithMultiIndexResultProjection()
throws Exception {
Host host = Host.getHost(0);
@@ -112,6 +127,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testLimitNotAppliedIfOrderByNotUsingIndex() throws Exception {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
@@ -124,6 +140,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testOrderByWithNullValues() throws Exception {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
@@ -136,6 +153,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testOrderByWithNullValuesUseIndex() throws Exception {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
@@ -148,6 +166,7 @@ public abstract class NonDistinctOrderByDUnitImpl extends CacheTestCase {
this.closeCache(vm0, vm1, vm2, vm3);
}
+ @Test
public void testOrderByForUndefined() throws Exception {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByPartitionedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByPartitionedDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByPartitionedDUnitTest.java
index 619a29b..f448db6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByPartitionedDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/NonDistinctOrderByPartitionedDUnitTest.java
@@ -17,6 +17,15 @@
package com.gemstone.gemfire.cache.query.dunit;
import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
@@ -43,8 +52,8 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
public class NonDistinctOrderByPartitionedDUnitTest extends
NonDistinctOrderByDUnitImpl {
- public NonDistinctOrderByPartitionedDUnitTest(String name) {
- super(name);
+ public NonDistinctOrderByPartitionedDUnitTest() {
+ super();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
index 6421439..e1d698a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
@@ -16,16 +16,8 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
-import com.gemstone.gemfire.cache.query.Query;
-import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.QueryTestUtils;
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache.query.data.Portfolio;
-import com.gemstone.gemfire.test.dunit.*;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.io.File;
import java.util.HashMap;
@@ -33,14 +25,25 @@ import java.util.Map;
import java.util.Properties;
import java.util.stream.IntStream;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
-@Category(DistributedTest.class)
-public class PartitionedRegionCompactRangeIndexDUnitTest extends DistributedTestCase {
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.QueryTestUtils;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.data.Portfolio;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.util.test.TestUtil;
- public PartitionedRegionCompactRangeIndexDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class PartitionedRegionCompactRangeIndexDUnitTest extends JUnit4DistributedTestCase {
private Properties getSystemProperties(String cacheXML) {
Properties props = new Properties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
index 0498a79..5124d85 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
@@ -16,13 +16,17 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
import java.util.Set;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -54,30 +58,27 @@ import com.gemstone.gemfire.cache.query.internal.index.RangeIndex;
import com.gemstone.gemfire.cache.query.types.CollectionType;
import com.gemstone.gemfire.cache.query.types.ObjectType;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.persistence.query.CloseableIterator;
import com.gemstone.gemfire.pdx.internal.PdxString;
import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-public class PdxStringQueryDUnitTest extends CacheTestCase{
- private static int bridgeServerPort;
+@Category(DistributedTest.class)
+public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
- public PdxStringQueryDUnitTest(String name) {
- super(name);
- }
+ private static int bridgeServerPort;
private final String rootRegionName = "root";
private final String regionName = "PdxTest";
@@ -117,6 +118,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
"SELECT distinct pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE p.ID > 1 order by pos.secIdIndexed limit 5",//12
};
+ @Test
public void testReplicatedRegionNoIndex() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -375,6 +377,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
this.closeClient(server0);
}
+ @Test
public void testRepliacatedRegionCompactRangeIndex() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -589,6 +592,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
this.closeClient(server0);
}
+ @Test
public void testReplicatedRegionRangeIndex() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -793,6 +797,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
this.closeClient(server0);
}
+ @Test
public void testPartitionRegionNoIndex() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1058,6 +1063,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
this.closeClient(server0);
}
+ @Test
public void testPartitionRegionCompactRangeIndex() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1285,6 +1291,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
this.closeClient(server0);
}
+ @Test
public void testPartitionRegionRangeIndex() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1512,6 +1519,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
this.closeClient(server0);
}
+ @Test
public void testNullPdxString() throws CacheException {
final Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1794,6 +1802,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
*
* @throws CacheException
*/
+ @Test
public void testPRQueryForDuplicates() throws CacheException {
final String regionName = "exampleRegion";
final Host host = Host.getHost(0);
@@ -1878,7 +1887,7 @@ public class PdxStringQueryDUnitTest extends CacheTestCase{
}
});
- Invoke.invokeInEveryVM(DistributedTestCase.class, "disconnectFromDS");
+ disconnectAllFromDS();
}
protected void configAndStartBridgeServer(boolean isPr, boolean isAccessor, boolean asyncIndex) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryAuthorization.java
index c4b3240..fca163e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryAuthorization.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryAuthorization.java
@@ -16,9 +16,9 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
-import java.security.Principal;
+import static org.junit.Assert.*;
-import junit.framework.TestCase;
+import java.security.Principal;
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.Cache;
@@ -32,9 +32,12 @@ import com.gemstone.gemfire.security.NotAuthorizedException;
* Test authorization class for testing the accessibility of query bind
* parameters from QueryOperationContext
*
- *
+ * Used by test:
+ *
+ * <li/>QueryParamsAuthorizationDUnitTest (via reflection)
*/
-public class QueryAuthorization extends TestCase implements AccessControl {
+public class QueryAuthorization implements AccessControl {
+
private DistributedMember remoteDistributedMember;
private LogWriter logger;
@@ -48,8 +51,7 @@ public class QueryAuthorization extends TestCase implements AccessControl {
}
@Override
- public void init(Principal principal, DistributedMember remoteMember,
- Cache cache) throws NotAuthorizedException {
+ public void init(Principal principal, DistributedMember remoteMember, Cache cache) throws NotAuthorizedException {
this.remoteDistributedMember = remoteMember;
this.logger = cache.getSecurityLogger();
}
@@ -60,10 +62,8 @@ public class QueryAuthorization extends TestCase implements AccessControl {
if (context instanceof QueryOperationContext) {
Object[] params = ((QueryOperationContext) context).getQueryParams();
assertTrue(" Bind parameters should not be null", params != null);
- assertEquals(" 2 bind parameters should have been received.", 2,
- params.length);
+ assertEquals(" 2 bind parameters should have been received.", 2, params.length);
}
return true;
}
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
index 475ad49..5513585 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.Properties;
import org.junit.experimental.categories.Category;
@@ -57,7 +66,8 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
* This tests the data inconsistency during update on an index and querying the
* same UNLOCKED index.
*/
-public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
private static final int cnt = 0;
@@ -88,8 +98,8 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public QueryDataInconsistencyDUnitTest(String name) {
- super(name);
+ public QueryDataInconsistencyDUnitTest() {
+ super();
}
@Override
@@ -104,6 +114,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
server = host.getVM(0);
}
+ @Test
public void testCompactRangeIndex() {
// Create caches
Properties props = new Properties();
@@ -199,6 +210,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
ThreadUtils.join(putThread, 200);
}
+ @Test
public void testRangeIndex() {
// Create caches
Properties props = new Properties();
@@ -294,6 +306,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-925: time sensitive, async actions, short timeouts
+ @Test
public void testRangeIndexWithIndexAndQueryFromCluaseMisMatch() { // TODO: fix misspelling
// Create caches
Properties props = new Properties();
@@ -384,6 +397,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
ThreadUtils.join(putThread, 200); // GEODE-925 occurs here and this is very short join 200 millis
}
+ @Test
public void testRangeIndexWithIndexAndQueryFromCluaseMisMatch2() {
// Create caches
Properties props = new Properties();
@@ -475,7 +489,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
public static void createProxyRegions() {
- new QueryDataInconsistencyDUnitTest("temp").createProxyRegs();
+ new QueryDataInconsistencyDUnitTest().createProxyRegs();
}
private void createProxyRegs() {
@@ -488,7 +502,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
public static void createNewPR() {
- new QueryDataInconsistencyDUnitTest("temp").createPR();
+ new QueryDataInconsistencyDUnitTest().createPR();
}
public void createPR() {
PartitionResolver testKeyBasedResolver = new QueryAPITestPartitionResolver();
@@ -504,7 +518,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
public static void createCacheClientWithoutRegion(String host, Integer port1) {
- new QueryDataInconsistencyDUnitTest("temp").createCacheClientWithoutReg(
+ new QueryDataInconsistencyDUnitTest().createCacheClientWithoutReg(
host, port1);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
index 16ff4cf..f6ced21 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
@@ -16,6 +16,18 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheExistsException;
@@ -32,23 +44,29 @@ import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.cache.query.internal.index.IndexManager;
import com.gemstone.gemfire.cache.query.internal.index.PartitionedIndex;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.FileUtil;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+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;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.util.test.TestUtil;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Properties;
-
-public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class QueryIndexUsingXMLDUnitTest extends JUnit4CacheTestCase {
static private final String WAIT_PROPERTY = "QueryIndexBuckets.maxWaitTime";
@@ -101,11 +119,6 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
private String persistentOverFlowRegName = "PersistentOverflowPortfolios";
- /** Creates a new instance of QueryIndexUsingXMLDUnitTest */
- public QueryIndexUsingXMLDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
//Workaround for #52008
@@ -123,6 +136,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
/**
* Creates partitioned index from an xml description.
*/
+ @Test
public void testCreateIndexThroughXML() throws Exception
{
@@ -190,6 +204,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
/**
* Creates partitioned index from an xml description.
*/
+ @Test
public void testCreateIndexWhileDoingGII() throws Exception
{
@@ -241,10 +256,10 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm1.invoke(close());
}
-
/**
* Creates partitioned index from an xml description.
*/
+ @Test
public void testReplicatedRegionCreateIndexWhileDoingGII() throws Exception
{
@@ -290,9 +305,11 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm0.invoke(close());
vm1.invoke(close());
}
+
/**
* Creates persistent partitioned index from an xml description.
*/
+ @Test
public void testPersistentPRRegionCreateIndexWhileDoingGII() throws Exception
{
@@ -322,7 +339,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm0.invoke(prIndexCreationCheck(persistentRegName, "secIndex", 50));
vm1.invoke(prIndexCreationCheck(persistentRegName, "secIndex", 50));
- //check hash index creation
+ //check hash index creation
vm0.invoke(prIndexCreationCheck(persistentRegNameWithHash, statusIndex, 50));
vm1.invoke(prIndexCreationCheck(persistentRegNameWithHash, statusIndex, 50));
vm0.invoke(prIndexCreationCheck(persistentRegNameWithHash, idIndex, 50));
@@ -354,10 +371,10 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm1.invoke(close());
}
-
/**
* Creates partitioned index from an xml description.
*/
+ @Test
public void testCreateIndexWhileDoingGIIWithEmptyPRRegion() throws Exception
{
@@ -393,8 +410,9 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
}
/**
- * Creats partitioned index from an xml discription.
+ * Creates partitioned index from an xml description.
*/
+ @Test
public void testCreateAsyncIndexWhileDoingGII() throws Exception
{
@@ -441,6 +459,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
/**
* Creates indexes and compares the results between index and non-index results.
*/
+ @Test
public void testCreateIndexWhileDoingGIIAndCompareQueryResults() throws Exception
{
@@ -489,9 +508,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm1.invoke(indexCreationCheck(repRegName, "secIndex"));
vm1.invoke(prIndexCreationCheck(persistentRegNameWithHash, "secIndex", 50));
vm1.invoke(indexCreationCheck(repRegNameWithHash, "secIndex"));
-
-
-
+
// Execute query and verify index usage
vm0.invoke(executeQueryAndCompareResult(name, true));
vm1.invoke(executeQueryAndCompareResult(name, true));
@@ -504,6 +521,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
/**
* Creates async partitioned index from an xml description.
*/
+ @Test
public void testCreateAsyncIndexWhileDoingGIIAndQuery() throws Exception
{
@@ -554,7 +572,9 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
* <p>
* DISABLED. This test is disabled due to a high rate of failure. See ticket #52167
*/
- public void disabled_testCreateAsyncIndexWhileDoingGIIAndCompareQueryResults() throws Exception
+ @Ignore("TODO: test is disabled because of #52167")
+ @Test
+ public void testCreateAsyncIndexWhileDoingGIIAndCompareQueryResults() throws Exception
{
Host host = Host.getHost(0);
@@ -598,6 +618,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm1.invoke(close());
}
+ @Test
public void testIndexCreationForReplicatedPersistentOverFlowRegionOnRestart() throws Exception
{
Host host = Host.getHost(0);
@@ -623,8 +644,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm0.invoke(close());
}
-
-
+
public CacheSerializableRunnable setTestHook()
{
SerializableRunnable sr = new CacheSerializableRunnable("TestHook") {
@@ -641,13 +661,6 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
}
}
};
- /*
- try {
- ClassLoader.getSystemClassLoader().loadClass(IndexManager.class.getName());
- } catch (Exception ex) {
- fail("Failed to load IndexManager.class");
- }
- */
IndexManager.testHook = new IndexTestHook();
}
};
@@ -665,6 +678,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
};
return (CacheSerializableRunnable)sr;
}
+
public CacheSerializableRunnable createIndexThrougXML(final String vmid,
final String regionName, final String xmlFileName)
{
@@ -917,8 +931,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
}
return basicGetSystem();
}
-
-
+
private Cache getCache(InternalDistributedSystem system) {
Cache cache = basicGetCache();
if (cache == null) {
@@ -941,13 +954,16 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
}
public static class QueryObserverImpl extends QueryObserverAdapter {
+
boolean isIndexesUsed = false;
ArrayList indexesUsed = new ArrayList();
+ @Override
public void beforeIndexLookup(Index index, int oper, Object key) {
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/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
index 26cfc05..674eca4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Region;
@@ -44,14 +53,16 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
*
*
*/
-public class QueryParamsAuthorizationDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class QueryParamsAuthorizationDUnitTest extends JUnit4CacheTestCase {
private final String regName = "exampleRegion";
- public QueryParamsAuthorizationDUnitTest(String name) {
- super(name);
+ public QueryParamsAuthorizationDUnitTest() {
+ super();
}
+ @Test
public void testNothing() {
// remove when Bug #51079 is fixed
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
index 1d60010..2505bbc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import static com.gemstone.gemfire.cache.query.Utils.createPortfoliosAndPositions;
import java.util.ArrayList;
@@ -74,7 +83,8 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
* (routing keys) to run the query on subset of buckets "locally". If query
* includes buckets
*/
-public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class QueryUsingFunctionContextDUnitTest extends JUnit4CacheTestCase {
private static final int cnt = 0;
@@ -130,8 +140,8 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public QueryUsingFunctionContextDUnitTest(String name) {
- super(name);
+ public QueryUsingFunctionContextDUnitTest() {
+ super();
}
@Override
@@ -161,6 +171,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
/**
* Test on Replicated Region.
*/
+ @Test
public void testQueriesWithFilterKeysOnReplicatedRegion() {
IgnoredException.addIgnoredException("IllegalArgumentException");
@@ -197,6 +208,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
/**
* Test on PR on one server only using filter.
*/
+ @Test
public void testQueriesWithFilterKeysOnPRLocal() {
client.invoke(new CacheSerializableRunnable("Test query on client and server") {
@@ -211,7 +223,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
TestServerQueryFunction func = new TestServerQueryFunction("LDS Server function-1");
function = new TestQueryFunction("queryFunction-1");
- QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest("test");
+ QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
ArrayList queryResults2 = test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, queries[i]);
if (queryResults2 == null)
fail(queries[i] +"result is null from client function");
@@ -230,6 +242,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
+ @Test
public void testInvalidQueries() {
IgnoredException.addIgnoredException("Syntax error");
@@ -242,7 +255,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
String query = "select * from / " + repRegionName + " where ID>=0";
TestServerQueryFunction func = new TestServerQueryFunction("LDS Server function-1");
function = new TestQueryFunction("queryFunction-1");
- QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest("test");
+ QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
try {
test.runQueryOnClientUsingFunc(function, repRegionName, filter, query);
fail("Query execution should have failed.");
@@ -253,7 +266,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
query = "select * from / " + PartitionedRegionName1 + " where ID>=0";
func = new TestServerQueryFunction("LDS Server function-1");
function = new TestQueryFunction("queryFunction-1");
- test = new QueryUsingFunctionContextDUnitTest("test");
+ test = new QueryUsingFunctionContextDUnitTest();
try {
test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, query);
fail("Query execution should have failed.");
@@ -268,6 +281,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
/**
*
*/
+ @Test
public void testQueriesWithFilterKeysOnPRLocalAndRemote() {
client.invoke(new CacheSerializableRunnable("Test query on client and server") {
@@ -282,7 +296,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
for (int i=0; i< queries.length; i++) {
Object[][] r = new Object[1][2];
- QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest("test");
+ QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
ArrayList queryResults2 = test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, queries[i]);
if (queryResults2 == null)
fail(queries[i] +"result is null from client function");
@@ -303,7 +317,8 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
/**
*
*/
- public void testQueriesWithFilterKeysOnPRLocalAndRemoteWithBucketDestroy() {
+ @Test
+ public void testQueriesWithFilterKeysOnPRLocalAndRemoteWithBucketDestroy() {
// Set Query Observer in cache on server1
server1.invoke(new CacheSerializableRunnable("Set QueryObserver in cache on server1") {
@@ -342,7 +357,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
for (int i=0; i< queries.length; i++) {
- QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest("test");
+ QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
ArrayList queryResults2 = test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, queries[i]);
// The Partition Region has 20 buckets with 100 values and key i goes in bucket j=(i%20)
@@ -366,6 +381,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
/**
*
*/
+ @Test
public void testQueriesWithFilterKeysOnPRWithBucketDestroy() {
IgnoredException.addIgnoredException("QueryInvocationTargetException");
Object[][] r = new Object[queries.length][2];
@@ -436,6 +452,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-575: ignores lots of exceptions, non-thread-safe test hooks
+ @Test
public void testQueriesWithFilterKeysOnPRWithRebalancing() {
IgnoredException.addIgnoredException("QueryInvocationTargetException");
IgnoredException.addIgnoredException("java.net.SocketException");
@@ -515,7 +532,8 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
- public void testNonColocatedRegionQueries() {
+ @Test
+ public void testNonColocatedRegionQueries() {
IgnoredException.addIgnoredException("UnsupportedOperationException");
client.invoke(new CacheSerializableRunnable("Test query on non-colocated regions on server") {
@Override
@@ -525,7 +543,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
for (int i=0; i< nonColocatedQueries.length; i++) {
function = new TestQueryFunction("queryFunction-1");
- QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest("test");
+ QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
try {
ArrayList queryResults2 = test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, nonColocatedQueries[i]);
fail("Function call did not fail for query with function context");
@@ -540,7 +558,8 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
- public void testJoinQueryPRWithMultipleIndexes(){
+ @Test
+ public void testJoinQueryPRWithMultipleIndexes(){
server1.invoke(new CacheSerializableRunnable("Test query with indexes") {
@@ -549,7 +568,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
Set filter = getFilter(0, 1);
function = new TestQueryFunction("queryFunction-2");
Object[][] r = new Object[2][2];
- QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest("test");
+ QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
int j = 0;
for (int i=3; i< 5; i++) {
ArrayList queryResults2 = test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, queries[i]);
@@ -744,7 +763,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
public static void createProxyRegions() {
- new QueryUsingFunctionContextDUnitTest("temp").createProxyRegs();
+ new QueryUsingFunctionContextDUnitTest().createProxyRegs();
}
private void createProxyRegs() {
@@ -766,7 +785,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
public static void createLocalRegion() {
- new QueryUsingFunctionContextDUnitTest("temp").createLocalReg();
+ new QueryUsingFunctionContextDUnitTest().createLocalReg();
}
public void createLocalReg() {
cache = CacheFactory.getAnyInstance();
@@ -774,7 +793,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
public static void createReplicatedRegion() {
- new QueryUsingFunctionContextDUnitTest("temp").createRR();
+ new QueryUsingFunctionContextDUnitTest().createRR();
}
public void createRR() {
cache = CacheFactory.getAnyInstance();
@@ -782,7 +801,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
public static void createColocatedPR() {
- new QueryUsingFunctionContextDUnitTest("temp").createColoPR();
+ new QueryUsingFunctionContextDUnitTest().createColoPR();
}
public void createColoPR() {
PartitionResolver testKeyBasedResolver = new QueryAPITestPartitionResolver();
@@ -837,7 +856,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
}
public static void createCacheClientWithoutRegion(String host, Integer port1, Integer port2, Integer port3) {
- new QueryUsingFunctionContextDUnitTest("temp").createCacheClientWithoutReg(host, port1, port2, port3);
+ new QueryUsingFunctionContextDUnitTest().createCacheClientWithoutReg(host, port1, port2, port3);
}
private void createCacheClientWithoutReg(String host, Integer port1, Integer port2, Integer port3) {
this.disconnectFromDS();
@@ -853,7 +872,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
* received from client function execution.
*/
public static ArrayList runQueryOnServerLocalDataSet(String query, Set filter) {
- return new QueryUsingFunctionContextDUnitTest("temp").runQueryOnServerLDS(query, filter);
+ return new QueryUsingFunctionContextDUnitTest().runQueryOnServerLDS(query, filter);
}
protected ArrayList runQueryOnServerLDS(String queryStr, Set filter) {
@@ -880,7 +899,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
* Run query on server to compare the results received from client function execution.
*/
public static ArrayList runQueryOnServerRegion(String query) {
- return new QueryUsingFunctionContextDUnitTest("temp").runQueryOnServerReg(query);
+ return new QueryUsingFunctionContextDUnitTest().runQueryOnServerReg(query);
}
protected ArrayList runQueryOnServerReg(String queryStr) {
@@ -904,7 +923,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
* @return ArrayList of results
*/
public static ArrayList runQueryOnClientUsingFunction(Function function, String regionName, Set filter, String query) {
- return new QueryUsingFunctionContextDUnitTest("temp").runQueryOnClientUsingFunc(function, regionName, filter, query);
+ return new QueryUsingFunctionContextDUnitTest().runQueryOnClientUsingFunc(function, regionName, filter, query);
}
private ArrayList runQueryOnClientUsingFunc(Function func, String regionName, Set filter, String query) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
index 7774920..cf73b81 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
@@ -16,36 +16,57 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import static org.junit.Assert.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import org.apache.logging.log4j.Logger;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.query.*;
+import com.gemstone.gemfire.cache.query.IndexType;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.Struct;
import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.cache.query.types.ObjectType;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.jayway.awaitility.Awaitility;
-import org.junit.experimental.categories.Category;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
@@ -54,40 +75,37 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
*
* @since GemFire 5.0.1
*/
-public class QueryUsingPoolDUnitTest extends CacheTestCase {
-
+@Category(DistributedTest.class)
+public class QueryUsingPoolDUnitTest extends JUnit4CacheTestCase {
+ private static final Logger logger = LogService.getLogger();
+
/**
* The port on which the bridge server was started in this VM
*/
private static int bridgeServerPort;
- final String rootRegionName = "root";
-
- private final String regionName = this.getName();
-
- private final String regName = "/" + rootRegionName + "/" + regionName;
+ private String rootRegionName;
+ private String regionName;
+ private String regName;
// Used with compiled queries.
- private final String[] queryString = new String[] {
- "SELECT itr.value FROM " + regName + ".entries itr where itr.key = $1", // 0
- "SELECT DISTINCT * FROM " + regName + " WHERE id < $1 ORDER BY id", // 1
- "SELECT DISTINCT * FROM " + regName + " WHERE id < $1 ORDER BY id", // 2
- "(SELECT DISTINCT * FROM " + regName + " WHERE id < $1).size", // 3
- "SELECT * FROM " + regName + " WHERE id = $1 and Ticker = $2", // 4
- "SELECT * FROM " + regName + " WHERE id < $1 and Ticker = $2", // 5
- };
-
- /**
- * Creates a new <code>GemFireMemberStatusDUnitTest</code>
- */
- public QueryUsingPoolDUnitTest(String name) {
- super(name);
- }
-
- //////// Test Methods
+ private String[] queryString;
@Override
public final void postSetUp() throws Exception {
+ this.rootRegionName = "root";
+ this.regionName = this.getName();
+ this.regName = "/" + this.rootRegionName + "/" + this.regionName;
+
+ this.queryString = new String[] {
+ "SELECT itr.value FROM " + this.regName + ".entries itr where itr.key = $1", // 0
+ "SELECT DISTINCT * FROM " + this.regName + " WHERE id < $1 ORDER BY id", // 1
+ "SELECT DISTINCT * FROM " + this.regName + " WHERE id < $1 ORDER BY id", // 2
+ "(SELECT DISTINCT * FROM " + this.regName + " WHERE id < $1).size", // 3
+ "SELECT * FROM " + this.regName + " WHERE id = $1 and Ticker = $2", // 4
+ "SELECT * FROM " + this.regName + " WHERE id < $1 and Ticker = $2", // 5
+ };
+
disconnectAllFromDS();
IgnoredException.addIgnoredException("Connection reset");
IgnoredException.addIgnoredException("Socket input is shutdown");
@@ -114,7 +132,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
PoolFactory poolFactory = PoolManager.createFactory();
poolFactory.setSubscriptionEnabled(subscriptionEnabled);
for (int i = 0; i < servers.length; i++) {
- LogService.getLogger().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
+ logger.info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
poolFactory.addServer(servers[i], ports[i]);
}
poolFactory.setMinConnections(1);
@@ -132,6 +150,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests remote import query execution.
*/
+ @Test
public void testRemoteImportQueries() throws CacheException {
final String name = this.getName();
@@ -250,6 +269,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests remote struct query execution.
*/
+ @Test
public void testRemoteStructQueries() throws CacheException {
final String name = this.getName();
@@ -372,6 +392,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests remote full region query execution.
*/
+ @Test
public void testRemoteFullRegionQueries() throws CacheException {
final String name = this.getName();
@@ -541,6 +562,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests client-server query using parameters (compiled queries).
*/
+ @Test
public void testClientServerQueriesWithParams() throws CacheException {
final Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -565,6 +587,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
50, // 5
};
+ assertNotNull(this.regionName);//KIRK
+
// Start server
final int port = vm0.invoke("Create Bridge Server", () -> {
setupBridgeServerAndCreateData(regionName, numberOfEntries);
@@ -632,7 +656,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
private void executeQueriesForClientServerQueriesWithParams(SelectResults results, QueryService qService, Object[][] params, int[] expectedResults) {
for (int i = 0; i < queryString.length; i++) {
try {
- LogService.getLogger().info("### Executing Query :" + queryString[i]);
+ logger.info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
results = (SelectResults) query.execute(params[i]);
} catch (Exception e) {
@@ -649,6 +673,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests client-server query using parameters (compiled queries).
*/
+ @Test
public void testMulitipleClientServerQueriesWithParams() throws CacheException {
final Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -764,6 +789,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests client-server compiled query register and cleanup.
*/
+ @Test
public void testClientServerCompiledQueryRegisterAndCleanup() throws CacheException {
final String name = this.getName();
@@ -822,6 +848,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests client-server compiled query register and cleanup.
*/
+ @Test
public void testClientServerCompiledQueryTimeBasedCleanup() throws CacheException {
final String name = this.getName();
@@ -905,6 +932,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
* It creates the client connections without the subscription
* enabled. This doesn't create any client proxy on the server.
*/
+ @Test
public void testClientServerCompiledQueryCleanup() throws CacheException {
final String name = this.getName();
@@ -998,6 +1026,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
* Tests client-server query using parameters (compiled queries).
*/
@Category(FlakyTest.class) // GEODE-1146: time senstiive, thread sleeps, uses zero port for servers (good!), async actions, AsyncInvocation orphans
+ @Test
public void testBindParamsWithMulitipleClients() throws CacheException {
final Host host = Host.getHost(0);
@@ -1055,7 +1084,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 2; i++) {
try {
- LogService.getLogger().info("### Executing Query :" + queryString[i]);
+ logger.info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
rs[0][0] = (SelectResults) query.execute(params[i]);
Query query2 = qService.newQuery(querys[i]);
@@ -1064,9 +1093,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
} catch (Exception e) {
Assert.fail("Failed executing " + queryString[i], e);
}
- LogService.getLogger().info("### Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
+ logger.info("### Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
compareQueryResultsWithoutAndWithIndexes(rs, 1);
- LogService.getLogger().info("### Done Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
+ logger.info("### Done Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
}
}
}
@@ -1090,7 +1119,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int j = 0; j < queryString.length; j++) {
for (int i = 0; i < queryString.length; i++) {
try {
- LogService.getLogger().info("### Executing Query :" + queryString[i]);
+ logger.info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
rs[0][0] = (SelectResults) query.execute(params[i]);
Query query2 = qService.newQuery(querys[i]);
@@ -1120,6 +1149,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests remote join query execution.
*/
+ @Test
public void testRemoteJoinRegionQueries() throws CacheException {
final String name = this.getName();
@@ -1204,6 +1234,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
* Tests remote query execution using a BridgeClient as the CacheWriter
* and CacheLoader.
*/
+ @Test
public void testRemoteBridgeClientQueries() throws CacheException {
final String name = this.getName();
@@ -1297,6 +1328,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
* @throws Exception
*/
+ @Test
public void testBug36969() throws Exception {
final String name = this.getName();
final String rootRegionName = "root";
@@ -1368,6 +1400,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/**
* Tests remote full region query execution.
*/
+ @Test
public void testRemoteSortQueriesUsingIndex() throws CacheException {
final String name = this.getName();
final String rootRegionName = "root";
@@ -1500,6 +1533,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke("Stop CacheServer", () -> stopBridgeServer(getCache()));
}
+ @Test
public void testUnSupportedOps() throws Exception {
final String name = this.getName();
final String rootRegionName = "root";
@@ -1635,15 +1669,15 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
type1 = ((SelectResults) r[j][0]).getCollectionType().getElementType();
type2 = ((SelectResults) r[j][1]).getCollectionType().getElementType();
if ((type1.getClass().getName()).equals(type2.getClass().getName())) {
- LogService.getLogger().info("Both SelectResults are of the same Type i.e.--> "
+ logger.info("Both SelectResults are of the same Type i.e.--> "
+ ((SelectResults) r[j][0]).getCollectionType().getElementType());
} else {
- LogService.getLogger().info("Classes are : " + type1.getClass().getName() + " "
+ logger.info("Classes are : " + type1.getClass().getName() + " "
+ type2.getClass().getName());
fail("FAILED:Select result Type is different in both the cases");
}
if (((SelectResults) r[j][0]).size() == ((SelectResults) r[j][1]).size()) {
- LogService.getLogger().info("Both SelectResults are of Same Size i.e. Size= "
+ logger.info("Both SelectResults are of Same Size i.e. Size= "
+ ((SelectResults) r[j][1]).size());
} else {
fail("FAILED:SelectResults size is different in both the cases. Size1="
@@ -1653,7 +1687,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
set2 = (((SelectResults) r[j][1]).asSet());
set1 = (((SelectResults) r[j][0]).asSet());
- LogService.getLogger().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
+ logger.info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
// boolean pass = true;
itert1 = set1.iterator();
@@ -1663,10 +1697,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
boolean exactMatch = false;
while (itert2.hasNext()) {
- LogService.getLogger().info("### Comparing results..");
+ logger.info("### Comparing results..");
Object p2 = itert2.next();
if (p1 instanceof Struct) {
- LogService.getLogger().info("ITS a Set");
+ logger.info("ITS a Set");
Object[] values1 = ((Struct) p1).getFieldValues();
Object[] values2 = ((Struct) p2).getFieldValues();
assertEquals(values1.length, values2.length);
@@ -1678,26 +1712,26 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
}
exactMatch = elementEqual;
} else {
- LogService.getLogger().info("Not a Set p2:" + p2 + " p1: " + p1);
+ logger.info("Not a Set p2:" + p2 + " p1: " + p1);
if (p2 instanceof TestObject) {
- LogService.getLogger().info("An instance of TestObject");
+ logger.info("An instance of TestObject");
exactMatch = p2.equals(p1);
} else {
- LogService.getLogger().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
+ logger.info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
exactMatch = p2.equals(p1);
}
}
if (exactMatch) {
- LogService.getLogger().info("Exact MATCH");
+ logger.info("Exact MATCH");
break;
}
}
if (!exactMatch) {
- LogService.getLogger().info("NOT A MATCH");
+ logger.info("NOT A MATCH");
fail("Atleast one element in the pair of SelectResults supposedly identical, is not equal ");
}
}
- LogService.getLogger().info("### Done Comparing results..");
+ logger.info("### Done Comparing results..");
}
}
@@ -1712,7 +1746,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int i = 0; i < queryString.length; i++) {
try {
- LogService.getLogger().info("### Executing Query :" + queryString[i]);
+ logger.info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
query.execute(params[i]);
} catch (Exception e) {
@@ -1749,11 +1783,11 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
/* Close Client */
public void closeClient() {
- LogService.getLogger().info("### Close Client. ###");
+ logger.info("### Close Client. ###");
try {
closeCache();
} catch (Exception ex) {
- LogService.getLogger().info("### Failed to get close client. ###");
+ logger.info("### Failed to get close client. ###");
}
// Wait.pause(2 * 1000);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
index 829f9ec..3866f40 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
@@ -16,11 +16,29 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Comparator;
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import cacheRunner.Portfolio;
import cacheRunner.Position;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.SelectResults;
@@ -30,38 +48,31 @@ import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.cache.query.internal.ResultsBag;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.experimental.categories.Category;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
/**
* Tests remote (client/server) query execution.
*
* @since GemFire 5.0.1
*/
-public class RemoteQueryDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class RemoteQueryDUnitTest extends JUnit4CacheTestCase {
/** The port on which the bridge server was started in this VM */
private static int bridgeServerPort;
- public RemoteQueryDUnitTest(String name) {
- super(name);
- }
-
- //////// Test Methods
-
@Override
public final void postSetUp() throws Exception {
disconnectAllFromDS();
@@ -75,6 +86,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
/**
* Tests remote predicate query execution.
*/
+ @Test
public void testRemotePredicateQueries() throws CacheException {
final String name = this.getName();
@@ -218,6 +230,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
/**
* Tests remote import query execution.
*/
+ @Test
public void testRemoteImportQueries() throws CacheException {
final String name = this.getName();
@@ -346,6 +359,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
/**
* Tests remote struct query execution.
*/
+ @Test
public void testRemoteStructQueries() throws CacheException {
final String name = this.getName();
@@ -472,7 +486,9 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
/**
* Tests remote complex query execution.
*/
- public void __testRemoteComplexQueries() throws CacheException {
+ @Ignore("TODO: test is disabled")
+ @Test
+ public void testRemoteComplexQueries() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@ -666,6 +682,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
/**
* Tests remote full region query execution.
*/
+ @Test
public void testRemoteFullRegionQueries() throws CacheException {
final String name = this.getName();
@@ -831,6 +848,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
/**
* Tests remote join query execution.
*/
+ @Test
public void testRemoteJoinRegionQueries() throws CacheException {
final String name = this.getName();
@@ -932,6 +950,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
* and CacheLoader.
*/
@Category(FlakyTest.class) // GEODE-490: random port
+ @Test
public void testRemoteBridgeClientQueries() throws CacheException {
final String name = this.getName();
@@ -1085,13 +1104,11 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
});
}
-
/**
* This the dunit test for the bug no : 36434
- * @throws Exception
*/
-
- public void testBug36434() throws Exception
+ @Test
+ public void testBug36434() throws Exception
{
final String name = this.getName();
final Host host = Host.getHost(0);
@@ -1185,17 +1202,13 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
stopBridgeServer(getCache());
}
});
-
-
-
}
/**
- * This the dunit test for the bug no : 36969
- * @throws Exception
- */
-
- public void testBug36969() throws Exception
+ * This the dunit test for the bug no : 36969
+ */
+ @Test
+ public void testBug36969() throws Exception
{
final String name = this.getName();
final Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
index 1ea2c3f..4a09351 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
@@ -16,9 +16,41 @@
*/
package com.gemstone.gemfire.cache.query.dunit;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.client.*;
-import com.gemstone.gemfire.cache.query.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.PoolFactory;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.cache.query.FunctionDomainException;
+import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.query.IndexInvalidException;
+import com.gemstone.gemfire.cache.query.NameResolutionException;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryException;
+import com.gemstone.gemfire.cache.query.QueryExecutionLowMemoryException;
+import com.gemstone.gemfire.cache.query.QueryExecutionTimeoutException;
+import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.TypeMismatchException;
import com.gemstone.gemfire.cache.query.data.Portfolio;
import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
import com.gemstone.gemfire.cache.query.internal.QueryMonitor;
@@ -30,31 +62,32 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.DistributedRegion;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.control.*;
+import com.gemstone.gemfire.internal.cache.control.HeapMemoryMonitor;
+import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
+import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
+import com.gemstone.gemfire.internal.cache.control.ResourceListener;
+import com.gemstone.gemfire.internal.cache.control.TestMemoryThresholdListener;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
-import util.TestException;
-
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+@Category(DistributedTest.class)
public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCase {
private static int MAX_TEST_QUERY_TIMEOUT = 4000;
private static int TEST_QUERY_TIMEOUT = 1000;
private final static int CRITICAL_HEAP_USED = 950;
private final static int NORMAL_HEAP_USED = 500;
- public ResourceManagerWithQueryMonitorDUnitTest(String name) {
- super(name);
- }
-
+
@Override
public final void postSetUpClientServerTestCase() throws Exception {
Invoke.invokeInEveryVM(this.setHeapMemoryMonitorTestMode);
@@ -103,98 +136,118 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
return null;
}
};
-
+
+ @Test
public void testRMAndNoTimeoutSet() throws Exception {
doCriticalMemoryHitTest("portfolios", false, 85/*crit threshold*/, false, -1, true);
}
-
+
+ @Test
public void testRMAndNoTimeoutSetParReg() throws Exception {
doCriticalMemoryHitTest("portfolios", true, 85/*crit threshold*/, false, -1, true);
}
-
+
+ @Test
public void testRMButDisabledQueryMonitorForLowMemAndNoTimeoutSet() throws Exception {
//verify that timeout is not set and that a query can execute properly
doCriticalMemoryHitTest("portfolios", false, 85/*crit threshold*/, true, -1, true);
}
-
+
+ @Test
public void testRMAndTimeoutSet() throws Exception {
//verify that we still receive critical heap cancelation
doCriticalMemoryHitTest("portfolios", false, 85/*crit threshold*/, true, TEST_QUERY_TIMEOUT, true);
}
-
+
+ @Test
public void testRMAndTimeoutSetAndQueryTimesoutInstead() throws Exception {
//verify that timeout is set correctly and cancel query
doCriticalMemoryHitTest("portfolios", false, 85/*crit threshold*/, true, TEST_QUERY_TIMEOUT, false);
}
-
+
+ @Test
public void testRMButDisabledQueryMonitorForLowMemAndTimeoutSet() throws Exception {
//verify that timeout is still working properly
doCriticalMemoryHitTest("portfolios", false, 85/*crit threshold*/, true, TEST_QUERY_TIMEOUT, true);
}
-
//Query directly on member with RM and QM set
+ @Test
public void testRMAndNoTimeoutSetOnServer() throws Exception {
doCriticalMemoryHitTestOnServer("portfolios", false, 85/*crit threshold*/, false, -1, true);
}
-
+
+ @Test
public void testRMAndNoTimeoutSetParRegOnServer() throws Exception {
doCriticalMemoryHitTestOnServer("portfolios", true, 85/*crit threshold*/, false, -1, true);
}
-
+
+ @Test
public void testRMButDisabledQueryMonitorForLowMemAndNoTimeoutSetOnServer() throws Exception {
//verify that timeout is not set and that a query can execute properly
doCriticalMemoryHitTestOnServer("portfolios", false, 85/*crit threshold*/, true, -1, true);
}
-
+
+ @Test
public void testRMAndTimeoutSetOnServer() throws Exception {
//verify that we still receive critical heap cancelation
doCriticalMemoryHitTestOnServer("portfolios", false, 85/*crit threshold*/, true, TEST_QUERY_TIMEOUT, true);
}
-
+
+ @Test
public void testRMAndTimeoutSetAndQueryTimesoutInsteadOnServer() throws Exception {
//verify that timeout is set correctly and cancel query
doCriticalMemoryHitTestOnServer("portfolios", false, 85/*crit threshold*/, true, TEST_QUERY_TIMEOUT, false);
}
-
+
+ @Test
public void testRMButDisabledQueryMonitorForLowMemAndTimeoutSetOnServer() throws Exception {
//verify that timeout is still working properly
doCriticalMemoryHitTestOnServer("portfolios", false, 85/*crit threshold*/, true, TEST_QUERY_TIMEOUT, true);
}
-
+
+ @Test
public void testPRGatherCancellation() throws Exception {
doCriticalMemoryHitTestWithMultipleServers("portfolios", true, 85/*crit threshold*/, false, -1, true);
}
+ @Test
public void testPRGatherCancellationWhileGatheringResults() throws Exception {
doCriticalMemoryHitDuringGatherTestWithMultipleServers("portfolios", true, 85/*crit threshold*/, false, -1, true);
}
-
+
+ @Test
public void testPRGatherCancellationWhileAddingResults() throws Exception {
doCriticalMemoryHitAddResultsTestWithMultipleServers("portfolios", true, 85/*crit threshold*/, false, -1, true);
}
-
+
+ @Test
public void testIndexCreationCancellationPR() throws Exception {
doCriticalMemoryHitWithIndexTest("portfolios", true, 85/*crit threshold*/, false, -1, true, "compact");
}
-
+
+ @Test
public void testIndexCreationCancellation() throws Exception {
doCriticalMemoryHitWithIndexTest("portfolios", false, 85/*crit threshold*/, false, -1, true, "compact");
}
-
+
+ @Test
public void testIndexCreationNoCancellationPR() throws Exception {
doCriticalMemoryHitWithIndexTest("portfolios", true, 85/*crit threshold*/, true, -1, true, "compact");
}
-
+
+ @Test
public void testHashIndexCreationCancellationPR() throws Exception {
doCriticalMemoryHitWithIndexTest("portfolios", true, 85/*crit threshold*/, false, -1, true, "hash");
}
-
+
+ @Test
public void testHashIndexCreationCancellation() throws Exception {
//need to add hook to canceled result set and very it is triggered for multiple servers
doCriticalMemoryHitWithIndexTest("portfolios", false, 85/*crit threshold*/, false, -1, true, "hash");
}
-
+
+ @Test
public void testHashIndexCreationNoCancellationPR() throws Exception {
//need to add hook to canceled result set and very it is triggered for multiple servers
doCriticalMemoryHitWithIndexTest("portfolios", true, 85/*crit threshold*/, true, -1, true, "hash");
@@ -1064,7 +1117,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
if (spot == 1) {
try {
if (!latch.await(8, TimeUnit.SECONDS)) {
- throw new TestException("query was never unlatched");
+ fail("query was never unlatched");
}
} catch (InterruptedException e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/ConstantsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/ConstantsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/ConstantsJUnitTest.java
index d1ecff6..b437734 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/ConstantsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/ConstantsJUnitTest.java
@@ -22,12 +22,7 @@
*/
package com.gemstone.gemfire.cache.query.functional;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.query.CacheUtils;
-import com.gemstone.gemfire.cache.query.Query;
-import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.data.Portfolio;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import static org.junit.Assert.*;
import java.util.Collection;
@@ -36,19 +31,15 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
-import junit.framework.*;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.query.CacheUtils;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.data.Portfolio;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-/**
- *
- */
@Category(IntegrationTest.class)
public class ConstantsJUnitTest {
- public ConstantsJUnitTest() {
- }
-
@Before
public void setUp() throws java.lang.Exception {
CacheUtils.startCache();