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:53 UTC
[25/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/internal/cache/execute/ColocationFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java
index 11eefd0..9de8806 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -25,6 +27,9 @@ import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
+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.AttributesFactory;
@@ -40,7 +45,6 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.partitioned.RegionAdvisor;
import com.gemstone.gemfire.internal.logging.InternalLogWriter;
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.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
@@ -48,8 +52,11 @@ 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.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-public class ColocationFailoverDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class ColocationFailoverDUnitTest extends JUnit4DistributedTestCase {
private static final long serialVersionUID = 1L;
@@ -73,10 +80,6 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
public static String orderPR_Name = "ColocationFailoverDUnitTest_OrderPR" ;
public static String shipmentPR_Name = "ColocationFailoverDUnitTest_ShipmentPR" ;
- public ColocationFailoverDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -86,6 +89,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
dataStore4 = host.getVM(3);
}
+ @Test
public void testPrimaryColocationFailover() throws Throwable {
createCacheInAllVms();
createCustomerPR();
@@ -97,6 +101,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
verifyPrimaryColocationAfterFailover();
}
+ @Test
public void testColocationFailover() throws Throwable {
createCacheInAllVms();
createCustomerPR();
@@ -362,7 +367,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
}
public static void createCacheInVm() {
- new ColocationFailoverDUnitTest("temp").createCache();
+ new ColocationFailoverDUnitTest().createCache();
}
public void createCache() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
index f6f4b01..1c9f93f 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
@@ -16,10 +16,37 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.execute.*;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DM;
@@ -32,17 +59,21 @@ import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
import com.gemstone.gemfire.security.templates.DummyAuthenticator;
import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
-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.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+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.internal.JUnit4DistributedTestCase;
+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.IOException;
-import java.io.Serializable;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4DistributedTestCase {
VM replicate1 = null;
@@ -62,10 +93,6 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
public static final Function functionWithNoResultThrowsException = new MyFunctionException();
- public DistributedRegionFunctionExecutionDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -82,6 +109,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
disconnectAllFromDS();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -98,6 +126,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
executeFunction();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_SendException() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -114,6 +143,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
executeFunction_SendException();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_NoLastResult() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -132,6 +162,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyNormal() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -154,6 +185,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -171,6 +203,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_SendException() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -187,6 +220,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.executeFunction_SendException());
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_NoLastResult() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -203,6 +237,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.executeFunction_NoLastResult());
}
+ @Test
public void testDistributedRegionFunctionExecutionWithFunctionInvocationTargetException() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -230,6 +265,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionWithFunctionInvocationTargetException_WithoutHA() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -264,6 +300,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionWithFunctionInvocationTargetExceptionForEmptyDataPolicy() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -291,6 +328,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionWithFunctionInvocationTargetExceptionForEmptyDataPolicy_WithoutHA() {
createCacheInVm(); // Empty
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -321,6 +359,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionHACacheClosedException() {
VM empty = normal;
@@ -361,6 +400,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
}
+ @Test
public void testDistributedRegionFunctionExecutionHANodeFailure() {
VM empty = normal;
@@ -394,6 +434,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer() {
VM empty1 = replicate3;
VM empty2 = normal;
@@ -413,6 +454,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
executeFunction();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer_SendException() {
VM empty1 = replicate3;
VM empty2 = normal;
@@ -433,6 +475,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
@Category(FlakyTest.class) // GEODE-632: random ports, eats exceptions
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer_NoLastResult() {
VM empty1 = replicate3;
VM empty2 = normal;
@@ -466,6 +509,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
* Ensure that the while executing the function if the servers is down then
* the execution is failover to other available server
*/
+ @Test
public void testServerFailoverWithTwoServerAliveHA()
throws InterruptedException {
@@ -501,6 +545,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyNormal_ClientServer() {
VM normal1 = normal;
VM normal2 = replicate3;
@@ -534,6 +579,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_ClientServer() {
VM empty = replicate3;
@@ -554,6 +600,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
executeUnregisteredFunction();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_ClientServer_WithoutRegister() {
VM empty = replicate3;
@@ -574,6 +621,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
executeFunction();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_ClientServer_FunctionInvocationTargetException() {
VM empty = replicate3;
@@ -603,6 +651,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_ClientServer_FunctionInvocationTargetException_WithoutHA() {
VM empty = replicate3;
@@ -640,6 +689,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer_FunctionInvocationTargetException() {
VM empty1 = replicate3;
VM empty2 = normal;
@@ -668,6 +718,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer_FunctionInvocationTargetException_WithoutHA() {
VM empty1 = replicate3;
VM empty2 = normal;
@@ -704,6 +755,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
ex.remove();
}
+ @Test
public void testBug40714() {
VM empty = replicate3;
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -734,6 +786,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
* lonerDistribuedSystem
*/
+ @Test
public void testBug41118() {
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.bug41118());
}
@@ -743,6 +796,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
* is not thrown. We have to grep for this exception in logs for any
* occerence.
*/
+ @Test
public void testBug41367() {
VM client = replicate1;
VM server = replicate2;
@@ -767,6 +821,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
}
+ @Test
public void testFunctionWithNoResultThrowsException(){
IgnoredException.addIgnoredException("RuntimeException");
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
@@ -794,7 +849,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
public static void bug41118(){
- InternalDistributedSystem ds = new DistributedRegionFunctionExecutionDUnitTest("temp").getSystem();
+ InternalDistributedSystem ds = new DistributedRegionFunctionExecutionDUnitTest().getSystem();
assertNotNull(ds);
ds.disconnect();
Properties props = new Properties();
@@ -880,7 +935,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
}
public static void createCacheInVm() {
- new DistributedRegionFunctionExecutionDUnitTest("temp")
+ new DistributedRegionFunctionExecutionDUnitTest()
.createCache(new Properties());
}
@@ -888,15 +943,14 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
Properties props = new Properties();
props.put(NAME, "SecurityServer");
props.put(SECURITY_CLIENT_AUTHENTICATOR, DummyAuthenticator.class.getName() + ".create");
- new DistributedRegionFunctionExecutionDUnitTest("temp").createCache(props);
+ new DistributedRegionFunctionExecutionDUnitTest().createCache(props);
}
public static void createCacheInClientVm() {
Properties props = new Properties();
props.put(MCAST_PORT, "0");
props.put(LOCATORS, "");
- new DistributedRegionFunctionExecutionDUnitTest("temp")
- .createCache(new Properties());
+ new DistributedRegionFunctionExecutionDUnitTest().createCache(new Properties());
}
public static void createCacheInClientVm_41367() {
@@ -907,7 +961,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends DistributedTest
props.put(SECURITY_CLIENT_AUTH_INIT, UserPasswordAuthInit.class.getName() + ".create");
props.put("security-username", "reader1");
props.put("security-password", "reader1");
- new DistributedRegionFunctionExecutionDUnitTest("temp").createCache(props);
+ new DistributedRegionFunctionExecutionDUnitTest().createCache(props);
}
public static void executeFunction() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
index 78d3827..218cac9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+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.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
@@ -40,6 +49,7 @@ import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+@Category(DistributedTest.class)
public class FunctionExecution_ExceptionDUnitTest extends
PartitionedRegionDUnitTestCase {
@@ -48,10 +58,11 @@ public class FunctionExecution_ExceptionDUnitTest extends
*/
private static final long serialVersionUID = 1L;
- public FunctionExecution_ExceptionDUnitTest(String name) {
- super(name);
+ public FunctionExecution_ExceptionDUnitTest() {
+ super();
}
+ @Test
public void testSingleKeyExecution_SendException_Datastore()
throws Exception {
final String rName = getUniqueName();
@@ -118,6 +129,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testSingleKeyExecution_SendException_MultipleTimes_Datastore()
throws Exception {
final String rName = getUniqueName();
@@ -169,6 +181,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteSingleKeyExecution_ThrowException_Datastore()
throws Exception {
final String rName = getUniqueName();
@@ -226,6 +239,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteSingleKeyExecution_SendException_Accessor()
throws Exception {
final String rName = getUniqueName();
@@ -303,6 +317,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteSingleKeyExecution_ThrowException_Accessor()
throws Exception {
final String rName = getUniqueName();
@@ -372,6 +387,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteMultiKeyExecution_SendException() throws Exception {
final String rName = getUniqueName();
Host host = Host.getHost(0);
@@ -444,6 +460,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteAllKeyExecution_SendException() throws Exception {
final String rName = getUniqueName();
Host host = Host.getHost(0);
@@ -510,6 +527,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteMultiKeyExecution_ThrowException() throws Exception {
final String rName = getUniqueName();
Host host = Host.getHost(0);
@@ -580,6 +598,7 @@ public class FunctionExecution_ExceptionDUnitTest extends
assertEquals(Boolean.TRUE, o);
}
+ @Test
public void testRemoteAllKeyExecution_ThrowException() throws Exception {
final String rName = getUniqueName();
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/internal/cache/execute/FunctionServiceStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
index c6af7e6..f0a4604 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
@@ -16,10 +16,35 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.execute.*;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
@@ -30,22 +55,22 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegionTestHelper;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.IOException;
-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.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+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;
-/*
+/**
* This is DUnite Test to test the Function Execution stats under various
- * scenarion like Cliet-Server with Region/without Region, P2P with partitioned
+ * scenarios like Client-Server with Region/without Region, P2P with partitioned
* Region/Distributed Region,member Execution
- *
*/
-
-public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
+@Category(DistributedTest.class)
+public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
static Boolean isByName = null;
@@ -86,16 +111,6 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
static int resultReceived_TestFunctionException = 0;
static int noOfExecutionExceptions_TestFunctionException = 0;
-// static Object[] VM0Stats;
-// static Object[] VM1Stats;
-// static Object[] VM2Stats;
-// static Object[] VM3tats;
-
-
- public FunctionServiceStatsDUnitTest(String name) {
- super(name);
- }
-
@Override
protected final void postSetUpPRClientServerTestBase() throws Exception {
//Make sure stats to linger from a previous test
@@ -163,7 +178,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
}
- /*
+ /**
* 1-client 3-Servers
* Function : TEST_FUNCTION2
* Function : TEST_FUNCTION3
@@ -173,6 +188,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
* On server side, function execution calls should be equal to the no of
* function executions completed.
*/
+ @Test
public void testClientServerPartitonedRegionFunctionExecutionStats() {
createScenario();
Function function = new TestFunction(true, TestFunction.TEST_FUNCTION2);
@@ -332,7 +348,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
server3.invoke(checkStatsOnServer);
}
- /*
+ /**
* 1-client 3-Servers
* server1 : Replicate
* server2 : Replicate
@@ -345,6 +361,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
* On server side, function execution calls should be equal to the no of
* function executions completed.
*/
+ @Test
public void testClientServerDistributedRegionFunctionExecutionStats() {
final String regionName = "FunctionServiceStatsDUnitTest";
@@ -540,15 +557,15 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
};
client.invoke(checkStatsOnClient);
}
-
-
- /*
+
+ /**
* Execution of the function on server using the name of the function
* TEST_FUNCTION1
* TEST_FUNCTION5
* On client side, the no of result received should equal to the no of function execution calls.
* On server side, function execution calls should be equal to the no of function executions completed.
*/
+ @Test
public void testClientServerwithoutRegion() {
createClientServerScenarionWithoutRegion();
Function function = new TestFunction(true, TestFunction.TEST_FUNCTION1);
@@ -711,6 +728,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
server3.invoke(checkStatsOnServer);
}
+ @Test
public void testP2PDummyExecutionStats()
throws Exception {
Host host = Host.getHost(0);
@@ -732,16 +750,15 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
datastore0.invoke(closeDistributedSystem);
datastore1.invoke(closeDistributedSystem);
datastore2.invoke(closeDistributedSystem);
-}
+ }
-
/**
* Ensure that the execution is happening all the PR as a whole
*
* Function Execution will not take place on accessor, accessor will onlu receive the resultsReceived.
* On datastore, no of function execution calls should be equal to the no of function execution calls from the accessor.
- * @throws Exception
*/
+ @Test
public void testP2PPartitionedRegionsFunctionExecutionStats()
throws Exception {
final String rName = getUniqueName();
@@ -932,7 +949,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
* Test the function execution statistics in case of the distributed Region P2P
* DataStore0 is with Empty datapolicy
*/
-
+ @Test
public void testP2PDistributedRegionFunctionExecutionStats() {
final String rName = getUniqueName();
Host host = Host.getHost(0);
@@ -1047,10 +1064,8 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
* Execution should happen on all other members too. so the no of function
* execution calls and no of function executions completed should be equal tio
* the no of functions from member 1
- *
- * @throws Exception
*/
-
+ @Test
public void testP2PMembersFunctionExecutionStats()
throws Exception {
Host host = Host.getHost(0);
@@ -1204,9 +1219,8 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
*
* Function throws the Exception,
* The check is added to for the no of function execution execption in datatostore1
- *
- * @throws Exception
*/
+ @Test
public void testFunctionExecutionExceptionStatsOnAllNodesPRegion()
throws Exception {
final String rName = getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
index 850f925..a1a965c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
@@ -16,20 +16,22 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Properties;
import java.util.Set;
+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.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.EntryOperation;
import com.gemstone.gemfire.cache.PartitionAttributes;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
@@ -40,19 +42,18 @@ import com.gemstone.gemfire.cache.execute.FunctionContext;
import com.gemstone.gemfire.cache.execute.FunctionService;
import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.functions.LocalDataSetFunction;
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.LogWriterUtils;
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 LocalDataSetDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class LocalDataSetDUnitTest extends JUnit4CacheTestCase {
private static final long serialVersionUID = 1L;
@@ -70,10 +71,6 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
protected static Region shipmentPR = null;
- public LocalDataSetDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -83,6 +80,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
accessor = host.getVM(3);
}
+ @Test
public void testLocalDataSet() {
createCacheInAllVms();
createCustomerPR();
@@ -93,6 +91,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
executeFunctions();
}
+ @Test
public void testLocalDataSetIteration() {
createCacheInAllVms();
createCustomerPR();
@@ -242,7 +241,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
}
public static void createCacheInVm() {
- new LocalDataSetDUnitTest("temp").createCache();
+ new LocalDataSetDUnitTest().createCache();
}
public void createCache() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
index c87ed56..a34ea69 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+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.io.File;
import java.io.Serializable;
import java.util.ArrayList;
@@ -74,14 +83,15 @@ import com.gemstone.gemfire.test.dunit.VM;
*
*
*/
-public class LocalDataSetIndexingDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class LocalDataSetIndexingDUnitTest extends JUnit4CacheTestCase {
protected static VM dataStore1 = null;
protected static VM dataStore2 = null;
- public LocalDataSetIndexingDUnitTest(String name) {
- super(name);
+ public LocalDataSetIndexingDUnitTest() {
+ super();
}
@Override
@@ -91,6 +101,7 @@ public class LocalDataSetIndexingDUnitTest extends CacheTestCase {
dataStore2 = host.getVM(1);
}
+ @Test
public void testLocalDataSetIndexing() {
final CacheSerializableRunnable createPRs = new CacheSerializableRunnable(
"create prs ") {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
index 1c47ffd..2216160 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
@@ -16,9 +16,12 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
-import java.util.HashSet;
+import static org.junit.Assert.*;
+
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;
@@ -35,14 +38,16 @@ import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
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.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
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;
-public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
+@Category(DistributedTest.class)
+public class LocalFunctionExecutionDUnitTest extends JUnit4DistributedTestCase{
protected static Cache cache = null;
@@ -50,17 +55,13 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
protected static Region region = null;
-
- public LocalFunctionExecutionDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
dataStore1 = host.getVM(0);
}
+ @Test
public void testLocalDataSetPR(){
dataStore1.invoke(() -> LocalFunctionExecutionDUnitTest.createCacheInVm());
Object args[] = new Object[] { "testRegion", new Integer(1), new Integer(50),
@@ -70,6 +71,7 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
dataStore1.invoke(() -> LocalFunctionExecutionDUnitTest.executeFunction());
}
+ @Test
public void testLocalDataSetDR(){
dataStore1.invoke(() -> LocalFunctionExecutionDUnitTest.createCacheInVm());
Object args[] = new Object[] { "testRegion",DataPolicy.REPLICATE };
@@ -78,13 +80,14 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
dataStore1.invoke(() -> LocalFunctionExecutionDUnitTest.executeFunction());
}
+ @Test
public void testLocalMember(){
dataStore1.invoke(() -> LocalFunctionExecutionDUnitTest.createCacheInVm());
dataStore1.invoke(() -> LocalFunctionExecutionDUnitTest.executeFunctionOnMember());
}
public static void createCacheInVm() {
- new LocalFunctionExecutionDUnitTest("temp").createCache();
+ new LocalFunctionExecutionDUnitTest().createCache();
}
public void createCache() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
index f8d4937..6b35900 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
@@ -16,9 +16,32 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.*;
-import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DM;
@@ -29,15 +52,18 @@ import com.gemstone.gemfire.i18n.LogWriterI18n;
import com.gemstone.gemfire.internal.ClassBuilder;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+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.lang.reflect.Constructor;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+@Category(DistributedTest.class)
+public class MemberFunctionExecutionDUnitTest extends JUnit4CacheTestCase {
-public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
private static final String TEST_FUNCTION6 = TestFunction.TEST_FUNCTION6;
private static final String TEST_FUNCTION5 = TestFunction.TEST_FUNCTION5;
@@ -50,10 +76,6 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
static InternalDistributedSystem ds = null;
- public MemberFunctionExecutionDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -68,32 +90,38 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = true
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecution()
throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers(new Integer(5)));
}
+ @Test
public void testRemoteMultiKeyExecution_SendException1() throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers_SendException( new Integer(1) ));
}
+ @Test
public void testRemoteMultiKeyExecution_SendException2() throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers_SendException( new Integer(4) ));
}
+ @Test
public void testRemoteMultiKeyExecution_SendException3() throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers_SendException( new Integer(5) ));
}
+ @Test
public void testRemoteMultiKeyExecution_NoLastResult() throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers_NoLastResult( new Integer(5) ));
}
+ @Test
public void testLocalMultiKeyExecution_NoLastResult() throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers_NoLastResult( new Integer(1) ));
@@ -104,12 +132,14 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = true
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecution_InlineFunction()
throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.excuteOnMembers_InlineFunction(new Integer(5)));
}
+ @Test
public void testBug45328() throws Exception {
createDistributedSystemAndRegisterFunction();
ClassBuilder classBuilder = new ClassBuilder();
@@ -149,6 +179,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
}
+ @Test
public void testBug40714() throws Exception {
createDistributedSystemAndRegisterFunction();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.registerFunction());
@@ -159,6 +190,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
+ @Test
public void testBug46129() throws Exception {
Properties props = new Properties();
member1.invoke(() -> MemberFunctionExecutionDUnitTest.connectToDistributedSystem( props ));
@@ -224,6 +256,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = false
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecutionNoResult()
throws Exception {
createDistributedSystemAndRegisterFunction();
@@ -234,6 +267,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = true
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecutiononLocalMember()
throws Exception {
createDistributedSystemAndRegisterFunction();
@@ -245,6 +279,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = true
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecutiononLocalMember_InlineFunction()
throws Exception {
createDistributedSystemAndRegisterFunction();
@@ -256,6 +291,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = true
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecutiononOtherMembers()
throws Exception {
createDistributedSystemAndRegisterFunction();
@@ -267,6 +303,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* haveResults = true
* @throws Exception
*/
+ @Test
public void testRemoteMultiKeyExecutiononOtherMembers_InlineFunction()
throws Exception {
createDistributedSystemAndRegisterFunction();
@@ -277,11 +314,13 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
* This tests make sure that, in case of LonerDistributedSystem we dont get ClassCast Exception.
* Just making sure that the function executed on lonerDistribuedSystem
*/
+ @Test
public void testBug41118()
throws Exception {
member1.invoke(() -> MemberFunctionExecutionDUnitTest.bug41118());
}
+ @Test
public void testOnMembersWithoutCache()
throws Exception {
DistributedMember member1Id = (DistributedMember) member1.invoke(new SerializableCallable() {
@@ -326,7 +365,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
public static void bug41118(){
- ds = new MemberFunctionExecutionDUnitTest("temp").getSystem();
+ ds = new MemberFunctionExecutionDUnitTest().getSystem();
assertNotNull(ds);
ds.disconnect();
Properties props = new Properties();
@@ -620,7 +659,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
public static void connectToDistributedSystem(Properties props) {
- new MemberFunctionExecutionDUnitTest("temp").createSystem(props);
+ new MemberFunctionExecutionDUnitTest().createSystem(props);
}
private InternalDistributedSystem createSystem(Properties props){
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
index a129af9..5388c9a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+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.HashSet;
import java.util.Properties;
import java.util.Set;
@@ -40,7 +49,8 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@SuppressWarnings("serial")
-public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class MultiRegionFunctionExecutionDUnitTest extends JUnit4CacheTestCase {
VM vm0 = null;
@@ -57,8 +67,8 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
static Region LR1 = null ;
static Cache cache = null ;
- public MultiRegionFunctionExecutionDUnitTest(String name) {
- super(name);
+ public MultiRegionFunctionExecutionDUnitTest() {
+ super();
}
@Override
@@ -76,6 +86,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
+ @Test
public void testMultiRegionFunctionExecution(){
vm0.invoke(() -> MultiRegionFunctionExecutionDUnitTest.createRegionsOnVm0());
vm1.invoke(() -> MultiRegionFunctionExecutionDUnitTest.createRegionsOnVm1());
@@ -158,7 +169,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
}
@SuppressWarnings("unchecked")
public static void createRegionsOnVm0() {
- new MultiRegionFunctionExecutionDUnitTest("temp").createCache();
+ new MultiRegionFunctionExecutionDUnitTest().createCache();
PartitionAttributesFactory pf = new PartitionAttributesFactory();
pf.setTotalNumBuckets(12);
@@ -178,7 +189,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
@SuppressWarnings("unchecked")
public static void createRegionsOnVm1() {
- new MultiRegionFunctionExecutionDUnitTest("temp").createCache();
+ new MultiRegionFunctionExecutionDUnitTest().createCache();
PartitionAttributesFactory pf = new PartitionAttributesFactory();
pf.setTotalNumBuckets(12);
@@ -198,7 +209,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
@SuppressWarnings("unchecked")
public static void createRegionsOnVm2() {
- new MultiRegionFunctionExecutionDUnitTest("temp").createCache();
+ new MultiRegionFunctionExecutionDUnitTest().createCache();
PartitionAttributesFactory pf = new PartitionAttributesFactory();
pf.setTotalNumBuckets(12);
@@ -227,7 +238,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
@SuppressWarnings("unchecked")
public static void createRegionsOnVm3() {
- new MultiRegionFunctionExecutionDUnitTest("temp").createCache();
+ new MultiRegionFunctionExecutionDUnitTest().createCache();
PartitionAttributesFactory pf = new PartitionAttributesFactory();
pf.setTotalNumBuckets(12);
@@ -255,7 +266,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
@SuppressWarnings("unchecked")
public static void createRegionsOnUnitControllerVm() {
- new MultiRegionFunctionExecutionDUnitTest("temp").createCache();
+ new MultiRegionFunctionExecutionDUnitTest().createCache();
PartitionAttributesFactory pf = new PartitionAttributesFactory();
pf.setTotalNumBuckets(12);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
index b2821cd..b84f55f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
@@ -17,6 +17,14 @@
package com.gemstone.gemfire.internal.cache.execute;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheClosedException;
@@ -24,26 +32,30 @@ import com.gemstone.gemfire.cache.CacheFactory;
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.execute.*;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Properties;
-
-/**
- *
- */
-public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
-
- public OnGroupsFunctionExecutionDUnitTest(String name) {
- super(name);
- }
+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.SerializableCallable;
+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.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCase {
@Override
public final void preTearDown() throws Exception {
@@ -167,8 +179,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
int count = 0;
synchronized (OnGroupsFunction.class) {
count = f.invocationCount;
- // f.invocationCount = 0;
- }
+ }
return count;
}
@@ -182,16 +193,18 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
OnGroupsFunction f = (OnGroupsFunction) FunctionService.getFunction(OnGroupsFunction.Id);
synchronized (OnGroupsFunction.class) {
f.invocationCount = 0;
- }
+ }
return null;
}
});
}
+ @Test
public void testBasicP2PFunctionNoCache() {
doBasicP2PFunctionNoCache(false);
}
+ @Test
public void testBasicP2pRegisteredFunctionNoCache() {
doBasicP2PFunctionNoCache(true);
}
@@ -301,6 +314,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
verifyAndResetInvocationCount(vm2, 1);
}
+ @Test
public void testonMember() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -367,6 +381,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testBasicP2PFunction() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -470,6 +485,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testP2PException () {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -524,6 +540,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testP2PMemberFailure() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -554,6 +571,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testP2POneMemberFailure() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -585,6 +603,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testP2PIgnoreMemberFailure() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -620,18 +639,22 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testBasicClientServerFunction() {
dotestBasicClientServerFunction(false, true);
}
+ @Test
public void testBasicClientServerRegisteredFunction() {
dotestBasicClientServerFunction(true, true);
}
+ @Test
public void testBasicClientServerFunctionNoArgs() {
dotestBasicClientServerFunction(false, false);
}
+ @Test
public void testBasicClientServerRegisteredFunctionNoArgs() {
dotestBasicClientServerFunction(true, false);
}
@@ -740,6 +763,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
verifyAndResetInvocationCount(server2, 1);
}
+ @Test
public void testStreamingClientServerFunction() {
Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -817,6 +841,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testOnServer() {
Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -897,6 +922,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
assertEquals(2, c0 + c1 + c2);
}
+ @Test
public void testClientServerException() {
Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -974,6 +1000,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testClientServerMemberFailure() {
Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1023,6 +1050,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testClientServerOneMemberFailure() {
Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1072,6 +1100,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testClientServerIgnoreMemberFailure() {
Host host = Host.getHost(0);
VM server0 = host.getVM(0);
@@ -1136,6 +1165,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testNoAckGroupsFunction() {
//Workaround for #52005. This is a product bug
//that should be fixed
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
index 0c33b5f..3f8f758 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+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.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -33,6 +42,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+@Category(DistributedTest.class)
public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServerTestBase{
/**
*
@@ -47,13 +57,14 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
private static final int NUM_ITERATION=1;
- public PRClientServerFunctionExecutionNoAckDUnitTest(String name) {
- super(name);
+ public PRClientServerFunctionExecutionNoAckDUnitTest() {
+ super();
}
/*
* Execution of the function on server using the name of the function
*/
+ @Test
public void testServerFunctionExecution_NoAck() {
createScenario();
@@ -71,6 +82,7 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
client.invoke(() -> PRClientServerFunctionExecutionNoAckDUnitTest.allServerExecution( isByName, functionNoAck , toRegister));
}
+ @Test
public void testServerFunctionExecution_NoAck_WithoutRegister() {
createScenario();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
index 4da6fbd..569fec7 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
@@ -16,13 +16,12 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
-import java.io.EOFException;
import java.io.IOException;
import java.io.Serializable;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
import java.rmi.ServerException;
import java.util.ArrayList;
import java.util.Collections;
@@ -32,6 +31,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheClosedException;
@@ -57,14 +59,16 @@ import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+@Category(DistributedTest.class)
public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServerTestBase {
+
private static final String TEST_FUNCTION7 = TestFunction.TEST_FUNCTION7;
private static final String TEST_FUNCTION2 = TestFunction.TEST_FUNCTION2;
@@ -77,10 +81,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
static final String retryRegionName = "RetryDataRegion";
- public PRClientServerRegionFunctionExecutionDUnitTest(String name) {
- super(name);
- }
-
+ @Test
public void test_Bug_43126_Function_Not_Registered()
throws InterruptedException {
createScenario();
@@ -94,6 +95,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
}
+ @Test
public void test_Bug43126() throws InterruptedException {
createScenario();
Function function = new TestFunction(true, TEST_FUNCTION2);
@@ -105,6 +107,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the function on server with single key as the routing
* object and using the name of the function
*/
+ @Test
public void testServerSingleKeyExecution_byName() {
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -134,6 +137,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
runOnAllServers(endSuspect);
}
+ @Test
public void testServerSingleKeyExecution_Bug43513_OnRegion() {
createScenario_SingleConnection();
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverSingleKeyExecutionOnRegion_SingleConnection());
@@ -144,6 +148,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverSingleKeyExecutionOnServer_SingleConnection());
}
+ @Test
public void testServerSingleKeyExecution_SendException() {
createScenario();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_SEND_EXCEPTION);
@@ -153,6 +158,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverSingleKeyExecution_SendException( isByName, toRegister));
}
+ @Test
public void testServerSingleKeyExecution_ThrowException() {
createScenario();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_THROW_EXCEPTION);
@@ -162,6 +168,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverSingleKeyExecution_ThrowException( isByName, toRegister));
}
+ @Test
public void testClientWithoutPool_Bug41832() {
createScenarioWith2Regions();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -195,6 +202,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the function on server with single key as the routing
* object and using the name of the function
*/
+ @Test
public void testServerExecution_NoLastResult() {
createScenario();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_NO_LASTRESULT);
@@ -208,6 +216,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
ex.remove();
}
+ @Test
public void testServerSingleKeyExecution_byName_WithoutRegister() {
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -243,11 +252,13 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* of HA then system should retry the function execution. After 5th attempt
* function will send Boolean as last result.
*/
+ @Test
public void testserverSingleKeyExecution_FunctionInvocationTargetException() {
createScenario();
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverSingleKeyExecution_FunctionInvocationTargetException());
}
+ @Test
public void testServerSingleKeyExecution_SocketTimeOut() {
createScenario();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_SOCKET_TIMEOUT);
@@ -260,6 +271,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the function on server with single key as the routing
* object and using the instance of the function
*/
+ @Test
public void testServerSingleKeyExecution_byInstance() {
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -273,6 +285,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the inline function on server with single key as the routing
* object
*/
+ @Test
public void testServerSingleKeyExecution_byInlineFunction() {
createScenario();
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverSingleKeyExecution_Inline());
@@ -282,6 +295,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the function on server with set multiple keys as the routing
* object and using the name of the function
*/
+ @Test
public void testserverMultiKeyExecution_byName(){
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -296,6 +310,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
/*
* Execution of the function on server with bucket as filter
*/
+ @Test
public void testBucketFilter(){
createScenarioForBucketFilter();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_BUCKET_FILTER);
@@ -313,6 +328,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
+ @Test
public void testBucketFilterOverride(){
createScenarioForBucketFilter();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_BUCKET_FILTER);
@@ -331,6 +347,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
+ @Test
public void testserverMultiKeyExecution_SendException(){
createScenario();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_SEND_EXCEPTION);
@@ -339,6 +356,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverMultiKeyExecution_SendException( isByName));
}
+ @Test
public void testserverMultiKeyExecution_ThrowException(){
createScenario();
Function function = new TestFunction(true,TestFunction.TEST_FUNCTION_THROW_EXCEPTION);
@@ -353,6 +371,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the inline function on server with set multiple keys as the routing
* object
*/
+ @Test
public void testserverMultiKeyExecution_byInlineFunction(){
createScenario();
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverMultiKeyExecution_Inline());
@@ -364,6 +383,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* this is the case of HA then system should retry the function execution.
* After 5th attempt function will send Boolean as last result.
*/
+ @Test
public void testserverMultiKeyExecution_FunctionInvocationTargetException() {
createScenario();
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.serverMultiKeyExecution_FunctionInvocationTargetException());
@@ -373,6 +393,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the function on server with set multiple keys as the routing
* object and using the name of the function
*/
+ @Test
public void testserverMultiKeyExecutionNoResult_byName(){
createScenario();
Function function = new TestFunction(false,TEST_FUNCTION7);
@@ -385,6 +406,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Execution of the function on server with set multiple keys as the routing
* object and using the instance of the function
*/
+ @Test
public void testserverMultiKeyExecution_byInstance(){
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -398,6 +420,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* that the routing logic works correctly such that there is not extra
* execution
*/
+ @Test
public void testserverMultiKeyExecutionOnASingleBucket_byName(){
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -411,6 +434,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* that the routing logic works correctly such that there is not extra
* execution
*/
+ @Test
public void testserverMultiKeyExecutionOnASingleBucket_byInstance(){
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
@@ -1532,6 +1556,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
* Attempt to do a client server function execution with an arg that fail deserialization
* on the server. The client should see an exception instead of a hang if bug 43430 is fixed.
*/
+ @Test
public void testBug43430() {
createScenario();
Function function = new TestFunction(true,TEST_FUNCTION2);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
index df7e9ae..f490e63 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
@@ -16,7 +16,24 @@
*/
package com.gemstone.gemfire.internal.cache.execute;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.execute.Execution;
@@ -32,27 +49,25 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
- PRClientServerTestBase {
+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.SerializableRunnable;
+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 PRClientServerRegionFunctionExecutionFailoverDUnitTest extends PRClientServerTestBase {
private static Locator locator = null;
private static Region region = null;
- public PRClientServerRegionFunctionExecutionFailoverDUnitTest(String name) {
- super(name);
- }
-
@Override
protected void postSetUpPRClientServerTestBase() throws Exception {
IgnoredException.addIgnoredException("Connection reset");
@@ -61,6 +76,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
IgnoredException.addIgnoredException("Socket Closed");
}
+ @Test
public void testserverMultiKeyExecution_SocektTimeOut() {
createScenario();
Function function = new TestFunction(true,
@@ -73,6 +89,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
* Ensure that the while executing the function if the servers is down then
* the execution is failover to other available server
*/
+ @Test
public void testServerFailoverWithTwoServerAliveHA()
throws InterruptedException {
IgnoredException.addIgnoredException("FunctionInvocationTargetException");
@@ -104,6 +121,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
* Ensure that the while executing the function if the servers is down then
* the execution is failover to other available server
*/
+ @Test
public void testServerCacheClosedFailoverWithTwoServerAliveHA()
throws InterruptedException {
IgnoredException.addIgnoredException("FunctionInvocationTargetException");
@@ -131,6 +149,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
assertEquals(2, l.size());
}
+ @Test
public void testBug40714() {
createScenario();
server1.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.registerFunction());
@@ -140,6 +159,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.FunctionExecution_Inline_Bug40714());
}
+ @Test
public void testOnRegionFailoverWithTwoServerDownHA()
throws InterruptedException {
IgnoredException.addIgnoredException("FunctionInvocationTargetException");
@@ -164,6 +184,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
}
// retry attempts is 2
+ @Test
public void testOnRegionFailoverWithOneServerDownHA()
throws InterruptedException {
IgnoredException.addIgnoredException("FunctionInvocationTargetException");
@@ -191,6 +212,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
* Ensure that the while executing the function if the servers are down then
* the execution shouldn't failover to other available server
*/
+ @Test
public void testOnRegionFailoverNonHA() throws InterruptedException { // See #47489 before enabling it
createScenario();
IgnoredException.addIgnoredException("FunctionInvocationTargetException");
@@ -215,6 +237,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
* Ensure that the while executing the function if the servers are down then
* the execution shouldn't failover to other available server
*/
+ @Test
public void testOnRegionFailoverNonHASingleHop() throws InterruptedException { // See #47489 before enabling it
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 0, 13, null);
@@ -271,6 +294,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(() -> PRClientServerRegionFunctionExecutionDUnitTest.verifyMetaData( new Integer(1), new Integer(0) ));
}
+ @Test
public void testServerBucketMovedException() throws InterruptedException {
IgnoredException.addIgnoredException("BucketMovedException");
@@ -293,18 +317,18 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
startLocatorInVM(portLocator);
try {
- Integer port1 = (Integer)server1.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createServerWithLocator( locator, false,
+ Integer port1 = (Integer)server1.invoke(() -> createServerWithLocator( locator, false,
commonAttributes ));
- Integer port2 = (Integer)server2.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createServerWithLocator( locator, false,
+ Integer port2 = (Integer)server2.invoke(() -> createServerWithLocator( locator, false,
commonAttributes ));
- server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createClientWithLocator( hostLocator, portLocator ));
+ server4.invoke(() -> createClientWithLocator( hostLocator, portLocator ));
server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.putIntoRegion());
server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.fetchMetaData());
- Integer port3 = (Integer)server3.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createServerWithLocator( locator, false,
+ Integer port3 = (Integer)server3.invoke(() -> createServerWithLocator( locator, false,
commonAttributes ));
Object result = server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.executeFunction());
@@ -316,6 +340,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
}
}
+ @Test
public void testServerBucketMovedException_LocalServer()
throws InterruptedException {
IgnoredException.addIgnoredException("BucketMovedException");
@@ -337,15 +362,15 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
startLocatorInVM(portLocator);
try {
- Integer port1 = (Integer)server1.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createServerWithLocator( locator, false,
+ Integer port1 = (Integer)server1.invoke(() -> createServerWithLocator( locator, false,
commonAttributes ));
- server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createClientWithLocator( hostLocator, portLocator ));
+ server4.invoke(() -> createClientWithLocator( hostLocator, portLocator ));
server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.putIntoRegion());
server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.fetchMetaData());
- Integer port2 = (Integer)server2.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.createServerWithLocator( locator, false,
+ Integer port2 = (Integer)server2.invoke(() -> createServerWithLocator( locator, false,
commonAttributes ));
Object result = server4.invoke(() -> PRClientServerRegionFunctionExecutionFailoverDUnitTest.executeFunction());
@@ -381,13 +406,11 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
locator.stop();
}
- public static int createServerWithLocator(String locator, boolean isAccessor, ArrayList commonAttrs) {
- CacheTestCase test = new PRClientServerRegionFunctionExecutionFailoverDUnitTest(
- "PRClientServerRegionFunctionExecutionFailoverDUnitTest");
+ public int createServerWithLocator(String locator, boolean isAccessor, ArrayList commonAttrs) {
Properties props = new Properties();
props = new Properties();
props.setProperty(LOCATORS, locator);
- DistributedSystem ds = test.getSystem(props);
+ DistributedSystem ds = getSystem(props);
cache = new CacheFactory(props).create(ds);
CacheServer server = cache.addCacheServer();
@@ -417,14 +440,12 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
return port;
}
- public static void createClientWithLocator(String host, int port0) {
+ public void createClientWithLocator(String host, int port0) {
Properties props = new Properties();
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PRClientServerRegionFunctionExecutionFailoverDUnitTest(
- "PRClientServerRegionFunctionExecutionFailoverDUnitTest");
- DistributedSystem ds = test.getSystem(props);
+ DistributedSystem ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
CacheServerTestUtil.disableShufflingOfEndpoints();