You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/03/01 01:09:25 UTC
[16/34] incubator-geode git commit: GEODE-1003 added dunit to verify
de-serialization failure in peer node
GEODE-1003 added dunit to verify de-serialization failure in peer node
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3dda21e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3dda21e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3dda21e5
Branch: refs/heads/feature/GEODE-949-2
Commit: 3dda21e5b65673920cd22fbbf9e8f5a4d2468a7c
Parents: e40962c
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Fri Feb 26 10:31:49 2016 -0800
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Fri Feb 26 10:31:49 2016 -0800
----------------------------------------------------------------------
.../DistributedMulticastRegionDUnitTest.java | 105 +++++++++++++++++++
1 file changed, 105 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3dda21e5/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
index 77e8253..72b7941 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
@@ -31,10 +31,15 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.ReplyException;
import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
+import com.gemstone.gemfire.pdx.PdxReader;
+import com.gemstone.gemfire.pdx.PdxSerializable;
+import com.gemstone.gemfire.pdx.PdxSerializationException;
+import com.gemstone.gemfire.pdx.PdxWriter;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.Invoke;
@@ -128,6 +133,106 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase {
closeLocator();
}
+ public class TestObjectThrowsException implements PdxSerializable {
+ String name = "TestObjectThrowsException";
+
+ @Override
+ public void toData(PdxWriter writer) {
+ writer.writeString("name", name);
+ }
+
+ @Override
+ public void fromData(PdxReader reader) {
+ throw new RuntimeException("Unable to desrialize message ");
+ //name = reader.readString("name");
+ }
+
+ }
+
+ public void testMulticastWithRegionOpsException() {
+ Host host = Host.getHost(0);
+ final VM vm0 = host.getVM(0);
+ final VM vm1 = host.getVM(1);
+
+ try {
+ final String name = "mcastRegion";
+
+ SerializableRunnable setSysProp = new CacheSerializableRunnable("Create Region") {
+ public void run2() throws CacheException {
+ System.setProperty("gemfire.STORE_ALL_VALUE_FORMS", "true");
+ }
+ };
+
+
+ SerializableRunnable create =
+ new CacheSerializableRunnable("Create Region") {
+ public void run2() throws CacheException {
+ createRegion(name, getRegionAttributes());
+ }
+ };
+
+ locatorPort = startLocator();
+
+ vm0.invoke(setSysProp);
+ vm1.invoke(setSysProp);
+
+ //1. start locator with mcast port
+ vm0.invoke(create);
+ vm1.invoke(create);
+
+ SerializableRunnable validateMulticastBeforeRegionOps =
+ new CacheSerializableRunnable("validateMulticast before region ops") {
+ public void run2() throws CacheException {
+ validateMulticastOpsBeforeRegionOps();
+ }
+ };
+
+ vm0.invoke(validateMulticastBeforeRegionOps);
+ vm1.invoke(validateMulticastBeforeRegionOps);
+
+ SerializableRunnable doPuts =
+ new CacheSerializableRunnable("do put") {
+ public void run2() throws CacheException {
+ final Region region =
+ getRootRegion().getSubregion(name);
+ boolean gotReplyException = false;
+ for(int i =0 ; i < 1; i++) {
+ try {
+ region.put(i, new TestObjectThrowsException());
+ }catch(PdxSerializationException e) {
+ gotReplyException = true;
+ }catch(Exception e ) {
+ region.getCache().getLogger().info("Got exception of type " + e.getClass().toString());
+ }
+ }
+ assertTrue("We should have got ReplyEception ", gotReplyException);
+ }
+ };
+
+ vm0.invoke(doPuts);
+
+ SerializableRunnable validateMulticastAfterRegionOps =
+ new CacheSerializableRunnable("validateMulticast after region ops") {
+ public void run2() throws CacheException {
+ validateMulticastOpsAfterRegionOps();
+ }
+ };
+
+ vm0.invoke(validateMulticastAfterRegionOps);
+ vm1.invoke(validateMulticastAfterRegionOps);
+
+ closeLocator();
+ }finally {
+ SerializableRunnable unsetSysProp = new CacheSerializableRunnable("Create Region") {
+ public void run2() throws CacheException {
+ System.setProperty("gemfire.STORE_ALL_VALUE_FORMS", "false");
+ }
+ };
+ vm0.invoke(unsetSysProp);
+ vm1.invoke(unsetSysProp);
+ }
+ }
+
protected RegionAttributes getRegionAttributes() {
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);