geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [06/94] [abbrv] [partial] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature/GEODE-917
Date Tue, 23 Feb 2016 20:23:02 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
index 0408eb7,0000000..bc631bd
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
@@@ -1,554 -1,0 +1,554 @@@
 +/*
 + * 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.io.Serializable;
 +import java.util.Collection;
 +import java.util.Iterator;
 +import java.util.Random;
 +import java.util.Set;
 +
 +import com.gemstone.gemfire.LogWriter;
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.Cache;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.EntryEvent;
 +import com.gemstone.gemfire.cache.EntryExistsException;
 +import com.gemstone.gemfire.cache.InterestPolicy;
 +import com.gemstone.gemfire.cache.PartitionAttributes;
 +import com.gemstone.gemfire.cache.PartitionAttributesFactory;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.RegionAttributes;
 +import com.gemstone.gemfire.cache.RegionFactory;
 +import com.gemstone.gemfire.cache.RegionShortcut;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.SubscriptionAttributes;
 +import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 +import com.gemstone.gemfire.internal.cache.PartitionedRegionException;
 +import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 +import com.gemstone.gemfire.internal.logging.PureLogWriter;
 +import com.gemstone.gemfire.test.dunit.Assert;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.SerializableCallable;
 +import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +/**
 + * This class tests the functionality of a cache {@link Region region}
 + * that has a scope of {@link Scope#DISTRIBUTED_ACK distributed ACK}
 + * and {@link PartitionAttributes partition-attributes}.
 + *
 + * @author Bruce Schuchardt
 + * @since 5.1
 + */
 +public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
 +  
 +  static int oldLogLevel;
 +
 +  public PartitionedRegionDUnitTest(String name) {
 +    super(name);
 +  }
 +  
 +  /*
 +   * (non-Javadoc)
 +   * @see com.gemstone.gemfire.cache30.RegionTestCase#supportsSubregions()
 +   */
 +  protected boolean supportsSubregions() { return false; }
 +  
 +  /*
 +   * (non-Javadoc)
 +   * @see com.gemstone.gemfire.cache30.MultiVMRegionTestCase#supportsNetLoad()
 +   */
 +  protected boolean supportsNetLoad() { return false; }
 +
 +  /*
 +   * (non-Javadoc)
 +   * @see com.gemstone.gemfire.cache30.MultiVMRegionTestCase#supportsReplication()
 +   */
 +  protected boolean supportsReplication() { return false; }
 +  
 +  /*
 +   * (non-Javadoc)
 +   * @see com.gemstone.gemfire.cache30.MultiVMRegionTestCase#supportsTransactions()
 +   */
 +  protected boolean supportsTransactions() { return false; }
 +  
 +  /*
 +   * (non-Javadoc)
 +   * @see com.gemstone.gemfire.cache30.RegionTestCase#supportsLocalDestroyAndLocalInvalidate()
 +   */
 +  protected boolean supportsLocalDestroyAndLocalInvalidate() { return false; }
 +  
 +  public void testCacheLoaderModifyingArgument() throws InterruptedException {
 +    // TODO, implement a specific PR related test that properly reflects primary allocation
 +    // and event deliver based on that allocation
 +  }
 +
 +  public void testLocalAndRemoteCacheWriters() throws InterruptedException {
 +    // TODO, implement a specific PR related test that properly reflects primary allocation
 +    // and event deliver based on that allocation
 +  }
 +
 +  public void testLocalCacheLoader() {
 +    // TODO, implement a specific PR related test that properly reflects primary allocation
 +    // and event deliver based on that allocation
 +  }
 +  
 +
 +  /**
 +   * Returns region attributes for a partitioned region with distributed-ack scope
 +   */
 +  protected RegionAttributes getRegionAttributes() {
 +    AttributesFactory factory = new AttributesFactory();
 +    factory.setEarlyAck(false);
 +    factory.setPartitionAttributes((new PartitionAttributesFactory()).create());
 +    return factory.create();
 +  }
 +
 +  /**
 +   * Returns region attributes with a distributed-ack scope
 +   */
 +  protected RegionAttributes getNonPRRegionAttributes() {
 +    AttributesFactory factory = new AttributesFactory();
 +    factory.setScope(Scope.DISTRIBUTED_ACK);
 +    factory.setEarlyAck(false);
 +    return factory.create();
 +  }
 +
 +  public static int setLogLevel(LogWriter l, int logLevl) {
 +    int ret = -1;
 +    if (l instanceof PureLogWriter) {
 +        PureLogWriter pl = (PureLogWriter) l;
 +        ret = pl.getLogWriterLevel();
 +        pl.setLevel(logLevl);
 +    }
 +    return ret;
 +  }
 +
 +  void setVMInfoLogLevel() {
 +    SerializableRunnable runnable = new SerializableRunnable() {
 +      public void run() {
 +        oldLogLevel = setLogLevel(getCache().getLogger(), InternalLogWriter.INFO_LEVEL);
 +      }
 +    };
 +    for (int i=0; i<4; i++) {
 +      Host.getHost(0).getVM(i).invoke(runnable);
 +    }
 +  }
 +    
 +  void resetVMLogLevel() {
 +    SerializableRunnable runnable = new SerializableRunnable() {
 +      public void run() {
 +        setLogLevel(getCache().getLogger(), oldLogLevel);
 +      }
 +    };
 +    for (int i=0; i<4; i++) {
 +      Host.getHost(0).getVM(i).invoke(runnable);
 +    }
 +  }
 +    
 +  //////////////////////  Test Methods  //////////////////////
 +
 +  public static boolean InvalidateInvoked = false;
 +  
 +  /**
 +   * Bug #47235 concerns assertion failures being thrown when there is a
 +   * member that receives adjunct messages (as in a WAN gateway, a peer
 +   * with clients, etc).
 +   * 
 +   * @throws Exception
 +   */
 +  public void testRegionInvalidationWithAdjunctMessages() throws Exception {
 +    final String name = getUniqueName();
 +    VM vm1 = Host.getHost(0).getVM(1);
 +    Cache cache = getCache();
 +    RegionFactory fact = getCache().createRegionFactory(RegionShortcut.PARTITION);
 +    Region pr = fact.create(name+"Region");
 +    pr.put("Object1", "Value1");
 +    
 +    vm1.invoke(new SerializableRunnable("create PR") {
 +      @Override
 +      public void run() {
 +        RegionFactory fact = getCache().createRegionFactory(RegionShortcut.PARTITION);
 +        fact.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL));
 +        fact.addCacheListener(new CacheListenerAdapter(){
 +          @Override
 +          public void afterInvalidate(EntryEvent event) {
 +            com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("afterInvalidate invoked with " + event);
 +            InvalidateInvoked = true;
 +          }
 +        });
 +        fact.create(name+"Region");
 +      }
 +    });
 +    try {
 +      pr.invalidateRegion();
 +      assertTrue("vm1 should have invoked the listener for an invalidateRegion operation",
 +          (Boolean)vm1.invoke(new SerializableCallable("getStatus") {
 +            public Object call() {
 +              return InvalidateInvoked;
 +            }
 +          }));
 +    } finally {
 +      disconnectAllFromDS();
 +    }
 +  }
 +
 +  /**
 +   * Tests the compatibility of creating certain kinds of subregions
 +   * of a local region.
 +   *
 +   * @see Region#createSubregion
 +   */
 +  public void testIncompatibleSubregions()
 +    throws CacheException, InterruptedException {
 +
 +    Host host = Host.getHost(0);
 +    VM vm0 = host.getVM(0);
 +    VM vm1 = host.getVM(1);
 +
 +    final String name = this.getUniqueName() + "-PR";
 +    vm0.invoke(new SerializableRunnable("Create partitioned Region") {
 +        public void run() {
 +          try {
 +            
 +            createRegion(name, "INCOMPATIBLE_ROOT", getRegionAttributes());
 +          } catch (CacheException ex) {
 +            Assert.fail("While creating Partitioned region", ex);
 +          }
 +        }
 +      });
 +
 +    vm1.invoke(new SerializableRunnable("Create non-partitioned Region") {
 +        public void run() {
 +          try {
 +            AttributesFactory factory =
 +              new AttributesFactory(getNonPRRegionAttributes());
 +            try {
 +              createRegion(name, "INCOMPATIBLE_ROOT", factory.create());
 +              fail("Should have thrown an IllegalStateException");
 +            } catch (IllegalStateException ex) {
 +              // pass...
 +            }
 +
 +          } catch (CacheException ex) {
 +            Assert.fail("While creating Partitioned Region", ex);
 +          }
 +        }
 +      });
 +  } 
 +  
 +
 +  private void setupExtendedTest(final String regionName, final int numVals) {
 +    Host host = Host.getHost(0);
 +    SerializableRunnable createPR = new SerializableRunnable("createPartitionedRegion") {
 +        public void run() {
 +          try {
 +            createRegion(regionName, "root", getRegionAttributes());
 +          } catch (CacheException ex) {
 +            Assert.fail("While creating Partitioned region", ex);
 +          }
 +        }
 +    };
 +    for (int i=1; i<4; i++) {
 +      host.getVM(i).invoke(createPR);
 +    }
 +    VM vm0 = host.getVM(0);
 +    vm0.invoke(new SerializableRunnable("Populate Partitioned Region") {
 +        public void run() {
 +          Region region = null;
 +          try {
 +            region = createRegion(regionName, "root", getRegionAttributes());
 +            // since random keys are being used, we might hit duplicates
 +            region.getCache().getLogger().info("<ExpectedException action=add>"
 +                + "com.gemstone.gemfire.cache.EntryExistsException"
 +                + "</ExpectedException>");
 +            java.util.Random rand = new java.util.Random(System.currentTimeMillis());
 +            for (int i=0; i<numVals; i++) {
 +              boolean created = false;
 +              while (!created) {
 +                try {
 +                  int val = rand.nextInt(100000000);
 +                  String key = String.valueOf(val);
 +                  region.create(key, new Integer(val));
 +                  created = true;
 +                }
 +                catch (EntryExistsException eee) {
 +                  // loop to try again
 +                }
 +              }
 +            }
 +          }
 +          catch (Exception ex) {
 +            Assert.fail("while creating or populating partitioned region", ex);
 +          }
 +          finally {
 +            if (region != null) {
 +              region.getCache().getLogger().info("<ExpectedException action=remove>"
 +                + "com.gemstone.gemfire.cache.EntryExistsException"
 +                + "</ExpectedException>");
 +            }
 +          }
 +        }
 +    });
 +  }
 +  
 +  /**
 +   * test with multiple vms and a decent spread of keys
 +   */
 +  public void testExtendedKeysValues() {
 +    final String regionName = getUniqueName();
 +    final int numEntries = 20000;
 +
 +    // since this test has to create a lot of entries, info log level is used.
 +    // comment out the setting of this and rerun if there are problems
 +    setVMInfoLogLevel();
 +    try {
 +      setupExtendedTest(regionName, numEntries);
 +      
 +      Host host = Host.getHost(0);
 +      VM vm0 = host.getVM(0);
 +      vm0.invoke(new SerializableRunnable("exercise Region.values") {
 +          public void run() {
 +            try {
 +              Region region = getRootRegion().getSubregion(regionName);
 +              Collection values = region.values();
 +              Set keys = region.keySet();
 +              Set entries = region.entrySet();
 +              assertEquals("value collection size was not the expected value", numEntries, values.size());
 +              assertEquals("key set size was not the expected value", numEntries, keys.size());
 +              assertEquals("entry set size was not the expected value", numEntries, entries.size());
 +              assertEquals("region size was not the expected value", numEntries, region.size());
 +              Iterator valuesIt = values.iterator();
 +              Iterator keysIt = keys.iterator();
 +              Iterator entriesIt = entries.iterator();
 +              for (int i=0; i<numEntries; i++) {
 +                assertTrue(valuesIt.hasNext());
 +                Integer value = (Integer)valuesIt.next();
 +                assertNotNull("value was null", value);
 +  
 +                assertTrue(keysIt.hasNext());
 +                String key = (String)keysIt.next();
 +                assertNotNull("key was null", key);
 +  
 +                assertTrue(entriesIt.hasNext());
 +                Region.Entry entry = (Region.Entry)entriesIt.next();
 +                assertNotNull("entry was null", entry);
 +                assertNotNull("entry key was null", entry.getKey());
 +                assertNotNull("entry value was null", entry.getValue());
 +              }
 +              assertTrue("should have been end of values iteration", !valuesIt.hasNext());
 +              assertTrue("should have been end of keys iteration", !keysIt.hasNext());
 +              assertTrue("should have been end of entries iteration", !entriesIt.hasNext());
 +            }
 +            catch (Exception ex) {
 +              try {
 +                getRootRegion().getSubregion(regionName).destroyRegion();
 +              }
 +              catch (Exception ex2) {
 +              }
 +              Assert.fail("Unexpected exception", ex);
 +            }
 +          }
 +      });
 +    }
 +    finally {
 +      resetVMLogLevel();
 +    }
 +  }
 +  
 +  // these tests make no sense for partitioned regions
 +  public void testDefinedEntryUpdated() {
 +    unimplemented();
 +  }
 +  public void testRemoteCacheListener() {
 +    unimplemented();
 +  }
 +  
 +  
 +  // these tests require getEntry support - need an alternative way of checking
 +  // the results that can be overridden here
 +//  public void testDistributedUpdate() {
 +//    unimplemented();
 +//  }
 +//  public void testDistributedPutNoUpdate() {
 +//    unimplemented();
 +//  }
 +//  public void testDistributedInvalidate() {
 +//    unimplemented();
 +//  }
 +//  public void testDistributedInvalidate4() {
 +//    unimplemented();
 +//  }
 +//  public void testContainsKey() {
 +//    unimplemented();
 +//  }
 +//  public void testBadRegionAccess() {
 +//    unimplemented();
 +//  }
 +//  public void testPutNonExistentEntry() {
 +//    unimplemented();
 +//  }
 +//  public void testDestroyEntry() {
 +//    unimplemented();
 +//  }
 +//  public void testInvalidateEntry() {
 +//    unimplemented();
 +//  }
 +//  public void testDistributedDestroy() {
 +//    unimplemented();
 +//  }
 +  
 +
 +  // user attributes aren't supported in partitioned regions at this time (5.1)
 +  public void testEntryUserAttribute() {
 +    unimplemented();
 +  }
 +
 +  
 +  // these tests require misc Region operations not currently supported by PRs
 +  public void testInvalidateRegion() {
 +    unimplemented();
 +  }
 +  public void testLocalDestroyRegion() {
 +    unimplemented();
 +  }
 +  public void testLocalInvalidateRegion() {
 +    unimplemented();
 +  }
 +  public void testSnapshot() {
 +    unimplemented();
 +  }
 +  public void testRootSnapshot() {
 +    unimplemented();
 +  }
 +
 +  private void unimplemented() {
 +//    StackTraceElement stack[] = new Exception("dummy").getStackTrace();
 +//    getLogWriter().info(stack[1].getClassName() + "." + stack[1].getMethodName()
 +//        + ": this test is not implemented for PartitionedRegions at this time");
 +  }
 +  static class PoisonedKey implements Serializable {
 +    static volatile boolean poisoned = false;
 +    static volatile boolean poisonDetected = false;
 +    
 +    /**
 +     * Accessed via reflection
 +     * @return true if poison found
 +     */
 +    public static boolean poisonFound() {
 +      boolean result = poisonDetected;
 +      poisonDetected = false; // restore default static value
 +      return result;
 +    }
 +    
 +    public int hashCode() {
 +      int result = k.hashCode();
 +      synchronized (PoisonedKey.class) {
 +        if (poisoned) {
 +          result += (new Random()).nextInt();
 +        }
 +      }
 +      return result;
 +    }
 +
 +    final String k;
 +    
 +    PoisonedKey(String s) {
 +      this.k = s;
 +    }
 +    
 +    public boolean equals(Object o) {
 +      if (o == null) {
 +        return false;
 +      }
 +      if (!(o instanceof PoisonedKey)) {
 +        return false;
 +      }
 +      PoisonedKey po = (PoisonedKey)o;
 +      if (k == null) {
 +        return po.k == null;
 +      }
 +      return k.equals(po.k);
 +    }
 +  }
 +  
 +  public void testBadHash() {
 +    final String regionName = getUniqueName();
 +    Host host = Host.getHost(0);
 +    VM vm0 = host.getVM(0);
 +    VM vm1 = host.getVM(1);
 +    SerializableRunnable createPR = new SerializableRunnable("createPartitionedRegion") {
 +        public void run() {
 +          try {
 +            createRegion(regionName, "root", getRegionAttributes());
 +          } catch (CacheException ex) {
 +            Assert.fail("While creating Partitioned region", ex);
 +          }
 +        }
 +    };
 +    vm0.invoke(createPR);
 +    vm1.invoke(createPR);
 +
 +    vm0.invoke(new SerializableRunnable("Populate 1") { 
 +      public void run() {
 +        Region region = getRootRegion().getSubregion(regionName);
 +        for (int i = 0; i < 10; i ++) {
 +          String st = Integer.toString(i);
 +          PoisonedKey pk = new PoisonedKey(st);
 +          region.create(pk, st);
 +        }
 +      }
 +    });
 +    
 +    // Verify values are readily accessible
 +    vm1.invoke(new SerializableRunnable("Read 1") { 
 +      public void run() {
 +        Region region = getRootRegion().getSubregion(regionName);
 +        for (int i = 0; i < 10; i ++) {
 +          String st = Integer.toString(i);
 +          PoisonedKey pk = new PoisonedKey(st);
 +          assertTrue("Keys screwed up too early", region.get(pk).equals(st));
 +        }
 +      }
 +    });
 +    
 +    // Bucket ID's will be screwed up with these creates.
 +    vm0.invoke(new SerializableRunnable("Populate 2") { 
 +      public void run() {
 +        Region region = getRootRegion().getSubregion(regionName);
 +        PoisonedKey.poisoned = true;
 +        try {
 +          for (int i = 10; i < 20; i ++) {
 +            String st = Integer.toString(i);
 +            PoisonedKey pk = new PoisonedKey(st);
 +            region.create(pk, st);
 +          }
 +        }
 +        catch (PartitionedRegionException e) {
 +          PoisonedKey.poisonDetected = true;
 +        } finally {
 +          PoisonedKey.poisoned = false; // restore default static value
 +        }
 +      }
 +    });
 +    
-     boolean success = vm0.invokeBoolean(PoisonedKey.class, "poisonFound");
++    boolean success = vm0.invoke(() -> PoisonedKey.poisonFound());
 +    assertTrue("Hash mismatch not found", success);
 +  }
 +}
 +

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/ProxyDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/ProxyDUnitTest.java
index 54554ab,0000000..8d6c14c
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ProxyDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ProxyDUnitTest.java
@@@ -1,546 -1,0 +1,546 @@@
 +/*
 + * 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.HashMap;
 +import java.util.Map;
 +
 +import com.gemstone.gemfire.cache.AttributesFactory;
 +import com.gemstone.gemfire.cache.AttributesMutator;
 +import com.gemstone.gemfire.cache.CacheEvent;
 +import com.gemstone.gemfire.cache.CacheException;
 +import com.gemstone.gemfire.cache.CacheListener;
 +import com.gemstone.gemfire.cache.CacheLoader;
 +import com.gemstone.gemfire.cache.CacheLoaderException;
 +import com.gemstone.gemfire.cache.CacheWriter;
 +import com.gemstone.gemfire.cache.CacheWriterException;
 +import com.gemstone.gemfire.cache.DataPolicy;
 +import com.gemstone.gemfire.cache.EntryEvent;
 +import com.gemstone.gemfire.cache.InterestPolicy;
 +import com.gemstone.gemfire.cache.LoaderHelper;
 +import com.gemstone.gemfire.cache.Operation;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.RegionEvent;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.SubscriptionAttributes;
 +import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 +import com.gemstone.gemfire.distributed.DistributedMember;
 +import com.gemstone.gemfire.distributed.internal.DMStats;
 +import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 +import com.gemstone.gemfire.test.dunit.Host;
 +import com.gemstone.gemfire.test.dunit.VM;
 +
 +/**
 + * Make sure that operations are distributed and done in
 + * regions remote from a PROXY
 + *
 + * @author darrel
 + * @since 5.0
 + */
 +public class ProxyDUnitTest extends CacheTestCase {
 +
 +  private transient Region r;
 +  private transient DistributedMember otherId;
 +  protected transient int clInvokeCount;
 +  protected transient CacheEvent clLastEvent;
 +  
 +  public ProxyDUnitTest(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();
 +        }
 +      });
