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:14:30 UTC
[02/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-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java
index c4d2a44..08b047a 100755
--- a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java
@@ -16,16 +16,62 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Ignore;
+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.CacheWriterException;
+import com.gemstone.gemfire.cache.CommitConflictException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Region.Entry;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.ServerConnectivityException;
import com.gemstone.gemfire.cache.client.ServerOperationException;
import com.gemstone.gemfire.cache.persistence.PartitionOfflineException;
-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.CqClosedException;
+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.CqQuery;
+import com.gemstone.gemfire.cache.query.QueryInvalidException;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.Struct;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
@@ -33,62 +79,62 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+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.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.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.junit.categories.DistributedTest;
/**
* Tests putAll for c/s. Also tests removeAll
*
* @since GemFire 5.0.23
*/
+@Category(DistributedTest.class)
@SuppressWarnings("serial")
public class PutAllCSDUnitTest extends ClientServerTestCase {
final int numberOfEntries = 100;
-
final int testEndPointSwitchNumber = 200;
-
final int thousandEntries = 1000;
-
final int TOTAL_BUCKETS = 10;
static Object lockObject = new Object();
-
static Object lockObject2 = new Object();
-
static Object lockObject3 = new Object();
-
static Object lockObject4 = new Object();
final String expectedExceptions = PutAllPartialResultException.class.getName()+"||"
+ ServerConnectivityException.class.getName()+"||"+RegionDestroyedException.class.getName()+"||java.net.ConnectException";
- // public static void caseTearDown() throws Exception {
- // disconnectAllFromDS();
- // }
+ List<VersionTag> client1Versions = null;
+ List<VersionTag> client2Versions = null;
- /**
- * Creates a new <code>GemFireMemberStatusDUnitTest</code>
- */
- public PutAllCSDUnitTest(String name) {
- super(name);
- }
+ List<VersionTag> client1RAVersions = null;
+ List<VersionTag> client2RAVersions = null;
- // ////// Test Methods
+ List<String> expectedVersions = null;
+ List<String> actualVersions = null;
+
+ List<String> expectedRAVersions = null;
+ List<String> actualRAVersions = null;
private static void checkRegionSize(final Region region, final int expectedSize) {
WaitCriterion ev = new WaitCriterion() {
+ @Override
public boolean done() {
return region.size() == expectedSize;
}
+ @Override
public String description() {
return null;
}
@@ -99,10 +145,9 @@ public class PutAllCSDUnitTest extends ClientServerTestCase {
/**
* Tests putAll to one server.
- *
- * @throws InterruptedException
*/
-public void testOneServer() throws CacheException, InterruptedException {
+ @Test
+ public void testOneServer() throws CacheException, InterruptedException {
final String title = "testOneServer:";
final Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -117,6 +162,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createClient(client2, regionName, serverHost, new int[] {serverPort}, -1, -1, false, true, true);
server.invoke(new CacheSerializableRunnable(title+"server add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -124,6 +170,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 registerInterest and add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -135,6 +182,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 create local region and run putAll") {
+ @Override
public void run2() throws CacheException {
AttributesFactory factory2 = new AttributesFactory();
factory2.setScope(Scope.LOCAL);
@@ -147,9 +195,10 @@ public void testOneServer() throws CacheException, InterruptedException {
});
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(title+"client1 create CQ") {
+ @Override
public void run2() throws CacheException {
// create a CQ for key 10-20
- Region localregion = getRootRegion().getSubregion("localsave");
+ Region localregion = getRootRegion().getSubregion("localsave");
CqAttributesFactory cqf1 = new CqAttributesFactory();
EOCQEventListener EOCQListener = new EOCQEventListener(localregion);
cqf1.addCqListener(EOCQListener);
@@ -198,6 +247,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
server.invoke(new CacheSerializableRunnable(title+"verify Bridge Server") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries, region.size());
@@ -210,6 +260,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify CQ is ready
client1.invoke(new CacheSerializableRunnable(title+"verify CQ is ready") {
+ @Override
public void run2() throws CacheException {
Region localregion = getRootRegion().getSubregion("localsave");
waitTillNotify(lockObject, 10000, (localregion.size()>0));
@@ -219,6 +270,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify registerInterest result at client2
client2.invoke(new CacheSerializableRunnable(title+"verify client2") {
+ @Override
public void run2() throws CacheException {
final Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -240,6 +292,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify CQ result at client1
client1.invoke(new CacheSerializableRunnable(title+"Verify client1") {
+ @Override
public void run2() throws CacheException {
Region localregion = getRootRegion().getSubregion("localsave");
for (int i=10; i<15; i++) {
@@ -262,6 +315,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client2.invoke(new CacheSerializableRunnable(title+"verify client2") {
+ @Override
public void run2() throws CacheException {
final Region region = getRootRegion().getSubregion(regionName);
LinkedHashMap map = new LinkedHashMap();
@@ -273,6 +327,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
// verify CQ result at client1
client1.invoke(new CacheSerializableRunnable(title+"Verify client1") {
+ @Override
public void run2() throws CacheException {
Region localregion = getRootRegion().getSubregion("localsave");
for (int i=10; i<20; i++) {
@@ -325,6 +380,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Test Exception handling
// verify CQ is ready
client1.invoke(new CacheSerializableRunnable(title+"test exception handling") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
Map m = null;
@@ -367,9 +423,8 @@ public void testOneServer() throws CacheException, InterruptedException {
/**
* Tests putAll afterUpdate event contained oldValue.
- *
- * @throws InterruptedException
*/
+ @Test
public void testOldValueInEvent() throws CacheException, InterruptedException {
final String title = "testOldValueInEvent:";
final Host host = Host.getHost(0);
@@ -388,6 +443,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createClient(client2, regionName, serverHost, new int[] {serverPort2}, -1, -1, false, true, true);
client2.invoke(new CacheSerializableRunnable(title+"client2 registerInterest and add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -399,6 +455,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 create local region and run putAll") {
+ @Override
public void run2() throws CacheException {
// create keys
Region region = getRootRegion().getSubregion(regionName);
@@ -414,6 +471,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify 41890, the local PUTALL_UPDATE event should contain old value
client1.invoke(new CacheSerializableRunnable(title+"verify after update events") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
waitTillNotify(lockObject, 20000, (region.size() == numberOfEntries));
@@ -421,6 +479,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"verify after update events") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
waitTillNotify(lockObject, 20000, (region.size() == numberOfEntries));
@@ -436,9 +495,9 @@ public void testOneServer() throws CacheException, InterruptedException {
* client to a replicated region 2) putAll from a multi-threaded client to a
* replicated region 3)
*/
+ @Test
public void test2Server() throws CacheException, InterruptedException {
final String title = "test2Server:";
-// disconnectAllFromDS();
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -457,6 +516,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createBridgeClient(client2, regionName, serverHost, new int[] {serverPort2}, -1, -1, true);
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -464,6 +524,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -479,6 +540,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter("key-"));
@@ -493,6 +555,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter("key-"));
@@ -505,6 +568,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -517,6 +581,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
doRemoveAll(regionName, "key-", numberOfEntries);
@@ -527,6 +592,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -539,6 +605,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -550,6 +617,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -560,12 +628,14 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client putAll from multithread client
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll1 from client1") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "async1key-", numberOfEntries);
}
});
AsyncInvocation async2 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll2 from client1") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "async2key-", numberOfEntries);
}
@@ -577,6 +647,7 @@ public void testOneServer() throws CacheException, InterruptedException {
client1.invoke(new CacheSerializableRunnable(title
+ "verify client 1 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries*2, region.size());
@@ -599,6 +670,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1 for asyn keys
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries*2, region.size());
@@ -620,6 +692,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2 for asyn keys
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries*2, region.size());
@@ -639,6 +712,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify async putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries*2);
@@ -659,12 +733,14 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client removeAll from multithread client
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll1 from client1") {
+ @Override
public void run2() throws CacheException {
doRemoveAll(regionName, "async1key-", numberOfEntries);
}
});
AsyncInvocation async2 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll2 from client1") {
+ @Override
public void run2() throws CacheException {
doRemoveAll(regionName, "async2key-", numberOfEntries);
}
@@ -675,6 +751,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
doRemoveAll(regionName, "key-", numberOfEntries);
@@ -685,6 +762,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify async removeAll Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -694,6 +772,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify async removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -701,6 +780,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify async removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -710,6 +790,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute p2p putAll
server1.invoke(new CacheSerializableRunnable(title
+ "server1 execute P2P putAll") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "p2pkey-", numberOfEntries);
Region region = getRootRegion().getSubregion(regionName);
@@ -727,6 +808,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2 for p2p keys
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2 for p2p keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
long ts1 = 0;
@@ -740,6 +822,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify p2p putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -751,6 +834,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client1.invoke(new CacheSerializableRunnable(title+"client1 verify p2p putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -765,6 +849,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute p2p removeAll
server1.invoke(new CacheSerializableRunnable(title
+ "server1 execute P2P removeAll") {
+ @Override
public void run2() throws CacheException {
doRemoveAll(regionName, "p2pkey-", numberOfEntries);
Region region = getRootRegion().getSubregion(regionName);
@@ -774,6 +859,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify p2p removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -781,6 +867,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify p2p removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -788,6 +875,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 verify p2p removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -797,6 +885,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// putAll at client2 to trigger local-invalidates at client1
client2.invoke(new CacheSerializableRunnable(title
+ "execute putAll on client2 for key 0-10") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "key-", 10);
}
@@ -805,15 +894,18 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify client 2 for key 0-10
client1.invoke(new CacheSerializableRunnable(title
+ "verify client1 for local invalidate") {
+ @Override
public void run2() throws CacheException {
final Region region = getRootRegion().getSubregion(regionName);
for (int i = 0; i < 10; i++) {
final int ii = i;
WaitCriterion ev = new WaitCriterion() {
+ @Override
public boolean done() {
Entry entry = region.getEntry("key-" + ii);
return entry != null && entry.getValue() == null;
}
+ @Override
public String description() {
return null;
}
@@ -832,10 +924,10 @@ public void testOneServer() throws CacheException, InterruptedException {
stopBridgeServers(getCache());
}
-
/* same as test2Server(), but all the servers are using policy normal */
private int createServerRegion(VM vm, final String regionName, final boolean CCE) {
SerializableCallable createRegion = new SerializableCallable() {
+ @Override
public Object call() throws Exception {
AttributesFactory af = new AttributesFactory();
af.setConcurrencyChecksEnabled(CCE);
@@ -858,7 +950,6 @@ public void testOneServer() throws CacheException, InterruptedException {
public void doTest2NormalServerCCE(boolean CCE) throws CacheException, InterruptedException {
final String title = "doTest2NormalServerCCE="+CCE+":";
-// disconnectAllFromDS();
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -876,6 +967,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createBridgeClient(client2, regionName, serverHost, new int[] {serverPort2}, -1, 59000, true);
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -884,6 +976,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// test case 1: putAll and removeAll to server1
client1.invoke(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -900,6 +993,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter("case1-"));
@@ -914,6 +1008,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter("case1-"));
@@ -923,6 +1018,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
LocalRegion region = (LocalRegion)getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries+1, region.size());
@@ -936,6 +1032,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -948,6 +1045,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -959,6 +1057,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -967,6 +1066,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// test case 2: putAll to server1, removeAll to server2
client1.invoke(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
doPutAll(regionName, "case2-", numberOfEntries);
@@ -981,6 +1081,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries, region.size());
@@ -993,6 +1094,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// normal policy will not distribute create events
@@ -1001,6 +1103,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
doRemoveAll(regionName, "case2-", numberOfEntries);
@@ -1010,6 +1113,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(100, region.size());
@@ -1018,6 +1122,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server2.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1025,6 +1130,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 verify removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 100);
@@ -1034,6 +1140,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// test case 3: removeAll a list with duplicated keys
client1.invoke(new CacheSerializableRunnable(title+"put 3 keys then removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.put("case3-1", "case3-1");
@@ -1053,6 +1160,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1063,14 +1171,16 @@ public void testOneServer() throws CacheException, InterruptedException {
// Stop server
stopBridgeServers(getCache());
}
-
+
+ @Test
public void test2NormalServerCCE() throws CacheException, InterruptedException {
doTest2NormalServerCCE(true);
disconnectAllFromDS();
doTest2NormalServerCCE(false);
disconnectAllFromDS();
}
-
+
+ @Test
public void testPRServerRVDuplicatedKeys() throws CacheException, InterruptedException {
doRVDuplicatedKeys(true, 1);
disconnectAllFromDS();
@@ -1082,7 +1192,6 @@ public void testOneServer() throws CacheException, InterruptedException {
public void doRVDuplicatedKeys(final boolean isPR, final int redundantCopies) throws CacheException, InterruptedException {
final String title = "doRVDuplicatedKeys:";
- // disconnectAllFromDS();
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -1101,6 +1210,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createBridgeClient(client2, regionName, serverHost, new int[] {serverPort2}, -1, 59000, false);
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1108,6 +1218,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1122,6 +1233,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// test case 3: removeAll a list with duplicated keys
client1.invoke(new CacheSerializableRunnable(title+"put 3 keys then removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.put("case3-1", "case3-1");
@@ -1132,6 +1244,7 @@ public void testOneServer() throws CacheException, InterruptedException {
client2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Wait.pause(5000);
Region region = getRootRegion().getSubregion(regionName);
@@ -1145,6 +1258,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"put 3 keys then removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
ArrayList keys = new ArrayList();
@@ -1164,6 +1278,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
Region.Entry re = region.getEntry("case3-1");
@@ -1177,6 +1292,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
Region.Entry re = region.getEntry("case3-1");
@@ -1190,6 +1306,7 @@ public void testOneServer() throws CacheException, InterruptedException {
client2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Wait.pause(5000);
Region region = getRootRegion().getSubregion(regionName);
@@ -1206,12 +1323,14 @@ public void testOneServer() throws CacheException, InterruptedException {
// Stop server
stopBridgeServers(getCache());
}
-
+
+ @Test
public void testBug51725() throws CacheException, InterruptedException {
doBug51725(false);
disconnectAllFromDS();
}
+ @Test
public void testBug51725_singlehup() throws CacheException, InterruptedException {
doBug51725(true);
disconnectAllFromDS();
@@ -1229,8 +1348,6 @@ public void testOneServer() throws CacheException, InterruptedException {
int server1Size;
int server2Size;
-// disconnectAllFromDS();
-
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
final VM server2 = host.getVM(1);
@@ -1253,6 +1370,7 @@ public void testOneServer() throws CacheException, InterruptedException {
client2.invoke(addExceptionTag1(expectedExceptions));
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1263,6 +1381,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"put 3 keys then removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1274,6 +1393,7 @@ public void testOneServer() throws CacheException, InterruptedException {
closeCache(server2);
client1.invoke(new CacheSerializableRunnable(title+"putAll from client again") {
+ @Override
public void run2() throws CacheException {
LocalRegion region = (LocalRegion)getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1312,6 +1432,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"verify entries from client2") {
+ @Override
public void run2() throws CacheException {
Wait.pause(5000);
Region region = getRootRegion().getSubregion(regionName);
@@ -1330,9 +1451,9 @@ public void testOneServer() throws CacheException, InterruptedException {
/**
* Tests putAll to 2 PR servers.
*/
+ @Test
public void testPRServer() throws CacheException, InterruptedException {
final String title = "testPRServer:";
-// disconnectAllFromDS();
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -1350,6 +1471,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createBridgeClient(client2, regionName, serverHost, new int[] {serverPort2}, -1, 59000, false);
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1357,6 +1479,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1372,6 +1495,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter("key-"));
@@ -1386,6 +1510,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter("key-"));
@@ -1398,6 +1523,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title
+ "verify client2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -1410,6 +1536,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
doRemoveAll(regionName, "key-", numberOfEntries);
@@ -1420,6 +1547,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1433,6 +1561,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1444,6 +1573,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -1452,25 +1582,28 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client putAll from multithread client
{
- AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(
- title + "async putAll1 from client1") {
- public void run2() throws CacheException {
- doPutAll(regionName, "async1key-", numberOfEntries);
- }
- });
- AsyncInvocation async2 = client1.invokeAsync(new CacheSerializableRunnable(
- title + "async putAll2 from client1") {
- public void run2() throws CacheException {
- doPutAll(regionName, "async2key-", numberOfEntries);
- }
- });
+ AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(
+ title + "async putAll1 from client1") {
+ @Override
+ public void run2() throws CacheException {
+ doPutAll(regionName, "async1key-", numberOfEntries);
+ }
+ });
+ AsyncInvocation async2 = client1.invokeAsync(new CacheSerializableRunnable(
+ title + "async putAll2 from client1") {
+ @Override
+ public void run2() throws CacheException {
+ doPutAll(regionName, "async2key-", numberOfEntries);
+ }
+ });
- ThreadUtils.join(async1, 30 * 1000);
- ThreadUtils.join(async2, 30 * 1000);
+ ThreadUtils.join(async1, 30 * 1000);
+ ThreadUtils.join(async2, 30 * 1000);
}
-
+
client1.invoke(new CacheSerializableRunnable(title
+ "verify client 1 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(numberOfEntries*2, region.size());
@@ -1493,6 +1626,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2 for asyn keys
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
long ts1 = 0, ts2 = 0;
@@ -1512,6 +1646,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify async putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries*2);
@@ -1532,12 +1667,14 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client removeAll from multithread client
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll1 from client1") {
+ @Override
public void run2() throws CacheException {
doRemoveAll(regionName, "async1key-", numberOfEntries);
}
});
AsyncInvocation async2 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll2 from client1") {
+ @Override
public void run2() throws CacheException {
doRemoveAll(regionName, "async2key-", numberOfEntries);
}
@@ -1548,6 +1685,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
doRemoveAll(regionName, "key-", numberOfEntries);
@@ -1558,6 +1696,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 1, its data are from client
server1.invoke(new CacheSerializableRunnable(title
+ "verify async removeAll Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1567,6 +1706,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify async removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1574,6 +1714,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify async removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -1583,6 +1724,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute p2p putAll
server1.invoke(new CacheSerializableRunnable(title
+ "server1 execute P2P putAll") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "p2pkey-", numberOfEntries);
Region region = getRootRegion().getSubregion(regionName);
@@ -1600,6 +1742,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2 for p2p keys
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
long ts1 = 0;
@@ -1613,6 +1756,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify p2p putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -1624,6 +1768,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client1.invoke(new CacheSerializableRunnable(title+"client1 verify p2p putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, numberOfEntries);
@@ -1638,6 +1783,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute p2p removeAll
server1.invoke(new CacheSerializableRunnable(title
+ "server1 execute P2P removeAll") {
+ @Override
public void run2() throws CacheException {
doRemoveAll(regionName, "p2pkey-", numberOfEntries);
Region region = getRootRegion().getSubregion(regionName);
@@ -1647,6 +1793,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2, because its data are from distribution
server2.invoke(new CacheSerializableRunnable(title
+ "verify p2p removeAll Bridge Server 2") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
assertEquals(0, region.size());
@@ -1654,6 +1801,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 verify p2p removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -1661,6 +1809,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 verify p2p removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
checkRegionSize(region, 0);
@@ -1670,6 +1819,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// putAll at client2 to trigger local-invalidates at client1
client2.invoke(new CacheSerializableRunnable(title
+ "execute putAll on client2 for key 0-10") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "key-", 10);
}
@@ -1678,15 +1828,18 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify client 2 for key 0-10
client1.invoke(new CacheSerializableRunnable(title
+ "verify client1 for local invalidate") {
+ @Override
public void run2() throws CacheException {
final Region region = getRootRegion().getSubregion(regionName);
for (int i = 0; i < 10; i++) {
final int ii = i;
WaitCriterion ev = new WaitCriterion() {
+ @Override
public boolean done() {
Entry entry = region.getEntry("key-" + ii);
return entry != null && entry.getValue() == null;
}
+ @Override
public String description() {
return null;
}
@@ -1703,9 +1856,12 @@ public void testOneServer() throws CacheException, InterruptedException {
stopBridgeServers(getCache());
}
- // Checks to see if a client does a destroy that throws an exception from CacheWriter beforeDestroy
- // that the size of the region is still correct.
- // See bug 51583.
+ /**
+ * Checks to see if a client does a destroy that throws an exception from CacheWriter beforeDestroy
+ * that the size of the region is still correct.
+ * See bug 51583.
+ */
+ @Test
public void testClientDestroyOfUncreatedEntry() throws CacheException, InterruptedException {
final String title = "testClientDestroyOfUncreatedEntry:";
@@ -1725,6 +1881,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add cacheWriter") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// Install cacheWriter that causes the very first destroy to fail
@@ -1734,6 +1891,7 @@ public void testOneServer() throws CacheException, InterruptedException {
assertEquals(0, getRegionSize(server1, regionName));
client1.invoke(new CacheSerializableRunnable(title+"client1 destroy") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
try {
@@ -1755,9 +1913,9 @@ public void testOneServer() throws CacheException, InterruptedException {
/**
* Tests partial key putAll and removeAll to 2 servers with local region
*/
+ @Test
public void testPartialKeyInLocalRegion() throws CacheException, InterruptedException {
final String title = "testPartialKeyInLocalRegion:";
-// disconnectAllFromDS();
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@ -1781,6 +1939,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add cacheWriter") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// let the server to trigger exception after created 15 keys
@@ -1789,6 +1948,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1799,6 +1959,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
@@ -1816,9 +1977,11 @@ public void testOneServer() throws CacheException, InterruptedException {
{
WaitCriterion waitForSizes = new WaitCriterion() {
+ @Override
public String description() {
return "waiting for conditions to be met";
}
+ @Override
public boolean done() {
int c1Size = getRegionSize(client1, regionName);
int c2Size = getRegionSize(client2, regionName);
@@ -1852,6 +2015,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// reset cacheWriter's count to allow another 15 keys to be created
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add cacheWriter") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// let the server to trigger exception after created 15 keys
@@ -1861,6 +2025,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// p2p putAll on DR and expect exception
server2.invoke(new CacheSerializableRunnable(title+"server2 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1880,9 +2045,11 @@ public void testOneServer() throws CacheException, InterruptedException {
{
WaitCriterion waitForSizes = new WaitCriterion() {
+ @Override
public String description() {
return "waiting for conditions to be met";
}
+ @Override
public boolean done() {
int c1Size = getRegionSize(client1, regionName);
int c2Size = getRegionSize(client2, regionName);
@@ -1914,6 +2081,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// now do a removeAll that is not allowed to remove everything
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add cacheWriter") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// server triggers exception after destroying 5 keys
@@ -1921,6 +2089,7 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
@@ -1937,9 +2106,11 @@ public void testOneServer() throws CacheException, InterruptedException {
});
{
WaitCriterion waitForSizes = new WaitCriterion() {
+ @Override
public String description() {
return "waiting for conditions to be met";
}
+ @Override
public boolean done() {
int c1Size = getRegionSize(client1, regionName);
int c2Size = getRegionSize(client2, regionName);
@@ -1971,6 +2142,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// reset cacheWriter's count to allow another 5 keys to be destroyed
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add cacheWriter") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// server triggers exception after destroying 5 keys
@@ -1980,6 +2152,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// p2p putAll on DR and expect exception
server2.invoke(new CacheSerializableRunnable(title+"server2 add listener and removeAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -1996,9 +2169,11 @@ public void testOneServer() throws CacheException, InterruptedException {
{
WaitCriterion waitForSizes = new WaitCriterion() {
+ @Override
public String description() {
return "waiting for conditions to be met";
}
+ @Override
public boolean done() {
int c1Size = getRegionSize(client1, regionName);
int c2Size = getRegionSize(client2, regionName);
@@ -2040,9 +2215,9 @@ public void testOneServer() throws CacheException, InterruptedException {
* side is different between PR and LR. PR does it in postPutAll.
* It's not running in singleHop putAll
*/
+ @Test
public void testPartialKeyInPR() throws CacheException, InterruptedException {
final String title = "testPartialKeyInPR:";
-// disconnectAllFromDS();
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -2066,6 +2241,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2076,6 +2252,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server2.invoke(new CacheSerializableRunnable(title
+ "server2 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(server2, true, sc_server2, 10));
@@ -2083,6 +2260,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2093,6 +2271,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2125,7 +2304,6 @@ public void testOneServer() throws CacheException, InterruptedException {
int client2Size = getRegionSize(client2, regionName);
int server1Size = getRegionSize(server1, regionName);
LogWriterUtils.getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size);
-// assertIndexDetailsEquals(server1Size, client1Size);
// restart server2
createBridgeServer(server2, regionName, serverPort2, true, 0, "ds1");
@@ -2139,6 +2317,7 @@ public void testOneServer() throws CacheException, InterruptedException {
closeCache(server2);
server1Size = getRegionSize(server1, regionName);
client1.invoke(new CacheSerializableRunnable(title+"client1 does putAll again") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
@@ -2172,6 +2351,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// add a cacheWriter for server to stop after created 15 keys
server1.invoke(new CacheSerializableRunnable(title
+ "server1 execute P2P putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
// let the server to trigger exception after created 15 keys
@@ -2181,6 +2361,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// p2p putAll on PR and expect exception
server2.invoke(new CacheSerializableRunnable(title+"server2 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
// create keys
try {
@@ -2212,6 +2393,7 @@ public void testOneServer() throws CacheException, InterruptedException {
* side is different between PR and LR. PR does it in postPutAll.
* This is a singlehop putAll test.
*/
+ @Test
public void testPartialKeyInPRSingleHop() throws CacheException, InterruptedException {
final String title = "testPartialKeyInPRSingleHop_";
final int cacheWriterAllowedKeyNum = 16;
@@ -2238,6 +2420,7 @@ public void testOneServer() throws CacheException, InterruptedException {
try {
client2.invoke(new CacheSerializableRunnable(title + "client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2248,16 +2431,19 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title + "do some putAll to get ClientMetaData for future putAll") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "key-", numberOfEntries);
}
});
WaitCriterion waitForSizes = new WaitCriterion() {
+ @Override
public String description() {
return "waiting for conditions to be met";
}
+ @Override
public boolean done() {
int c1Size = getRegionSize(client1, regionName);
int c2Size = getRegionSize(client2, regionName);
@@ -2287,6 +2473,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2297,6 +2484,7 @@ public void testOneServer() throws CacheException, InterruptedException {
final SharedCounter sc_server2 = new SharedCounter("server2");
server2.invoke(new CacheSerializableRunnable(title
+ "server2 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(server2, true, sc_server2, 10));
@@ -2304,6 +2492,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(title + "client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2325,7 +2514,6 @@ public void testOneServer() throws CacheException, InterruptedException {
Assert.fail("putAll client threw an exception", async1.getException());
}
-
// restart server2
System.out.println("restarting server 2");
createBridgeServer(server2, regionName, serverPort2, true, 0, "ds1");
@@ -2338,6 +2526,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// close a server to re-run the test
closeCache(server2);
client1.invoke(new CacheSerializableRunnable(title + "client1 does putAll again") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
@@ -2360,6 +2549,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// add a cacheWriter for server to fail putAll after it created cacheWriterAllowedKeyNum keys
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add cachewriter to throw exception after created some keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().setCacheWriter(new MyWriter(cacheWriterAllowedKeyNum));
@@ -2367,6 +2557,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title + "client1 does putAll once more") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
@@ -2391,9 +2582,10 @@ public void testOneServer() throws CacheException, InterruptedException {
}
/**
- * Set redundency=1 to see if retry succeeded after PRE
+ * Set redundancy=1 to see if retry succeeded after PRE
* This is a singlehop putAll test.
*/
+ @Test
public void testPartialKeyInPRSingleHopWithRedundency() throws CacheException, InterruptedException {
final String title = "testPartialKeyInPRSingleHopWithRedundency_";
int client1Size;
@@ -2401,8 +2593,6 @@ public void testOneServer() throws CacheException, InterruptedException {
int server1Size;
int server2Size;
-// disconnectAllFromDS();
-
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
final VM server2 = host.getVM(1);
@@ -2424,6 +2614,7 @@ public void testOneServer() throws CacheException, InterruptedException {
client2.invoke(addExceptionTag1(expectedExceptions));
client2.invoke(new CacheSerializableRunnable(title+"client2 add listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2434,15 +2625,18 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"do some putAll to get ClientMetaData for future putAll") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "key-", numberOfEntries);
}
});
WaitCriterion waitForSizes = new WaitCriterion() {
+ @Override
public String description() {
return "waiting for conditions to be met";
}
+ @Override
public boolean done() {
int c1Size = getRegionSize(client1, regionName);
int c2Size = getRegionSize(client2, regionName);
@@ -2477,6 +2671,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2486,6 +2681,7 @@ public void testOneServer() throws CacheException, InterruptedException {
final SharedCounter sc_server2 = new SharedCounter("server2");
server2.invoke(new CacheSerializableRunnable(title
+ "server2 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(server2, true, sc_server2, 10));
@@ -2493,6 +2689,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2532,6 +2729,7 @@ public void testOneServer() throws CacheException, InterruptedException {
closeCache(server2);
server1Size = getRegionSize(server1, regionName);
client1.invoke(new CacheSerializableRunnable(title+"client1 does putAll again") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, title+"again:", numberOfEntries);
}
@@ -2554,11 +2752,10 @@ public void testOneServer() throws CacheException, InterruptedException {
* Tests bug 41403: let 2 sub maps both failed with partial key applied.
* This is a singlehop putAll test.
*/
+ @Test
public void testEventIdMisorderInPRSingleHop() throws CacheException, InterruptedException {
final String title = "testEventIdMisorderInPRSingleHop_";
-// disconnectAllFromDS();
-
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
final VM server2 = host.getVM(1);
@@ -2609,6 +2806,7 @@ public void testOneServer() throws CacheException, InterruptedException {
addExceptionTag1(expectedExceptions);
client1.invoke(new CacheSerializableRunnable(title+"do some putAll to get ClientMetaData for future putAll") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "key-", numberOfEntries);
}
@@ -2622,6 +2820,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server1.invoke(new CacheSerializableRunnable(title
+ "server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region r = getRootRegion().getSubregion(regionName);
r.getAttributesMutator().addCacheListener(new MyListener(server1, true, sc_server1, 10));
@@ -2630,6 +2829,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server2.invoke(new CacheSerializableRunnable(title
+ "server2 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region r = getRootRegion().getSubregion(regionName);
r.getAttributesMutator().addCacheListener(new MyListener(server2, true, sc_server2, 10));
@@ -2638,6 +2838,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server3.invoke(new CacheSerializableRunnable(title
+ "server3 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region r = getRootRegion().getSubregion(regionName);
r.getAttributesMutator().addCacheListener(new MyListener(true, sc_server3));
@@ -2651,6 +2852,7 @@ public void testOneServer() throws CacheException, InterruptedException {
LogWriterUtils.getLogWriter().info("region sizes: "+client1Size+","+server1Size+","+server2Size+","+server3Size);
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(title+"client1 add listener and putAll") {
+ @Override
public void run2() throws CacheException {
Region r = getRootRegion().getSubregion(regionName);
r.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2667,6 +2869,7 @@ public void testOneServer() throws CacheException, InterruptedException {
server3.invoke(new CacheSerializableRunnable(title
+ "server3 print counter") {
+ @Override
public void run2() throws CacheException {
Region r = getRootRegion().getSubregion(regionName);
MyListener l = (MyListener)r.getAttributes().getCacheListeners()[0];
@@ -2676,7 +2879,6 @@ public void testOneServer() throws CacheException, InterruptedException {
}
});
-
LogWriterUtils.getLogWriter().info("event counters : "+myListener.sc);
assertEquals(numberOfEntries, myListener.sc.num_create_event);
assertEquals(0, myListener.sc.num_update_event);
@@ -2695,14 +2897,13 @@ public void testOneServer() throws CacheException, InterruptedException {
* Tests while putAll to 2 distributed servers, one server failed over Add a
* listener to slow down the processing of putAll
*/
- public void test2FailOverDistributedServer() throws CacheException,
- InterruptedException {
+ @Test
+ public void test2FailOverDistributedServer() throws CacheException, InterruptedException {
IgnoredException.addIgnoredException("Broken pipe");
IgnoredException.addIgnoredException("Connection reset");
IgnoredException.addIgnoredException("Unexpected IOException");
final String title = "test2FailOverDistributedServer:";
-// disconnectAllFromDS();
-
+
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
VM server2 = host.getVM(1);
@@ -2720,6 +2921,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createBridgeClient(client2, regionName, serverHost, new int[] {serverPort2, serverPort1}, -1, -1, true);
server1.invoke(new CacheSerializableRunnable(title+"server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2727,6 +2929,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
server2.invoke(new CacheSerializableRunnable(title+"server2 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2734,6 +2937,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client1.invoke(new CacheSerializableRunnable(title+"client1 registerInterest") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2745,6 +2949,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 registerInterest") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2758,6 +2963,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client putAll from multithread client
AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll1 from client1") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, "async1key-", numberOfEntries);
}
@@ -2767,6 +2973,7 @@ public void testOneServer() throws CacheException, InterruptedException {
Wait.pause(2000);
server1.invoke(new CacheSerializableRunnable(title
+ "stop Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
stopOneBridgeServer(serverPort1);
}
@@ -2777,6 +2984,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify bridge server 2 for asyn keys
server2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge Server 2 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
long ts1 = 0;
@@ -2797,6 +3005,7 @@ public void testOneServer() throws CacheException, InterruptedException {
/**
* Tests while putAll timeout's exception
*/
+ @Test
public void testClientTimeOut() throws CacheException, InterruptedException {
final String title = "testClientTimeOut:";
disconnectAllFromDS();
@@ -2818,6 +3027,7 @@ public void testOneServer() throws CacheException, InterruptedException {
createBridgeClient(client2, regionName, serverHost, new int[] {serverPort2, serverPort1}, -1, -1, true);
server1.invoke(new CacheSerializableRunnable(title+"server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2825,6 +3035,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
server2.invoke(new CacheSerializableRunnable(title+"server2 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2835,6 +3046,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client putAll
client1.invoke(new CacheSerializableRunnable(title
+ "client1 execute putAll") {
+ @Override
public void run2() throws CacheException {
boolean exceptionTriggered = false;
try {
@@ -2855,6 +3067,7 @@ public void testOneServer() throws CacheException, InterruptedException {
/**
* Tests while putAll timeout at endpoint1 and switch to endpoint2
*/
+ @Test
public void testEndPointSwitch() throws CacheException, InterruptedException {
IgnoredException.addIgnoredException("Broken pipe");
IgnoredException.addIgnoredException("Connection reset");
@@ -2880,6 +3093,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// only add slow listener to server1, because we wish it to succeed
server1.invoke(new CacheSerializableRunnable(title+"server1 add slow listener") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(true));
@@ -2888,6 +3102,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// only register interest on client2
client2.invoke(new CacheSerializableRunnable(title+"client2 registerInterest") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2898,6 +3113,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Execute client1 putAll
client1.invoke(new CacheSerializableRunnable(title + "putAll from client1") {
+ @Override
public void run2() throws CacheException {
try {
doPutAll(regionName, title, testEndPointSwitchNumber);
@@ -2910,6 +3126,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify client 2 for all keys
client2.invoke(new CacheSerializableRunnable(title
+ "verify Bridge client2 for keys arrived finally") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
waitTillNotify(lockObject3, 100000, (region.size() == testEndPointSwitchNumber));
@@ -2922,11 +3139,11 @@ public void testOneServer() throws CacheException, InterruptedException {
stopBridgeServers(getCache());
}
-
/**
* Tests while putAll to 2 distributed servers, one server failed over Add a
* listener to slow down the processing of putAll
*/
+ @Test
public void testHADRFailOver() throws CacheException, InterruptedException {
final String title = "testHADRFailOver:";
disconnectAllFromDS();
@@ -2953,6 +3170,7 @@ public void testOneServer() throws CacheException, InterruptedException {
client2.invoke(addExceptionTag1(expectedExceptions));
client1.invoke(new CacheSerializableRunnable(title+"client1 registerInterest") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.registerInterest("ALL_KEYS");
@@ -2961,6 +3179,7 @@ public void testOneServer() throws CacheException, InterruptedException {
});
client2.invoke(new CacheSerializableRunnable(title+"client2 registerInterest") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
region.getAttributesMutator().addCacheListener(new MyListener(false));
@@ -2972,6 +3191,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// Server2 do a putAll to use HARegionQueues
AsyncInvocation async1 = server2.invokeAsync(new CacheSerializableRunnable(
title + "async putAll1 from server2") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, title+"1:", thousandEntries);
}
@@ -2980,6 +3200,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// client1 do a putAll to start HARegionQueues
AsyncInvocation async2 = client1.invokeAsync(new CacheSerializableRunnable(
title + "async putAll1 from client1") {
+ @Override
public void run2() throws CacheException {
doPutAll(regionName, title+"2:", thousandEntries);
}
@@ -2988,6 +3209,7 @@ public void testOneServer() throws CacheException, InterruptedException {
Wait.pause(2000);
server1.invoke(new CacheSerializableRunnable(title
+ "stop Bridge Server 1") {
+ @Override
public void run2() throws CacheException {
stopOneBridgeServer(serverPort1);
}
@@ -2999,6 +3221,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// verify client 2 for asyn keys
client2.invokeAsync(new CacheSerializableRunnable(title
+ "verify Bridge client2 for async keys") {
+ @Override
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
waitTillNotify(lockObject4, 100000, (region.size() == thousandEntries*2));
@@ -3020,7 +3243,9 @@ public void testOneServer() throws CacheException, InterruptedException {
* Test TX for putAll. There's no TX for c/s. We only test P2P
* This is disabled because putAll in TX is disabled.
*/
- public void no_testTX() throws CacheException, InterruptedException {
+ @Ignore("TODO: test is disabled")
+ @Test
+ public void testTX() throws CacheException, InterruptedException {
final String title = "testTX:";
disconnectAllFromDS();
final Host host = Host.getHost(0);
@@ -3038,6 +3263,7 @@ public void testOneServer() throws CacheException, InterruptedException {
// add slow liste
<TRUNCATED>