You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/02/20 00:59:28 UTC

[10/51] [abbrv] [partial] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature/GEODE-917

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
index fd50e63,0000000..960bd4e
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
@@@ -1,216 -1,0 +1,216 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package com.gemstone.gemfire.cache.query.internal.index;
 +
 +import java.io.IOException;
 +import java.util.HashMap;
 +import java.util.Map;
 +import java.util.Properties;
 +
 +import org.junit.Ignore;
 +import org.junit.experimental.categories.Category;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.Cache;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.CacheFactory;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.client.ClientCache;
 +import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 +import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 +import com.gemstone.gemfire.cache.query.data.PortfolioPdx;
 +import com.gemstone.gemfire.cache.query.dunit.RemoteQueryDUnitTest;
 +import com.gemstone.gemfire.cache.server.CacheServer;
 +import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 +import com.gemstone.gemfire.cache30.CacheTestCase;
 +import com.gemstone.gemfire.internal.AvailablePort;
 +import com.gemstone.gemfire.test.dunit.Assert;
 +import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.NetworkUtils;
 +import com.gemstone.gemfire.test.dunit.VM;
 +import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 +
 +/**
 + * @author shobhit
 + *
 + */
 +@Category(DistributedTest.class)
 +@Ignore("Test was disabled by renaming to DisabledTest")
 +public class PutAllWithIndexPerfDUnitTest extends CacheTestCase {
 +
 +  /** The port on which the bridge server was started in this VM */
 +  private static int bridgeServerPort;
 +  static long timeWithoutStructTypeIndex = 0;
 +  static long timeWithStructTypeIndex = 0;
 +  
 +  public PutAllWithIndexPerfDUnitTest(String name) {
 +    super(name);
 +  }
 +
 +  public void setUp() throws Exception {
 +    super.setUp();
 +    disconnectAllFromDS();
 +  }
 +
 +  @Override
 +  protected final void postTearDownCacheTestCase() throws Exception {
 +    disconnectAllFromDS();
 +  }
 +
 +  public void testPutAllWithIndexes() {
 +    final String name = "testRegion";
 +    final Host host = Host.getHost(0);
 +    VM vm0 = host.getVM(0);
 +    VM vm1 = host.getVM(1);
 +    final int numberOfEntries = 10000;
 +
 +    // Start server
 +    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
 +        public void run2() throws CacheException {
 +          Properties config = new Properties();
 +          config.put("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
 +          Cache cache = new CacheFactory(config).create();
 +          AttributesFactory factory = new AttributesFactory();
 +          factory.setScope(Scope.LOCAL);
 +          cache.createRegionFactory(factory.create()).create(name);
 +          try {
 +            startBridgeServer(0, false);
 +          } catch (Exception ex) {
 +            Assert.fail("While starting CacheServer", ex);
 +          }
 +          //Create Index on empty region
 +          try {
 +            cache.getQueryService().createIndex("idIndex", "ID", "/"+name);
 +          } catch (Exception e) {
 +            Assert.fail("index creation failed", e);
 +          }
 +        }
 +      });
 +
 +    // Create client region
-     final int port = vm0.invokeInt(PutAllWithIndexPerfDUnitTest.class, "getCacheServerPort");
++    final int port = vm0.invoke(() -> PutAllWithIndexPerfDUnitTest.getCacheServerPort());
 +    final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 +    vm1.invoke(new CacheSerializableRunnable("Create region") {
 +        public void run2() throws CacheException {
 +          Properties config = new Properties();
 +          config.setProperty("mcast-port", "0");
 +          ClientCache cache = new ClientCacheFactory().addPoolServer(host0, port).create();
 +          AttributesFactory factory = new AttributesFactory();
 +          factory.setScope(Scope.LOCAL);
 +          cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(name);
 +        }
 +      });
 +
 +    vm1.invoke(new CacheSerializableRunnable("putAll() test") {
 +      
 +      @Override
 +      public void run2() throws CacheException {
 +        Region exampleRegion = ClientCacheFactory.getAnyInstance().getRegion(name);
 +
 +        Map warmupMap = new HashMap();
 +        Map data =  new HashMap();
 +        for(int i=0; i<10000; i++){
 +          Object p = new PortfolioPdx(i);
 +          if (i < 1000) warmupMap.put(i, p);
 +          data.put(i, p);
 +        }
 +        
 +        for (int i=0; i<10; i++) {
 +          exampleRegion.putAll(warmupMap);
 +        }
 +        
 +        long start = System.currentTimeMillis();
 +        for (int i=0; i<10; i++) {
 +          exampleRegion.putAll(data);
 +        }
 +        long end = System.currentTimeMillis();
 +        timeWithoutStructTypeIndex = ((end-start)/10);
 +        System.out.println("Total putall time for 10000 objects is: "+ ((end-start)/10) + "ms");
 + 
 +      }
 +    });
 +    
 +    vm0.invoke(new CacheSerializableRunnable("Remove Index and create new one") {
 +      
 +      @Override
 +      public void run2() throws CacheException {
 +        try {
 +          Cache cache = CacheFactory.getAnyInstance();
 +          cache.getQueryService().removeIndexes();
 +          cache.getRegion(name).clear();
 +          cache.getQueryService().createIndex("idIndex", "p.ID", "/"+name+" p");
 +        } catch (Exception e) {
 +          Assert.fail("index creation failed", e);
 +        }
 +      }
 +    });
 +
 +    vm1.invoke(new CacheSerializableRunnable("putAll() test") {
 +      
 +      @Override
 +      public void run2() throws CacheException {
 +        Region exampleRegion = ClientCacheFactory.getAnyInstance().getRegion(name);
 +        exampleRegion.clear();
 +        Map warmupMap = new HashMap();
 +        Map data =  new HashMap();
 +        for(int i=0; i<10000; i++){
 +          Object p = new PortfolioPdx(i);
 +          if (i < 1000) warmupMap.put(i, p);
 +          data.put(i, p);
 +        }
 +        
 +        for (int i=0; i<10; i++) {
 +          exampleRegion.putAll(warmupMap);
 +        }
 +        
 +        long start = System.currentTimeMillis();
 +        for (int i=0; i<10; i++) {
 +          exampleRegion.putAll(data);
 +        }
 +        long end = System.currentTimeMillis();
 +        timeWithStructTypeIndex  = ((end-start)/10);
 +        System.out.println("Total putall time for 10000 objects is: "+ ((end-start)/10) + "ms");
 + 
 +      }
 +    });
 +    
 +    if (timeWithoutStructTypeIndex > timeWithStructTypeIndex) {
 +      fail("putAll took more time without struct type index than simple index");
 +    }
 +  }
 +
 +  /**
 +   * Starts a bridge server on the given port, using the given
 +   * deserializeValues and notifyBySubscription to serve up the
 +   * given region.
 +   */
 +  protected void startBridgeServer(int port, boolean notifyBySubscription)
 +    throws IOException {
 +
 +    Cache cache = CacheFactory.getAnyInstance();
 +    CacheServer bridge = cache.addCacheServer();
 +    bridge.setPort(port);
 +    bridge.start();
 +    bridgeServerPort = bridge.getPort();
 +  }
 +
 +  private static int getCacheServerPort() {
 +    return bridgeServerPort;
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/Bug34387DUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/Bug34387DUnitTest.java
index 9c35b1b,0000000..879600d
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/Bug34387DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/Bug34387DUnitTest.java
@@@ -1,174 -1,0 +1,174 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.CacheListener;
 +import com.gemstone.gemfire.cache.CacheTransactionManager;
 +import com.gemstone.gemfire.cache.DataPolicy;
 +import com.gemstone.gemfire.cache.EntryEvent;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.UnsupportedOperationInTransactionException;
 +import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 +import com.gemstone.gemfire.distributed.DistributedMember;
 +import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 +import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +/**
 + * Test create + localDestroy for bug 34387
 + *
 + * @author darrel
 + * @since 5.0
 + */
 +public class Bug34387DUnitTest extends CacheTestCase {
 +
 +//  private transient Region r;
 +//  private transient DistributedMember otherId;
 +  protected transient int invokeCount;
 +  
 +  static volatile boolean callbackFailure;
 +  
 +  public Bug34387DUnitTest(String name) {
 +    super(name);
 +  }
 +
 +  protected static void callbackAssertEquals(String message, Object expected, 
 +      Object actual) {
 +    if (expected == null && actual == null)
 +      return;
 +    if (expected != null && expected.equals(actual))
 +      return;
 +    callbackFailure = true;
 +    // Throws an error that is ignored, but...
 +    assertEquals(message, expected, actual);
 +  }
 +  
 +
 +  private VM getOtherVm() {
 +    Host host = Host.getHost(0);
 +    return host.getVM(0);
 +  }
 +    
 +  private void initOtherId() {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("Connect") {
 +        public void run2() throws CacheException {
 +          getCache();
 +        }
 +      });
-     vm.invoke(Bug34387DUnitTest.class, "getVMDistributedMember");
++    vm.invoke(() -> Bug34387DUnitTest.getVMDistributedMember());
 +  }
 +  private void doCommitOtherVm(final boolean doDestroy) {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("create root") {
 +        public void run2() throws CacheException {
 +          AttributesFactory af = new AttributesFactory();
 +          af.setScope(Scope.DISTRIBUTED_ACK);
 +          af.setConcurrencyChecksEnabled(true);
 +          Region r1 = createRootRegion("r1", af.create());
 +          CacheTransactionManager ctm =  getCache().getCacheTransactionManager();
 +          ctm.begin();
 +          r1.create("createKey", "createValue");
 +          if (doDestroy) {
 +            try {
 +              r1.localDestroy("createKey");
 +              fail("expected exception not thrown");
 +            } catch (UnsupportedOperationInTransactionException e) {
 +              assertEquals(e.getMessage(), LocalizedStrings.TXStateStub_LOCAL_DESTROY_NOT_ALLOWED_IN_TRANSACTION.toLocalizedString());
 +            }
 +          } else {
 +            try {
 +              r1.localInvalidate("createKey");
 +              fail("expected exception not thrown");
 +            } catch (UnsupportedOperationInTransactionException e) {
 +              assertEquals(e.getMessage(), LocalizedStrings.TXStateStub_LOCAL_INVALIDATE_NOT_ALLOWED_IN_TRANSACTION.toLocalizedString());
 +            }
 +          }
 +          ctm.commit();
 +        }
 +      });
 +  }
 +
 +  public static DistributedMember getVMDistributedMember() {
 +    return InternalDistributedSystem.getAnyInstance().getDistributedMember();
 +  }
 +  
 +  //////////////////////  Test Methods  //////////////////////
 +
 +  /**
 +   * test create followed by localDestroy
 +   */
 +  public void testCreateAndLD() throws CacheException {
 +    initOtherId();
 +    AttributesFactory af = new AttributesFactory();
 +    af.setDataPolicy(DataPolicy.REPLICATE);
 +    af.setScope(Scope.DISTRIBUTED_ACK);
 +    af.setConcurrencyChecksEnabled(true);
 +    callbackFailure = false;
 +    
 +    CacheListener cl1 = new CacheListenerAdapter() {
 +        public void afterCreate(EntryEvent e) {
 +          callbackAssertEquals("Keys not equal", "createKey", e.getKey());
 +          callbackAssertEquals("Values not equal", "createValue", e.getNewValue());
 +          Bug34387DUnitTest.this.invokeCount++;
 +        }
 +      };
 +    af.addCacheListener(cl1);
 +    Region r1 = createRootRegion("r1", af.create());
 +
 +    this.invokeCount = 0;
 +    assertNull(r1.getEntry("createKey"));
 +    doCommitOtherVm(true);
 +    assertNotNull(r1.getEntry("createKey"));
 +    assertEquals("createValue", r1.getEntry("createKey").getValue());
 +    assertEquals(1, this.invokeCount);
 +    assertFalse("Errors in callbacks; check logs for details", callbackFailure);
 +  }
 +  /**
 +   * test create followed by localInvalidate
 +   */
 +  public void testCreateAndLI() throws CacheException {
 +    initOtherId();
 +    AttributesFactory af = new AttributesFactory();
 +    af.setDataPolicy(DataPolicy.REPLICATE);
 +    af.setScope(Scope.DISTRIBUTED_ACK);
 +    af.setConcurrencyChecksEnabled(true);
 +    callbackFailure = false;
 +    
 +    CacheListener cl1 = new CacheListenerAdapter() {
 +        public void afterCreate(EntryEvent e) {
 +          callbackAssertEquals("key not equal", "createKey", e.getKey());
 +          callbackAssertEquals("value not equal", "createValue", e.getNewValue());
 +          Bug34387DUnitTest.this.invokeCount++;
 +        }
 +      };
 +    af.addCacheListener(cl1);
 +    Region r1 = createRootRegion("r1", af.create());
 +
 +    this.invokeCount = 0;
 +    assertNull(r1.getEntry("createKey"));
 +    doCommitOtherVm(false);
 +    assertNotNull(r1.getEntry("createKey"));
 +    assertEquals("createValue", r1.getEntry("createKey").getValue());
 +    assertEquals(1, this.invokeCount);
 +    assertFalse("Errors in callbacks; check logs for details", callbackFailure);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
index b889bc7,0000000..f7e1739
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
@@@ -1,534 -1,0 +1,534 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +/*
 + * CacheMapTxnDUnitTest.java
 + *
 + * Created on August 9, 2005, 11:18 AM
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.Properties;
 +import java.util.Set;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.Cache;
 +import com.gemstone.gemfire.cache.CacheFactory;
 +import com.gemstone.gemfire.cache.CacheTransactionManager;
 +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.UnsupportedOperationInTransactionException;
 +import com.gemstone.gemfire.distributed.DistributedSystem;
 +import com.gemstone.gemfire.test.dunit.Assert;
 +import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 +import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.ThreadUtils;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +public class CacheMapTxnDUnitTest extends DistributedTestCase{
 +    
 +    protected static Cache cache;
 +    protected static Properties props = new Properties();
 +    static DistributedSystem ds = null;
 +    static Region region;
 +    static Region mirroredRegion;
 +    protected static CacheTransactionManager cacheTxnMgr;
 +    
 +    /** Creates a new instance of CacheMapTxnDUnitTest */
 +    public CacheMapTxnDUnitTest(String name) {
 +        super(name);
 +    }
 +    
 +    @Override
 +    public void setUp() throws Exception {
 +      super.setUp();
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      VM vm1 = host.getVM(1);
-       vm0.invoke(CacheMapTxnDUnitTest.class, "createCache");
-       vm1.invoke(CacheMapTxnDUnitTest.class, "createCache");
++      vm0.invoke(() -> CacheMapTxnDUnitTest.createCache());
++      vm1.invoke(() -> CacheMapTxnDUnitTest.createCache());
 +    }
 +    
 +    @Override
 +    protected final void preTearDown() throws Exception {
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      VM vm1 = host.getVM(1);
-       vm0.invoke(CacheMapTxnDUnitTest.class, "closeCache");
-       vm1.invoke(CacheMapTxnDUnitTest.class, "closeCache");
++      vm0.invoke(() -> CacheMapTxnDUnitTest.closeCache());
++      vm1.invoke(() -> CacheMapTxnDUnitTest.closeCache());
 +    }
 +    
 +    public static void createCache(){
 +        try{
 +            //            props.setProperty("mcast-port", "1234");
 +            //            ds = DistributedSystem.connect(props);
 +            ds = (new CacheMapTxnDUnitTest("temp")).getSystem(props);
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            factory.setDataPolicy(DataPolicy.REPLICATE);
 +            RegionAttributes attr = factory.create();
 +            region = cache.createRegion("map", attr);
 +            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    public static void closeCache(){
 +        try{            
 +            cache.close();
 +            ds.disconnect();            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    public void testCommitTxn() {
 +        //this is to test single VM region transactions
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
-         vm0.invoke(CacheMapTxnDUnitTest.class, "commitTxn");
++        vm0.invoke(() -> CacheMapTxnDUnitTest.commitTxn());
 +    }//end of testCommitTxn
 +    
 +    public void testRollbackTxn() {
 +        //this is to test single VM region transactions
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
-         vm0.invoke(CacheMapTxnDUnitTest.class, "rollbackTxn");
++        vm0.invoke(() -> CacheMapTxnDUnitTest.rollbackTxn());
 +    }//end of testRollbackTxn
 +    
 +    public void testRollbackTxnClear() {
 +        //this is to test single VM region transactions
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        int i=0;
 +        Object ob2;
 +        Object [] objArr = new Object[1];
 +        
 +        for (i=0;i<5; i++){
 +            objArr [0] = ""+i;
 +            vm1.invoke(CacheMapTxnDUnitTest.class, "putMethod", objArr);
 +        }
 +        
-         vm0.invoke(CacheMapTxnDUnitTest.class, "rollbackTxnClear");
++        vm0.invoke(() -> CacheMapTxnDUnitTest.rollbackTxnClear());
 +        
 +        i=3;
 +        objArr [0] = ""+i;
 +        ob2 = vm1.invoke(CacheMapTxnDUnitTest.class, "getMethod", objArr);
 +        
 +        if(ob2 != null){
 +            fail("failed in testRollbackTxnClear");
 +        }
 +    }//end of testRollbackTxnClear
 +    
 +    public void testMiscMethods() throws Throwable{
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
-         vm0.invoke(CacheMapTxnDUnitTest.class, "miscMethodsOwner");
-         AsyncInvocation o2 = vm0.invokeAsync(CacheMapTxnDUnitTest.class, "miscMethodsNotOwner");//invoke in same vm but in seperate thread
-         AsyncInvocation o3 = vm1.invokeAsync(CacheMapTxnDUnitTest.class, "miscMethodsNotOwner");//invoke in another vm
++        vm0.invoke(() -> CacheMapTxnDUnitTest.miscMethodsOwner());
++        AsyncInvocation o2 = vm0.invokeAsync(() -> CacheMapTxnDUnitTest.miscMethodsNotOwner());//invoke in same vm but in seperate thread
++        AsyncInvocation o3 = vm1.invokeAsync(() -> CacheMapTxnDUnitTest.miscMethodsNotOwner());//invoke in another vm
 +        ThreadUtils.join(o2, 30 * 1000);
 +        ThreadUtils.join(o3, 30 * 1000);
 +        
 +        if(o2.exceptionOccurred()){
 +          Assert.fail("o2 failed", o2.getException());
 +        }
 +        
 +        if(o3.exceptionOccurred()){
 +          Assert.fail("o3 failed", o3.getException());
 +        }
 +        
 +    }//end of testMiscMethods
 +    
 +    
 +    //methods to be executed in remote vms...and called through vm.invoke
 +    
 +    public static void commitTxn(){
 +        try{
 +            cacheTxnMgr = cache.getCacheTransactionManager();
 +            int [] i = {0,1,2,3,4,5,6,7,8,9};
 +            Object o3;
 +            o3="init";
 +            region.put(""+i[0], "zero");
 +            region.create(""+i[5], "fifth");
 +            //begin transaction
 +            cacheTxnMgr.begin();
 +            region.put(""+i[1], "first");
 +            //test get
 +            o3 = region.get(""+i[1]);
 +            if( !(o3.toString().equals("first"))){
 +                fail("get inside transaction returns incorrect object");
 +            }
 +            
 +            //test remove
 +            region.put(""+i[2], "second");
 +            o3 = region.remove(""+i[2]);
 +            if( !(o3.toString().equals("second"))){
 +                fail("remove inside transaction returns incorrect object");
 +            }
 +            
 +            boolean flag = region.containsKey(""+i[2]);
 +            if (flag){
 +                fail("region.containsKey after region.remove inside txn returns incorrect value");
 +            }
 +            
 +            region.put(""+i[3], "third");
 +            region.put(""+i[0], "updatedZero");
 +
 +            // test putIfAbsent
 +            region.putIfAbsent(""+i[4], "fourth");
 +            if (!region.get(""+i[4]).toString().equals("fourth")) {
 +              fail("putIfAbsent inside transaction returns incorrect object");
 +            }
 +            
 +            // test replace
 +            region.replace(""+i[4], "fourth2");
 +            if (!region.get(""+i[4]).toString().equals("fourth2")) {
 +              fail("replace inside transaction returns incorrect object)");
 +            }
 +
 +            // test replace
 +            region.replace(""+i[4], "fourth2", "fourth3");
 +            if (!region.get(""+i[4]).toString().equals("fourth3")) {
 +              fail("replace inside transaction returns incorrect object)");
 +            }
 +            
 +            // test a failed removal
 +            boolean succeeded = region.remove(""+i[5], new Object());
 +            assertTrue(!succeeded);
 +            assertTrue(region.get(""+i[5]).equals("fifth"));
 +            
 +            // test remove
 +            region.remove(""+i[5]);
 +            
 +            //commit the transaction
 +            cacheTxnMgr.commit();
 +            
 +            //verify for persistent data now
 +            o3 = region.get(""+i[1]);
 +            if( !(o3.toString().equals("first"))){
 +                fail("get after committed transaction returns incorrect object");
 +            }
 +            
 +            o3 = region.get(""+i[2]);
 +            if(o3 != null){
 +                fail("get after committed transaction returns incorrect object");
 +            }
 +            
 +            o3 = region.get(""+i[3]);
 +            if( !(o3.toString().equals("third"))){
 +                fail("get after committed transaction returns incorrect object");
 +            }
 +            
 +            if (!region.get(""+i[4]).toString().equals("fourth3")) {
 +              fail("get after committed transaction returns incorrect object");
 +            }
 +            
 +            if (region.containsKey(""+i[5])) {
 +              fail("containsKey after committed transaction was true");
 +            }
 +            
 +            boolean val = region.containsValue("updatedZero");
 +            if(! val){
 +                fail("containsValue after committed transaction returns incorrect result");
 +            }
 +            
 +        }
 +        catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("failed in commitTxn");
 +        }
 +        finally{
 +            if(cacheTxnMgr.exists()){
 +                try {cacheTxnMgr.commit();} catch (Exception cce){cce.printStackTrace();}
 +            }
 +        }
 +        
 +    }//end of commitTxn
 +    
 +    
 +    public static void rollbackTxn(){
 +        try{
 +            cacheTxnMgr = cache.getCacheTransactionManager();
 +            int [] i = {0,1,2,3,4,5,6,7,8,9};
 +            Object o3;
 +            o3="init";
 +            region.put(""+i[0], "zero");
 +            region.put(""+i[5], "fifth");
 +            cacheTxnMgr.begin();
 +            region.put(""+i[1], "first");
 +            //test get
 +            o3 = region.get(""+i[1]);
 +            if( !(o3.toString().equals("first"))){
 +                fail("get inside transaction returns incorrect object");
 +            }
 +            
 +            //test containsValue
 +            boolean flag = region.containsValue(new String("first"));
 +            //assertEquals(true, flag);
 +            
 +            //test remove
 +            region.put(""+i[2], "second");
 +            o3 = region.remove(""+i[2]);
 +            if( !(o3.toString().equals("second"))){
 +                fail("remove inside transaction returns incorrect object");
 +            }
 +            
 +            region.put(""+i[3], "third");
 +            region.put(""+i[0], "updatedZero");
 +
 +            
 +            // test putIfAbsent
 +            region.putIfAbsent(""+i[4], "fourth");
 +            if (!region.get(""+i[4]).toString().equals("fourth")) {
 +              fail("putIfAbsent inside transaction returns incorrect object");
 +            }
 +            
 +            // test replace
 +            region.replace(""+i[4], "fourth2");
 +            if (!region.get(""+i[4]).toString().equals("fourth2")) {
 +              fail("replace inside transaction returns incorrect object)");
 +            }
 +
 +            // test replace
 +            region.replace(""+i[4], "fourth2", "fourth3");
 +            if (!region.get(""+i[4]).toString().equals("fourth3")) {
 +              fail("replace inside transaction returns incorrect object)");
 +            }
 +            
 +            // test a failed removal
 +            boolean succeeded = region.remove(""+i[5], new Object());
 +            assertTrue(!succeeded);
 +            assertTrue(region.get(""+i[5]).equals("fifth"));
 +
 +            // test remove
 +            region.remove(""+i[5]);
 +            
 +            //rollback the transaction
 +            cacheTxnMgr.rollback();
 +            
 +            //verify for persistent data now
 +            o3 = region.get(""+i[1]);
 +            if( o3 != null){ //null?
 +                fail("get after rolled back transaction returns incorrect object");
 +            }
 +            
 +            o3 = region.get(""+i[2]);
 +            if( o3 != null){ //null?
 +                fail("get after rolled back transaction returns incorrect object");
 +            }
 +            
 +            o3 = region.get(""+i[3]);
 +            if( o3 != null){ //null?
 +                fail("get after rolled back transaction returns incorrect object");
 +            }
 +            
 +            o3 = region.get(""+i[4]);
 +            if( o3 != null){ //null?
 +                fail("get after rolled back transaction returns incorrect object");
 +            }
 +            
 +            o3 = region.get(""+i[5]);
 +            if (o3 == null) {
 +              fail("get after rolled back transaction returns incorrect object");
 +            }
 +            
 +            //            boolean val = region.containsValue("zero");
 +            //            if( !val){
 +            //                fail("containsValue after rolled back transaction returns incorrect result");
 +            //            }
 +            
 +        }
 +        catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("failed in rollbackTxn");
 +        }
 +        finally{
 +            if(cacheTxnMgr.exists()){
 +                try {cacheTxnMgr.commit();} catch (Exception cce){cce.printStackTrace();}
 +            }
 +        }
 +        
 +    }//end of rollbackTxn
 +    
 +    public static void rollbackTxnClear(){
 +        try{
 +            cacheTxnMgr = cache.getCacheTransactionManager();
 +            int [] i = {0,1,2,3,4,5,6,7,8,9};
 +            region.put(""+i[0], "zero");
 +            //begin transaction
 +            cacheTxnMgr.begin();
 +            region.put(""+i[1], "first");
 +            region.put(""+i[0], "updatedZero");
 +            
 +            try {
 +              region.clear(); //clear is not transactional operation
 +              fail("excpected exception not thrown");
 +            } catch (UnsupportedOperationInTransactionException e) {
 +            }
 +            
 +            //rollback the transaction
 +            cacheTxnMgr.rollback();
 +            
 +            //verify for persistent data now
 +            
 +            boolean val = region.containsValue("updatedZero");
 +            if(val){
 +                fail("containsValue after region.clear & rolled back transaction returns incorrect result");
 +            }
 +            region.clear();
 +            val = region.containsValue("first");
 +            if(val){
 +                fail("containsValue after region.clear & rolled back transaction returns incorrect result");
 +            }
 +            
 +        }
 +        catch(Exception ex){
 +            cacheTxnMgr = null;
 +            ex.printStackTrace();
 +            fail("failed in rollbackTxnClear");
 +        }
 +        
 +    }//end of rollbackTxnClear
 +    
 +    public static void miscMethodsOwner(){
 +        try{
 +            cacheTxnMgr = cache.getCacheTransactionManager();
 +            int [] i = {0,1,2,3,4,5,6,7,8,9};
 +            region.clear();
 +            region.put(""+i[0], "zero");
 +            region.put(""+i[1], "first");
 +            region.put(""+i[2], "second");
 +            region.put(""+i[3], "third");
 +            
 +            cacheTxnMgr.begin();
 +            region.put(""+i[4], "forth");
 +            region.put(""+i[5], "fifth");
 +            
 +            //test size method
 +            int j = region.size();
 +            if(j != 6){
 +                fail("region.size inside transaction returns incorrect results");
 +            }
 +            
 +            //test entrySet method
 +            Set set = region.entrySet();
 +            int k = set.size();
 +            if(j != 6){
 +                fail("region.entrySet inside transaction returns incorrect results");
 +            }
 +            
 +            //test keySet method
 +            set = region.keySet();
 +            k = set.size();
 +            if(j != 6){
 +                fail("region.keySet inside transaction returns incorrect results");
 +            }
 +            
 +            boolean val = region.containsValue("forth");
 +            if( !val){
 +                fail("containsValue inside transaction returns incorrect result");
 +            }
 +            
 +            //commit the transaction
 +            cacheTxnMgr.rollback();
 +            
 +            //verify for persistent data now
 +            
 +        }
 +        catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("failed in miscMethodsOwner");
 +        }
 +        finally{
 +            if(cacheTxnMgr.exists()){
 +                try {cacheTxnMgr.commit();} catch (Exception cce){cce.printStackTrace();}
 +            }
 +        }
 +        
 +    }//end of miscMethodsOwner
 +    
 +    public static void miscMethodsNotOwner(){
 +        try{
 +//            int [] i = {0,1,2,3,4,5,6,7,8,9};
 +            //it is assumed that there are already four committed entried inside region
 +            //test size method
 +            int j = region.size();
 +            if(j != 4){
 +                fail("region.size for not owner of transaction returns incorrect results, size is "+j+ " but expected 4");
 +            }
 +            
 +            //test entrySet method
 +            Set set = region.entrySet();
 +            int k = set.size();
 +            if(j != 4){
 +                fail("region.entrySet for not owner of transaction returns incorrect results");
 +            }
 +            
 +            //test keySet method
 +            set = region.keySet();
 +            k = set.size();
 +            if(j != 4){
 +                fail("region.keySet for not owner of transaction returns incorrect results");
 +            }
 +            boolean val = region.containsKey("forth");
 +            if(val){
 +                fail("containsValue for not owner of transaction returns incorrect result");
 +            }
 +            
 +        }
 +        catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("failed in miscMethodsNotOwner");
 +        }
 +    }//end of miscMethodsNotOwner
 +    
 +    
 +    
 +    //helper methods
 +    public static Object putMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            if(ob != null){
 +                String str = "first";
 +                obj = region.put(ob, str);
 +            }
 +        }catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("Failed while region.put");
 +        }
 +        return obj;
 +    }
 +    
 +    public static Object getMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            obj = region.get(ob);
 +        } catch(Exception ex){
 +            fail("Failed while region.get");
 +        }
 +        return obj;
 +    }
 +    
 +    
 +}//end of test class

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
index c0a1fc4,0000000..c3f97f7
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
@@@ -1,111 -1,0 +1,111 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.DataPolicy;
 +import com.gemstone.gemfire.cache.InterestPolicy;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.SubscriptionAttributes;
 +import com.gemstone.gemfire.distributed.DistributedMember;
 +import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +/**
 + * Make sure that create are distributed and done in
 + * remote regions that are CACHED_ALL_EVENTS*.
 + *
 + * @author darrel
 + * @since 5.0
 + */
 +public class CachedAllEventsDUnitTest extends CacheTestCase {
 +
 +//  private transient Region r;
 +//  private transient DistributedMember otherId;
 +//  private transient int invokeCount;
 +  
 +  public CachedAllEventsDUnitTest(String name) {
 +    super(name);
 +  }
 +
 +  private VM getOtherVm() {
 +    Host host = Host.getHost(0);
 +    return host.getVM(0);
 +  }
 +    
 +  private void initOtherId() {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("Connect") {
 +        public void run2() throws CacheException {
 +          getCache();
 +        }
 +      });
-     vm.invoke(CachedAllEventsDUnitTest.class, "getVMDistributedMember");
++    vm.invoke(() -> CachedAllEventsDUnitTest.getVMDistributedMember());
 +  }
 +  private void doCreateOtherVm() {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("create root") {
 +        public void run2() throws CacheException {
 +          AttributesFactory af = new AttributesFactory();
 +          af.setScope(Scope.DISTRIBUTED_ACK);
 +          Region r1 = createRootRegion("r1", af.create());
 +          r1.create("key", "value");
 +        }
 +      });
 +  }
 +
 +  public static DistributedMember getVMDistributedMember() {
 +    return InternalDistributedSystem.getAnyInstance().getDistributedMember();
 +  }
 +  
 +  //////////////////////  Test Methods  //////////////////////
 +
 +  /**
 +   * make sure a remote create will be done in a NORMAL+ALL region
 +   * @param rmtCreate is true if create should happen in remote region
 +   */
 +  private void remoteCreate(DataPolicy dp, InterestPolicy ip, boolean rmtCreate) throws CacheException {
 +    initOtherId();
 +    AttributesFactory af = new AttributesFactory();
 +    af.setDataPolicy(dp);
 +    af.setSubscriptionAttributes(new SubscriptionAttributes(ip));
 +    af.setScope(Scope.DISTRIBUTED_ACK);
 +    Region r1 = createRootRegion("r1", af.create());
 +
 +    assertEquals(false, r1.containsKey("key"));
 +    doCreateOtherVm();
 +    if (rmtCreate) {
 +      assertEquals(true, r1.containsKey("key"));
 +      assertEquals("value", r1.getEntry("key").getValue());
 +    } else {
 +      assertEquals(false, r1.containsKey("key"));
 +    }
 +  }
 +  // TODO these are never used
 +  public void testRemoteCreate_CAE() throws CacheException {
 +    remoteCreate(DataPolicy.NORMAL, InterestPolicy.ALL, true);
 +  }
 +  public void testRemoteCreate_CAER() throws CacheException {
 +    remoteCreate(DataPolicy.REPLICATE, InterestPolicy.CACHE_CONTENT, true);
 +  }
 +  public void testRemoteCreate_C() throws CacheException {
 +    remoteCreate(DataPolicy.NORMAL, InterestPolicy.CACHE_CONTENT, false);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/CallbackArgDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/CallbackArgDUnitTest.java
index 49e38c0,0000000..f0bae93
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CallbackArgDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CallbackArgDUnitTest.java
@@@ -1,185 -1,0 +1,185 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.ArrayList;
 +import java.util.Arrays;
 +import java.util.Iterator;
 +import java.util.List;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.CacheListener;
 +import com.gemstone.gemfire.cache.CacheTransactionManager;
 +import com.gemstone.gemfire.cache.DataPolicy;
 +import com.gemstone.gemfire.cache.EntryEvent;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.TransactionEvent;
 +import com.gemstone.gemfire.cache.TransactionListener;
 +import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 +import com.gemstone.gemfire.cache.util.TransactionListenerAdapter;
 +import com.gemstone.gemfire.distributed.DistributedMember;
 +import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.SerializableCallable;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +/**
 + * Test the getCallbackArgument in light of bug 34075.
 + *
 + * @author darrel
 + * @since 5.0
 + */
 +public class CallbackArgDUnitTest extends CacheTestCase {
 +
 +//  private transient Region r;
 +//  private transient DistributedMember otherId;
 +  protected transient int invokeCount;
 +  protected static String callbackArg;
 +  
 +  public CallbackArgDUnitTest(String name) {
 +    super(name);
 +  }
 +
 +  private VM getOtherVm() {
 +    Host host = Host.getHost(0);
 +    return host.getVM(0);
 +  }
 +    
 +  private void initOtherId() {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("Connect") {
 +        public void run2() throws CacheException {
 +          getCache();
 +        }
 +      });
-     vm.invoke(CallbackArgDUnitTest.class, "getVMDistributedMember");
++    vm.invoke(() -> CallbackArgDUnitTest.getVMDistributedMember());
 +  }
 +  private void doCommitOtherVm() {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("create root") {
 +        public void run2() throws CacheException {
 +          AttributesFactory af = new AttributesFactory();
 +          CacheListener cl1 = new CacheListenerAdapter() {
 +              public void afterCreate(EntryEvent e) {
 +                assertEquals(callbackArg, e.getCallbackArgument());
 +              }
 +            };
 +          af.addCacheListener(cl1);
 +          af.setScope(Scope.DISTRIBUTED_ACK);
 +          Region r1 = createRootRegion("r1", af.create());
 +          Region r2 = r1.createSubregion("r2", af.create());
 +          Region r3 = r2.createSubregion("r3", af.create());
 +          CacheTransactionManager ctm =  getCache().getCacheTransactionManager();
 +          TransactionListener tl1 = new TransactionListenerAdapter() {
 +              public void afterCommit(TransactionEvent e) {
 +                assertEquals(6, e.getEvents().size());
 +                Iterator it = e.getEvents().iterator();
 +                while (it.hasNext()) {
 +                  EntryEvent ee = (EntryEvent)it.next();
 +                  assertEquals(callbackArg, ee.getCallbackArgument());
 +                  assertEquals(true, ee.isCallbackArgumentAvailable());
 +                }
 +              }
 +            };
 +          ctm.addListener(tl1);
 +          ctm.begin();
 +          r2.put("b", "value1", callbackArg);
 +          r3.put("c", "value2", callbackArg);
 +          r1.put("a", "value3", callbackArg);
 +          r1.put("a2", "value4", callbackArg);
 +          r3.put("c2", "value5", callbackArg);
 +          r2.put("b2", "value6", callbackArg);
 +          ctm.commit();
 +        }
 +      });
 +  }
 +
 +  public static DistributedMember getVMDistributedMember() {
 +    return InternalDistributedSystem.getAnyInstance().getDistributedMember();
 +  }
 +  
 +  //////////////////////  Test Methods  //////////////////////
 +
 +  List expectedKeys;
 +  int clCount = 0;
 +
 +  Object getCurrentExpectedKey() {
 +    Object result = this.expectedKeys.get(this.clCount);
 +    this.clCount += 1;
 +    return result;
 +  }
 +  /**
 +   * make sure callback arg is NOT_AVAILABLE in all the places it should be
 +   */
 +  public void testForNA_CA() throws CacheException {
 +    doTest();
 +  }
 +  public void testForCA() throws Exception {
 +    callbackArg = "cbArg";
 +    getOtherVm().invoke(new SerializableCallable() {
 +      public Object call() throws Exception {
 +        callbackArg = "cbArg";
 +        return null;
 +      }
 +    });
 +    doTest();
 +  }
 +  private void doTest() throws CacheException {
 +    initOtherId();
 +    AttributesFactory af = new AttributesFactory();
 +    af.setDataPolicy(DataPolicy.REPLICATE);
 +    af.setScope(Scope.DISTRIBUTED_ACK);
 +    CacheListener cl1 = new CacheListenerAdapter() {
 +        public void afterCreate(EntryEvent e) {
 +          assertEquals(getCurrentExpectedKey(), e.getKey());
 +          assertEquals(callbackArg, e.getCallbackArgument());
 +          assertEquals(true, e.isCallbackArgumentAvailable());
 +        }
 +      };
 +    af.addCacheListener(cl1);
 +    Region r1 = createRootRegion("r1", af.create());
 +    Region r2 = r1.createSubregion("r2", af.create());
 +    r2.createSubregion("r3", af.create());
 +
 +    TransactionListener tl1 = new TransactionListenerAdapter() {
 +        public void afterCommit(TransactionEvent e) {
 +          assertEquals(6, e.getEvents().size());
 +          ArrayList keys = new ArrayList();
 +          Iterator it = e.getEvents().iterator();
 +          while (it.hasNext()) {
 +            EntryEvent ee = (EntryEvent)it.next();
 +            keys.add(ee.getKey());
 +            assertEquals(callbackArg, ee.getCallbackArgument());
 +            assertEquals(true, ee.isCallbackArgumentAvailable());
 +          }
 +          assertEquals(CallbackArgDUnitTest.this.expectedKeys, keys);
 +          CallbackArgDUnitTest.this.invokeCount = 1;
 +        }
 +      };
 +    CacheTransactionManager ctm =  getCache().getCacheTransactionManager();
 +    ctm.addListener(tl1);
 +
 +    this.invokeCount = 0;
 +    this.clCount = 0;
 +    this.expectedKeys = Arrays.asList(new String[]{"b", "c", "a", "a2", "c2", "b2"});
 +    doCommitOtherVm();
 +    assertEquals(1, this.invokeCount);
 +    assertEquals(6, this.clCount);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
index 1d5b621,0000000..e748a42
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
@@@ -1,249 -1,0 +1,249 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +/*
 + * ClearMultiVmCallBkDUnitTest.java
 + *
 + * Created on August 11, 2005, 7:37 PM
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.Properties;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.Cache;
 +import com.gemstone.gemfire.cache.CacheFactory;
 +import com.gemstone.gemfire.cache.CacheListener;
 +import com.gemstone.gemfire.cache.CacheTransactionManager;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.RegionAttributes;
 +import com.gemstone.gemfire.cache.RegionEvent;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 +import com.gemstone.gemfire.distributed.DistributedSystem;
 +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.VM;
 +
 +/**
 + *
 + * @author  prafulla/vjadhav
 + */
 +public class ClearMultiVmCallBkDUnitTest extends DistributedTestCase{
 +    
 +    /** Creates a new instance of ClearMultiVmCallBkDUnitTest */
 +    public ClearMultiVmCallBkDUnitTest(String name) {
 +        super(name);
 +    }
 +    
 +    static Cache cache;
 +    static Properties props = new Properties();
 +    static Properties propsWork = new Properties();
 +    static DistributedSystem ds = null;
 +    static Region region;
 +    static Region paperWork;
 +    static CacheTransactionManager cacheTxnMgr;
 +    static boolean afterClear=false;
 +    
 +    
 +    @Override
 +    public void setUp() throws Exception {
 +      super.setUp();
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      VM vm1 = host.getVM(1);
-       vm0.invoke(ClearMultiVmCallBkDUnitTest.class, "createCache");
-       vm1.invoke(ClearMultiVmCallBkDUnitTest.class, "createCache");
++      vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.createCache());
++      vm1.invoke(() -> ClearMultiVmCallBkDUnitTest.createCache());
 +      LogWriterUtils.getLogWriter().fine("Cache created in successfully");
 +    }
 +    
 +    @Override
 +    protected final void preTearDown() throws Exception {
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      VM vm1 = host.getVM(1);
-       vm0.invoke(ClearMultiVmCallBkDUnitTest.class, "closeCache");
-       vm1.invoke(ClearMultiVmCallBkDUnitTest.class, "closeCache");
++      vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.closeCache());
++      vm1.invoke(() -> ClearMultiVmCallBkDUnitTest.closeCache());
 +    }
 +    
 +    public static void createCache(){
 +        try{
 +            CacheListener aListener = new ListenerCallBk();
 +//            props.setProperty("mcast-port", "1234");
 +//            ds = DistributedSystem.connect(props);
 +            ds = (new ClearMultiVmCallBkDUnitTest("temp")).getSystem(props);            
 +            
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            
 +            // Set Cachelisterner : aListener
 +            
 +            factory.setCacheListener(aListener);
 +            RegionAttributes attr = factory.create();
 +            
 +            region = cache.createRegion("map", attr);
 +            
 +            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    public static void closeCache(){
 +        try{
 +            
 +            cache.close();
 +            ds.disconnect();
 +            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    //test methods
 +    
 +    public void testClearSingleVM(){
 +        
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        //VM vm1 = host.getVM(1);
 +        
 +//        Object obj0;
 +//        Object obj1;
 +        Object[] objArr = new Object[1];
 +        for (int i=1; i<4; i++){
 +            objArr[0] = ""+i;
 +            vm0.invoke(ClearMultiVmCallBkDUnitTest.class, "putMethod", objArr);
 +            
 +        }
 +        LogWriterUtils.getLogWriter().fine("Did all puts successfully");
 +        
-         vm0.invoke(ClearMultiVmCallBkDUnitTest.class,"clearMethod");
++        vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.clearMethod());
 +        LogWriterUtils.getLogWriter().fine("Did clear successfully");
 +        
 +        while(afterClear){
 +        }       
 +        
-         int Regsize = vm0.invokeInt(ClearMultiVmCallBkDUnitTest.class, "sizeMethod");
++        int Regsize = vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.sizeMethod());
 +        assertEquals(1, Regsize);
 +        
 +        
 +    }//end of test case1
 +    
 +     public void testClearMultiVM(){
 +        
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        Object[] objArr = new Object[1];
 +        for (int i=1; i<4; i++){
 +            objArr[0] = ""+i;
 +            vm0.invoke(ClearMultiVmCallBkDUnitTest.class, "putMethod", objArr);
 +            vm1.invoke(ClearMultiVmCallBkDUnitTest.class, "getMethod", objArr);
 +        }
 +        LogWriterUtils.getLogWriter().fine("Did all puts successfully");
-         //vm0.invoke(ClearMultiVmCallBkDUnitTest.class,"putMethod");
-         vm1.invoke(ClearMultiVmCallBkDUnitTest.class,"clearMethod");
++        //vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.putMethod());
++        vm1.invoke(() -> ClearMultiVmCallBkDUnitTest.clearMethod());
 +        LogWriterUtils.getLogWriter().fine("Did clear successfully");
 +        
 +        while(afterClear){
 +        }       
 +        
-         int Regsize = vm0.invokeInt(ClearMultiVmCallBkDUnitTest.class, "sizeMethod");
++        int Regsize = vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.sizeMethod());
 +        assertEquals(1, Regsize);
 +        
 +        
 +    }//end of test case2
 +    
 +    public static Object putMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            if(ob != null){
 +                String str = "first";
 +                obj = region.put(ob, str);
 +            }
 +        }catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("Failed while region.put");
 +        }
 +        return obj;
 +    }
 +    
 +    public static Object getMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            obj = region.get(ob);
 +        } catch(Exception ex){
 +            fail("Failed while region.get");
 +        }
 +        return obj;
 +    }
 +    
 +    public static boolean containsValueMethod(Object ob){
 +        boolean flag = false;
 +        try{
 +            flag = region.containsValue(ob);
 +        }catch(Exception ex){
 +            fail("Failed while region.containsValueMethod");
 +        }
 +        return flag;
 +    }
 +    
 +    public static int sizeMethod(){
 +        int i=0;
 +        try{
 +            i = region.size();
 +        }catch(Exception ex){
 +            fail("Failed while region.size");
 +        }
 +        return i;
 +    }
 +    
 +    public static void clearMethod(){
 +        try{
 +            region.clear();
 +        } catch(Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    public static boolean getBoolean(){
 +        return afterClear;
 +    }
 +    
 +    static class ListenerCallBk extends CacheListenerAdapter {
 +  
 +        public void afterRegionClear(RegionEvent event){
 +            LogWriterUtils.getLogWriter().fine("In afterClear:: CacheListener Callback");
 +            try {
 +                int i = 7;
 +                region.put(""+i, "inAfterClear");
 +                afterClear = true;
 +            }catch (Exception e){
 +                //
 +            }
 +            
 +        }
 +        
 +    }
 +    
 +    
 +    
 +}//end of class

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
index 8553fe6,0000000..5f9450b
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
@@@ -1,469 -1,0 +1,467 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +/*
 + * ClearMultiVmDUnitTest.java
 + *
 + * Created on August 11, 2005, 7:37 PM
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.Properties;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.Cache;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.CacheFactory;
 +import com.gemstone.gemfire.cache.CacheTransactionManager;
 +import com.gemstone.gemfire.cache.DataPolicy;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.RegionAttributes;
 +import com.gemstone.gemfire.cache.RegionDestroyedException;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.UnsupportedOperationInTransactionException;
 +import com.gemstone.gemfire.distributed.DistributedSystem;
 +import com.gemstone.gemfire.test.dunit.Assert;
 +import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 +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.SerializableRunnable;
 +import com.gemstone.gemfire.test.dunit.ThreadUtils;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +/**
 + *
 + * @author  prafulla
 + */
 +public class ClearMultiVmDUnitTest extends DistributedTestCase{
 +    
 +    /** Creates a new instance of ClearMultiVmDUnitTest */
 +    public ClearMultiVmDUnitTest(String name) {
 +        super(name);
 +    }
 +    
 +    static Cache cache;
 +    static Properties props = new Properties();
 +    static Properties propsWork = new Properties();
 +    static DistributedSystem ds = null;
 +    static Region region;
 +    static Region paperWork;
 +    static Region mirroredRegion;
 +    static CacheTransactionManager cacheTxnMgr;
 +    
 +    @Override
 +    public void setUp() throws Exception {
 +      super.setUp();
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      VM vm1 = host.getVM(1);
-       vm0.invoke(ClearMultiVmDUnitTest.class, "createCache");
-       vm1.invoke(ClearMultiVmDUnitTest.class, "createCache");
++      vm0.invoke(() -> ClearMultiVmDUnitTest.createCache());
++      vm1.invoke(() -> ClearMultiVmDUnitTest.createCache());
 +    }
 +    
 +    @Override
 +    protected final void preTearDown() throws Exception {
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      VM vm1 = host.getVM(1);
-       vm0.invoke(ClearMultiVmDUnitTest.class, "closeCache");
-       vm1.invoke(ClearMultiVmDUnitTest.class, "closeCache");
++      vm0.invoke(() -> ClearMultiVmDUnitTest.closeCache());
++      vm1.invoke(() -> ClearMultiVmDUnitTest.closeCache());
 +      cache = null;
 +      Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
 +    }
 +    
 +    public static void createCache(){
 +        try{            
 +            ds = (new ClearMultiVmDUnitTest("temp")).getSystem(props);
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            factory.setConcurrencyChecksEnabled(true);
 +            RegionAttributes attr = factory.create();
 +            region = cache.createRegion("map", attr);
 +            
 +            AttributesFactory factory1  = new AttributesFactory();
 +            factory1.setScope(Scope.DISTRIBUTED_ACK);
 +            factory.setConcurrencyChecksEnabled(true);
 +            factory1.setDataPolicy(DataPolicy.REPLICATE);
 +            paperWork = cache.createRegion("paperWork", factory1.create());
 +            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    public static void closeCache(){
 +        try{
 +            cache.close();
 +            ds.disconnect();
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    //test methods
 +    
 +    public void testClearSimpleScenarios(){
 +        
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        //verifying Single VM clear functionalities
 +        vm0.invoke(new CacheSerializableRunnable("temp1"){
 +            public void run2()throws CacheException{
 +                region.put(new Integer(1), new String("first"));
 +                region.put(new Integer(2), new String("second"));
 +                region.put(new Integer(3), new String("third"));
 +                region.clear();
 +                assertEquals(0, region.size());
 +            }
 +        }
 +        );
 +        
 +        vm1.invoke(new CacheSerializableRunnable("temp1vm1"){
 +            public void run2()throws CacheException{
 +                assertEquals(0, region.size());
 +            }
 +        }
 +        );
 +        
 +        //verifying Single VM and single transaction clear functionalities
 +        vm1.invoke(new CacheSerializableRunnable("temp2"){
 +            public void run2() throws CacheException{
 +                try{
 +                    region.put(new Integer(1), new String("first"));
 +                    region.put(new Integer(2), new String("second"));
 +                    region.put(new Integer(3), new String("third"));
 +                    cacheTxnMgr = cache.getCacheTransactionManager();
 +                    cacheTxnMgr.begin();
 +                    region.put(new Integer(4), new String("forth"));
 +                    try {
 +                      region.clear();
 +                      fail("expected exception not thrown");
 +                    } catch (UnsupportedOperationInTransactionException e) {
 +                      // expected
 +                    }
 +                    region.put(new Integer(5), new String("fifth"));
 +                    cacheTxnMgr.commit();
 +                    assertEquals(5, region.size());
 +                    assertEquals("fifth", region.get(new Integer(5)).toString());
 +                }
 +                catch(CacheException ce){
 +                    ce.printStackTrace();
 +                }
 +                finally{
 +                    if(cacheTxnMgr.exists()){
 +                        try {cacheTxnMgr.commit();} catch (Exception cce){cce.printStackTrace();}
 +                    }
 +                }
 +                
 +            }
 +        }
 +        );
 +        
 +        //verifying that region.clear does not clear the entries from sub region
 +        vm0.invoke(new CacheSerializableRunnable("temp3"){
 +            public void run2()throws CacheException{
 +                region.put(new Integer(1), new String("first"));
 +                region.put(new Integer(2), new String("second"));
 +                AttributesFactory factory  = new AttributesFactory();
 +                factory.setScope(Scope.DISTRIBUTED_ACK);
 +                RegionAttributes attr = factory.create();
 +                Region subRegion = region.createSubregion("subr", attr);
 +                subRegion.put(new Integer(3), new String("third"));
 +                subRegion.put(new Integer(4), new String("forth"));
 +                region.clear();
 +                assertEquals(0, region.size());
 +                assertEquals(2, subRegion.size());
 +            }
 +        }
 +        );
 +        
 +    }//end of test case
 +    
 +    public void testClearMultiVM() throws Throwable{
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        //put 3 key/values in vm0 and get from vm1
 +        Object[] objArr = new Object[1];
 +        //Integer in = new Integer(i);
 +        //objArr[0] = (Object) in;
 +        for (int i=1; i<4; i++){
 +            objArr[0] = ""+i;
 +            vm0.invoke(ClearMultiVmDUnitTest.class, "putMethod", objArr);
 +            vm1.invoke(ClearMultiVmDUnitTest.class, "getMethod", objArr);
 +        }
 +        
-         AsyncInvocation as1 = vm0.invokeAsync(ClearMultiVmDUnitTest.class, "firstVM");
-         AsyncInvocation as2 = vm1.invokeAsync(ClearMultiVmDUnitTest.class, "secondVM");
++        AsyncInvocation as1 = vm0.invokeAsync(() -> ClearMultiVmDUnitTest.firstVM());
++        AsyncInvocation as2 = vm1.invokeAsync(() -> ClearMultiVmDUnitTest.secondVM());
 +        ThreadUtils.join(as1, 30 * 1000);
 +        ThreadUtils.join(as2, 30 * 1000);
 +        
 +        if(as1.exceptionOccurred()){
 +          Assert.fail("as1 failed", as1.getException());
 +        }
 +        
 +        if(as2.exceptionOccurred()){
 +          Assert.fail("as2 failed", as2.getException());
 +        }
 +        
-         int j = vm0.invokeInt(ClearMultiVmDUnitTest.class, "sizeMethod");
++        int j = vm0.invoke(() -> ClearMultiVmDUnitTest.sizeMethod());
 +        assertEquals(0, j);
 +        
-         j = vm1.invokeInt(ClearMultiVmDUnitTest.class, "sizeMethod");
++        j = vm1.invoke(() -> ClearMultiVmDUnitTest.sizeMethod());
 +        assertEquals(1, j);
 +        
 +        
 +        
 +        int i=6;
 +        objArr[0] = ""+i;
 +        vm1.invoke(ClearMultiVmDUnitTest.class, "getMethod", objArr);
 +        
-         Object ob[] = new Object[1];
-         ob[0] = "secondVM";
-         boolean val = vm1.invokeBoolean(ClearMultiVmDUnitTest.class, "containsValueMethod", ob);
++        boolean val = vm1.invoke(() -> containsValueMethod("secondVM"));
 +        assertEquals(true, val);
 +        
 +    }//end of testClearMultiVM
 +    
 +    public void testClearExceptions(){
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
-         vm1.invoke(ClearMultiVmDUnitTest.class, "localDestroyRegionMethod");
++        vm1.invoke(() -> ClearMultiVmDUnitTest.localDestroyRegionMethod());
 +        vm0.invoke(new CacheSerializableRunnable ("exception in vm0"){
 +            public void run2() throws CacheException {
 +               try{
 +                    region.clear();                    
 +                } catch(RegionDestroyedException rdex){
 +                    fail("Should NOT have thrown RegionDestroyedException");
 +                } 
 +            }
 +        }        
 +        );
 +        
 +        vm1.invoke(new CacheSerializableRunnable ("exception in vm1"){
 +            public void run2() throws CacheException {
 +               try{
 +                    region.clear();
 +                    fail("Should have thrown RegionDestroyedException");
 +                } catch(RegionDestroyedException rdex){
 +                    //pass
 +                } 
 +            }
 +        }        
 +        );
 +        
 +    }//end of testClearExceptions
 +
 +    public void testGiiandClear() throws Throwable{
 +      if (false) {
 +        getSystem().getLogWriter().severe("testGiiandClear skipped because of bug 34963");
 +      } else {
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        SerializableRunnable create = new
 +        CacheSerializableRunnable("create mirrored region") {
 +            public void run2() throws CacheException {
 +                AttributesFactory factory1  = new AttributesFactory();
 +                factory1.setScope(Scope.DISTRIBUTED_ACK);
 +                factory1.setDataPolicy(DataPolicy.REPLICATE);
 +                RegionAttributes attr1 = factory1.create();
 +                mirroredRegion = cache.createRegion("mirrored", attr1);
 +                // reset slow
 +                com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = 0;
 +            }
 +        };
 +        
 +        
 +        vm0.invoke(create);
 +        
 +        vm0.invoke(new CacheSerializableRunnable("put initial data"){
 +            public void run2() throws CacheException {
 +                for(int i=0; i<1000; i++){
 +                    mirroredRegion.put(new Integer(i), (new Integer(i)).toString());
 +                }
 +            }
 +        }
 +        );
 +        
 +        // slow down image processing to make it more likely to get async updates
 +        vm1.invoke(new SerializableRunnable("set slow image processing") {
 +            public void run() {
 +                // if this is a no_ack test, then we need to slow down more because of the
 +                // pauses in the nonblocking operations
 +                int pause = 50;
 +                com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = pause;
 +            }
 +        });
 +        
 +        // now do the get initial image in vm1
 +        AsyncInvocation async1 = vm1.invokeAsync(create);
 +
 +        // try to time a distributed clear to happen in the middle of gii
 +        vm0.invoke(new SerializableRunnable("call clear when gii") {
 +            public void run() {
 +                try{Thread.sleep(3*1000);}catch(InterruptedException ex){fail("interrupted");}
 +                mirroredRegion.clear();                
 +                assertEquals(0, mirroredRegion.size());
 +            }
 +        });
 +        
 +        ThreadUtils.join(async1, 30 * 1000);
 +        if(async1.exceptionOccurred()){
 +          Assert.fail("async1 failed", async1.getException());
 +        }
 +        
 +        SerializableRunnable validate = new
 +        CacheSerializableRunnable("validate for region size") {
 +            public void run2() throws CacheException {
 +                assertEquals(0, mirroredRegion.size());
 +            }
 +        };
 +        
 +        vm0.invoke(validate);
 +        vm1.invoke(validate);
 +      }
 +        
 +    }//end of testGiiandClear
 +    
 +    
 +    //remote vm methods
 +    
 +    public static void firstVM(){
 +          //put one entry
 +          int i=5;
 +          region.put(i, "firstVM");
 +            
 +          //test localClear
 +          region.localClear();
 +          assertFalse(region.containsKey(i));
 +          
 +          paperWork.put("localClear","true");
 +          
 +          // wait unit clear on 2nd VM
 +          boolean val=false;
 +          while (!val) {
 +            val = paperWork.containsKey("localClearVerified");
 +          }
 +          region.put("key10", "value");
 +          region.put("key11", "value");
 +          
 +          // test distributed clear
 +          region.clear();
 +          paperWork.put("clear", "value");
 +          
 +          val = false;
 +          while (!val) {
 +            val = paperWork.containsKey("clearVerified");
 +          }
 +          
 +    }//end of firstVM
 +    
 +    public static void secondVM(){
 +          // verify that localClear on the other VM does not affect size on this VM
 +          boolean val=false;
 +          while (!val) {
 +            val = paperWork.containsKey("localClear");
 +          }
 +          assertEquals(3, region.size());
 +          
 +          paperWork.put("localClearVerified", "value");
 +          
 +          // wait for clear
 +          val = false;
 +          while (!val) {
 +            val = paperWork.containsKey("clear");
 +          }
 +          assertEquals(0, region.size());
 +          
 +          paperWork.put("clearVerified", "value");
 +          region.put(""+6, "secondVM");
 +    }//end of secondVM
 +    
 +    //helper methods
 +    
 +    
 +    public static Object putMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            if(ob != null){
 +                String str = "first";
 +                obj = region.put(ob, str);
 +            }
 +        }catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("Failed while region.put");
 +        }
 +        return obj;
 +    }
 +    
 +    public static Object getMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            obj = region.get(ob);
 +        } catch(Exception ex){
 +            fail("Failed while region.get");
 +        }
 +        return obj;
 +    }
 +    
 +    public static boolean containsValueMethod(Object ob){
 +        boolean flag = false;
 +        try{
 +            flag = region.containsValue(ob);
 +        }catch(Exception ex){
 +            fail("Failed while region.containsValueMethod");
 +        }
 +        return flag;
 +    }
 +    
 +    public static int sizeMethod(){
 +        int i=0;
 +        try{
 +            i = region.size();
 +        }catch(Exception ex){
 +            fail("Failed while region.size");
 +        }
 +        return i;
 +    }
 +    
 +    public static void localDestroyRegionMethod(){
 +        try{
 +            region.localDestroyRegion();
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }//end of localDestroyRegionMethod
 +    
 +    public static void clearExceptions(){
 +        try{
 +            region.clear();
 +            //fail("Should have thrown RegionDestroyedException");
 +        } catch(RegionDestroyedException rdex){
 +            //pass
 +        }
 +    }//end of clearExceptions
 +    
 +}//end of class