-     this.otherId = (DistributedMember)vm.invoke(ProxyDUnitTest.class, "getVMDistributedMember");
++    this.otherId = (DistributedMember)vm.invoke(() -> ProxyDUnitTest.getVMDistributedMember());
 +  }
 +  private void doCreateOtherVm() {
 +    VM vm = getOtherVm();
 +    vm.invoke(new CacheSerializableRunnable("create root") {
 +        public void run2() throws CacheException {
 +          AttributesFactory af = new AttributesFactory();
 +          af.setDataPolicy(DataPolicy.REPLICATE);
 +          af.setScope(Scope.DISTRIBUTED_ACK);
 +          createRootRegion("ProxyDUnitTest", af.create());
 +        }
 +      });
 +  }
 +
 +  public static DistributedMember getVMDistributedMember() {
 +    return InternalDistributedSystem.getAnyInstance().getDistributedMember();
 +  }
 +  
 +  //////////////////////  Test Methods  //////////////////////
 +
 +  /**
 +   * check distributed ops that originate in a PROXY are correctly distributed
 +   * to non-proxy regions.
 +   */
 +  private void distributedOps(DataPolicy dp, InterestPolicy ip) throws CacheException {
 +    initOtherId();
 +    AttributesFactory af = new AttributesFactory();
 +    af.setDataPolicy(dp);
 +    af.setSubscriptionAttributes(new SubscriptionAttributes(ip));
 +    af.setScope(Scope.DISTRIBUTED_ACK);
 +    Region r = createRootRegion("ProxyDUnitTest", af.create());
 +
 +    doCreateOtherVm();
 +
 +    r.put("putkey", "putvalue1");
 +    
 +    getOtherVm().invoke(new CacheSerializableRunnable("check put") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(true, r.containsKey("putkey"));
 +          assertEquals("putvalue1", r.getEntry("putkey").getValue());
 +          r.put("putkey", "putvalue2");
 +        }
 +      });
 +    
 +    assertEquals(false, r.containsKey("putkey"));
 +    assertEquals("putvalue2", r.get("putkey")); // netsearch
 +
 +    r.invalidate("putkey");
 +
 +    getOtherVm().invoke(new CacheSerializableRunnable("check invalidate") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(true, r.containsKey("putkey"));
 +          assertEquals(null, r.getEntry("putkey").getValue());
 +        }
 +      });
 +    assertEquals(null, r.get("putkey")); // invalid so total miss
 +
 +    r.destroy("putkey");
 +
 +    getOtherVm().invoke(new CacheSerializableRunnable("check destroy") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(false, r.containsKey("putkey"));
 +        }
 +      });
 +    
 +    assertEquals(null, r.get("putkey")); // total miss
 +
 +    r.create("createKey", "createValue1");
 +    getOtherVm().invoke(new CacheSerializableRunnable("check create") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(true, r.containsKey("createKey"));
 +          assertEquals("createValue1", r.getEntry("createKey").getValue());
 +        }
 +      });
 +    {
 +      Map m = new HashMap();
 +      m.put("putAllKey1", "putAllValue1");
 +      m.put("putAllKey2", "putAllValue2");
 +      r.putAll(m, "putAllCallback");
 +    }
 +    getOtherVm().invoke(new CacheSerializableRunnable("check putAll") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(true, r.containsKey("putAllKey1"));
 +          assertEquals("putAllValue1", r.getEntry("putAllKey1").getValue());
 +          assertEquals(true, r.containsKey("putAllKey2"));
 +          assertEquals("putAllValue2", r.getEntry("putAllKey2").getValue());
 +        }
 +      });
 +    r.clear();
 +    getOtherVm().invoke(new CacheSerializableRunnable("check clear") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(0, r.size());
 +        }
 +      });
 +
 +    getOtherVm().invoke(new CacheSerializableRunnable("install CacheWriter") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          AttributesMutator am = r.getAttributesMutator();
 +          CacheWriter cw = new CacheWriterAdapter() {
 +              public void beforeCreate(EntryEvent event) throws CacheWriterException {
 +                throw new CacheWriterException("expected");
 +              }
 +            };
 +          am.setCacheWriter(cw);
 +        }
 +      });
 +    try {
 +      r.put("putkey", "putvalue");
 +      fail("expected CacheWriterException");
 +    } catch (CacheWriterException expected) {
 +    }
 +    getOtherVm().invoke(new CacheSerializableRunnable("check clear") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(0, r.size());
 +        }
 +      });
 +
 +    assertEquals(null, r.get("loadkey")); // total miss
 +    getOtherVm().invoke(new CacheSerializableRunnable("install CacheLoader") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          AttributesMutator am = r.getAttributesMutator();
 +          am.setCacheWriter(null); // clear csche writer
 +          CacheLoader cl = new CacheLoader() {
 +              public Object load(LoaderHelper helper) throws CacheLoaderException {
 +                if (helper.getKey().equals("loadkey")) {
 +                  return "loadvalue";
 +                } else if (helper.getKey().equals("loadexception")) {
 +                  throw new CacheLoaderException("expected");
 +                } else {
 +                  return null;
 +                }
 +              }
 +              public void close() {
 +              }
 +            };
 +          am.setCacheLoader(cl);
 +        }
 +      });
 +    assertEquals("loadvalue", r.get("loadkey")); // net load
 +    assertEquals(null, r.get("foobar")); // total miss
 +    try {
 +      r.get("loadexception");
 +      fail("expected CacheLoaderException");
 +    } catch (CacheLoaderException expected) {
 +    }
 +    r.destroyRegion();
 +    getOtherVm().invoke(new CacheSerializableRunnable("check clear") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals(null, r);
 +        }
 +      });
 +  }
 +  /**
 +   * Gets the DMStats for the vm's DM
 +   */
 +  private DMStats getDMStats() {
 +    return ((InternalDistributedSystem)getCache().getDistributedSystem())
 +      .getDistributionManager().getStats();
 +  }
 +  /**
 +   * check remote ops done in a normal vm are correctly distributed to PROXY regions
 +   */
 +  private void remoteOriginOps(DataPolicy dp, InterestPolicy ip) throws CacheException {
 +    initOtherId();
 +    AttributesFactory af = new AttributesFactory();
 +    af.setDataPolicy(dp);
 +    af.setSubscriptionAttributes(new SubscriptionAttributes(ip));
 +    af.setScope(Scope.DISTRIBUTED_ACK);
 +    CacheListener cl1 = new CacheListener() {
 +        public void afterUpdate(EntryEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterCreate(EntryEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterInvalidate(EntryEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterDestroy(EntryEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterRegionInvalidate(RegionEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterRegionDestroy(RegionEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterRegionClear(RegionEvent e) {
 +          clLastEvent = e;
 +          clInvokeCount++;
 +        }
 +        public void afterRegionCreate(RegionEvent e) {
 +        }
 +        public void afterRegionLive(RegionEvent e) {
 +        }
 +        public void close() {
 +        }
 +      };
 +    af.addCacheListener(cl1);
 +    Region r = createRootRegion("ProxyDUnitTest", af.create());
 +    this.clInvokeCount = 0;
 +
 +    doCreateOtherVm();
 +
 +    DMStats stats = getDMStats();
 +    long receivedMsgs = stats.getReceivedMessages();
 +
 +    if (ip.isAll()) {
 +      getOtherVm().invoke(new CacheSerializableRunnable("do put") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            r.put("p", "v");
 +          }
 +        });
 +      assertEquals(1, this.clInvokeCount);
 +      assertEquals(Operation.CREATE, this.clLastEvent.getOperation());
 +      assertEquals(true, this.clLastEvent.isOriginRemote());
 +      assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getOldValue());
 +      assertEquals(false, ((EntryEvent)this.clLastEvent).isOldValueAvailable()); // failure
 +      assertEquals("v", ((EntryEvent)this.clLastEvent).getNewValue());
 +      assertEquals("p", ((EntryEvent)this.clLastEvent).getKey());
 +      this.clInvokeCount = 0;
 +      
 +      getOtherVm().invoke(new CacheSerializableRunnable("do create") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            r.create("c", "v");
 +          }
 +        });
 +      assertEquals(1, this.clInvokeCount);
 +      assertEquals(Operation.CREATE, this.clLastEvent.getOperation());
 +      assertEquals(true, this.clLastEvent.isOriginRemote());
 +      assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getOldValue());
 +      assertEquals(false, ((EntryEvent)this.clLastEvent).isOldValueAvailable());
 +      assertEquals("v", ((EntryEvent)this.clLastEvent).getNewValue());
 +      assertEquals("c", ((EntryEvent)this.clLastEvent).getKey());
 +      this.clInvokeCount = 0;
 +      
 +      getOtherVm().invoke(new CacheSerializableRunnable("do update") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            r.put("c", "v2");
 +          }
 +        });
 +      assertEquals(1, this.clInvokeCount);
 +      assertEquals(Operation.UPDATE, this.clLastEvent.getOperation());
 +      assertEquals(true, this.clLastEvent.isOriginRemote());
 +      assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getOldValue());
 +      assertEquals(false, ((EntryEvent)this.clLastEvent).isOldValueAvailable());
 +      assertEquals("v2", ((EntryEvent)this.clLastEvent).getNewValue());
 +      assertEquals("c", ((EntryEvent)this.clLastEvent).getKey());
 +      this.clInvokeCount = 0;
 +
 +      getOtherVm().invoke(new CacheSerializableRunnable("do invalidate") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            r.invalidate("c");
 +          }
 +        });
 +      assertEquals(1, this.clInvokeCount);
 +      assertEquals(Operation.INVALIDATE, this.clLastEvent.getOperation());
 +      assertEquals(true, this.clLastEvent.isOriginRemote());
 +      assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getOldValue());
 +      assertEquals(false, ((EntryEvent)this.clLastEvent).isOldValueAvailable());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getNewValue());
 +      assertEquals("c", ((EntryEvent)this.clLastEvent).getKey());
 +      this.clInvokeCount = 0;
 +      
 +      getOtherVm().invoke(new CacheSerializableRunnable("do destroy") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            r.destroy("c");
 +          }
 +        });
 +      assertEquals(1, this.clInvokeCount);
 +      assertEquals(Operation.DESTROY, this.clLastEvent.getOperation());
 +      assertEquals(true, this.clLastEvent.isOriginRemote());
 +      assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getOldValue());
 +      assertEquals(false, ((EntryEvent)this.clLastEvent).isOldValueAvailable());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getNewValue());
 +      assertEquals("c", ((EntryEvent)this.clLastEvent).getKey());
 +      this.clInvokeCount = 0;
 +      
 +      getOtherVm().invoke(new CacheSerializableRunnable("do putAll") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            Map m = new HashMap();
 +            m.put("putAllKey1", "putAllValue1");
 +            m.put("putAllKey2", "putAllValue2");
 +            r.putAll(m);
 +          }
 +        });
 +      assertEquals(2, this.clInvokeCount);
 +      // @todo darrel; check putAll events
 +      this.clInvokeCount = 0;
 +
 +      getOtherVm().invoke(new CacheSerializableRunnable("do netsearch") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            assertEquals(null, r.get("loadkey")); // total miss
 +          }
 +        });
 +      assertEquals(0, this.clInvokeCount);
 +      
 +    } else {
 +      getOtherVm().invoke(new CacheSerializableRunnable("do entry ops") {
 +          public void run2() throws CacheException {
 +            Region r = getRootRegion("ProxyDUnitTest");
 +            r.put("p", "v");
 +            r.create("c", "v");
 +            r.put("c", "v"); // update
 +            r.invalidate("c");
 +            r.destroy("c");
 +            {
 +              Map m = new HashMap();
 +              m.put("putAllKey1", "putAllValue1");
 +              m.put("putAllKey2", "putAllValue2");
 +              r.putAll(m);
 +            }
 +            assertEquals(null, r.get("loadkey")); // total miss
 +          }
 +        });
 +
 +      assertEquals(0, this.clInvokeCount);
 +      assertEquals(0, r.size());
 +      // check the stats to make sure none of the above sent up messages
 +      assertEquals(receivedMsgs, stats.getReceivedMessages());
 +    }
 +
 +    {
 +      AttributesMutator am = r.getAttributesMutator();
 +      CacheLoader cl = new CacheLoader() {
 +          public Object load(LoaderHelper helper) throws CacheLoaderException {
 +            if (helper.getKey().equals("loadkey")) {
 +              return "loadvalue";
 +            } else if (helper.getKey().equals("loadexception")) {
 +              throw new CacheLoaderException("expected");
 +            } else {
 +              return null;
 +            }
 +          }
 +          public void close() {
 +          }
 +        };
 +      am.setCacheLoader(cl);
 +    }
 +
 +    receivedMsgs = stats.getReceivedMessages();
 +    getOtherVm().invoke(new CacheSerializableRunnable("check net loader") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          assertEquals("loadvalue", r.get("loadkey")); // net load
 +          assertEquals(null, r.get("foobar")); // total miss
 +          try {
 +            r.get("loadexception");
 +            fail("expected CacheLoaderException");
 +          } catch (CacheLoaderException expected) {
 +          }
 +        }
 +      });
 +    assertTrue(stats.getReceivedMessages() > receivedMsgs);
 +    if (ip.isAll()) {
 +      assertEquals(1, this.clInvokeCount);
 +      assertEquals(Operation.NET_LOAD_CREATE, this.clLastEvent.getOperation());
 +      assertEquals(true, this.clLastEvent.isOriginRemote());
 +      assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +      assertEquals(null, ((EntryEvent)this.clLastEvent).getOldValue());
 +      assertEquals(false, ((EntryEvent)this.clLastEvent).isOldValueAvailable());
 +      this.clInvokeCount = 0;
 +    } else {
 +      assertEquals(0, this.clInvokeCount);
 +    }
 +
 +    {
 +      AttributesMutator am = r.getAttributesMutator();
 +      am.setCacheLoader(null);
 +      CacheWriter cw = new CacheWriterAdapter() {
 +          public void beforeCreate(EntryEvent event) throws CacheWriterException {
 +            throw new CacheWriterException("expected");
 +          }
 +        };
 +      am.setCacheWriter(cw);
 +    }
 +    receivedMsgs = stats.getReceivedMessages();
 +    getOtherVm().invoke(new CacheSerializableRunnable("check net write") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          try {
 +            r.put("putkey", "putvalue");
 +            fail("expected CacheWriterException");
 +          } catch (CacheWriterException expected) {
 +          }
 +        }
 +      });
 +    assertTrue(stats.getReceivedMessages() > receivedMsgs);
 +    {
 +      AttributesMutator am = r.getAttributesMutator();
 +      am.setCacheWriter(null);
 +    }
 +    assertEquals(0, this.clInvokeCount);
 +    this.clLastEvent = null;
 +    getOtherVm().invoke(new CacheSerializableRunnable("check region invalidate") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          r.invalidateRegion();
 +        }
 +      });
 +    assertEquals(1, this.clInvokeCount);
 +    assertEquals(Operation.REGION_INVALIDATE, this.clLastEvent.getOperation());
 +    assertEquals(true, this.clLastEvent.isOriginRemote());
 +    assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +
 +    this.clLastEvent = null;
 +    getOtherVm().invoke(new CacheSerializableRunnable("check region clear") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          r.clear();
 +        }
 +      });
 +    assertEquals(2, this.clInvokeCount);
 +    assertEquals(Operation.REGION_CLEAR, this.clLastEvent.getOperation());
 +    assertEquals(true, this.clLastEvent.isOriginRemote());
 +    assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +
 +    this.clLastEvent = null;
 +    getOtherVm().invoke(new CacheSerializableRunnable("check region destroy") {
 +        public void run2() throws CacheException {
 +          Region r = getRootRegion("ProxyDUnitTest");
 +          r.destroyRegion();
 +        }
 +      });
 +    assertEquals(3, this.clInvokeCount);
 +    assertEquals(Operation.REGION_DESTROY, this.clLastEvent.getOperation());
 +    assertEquals(true, this.clLastEvent.isOriginRemote());
 +    assertEquals(this.otherId, this.clLastEvent.getDistributedMember());
 +    assertTrue(r.isDestroyed());
 +  }
 +  
 +  public void testDistributedOpsPROXY() throws CacheException {
 +    distributedOps(DataPolicy.EMPTY, InterestPolicy.CACHE_CONTENT);
 +  }
 +
 +  public void testRemoteOriginOpsPROXY() throws CacheException {
 +    remoteOriginOps(DataPolicy.EMPTY, InterestPolicy.CACHE_CONTENT);
 +  }
 +  public void testRemoteOriginOpsPROXY_ALL() throws CacheException {
 +    remoteOriginOps(DataPolicy.EMPTY, InterestPolicy.ALL);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
index caa8333,0000000..01a1f42
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
@@@ -1,401 -1,0 +1,401 @@@
 +/*
 + * 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.
 + */
 +
 +/*
 + * PutAllCallBkRemoteVMDUnitTest.java
 + *
 + * Created on September 2, 2005, 2:49 PM
 +*/
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +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.CacheListener;
 +import com.gemstone.gemfire.cache.CacheWriter;
 +import com.gemstone.gemfire.cache.DataPolicy;
 +import com.gemstone.gemfire.cache.EntryEvent;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.RegionAttributes;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 +import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 +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;
 +import com.gemstone.gemfire.test.dunit.Wait;
 +import com.gemstone.gemfire.test.dunit.WaitCriterion;
 +
 +/**
 + *
 + * @author vjadhav
 + */
 +public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
 +    
 +    /** Creates a new instance of PutAllCallBkRemoteVMDUnitTest */
 +    public PutAllCallBkRemoteVMDUnitTest(String name) {
 +        super(name);
 +    }
 +    
 +    static volatile Cache cache;
 +    static Properties props = new Properties();
 +    static Properties propsWork = new Properties();
 +    static volatile DistributedSystem ds = null;
 +    static volatile Region region;
 +    static volatile Region paperRegion;
 +    static boolean afterCreate=false;
 +    static boolean afterUpdate=false;
 +    static int putAllcounter = 0;
 +    static int afterUpdateputAllcounter = 0;
 +    static boolean beforeCreate=false;
 +    static boolean beforeUpdate=false;
 +    static int forCreate = 0;
 +    static int forUpdate = 0;
 +    static int beforeCreateputAllcounter = 0;
 +    static int beforeUpdateputAllcounter = 0;
 +    static boolean notified = 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(PutAllCallBkRemoteVMDUnitTest.class, "createCacheForVM0");
-       vm1.invoke(PutAllCallBkRemoteVMDUnitTest.class, "createCacheForVM1");
++      vm0.invoke(() -> PutAllCallBkRemoteVMDUnitTest.createCacheForVM0());
++      vm1.invoke(() -> PutAllCallBkRemoteVMDUnitTest.createCacheForVM1());
 +      LogWriterUtils.getLogWriter().info("Cache created 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(PutAllCallBkRemoteVMDUnitTest.class, "closeCache");
-       vm1.invoke(PutAllCallBkRemoteVMDUnitTest.class, "closeCache");
++      vm0.invoke(() -> PutAllCallBkRemoteVMDUnitTest.closeCache());
++      vm1.invoke(() -> PutAllCallBkRemoteVMDUnitTest.closeCache());
 +    }
 +    
 +    public static synchronized void createCacheForVM0(){
 +        try{
 +            ds = (new PutAllCallBkRemoteVMDUnitTest("temp")).getSystem(props);
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setDataPolicy(DataPolicy.REPLICATE);
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            RegionAttributes attr1 = factory.create();
 +            paperRegion = cache.createRegion("paper", attr1);
 +            RegionAttributes attr = factory.create();
 +            region = cache.createRegion("map", attr);
 +              
 +        } catch (CacheException ex){
 +            throw new RuntimeException("vm0 cache creation exception", ex);
 +        }
 +    }
 +    
 +    public static void createCacheForVM1(){
 +        try{
 +            CacheListener aListener = new AfterCreateCallback();
 +            CacheWriter aWriter = new BeforeCreateCallback();
 +            
 +            ds = (new PutAllCallBkRemoteVMDUnitTest("temp")).getSystem(props);
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setDataPolicy(DataPolicy.REPLICATE);
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            RegionAttributes attr1 = factory.create();
 +            paperRegion = cache.createRegion("paper", attr1);
 +            factory.setCacheWriter(aWriter);
 +            factory.addCacheListener(aListener);
 +            RegionAttributes attr = factory.create();
 +            region = cache.createRegion("map", attr);
 +        } catch (CacheException ex){
 +            throw new RuntimeException("vm1 cache creation exception", ex);
 +        }
 +    }
 +    
 +    
 +    public static synchronized void closeCache(){
 +      paperRegion = null;
 +      region = null;
 +      if (cache != null) {
 +        cache.close();
 +        cache = null;
 +      }
 +      if (ds != null) {
 +        ds.disconnect();
 +        ds = null;
 +      }
 +    }
 +    
 +    //test methods
 +    
 +    public void testputAllRemoteVM(){
 +        
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        ////////////////testing create call backs//////////////
 +        
 +        vm0.invoke(new CacheSerializableRunnable("put entries"){
 +            public void run2() throws CacheException{
 +                Map m = new HashMap();
 +                paperRegion.put("callbackCame","false");
 +                try{
 +                    for(int i=1; i<21; i++){
 +                        m.put(new Integer(i), java.lang.Integer.toString(i));
 +                    }
 +                    region.putAll(m);
 +                    
 +                }catch (Exception ex){
 +                    throw new RuntimeException("exception putting entries", ex);
 +                }
 +                LogWriterUtils.getLogWriter().info("****************paperRegion.get(afterCreate)***************"+paperRegion.get("afterCreate"));
 +
 +                WaitCriterion ev = new WaitCriterion() {
 +                  public boolean done() {
 +                    int size = region.size();
 +                    if (size != ((Integer)paperRegion.get("afterCreate")).intValue()-1) {
 +                      return false;
 +                    }
 +                    if (size != ((Integer)paperRegion.get("beforeCreate")).intValue()-1) {
 +                      return false;
 +                    }
 +                    return true;
 +                  }
 +                  public String description() {
 +                    return "Waiting for event";
 +                  }
 +                };
 +                Wait.waitForCriterion(ev, 3000, 200, true);
 +            }
 +        });
 +        
 +        
 +        vm1.invoke(new CacheSerializableRunnable("validate callbacks"){
 +            public void run2() throws CacheException{
 +                if(!notified){
 +                    try{
 +                        synchronized(PutAllCallBkRemoteVMDUnitTest.class){
 +                            this.wait();
 +                        }
 +                    } catch(Exception e){
 +                        
 +                    }
 +                }
 +                if(!paperRegion.get("callbackCame").equals("true")){
 +                    fail("Failed in aftercreate call back :: PutAllCallBkRemoteVMDUnitTest ");
 +                }
 +    
 +            }
 +        });
 +        
 +        
 +        //to test afterUpdate
 +        
 +    }
 +    
 +    public void testPutAllAfterUpdateCallbacks(){
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        vm0.invoke(new CacheSerializableRunnable("put and then update"){
 +            public void run2() throws CacheException{
 +                paperRegion.put("callbackCame","false");             
 +                //to invoke afterUpdate we should make sure that entries are already present
 +                for(int i=0; i<5; i++){
 +                    region.put(new Integer(i), new String("region"+i));
 +                }
 +                
 +                Map m = new HashMap();
 +                for(int i=0; i<5; i++){
 +                    m.put(new Integer(i), new String("map"+i));
 +                }
 +                
 +                region.putAll(m);
 +                
 +//                 try{
 +//                     Thread.sleep(3000);
 +//                 }catch(InterruptedException ex){
 +//                     //
 +//                 }
 +                
 +                assertEquals(region.size(), ((Integer)paperRegion.get("beforeUpdate")).intValue()-1);
 +                assertEquals(region.size(), ((Integer)paperRegion.get("afterUpdate")).intValue()-1);
 +            }
 +        }
 +        );
 +        
 +        vm1.invoke(new CacheSerializableRunnable("validate callbacks"){
 +            public void run2() throws CacheException{
 +                
 +                if(!notified){
 +                    try{
 +                        synchronized(PutAllCallBkRemoteVMDUnitTest.class){
 +                            this.wait();
 +                        }
 +                    } catch(Exception e){
 +                        
 +                    }
 +                }
 +                
 +                if(!paperRegion.get("callbackCame").equals("true")){
 +                    fail("Failed in afterUpdate call back :: PutAllCallBkRemoteVMDUnitTest");
 +                }
 +                
 +            }
 +        }
 +        );
 +        
 +    }//end of test case1
 +    
 +    
 +    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;
 +    }//end of putMethod
 +    
 +    public static void putAllMethod(){
 +        Map m = new HashMap();
 +        int i = 5, cntr = 0;
 +        try{
 +            while(cntr<20){
 +                m.put(new Integer(i), new String("map"+i));
 +                i++;
 +                cntr++;
 +            }
 +            
 +            region.putAll(m);
 +            
 +        }catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("Failed while region.putAll");
 +        }
 +    }//end of putAllMethod
 +    
 +    
 +    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 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();
 +        }
 +    }
 +    
 +    static class AfterCreateCallback extends CacheListenerAdapter {
 +        public void afterCreate(EntryEvent event){
 +            paperRegion.put("callbackCame","true");
 +            Integer counter = (Integer)paperRegion.get("afterCreate");
 +            if(counter==null) counter = new Integer(1);
 +            paperRegion.put("afterCreate",new Integer(counter.intValue()+1));
 +            
 +            LogWriterUtils.getLogWriter().info("In afterCreate"+putAllcounter);
 +            if(putAllcounter == forCreate){
 +                LogWriterUtils.getLogWriter().info("performingtrue");
 +                afterCreate = true;
 +            }
 +            try{
 +                synchronized(PutAllCallBkRemoteVMDUnitTest.class){
 +                    this.notify();
 +                }
 +            } catch(Exception e){
 +                
 +            }
 +            notified = true;
 +            LogWriterUtils.getLogWriter().info("*******afterCreate***** Key :"+event.getKey()+ " Value :"+event.getNewValue());
 +        }
 +        
 +        public void afterUpdate(EntryEvent event){
 +            paperRegion.put("callbackCame","true");
 +            Integer counter = (Integer)paperRegion.get("afterUpdate");
 +            if(counter==null) counter = new Integer(1);
 +            paperRegion.put("afterUpdate",new Integer(counter.intValue()+1));
 +            LogWriterUtils.getLogWriter().info("In afterUpdate"+afterUpdateputAllcounter);
 +            if(afterUpdateputAllcounter == forUpdate){
 +                LogWriterUtils.getLogWriter().info("performingtrue afterUpdate");
 +                afterUpdate = true;
 +            }
 +            try{
 +                synchronized(PutAllCallBkRemoteVMDUnitTest.class){
 +                    this.notify();
 +                }
 +            } catch(Exception e){
 +                
 +            }
 +            
 +            notified = true;
 +            
 +            LogWriterUtils.getLogWriter().info("*******afterUpdate***** Key :"+event.getKey()+ " Value :"+event.getNewValue());
 +            
 +        }
 +    }
 +    static class BeforeCreateCallback extends CacheWriterAdapter {
 +        //    static class BeforeCreateCallback extends CapacityControllerAdapter {
 +        public void beforeCreate(EntryEvent event){
 +            Integer counter = (Integer)paperRegion.get("beforeCreate");
 +            if(counter==null) counter = new Integer(1);
 +            paperRegion.put("beforeCreate",new Integer(counter.intValue()+1));
 +            LogWriterUtils.getLogWriter().info("*******BeforeCreate***** event="+event);
 +        }
 +        
 +        public void beforeUpdate(EntryEvent event) {
 +            Integer counter = (Integer)paperRegion.get("beforeUpdate");
 +            if(counter==null) counter = new Integer(1);
 +            paperRegion.put("beforeUpdate",new Integer(counter.intValue()+1));
 +            LogWriterUtils.getLogWriter().info("In beforeUpdate"+beforeUpdateputAllcounter);
 +            LogWriterUtils.getLogWriter().info("*******BeforeUpdate***** event="+event);
 +        }
 +    }
 +}// 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/PutAllCallBkSingleVMDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
index 8c85ebd,0000000..12337cd
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
@@@ -1,321 -1,0 +1,321 @@@
 +/*
 + * 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.
 + */
 +
 +/*
 + * PutAllCallBkSingleVMDUnitTest.java
 + *
 + * Created on August 31, 2005, 4:17 PM
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +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.CacheListener;
 +import com.gemstone.gemfire.cache.CacheWriter;
 +import com.gemstone.gemfire.cache.EntryEvent;
 +import com.gemstone.gemfire.cache.Region;
 +import com.gemstone.gemfire.cache.RegionAttributes;
 +import com.gemstone.gemfire.cache.Scope;
 +import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 +import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 +import com.gemstone.gemfire.distributed.DistributedSystem;
 +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.VM;
 +
 +public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
 +    
 +    /** Creates a new instance of PutAllCallBkSingleVMDUnitTest */
 +    public PutAllCallBkSingleVMDUnitTest(String name) {
 +        super(name);
 +    }
 +    
 +    static volatile Cache cache;
 +    static Properties props = new Properties();
 +    static Properties propsWork = new Properties();
 +    static volatile DistributedSystem ds = null;
 +    static volatile Region region;
 +    static boolean afterCreate=false;
 +    static boolean afterUpdate=false;
 +    static int putAllcounter = 0;
 +    static int afterUpdateputAllcounter = 0;
 +    static boolean beforeCreate=false;
 +    static boolean beforeUpdate=false;
 +    static int beforeCreateputAllcounter = 0;
 +    static int beforeUpdateputAllcounter = 0;
 +    
 +    @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(PutAllCallBkSingleVMDUnitTest.class, "createCache");
-       vm1.invoke(PutAllCallBkSingleVMDUnitTest.class, "createCache");
++      vm0.invoke(() -> PutAllCallBkSingleVMDUnitTest.createCache());
++      vm1.invoke(() -> PutAllCallBkSingleVMDUnitTest.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(PutAllCallBkSingleVMDUnitTest.class, "closeCache");
-       vm1.invoke(PutAllCallBkSingleVMDUnitTest.class, "closeCache");
++      vm0.invoke(() -> PutAllCallBkSingleVMDUnitTest.closeCache());
++      vm1.invoke(() -> PutAllCallBkSingleVMDUnitTest.closeCache());
 +    }
 +    
 +    public static synchronized void createCache(){
 +        try{
 +            CacheListener aListener = new AfterCreateCallback();
 +            CacheWriter aWriter = new BeforeCreateCallback();            
 +            ds = (new PutAllCallBkSingleVMDUnitTest("temp")).getSystem(props);
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            factory.setCacheWriter(aWriter);
 +            factory.setCacheListener(aListener);
 +            RegionAttributes attr = factory.create();
 +            
 +            region = cache.createRegion("map", attr);
 +            
 +            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }
 +    
 +    public static synchronized void closeCache(){
 +      region = null;
 +      if (cache != null) {
 +        cache.close();
 +        cache = null;
 +      }
 +      if (ds != null) {
 +        ds.disconnect();
 +        ds = null;
 +      }
 +    }
 +
 +    //test methods
 +    public void testputAllSingleVM(){
 +        
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        
 +//        Object obj2;
 +        Object[] objArr = new Object[1];
 +        for (int i=0; i<5; i++){
 +            objArr[0] = ""+i;
 +            vm0.invoke(PutAllCallBkSingleVMDUnitTest.class, "putMethod", objArr);
 +            
 +        }
 +        
-         vm0.invoke(PutAllCallBkSingleVMDUnitTest.class, "putAllMethod");
++        vm0.invoke(() -> PutAllCallBkSingleVMDUnitTest.putAllMethod());
 +        
 +        vm0.invoke(new CacheSerializableRunnable("temp1"){
 +            public void run2() throws CacheException{
 +                if(!afterCreate){
 +                    fail("FAILED in aftercreate call back");
 +                }
 +                assertEquals(region.size(), putAllcounter); 
 +                assertEquals(region.size(), beforeCreateputAllcounter);
 +            }
 +        });
 +        
 +        vm0.invoke(new CacheSerializableRunnable("abc"){
 +            public void run2() throws CacheException{
 +                CacheListener bListener = new AfterUpdateCallback();  
 +                CacheWriter bWriter =new BeforeUpdateCallback();
 +                AttributesFactory factory  = new AttributesFactory();
 +                factory.setScope(Scope.DISTRIBUTED_ACK);
 +                factory.setCacheWriter(bWriter);
 +                factory.setCacheListener(bListener);
 +                RegionAttributes attr = factory.create();                
 +                Region tempRegion = cache.createRegion("temp", attr);                
 +                
 +                //to invoke afterUpdate we should make sure that entries are already present
 +                for(int i=0; i<5; i++){
 +                    tempRegion.put(new Integer(i), new String("region"+i));
 +                }
 +                
 +                Map m = new HashMap();
 +                for(int i=0; i<5; i++){
 +                    m.put(new Integer(i), new String("map"+i));
 +                }
 +                
 +                tempRegion.putAll(m, "putAllAfterUpdateCallback");
 +                
 +                //now, verifying callbacks
 +                if(!afterUpdate){
 +                    fail("FAILED in afterupdate call back");
 +                }
 +                assertEquals(tempRegion.size(), afterUpdateputAllcounter);
 +                assertEquals(tempRegion.size(), beforeUpdateputAllcounter); 
 +            }
 +        }
 +        );
 +        
 +    }//end of test case1
 +    
 +   
 +    public static Object putMethod(Object ob){
 +        Object obj=null;
 +        try{
 +            if(ob != null){
 +                String str = "first";
 +                obj = region.put(ob, str);
 +            }
 +        }catch(Exception ex){
 +            Assert.fail("Failed while region.put", ex);
 +        }
 +        return obj;
 +    }//end of putMethod
 +    
 +    public static void putAllMethod(){
 +        Map m = new HashMap();
 +        int i = 5, cntr = 0;
 +        try{
 +            while(cntr<21){
 +                m.put(new Integer(i), new String("map"+i));
 +                i++;
 +                cntr++;
 +            }
 +            
 +            region.putAll(m, "putAllCreateCallback");
 +            
 +        }catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("Failed while region.putAll");
 +        }
 +    }//end of putAllMethod
 +    
 +    public static void putAllAfterUpdate(){
 +        Map m = new HashMap();
 +        int cntr = 0;
 +        try{
 +            for(int i=0; i<5; i++){
 +                m.put(""+i, new String("map_AfterUpdate"+i));
 +                cntr++;
 +            }
 +            region.putAll(m, "putAllAfterUpdateCallback");
 +        }catch(Exception ex){
 +            ex.printStackTrace();
 +            fail("Failed while region.putAll");
 +        }
 +    }//end of putAllAfterUpdate
 +    
 +    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();
 +        }
 +    }
 +    
 +    static class AfterCreateCallback extends CacheListenerAdapter {
 +        public void afterCreate(EntryEvent event){            
 +            putAllcounter++;
 +            LogWriterUtils.getLogWriter().fine("In afterCreate"+putAllcounter);
 +            if (event.getOperation().isPutAll()) {
 +              assertEquals("putAllCreateCallback", event.getCallbackArgument());
 +            }
 +            if(putAllcounter == 25){
 +                LogWriterUtils.getLogWriter().fine("performingtrue");
 +                afterCreate = true;
 +            }            
 +        }
 +    }
 +    
 +    static class AfterUpdateCallback extends CacheListenerAdapter {
 +        public void afterUpdate(EntryEvent event){            
 +            afterUpdateputAllcounter++;
 +            LogWriterUtils.getLogWriter().fine("In afterUpdate"+afterUpdateputAllcounter);
 +            if (event.getOperation().isPutAll()) {
 +              assertEquals("putAllAfterUpdateCallback", event.getCallbackArgument());
 +            }
 +            if(afterUpdateputAllcounter == 5){
 +                LogWriterUtils.getLogWriter().fine("performingtrue afterUpdate");
 +                afterUpdate = true;
 +            }            
 +        }
 +    }
 +    static class BeforeCreateCallback extends CacheWriterAdapter {
 +          public void beforeCreate(EntryEvent event){            
 +            beforeCreateputAllcounter++;
 +            LogWriterUtils.getLogWriter().fine("In beforeCreate"+beforeCreateputAllcounter);
 +            if (event.getOperation().isPutAll()) {
 +              assertEquals("putAllCreateCallback", event.getCallbackArgument());
 +            }
 +            if(beforeCreateputAllcounter == 25){
 +                LogWriterUtils.getLogWriter().fine("performingtrue beforeCreateputAll");
 +                beforeCreate = true;
 +            }            
 +        }
 +     }   
 +      static class BeforeUpdateCallback extends CacheWriterAdapter {
 +        public void beforeUpdate(EntryEvent event){            
 +            beforeUpdateputAllcounter++;
 +            LogWriterUtils.getLogWriter().fine("In beforeUpdate"+beforeUpdateputAllcounter);
 +            if (event.getOperation().isPutAll()) {
 +              assertEquals("putAllAfterUpdateCallback", event.getCallbackArgument());
 +            }
 +            if(beforeUpdateputAllcounter == 5){
 +                LogWriterUtils.getLogWriter().fine("performingtrue beforeUpdate");
 +                beforeUpdate = true;
 +            }            
 +        }
 +    }
 +    
 +}//end of class

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5beaaedc/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
index 5a37ebf,0000000..4ec8054
mode 100644,000000..100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
@@@ -1,366 -1,0 +1,366 @@@
 +/*
 + * 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.
 + */
 +
 +/*
 + * PutAllMultiVmDUnitTest.java
 + *
 + * Created on September 1, 2005, 12:19 PM
 + */
 +package com.gemstone.gemfire.cache30;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +import java.util.Properties;
 +import java.util.TreeMap;
 +
 +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.distributed.DistributedSystem;
 +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.VM;
 +
 +/**
 + *
 + * @author  prafulla
 + */
 +public class PutAllMultiVmDUnitTest extends DistributedTestCase{
 +    
 +    /** Creates a new instance of PutAllMultiVmDUnitTest */
 +    public PutAllMultiVmDUnitTest(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 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(PutAllMultiVmDUnitTest.class, "createCache");
-       vm1.invoke(PutAllMultiVmDUnitTest.class, "createCache");
++      vm0.invoke(() -> PutAllMultiVmDUnitTest.createCache());
++      vm1.invoke(() -> PutAllMultiVmDUnitTest.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(PutAllMultiVmDUnitTest.class, "closeCache");
-       vm1.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
++      vm0.invoke(() -> PutAllMultiVmDUnitTest.closeCache());
++      vm1.invoke(() -> PutAllMultiVmDUnitTest.closeCache());
 +      cache = null;
 +      Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
 +    }
 +    
 +    public static void createCache(){
 +        try{
 +            ds = (new PutAllMultiVmDUnitTest("temp")).getSystem(props);
 +            cache = CacheFactory.create(ds);
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            RegionAttributes attr = factory.create();
 +            region = cache.createRegion("map", attr);
 +            
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }//end of createCache
 +    
 +    public static void createMirroredRegion(){
 +        try{
 +            AttributesFactory factory  = new AttributesFactory();
 +            factory.setDataPolicy(DataPolicy.REPLICATE);
 +            factory.setScope(Scope.DISTRIBUTED_ACK);
 +            RegionAttributes attr = factory.create();
 +            mirroredRegion = cache.createRegion("mirrored", attr);
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }//end of createCache
 +    
 +    public static void closeCache(){
 +        try{
 +            //System.out.println("closing cache cache cache cache cache 33333333");
 +            cache.close();
 +            ds.disconnect();
 +            //System.out.println("closed cache cache cache cache cache 44444444");
 +        } catch (Exception ex){
 +            ex.printStackTrace();
 +        }
 +    }//end of closeCache
 +    
 +    
 +    //tests methods
 +    
 +    public void testSimplePutAll(){
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        SerializableRunnable clear = new CacheSerializableRunnable("clear"){
 +            public void run2() throws CacheException {
 +                try{
 +                    region.clear();
 +                }catch(Exception ex){
 +                    ex.printStackTrace();
 +                }
 +            }
 +        };//end of clear
 +        
 +        vm0.invoke(new CacheSerializableRunnable("testSimplePutAll1"){
 +            public void run2() throws CacheException {
 +                int cntr = 0, cntr1 = 0;
 +                for(int i=1; i<6; i++) {
 +                    region.put(new Integer(i), new String("testSimplePutAll"+i));
 +                    cntr++;
 +                }
 +                
 +                int size1 = region.size();
 +                Map m = new HashMap();
 +                for(int i=6; i<27; i++) {
 +                    m.put(new Integer(i), new String("map"+i));
 +                    cntr++;
 +                    cntr1++;
 +                }
 +                
 +                region.putAll(m);
 +                int size2 = region.size();
 +                
 +                assertEquals(cntr, region.size());
 +                assertEquals(cntr1, (size2 - size1));
 +                assertEquals(true, region.containsKey(new Integer(10)));
 +                assertEquals(true, region.containsValue(new String("map12")));
 +            }
 +        } );
 +        
 +        vm0.invoke(clear);
 +        
 +        vm1.invoke(new CacheSerializableRunnable("create mirrored region"){
 +            public void run2() throws CacheException {
 +                createMirroredRegion();
 +            }
 +        }
 +        );
 +        
 +        vm0.invoke(new CacheSerializableRunnable("testSimplePutAll2"){
 +            public void run2() throws CacheException {
 +                //assertEquals(0, region.size());
 +                createMirroredRegion();
 +                cacheTxnMgr = cache.getCacheTransactionManager();
 +                int cntr = 0;
 +                for(int i=1; i<6; i++) {
 +                    mirroredRegion.put(new Integer(i), new String("testSimplePutAll"+i));
 +                    cntr++;
 +                }
 +                
 +                int size1 = mirroredRegion.size();
 +                Map m = new HashMap();
 +                for(int i=6; i<27; i++) {
 +                    m.put(new Integer(i), new String("map"+i));
 +                    cntr++;
 +                }
 +                
 +                //Disabled until putAll works in tx
 +                //cacheTxnMgr.begin();
 +                //mirroredRegion.putAll(m);
 +                //cacheTxnMgr.rollback();
 +                
 +                assertEquals(size1, mirroredRegion.size());
 +                assertEquals(false, mirroredRegion.containsKey(new Integer(10)));
 +                assertEquals(false, mirroredRegion.containsValue(new String("map12")));
 +                
 +                //cacheTxnMgr.begin();
 +                mirroredRegion.putAll(m);
 +                //cacheTxnMgr.commit();
 +                
 +//                int size2 = mirroredRegion.size();
 +                
 +                assertEquals(cntr, mirroredRegion.size());
 +                assertEquals(true, mirroredRegion.containsKey(new Integer(10)));
 +                assertEquals(true, mirroredRegion.containsValue(new String("map12")));
 +                
 +                //sharing the size of region of vm0 in vm1
 +                mirroredRegion.put("size", new Integer(mirroredRegion.size()));
 +            }
 +        } );
 +        
 +        vm1.invoke(new CacheSerializableRunnable("testSimplePutAll3"){
 +            public void run2() throws CacheException {
 +                Integer i = (Integer) mirroredRegion.get("size");
 +                int cntr = i.intValue();
 +                assertEquals(cntr, (mirroredRegion.size()-1));
 +                assertEquals(true, mirroredRegion.containsKey(new Integer(10)));
 +                assertEquals(true, mirroredRegion.containsValue(new String("map12")));
 +            }
 +        } );
 +        
 +    }//end of testSimplePutAll
 +    
 +    public void testPutAllExceptions(){
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +        VM vm1 = host.getVM(1);
 +        
 +        vm0.invoke(new CacheSerializableRunnable("testPutAllExceptions1"){
 +            public void run2() throws CacheException {
 +                int cntr = 0;
 +//                int cntr1 = 0;
 +                for(int i=1; i<6; i++) {
 +                    region.put(new Integer(i), new String("testSimplePutAll"+i));
 +                    cntr++;
 +                }
 +                
 +                Map m = new TreeMap();//to verify the assertions
 +                for(int i=6; i<27; i++) {
 +                    if(i == 16){
 +                        m.put(new Integer(i), null);
 +                    }
 +                    else {
 +                        m.put(new Integer(i), new String("map"+i));
 +                    }
 +                }
 +                
 +                try{
 +                    region.putAll(m);
 +                    fail("Expect NullPointerException");
 +                } catch (NullPointerException ex){
 +                    //do nothing
 +                }
 +                
 +                assertEquals(5, region.size());
 +                assertEquals(false, region.containsKey(new Integer(10)));
 +                assertEquals(false, region.containsValue(new String("map12")));
 +                assertEquals(false, region.containsKey(new Integer(20)));
 +                assertEquals(false, region.containsValue(new String("map21")));
 +            }
 +        } );
 +        
 +        
 +        vm1.invoke(new CacheSerializableRunnable("create mirrored region"){
 +            public void run2() throws CacheException {
 +                createMirroredRegion();
 +            }
 +        }
 +        );
 +        
 +        
 +        vm0.invoke(new CacheSerializableRunnable("testPutAllExceptions2"){
 +            public void run2() throws CacheException {
 +                //assertEquals(0, region.size());
 +                createMirroredRegion();
 +                
 +                for(int i=1; i<6; i++) {
 +                    mirroredRegion.put(new Integer(i), new String("testSimplePutAll"+i));
 +                }
 +                
 +                Map m = new TreeMap();//to verify the assertions
 +                for(int i=6; i<27; i++) {
 +                    if(i == 16){
 +                        m.put(new Integer(i), null);
 +                    }
 +                    else {
 +                        m.put(new Integer(i), new String("map"+i));
 +                    }
 +                }
 +                
 +                try{
 +                    mirroredRegion.putAll(m);
 +                    fail("Expect NullPointerException");
 +                } catch (NullPointerException ex){
 +                    //do nothing
 +                }
 +               
 +                assertEquals(5, mirroredRegion.size());
 +                assertEquals(false, mirroredRegion.containsKey(new Integer(10)));
 +                assertEquals(false, mirroredRegion.containsValue(new String("map12")));
 +                assertEquals(false, region.containsKey(new Integer(20)));
 +                assertEquals(false, region.containsValue(new String("map21")));
 +
 +                //sharing the size of region of vm0 in vm1
 +                mirroredRegion.put("size", new Integer(mirroredRegion.size()));
 +            }
 +        } );
 +        
 +        vm1.invoke(new CacheSerializableRunnable("testPutAllExceptions3"){
 +            public void run2() throws CacheException {
 +                Integer i = (Integer) mirroredRegion.get("size");
 +                int cntr = i.intValue();
 +                assertEquals(cntr, (mirroredRegion.size()-1));
 +                assertEquals(false, mirroredRegion.containsKey(new Integer(10)));
 +                assertEquals(false, mirroredRegion.containsValue(new String("map12")));
 +                assertEquals(false, mirroredRegion.containsKey(new Integer(20)));
 +                assertEquals(false, mirroredRegion.containsValue(new String("map21")));
 +            }
 +        } );
 +        
 +        
 +    }//end of testPutAllExceptions
 +    
 +    public void testPutAllExceptionHandling(){
 +        Host host = Host.getHost(0);
 +        VM vm0 = host.getVM(0);
 +//        VM vm1 = host.getVM(1);
 +        
 +        vm0.invoke(new CacheSerializableRunnable("testPutAllExceptionHandling1"){
 +            public void run2() throws CacheException {
 +                Map m = new HashMap();
 +                m = null;
 +                try{
 +                    region.putAll(m);
 +                    fail("Should have thrown NullPointerException");
 +                }catch (NullPointerException ex){
 +                    //pass
 +                }
 +                
 +                region.localDestroyRegion();
 +                try{
 +                    Map m1 = new HashMap();
 +                    for(int i=1; i<21; i++) {
 +                        m1.put(new Integer(i), Integer.toString(i));
 +                    }
 +                    
 +                    region.putAll(m1);
 +                    fail("Should have thrown RegionDestroyedException");
 +                }catch (RegionDestroyedException ex){
 +                    //pass
 +                }
 +                
 +            }
 +        });
 +        
 +    }//testPutAllExceptionHandling
 +    
 +    
 +}//end of PutAllMultiVmDUnitTest


Mime
View raw message