You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by hi...@apache.org on 2016/09/13 22:43:49 UTC

[01/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-37_2 3897a76ea -> 7c20e6931


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
new file mode 100644
index 0000000..b1e070d
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
@@ -0,0 +1,1013 @@
+/*
+ * 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.management.internal.configuration;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.internal.ClassBuilder;
+import com.gemstone.gemfire.internal.JarClassLoader;
+import com.gemstone.gemfire.internal.JarDeployer;
+import com.gemstone.gemfire.internal.admin.remote.ShutdownAllRequest;
+import com.gemstone.gemfire.internal.cache.DiskStoreImpl;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.extension.Extensible;
+import com.gemstone.gemfire.internal.cache.extension.Extension;
+import com.gemstone.gemfire.internal.cache.extension.mock.MockCacheExtension;
+import com.gemstone.gemfire.internal.cache.extension.mock.MockExtensionCommands;
+import com.gemstone.gemfire.internal.cache.extension.mock.MockRegionExtension;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlParser;
+import com.gemstone.gemfire.management.cli.Result.Status;
+import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
+import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
+import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
+import static com.gemstone.gemfire.internal.FileUtil.delete;
+import static com.gemstone.gemfire.internal.FileUtil.deleteMatching;
+import static com.gemstone.gemfire.internal.lang.StringUtils.isBlank;
+import static com.gemstone.gemfire.management.internal.cli.CliUtil.getAllNormalMembers;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.getHost;
+import static com.gemstone.gemfire.test.dunit.IgnoredException.addIgnoredException;
+import static com.gemstone.gemfire.test.dunit.Wait.waitForCriterion;
+import static org.apache.commons.io.FileUtils.*;
+
+@Category(DistributedTest.class)
+public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
+
+  private static final int TIMEOUT = 10000;
+  private static final int INTERVAL = 500;
+
+  private static final String REPLICATE_REGION = "ReplicateRegion1";
+  private static final String PARTITION_REGION = "PartitionRegion1";
+  private static final String DISK_REGION1 = "DR1";
+  private static final String INDEX1 = "ID1";
+  private static final String INDEX2 = "ID2";
+  private static final String GROUP1 = "G1";
+  private static final String GROUP2 = "G2";
+  private static final String JAR1 = "D1.jar";
+  private static final String JAR2 = "D2.jar";
+  private static final String JAR3 = "D3.jar";
+  private static final String AsyncEventQueue1 = "Q1";
+
+  private static final String dataMember = "DataMember";
+  private static final String newMember = "NewMember";
+
+  private static Set<String> serverNames = new HashSet<>();
+  private static Set<String> jarFileNames = new HashSet<>();
+
+  private transient ClassBuilder classBuilder = new ClassBuilder();
+
+  @Override
+  public final void postSetUpCliCommandTestBase() throws Exception {
+    disconnectAllFromDS();
+  }
+
+  @Override
+  public final void preTearDownCliCommandTestBase() throws Exception {
+    shutdownAll();
+
+    serverNames.clear();
+    jarFileNames.clear();
+  }
+
+  @Test
+  public void testConfigDistribution() throws Exception {
+    addIgnoredException("could not get remote locator");
+    addIgnoredException("EntryDestroyedException");
+
+    String workingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator;
+
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+    final String jmxHost = (String) result[1];
+    final int jmxPort = (Integer) result[2];
+    final int httpPort = (Integer) result[3];
+    final String locatorString = "localHost[" + locatorPort + "]";
+
+    String gatewayReceiverStartPort = "10000";
+    String gatewayReceiverEndPort = "20000";
+    final String gsId = "GatewaySender1";
+    final String batchSize = "1000";
+    final String dispatcherThreads = "5";
+    final String enableConflation = "false";
+    final String manualStart = "false";
+    final String receiverManualStart = "true";
+    final String alertThreshold = "1000";
+    final String batchTimeInterval = "20";
+    final String maxQueueMemory = "100";
+    final String orderPolicy = OrderPolicy.KEY.toString();
+    final String parallel = "true";
+    final String rmDsId = "250";
+    final String socketBufferSize = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000);
+    final String socketReadTimeout = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+200);
+    final String DESTROY_REGION = "regionToBeDestroyed";
+
+    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+    createRegion(PARTITION_REGION, RegionShortcut.PARTITION, null);
+    createRegion(DESTROY_REGION, RegionShortcut.REPLICATE, null);
+    createIndex(INDEX1, "AAPL", REPLICATE_REGION, null);
+    createIndex(INDEX2, "VMW", PARTITION_REGION, null);
+
+    createAndDeployJar(workingDir + JAR1, null);
+    createAndDeployJar(workingDir + JAR2, null);
+    createAndDeployJar(workingDir + JAR3, null);
+
+    createAsyncEventQueue(AsyncEventQueue1, "false", null, "1000", "1000",  null);
+    destroyRegion(DESTROY_REGION);
+    destroyIndex(INDEX2, PARTITION_REGION, null);
+
+    undeployJar(JAR3, null);
+
+    alterRuntime("true", "", "", "");
+    createGatewayReceiver(receiverManualStart, "", gatewayReceiverStartPort, gatewayReceiverEndPort, "20", "");
+    createGatewaySender(gsId, batchSize, alertThreshold, batchTimeInterval, dispatcherThreads, enableConflation, manualStart, maxQueueMemory, orderPolicy, parallel, rmDsId, socketBufferSize, socketReadTimeout);
+
+    //alterRegion(PARTITION_REGION, "false", AsyncEventQueue1, "", "", "", "", "", "", gsId);
+    //Start a new member which receives the shared configuration
+    //Verify the config creation on this member
+
+    final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+    VM newMember = getHost(0).getVM(2);
+    newMember.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+
+        File workingDir = new File(newMemberWorkingDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
+        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+
+        assertNotNull(cache);
+        assertTrue(cache.getCopyOnRead());
+
+        Region region1 = cache.getRegion(REPLICATE_REGION);
+        assertNotNull(region1);
+        Region region2 = cache.getRegion(PARTITION_REGION);
+        assertNotNull(region2);
+
+        Region region3 = cache.getRegion(DESTROY_REGION);
+        assertNull(region3);
+
+        //Index verification
+        Index index1 = cache.getQueryService().getIndex(region1, INDEX1);
+        assertNotNull(index1);
+        assertNull(cache.getQueryService().getIndex(region2, INDEX2));
+
+        final JarDeployer jarDeployer = new JarDeployer(((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
+
+        final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
+
+        Set<String> jarNames = new HashSet<String>();
+
+        for (JarClassLoader jarClassLoader : jarClassLoaders) {
+          jarNames.add(jarClassLoader.getJarName());
+        }
+
+        assertTrue(jarNames.contains(JAR1));
+        assertTrue(jarNames.contains(JAR2));
+        assertFalse(jarNames.contains(JAR3));
+
+        //ASYNC-EVENT-QUEUE verification
+        AsyncEventQueue aeq = cache.getAsyncEventQueue(AsyncEventQueue1);
+        assertNotNull(aeq);
+        assertFalse(aeq.isPersistent());
+        assertTrue(aeq.getBatchSize() == 1000);
+        assertTrue(aeq.getMaximumQueueMemory() == 1000);
+
+        //GatewayReceiver verification
+        Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
+        assertFalse(gatewayReceivers.isEmpty());
+        assertTrue(gatewayReceivers.size() == 1);
+
+        //Gateway Sender verification
+        GatewaySender gs = cache.getGatewaySender(gsId);
+        assertNotNull(gs);
+        assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
+        assertTrue(batchSize.equals(Integer.toString(gs.getBatchSize())));
+        assertTrue(dispatcherThreads.equals(Integer.toString(gs.getDispatcherThreads())));
+        assertTrue(enableConflation.equals(Boolean.toString(gs.isBatchConflationEnabled())));
+        assertTrue(manualStart.equals(Boolean.toString(gs.isManualStart())));
+        assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
+        assertTrue(batchTimeInterval.equals(Integer.toString(gs.getBatchTimeInterval())));
+        assertTrue(maxQueueMemory.equals(Integer.toString(gs.getMaximumQueueMemory())));
+        assertTrue(orderPolicy.equals(gs.getOrderPolicy().toString()));
+        assertTrue(parallel.equals(Boolean.toString(gs.isParallel())));
+        assertTrue(rmDsId.equals(Integer.toString(gs.getRemoteDSId())));
+        assertTrue(socketBufferSize.equals(Integer.toString(gs.getSocketBufferSize())));
+        assertTrue(socketReadTimeout.equals(Integer.toString(gs.getSocketReadTimeout())));
+
+        return getAllNormalMembers(cache);
+      }
+    });
+  }
+
+  /**
+   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser},
+   * {@link XmlGenerator}, {@link XmlEntity} as it applies to Extensions.
+   * Asserts that Mock Extension is created and altered on region and cache.
+   * 
+   * @since GemFire 8.1
+   */
+  @Test
+  public void testCreateExtensions() throws Exception {
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+
+    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+    createMockRegionExtension(REPLICATE_REGION, "value1");
+    alterMockRegionExtension(REPLICATE_REGION, "value2");
+    createMockCacheExtension("value1");
+    alterMockCacheExtension("value2");
+
+    //Start a new member which receives the shared configuration
+    //Verify the config creation on this member
+
+    final String newMemberWorkDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+    VM newMember = getHost(0).getVM(2);
+    newMember.invoke(new SerializableCallable() {
+      private static final long serialVersionUID = 1L;
+
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+
+        File workingDir = new File(newMemberWorkDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
+        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+
+        assertNotNull(cache);
+
+        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
+        assertNotNull(region1);
+
+        //MockRegionExtension verification
+        @SuppressWarnings("unchecked")
+        // should only be one region extension
+        final MockRegionExtension mockRegionExtension = (MockRegionExtension) ((Extensible<Region<?,?>>) region1).getExtensionPoint().getExtensions().iterator().next();
+        assertNotNull(mockRegionExtension);
+        assertEquals(1, mockRegionExtension.beforeCreateCounter.get());
+        assertEquals(1, mockRegionExtension.onCreateCounter.get());
+        assertEquals("value2", mockRegionExtension.getValue());
+
+        //MockCacheExtension verification
+        @SuppressWarnings("unchecked")
+        // should only be one cache extension
+        final MockCacheExtension mockCacheExtension = (MockCacheExtension) ((Extensible<Cache>) cache).getExtensionPoint().getExtensions().iterator().next();
+        assertNotNull(mockCacheExtension);
+        assertEquals(1, mockCacheExtension.beforeCreateCounter.get());
+        assertEquals(1, mockCacheExtension.onCreateCounter.get());
+        assertEquals("value2", mockCacheExtension.getValue());
+
+        return getAllNormalMembers(cache);
+      }
+    });
+  }
+
+  /**
+   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser},
+   * {@link XmlGenerator}, {@link XmlEntity} as it applies to Extensions.
+   * Asserts that Mock Extension is created and destroyed on region and cache.
+   * 
+   * @since GemFire 8.1
+   */
+  @Test
+  public void testDestroyExtensions() throws Exception {
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+
+    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
+    createMockRegionExtension(REPLICATE_REGION, "value1");
+    destroyMockRegionExtension(REPLICATE_REGION);
+    createMockCacheExtension("value1");
+    destroyMockCacheExtension();
+
+    //Start a new member which receives the shared configuration
+    //Verify the config creation on this member
+
+    final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+    VM newMember = getHost(0).getVM(2);
+    newMember.invoke(new SerializableCallable() {
+
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+
+        File workingDir = new File(newMemberWorkingDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
+        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+
+        assertNotNull(cache);
+
+        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
+        assertNotNull(region1);
+
+        //MockRegionExtension verification
+        @SuppressWarnings("unchecked")
+        final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?,?>>) region1;
+        // Should not be any region extensions
+        assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
+
+        //MockCacheExtension verification
+        @SuppressWarnings("unchecked")
+        final Extensible<Cache> extensibleCache = (Extensible<Cache>) cache;
+        // Should not be any cache extensions
+        assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
+
+        return getAllNormalMembers(cache);
+      }
+    });
+  }
+
+  @Ignore("disabled for unknown reason") // this passes when @Ignore is removed
+  @Test
+  public void testCreateDiskStore () throws Exception {
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+    final String jmxHost = (String) result[1];
+    final int jmxPort = (Integer) result[2];
+    final int httpPort = (Integer) result[3];
+    final String locatorString = "localHost[" + locatorPort + "]";
+
+    final String diskStoreName = "clusterConfigTestDiskStore";
+    final String diskDirs = "dir1";
+
+    //final String
+    //createPersistentRegion(peersRegion, RegionShortcut.PARTITION_PERSISTENT, "", diskStoreName);
+
+    final String autoCompact = "true";
+    final String allowForceCompaction = "true";
+    final String compactionThreshold = "50";
+    final String duCritical = "90";
+    final String duWarning = "85";
+    final String maxOplogSize = "1000";
+    final String queueSize = "300";
+    final String timeInterval = "10";
+    final String writeBufferSize="100";
+
+    createDiskStore(diskStoreName, diskDirs, autoCompact, allowForceCompaction, compactionThreshold, duCritical, duWarning, maxOplogSize, queueSize, timeInterval, writeBufferSize);
+
+    //createAsyncEventQueue(id, persistent, diskStoreName, batchSize, maxQueueMemory, group)
+
+    //Stop the existing data member
+    VM dataMember = getHost(0).getVM(1);
+    dataMember.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+
+        CacheFactory cf = new CacheFactory();
+        GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
+        File[] diskDirs = null;
+        Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
+
+        assertFalse(diskStoreList.isEmpty());
+        assertTrue(diskStoreList.size() == 1);
+
+        for (DiskStoreImpl diskStore : diskStoreList) {
+          diskDirs = diskStore.getDiskDirs();
+          break;
+        }
+
+        assertNotNull(diskDirs);
+        assertTrue(diskDirs.length > 0);
+
+        //close the cache
+        cache.close();
+
+        //Delete the disk-store files
+        for (File diskDir : diskDirs) {
+          deleteDirectory(diskDir);
+        }
+        return getAllNormalMembers(cache);
+      }
+    });
+
+    final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
+
+    //Now start the new data member and it should create all the disk-store artifacts
+    VM newMember = getHost(0).getVM(2);
+    newMember.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+
+        File workingDir = new File(newMemberWorkingDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
+        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
+        assertNotNull(cache);
+
+
+        Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
+
+        assertFalse(diskStoreList.isEmpty());
+        assertTrue(diskStoreList.size() == 1);
+
+        for (DiskStoreImpl diskStore : diskStoreList) {
+          assertTrue(diskStore.getName().equals(diskStoreName));
+          assertTrue(Boolean.toString(diskStore.getAutoCompact()).equals(autoCompact));
+          assertTrue(Boolean.toString(diskStore.getAllowForceCompaction()).equals(allowForceCompaction));
+          assertTrue(Integer.toString(diskStore.getCompactionThreshold()).equals(compactionThreshold));
+          assertTrue(Long.toString(diskStore.getMaxOplogSize()).equals(maxOplogSize));
+          assertTrue(Integer.toString(diskStore.getQueueSize()).equals(queueSize));
+          assertTrue(Integer.toString(diskStore.getWriteBufferSize()).equals(writeBufferSize));
+          assertTrue(Long.toString(diskStore.getTimeInterval()).equals(timeInterval));
+          break;
+        }
+        cache.close();
+        return null;
+      }
+    });
+  }
+
+  @Ignore("disabled for unknown reason") // this fails in configurePDX when @Ignore is removed
+  @Test
+  public void testConfigurePDX() throws Exception {
+    Object[] result = setup();
+    final int locatorPort = (Integer) result[0];
+    final String jmxHost = (String) result[1];
+    final int jmxPort = (Integer) result[2];
+    final int httpPort = (Integer) result[3];
+    final String locatorString = "localHost[" + locatorPort + "]";
+
+    configurePDX("com.foo.*", "true", "true", null, "true");
+
+    VM dataMember = getHost(0).getVM(1);
+    dataMember.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
+        assertTrue(cache.getPdxReadSerialized());
+        assertTrue(cache.getPdxIgnoreUnreadFields());
+        assertTrue(cache.getPdxPersistent());
+        return null;
+      }
+    });
+  }
+  
+  @Test
+  public void testClusterConfigDir() throws Exception {
+    final int [] ports = getRandomAvailableTCPPorts(3);
+    final int locator1Port = ports[0];
+    final String locator1Name = "locator1-" + locator1Port;
+
+    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
+    final String clusterConfigPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "userSpecifiedDir";
+
+    VM locatorAndMgr = getHost(0).getVM(3);
+    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        int httpPort;
+        int jmxPort;
+        String jmxHost;
+        
+        try {
+          jmxHost = InetAddress.getLocalHost().getHostName();
+        } catch (UnknownHostException ignore) {
+          jmxHost = "localhost";
+        }
+
+        final int[] ports = getRandomAvailableTCPPorts(2);
+
+        jmxPort = ports[0];
+        httpPort = ports[1];
+        
+        final File locatorLogFile = new File(locatorLogPath);
+
+        final Properties locatorProps = new Properties();
+        locatorProps.setProperty(NAME, locator1Name);
+        locatorProps.setProperty(MCAST_PORT, "0");
+        locatorProps.setProperty(LOG_LEVEL, "config");
+        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+        locatorProps.setProperty(JMX_MANAGER, "true");
+        locatorProps.setProperty(JMX_MANAGER_START, "true");
+        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
+        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
+        
+        File clusterConfigDir = new File(clusterConfigPath);
+        assertTrue(clusterConfigDir.mkdir());
+        
+        locatorProps.setProperty(CLUSTER_CONFIGURATION_DIR, clusterConfigDir.getCanonicalPath());
+        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
+
+        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
+        WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            return locator.isSharedConfigurationRunning();
+          }
+          @Override
+          public String description() {
+            return "Waiting for shared configuration to be started";
+          }
+        };
+        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+        assertTrue(clusterConfigDir.list().length > 0);
+
+        final Object[] result = new Object[4];
+        result[0] = locator1Port;
+        result[1] = jmxHost;
+        result[2] = jmxPort;
+        result[3] = httpPort;
+        return result;
+      }
+    });
+  }
+  
+  private Object[] setup() throws IOException {
+    final int [] ports = getRandomAvailableTCPPorts(3);
+    final int locator1Port = ports[0];
+    final String locator1Name = "locator1-" + locator1Port;
+    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
+
+    VM locatorAndMgr = getHost(0).getVM(3);
+    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        int httpPort;
+        int jmxPort;
+        String jmxHost;
+        
+        try {
+          jmxHost = InetAddress.getLocalHost().getHostName();
+        } catch (UnknownHostException ignore) {
+          jmxHost = "localhost";
+        }
+
+        final int[] ports = getRandomAvailableTCPPorts(2);
+
+        jmxPort = ports[0];
+        httpPort = ports[1];
+        
+        final File locatorLogFile = new File(locatorLogPath);
+
+        final Properties locatorProps = new Properties();
+        locatorProps.setProperty(NAME, locator1Name);
+        locatorProps.setProperty(MCAST_PORT, "0");
+        locatorProps.setProperty(LOG_LEVEL, "config");
+        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+        locatorProps.setProperty(JMX_MANAGER, "true");
+        locatorProps.setProperty(JMX_MANAGER_START, "true");
+        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
+        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
+        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
+
+        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
+
+        WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            return locator.isSharedConfigurationRunning();
+          }
+          @Override
+          public String description() {
+            return "Waiting for shared configuration to be started";
+          }
+        };
+        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+        final Object[] result = new Object[4];
+        result[0] = locator1Port;
+        result[1] = jmxHost;
+        result[2] = jmxPort;
+        result[3] = httpPort;
+        return result;
+      }
+    });
+
+    HeadlessGfsh gfsh = getDefaultShell();
+    String jmxHost = (String)result[1];
+    int jmxPort = (Integer)result[2];
+    int httpPort = (Integer)result[3];
+    
+    connect(jmxHost, jmxPort, httpPort, gfsh);
+
+    final String dataMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + dataMember;
+
+    // Create a cache in VM 1
+    VM dataMember = getHost(0).getVM(1);
+    dataMember.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws IOException {
+        Properties localProps = new Properties();
+        File workingDir = new File(dataMemberWorkingDir);
+        workingDir.mkdirs();
+
+        localProps.setProperty(MCAST_PORT, "0");
+        localProps.setProperty(LOCATORS, "localhost[" + locator1Port+"]");
+        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.dataMember);
+        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
+
+        getSystem(localProps);
+        Cache cache = getCache();
+        assertNotNull(cache);
+        return getAllNormalMembers(cache);
+      }
+    });
+
+    return result;
+  }
+  
+  private void createRegion(String regionName, RegionShortcut regionShortCut, String group) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
+    csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
+    csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void createMockRegionExtension(final String regionName, final String value) {
+    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_REGION_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void alterMockRegionExtension(final String regionName, final String value) {
+    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_REGION_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void destroyMockRegionExtension(final String regionName) {
+    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_REGION_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void createMockCacheExtension(final String value) {
+    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_CACHE_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void alterMockCacheExtension(final String value) {
+    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_CACHE_EXTENSION);
+    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void destroyMockCacheExtension() {
+    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_CACHE_EXTENSION);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void createPersistentRegion(String regionName, RegionShortcut regionShortCut, String group, String diskStoreName) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGION, regionName);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__DISKSTORE, diskStoreName);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+  
+  private void destroyRegion(String regionName) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_REGION);
+    csb.addOption(CliStrings.DESTROY_REGION__REGION, regionName);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+  
+  private void alterRegion(String regionName,
+                           String cloningEnabled,
+                           String aeqId,
+                           String cacheListener,
+                           String cacheWriter,
+                           String cacheLoader,
+                           String entryExpIdleTime,
+                           String entryExpIdleTimeAction,
+                           String evictionMax,
+                           String gsId) {
+
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_REGION);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, "false");
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, aeqId);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHELISTENER, cacheListener);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHEWRITER, cacheWriter);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHELOADER, cacheLoader);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, cloningEnabled);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME, entryExpIdleTime);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION, entryExpIdleTimeAction);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__EVICTIONMAX, evictionMax);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__GATEWAYSENDERID, gsId);
+
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+
+  private void executeAndVerifyCommand(String commandString) {
+    CommandResult cmdResult = executeCommand(commandString);
+    com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Command : " + commandString);
+    com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Command Result : " + commandResultToString(cmdResult));
+    assertEquals(Status.OK, cmdResult.getStatus());
+    assertFalse(cmdResult.failedToPersist());
+  }
+  
+  private void createIndex(String indexName, String expression, String regionName, String group) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
+    csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
+    csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
+    csb.addOption(CliStrings.CREATE_INDEX__REGION, regionName);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+
+  private void destroyIndex(String indexName, String regionName, String group) {
+    if (isBlank(indexName) && isBlank(regionName) && isBlank(group)) {
+      return;
+    }
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
+    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__NAME, indexName);
+    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__REGION, regionName);
+    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__GROUP, group);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+  
+  private void createDiskStore(String diskStoreName,
+                               String diskDirs,
+                               String autoCompact,
+                               String allowForceCompaction,
+                               String compactionThreshold,
+                               String duCritical,
+                               String duWarning,
+                               String maxOplogSize,
+                               String queueSize,
+                               String timeInterval,
+                               String writeBufferSize) {
+
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
+    csb.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreName);
+    csb.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, diskDirs);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, autoCompact);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION, allowForceCompaction);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD, compactionThreshold);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, duCritical);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, duWarning);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, maxOplogSize);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, queueSize);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, timeInterval);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, writeBufferSize);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+  
+  private void destroyDiskStore(String diskStoreName, String group) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_DISK_STORE);
+    csb.addOption(CliStrings.DESTROY_DISK_STORE__NAME, diskStoreName);
+    csb.addOptionWithValueCheck(CliStrings.DESTROY_DISK_STORE__GROUP, group);
+    executeAndVerifyCommand(csb.toString());
+  }
+  
+  private void createGatewayReceiver(String manualStart, String bindAddress, String startPort, String endPort, String maxTimeBetweenPings, String group) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYRECEIVER);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART, manualStart);
+    csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT, startPort);
+    csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT, endPort);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS, bindAddress);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__GROUP, group);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS, maxTimeBetweenPings);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+  
+  private void createGatewaySender(String id, 
+                                   String batchSize,
+                                   String alertThreshold,
+                                   String batchTimeInterval,
+                                   String dispatcherThreads,
+                                   String enableConflation,
+                                   String manualStart,
+                                   String maxQueueMemory,
+                                   String orderPolicy,
+                                   String parallel,
+                                   String rmDsId,
+                                   String socketBufferSize,
+                                   String socketReadTimeout) {
+    
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYSENDER);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ID, id);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE, batchSize);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD, alertThreshold);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL, batchTimeInterval);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS, dispatcherThreads);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION, enableConflation);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__MANUALSTART, manualStart);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY, maxQueueMemory);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY, orderPolicy);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__PARALLEL, parallel);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID, rmDsId);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE, socketBufferSize);
+    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT, socketReadTimeout);
+    
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+  
+  private void createAsyncEventQueue(String id, String persistent , String diskStoreName, String batchSize, String maxQueueMemory, String group) throws IOException {
+    String queueCommandsJarName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "testEndToEndSC-QueueCommands.jar";
+    final File jarFile = new File(queueCommandsJarName);
+
+    try {
+      ClassBuilder classBuilder = new ClassBuilder();
+      byte[] jarBytes = classBuilder.createJarFromClassContent("com/qcdunit/QueueCommandsDUnitTestListener",
+          "package com.qcdunit;" +
+          "import java.util.List; import java.util.Properties;" +
+          "import com.gemstone.gemfire.internal.cache.xmlcache.Declarable2; import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;" +
+          "import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;" +
+          "public class QueueCommandsDUnitTestListener implements Declarable2, AsyncEventListener {" +
+          "Properties props;" +
+          "public boolean processEvents(List<AsyncEvent> events) { return true; }" +
+          "public void close() {}" +
+          "public void init(final Properties props) {this.props = props;}" +
+          "public Properties getConfig() {return this.props;}}");
+      
+      writeByteArrayToFile(jarFile, jarBytes);
+      CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
+      csb.addOption(CliStrings.DEPLOY__JAR, queueCommandsJarName);
+      executeAndVerifyCommand(csb.getCommandString());
+      
+      csb = new CommandStringBuilder(CliStrings.CREATE_ASYNC_EVENT_QUEUE);
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__ID, id);
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER, "com.qcdunit.QueueCommandsDUnitTestListener");
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISK_STORE, diskStoreName);
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__BATCH_SIZE, batchSize);
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GROUP, group);
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__PERSISTENT, persistent);
+      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY, maxQueueMemory);
+      executeAndVerifyCommand(csb.getCommandString());
+      
+    } finally {
+      deleteQuietly(jarFile);
+    }
+  }
+
+  private void configurePDX(String autoSerializerClasses, String ignoreUnreadFields, String persistent, String portableAutoSerializerClasses, String readSerialized) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CONFIGURE_PDX);
+    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__AUTO__SERIALIZER__CLASSES, autoSerializerClasses);
+    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__IGNORE__UNREAD_FIELDS, ignoreUnreadFields);
+    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__PERSISTENT, persistent);
+    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__PORTABLE__AUTO__SERIALIZER__CLASSES, portableAutoSerializerClasses);
+    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__READ__SERIALIZED, readSerialized);
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+
+  private void createAndDeployJar(String jarName, String group) throws IOException {
+    File newDeployableJarFile = new File(jarName);
+    this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
+    csb.addOption(CliStrings.DEPLOY__JAR, jarName);
+    if (!isBlank(group)) {
+      csb.addOption(CliStrings.DEPLOY__GROUP, group);
+    }
+    executeAndVerifyCommand(csb.getCommandString());
+    jarFileNames.add(jarName);
+  }
+
+  private void undeployJar(String jarName, String group) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.UNDEPLOY);
+    if (!isBlank(jarName)) {
+      csb.addOption(CliStrings.UNDEPLOY__JAR, jarName);
+    }
+    if (!isBlank(group)) {
+      csb.addOption(CliStrings.UNDEPLOY__GROUP, group);
+    }
+    executeAndVerifyCommand(csb.getCommandString());
+  }
+
+  private void alterRuntime(String copyOnRead, String lockLease, String lockTimeout, String messageSyncInterval) {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ, copyOnRead);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE, lockLease);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT, lockTimeout);
+    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL, messageSyncInterval);
+    executeAndVerifyCommand(csb.toString());
+  }
+
+  private void deleteSavedJarFiles() throws IOException {
+    deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
+    delete(new File("Deploy1.jar"));
+  }
+
+  private void shutdownAll() throws IOException {
+    VM locatorAndMgr = getHost(0).getVM(3);
+    locatorAndMgr.invoke(new SerializableCallable() {
+      @Override
+      public Object call() throws Exception {
+        GemFireCacheImpl cache = (GemFireCacheImpl)CacheFactory.getAnyInstance();
+        ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
+        return null;
+      }
+    });
+
+    locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
+    //Clean up the directories
+    if (serverNames != null && !serverNames.isEmpty()) {
+      for (String serverName : serverNames) {
+        final File serverDir = new File(serverName);
+        cleanDirectory(serverDir);
+        deleteDirectory(serverDir);
+      }
+    }
+  }
+
+  private static class CommandBuilder {
+
+    private CommandStringBuilder csb;
+
+    public CommandBuilder(String commandName, Map<String, String> options) {
+      csb = new CommandStringBuilder(commandName);
+
+      Set<Entry<String, String>> entries = options.entrySet();
+
+      Iterator<Entry<String, String>> iter = entries.iterator();
+
+      while (iter.hasNext()) {
+        Entry<String, String> entry = iter.next();
+        String option = entry.getKey();
+
+        if (isBlank(option)) {
+          csb.addOption(option, entry.getValue());
+        }
+      }
+    }
+
+    public String getCommandString() {
+      return csb.toString();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/management/internal/pulse/TestRemoteClusterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/pulse/TestRemoteClusterDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/pulse/TestRemoteClusterDUnitTest.java
new file mode 100644
index 0000000..4829523
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/pulse/TestRemoteClusterDUnitTest.java
@@ -0,0 +1,272 @@
+/*
+ * 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.management.internal.pulse;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.management.DistributedSystemMXBean;
+import com.gemstone.gemfire.management.GatewayReceiverMXBean;
+import com.gemstone.gemfire.management.GatewaySenderMXBean;
+import com.gemstone.gemfire.management.MBeanUtil;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.ManagementTestBase;
+import com.gemstone.gemfire.management.RegionMXBean;
+
+import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+
+/**
+ * This is for testing remote Cluster
+ * 
+ * 
+ */
+
+@Category(DistributedTest.class)
+public class TestRemoteClusterDUnitTest extends ManagementTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  public static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
+
+  public TestRemoteClusterDUnitTest() throws Exception {
+    super();
+  }
+
+  @Test
+  public void testMBeanCallback() throws Exception {
+
+    VM nyLocator = getManagedNodeList().get(0);
+    VM nyReceiver = getManagedNodeList().get(1);
+    VM puneSender = getManagedNodeList().get(2);
+    VM managing = getManagingNode();
+    VM puneLocator = Host.getLocator();
+
+    int punePort = (Integer) puneLocator.invoke(() -> TestRemoteClusterDUnitTest.getLocatorPort());
+
+    Integer nyPort = (Integer) nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
+
+    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
+    managing.invoke(() -> WANTestBase.createManagementCache( punePort ));
+    startManagingNode(managing);
+
+    puneSender.invoke(() -> WANTestBase.createSender( "pn",
+        12, true, 100, 300, false, false, null, true ));
+    managing.invoke(() -> WANTestBase.createSender( "pn", 12,
+        true, 100, 300, false, false, null, true ));
+
+    puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
+    managing.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "pn", 1, 100, false ));
+
+    WANTestBase.createCacheInVMs(nyPort, nyReceiver);
+    nyReceiver.invoke(() -> WANTestBase.createReceiver());
+    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
+
+    WANTestBase.startSenderInVMs("pn", puneSender, managing);
+
+    // make sure all the senders are running before doing any puts
+    puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
+    managing.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
+
+    checkSenderMBean(puneSender, getTestMethodName() + "_PR");
+    checkSenderMBean(managing, getTestMethodName() + "_PR");
+
+    checkReceiverMBean(nyReceiver);
+
+    stopGatewaySender(puneSender);
+    startGatewaySender(puneSender);
+
+    DistributedMember puneMember = (DistributedMember) puneSender.invoke(() -> TestRemoteClusterDUnitTest.getMember());
+
+    checkRemoteClusterStatus(managing, puneMember);
+
+  }
+
+  private static int getLocatorPort() {
+    return Locator.getLocators().get(0).getPort();
+  }
+
+  private static DistributedMember getMember() {
+    return GemFireCacheImpl.getInstance().getMyId();
+  }
+
+  /**
+   * Checks Proxy GatewaySender
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkRemoteClusterStatus(final VM vm,
+      final DistributedMember senderMember) {
+    SerializableRunnable checkProxySender = new SerializableRunnable(
+        "DS Map Size") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+          final WaitCriterion waitCriteria2 = new WaitCriterion() {
+            @Override
+            public boolean done() {
+              Cache cache = GemFireCacheImpl.getInstance();
+              final ManagementService service = ManagementService
+                  .getManagementService(cache);
+              final DistributedSystemMXBean dsBean = service
+                  .getDistributedSystemMXBean();
+              if (dsBean != null) {
+                return true;
+              }
+              return false;
+            }
+            @Override
+            public String description() {
+              return "wait for getDistributedSystemMXBean to complete and get results";
+            }
+          };
+          Wait.waitForCriterion(waitCriteria2, 2 * 60 * 1000, 5000, true);
+          ManagementService service = ManagementService
+              .getManagementService(cache);
+          final DistributedSystemMXBean dsBean = service
+              .getDistributedSystemMXBean();
+          assertNotNull(dsBean);
+          Map<String, Boolean> dsMap = dsBean.viewRemoteClusterStatus();
+          LogWriterUtils.getLogWriter().info(
+              "Ds Map is: " + dsMap.size());
+          assertNotNull(dsMap);
+          assertEquals(true, dsMap.size() > 0 ? true : false);
+        }      
+    };
+    vm.invoke(checkProxySender);
+  }
+
+
+  /**
+   * stops a gateway sender
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void stopGatewaySender(final VM vm) {
+    SerializableRunnable stopGatewaySender = new SerializableRunnable(
+        "Stop Gateway Sender") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
+        assertNotNull(bean);
+        bean.stop();
+        assertFalse(bean.isRunning());
+      }
+    };
+    vm.invoke(stopGatewaySender);
+  }
+
+  /**
+   * start a gateway sender
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void startGatewaySender(final VM vm) {
+    SerializableRunnable stopGatewaySender = new SerializableRunnable(
+        "Start Gateway Sender") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
+        assertNotNull(bean);
+        bean.start();
+        assertTrue(bean.isRunning());
+      }
+    };
+    vm.invoke(stopGatewaySender);
+  }
+
+  /**
+   * Checks whether a GatewayReceiverMBean is created or not
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkReceiverMBean(final VM vm) {
+    SerializableRunnable checkMBean = new SerializableRunnable(
+        "Check Receiver MBean") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        GatewayReceiverMXBean bean = service.getLocalGatewayReceiverMXBean();
+        assertNotNull(bean);
+      }
+    };
+    vm.invoke(checkMBean);
+  }
+
+  /**
+   * Checks whether a GatewayReceiverMBean is created or not
+   * 
+   * @param vm reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkSenderMBean(final VM vm, final String regionPath) {
+    SerializableRunnable checkMBean = new SerializableRunnable(
+        "Check Sender MBean") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+
+        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
+        assertNotNull(bean);
+        assertTrue(bean.isConnected());
+
+        ObjectName regionBeanName = service.getRegionMBeanName(cache
+            .getDistributedSystem().getDistributedMember(), "/" + regionPath);
+        RegionMXBean rBean = service.getMBeanInstance(regionBeanName,
+            RegionMXBean.class);
+        assertTrue(rBean.isGatewayEnabled());
+
+      }
+    };
+    vm.invoke(checkMBean);
+  }
+}
\ No newline at end of file


[31/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
deleted file mode 100644
index 5e32bb6..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialWANPersistenceEnabledGatewaySenderDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest extends
-    SerialWANPersistenceEnabledGatewaySenderDUnitTest {
-
-  public SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java
deleted file mode 100644
index d6cecd1..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialWANPropagationDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class SerialWANPropagationOffHeapDUnitTest extends SerialWANPropagationDUnitTest {
-
-  public SerialWANPropagationOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java
deleted file mode 100644
index 4abd6e6..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialWANPropagation_PartitionedRegionDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class SerialWANPropagation_PartitionedRegionOffHeapDUnitTest
-  extends SerialWANPropagation_PartitionedRegionDUnitTest {
-
-  public SerialWANPropagation_PartitionedRegionOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java
deleted file mode 100644
index e0f29db..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.concurrent.ConcurrentParallelGatewaySenderOperation_2_DUnitTest;
-import com.gemstone.gemfire.test.dunit.VM;
-
-@Category(DistributedTest.class)
-public class ParallelGatewaySenderOperation_2_DUnitTest extends ConcurrentParallelGatewaySenderOperation_2_DUnitTest {
-
-  private static final long serialVersionUID = 1L;
-
-  public ParallelGatewaySenderOperation_2_DUnitTest() {
-    super();
-  }
-
-  protected void createSender(VM vm, int concurrencyLevel, boolean manualStart) {
-    vm.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, manualStart));
-  }
-
-  protected void createSenders(VM vm, int concurrencyLevel) {
-    vm.invoke(() -> createSender("ln1", 2, true, 100, 10, false, false, null, true));
-    vm.invoke(() -> createSender("ln2", 3, true, 100, 10, false, false, null, true));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java
deleted file mode 100644
index 4981c97..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.GemFireIOException;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
-import com.gemstone.gemfire.internal.cache.tier.sockets.MessageTooLargeException;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.RMIException;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-/**
- * DUnit test for operations on ParallelGatewaySender
- */
-@Category(DistributedTest.class)
-public class ParallelGatewaySenderOperationsDUnitTest extends WANTestBase {
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe||Unexpected IOException");
-  }
-  
-  @Test
-  public void testParallelGatewaySenderWithoutStarting() {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, false);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    vm5.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    vm6.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    vm7.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    
-    validateRegionSizes(getTestMethodName() + "_PR", 0, vm2, vm3);
-  }
-  
-  /**
-   * Defect 44323 (ParallelGatewaySender should not be started on Accessor node)
-   */
-  @Test
-  public void testParallelGatewaySenderStartOnAccessorNode() {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, true, true);
-
-    Wait.pause(2000);
-    
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10 ));
-
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    validateRegionSizes(getTestMethodName() + "_PR", 10, vm2, vm3);
-  }
-
-  /**
-   * Normal scenario in which the sender is paused in between.
-   */
-  @Test
-  public void testParallelPropagationSenderPause() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    //make sure all the senders are running before doing any puts
-    waitForSendersRunning();
-    
-    //FIRST RUN: now, the senders are started. So, start the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-    
-    //now, pause all of the senders
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //SECOND RUN: keep one thread doing puts to the region
-    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //verify region size remains on remote vm and is restricted below a specified limit (i.e. number of puts in the first run)
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
-  }
-
-  /**
-   * Normal scenario in which a paused sender is resumed.
-   */
-  @Test
-  public void testParallelPropagationSenderResume() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    //make sure all the senders are running before doing any puts
-    waitForSendersRunning();
-    
-    //now, the senders are started. So, start the puts
-    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //now, pause all of the senders
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //sleep for a second or two
-    Wait.pause(2000);
-    
-    //resume the senders
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    Wait.pause(2000);
-
-    validateParallelSenderQueueAllBucketsDrained();
-    
-    //find the region size on remote vm
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
-  }
-
-  /**
-   * Negative scenario in which a sender that is stopped (and not paused) is resumed.
-   * Expected: resume is only valid for pause. If a sender which is stopped is resumed,
-   * it will not be started again.
-   */
-  @Test
-  public void testParallelPropagationSenderResumeNegativeScenario() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    //wait till the senders are running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    //start the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-
-    //let the queue drain completely
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
-    
-    //stop the senders
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    //now, try to resume a stopped sender
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    //do more puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //validate region size on remote vm to contain only the events put in local site 
-    //before the senders are stopped.
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 100 ));
-  }
-
-  /**
-   * Normal scenario in which a sender is stopped.
-   */
-  @Test
-  public void testParallelPropagationSenderStop() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    //make sure all the senders are running before doing any puts
-    waitForSendersRunning();
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-    
-    //now, stop all of the senders
-    stopSenders();
-    
-    //SECOND RUN: keep one thread doing puts
-    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //verify region size remains on remote vm and is restricted below a specified limit (number of puts in the first run)
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
-  }
-
-  /**
-   * Normal scenario in which a sender is stopped and then started again.
-   */
-  @Test
-  public void testParallelPropagationSenderStartAfterStop() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-    String regionName = getTestMethodName() + "_PR";
-
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    vm3.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-
-    createReceiverInVMs(vm2, vm3);
-
-    vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    vm6.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    vm7.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-
-    vm4.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-    vm5.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-    vm6.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-    vm7.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> waitForSenderRunningState("ln"));
-    vm5.invoke(() -> waitForSenderRunningState("ln"));
-    vm6.invoke(() -> waitForSenderRunningState("ln"));
-    vm7.invoke(() -> waitForSenderRunningState("ln"));
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( regionName, 200 ));
-    
-    //now, stop all of the senders
-    vm4.invoke(() -> stopSender("ln"));
-    vm5.invoke(() -> stopSender("ln"));
-    vm6.invoke(() -> stopSender("ln"));
-    vm7.invoke(() -> stopSender("ln"));
-
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 ));
-
-    //SECOND RUN: do some of the puts after the senders are stopped
-    vm4.invoke(() -> WANTestBase.doPuts( regionName, 1000 ));
-    
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 ));
-    
-    //start the senders again
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> waitForSenderRunningState("ln"));
-    vm5.invoke(() -> waitForSenderRunningState("ln"));
-    vm6.invoke(() -> waitForSenderRunningState("ln"));
-    vm7.invoke(() -> waitForSenderRunningState("ln"));
-
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 ));
-
-    //SECOND RUN: do some more puts
-    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( regionName, 1000 ));
-    async.join();
-    
-    //verify all the buckets on all the sender nodes are drained
-    validateParallelSenderQueueAllBucketsDrained();
-    
-    //verify the events propagate to remote site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(regionName, 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm6.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm7.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-  }
-
-  /**
-   * Normal scenario in which a sender is stopped and then started again.
-   * Differs from above test case in the way that when the sender is starting from
-   * stopped state, puts are simultaneously happening on the region by another thread.
-   */
-  @Test
-  public void testParallelPropagationSenderStartAfterStop_Scenario2() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    //make sure all the senders are running before doing any puts
-    waitForSendersRunning();
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now started");
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
-    
-    LogWriterUtils.getLogWriter().info("Done few puts");
-
-    //Make sure the puts make it to the remote side
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
-
-    //now, stop all of the senders
-    stopSenders();
-    
-    LogWriterUtils.getLogWriter().info("All the senders are stopped");
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
-    
-    //SECOND RUN: do some of the puts after the senders are stopped
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Done some more puts in second run");
-    
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-    
-    //SECOND RUN: start async puts on region
-    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
-    LogWriterUtils.getLogWriter().info("Started high number of puts by async thread");
-
-    LogWriterUtils.getLogWriter().info("Starting the senders at the same time");
-    //when puts are happening by another thread, start the senders
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("All the senders are started");
-    
-    async.join();
-
-    //verify all the buckets on all the sender nodes are drained
-    validateParallelSenderQueueAllBucketsDrained();
-    
-    //verify that the queue size ultimately becomes zero. That means all the events propagate to remote site.
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
-  }
-  
-  /**
-   * Normal scenario in which a sender is stopped and then started again on accessor node.
-   */
-  @Test
-  public void testParallelPropagationSenderStartAfterStopOnAccessorNode() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, true, true);
-
-    //make sure all the senders are not running on accessor nodes and running on non-accessor nodes
-    waitForSendersRunning();
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
-    
-    //now, stop all of the senders
-    stopSenders();
-    
-    Wait.pause(2000);
-    
-    //SECOND RUN: do some of the puts after the senders are stopped
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-    
-    //start the senders again
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-
-    //SECOND RUN: do some more puts
-    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    async.join();
-    Wait.pause(5000);
-    
-    //verify all buckets drained only on non-accessor nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    //verify the events propagate to remote site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
-  }
-
-  /**
-   * Normal scenario in which a combinations of start, pause, resume operations
-   * is tested
-   */
-  @Test
-  public void testStartPauseResumeParallelGatewaySender() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Done 1000 puts on local site");
-    
-    //Since puts are already done on userPR, it will have the buckets created. 
-    //During sender start, it will wait until those buckets are created for shadowPR as well.
-    //Start the senders in async threads, so colocation of shadowPR will be complete and 
-    //missing buckets will be created in PRHARedundancyProvider.createMissingBuckets().
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    waitForSendersRunning();
-    
-    LogWriterUtils.getLogWriter().info("Started senders on local site");
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
-    LogWriterUtils.getLogWriter().info("Done 5000 puts on local site");
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Paused senders on local site");
-    
-    vm4.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    vm5.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    vm6.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    vm7.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Started 1000 async puts on local site");
-
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Resumed senders on local site");
-
-    vm4.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-    vm5.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-    vm6.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-    vm7.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      fail("Interrupted the async invocation.", e);
-    }
-    
-    //verify all buckets drained on all sender nodes.
-    validateParallelSenderQueueAllBucketsDrained();
-
-    validateRegionSizes(getTestMethodName() + "_PR", 5000, vm2, vm3);
-  }
-
-  /**
-   * Since the sender is attached to a region and in use, it can not be
-   * destroyed. Hence, exception is thrown by the sender API.
-   */
-  @Test
-  public void testDestroyParallelGatewaySenderExceptionScenario() {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    // make sure all the senders are running before doing any puts
-    waitForSendersRunning();
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    // try destroying on couple of nodes
-    try {
-      vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
-    }
-    catch (RMIException e) {
-      assertTrue("Cause of the exception should be GatewaySenderException", e
-          .getCause() instanceof GatewaySenderException);
-    }
-    try {
-      vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
-    }
-    catch (RMIException e) {
-      assertTrue("Cause of the exception should be GatewaySenderException", e
-          .getCause() instanceof GatewaySenderException);
-    }
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testDestroyParallelGatewaySender() {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
-
-    // make sure all the senders are running
-    waitForSendersRunning();
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    Wait.pause(2000);
-    
-    //stop the sender and remove from region before calling destroy on it
-    stopSenders();
-
-    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion(
-        "ln", getTestMethodName() + "_PR" ));
-    vm5.invoke(() -> WANTestBase.removeSenderFromTheRegion(
-        "ln", getTestMethodName() + "_PR" ));
-    vm6.invoke(() -> WANTestBase.removeSenderFromTheRegion(
-        "ln", getTestMethodName() + "_PR" ));
-    vm7.invoke(() -> WANTestBase.removeSenderFromTheRegion(
-        "ln", getTestMethodName() + "_PR" ));
-
-    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
-    vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
-    vm6.invoke(() -> WANTestBase.destroySender( "ln" ));
-    vm7.invoke(() -> WANTestBase.destroySender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
-    vm5.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
-    vm6.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
-    vm7.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
-  }
-
-  @Test
-  public void testParallelGatewaySenderMessageTooLargeException() {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    // Create and start sender with reduced maximum message size and 1 dispatcher thread
-    String regionName = getTestMethodName() + "_PR";
-    vm4.invoke(() -> setMaximumMessageSize( 1024*1024 ));
-    vm4.invoke(() -> createCache( lnPort ));
-    vm4.invoke(() -> setNumDispatcherThreadsForTheRun( 1 ));
-    vm4.invoke(() -> createSender( "ln", 2, true, 100, 100, false, false, null, false ));
-    vm4.invoke(() -> createPartitionedRegion( regionName, "ln", 0, 100, isOffHeap() ));
-
-    // Do puts
-    int numPuts = 200;
-    vm4.invoke(() -> doPuts( regionName, numPuts, new byte[11000] ));
-    validateRegionSizes(regionName, numPuts, vm4);
-
-    // Start receiver
-    IgnoredException ignoredMTLE = IgnoredException.addIgnoredException(MessageTooLargeException.class.getName(), vm4);
-    IgnoredException ignoredGIOE = IgnoredException.addIgnoredException(GemFireIOException.class.getName(), vm4);
-    vm2.invoke(() -> createCache( nyPort ));
-    vm2.invoke(() -> createPartitionedRegion( regionName, null, 0, 100, isOffHeap() ));
-    vm2.invoke(() -> createReceiver());
-    validateRegionSizes( regionName, numPuts, vm2 );
-
-    vm4.invoke(() -> {
-      final AbstractGatewaySender sender = (AbstractGatewaySender) cache.getGatewaySender("ln");
-      assertTrue(sender.getStatistics().getBatchesResized() > 0);
-    });
-    ignoredMTLE.remove();
-    ignoredGIOE.remove();
-  }
-
-  private void setMaximumMessageSize(int maximumMessageSizeBytes) {
-    Message.MAX_MESSAGE_SIZE = maximumMessageSizeBytes;
-    LogWriterUtils.getLogWriter()
-        .info("Set gemfire.client.max-message-size: " + System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "client.max-message-size"));
-  }
-
-  private void createSendersReceiversAndPartitionedRegion(Integer lnPort, Integer nyPort, boolean createAccessors,
-      boolean startSenders) {
-    // Note: This is a test-specific method used by several test to create
-    // receivers, senders and partitioned regions.
-    createSendersAndReceivers(lnPort, nyPort);
-
-    createPartitionedRegions(createAccessors);
-
-    if (startSenders) {
-      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    }
-  }
-
-  private void createSendersAndReceivers(Integer lnPort, Integer nyPort) {
-    // Note: This is a test-specific method used by several test to create
-    // receivers and senders.
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-    vm5.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-    vm6.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-    vm7.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
-  }
-
-  private void createPartitionedRegions(boolean createAccessors) {
-    // Note: This is a test-specific method used by several test to create
-    // partitioned regions.
-    String regionName = getTestMethodName() + "_PR";
-    vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-
-    if (createAccessors) {
-      vm6.invoke(() -> createPartitionedRegionAsAccessor(regionName, "ln", 1, 100));
-      vm7.invoke(() -> createPartitionedRegionAsAccessor(regionName, "ln", 1, 100));
-    } else {
-      vm6.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-      vm7.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    }
-
-    vm2.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-    vm3.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
-  }
-
-  private void stopSenders() {
-    vm4.invoke(() -> stopSender("ln"));
-    vm5.invoke(() -> stopSender("ln"));
-    vm6.invoke(() -> stopSender("ln"));
-    vm7.invoke(() -> stopSender("ln"));
-  }
-
-  private void waitForSendersRunning() {
-    vm4.invoke(() -> waitForSenderRunningState("ln"));
-    vm5.invoke(() -> waitForSenderRunningState("ln"));
-    vm6.invoke(() -> waitForSenderRunningState("ln"));
-    vm7.invoke(() -> waitForSenderRunningState("ln"));
-  }
-
-  private void validateParallelSenderQueueAllBucketsDrained() {
-    vm4.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java
deleted file mode 100644
index a248520..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.cache.RegionQueue;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-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.junit.categories.DistributedTest;
-import com.jayway.awaitility.Awaitility;
-
-/**
- * DUnit for ParallelSenderQueue overflow operations.
- */
-@Category(DistributedTest.class)
-public class ParallelGatewaySenderQueueOverflowDUnitTest extends WANTestBase {
-
-  @Test
-  public void testParallelSenderQueueEventsOverflow_NoDiskStoreSpecified() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //give some time for the senders to pause
-    Wait.pause(1000);
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    int numEventPuts = 50;
-    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
-    
-    
-    //considering a memory limit of 40 MB, maximum of 40 events can be in memory. Rest should be on disk.
-    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(()-> 
-    {
-      long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-      long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-      long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-      long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-      
-      long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-      long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-      long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-      long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-      
-      LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
-      LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
-      long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
-      assertTrue("Total number of entries overflown to disk should be at least greater than 55", (totalOverflown > 55));
-
-      long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
-      //expected is twice the number of events put due to redundancy level of 1  
-      assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
-      
-    });
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50, 240000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50, 240000 ));
-  }
-  
-  /**
-   * Keep same max memory limit for all the VMs
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void testParallelSenderQueueEventsOverflow() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //give some time for the senders to pause
-    Wait.pause(1000);
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    int numEventPuts = 50;
-    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
-    
-    long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    
-    long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
-    LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
-    
-    long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
-    //considering a memory limit of 40 MB, maximum of 40 events can be in memory. Rest should be on disk.
-    assertTrue("Total number of entries overflown to disk should be at least greater than 55", (totalOverflown > 55));
-    
-    long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
-    //expected is twice the number of events put due to redundancy level of 1  
-    assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
-  }
-
-  /**
-   * Set a different memory limit for each VM and make sure that all the VMs are utilized to
-   * full extent of available memory.
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void testParallelSenderQueueEventsOverflow_2() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 5, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 5, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 20, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //give some time for the senders to pause
-    Wait.pause(1000);
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    int numEventPuts = 50;
-    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
-    
-    long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    
-    long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
-    LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
-    
-    long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
-    //considering a memory limit of 40 MB, maximum of 40 events can be in memory. Rest should be on disk.
-    assertTrue("Total number of entries overflown to disk should be at least greater than 55", (totalOverflown > 55));
-    
-    long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
-    //expected is twice the number of events put due to redundancy level of 1  
-    assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
-    
-    //assert the numbers for each VM
-    assertTrue("Number of entries in memory VM4 is incorrect. Should be less than 10", (numMemVm4 < 10));
-    assertTrue("Number of entries in memory VM5 is incorrect. Should be less than 5", (numMemVm5 < 5));
-    assertTrue("Number of entries in memory VM6 is incorrect. Should be less than 5", (numMemVm6 < 5));
-    assertTrue("Number of entries in memory VM7 is incorrect. Should be less than 20", (numMemVm7 < 20));
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
-  }
-
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void testParallelSenderQueueNoEventsOverflow() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 10, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //give some time for the senders to pause
-    Wait.pause(1000);
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    int numEventPuts = 15;
-    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
-    
-    long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
-    
-    long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
-    LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
-    
-    long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
-    //all 30 (considering redundant copies) events should accommodate in 40 MB space given to 4 senders
-    assertEquals("Total number of entries overflown to disk is incorrect", 0, totalOverflown);
-    
-    long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
-    //expected is twice the number of events put due to redundancy level of 1  
-    assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 15 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 15 ));
-  }
-  
-  /**
-   * Test to validate that ParallelGatewaySenderQueue diskSynchronous attribute
-   * when persistence of sender is enabled. 
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void test_ValidateParallelGatewaySenderQueueAttributes_1() {
-    Integer localLocPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    
-    Integer remoteLocPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
-    
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);  
-
-    File directory = new File("TKSender" + "_disk_"
-        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    directory.mkdir();
-    File[] dirs1 = new File[] { directory };
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    dsf.setDiskDirs(dirs1);
-    DiskStore diskStore = dsf.create("FORNY");
-    
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setParallel(true);//set parallel to true
-    fact.setBatchConflationEnabled(true);
-    fact.setBatchSize(200);
-    fact.setBatchTimeInterval(300);
-    fact.setPersistenceEnabled(true);//enable the persistence
-    fact.setDiskSynchronous(true);
-    fact.setDiskStoreName("FORNY");
-    fact.setMaximumQueueMemory(200);
-    fact.setAlertThreshold(1200);
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    fact.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    final IgnoredException exTKSender = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      GatewaySender sender1 = fact.create("TKSender", 2);
-
-      AttributesFactory factory = new AttributesFactory();
-      factory.addGatewaySenderId(sender1.getId());
-      factory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-      Region region = cache.createRegionFactory(factory.create()).create(
-          "test_ValidateGatewaySenderAttributes");
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      assertEquals(senders.size(), 1);
-      GatewaySender gatewaySender = senders.iterator().next();
-      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
-          .getQueues();
-      assertEquals(regionQueues.size(), 1);
-      RegionQueue regionQueue = regionQueues.iterator().next();
-      assertEquals(true, regionQueue.getRegion().getAttributes()
-          .isDiskSynchronous());
-    } finally {
-      exTKSender.remove();
-    }
-  }
-  
-  /**
-   * Test to validate that ParallelGatewaySenderQueue diskSynchronous attribute
-   * when persistence of sender is not enabled. 
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void test_ValidateParallelGatewaySenderQueueAttributes_2() {
-    Integer localLocPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    
-    Integer remoteLocPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
-    
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);  
-
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setParallel(true);//set parallel to true
-    fact.setBatchConflationEnabled(true);
-    fact.setBatchSize(200);
-    fact.setBatchTimeInterval(300);
-    fact.setPersistenceEnabled(false);//set persistence to false
-    fact.setDiskSynchronous(true);
-    fact.setMaximumQueueMemory(200);
-    fact.setAlertThreshold(1200);
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    fact.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    final IgnoredException ex = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      GatewaySender sender1 = fact.create("TKSender", 2);
-      AttributesFactory factory = new AttributesFactory();
-      factory.addGatewaySenderId(sender1.getId());
-      factory.setDataPolicy(DataPolicy.PARTITION);
-      Region region = cache.createRegionFactory(factory.create()).create(
-          "test_ValidateGatewaySenderAttributes");
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      assertEquals(senders.size(), 1);
-      GatewaySender gatewaySender = senders.iterator().next();
-      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
-          .getQueues();
-      assertEquals(regionQueues.size(), 1);
-      RegionQueue regionQueue = regionQueues.iterator().next();
-      assertEquals(false, regionQueue.getRegion().getAttributes()
-          .isDiskSynchronous());
-    } finally {
-      ex.remove();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
deleted file mode 100644
index 87a74b9..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-
-/**
- * 
- */
-@Category(DistributedTest.class)
-public class ParallelWANConflationDUnitTest extends WANTestBase {
-  private static final long serialVersionUID = 1L;
-
-  public ParallelWANConflationDUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("java.net.ConnectException");
-  }
-
-  @Test
-  public void testParallelPropagationConflationDisabled() throws Exception {
-    initialSetUp();
-
-    createSendersNoConflation();
-
-    createSenderPRs();
-
-    startPausedSenders();
-
-    createReceiverPrs();
-
-    final Map keyValues = putKeyValues();
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() ));
-    
-    final Map updateKeyValues = updateKeyValues();
-
-    vm4.invoke(() ->checkQueueSize( "ln", (keyValues.size() + updateKeyValues.size()) ));
-
-    vm2.invoke(() ->validateRegionSize(
-        getTestMethodName(), 0 ));
-
-    resumeSenders();
-
-    keyValues.putAll(updateKeyValues);
-    validateReceiverRegionSize(keyValues);
-    
-  }
-
-  /**
-   * This test is disabled as it is not guaranteed to pass it everytime. This
-   * test is related to the conflation in batch. yet did find any way to
-   * ascertain that the vents in the batch will always be conflated.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationBatchConflation() throws Exception {
-    initialSetUp();
-    
-    vm4.invoke(() ->createSender( "ln", 2,
-        true, 100, 50, false, false, null, true ));
-    vm5.invoke(() ->createSender( "ln", 2,
-      true, 100, 50, false, false, null, true ));
-    vm6.invoke(() ->createSender( "ln", 2,
-      true, 100, 50, false, false, null, true ));
-    vm7.invoke(() ->createSender( "ln", 2,
-    true, 100, 50, false, false, null, true ));
-  
-    createSenderPRs();
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    pauseSenders();
-    
-    createReceiverPrs();
-
-    final Map keyValues = new HashMap();
-    
-    for (int i = 1; i <= 10; i++) {
-      for (int j = 1; j <= 10; j++) {
-        keyValues.put(j, i) ;
-      }
-      vm4.invoke(() ->putGivenKeyValue(
-        getTestMethodName(), keyValues ));
-    }
-    
-    vm4.invoke(() ->enableConflation( "ln" ));
-    vm5.invoke(() ->enableConflation( "ln" ));
-    vm6.invoke(() ->enableConflation( "ln" ));
-    vm7.invoke(() ->enableConflation( "ln" ));
-    
-    resumeSenders();
-    
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> 
-        WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> 
-        WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> 
-        WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> 
-        WANTestBase.getSenderStats( "ln", 0 ));
-    
-    assertTrue("No events conflated in batch", (v4List.get(8) + v5List.get(8) + v6List.get(8) + v7List.get(8)) > 0);
-    
-    vm2.invoke(() ->validateRegionSize(
-      getTestMethodName(), 10 ));
-
-  }
-  
-  @Test
-  public void testParallelPropagationConflation() throws Exception {
-    doTestParallelPropagationConflation(0);
-  }
-  
-  @Test
-  public void testParallelPropagationConflationRedundancy2() throws Exception {
-    doTestParallelPropagationConflation(2);
-  }
-  
-  public void doTestParallelPropagationConflation(int redundancy) throws Exception {
-    initialSetUp();
-
-    createSendersWithConflation();
-
-    createSenderPRs(redundancy);
-
-    startPausedSenders();
-
-    createReceiverPrs();
-
-    final Map keyValues = putKeyValues();
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() ));
-    final Map updateKeyValues = updateKeyValues();
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() )); // creates aren't conflated
-    
-    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() )); // creates aren't conflated
-
-    vm2.invoke(() ->validateRegionSize(
-        getTestMethodName(), 0 ));
-
-    resumeSenders();
-
-    keyValues.putAll(updateKeyValues);
-    validateReceiverRegionSize(keyValues);
-  }
-  
-  @Test
-  public void testParallelPropagationConflationOfRandomKeys() throws Exception {
-    initialSetUp();
-
-    createSendersWithConflation();
-
-    createSenderPRs();
-
-    startPausedSenders();
-
-    createReceiverPrs();
-
-    final Map keyValues = putKeyValues();
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() ));
-    
-    final Map updateKeyValues = new HashMap();
-    while(updateKeyValues.size()!=10) {
-      int key = (new Random()).nextInt(keyValues.size());
-      updateKeyValues.put(key, key+"_updated");
-    }
-    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() ));
-
-    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
-
-    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() ));
-
-    vm2.invoke(() ->validateRegionSize(
-        getTestMethodName(), 0 ));
-
-    resumeSenders();
-
-    
-    keyValues.putAll(updateKeyValues);
-    validateReceiverRegionSize(keyValues);
-    
-  }
-  
-  @Test
-  public void testParallelPropagationColocatedRegionConflation()
-      throws Exception {
-    initialSetUp();
-
-    createSendersWithConflation();
-
-    createOrderShipmentOnSenders();
-
-    startPausedSenders();
-
-    createOrderShipmentOnReceivers();
-
-    Map custKeyValues = (Map)vm4.invoke(() ->putCustomerPartitionedRegion( 20 ));
-    Map orderKeyValues = (Map)vm4.invoke(() ->putOrderPartitionedRegion( 20 ));
-    Map shipmentKeyValues = (Map)vm4.invoke(() ->putShipmentPartitionedRegion( 20 ));
-
-    vm4.invoke(() -> 
-        WANTestBase.checkQueueSize(
-            "ln",
-            (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
-                .size()) ));
-
-    Map updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
-    Map updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegion( 10 ));
-    Map updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegion( 10 ));
-    int sum = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
-        .size())
-        + updatedCustKeyValues.size()
-        + updatedOrderKeyValues.size()
-        + updatedShipmentKeyValues.size();
-    vm4.invoke(() -> 
-        WANTestBase.checkQueueSize(
-            "ln",
-            sum));
-
-    
-    updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
-    updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegion( 10 ));
-    updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegion( 10 ));
-    int sum2 = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
-        .size())
-        + updatedCustKeyValues.size()
-        + updatedOrderKeyValues.size()
-        + updatedShipmentKeyValues.size();
-    vm4.invoke(() -> 
-        WANTestBase.checkQueueSize(
-            "ln",
-            sum2));
-
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.customerRegionName, 0 ));
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.orderRegionName, 0 ));
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.shipmentRegionName, 0 ));
-
-    resumeSenders();
-    
-    custKeyValues.putAll(updatedCustKeyValues);
-    orderKeyValues.putAll(updatedOrderKeyValues);
-    shipmentKeyValues.putAll(updatedShipmentKeyValues);
-    
-    validateColocatedRegionContents(custKeyValues, orderKeyValues,
-        shipmentKeyValues);
-    
-  }
-  
-  //
-  //This is the same as the previous test, except for the UsingCustId methods
-  @Test
-  public void testParallelPropagationColocatedRegionConflationSameKey()
-      throws Exception {
-    initialSetUp();
-
-    createSendersWithConflation();
-
-    createOrderShipmentOnSenders();
-
-    startPausedSenders();
-
-    createOrderShipmentOnReceivers();
-
-    Map custKeyValues = (Map)vm4.invoke(() ->putCustomerPartitionedRegion( 20 ));
-    Map orderKeyValues = (Map)vm4.invoke(() ->putOrderPartitionedRegionUsingCustId( 20 ));
-    Map shipmentKeyValues = (Map)vm4.invoke(() ->putShipmentPartitionedRegionUsingCustId( 20 ));
-
-    vm4.invoke(() ->checkQueueSize( "ln", (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
-      .size()) ));
-
-    Map updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
-    Map updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegionUsingCustId( 10 ));
-    Map updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegionUsingCustId( 10 ));
-    int sum = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
-        .size()) + updatedCustKeyValues.size() + updatedOrderKeyValues.size() + updatedShipmentKeyValues.size() ;
-
-    vm4.invoke(() ->checkQueueSize( "ln", sum));
-
-    updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
-    updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegionUsingCustId( 10 ));
-    updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegionUsingCustId( 10 ));
-
-    int sum2 = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
-        .size()) + updatedCustKeyValues.size() + updatedOrderKeyValues.size() + updatedShipmentKeyValues.size();
-    vm4.invoke(() ->checkQueueSize( "ln", sum2));
-
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.customerRegionName, 0 ));
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.orderRegionName, 0 ));
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.shipmentRegionName, 0 ));
-
-    resumeSenders();
-
-    custKeyValues.putAll(updatedCustKeyValues);
-    orderKeyValues.putAll(updatedOrderKeyValues);
-    shipmentKeyValues.putAll(updatedShipmentKeyValues);
-    
-    validateColocatedRegionContents(custKeyValues, orderKeyValues,
-        shipmentKeyValues);
-  }
-  
-  protected void validateColocatedRegionContents(Map custKeyValues,
-      Map orderKeyValues, Map shipmentKeyValues) {
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.customerRegionName, custKeyValues.size() ));
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.orderRegionName, orderKeyValues.size() ));
-    vm2.invoke(() ->validateRegionSize(
-        WANTestBase.shipmentRegionName, shipmentKeyValues.size() ));
-
-    vm2.invoke(() ->validateRegionContents(
-        WANTestBase.customerRegionName, custKeyValues ));
-    vm2.invoke(() ->validateRegionContents(
-        WANTestBase.orderRegionName, orderKeyValues ));
-    vm2.invoke(() ->validateRegionContents(
-        WANTestBase.shipmentRegionName, shipmentKeyValues ));
-    
-    vm3.invoke(() ->validateRegionSize(
-        WANTestBase.customerRegionName, custKeyValues.size() ));
-    vm3.invoke(() ->validateRegionSize(
-        WANTestBase.orderRegionName, orderKeyValues.size() ));
-    vm3.invoke(() ->validateRegionSize(
-        WANTestBase.shipmentRegionName, shipmentKeyValues.size() ));
-
-    vm3.invoke(() ->validateRegionContents(
-        WANTestBase.customerRegionName, custKeyValues ));
-    vm3.invoke(() ->validateRegionContents(
-        WANTestBase.orderRegionName, orderKeyValues ));
-    vm3.invoke(() ->validateRegionContents(
-        WANTestBase.shipmentRegionName, shipmentKeyValues ));
-  }
-
-  protected void createOrderShipmentOnReceivers() {
-    vm2.invoke(() ->createCustomerOrderShipmentPartitionedRegion(null, 1, 8, isOffHeap() ));
-    vm3.invoke(() ->createCustomerOrderShipmentPartitionedRegion(null, 1, 8, isOffHeap() ));
-  }
-
-  protected void createOrderShipmentOnSenders() {
-    vm4.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
-    vm5.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
-    vm6.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
-    vm7.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
-  }
-  
-  protected Map updateKeyValues() {
-    final Map updateKeyValues = new HashMap();
-    for(int i=0;i<10;i++) {
-      updateKeyValues.put(i, i+"_updated");
-    }
-    
-    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
-    return updateKeyValues;
-  }
-
-  protected Map putKeyValues() {
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 20; i++) {
-      keyValues.put(i, i);
-    }
-    
-    
-    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), keyValues ));
-    return keyValues;
-  }
-
-  protected void validateReceiverRegionSize(final Map keyValues) {
-    vm2.invoke(() ->validateRegionSize(
-        getTestMethodName(), keyValues.size() ));
-    vm3.invoke(() ->validateRegionSize(
-      getTestMethodName(), keyValues.size() ));
-    
-    vm2.invoke(() ->validateRegionContents(
-        getTestMethodName(), keyValues ));
-    vm3.invoke(() ->validateRegionContents(
-        getTestMethodName(), keyValues ));
-  }
-
-  protected void resumeSenders() {
-    vm4.invoke(() ->resumeSender( "ln" ));
-    vm5.invoke(() ->resumeSender( "ln" ));
-    vm6.invoke(() ->resumeSender( "ln" ));
-    vm7.invoke(() ->resumeSender( "ln" ));
-  }
-
-  protected void createReceiverPrs() {
-    vm2.invoke(() ->createPartitionedRegion(
-        getTestMethodName(), null, 1, 8, isOffHeap() ));
-    vm3.invoke(() ->createPartitionedRegion(
-        getTestMethodName(), null, 1, 8, isOffHeap() ));
-  }
-
-  protected void startPausedSenders() {
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    pauseSenders();
-  }
-
-  protected void pauseSenders() {
-    vm4.invoke(() ->pauseSender( "ln" ));
-    vm5.invoke(() ->pauseSender( "ln" ));
-    vm6.invoke(() ->pauseSender( "ln" ));
-    vm7.invoke(() ->pauseSender( "ln" ));
-  }
-  
-  protected void createSenderPRs() {
-    createSenderPRs(0);
-  }
-
-  protected void createSenderPRs(int redundancy) {
-    vm4.invoke(() ->createPartitionedRegion(
-        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
-    vm5.invoke(() ->createPartitionedRegion(
-        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
-    vm6.invoke(() ->createPartitionedRegion(
-        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
-    vm7.invoke(() ->createPartitionedRegion(
-        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
-  }
-
-  protected void initialSetUp() {
-    Integer lnPort = (Integer)vm0.invoke(() ->createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() ->createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-  }
-  
-  protected void createSendersNoConflation() {
-    vm4.invoke(() ->createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() ->createSender( "ln", 2,
-        true, 100, 10, false, false, null, true  ));
-    vm6.invoke(() ->createSender( "ln", 2,
-        true, 100, 10, false, false, null, true  ));
-    vm7.invoke(() ->createSender( "ln", 2,
-        true, 100, 10, false, false, null, true  ));
-  }
-  
-  protected void createSendersWithConflation() {
-    vm4.invoke(() ->createSender( "ln", 2,
-        true, 100, 2, true, false, null, true ));
-    vm5.invoke(() ->createSender( "ln", 2,
-        true, 100, 2, true, false, null, true ));
-    vm6.invoke(() ->createSender( "ln", 2,
-        true, 100, 2, true, false, null, true ));
-    vm7.invoke(() ->createSender( "ln", 2,
-        true, 100, 2, true, false, null, true ));
-  }
-  
-}


[55/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-web/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-web/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/ClientHttpRequestJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/ClientHttpRequestJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/ClientHttpRequestJUnitTest.java
deleted file mode 100644
index bbe961b..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/ClientHttpRequestJUnitTest.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * 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.management.internal.web.http;
-
-import static org.junit.Assert.*;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jmock.Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.MediaType;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-
-import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
-import com.gemstone.gemfire.management.internal.web.domain.Link;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * The ClientHttpRequestJUnitTest class is a test suite of test cases testing the contract and functionality of the
- * ClientHttpRequest class.
- * <p/>
- * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
- * @see com.gemstone.gemfire.management.internal.web.http.ClientHttpRequest
- * @see org.jmock.Mockery
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class ClientHttpRequestJUnitTest extends AbstractWebTestCase {
-
-  private Mockery mockContext;
-
-  @Before
-  public void setUp() {
-    mockContext = new Mockery();
-    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  @Test
-  public void testCreateClientHttpRequest() throws Exception {
-    final Link expectedLink = new Link("test", toUri("http://host.domain.com:8080/app/service"));
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertNotNull(request);
-    assertEquals(expectedLink, request.getLink());
-  }
-
-  @Test(expected = AssertionError.class)
-  public void testCreateClientHttpRequestWithNullLink() {
-    new ClientHttpRequest(null);
-  }
-
-  @Test
-  public void testGetMethod() throws Exception {
-    Link link = new Link("get-resource", toUri("http://host.domain.com:8080/app/resources/{id}"));
-    ClientHttpRequest request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.GET, request.getMethod());
-
-    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.DELETE);
-    request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.DELETE, request.getMethod());
-
-    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/service"), HttpMethod.HEAD);
-    request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.HEAD, request.getMethod());
-
-    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/service"), HttpMethod.OPTIONS);
-    request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.OPTIONS, request.getMethod());
-
-    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/resources"), HttpMethod.POST);
-    request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.POST, request.getMethod());
-
-    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/resources"), HttpMethod.PUT);
-    request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.PUT, request.getMethod());
-
-    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app"), HttpMethod.TRACE);
-    request = new ClientHttpRequest(link);
-
-    assertEquals(link, request.getLink());
-    assertEquals(org.springframework.http.HttpMethod.TRACE, request.getMethod());
-  }
-
-  @Test
-  public void testIsDelete() throws Exception {
-    final Link expectedLink = new Link("delete", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.DELETE);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertTrue(request.isDelete());
-    assertFalse(request.isGet());
-    assertFalse(request.isPost());
-    assertFalse(request.isPut());
-  }
-
-  @Test
-  public void testIsGet() throws Exception {
-    final Link expectedLink = new Link("get", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.GET);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertFalse(request.isDelete());
-    assertTrue(request.isGet());
-    assertFalse(request.isPost());
-    assertFalse(request.isPut());
-  }
-
-  @Test
-  public void testIsPost() throws Exception {
-    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/resources"), HttpMethod.POST);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertFalse(request.isDelete());
-    assertFalse(request.isGet());
-    assertTrue(request.isPost());
-    assertFalse(request.isPut());
-  }
-
-  @Test
-  public void testIsPut() throws Exception {
-    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.PUT);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertFalse(request.isDelete());
-    assertFalse(request.isGet());
-    assertFalse(request.isPost());
-    assertTrue(request.isPut());
-  }
-
-  @Test
-  public void testGetPathVariables() throws Exception {
-    final Link expectedLink = new Link("test", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{author}/{title}"));
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals(Arrays.asList("name", "author", "title"), request.getPathVariables());
-  }
-
-  @Test
-  public void testGetPathVariablesWithUriHavingNoPathVariables() throws Exception {
-    final Link expectedLink = new Link("test", toUri("http://host.domain.com:8080/app/service"));
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-
-    final List<String> actualPathVariables = request.getPathVariables();
-
-    assertNotNull(actualPathVariables);
-    assertTrue(actualPathVariables.isEmpty());
-  }
-
-  @Test
-  public void testGetURI() throws Exception {
-    final URI expectedURI = toUri("http://host.domain.com:8080/app/service");
-    final Link expectedLink = new Link("test", expectedURI);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals(expectedURI, request.getURI());
-  }
-
-  @Test
-  public void testGetURLForGet() throws Exception {
-    final Link expectedLink = new Link("find", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.GET);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    request.addParameterValues("author", "Rowling");
-    request.addParameterValues("category", "science-fiction");
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals("http://host.domain.com:8080/app/libraries/amazon/books?author=Rowling&category=science-fiction",
-      toString(request.getURL(Collections.singletonMap("name", "amazon"))));
-  }
-
-  @Test
-  public void testGetURLForGetEncoded() throws Exception {
-    final Link expectedLink = new Link("readValue4Key", toUri("http://host.domain.com:8080/app/regions/{region}/keys/{key}"), HttpMethod.GET);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    final Map<String, Object> uriVariables = new HashMap<String, Object>(4);
-
-    uriVariables.put("region", "Customers/Accounts/Orders");
-    uriVariables.put("key", "123");
-    uriVariables.put("item", "456");
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals("http://host.domain.com:8080/app/regions/Customers%2FAccounts%2FOrders/keys/123",
-      toString(request.getURL(uriVariables)));
-  }
-
-  @Test
-  public void testGetURLForGetWithQueryParametersNoBody() throws Exception {
-    final Link expectedLink = new Link("find", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{author}"), HttpMethod.GET);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    request.addParameterValues("author", "Rowling");
-    request.addParameterValues("category", "science-fiction");
-    request.addParameterValues("name", "Boston");
-    request.addParameterValues("year", "2007");
-
-    final Map<String, Object> uriVariables = new HashMap<String, Object>(4);
-
-    uriVariables.put("author", "Rowling");
-    uriVariables.put("category", "mystery");
-    uriVariables.put("isbn", "0-123456789");
-    uriVariables.put("name", "Amazon");
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals("http://host.domain.com:8080/app/libraries/Amazon/books/Rowling?category=science-fiction&year=2007",
-      toString(request.getURL(uriVariables)));
-  }
-
-  @Test
-  public void testGetURLForDelete() throws Exception {
-    final Link expectedLink = new Link("delete-all", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.DELETE);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    request.addParameterValues("category", "romance");
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals("http://host.domain.com:8080/app/libraries/congress/books?category=romance",
-      toString(request.getURL(Collections.singletonMap("name", "congress"))));
-  }
-
-  @Test
-  public void testGetURLForPost() throws Exception {
-    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.POST);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    request.addParameterValues("author", "Douglas Adams");
-    request.addParameterValues("title", "The Hitchhiker's Guide to the Galaxy");
-    request.addParameterValues("year", "1979");
-    request.addParameterValues("isbn", "0345453743");
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals("http://host.domain.com:8080/app/libraries/royal/books",
-      toString(request.getURL(Collections.singletonMap("name", "royal"))));
-  }
-
-  @Test
-  public void testGetURLForPut() throws Exception {
-    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{isbn}"), HttpMethod.PUT);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    request.addParameterValues("year", "1983");
-
-    final Map<String, String> uriVariables = new HashMap<String, String>(2);
-
-    uriVariables.put("name", "royal");
-    uriVariables.put("isbn", "0345453743");
-
-    assertEquals(expectedLink, request.getLink());
-    assertEquals("http://host.domain.com:8080/app/libraries/royal/books/0345453743",
-      toString(request.getURL(uriVariables)));
-  }
-
-  @Test
-  public void testCreateRequestEntityForGet() throws Exception {
-    final Link expectedLink = new Link("find", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.GET);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-
-    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.TEXT_PLAIN_VALUE);
-    request.addParameterValues("author", "Rowling");
-    request.addParameterValues("category", "science-fiction");
-
-    final HttpEntity<?> requestEntity = request.createRequestEntity();
-
-    assertNotNull(requestEntity);
-    assertNotNull(requestEntity.getHeaders());
-    assertEquals(MediaType.TEXT_PLAIN, requestEntity.getHeaders().getContentType());
-    assertNull(requestEntity.getBody());
-  }
-
-  @Test
-  public void testCreateRequestEntityForDelete() throws Exception {
-    final Link expectedLink = new Link("delete-all", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.DELETE);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-
-    request.addHeaderValues(HttpHeader.ACCEPT.getName(), MediaType.APPLICATION_JSON_VALUE);
-    request.addParameterValues("category", "romance");
-
-    final HttpEntity<?> requestEntity = request.createRequestEntity();
-
-    assertNotNull(requestEntity);
-    assertNotNull(requestEntity.getHeaders());
-    assertEquals(Collections.singletonList(MediaType.APPLICATION_JSON), requestEntity.getHeaders().getAccept());
-    assertNull(requestEntity.getBody());
-  }
-
-  @Test
-  @SuppressWarnings("unchecked")
-  public void testCreateRequestEntityForPost() throws Exception {
-    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.POST);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-
-    final MultiValueMap<String, Object> expectedRequestParameters = new LinkedMultiValueMap<String, Object>(4);
-
-    expectedRequestParameters.add("author", "Douglas Adams");
-    expectedRequestParameters.add("title", "The Hitchhiker's Guide to the Galaxy");
-    expectedRequestParameters.add("year", "1979");
-    expectedRequestParameters.add("isbn", "0345453743");
-
-    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.APPLICATION_FORM_URLENCODED_VALUE);
-    request.addParameterValues("author", expectedRequestParameters.getFirst("author"));
-    request.addParameterValues("title", expectedRequestParameters.getFirst("title"));
-    request.addParameterValues("year", expectedRequestParameters.getFirst("year"));
-    request.addParameterValues("isbn", expectedRequestParameters.getFirst("isbn"));
-
-    final HttpEntity<MultiValueMap<String, Object>> requestEntity = (HttpEntity<MultiValueMap<String, Object>>)
-      request.createRequestEntity();
-
-    assertNotNull(requestEntity);
-    assertNotNull(requestEntity.getHeaders());
-    assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
-    assertEquals(expectedRequestParameters, requestEntity.getBody());
-  }
-
-  @Test
-  @SuppressWarnings("unchecked")
-  public void testCreateRequestEntityForPut() throws Exception {
-    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{isbn}"), HttpMethod.PUT);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-
-    final MultiValueMap<String, Object> expectedRequestParameters = new LinkedMultiValueMap<String, Object>(4);
-
-    expectedRequestParameters.add("year", "1979");
-
-    request.addHeaderValues(HttpHeader.ACCEPT.getName(), MediaType.TEXT_XML_VALUE);
-    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.APPLICATION_FORM_URLENCODED_VALUE);
-    request.addParameterValues("year", expectedRequestParameters.getFirst("year"));
-
-    final HttpEntity<MultiValueMap<String, Object>> requestEntity = (HttpEntity<MultiValueMap<String, Object>>)
-      request.createRequestEntity();
-
-    assertNotNull(requestEntity);
-    assertNotNull(requestEntity.getHeaders());
-    assertEquals(Collections.singletonList(MediaType.TEXT_XML), requestEntity.getHeaders().getAccept());
-    assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
-    assertEquals(expectedRequestParameters, requestEntity.getBody());
-  }
-
-  @Test
-  public void testCreateRequestEntityOnPost() throws Exception {
-    final Library mockLibrary = mockContext.mock(Library.class, "testCreateRequestEntityOnPost.Library");
-    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/libraries"), HttpMethod.POST);
-
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertTrue(request.isPost());
-    assertNull(request.getContent());
-
-    request.setContent(mockLibrary);
-
-    assertSame(mockLibrary, request.getContent());
-
-    final HttpEntity<?> requestEntity = request.createRequestEntity();
-
-    assertNotNull(requestEntity);
-    assertTrue(requestEntity.getBody() instanceof Library);
-  }
-
-  @Test
-  public void testCreateRequestEntityOnPut() throws Exception {
-    final Book mockBook = mockContext.mock(Book.class, "testCreateRequestEntityOnPut.Book");
-    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{id}"), HttpMethod.PUT);
-
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertTrue(request.isPut());
-    assertNull(request.getContent());
-
-    request.setContent(mockBook);
-    request.addParameterValues("isbn", "0-123456789");
-    request.addParameterValues("category", "science-fiction", "sci-fi", "fiction");
-
-    assertSame(mockBook, request.getContent());
-    assertEquals("0-123456789", request.getParameterValue("isbn"));
-    assertTrue(request.getParameterValues("category").containsAll(Arrays.asList("science-fiction", "sci-fi", "fiction")));
-
-    final HttpEntity<?> requestEntity = request.createRequestEntity();
-
-    assertNotNull(requestEntity);
-    assertTrue(requestEntity.getBody() instanceof MultiValueMap);
-    assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
-  }
-
-  @Test
-  public void testSetAndGetHeaderValues() throws Exception {
-    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries"), HttpMethod.PUT);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertTrue(request.getHeaders().isEmpty());
-
-    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.APPLICATION_JSON_VALUE);
-    request.addHeaderValues(HttpHeader.ACCEPT.getName(), MediaType.APPLICATION_JSON_VALUE,
-      MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_PLAIN_VALUE);
-
-    assertEquals(MediaType.APPLICATION_JSON_VALUE, request.getHeaderValue(HttpHeader.CONTENT_TYPE.getName()));
-    assertEquals(1, request.getHeaderValues(HttpHeader.CONTENT_TYPE.getName()).size());
-    assertEquals(MediaType.APPLICATION_JSON_VALUE, request.getHeaderValue(HttpHeader.ACCEPT.getName()));
-    assertEquals(3, request.getHeaderValues(HttpHeader.ACCEPT.getName()).size());
-    assertTrue(request.getHeaderValues(HttpHeader.ACCEPT.getName()).containsAll(Arrays.asList(
-      MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_PLAIN_VALUE)));
-
-    request.setHeader(HttpHeader.ACCEPT.getName(), MediaType.APPLICATION_OCTET_STREAM_VALUE);
-
-    assertEquals(MediaType.APPLICATION_OCTET_STREAM_VALUE, request.getHeaderValue(HttpHeader.ACCEPT.getName()));
-    assertEquals(1, request.getHeaderValues(HttpHeader.ACCEPT.getName()).size());
-    assertTrue(request.getHeaderValues(HttpHeader.ACCEPT.getName()).containsAll(Arrays.asList(
-      MediaType.APPLICATION_OCTET_STREAM_VALUE)));
-  }
-
-  @Test
-  public void testSetAndGetParameterValues() throws Exception {
-    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries"), HttpMethod.PUT);
-    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
-
-    assertEquals(expectedLink, request.getLink());
-    assertTrue(request.getParameters().isEmpty());
-
-    request.addParameterValues("parameterOne", "value");
-    request.addParameterValues("parameterTwo", "test", "testing", "tested");
-
-    assertEquals("value", request.getParameterValue("parameterOne"));
-    assertEquals(1, request.getParameterValues("parameterOne").size());
-    assertEquals("test", request.getParameterValue("parameterTwo"));
-    assertEquals(3, request.getParameterValues("parameterTwo").size());
-    assertTrue(request.getParameterValues("parameterTwo").containsAll(Arrays.asList("test", "testing", "tested")));
-
-    request.setParameter("parameterTwo", "development");
-
-    assertEquals("development", request.getParameterValue("parameterTwo"));
-    assertEquals(1, request.getParameterValues("parameterTwo").size());
-    assertTrue(request.getParameterValues("parameterTwo").containsAll(Arrays.asList("development")));
-  }
-
-  @SuppressWarnings("unused")
-  private static interface Library {
-    public String getName();
-  }
-
-  @SuppressWarnings("unused")
-  private static interface Book {
-    public String getAuthor();
-    public String getIsbn();
-    public String getTitle();
-    public Integer getYear();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java
deleted file mode 100644
index 9ecf645..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.management.internal.web.http.converter;
-
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Calendar;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpInputMessage;
-import org.springframework.http.HttpOutputMessage;
-import org.springframework.http.MediaType;
-
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * The SerializableObjectHttpMessageConverterJUnitTest class is a test suite of test cases testing the contract
- * and functionality of the SerializableObjectHttpMessageConverter class.
- * <p/>
- * @see com.gemstone.gemfire.management.internal.web.http.converter.SerializableObjectHttpMessageConverter
- * @see org.jmock.Mockery
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class SerializableObjectHttpMessageConverterJUnitTest {
-
-  private Mockery mockContext;
-
-  @Before
-  public void setUp() {
-    mockContext = new Mockery();
-    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  @Test
-  public void testCreateSerializableObjectHttpMessageConverter() {
-    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
-
-    assertNotNull(converter);
-    assertTrue(converter.getSupportedMediaTypes().contains(MediaType.APPLICATION_OCTET_STREAM));
-    assertTrue(converter.getSupportedMediaTypes().contains(MediaType.ALL));
-  }
-
-  @Test
-  public void testSupport() {
-    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
-
-    assertTrue(converter.supports(Boolean.class));
-    assertTrue(converter.supports(Calendar.class));
-    assertTrue(converter.supports(Character.class));
-    assertTrue(converter.supports(Integer.class));
-    assertTrue(converter.supports(Double.class));
-    assertTrue(converter.supports(String.class));
-    assertTrue(converter.supports(Serializable.class));
-    assertFalse(converter.supports(Object.class));
-    assertFalse(converter.supports(null));
-  }
-
-  @Test
-  public void testReadInternal() throws IOException {
-    final String expectedInputMessageBody = "Expected content of the HTTP input message body!";
-
-    final HttpInputMessage mockInputMessage = mockContext.mock(HttpInputMessage.class, "HttpInputMessage");
-
-    mockContext.checking(new Expectations() {{
-      oneOf(mockInputMessage).getBody();
-      will(returnValue(new ByteArrayInputStream(IOUtils.serializeObject(expectedInputMessageBody))));
-    }});
-
-    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
-
-    final Serializable obj = converter.readInternal(String.class, mockInputMessage);
-
-    assertTrue(obj instanceof String);
-    assertEquals(expectedInputMessageBody, obj);
-  }
-
-  @Test
-  public void testSetContentLength() {
-    final byte[] bytes = { (byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE };
-
-    final HttpHeaders headers = new HttpHeaders();
-
-    final HttpOutputMessage mockOutputMessage = mockContext.mock(HttpOutputMessage.class, "HttpOutputMessage");
-
-    mockContext.checking(new Expectations() {{
-      oneOf(mockOutputMessage).getHeaders();
-      will(returnValue(headers));
-    }});
-
-    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
-
-    converter.setContentLength(mockOutputMessage, bytes);
-
-    assertEquals(bytes.length, headers.getContentLength());
-  }
-
-  @Test
-  public void testWriteInternal() throws IOException {
-    final String expectedOutputMessageBody = "Expected media of the HTTP output message body!";
-
-    final byte[] expectedOutputMessageBodyBytes = IOUtils.serializeObject(expectedOutputMessageBody);
-
-    final ByteArrayOutputStream out = new ByteArrayOutputStream(expectedOutputMessageBodyBytes.length);
-
-    final HttpHeaders headers = new HttpHeaders();
-
-    final HttpOutputMessage mockOutputMessage = mockContext.mock(HttpOutputMessage.class, "HttpOutputMessage");
-
-    mockContext.checking(new Expectations() {{
-      oneOf(mockOutputMessage).getHeaders();
-      will(returnValue(headers));
-      oneOf(mockOutputMessage).getBody();
-      will(returnValue(out));
-    }});
-
-    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
-
-    converter.writeInternal(expectedOutputMessageBody, mockOutputMessage);
-
-    final byte[] actualOutputMessageBodyBytes = out.toByteArray();
-
-    assertEquals(expectedOutputMessageBodyBytes.length, headers.getContentLength());
-    assertEquals(expectedOutputMessageBodyBytes.length, actualOutputMessageBodyBytes.length);
-
-    for (int index = 0; index < actualOutputMessageBodyBytes.length; index++) {
-      assertEquals(expectedOutputMessageBodyBytes[index], actualOutputMessageBodyBytes[index]);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
deleted file mode 100644
index b11125c..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * 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.management.internal.web.shell;
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.springframework.core.io.Resource;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.ResourceAccessException;
-
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.management.internal.cli.CommandRequest;
-import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
-import com.gemstone.gemfire.management.internal.web.domain.Link;
-import com.gemstone.gemfire.management.internal.web.domain.LinkIndex;
-import com.gemstone.gemfire.management.internal.web.http.ClientHttpRequest;
-import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * The RestHttpOperationInvokerJUnitTest class is a test suite of test cases testing the contract and functionality of the
- * RestHttpOperationInvoker class.
- * <p/>
- * @see java.net.URI
- * @see com.gemstone.gemfire.management.internal.cli.CommandRequest
- * @see com.gemstone.gemfire.management.internal.web.http.HttpMethod
- * @see com.gemstone.gemfire.management.internal.web.domain.Link
- * @see com.gemstone.gemfire.management.internal.web.domain.LinkIndex
- * @see com.gemstone.gemfire.management.internal.web.shell.RestHttpOperationInvoker
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@SuppressWarnings("unused")
-@Category(UnitTest.class)
-public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
-
-  private LinkIndex linkIndex;
-
-  private RestHttpOperationInvoker operationInvoker;
-
-  @Before
-  public void setUp() throws Exception {
-    final Link listLibraries = new Link("list-libraries", toUri("http://host.domain.com/service/v1/libraries"));
-    final Link getLibrary = new Link("get-library", toUri("http://host.domain.com/service/v1/libraries/{name}"));
-    final Link listBooks = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books"));
-    final Link listBooksByAuthor = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}"));
-    final Link listBooksByAuthorAndCategory = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{category}"));
-    final Link listBooksByAuthorAndYear = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{year}"));
-    final Link listBooksByAuthorCategoryAndYear = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{category}/{year}"));
-    final Link addBook = new Link("add-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books"), HttpMethod.POST);
-    final Link getBookByIsbn = new Link("get-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{isbn}"));
-    final Link getBookByTitle = new Link("get-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{title}"));
-    final Link removeBook = new Link("remove-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{isbn}"), HttpMethod.DELETE);
-
-    linkIndex = new LinkIndex();
-
-    linkIndex.addAll(
-      listLibraries,
-      getLibrary,
-      listBooks,
-      listBooksByAuthor,
-      listBooksByAuthorAndCategory,
-      listBooksByAuthorAndYear,
-      listBooksByAuthorCategoryAndYear,
-      addBook,
-      getBookByIsbn,
-      getBookByTitle,
-      removeBook
-    );
-
-    assertEquals(11, linkIndex.size());
-
-    operationInvoker = new RestHttpOperationInvoker(linkIndex);
-
-    assertSame(linkIndex, operationInvoker.getLinkIndex());
-  }
-
-  @After
-  public void tearDown() {
-    operationInvoker.stop();
-    operationInvoker = null;
-  }
-
-  private CommandRequest createCommandRequest(final String command, final Map<String, String> options) {
-    return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(), null);
-  }
-
-  private CommandRequest createCommandRequest(final String command, final Map<String, String> options, final Map<String, String> environment) {
-    return new TestCommandRequest(command, options, environment, null);
-  }
-
-  private CommandRequest createCommandRequest(final String command, final Map<String, String> options, final byte[][] fileData) {
-    return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(), fileData);
-  }
-
-  private CommandRequest createCommandRequest(final String command, final Map<String, String> options, final Map<String, String> environment, final byte[][] fileData) {
-    return new TestCommandRequest(command, options, environment, fileData);
-  }
-
-  private LinkIndex getLinkIndex() {
-    assertTrue("The LinkIndex was not property initialized!", linkIndex != null);
-    return linkIndex;
-  }
-
-  private RestHttpOperationInvoker getOperationInvoker() {
-    assertTrue("The RestHttpOperationInvoker was not properly initialized!", operationInvoker != null);
-    return operationInvoker;
-  }
-
-  @Test
-  public void testCreateHttpRequest() {
-    final Map<String, String> commandOptions = new HashMap<String, String>();
-
-    commandOptions.put("author", "Adams");
-    commandOptions.put("blankOption", "  ");
-    commandOptions.put("category", "sci-fi");
-    commandOptions.put("emptyOption", StringUtils.EMPTY_STRING);
-    commandOptions.put("isbn", "0-123456789");
-    commandOptions.put("nullOption", null);
-    commandOptions.put("title", "Hitch Hiker's Guide to the Galaxy");
-    commandOptions.put("year", "1983");
-
-    final CommandRequest command = createCommandRequest("add-book", commandOptions);
-
-    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
-
-    assertNotNull(request);
-    assertEquals("POST http://host.domain.com/service/v1/libraries/{name}/books", request.getLink().toHttpRequestLine());
-    assertEquals("Adams", request.getParameterValue("author"));
-    assertEquals("sci-fi", request.getParameterValue("category"));
-    assertEquals("0-123456789", request.getParameterValue("isbn"));
-    assertEquals("Hitch Hiker's Guide to the Galaxy", request.getParameterValue("title"));
-    assertEquals("1983", request.getParameterValue("year"));
-    assertTrue(request.getParameters().containsKey("blankOption"));
-    assertTrue(request.getParameters().containsKey("emptyOption"));
-    assertFalse(request.getParameters().containsKey("nullOption"));
-
-    for (String requestParameter : request.getParameters().keySet()) {
-      assertFalse(requestParameter.startsWith(RestHttpOperationInvoker.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX));
-    }
-
-    assertNull(request.getParameterValue(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER));
-  }
-
-  @Test
-  public void testCreateHttpRequestWithEnvironmentVariables() {
-    final Map<String, String> commandOptions = new HashMap<String, String>(2);
-
-    commandOptions.put("name", "ElLibreDeCongress");
-    commandOptions.put("isbn", "${ISBN}");
-
-    final Map<String, String> environment = new HashMap<String, String>(2);
-
-    environment.put("ISBN", "0-987654321");
-    environment.put("VAR", "test");
-
-    final CommandRequest command = createCommandRequest("get-book", commandOptions, environment);
-
-    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
-
-    assertNotNull(request);
-    assertEquals("GET http://host.domain.com/service/v1/libraries/{name}/books/{isbn}", request.getLink()
-      .toHttpRequestLine());
-    assertEquals("${ISBN}", request.getParameterValue("isbn"));
-    assertFalse(request.getParameters().containsKey("ISBN"));
-    assertEquals("0-987654321", request.getParameterValue(
-      RestHttpOperationInvoker.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "ISBN"));
-    assertFalse(request.getParameters().containsKey("VAR"));
-    assertEquals("test", request.getParameterValue(
-      RestHttpOperationInvoker.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "VAR"));
-  }
-
-  @Test
-  public void testCreatHttpRequestWithFileData() {
-    final Map<String, String> commandOptions = Collections.singletonMap("isbn", "0-123456789");
-
-    final byte[][] fileData = {
-      "/path/to/book/content.txt".getBytes(),
-      "Once upon a time in a galaxy far, far away...".getBytes()
-    };
-
-    final CommandRequest command = createCommandRequest("add-book", commandOptions, fileData);
-
-    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
-
-    assertNotNull(request);
-    assertEquals("POST http://host.domain.com/service/v1/libraries/{name}/books", request.getLink().toHttpRequestLine());
-    assertEquals("0-123456789", request.getParameterValue("isbn"));
-    assertTrue(request.getParameters().containsKey(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER));
-    assertTrue(request.getParameterValue(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER) instanceof Resource);
-
-    final List<Object> resources = request.getParameterValues(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER);
-
-    assertNotNull(resources);
-    assertFalse(resources.isEmpty());
-    assertEquals(1, resources.size());
-  }
-
-  @Test
-  public void testFindAndResolveLink() throws Exception {
-    final Map<String, String> commandOptions = new HashMap<String, String>();
-
-    commandOptions.put("name", "BarnesN'Noble");
-
-    Link link = getOperationInvoker().findLink(createCommandRequest("list-libraries", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries", toString(link.getHref()));
-
-    link = getOperationInvoker().findLink(createCommandRequest("get-library", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}", toString(link.getHref()));
-
-    commandOptions.put("author", "J.K.Rowlings");
-
-    link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{author}", toString(link.getHref()));
-
-    commandOptions.put("category", "sci-fi");
-    commandOptions.put("year", "1998");
-    commandOptions.put("bogus", "data");
-
-    link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{category}/{year}",
-      toString(link.getHref()));
-
-    commandOptions.remove("category");
-
-    link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{year}",
-      toString(link.getHref()));
-
-    commandOptions.put("category", "fantasy");
-    commandOptions.put("isbn", "0-123456789");
-    commandOptions.put("title", "Harry Potter");
-
-    link = getOperationInvoker().findLink(createCommandRequest("add-book", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books", toString(link.getHref()));
-
-    commandOptions.remove("isbn");
-
-    link = getOperationInvoker().findLink(createCommandRequest("get-book", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{title}", toString(link.getHref()));
-
-    link = getOperationInvoker().findLink(createCommandRequest("remove-book", commandOptions));
-
-    assertNotNull(link);
-    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{isbn}", toString(link.getHref()));
-  }
-
-  @Test
-  public void testProcessCommand() {
-    final String expectedResult = "{\"libraries\":[{\"library-of\":\"Congress\"}]"; // JSON
-
-    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
-      @Override
-      public boolean isConnected() {
-        return true;
-      }
-
-      @Override
-      @SuppressWarnings("unchecked")
-      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType, final Map<String, ?> uriVariables) {
-        return new ResponseEntity(expectedResult, HttpStatus.OK);
-      }
-    };
-
-    final String actualResult = operationInvoker.processCommand(createCommandRequest("list-libraries",
-      Collections.<String, String>emptyMap()));
-
-    assertEquals(expectedResult, actualResult);
-  }
-
-  @Test
-  public void testProcessCommandDelegatesToSimpleProcessCommand() {
-    final String expectedResult = "<resources>test</resources>";
-
-    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
-      @Override
-      public boolean isConnected() {
-        return true;
-      }
-
-      @Override
-      protected HttpOperationInvoker getHttpOperationInvoker() {
-        return new AbstractHttpOperationInvoker(AbstractHttpOperationInvoker.REST_API_URL) {
-          @Override public Object processCommand(final CommandRequest command) {
-            return expectedResult;
-          }
-        };
-      }
-
-      @Override
-      protected void printWarning(final String message, final Object... args) {
-      }
-    };
-
-    final String actualResult = operationInvoker.processCommand(createCommandRequest("get resource",
-      Collections.<String, String>emptyMap()));
-
-    assertEquals(expectedResult, actualResult);
-  }
-
-  @Test
-  public void testProcessCommandHandlesResourceAccessException() {
-    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
-      private boolean connected = true;
-
-      @Override
-      public boolean isConnected() {
-        return connected;
-      }
-
-      @Override
-      protected void printWarning(final String message, final Object... args) {
-      }
-
-      @Override
-      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType, final Map<String, ?> uriVariables) {
-        throw new ResourceAccessException("test");
-      }
-
-      @Override
-      public void stop() {
-        this.connected = false;
-      }
-    };
-
-    assertTrue(operationInvoker.isConnected());
-
-    final String expectedResult = String.format(
-      "The connection to the GemFire Manager's HTTP service @ %1$s failed with: %2$s. "
-        + "Please try reconnecting or see the GemFire Manager's log file for further details.",
-      operationInvoker.getBaseUrl(), "test");
-
-    final String actualResult = operationInvoker.processCommand(createCommandRequest("list-libraries",
-      Collections.<String, String>emptyMap()));
-
-    assertFalse(operationInvoker.isConnected());
-    assertEquals(expectedResult, actualResult);
-  }
-
-  @Test(expected = RestApiCallForCommandNotFoundException.class)
-  public void testProcessCommandThrowsRestApiCallForCommandNotFoundException() {
-    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
-      @Override
-      public boolean isConnected() {
-        return true;
-      }
-
-      @Override
-      protected HttpOperationInvoker getHttpOperationInvoker() {
-        return null;
-      }
-    };
-
-    try {
-      operationInvoker.processCommand(createCommandRequest("get resource", Collections.<String, String>emptyMap()));
-    }
-    catch (RestApiCallForCommandNotFoundException e) {
-      assertEquals("No REST API call for command (get resource) was found!", e.getMessage());
-      throw e;
-    }
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void testProcessCommandWhenNotConnected() {
-    try {
-      getOperationInvoker().processCommand(createCommandRequest("get-book", Collections.<String, String>emptyMap()));
-    }
-    catch (IllegalStateException e) {
-      assertEquals("Gfsh must be connected to the GemFire Manager in order to process commands remotely!",
-        e.getMessage());
-      throw e;
-    }
-  }
-
-  private static final class TestCommandRequest extends CommandRequest {
-
-    private final Map<String, String> commandParameters = new TreeMap<String, String>();
-
-    private final String command;
-
-    protected TestCommandRequest(final String command,
-                                 final Map<String, String> commandParameters,
-                                 final Map<String, String> environment,
-                                 final byte[][] fileData)
-    {
-      super(environment, fileData);
-
-      assert command != null : "The command cannot be null!";
-
-      this.command = command;
-
-      if (commandParameters != null) {
-        this.commandParameters.putAll(commandParameters);
-      }
-    }
-
-    @Override
-    public String getInput() {
-      return command;
-    }
-
-    @Override
-    public String getName() {
-      return command;
-    }
-
-    @Override
-    public Map<String, String> getParameters() {
-      return Collections.unmodifiableMap(commandParameters);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java
deleted file mode 100644
index 557cc20..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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.management.internal.web.shell;
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-
-import com.gemstone.gemfire.management.internal.cli.CommandRequest;
-import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
-import com.gemstone.gemfire.management.internal.web.domain.Link;
-import com.gemstone.gemfire.management.internal.web.http.ClientHttpRequest;
-import com.gemstone.gemfire.management.internal.web.http.HttpHeader;
-import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.ResourceAccessException;
-
-/**
- * The SimpleHttpOperationInvokerJUnitTest class is a test suite of test cases testing the contract and functionality of the
- * SimpleHttpOperationInvoker class.
- * <p/>
- * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
- * @see com.gemstone.gemfire.management.internal.web.shell.SimpleHttpOperationInvoker
- * @see org.junit.Assert
- * @see org.junit.After
- * @see org.junit.Before
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class SimpleHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
-
-  private SimpleHttpOperationInvoker operationInvoker;
-
-  @Before
-  public void setUp() {
-    operationInvoker = new SimpleHttpOperationInvoker();
-  }
-
-  @After
-  public void tearDown() {
-    operationInvoker.stop();
-    operationInvoker = null;
-  }
-
-  private CommandRequest createCommandRequest(final String command) {
-    return new TestCommandRequest(command);
-  }
-
-  private String getExpectedHttpRequestUrl(final CommandRequest command) {
-    return SimpleHttpOperationInvoker.REST_API_URL.concat(SimpleHttpOperationInvoker.REST_API_MANAGEMENT_COMMANDS_URI)
-      .concat("?").concat(SimpleHttpOperationInvoker.CMD_QUERY_PARAMETER).concat("=").concat(command.getInput());
-  }
-
-  private SimpleHttpOperationInvoker getOperationInvoker() {
-    return operationInvoker;
-  }
-
-  @Test
-  public void testCreateHttpRequest() throws Exception {
-    final CommandRequest command = createCommandRequest("save resource --path=/path/to/file --size=1024KB");
-
-    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
-
-    assertNotNull(request);
-    assertEquals(SimpleHttpOperationInvoker.USER_AGENT_HTTP_REQUEST_HEADER_VALUE,
-      request.getHeaderValue(HttpHeader.USER_AGENT.getName()));
-
-    final Link requestLink = request.getLink();
-
-    assertNotNull(requestLink);
-    assertTrue(toString(requestLink).startsWith("POST"));
-    assertTrue(toString(requestLink).endsWith(command.getInput()));
-  }
-
-  @Test
-  public void testCreateLink() throws Exception {
-    final CommandRequest command = createCommandRequest("delete resource --id=1");
-
-    final Link actualLink = getOperationInvoker().createLink(command);
-
-    assertNotNull(actualLink);
-    assertEquals(SimpleHttpOperationInvoker.LINK_RELATION, actualLink.getRelation());
-    assertEquals(HttpMethod.POST, actualLink.getMethod());
-    assertTrue(toString(actualLink.getHref()).endsWith(command.getInput()));
-  }
-
-  @Test
-  public void testGetHttpRequestUrl() throws Exception {
-    final CommandRequest command = createCommandRequest("get resource --option=value");
-
-    assertEquals(getExpectedHttpRequestUrl(command), toString(getOperationInvoker().getHttpRequestUrl(command)));
-  }
-
-  @Test
-  public void testProcessCommand() {
-    final String expectedResult = "<resource>test</resource>"; // XML
-
-    final SimpleHttpOperationInvoker operationInvoker = new SimpleHttpOperationInvoker() {
-      @Override
-      public boolean isConnected() {
-        return true;
-      }
-
-      @Override
-      @SuppressWarnings("unchecked")
-      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType) {
-        return new ResponseEntity(expectedResult, HttpStatus.OK);
-      }
-    };
-
-    final String actualResult = operationInvoker.processCommand(createCommandRequest("get resource --id=1"));
-
-    assertEquals(expectedResult, actualResult);
-  }
-
-  @Test
-  public void testProcessCommandHandlesResourceAccessException() {
-    final SimpleHttpOperationInvoker operationInvoker = new SimpleHttpOperationInvoker() {
-      private boolean connected = true;
-      @Override
-      public boolean isConnected() {
-        return connected;
-      }
-
-      @Override
-      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType) {
-        throw new ResourceAccessException("test");
-      }
-
-      @Override public void stop() {
-        this.connected = false;
-      }
-    };
-
-    assertTrue(operationInvoker.isConnected());
-
-    final String expectedResult = String.format(
-      "The connection to the GemFire Manager's HTTP service @ %1$s failed with: %2$s. "
-        + "Please try reconnecting or see the GemFire Manager's log file for further details.",
-          operationInvoker.getBaseUrl(), "test");
-
-    final String actualResult = operationInvoker.processCommand(createCommandRequest("get resource --id=1"));
-
-    assertFalse(operationInvoker.isConnected());
-    assertEquals(expectedResult, actualResult);
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void testProcessCommandWhenNotConnected() {
-    try {
-      getOperationInvoker().processCommand(createCommandRequest("get resource"));
-    }
-    catch (IllegalStateException e) {
-      assertEquals("Gfsh must be connected to the GemFire Manager in order to process commands remotely!",
-        e.getMessage());
-      throw e;
-    }
-  }
-
-  private static final class TestCommandRequest extends CommandRequest {
-
-    private final String command;
-
-    protected TestCommandRequest(final String command) {
-      super(Collections.<String, String>emptyMap());
-      assert command != null : "The command cannot be null!";
-      this.command = command;
-    }
-
-    @Override
-    public String getInput() {
-      return command;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/ConvertUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/ConvertUtilsJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/ConvertUtilsJUnitTest.java
deleted file mode 100644
index d9eb8e5..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/ConvertUtilsJUnitTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.management.internal.web.util;
-
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.management.internal.web.io.MultipartFileAdapter;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.springframework.core.io.ByteArrayResource;
-import org.springframework.core.io.Resource;
-import org.springframework.web.multipart.MultipartFile;
-
-/**
- * The ConvertUtilsJUnitTest class is a test suite testing the contract and functionality of the ConvertUtilsJUnitTest class.
- * <p/>
- * @see com.gemstone.gemfire.management.internal.web.util.ConvertUtils
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class ConvertUtilsJUnitTest {
-
-  private MultipartFile createMultipartFile(final String filename, final byte[] content) {
-    return new MultipartFileAdapter() {
-      @Override public byte[] getBytes() throws IOException {
-        return content;
-      }
-      @Override public InputStream getInputStream() throws IOException {
-        return new ByteArrayInputStream(getBytes());
-      }
-      @Override public String getName() {
-        return filename;
-      }
-      @Override public String getOriginalFilename() {
-        return filename;
-      }
-      @Override public long getSize() {
-        return content.length;
-      }
-    };
-  }
-
-  private Resource createResource(final String filename, final byte[] content) {
-    return new ByteArrayResource(content, String.format("Content of file (%1$s).", filename)) {
-      @Override public String getFilename() {
-        return filename;
-      }
-    };
-  }
-
-  @Test
-  public void testConvertFileData() throws IOException {
-    final String[] filenames = { "/path/to/file1.ext", "/path/to/another/file2.ext" };
-    final String[] fileContent = { "This is the contents of file 1.", "This is the contents of file 2." };
-
-    final List<byte[]> fileData = new ArrayList<byte[]>(2);
-
-    for (int index = 0; index < filenames.length; index++) {
-      fileData.add(filenames[index].getBytes());
-      fileData.add(fileContent[index].getBytes());
-    }
-
-    final Resource[] resources = ConvertUtils.convert(fileData.toArray(new byte[fileData.size()][]));
-
-    assertNotNull(resources);
-    assertEquals(filenames.length, resources.length);
-
-    for (int index = 0; index < resources.length; index++) {
-      assertEquals(filenames[index], resources[index].getFilename());
-      assertEquals(fileContent[index], new String(IOUtils.toByteArray(resources[index].getInputStream())));
-    }
-  }
-
-  @Test
-  public void testConvertFileDataWithNull() {
-    final Resource[] resources = ConvertUtils.convert((byte[][]) null);
-
-    assertNotNull(resources);
-    assertEquals(0, resources.length);
-  }
-
-  @Test
-  public void testConvertMultipartFile() throws IOException {
-    final MultipartFile[] files = {
-      createMultipartFile("/path/to/multi-part/file1.txt", "The contents of multi-part file1.".getBytes()),
-      createMultipartFile("/path/to/multi-part/file2.txt", "The contents of multi-part file2.".getBytes())
-    };
-
-    final byte[][] fileData = ConvertUtils.convert(files);
-
-    assertNotNull(fileData);
-    assertEquals(files.length * 2, fileData.length);
-
-    for (int index = 0; index < fileData.length; index += 2) {
-      assertEquals(files[index / 2].getOriginalFilename(), new String(fileData[index]));
-      assertEquals(new String(files[index / 2].getBytes()), new String(fileData[index + 1]));
-    }
-  }
-
-  @Test
-  public void testConvertResource() throws IOException {
-    final Resource[] resources = {
-      createResource("/path/to/file1.txt", "Contents of file1.".getBytes()),
-      createResource("/path/to/file2.txt", "Contents of file2.".getBytes())
-    };
-
-    final byte[][] fileData = ConvertUtils.convert(resources);
-
-    assertNotNull(fileData);
-    assertEquals(resources.length * 2, fileData.length);
-
-    for (int index = 0; index < fileData.length; index += 2) {
-      assertEquals(resources[index / 2].getFilename(), new String(fileData[index]));
-      assertEquals(new String(IOUtils.toByteArray(resources[index / 2].getInputStream())), new String(fileData[index + 1]));
-    }
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testConvertResourceWithResourceHavingNoFilename() throws IOException {
-    try {
-      ConvertUtils.convert(createResource(null, "test".getBytes()));
-    }
-    catch (IllegalArgumentException expected) {
-      assertEquals("The filename of Resource (Byte array resource [Content of file (null).]) must be specified!", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testConvertResourceWithEmpty() throws IOException {
-    final byte[][] fileData = ConvertUtils.convert(new Resource[0]);
-
-    assertNotNull(fileData);
-    assertEquals(0, fileData.length);
-  }
-
-  @Test
-  public void testConvertResourceWithNull() throws IOException {
-    final byte[][] fileData = ConvertUtils.convert((Resource[]) null);
-
-    assertNotNull(fileData);
-    assertEquals(0, fileData.length);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/UriUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/UriUtilsJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/UriUtilsJUnitTest.java
deleted file mode 100644
index 645133a..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/util/UriUtilsJUnitTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.management.internal.web.util;
-
-import static org.junit.Assert.*;
-
-import java.util.Map;
-
-import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * The UriUtilsJUnitTest class is a test suite of test cases testing the contract and functionality of the UriUtils class.
- * <p/>
- * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
- * @see com.gemstone.gemfire.management.internal.web.util.UriUtils
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class UriUtilsJUnitTest extends AbstractWebTestCase {
-
-  @Test
-  public void testDecodeNull() {
-    assertNull(UriUtils.decode((String) null));
-  }
-
-  @Test
-  public void testDecodeStringArray() throws Exception {
-    final String[] encodedValues = {
-      null,
-      "123",
-      "test",
-      encode("Path/Subpath"),
-      encode(encode(encode("/Customers/Accounts/Orders/Items")))
-    };
-
-    final String[] decodedValues = UriUtils.decode(encodedValues);
-
-    assertSame(encodedValues, decodedValues);
-    assertEquals(5, decodedValues.length);
-    assertNull(decodedValues[0]);
-    assertEquals("123", decodedValues[1]);
-    assertEquals("test", decodedValues[2]);
-    assertEquals("Path/Subpath", decodedValues[3]);
-    assertEquals("/Customers/Accounts/Orders/Items", decodedValues[4]);
-  }
-
-  @Test
-  public void testDecodeMap() throws Exception {
-    final Map<String, Object> encodedForm = createMap(createArray("0", "1", "2", "3", "4"),
-      (Object[]) createArray(null, "123", "test", encode("Path/Subpath"), encode(encode(encode("/Customers/Accounts/Orders/Items")))));
-
-    final Map<String, Object> decodedForm = UriUtils.decode(encodedForm);
-
-    assertSame(encodedForm, decodedForm);
-    assertEquals(5, decodedForm.size());
-    assertNull(decodedForm.get("0"));
-    assertEquals("123", decodedForm.get("1"));
-    assertEquals("test", decodedForm.get("2"));
-    assertEquals("Path/Subpath", decodedForm.get("3"));
-    assertEquals("/Customers/Accounts/Orders/Items", decodedForm.get("4"));
-  }
-
-  @Test
-  public void testEncodeNull() {
-    assertNull(UriUtils.encode((String) null));
-  }
-
-  @Test
-  public void testEncodeStringArray() throws Exception {
-    final String[] values = { null, "123", "test", "Path/Subpath", "/Customers/Accounts/Orders/Items" };
-    final String[] encodedValues = UriUtils.encode(values);
-
-    assertSame(values, encodedValues);
-    assertEquals(5, encodedValues.length);
-    assertNull(encodedValues[0]);
-    assertEquals("123", encodedValues[1]);
-    assertEquals("test", encodedValues[2]);
-    assertEquals(encode("Path/Subpath"), encodedValues[3]);
-    assertEquals(encode("/Customers/Accounts/Orders/Items"), encodedValues[4]);
-  }
-
-  @Test
-  public void testEncodeMap() throws Exception {
-    final Map<String, Object> form = createMap(createArray("0", "1", "2", "3", "4"),
-      (Object[]) createArray(null, "123", "test", "Path/Subpath", "/Customers/Accounts/Orders/Items"));
-
-    final Map<String, Object> encodedForm = UriUtils.encode(form);
-
-    assertSame(form, encodedForm);
-    assertEquals(5, encodedForm.size());
-    assertNull(encodedForm.get("0"));
-    assertEquals("123", encodedForm.get("1"));
-    assertEquals("test", encodedForm.get("2"));
-    assertEquals(encode("Path/Subpath"), encodedForm.get("3"));
-    assertEquals(encode("/Customers/Accounts/Orders/Items"), encodedForm.get("4"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
new file mode 100644
index 0000000..2f5348f
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.management.internal.cli.commands;
+
+import org.junit.ClassRule;
+import org.junit.contrib.java.lang.system.ProvideSystemProperty;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.runner.SuiteRunner;
+
+@Category({ DistributedTest.class, SecurityTest.class })
+@RunWith(SuiteRunner.class)
+@Suite.SuiteClasses({
+  ConfigCommandsDUnitTest.class,
+  DeployCommandsDUnitTest.class,
+  DiskStoreCommandsDUnitTest.class,
+  FunctionCommandsDUnitTest.class,
+  GemfireDataCommandsDUnitTest.class,
+  GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.class,
+  IndexCommandsDUnitTest.class,
+  ListAndDescribeDiskStoreCommandsDUnitTest.class,
+  ListIndexCommandDUnitTest.class,
+  MemberCommandsDUnitTest.class,
+  MiscellaneousCommandsDUnitTest.class,
+  MiscellaneousCommandsExportLogsPart1DUnitTest.class,
+  MiscellaneousCommandsExportLogsPart2DUnitTest.class,
+  MiscellaneousCommandsExportLogsPart3DUnitTest.class,
+  MiscellaneousCommandsExportLogsPart4DUnitTest.class,
+  QueueCommandsDUnitTest.class,
+  SharedConfigurationCommandsDUnitTest.class,
+  ShellCommandsDUnitTest.class,
+  ShowDeadlockDUnitTest.class,
+  ShowMetricsDUnitTest.class,
+  ShowStackTraceDUnitTest.class,
+  UserCommandsDUnitTest.class
+})
+public class CommandOverHttpDUnitTest {
+  @ClassRule
+  public static ProvideSystemProperty provideSystemProperty = new ProvideSystemProperty(CliCommandTestBase.USE_HTTP_SYSTEM_PROPERTY, "true");
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
new file mode 100644
index 0000000..dab762b
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
@@ -0,0 +1,319 @@
+/*
+ * 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.management.internal.cli.commands;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
+import static com.gemstone.gemfire.util.test.TestUtil.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Properties;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.runners.CategoryWithParameterizedRunnerFactory;
+
+/**
+ * @since GemFire  8.1
+ */
+@Category({ DistributedTest.class, SecurityTest.class })
+@RunWith(Parameterized.class)
+@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
+public class ConnectCommandWithHttpAndSSLDUnitTest extends CliCommandTestBase {
+
+  private static final ThreadLocal<Properties> sslInfoHolder = new ThreadLocal<>();
+
+  private File jks;
+
+  @Parameterized.Parameter
+  public String urlContext;
+
+  @Parameterized.Parameters
+  public static Collection<String> data() {
+    return Arrays.asList("/geode-mgmt", "/gemfire");
+  }
+
+  @Override
+  public final void postSetUpCliCommandTestBase() throws Exception {
+    this.jks = new File(getResourcePath(getClass(), "/ssl/trusted.keystore"));
+  }
+  
+  @Override
+  protected final void preTearDownCliCommandTestBase() throws Exception {
+    destroyDefaultSetup();
+  }
+  
+  @Override
+  public final void postTearDownCacheTestCase() throws Exception {
+    sslInfoHolder.set(null);
+  }
+
+  @Test
+  public void testMutualAuthentication() throws Exception {
+    Properties serverProps = new Properties();
+    serverProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE, "JKS");
+    serverProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL");
+    serverProps.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION, "true");
+    serverProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE, jks.getCanonicalPath());
+    serverProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, "password");
+
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__KEY_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__KEY_STORE_PASSWORD, "password");
+    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "SSL");
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(serverProps);
+  }
+
+  @Test
+  public void testSimpleSSL() throws Exception {
+    Properties serverProps = new Properties();
+    serverProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE, "JKS");
+
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(serverProps);
+  }
+
+  @Test
+  public void testSSLWithoutKeyStoreType() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+  
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithSSLProtocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithTLSProtocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLS");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithTLSv11Protocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.1");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithTLSv12Protocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testWithMultipleProtocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL,TLSv1.2");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Ignore("TODO: disabled for unknown reason")
+  @Test
+  public void testSSLWithCipherSuite() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
+
+    //Its bad to hard code here. But using SocketFactory.getDefaultCiphers() somehow is not working with the option 
+    //"https.cipherSuites" which is required to restrict cipher suite with HttpsURLConnection
+    //Keeping the below code for further investigation on different Java versions ( 7 & 8) @TODO
+    
+    /*SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
+    
+    sslContext.init(null, null, new java.security.SecureRandom());
+    String[] cipherSuites = sslContext.getSocketFactory().getSupportedCipherSuites();*/
+
+    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
+
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    clientProps.setProperty(CONNECT__SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
+    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Ignore("TODO: disabled for unknown reason")
+  @Test
+  public void testSSLWithMultipleCipherSuite() throws Exception {
+    System.setProperty("javax.net.debug", "ssl,handshake,failure");
+    
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
+    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_EMPTY_RENEGOTIATION_INFO_SCSV");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Override
+  protected void connect(final String host, final int jmxPort, final int httpPort, final HeadlessGfsh shell) {
+    assertNotNull(host);
+    assertNotNull(shell);
+
+    final CommandStringBuilder command = new CommandStringBuilder(CONNECT);
+    String endpoint;
+
+    // This is for testing purpose only. If we remove this piece of code we will
+    // get a java.security.cert.CertificateException
+    // as matching hostname can not be obtained in all test environment.
+    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
+      @Override
+      public boolean verify(String string, SSLSession ssls) {
+        return true;
+      }
+    });
+    
+    endpoint = "https://" + host + ":" + httpPort + urlContext + "/v1";
+    
+    command.addOption(CONNECT__USE_HTTP, Boolean.TRUE.toString());
+    command.addOption(CONNECT__URL, endpoint);
+    command.addOption(CONNECT__USE_SSL,Boolean.TRUE.toString());
+
+    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE) != null){
+      command.addOption(CONNECT__KEY_STORE, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD) != null){
+      command.addOption(CONNECT__KEY_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE) != null){
+      command.addOption(CONNECT__TRUST_STORE, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD) != null){
+      command.addOption(CONNECT__TRUST_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS) != null){
+      command.addOption(CONNECT__SSL_PROTOCOLS, sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS) != null){
+      command.addOption(CONNECT__SSL_CIPHERS, sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS));
+    }
+
+    CommandResult result = executeCommand(shell, command.toString());
+
+    if (!shell.isConnectedAndReady()) {
+      fail("Connect command failed to connect to manager " + endpoint + " result=" + commandResultToString(result));
+    }
+
+    info("Successfully connected to managing node using HTTPS");
+    assertEquals(true, shell.isConnectedAndReady());
+  }
+
+}


[33/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java
deleted file mode 100644
index 7973c05..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.client.ClientCacheFactory;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.client.internal.Connection;
-import com.gemstone.gemfire.cache.client.internal.PoolImpl;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class WANLocatorServerDUnitTest extends WANTestBase {
-
-  static PoolImpl proxy;
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    final Host host = Host.getHost(0);
-  }
-
-  @Test
-  public void test_3Locators_2Servers() {
-
-    int port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-
-    int port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-
-    int port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-
-    vm0.invoke(() -> WANLocatorServerDUnitTest.createLocator(
-        port1, port2, port3, port1 ));
-
-    vm1.invoke(() -> WANLocatorServerDUnitTest.createLocator(
-        port1, port2, port3, port2 ));
-
-    vm2.invoke(() -> WANLocatorServerDUnitTest.createLocator(
-        port1, port2, port3, port3 ));
-
-    vm3.invoke(() -> WANLocatorServerDUnitTest.createReceiver(
-        port1, port2, port3 ));
-    vm5.invoke(() -> WANLocatorServerDUnitTest.createClient(
-        port1, port2, port3 ));
-
-    vm0.invoke(() -> WANLocatorServerDUnitTest.disconnect());
-    vm1.invoke(() -> WANLocatorServerDUnitTest.disconnect());
-    vm2.invoke(() -> WANLocatorServerDUnitTest.disconnect());
-
-    vm0.invoke(() -> WANLocatorServerDUnitTest.createLocator(
-        port1, port2, port3, port1 ));
-
-    vm1.invoke(() -> WANLocatorServerDUnitTest.createLocator(
-        port1, port2, port3, port2 ));
-
-    vm2.invoke(() -> WANLocatorServerDUnitTest.createLocator(
-        port1, port2, port3, port3 ));
-
-    vm5.invoke(() -> WANLocatorServerDUnitTest.tryNewConnection());
-  }
-
-  public static void createLocator(Integer port1, Integer port2, Integer port3,
-      Integer startingPort) {
-    WANTestBase test = new WANTestBase(getTestMethodName());
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + 1);
-    props.setProperty(LOCATORS, "localhost[" + port1
-        + "],localhost[" + port2 + "],localhost[" + port3 + "]");
-    props.setProperty(START_LOCATOR, "localhost["
-        + startingPort
-        + "],server=true,peer=true,hostname-for-clients=localhost");
-    test.getSystem(props);
-  }
-
-  public static void createReceiver(Integer port1, Integer port2, Integer port3) {
-    WANTestBase test = new WANTestBase(getTestMethodName());
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + port1
-        + "],localhost[" + port2 + "],localhost[" + port3 + "]");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port, e);
-    }
-  }
-
-  public static void createServer(Integer port1, Integer port2, Integer port3) {
-    WANTestBase test = new WANTestBase(getTestMethodName());
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + port1
-        + "],localhost[" + port2 + "],localhost[" + port3 + "]");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    CacheServer server = cache.addCacheServer();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    server.setPort(port);
-    try {
-      server.start();
-    }
-    catch (IOException e) {
-      fail("Test " + test.getName() + " failed to start CacheServer on port " + port, e);
-    }
-    LogWriterUtils.getLogWriter().info(
-        "Server Started on port : " + port + " : server : " + server);
-  }
-
-  public static void disconnect() {
-    WANTestBase test = new WANTestBase(getTestMethodName());
-    test.getSystem().disconnect();
-  }
-
-  public static void createClient(Integer port1, Integer port2, Integer port3) {
-    ClientCacheFactory cf = new ClientCacheFactory();
-    cache = (Cache)cf.create();
-    PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
-    pf.setReadTimeout(0);
-    pf.setIdleTimeout(-1);
-    pf.setMinConnections(4);
-    pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
-    pf.addLocator("localhost", port1);
-    pf.addLocator("localhost", port2);
-    pf.addLocator("localhost", port3);
-    pf.init((GatewaySender)null);
-    proxy = ((PoolImpl)pf.create("KISHOR_POOL"));
-    Connection con1 = proxy.acquireConnection();
-    try {
-      con1.close(true);
-    }
-    catch (Exception e) {
-      fail("createClient failed", e);
-    }
-  }
-
-  public static void tryNewConnection() {
-    Connection con1 = null;
-    try {
-      con1 = proxy.acquireConnection();
-    }
-    catch (Exception e) {
-      Assert.fail("No Exception expected", e);
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java
deleted file mode 100644
index 00bfa1a..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class WANSSLDUnitTest extends WANTestBase{
-
-  public WANSSLDUnitTest() {
-    super();
-  }
-
-  @Test
-  public void testSenderSSLReceiverSSL(){
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiverWithSSL( nyPort ));
-
-    vm4.invoke(() -> WANTestBase.createCacheWithSSL( lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  @Test
-  public void testSenderNoSSLReceiverSSL() {
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    IgnoredException.addIgnoredException("SSL Error");
-    IgnoredException.addIgnoredException("Unrecognized SSL message");
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      vm2.invoke(() -> WANTestBase.createReceiverWithSSL( nyPort ));
-
-      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-          false, 100, 10, false, false, null, true ));
-
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", null, isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-          1000 ));
-
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 1000 ));
-      fail("Expected exception as only Receiver is SSL enabled. Not Sender");
-    }
-    catch (Exception e) {
-      assertTrue(e.getCause().getMessage().contains("Server expecting SSL connection"));
-    }
-  }
-  
-  @Test
-  public void testSenderSSLReceiverNoSSL(){
-    IgnoredException.addIgnoredException("Acceptor received unknown");
-    IgnoredException.addIgnoredException("failed accepting client");
-    IgnoredException.addIgnoredException("Error in connecting to peer");
-    IgnoredException.addIgnoredException("Remote host closed connection during handshake");
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> WANTestBase.createReceiver());
-
-      vm4.invoke(() -> WANTestBase.createCacheWithSSL( lnPort ));
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-          false, 100, 10, false, false, null, true ));
-
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", null, isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-          1 ));
-
-      Boolean doesSizeMatch = (Boolean)vm2.invoke(() -> WANSSLDUnitTest.ValidateSSLRegionSize(
-          getTestMethodName() + "_RR", 1 ));
-      
-      assertFalse(doesSizeMatch);
-  }
-  
-  public static boolean ValidateSSLRegionSize (String regionName, final int regionSize) {
-      final Region r = cache.getRegion(Region.SEPARATOR + regionName);
-      assertNotNull(r);
-      WaitCriterion wc = new WaitCriterion() {
-        public boolean done() {
-          return false;
-        }
-
-        public String description() {
-          return null;
-        }
-      };
-      Wait.waitForCriterion(wc, 2000, 500, false);
-      
-      if(r.size() == regionSize){
-        return true;
-      }
-      return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java
deleted file mode 100644
index 4148789..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.gemstone.gemfire.GemFireConfigException;
-import com.gemstone.gemfire.IncompatibleSystemException;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.OSProcess;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-
-@Category(DistributedTest.class)
-public class WanAutoDiscoveryDUnitTest extends WANTestBase {
-
-  
-  public WanAutoDiscoveryDUnitTest() {
-    super();
-  }
-
-  @Override
-  protected void postSetUpWANTestBase() throws Exception {
-    final Host host = Host.getHost(0);
-  }
-  
-  /**
-   * Test to validate that sender can not be started without locator started.
-   * else GemFireConfigException will be thrown.
-   */
-  @Test
-  public void test_GatewaySender_Started_Before_Locator() {
-    try {
-      int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-      vm0.invoke(() -> WANTestBase.createCache(port));      
-      vm0.invoke(() -> WANTestBase.createSender("ln",2,false,100,10,false,false, null, false));
-      fail("Expected GemFireConfigException but not thrown");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GemFireConfigException)) {
-        Assert.fail("Expected GemFireConfigException but received :", e);
-      }
-    }
-  }
-  
-  /**
-   * Test to validate that all locators in one DS should have same name. Though
-   * this test passes, it causes other below tests to fail. In this test, VM1 is
-   * throwing IncompatibleSystemException after startInitLocator. I think, after
-   * throwing this exception, locator is not stopped properly and hence other
-   * tests are failing.
-   * 
-   * @throws Exception
-   */
-  @Ignore
-  @Test
-  public void test_AllLocatorsInDSShouldHaveDistributedSystemId() throws Exception {
-    try {
-      Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-
-      Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondLocator( 2,
-              lnLocPort1 ));
-      fail("Expected IncompatibleSystemException but not thrown");
-    }
-    catch (Exception e) {
-      if (!(e.getCause()instanceof IncompatibleSystemException)) {
-        Assert.fail("Expected IncompatibleSystemException but received :", e);
-      }
-    }
-  }
-  
-  /**
-   * Test to validate that multiple locators added on LN site and multiple
-   * locators on Ny site recognizes each other
-   * @throws Exception 
-   */
-  @Test
-  public void test_NY_Recognises_ALL_LN_Locators() throws Exception {
-    Set<InetSocketAddress> locatorPorts = new HashSet<>();
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-    dsVsPort.put(1, locatorPorts);
-
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
-
-    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
-    
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(2, locatorPorts);
-    Integer nyLocPort1 = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
-    
-    Integer nyLocPort2 = (Integer)vm3.invoke(() -> WANTestBase.createSecondRemoteLocator(
-            2, nyLocPort1, lnLocPort1));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort2));
-    
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-  }
-
-  /**
-   * Test to validate that multiple locators added two sets receive eachothers
-   * hostname for client setting even when the locator is started through the API.
-   */
-  @Test
-  public void locatorsReceiveHostnameForClientsFromRemoteSite() throws Exception {
-    Set<InetSocketAddress> locatorPorts = new HashSet<>();
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-    dsVsPort.put(1, locatorPorts);
-
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
-
-    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
-
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(2, locatorPorts);
-    Integer nyLocPort1 = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
-
-    Integer nyLocPort2 = (Integer)vm3.invoke(() -> WANTestBase.createSecondRemoteLocatorWithAPI(
-      2, nyLocPort1, lnLocPort1, "localhost"));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort2));
-
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-  }
-
-  /**
-   * Test to validate that TK site's locator is recognized by LN and NY. Test to
-   * validate that HK site's locator is recognized by LN , NY, TK.
-   */
-  @Test
-  public void test_NY_Recognises_TK_AND_HK_Through_LN_Locator() {
-
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-
-    Set<InetSocketAddress> locatorPorts = new HashSet<>();
-    dsVsPort.put(1, locatorPorts);
-    
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
-
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(2, locatorPorts);
-    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
-
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(3, locatorPorts);
-    Integer tkLocPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort));
-
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(4, locatorPorts);
-    Integer hkLocPort = (Integer)vm3.invoke(() -> WANTestBase.createFirstRemoteLocator( 4, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", hkLocPort));
-
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-  }
-
-  @Test
-  public void test_TK_Recognises_LN_AND_NY() {
-
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-
-    Set<InetSocketAddress> locatorPorts = new HashSet<>();
-    dsVsPort.put(1, locatorPorts);
-    
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
-
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(2, locatorPorts);
-    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
-
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(3, locatorPorts);
-    Integer tkLocPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, nyLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort));
-
-
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-  }
-  
-  @Test
-  public void test_NY_Recognises_TK_AND_HK_Simultaneously() {
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-
-    Set<InetSocketAddress> locatorPortsln = new HashSet<>();
-    dsVsPort.put(1, locatorPortsln);
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    locatorPortsln.add(new InetSocketAddress("localhost", lnLocPort1));
-
-    Set<InetSocketAddress> locatorPortsny = new HashSet<>();
-    dsVsPort.put(2, locatorPortsny);
-    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
-    locatorPortsny.add(new InetSocketAddress("localhost", nyLocPort1));
-
-    int AsyncInvocationArrSize = 4;
-    AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize];
-
-    Set<InetSocketAddress> locatorPortstk = new HashSet<>();
-    dsVsPort.put(3, locatorPortstk);
-    async[0] = vm2.invokeAsync(() -> WANTestBase.createFirstRemoteLocator( 3, lnLocPort1 ));
-
-    Set<InetSocketAddress> locatorPortshk = new HashSet<>();
-    dsVsPort.put(4, locatorPortshk);
-    async[1] = vm3.invokeAsync(() -> WANTestBase.createFirstRemoteLocator(4, nyLocPort1));
-
-    ArrayList<Integer> locatorPortsln2 = new ArrayList<Integer>();
-    async[2] = vm4.invokeAsync(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
-    
-    ArrayList<Integer> locatorPortsny2 = new ArrayList<Integer>();
-    async[3] = vm5.invokeAsync(() -> WANTestBase.createSecondLocator( 2, nyLocPort1 ));
-
-    
-    try {
-      async[0].join();
-      async[1].join();
-      async[2].join();
-      async[3].join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    locatorPortstk.add(new InetSocketAddress("localhost", (Integer)async[0].getReturnValue()));
-    locatorPortshk.add(new InetSocketAddress("localhost", (Integer)async[1].getReturnValue()));
-    locatorPortsln.add(new InetSocketAddress("localhost", (Integer)async[2].getReturnValue()));
-    locatorPortsny.add(new InetSocketAddress("localhost", (Integer)async[3].getReturnValue()));
-    
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-  }
-  
-  
-  @Test
-  public void test_LN_Sender_recognises_ALL_NY_Locators() {
-    
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    
-    Integer lnLocPort2 = (Integer)vm5.invoke(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
-    
-    vm2.invoke(() -> WANTestBase.createCache(lnLocPort1, lnLocPort2));
-    
-    vm2.invoke(() -> WANTestBase.createSender("ln",2,false,100,10,false,false, null, true));
-    
-    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
-    
-    vm2.invoke(() -> WANTestBase.startSender("ln"));
-
-    //Since to fix Bug#46289, we have moved call to initProxy in getConnection which will be called only when batch is getting dispatched.
-    //So for locator discovery callback to work, its now expected that atleast try to send a batch so that proxy will be initialized
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-  
-     vm2.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10));
-
-    Integer nyLocPort2 = (Integer)vm3
-        .invoke(() -> WANTestBase.createSecondRemoteLocator(
-            2, nyLocPort1, lnLocPort1 ));
-
-    InetSocketAddress locatorToWaitFor = new InetSocketAddress("localhost",
-        nyLocPort2);
-
-    vm2.invoke(() -> WANTestBase.checkLocatorsinSender("ln", locatorToWaitFor ));
-
-    Integer nyLocPort3 = (Integer)vm4
-        .invoke(() -> WANTestBase.createSecondRemoteLocator(
-            2, nyLocPort1, lnLocPort1 ));
-    
-    InetSocketAddress locatorToWaitFor2 = new InetSocketAddress("localhost", nyLocPort3);
-
-    vm2.invoke(() -> WANTestBase.checkLocatorsinSender("ln", locatorToWaitFor2 ));
-
-  }
-
-  @Test
-  public void test_RingTopology() {
-
-    int [] ports = AvailablePortHelper.getRandomAvailableTCPPortsForDUnitSite(4);
-
-    final Set<String> site1LocatorsPort = new HashSet<String>();
-    site1LocatorsPort.add("localhost["+ports[0]+"]");
-   
-    final Set<String> site2LocatorsPort = new HashSet<String>();
-    site2LocatorsPort.add("localhost["+ports[1]+"]");
-   
-    final Set<String> site3LocatorsPort = new HashSet<String>();
-    site3LocatorsPort.add("localhost["+ports[2]+"]");
-   
-    final Set<String> site4LocatorsPort = new HashSet<String>();
-    site4LocatorsPort.add("localhost["+ports[3]+"]");
-   
-    Map<Integer, Set<String>> dsVsPort = new HashMap<Integer, Set<String>>();
-    dsVsPort.put(1, site1LocatorsPort);
-    dsVsPort.put(2, site2LocatorsPort);
-    dsVsPort.put(3, site3LocatorsPort);
-    dsVsPort.put(4, site4LocatorsPort);
-   
-    int AsyncInvocationArrSize = 9;
-    AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize];
-   
-    async[0] = vm0.invokeAsync(() -> WANTestBase.createLocator( 1, ports[0], site1LocatorsPort, site2LocatorsPort));
-   
-    async[1] = vm1.invokeAsync(() -> WANTestBase.createLocator( 2, ports[1], site2LocatorsPort, site3LocatorsPort));
-   
-    async[2] = vm2.invokeAsync(() -> WANTestBase.createLocator( 3, ports[2], site3LocatorsPort, site4LocatorsPort));
-   
-    async[3] = vm3.invokeAsync(() -> WANTestBase.createLocator( 4, ports[3], site4LocatorsPort, site1LocatorsPort));
-   
-   // pause(5000);
-    try {
-      async[0].join();
-      async[1].join();
-      async[2].join();
-      async[3].join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail("Could not join async operations");
-    }
-   
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-  }
-
-  @Ignore
-  @Test
-  public void test_3Sites3Locators() {
-    final Set<String> site1LocatorsPort = new HashSet<String>();
-    int site1Port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site1LocatorsPort.add("localhost["+site1Port1+"]");
-    int site1Port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site1LocatorsPort.add("localhost["+site1Port2+"]");
-    int site1Port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site1LocatorsPort.add("localhost["+site1Port3+"]");
-    
-    final Set<String> site2LocatorsPort = new HashSet<String>();
-    int site2Port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site2LocatorsPort.add("localhost["+site2Port1+"]");
-    int site2Port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site2LocatorsPort.add("localhost["+site2Port2+"]");
-    int site2Port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site2LocatorsPort.add("localhost["+site2Port3+"]");
-    
-    final Set<String> site3LocatorsPort = new HashSet<String>();
-    int site3Port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site3LocatorsPort.add("localhost["+site3Port1+"]");
-    final int site3Port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site3LocatorsPort.add("localhost["+site3Port2+"]");
-    int site3Port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    site3LocatorsPort.add("localhost["+site3Port3+"]");
-
-    Map<Integer, Set<String>> dsVsPort = new HashMap<Integer, Set<String>>();
-    dsVsPort.put(1, site1LocatorsPort);
-    dsVsPort.put(2, site2LocatorsPort);
-    dsVsPort.put(3, site3LocatorsPort);
-    
-    int AsyncInvocationArrSize = 9;
-    AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize];
-    
-    async[0] = vm0.invokeAsync(() -> WANTestBase.createLocator( 1, site1Port1, site1LocatorsPort, site2LocatorsPort));
-    
-    async[8] = vm0.invokeAsync(() -> WANTestBase.checkAllSiteMetaDataFor3Sites(dsVsPort));
-    
-    async[1] = vm1.invokeAsync(() -> WANTestBase.createLocator( 1, site1Port2, site1LocatorsPort, site2LocatorsPort));
-    async[2] = vm2.invokeAsync(() -> WANTestBase.createLocator( 1, site1Port3, site1LocatorsPort, site2LocatorsPort));
-    
-    async[3] = vm3.invokeAsync(() -> WANTestBase.createLocator( 2, site2Port1, site2LocatorsPort, site3LocatorsPort));
-    async[4] = vm4.invokeAsync(() -> WANTestBase.createLocator( 2, site2Port2, site2LocatorsPort, site3LocatorsPort));
-    async[5] = vm5.invokeAsync(() -> WANTestBase.createLocator( 2, site2Port3, site2LocatorsPort, site3LocatorsPort));
-    
-    async[6] = vm6.invokeAsync(() -> WANTestBase.createLocator( 3, site3Port1, site3LocatorsPort, site1LocatorsPort));
-    async[7] = vm7.invokeAsync(() -> WANTestBase.createLocator( 3, site3Port2, site3LocatorsPort, site1LocatorsPort));
-    
-    WANTestBase.createLocator(3, site3Port3, site3LocatorsPort, site1LocatorsPort);
-    long startTime = System.currentTimeMillis();
-    
-    try {
-      async[0].join();
-      async[1].join();
-      async[2].join();
-      async[3].join();
-      async[4].join();
-      async[5].join();
-      async[6].join();
-      async[7].join();
-      async[8].join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail("Could not join async operations");
-    }
-    Long endTime = null;
-    try {
-      endTime = (Long)async[8].getResult();
-    }
-    catch (Throwable e) {
-      e.printStackTrace();
-     Assert.fail("Could not get end time", e);
-    }
-    
-    LogWriterUtils.getLogWriter().info("Time taken for all 9 locators discovery in 3 sites: " + (endTime.longValue() - startTime));
-    
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm4.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm5.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm6.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    vm7.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
-    WANTestBase.checkAllSiteMetaDataFor3Sites(dsVsPort);
-  }
-  
-  
-  @Test
-  public void test_LN_Peer_Locators_Exchange_Information() {
-    Set<InetSocketAddress> locatorPorts = new HashSet<>();
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-    dsVsPort.put(1, locatorPorts);
-
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
-
-    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondPeerLocator( 1, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
-    
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-  }
-  
-  @Test
-  public void test_LN_NY_TK_5_PeerLocators_1_ServerLocator() {
-    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
-    
-    
-    Set<InetSocketAddress> locatorPorts = new HashSet<>();
-    dsVsPort.put(1, locatorPorts);
-    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
-    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondPeerLocator( 1, lnLocPort1 ));
-    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
-    
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(2, locatorPorts);
-    Integer nyLocPort1 = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemotePeerLocator(2, lnLocPort1));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
-    Integer nyLocPort2 = (Integer)vm3.invoke(() -> WANTestBase.createSecondRemotePeerLocator( 2, nyLocPort1, lnLocPort2));
-    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort2));
-    
-    locatorPorts = new HashSet<>();
-    dsVsPort.put(3, locatorPorts);
-    Integer tkLocPort1 = (Integer)vm4.invoke(() -> WANTestBase.createFirstRemotePeerLocator(3, nyLocPort1));
-    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort1));
-    Integer tkLocPort2 = (Integer)vm5.invoke(() -> WANTestBase.createSecondRemotePeerLocator( 3, tkLocPort1, nyLocPort1));
-    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort2));
-    Integer tkLocPort3 = (Integer)vm6.invoke(() -> WANTestBase.createSecondRemoteLocator( 3, tkLocPort1, nyLocPort2));
-    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort3));
-    
-   // pause(5000);
-    
-    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm4.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm5.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-    vm6.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
-        
-  }
-
-  @Test
-  public void testNoThreadLeftBehind() {
-    // Get active thread count before test
-    int activeThreadCountBefore = Thread.activeCount();
-
-    // Start / stop locator
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    WANTestBase.createFirstRemoteLocator( 2, port );
-    disconnectFromDS();
-
-    // Validate active thread count after test
-
-    // Wait up to 60 seconds for all threads started during the test
-    // (including the 'WAN Locator Discovery Thread') to stop
-    // Note: Awaitility is not being used since it adds threads
-    for (int i=0; i<60; i++) {
-      if (Thread.activeCount() > activeThreadCountBefore) {
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException e) {
-          fail("Caught the following exception waiting for threads to stop: " + e);
-        }
-      } else {
-        break;
-      }
-    }
-
-    // Fail if the active thread count after the test is greater than the active thread count before the test
-    if (Thread.activeCount() > activeThreadCountBefore) {
-      OSProcess.printStacks(0);
-      StringBuilder builder = new StringBuilder();
-      builder
-          .append("Expected ")
-          .append(activeThreadCountBefore)
-          .append(" threads but found ")
-          .append(Thread.activeCount())
-          .append(". Check log file for a thread dump.");
-      fail(builder.toString());
-    }
-  }
-}



[16/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java
new file mode 100644
index 0000000..9c6cbdd
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java
@@ -0,0 +1,460 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.internal.cache.BucketRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+
+import java.util.Set;
+
+/**
+ *
+ */
+@Category(DistributedTest.class)
+public class CommonParallelGatewaySenderDUnitTest extends WANTestBase {
+
+  @Test
+  public void testSameSenderWithNonColocatedRegions() throws Exception {
+    IgnoredException.addIgnoredException("cannot have the same parallel");
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    try {
+      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+      fail("Expected IllegalStateException : cannot have the same parallel gateway sender");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("cannot have the same parallel gateway sender id"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  /**
+   * Simple scenario. Two regions attach the same PGS
+   * @throws Exception
+   * Below test is disabled intentionally
+    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+    3> We have to enabled it in next release
+    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0
+   */
+  @Test
+  @Ignore("TODO")
+  public void testParallelPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR1",
+        1000 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR2",
+      1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR1", 1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR2", 1000 ));
+  }
+  
+  /**
+   * The PGS is persistence enabled but not the Regions
+   * Below test is disabled intentionally
+    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+    3> We have to enabled it in next release
+    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0
+   */
+  @Test
+  @Ignore("TODO")
+  public void testParallelPropagationPersistenceEnabled() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR1",
+        1000 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR2",
+      1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR1", 1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR2", 1000 ));
+  }
+  
+  
+  /**
+   * Enable persistence for GatewaySender.
+   * Pause the sender and do some puts in local region.  
+   * Close the local site and rebuild the region and sender from disk store.
+   * Dispatcher should not start dispatching events recovered from persistent sender.
+   * Check if the remote site receives all the events.
+   * Below test is disabled intentionally
+    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+    3> We have to enabled it in next release
+    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0
+   */
+  @Test
+  @Ignore("TODO")
+  public void testPRWithGatewaySenderPersistenceEnabled_Restart() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", null, 1, 100, isOffHeap() ));
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //pause the senders
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"PR1", 3000 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"PR2", 5000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+    vm6.invoke(() -> WANTestBase.killSender());
+    vm7.invoke(() -> WANTestBase.killSender());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+
+    inv1 = vm4.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    inv2 = vm5.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    inv3 = vm6.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    inv4 = vm7.invokeAsync(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName()+"PR1", 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName()+"PR1", 3000 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName()+"PR2", 5000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName()+"PR2", 5000 ));
+  }
+  
+  public static void validateParallelSenderQueueAllBucketsDrained(final String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    ConcurrentParallelGatewaySenderQueue regionQueue = (ConcurrentParallelGatewaySenderQueue)((AbstractGatewaySender)sender).getQueues().toArray(new RegionQueue[1])[0];
+    
+    Set<PartitionedRegion> shadowPRs = (Set<PartitionedRegion>)regionQueue.getRegions();
+    
+    for(PartitionedRegion shadowPR: shadowPRs) {
+      Set<BucketRegion> buckets = shadowPR.getDataStore().getAllLocalBucketRegions();
+      
+      for (final BucketRegion bucket : buckets) {
+        WaitCriterion wc = new WaitCriterion() {
+          public boolean done() {
+            if (bucket.keySet().size() == 0) {
+              LogWriterUtils.getLogWriter().info("Bucket " + bucket.getId() + " is empty");
+              return true;
+            }
+            return false;
+          }
+     
+          public String description() {
+            return "Expected bucket entries for bucket: " + bucket.getId() + " is: 0 but actual entries: " 
+              + bucket.keySet().size() + " This bucket isPrimary: " + bucket.getBucketAdvisor().isPrimary() + " KEYSET: " + bucket.keySet();
+          }
+        };
+        Wait.waitForCriterion(wc, 180000, 50, true);
+      
+      }//for loop ends
+    }
+    
+
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java
new file mode 100644
index 0000000..2fb77ff
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class CommonParallelGatewaySenderOffHeapDUnitTest extends
+    CommonParallelGatewaySenderDUnitTest {
+
+  public CommonParallelGatewaySenderOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java
new file mode 100644
index 0000000..8b8c624
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java
@@ -0,0 +1,532 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.internal.cache.DistributedCacheOperation;
+import com.gemstone.gemfire.internal.cache.EntrySnapshot;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.LocalRegion.NonTXEntry;
+import com.gemstone.gemfire.internal.cache.RegionEntry;
+import com.gemstone.gemfire.internal.cache.Token.Tombstone;
+import com.gemstone.gemfire.internal.cache.versions.VersionTag;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+/**
+ *
+ * Test verifies that version tag for destroyed entry is propagated back to
+ * origin distributed system if the version tag is applied and replaces old
+ * version information in destination distributed system.
+ *
+ * Version tag information which is relevant between multiple distributed
+ * systems consistency check is basically dsid and timestamp.
+ */
+@Category(DistributedTest.class)
+public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase {
+
+  public NewWANConcurrencyCheckForDestroyDUnitTest() {
+    super();
+  }
+
+  @Test
+  public void testVersionTagTimestampForDestroy() {
+    
+    
+    // create three distributed systems with each having a cache containing
+    // a Replicated Region with one entry and concurrency checks enabled.
+
+    // Site 2 and Site 3 only know about Site 1 but Site 1 knows about both
+    // Site 2 and Site 3.
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    createCacheInVMs(lnPort, vm1);
+    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
+    
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    createCacheInVMs(nyPort, vm3);
+    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
+
+    //Site 3
+    Integer tkPort = (Integer)vm4.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+    createCacheInVMs(tkPort, vm5);
+    Integer tkRecPort = (Integer) vm5.invoke(() -> WANTestBase.createReceiver());
+
+    LogWriterUtils.getLogWriter().info("Created locators and receivers in 3 distributed systems");
+     
+    //Site 1
+    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      true, 10, 1, false, false, null, true ));
+    vm1.invoke(() -> WANTestBase.createSender( "ln2", 3,
+      true, 10, 1, false, false, null, true ));
+    
+    vm1.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ln1,ln2", 0, 1, isOffHeap() ));
+    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm1.invoke(() -> WANTestBase.startSender( "ln2" ));
+    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
+    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln2" ));
+    
+    //Site 2
+    vm3.invoke(() -> WANTestBase.createSender( "ny1", 1,
+      true, 10, 1, false, false, null, true ));
+    
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ny1", 0, 1, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm3.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
+    
+    //Site 3 which only knows about Site 1.
+    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
+      true, 10, 1, false, false, null, true ));
+    
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "tk1", 0, 1, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "tk1" ));
+    
+    Wait.pause(2000);
+    
+    // Perform a put in vm1
+    vm1.invoke(new CacheSerializableRunnable("Putting an entry in ds1") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        
+        Region region = cache.getRegion("/repRegion");
+        region.put("testKey", "testValue");
+        
+        assertEquals(1, region.size());
+      }
+    });
+
+    //wait for vm1 to propagate put to vm3 and vm5
+    Wait.pause(2000); 
+
+    long destroyTimeStamp = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterOp());
+    
+    //wait for vm1 to propagate destroyed entry's new version tag to vm5
+    Wait.pause(2000); 
+
+    vm5.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.verifyTimestampAfterOp(destroyTimeStamp, 1 /* ds 3 receives gateway event only from ds 1*/));
+  }
+
+  /**
+   * Test creates two sites and one Replicated Region on each with Serial
+   * GatewaySender on each. Test checks for sequence of events being sent from
+   * site1 to site2 for PUTALL and PUT and finally checks for final timestamp in
+   * version for RegionEntry with key "testKey". If timestamp on both site is
+   * same that means events were transferred in correct sequence.
+   */
+  @Test
+  public void testPutAllEventSequenceOnSerialGatewaySenderWithRR() {
+    
+    // create two distributed systems with each having a cache containing
+    // a Replicated Region with one entry and concurrency checks enabled.
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    vm1.invoke(() -> WANTestBase.createCache(lnPort));
+    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
+    
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    vm3.invoke(() -> WANTestBase.createCache(nyPort));
+    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
+
+    LogWriterUtils.getLogWriter().info("Created locators and receivers in 2 distributed systems");
+     
+    //Site 1
+    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      false, 10, 1, false, false, null, true ));
+    
+    vm1.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ln1", isOffHeap() ));
+    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
+    
+    //Site 2
+    vm3.invoke(() -> WANTestBase.createSender( "ny1", 1,
+      false, 10, 1, false, false, null, true ));
+    
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ny1", isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm3.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
+    
+    Wait.pause(2000);
+    
+    // Perform a put in vm1
+    AsyncInvocation asynch1 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
+        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 2000; 
+        
+        Region region = cache.getRegion("/repRegion");
+        Map testMap = new HashMap();
+        testMap.put("testKey", "testValue1");
+        region.putAll(testMap);
+        
+        assertEquals(1, region.size());
+        assertEquals("testValue2", region.get("testKey"));
+      }
+    });
+
+    //wait for vm1 to propagate put to vm3
+    Wait.pause(1000); 
+
+    AsyncInvocation asynch2 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        Region region = cache.getRegion("/repRegion");
+        
+        while (!region.containsKey("testKey")) {
+          Wait.pause(10);
+        }
+        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
+        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0; 
+        
+        region.put("testKey", "testValue2");
+        
+        assertEquals(1, region.size());
+        assertEquals("testValue2", region.get("testKey"));
+      }
+    });
+
+    try {
+      asynch1.join(5000);
+      asynch2.join(5000);
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    } finally {
+      vm1.invoke(new CacheSerializableRunnable("Reset Test Hook") {
+        
+        @Override
+        public void run2() throws CacheException {
+          DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0;
+        }
+      });
+    }
+
+    //Wait for all Gateway events be received by vm3.
+    Wait.pause(1000);
+
+    long putAllTimeStampVm1 = (Long) vm1.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
+    
+    long putAllTimeStampVm3 = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
+    
+    assertEquals(putAllTimeStampVm1, putAllTimeStampVm3);
+  }
+
+/**
+ * This is similar to above test but for PartitionedRegion.
+ */
+  @Test
+  public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() {
+    
+    // create two distributed systems with each having a cache containing
+    // a Replicated Region with one entry and concurrency checks enabled.
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    createCacheInVMs(lnPort, vm1);
+    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
+    
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    createCacheInVMs(nyPort, vm3);
+    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
+
+    LogWriterUtils.getLogWriter().info("Created locators and receivers in 2 distributed systems");
+     
+    //Site 1
+    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      false, 10, 1, false, false, null, true ));
+    
+    vm1.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ln1", 0, 1, isOffHeap() ));
+    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
+    
+    //Site 2
+    vm3.invoke(() -> WANTestBase.createSender( "ny1", 1,
+      false, 10, 1, false, false, null, true ));
+    
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ny1", 0, 1, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm3.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
+    
+    Wait.pause(2000);
+    
+    // Perform a put in vm1
+    AsyncInvocation asynch1 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
+        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 2000; 
+        
+        Region region = cache.getRegion("/repRegion");
+        Map testMap = new HashMap();
+        testMap.put("testKey", "testValue1");
+        region.putAll(testMap);
+        
+        assertEquals(1, region.size());
+        assertEquals("testValue2", region.get("testKey"));
+      }
+    });
+
+    //wait for vm1 to propagate put to vm3
+    Wait.pause(1000); 
+
+    AsyncInvocation asynch2 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        Region region = cache.getRegion("/repRegion");
+        
+        while (!region.containsKey("testKey")) {
+          Wait.pause(10);
+        }
+        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
+        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0; 
+        
+        region.put("testKey", "testValue2");
+        
+        assertEquals(1, region.size());
+        assertEquals("testValue2", region.get("testKey"));
+      }
+    });
+
+    try {
+      asynch1.join(5000);
+      asynch2.join(5000);
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    } finally {
+      vm1.invoke(new CacheSerializableRunnable("Reset Test Hook") {
+        
+        @Override
+        public void run2() throws CacheException {
+          DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0;
+        }
+      });
+    }
+
+    //Wait for all Gateway events be received by vm3.
+    Wait.pause(1000);
+
+    long putAllTimeStampVm1 = (Long) vm1.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
+    
+    long putAllTimeStampVm3 = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
+    
+    assertEquals(putAllTimeStampVm1, putAllTimeStampVm3);
+  }
+
+  /**
+   * Tests if conflict checks are happening based on DSID and timestamp even if
+   * version tag is generated in local distributed system.
+   */
+  @Test
+  public void testConflictChecksBasedOnDsidAndTimeStamp() {
+
+    
+    // create two distributed systems with each having a cache containing
+    // a Replicated Region with one entry and concurrency checks enabled.
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    createCacheInVMs(lnPort, vm1);
+    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
+
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    createCacheInVMs(nyPort, vm3);
+    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
+    
+    LogWriterUtils.getLogWriter().info("Created locators and receivers in 2 distributed systems");
+
+    //Site 1
+    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      false, 10, 1, false, false, null, true ));
+    
+    vm1.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ln1", isOffHeap() ));
+    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
+    
+    //Site 2
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ny1", isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm4.invoke(() -> WANTestBase.createSender( "ny1", 1,
+      false, 10, 1, false, false, null, true ));
+    
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ny1", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
+    
+    Wait.pause(2000);
+    
+    // Perform a put in vm1
+    vm1.invoke(new CacheSerializableRunnable("Putting an entry in ds1") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        
+        Region region = cache.getRegion("/repRegion");
+        region.put("testKey", "testValue1");
+        
+        assertEquals(1, region.size());
+      }
+    });
+
+    //wait for vm4 to have later timestamp before sending operation to vm1
+    Wait.pause(300); 
+
+    AsyncInvocation asynch = vm4.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds2 in vm4") {
+      
+      @Override
+      public void run2() throws CacheException {
+        assertNotNull(cache);
+        Region region = cache.getRegion("/repRegion");
+        
+        region.put("testKey", "testValue2");
+        
+        assertEquals(1, region.size());
+        assertEquals("testValue2", region.get("testKey"));
+      }
+    });
+
+    try {
+      asynch.join(2000);
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    }
+
+    //Wait for all local ds events be received by vm3.
+    Wait.pause(1000);
+
+    vm3.invoke(new CacheSerializableRunnable("Check dsid") {
+      
+      @Override
+      public void run2() throws CacheException {
+        Region region = cache.getRegion("repRegion");
+        
+        Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/
+            true); //commented while merging revision 43582
+        RegionEntry re = null;
+        if (entry instanceof EntrySnapshot) {
+          re = ((EntrySnapshot)entry).getRegionEntry();
+        } else if (entry instanceof NonTXEntry) {
+          re = ((NonTXEntry)entry).getRegionEntry();
+        }
+        VersionTag tag = re.getVersionStamp().asVersionTag();
+        assertEquals(2, tag.getDistributedSystemId());
+      }
+    });
+
+    // Check vm3 has latest timestamp from vm4.
+    long putAllTimeStampVm1 = (Long) vm4.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
+    
+    long putAllTimeStampVm3 = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
+    
+    assertEquals(putAllTimeStampVm1, putAllTimeStampVm3);
+  }
+  
+  /*
+   * For VM1 in ds 1. Used in testPutAllEventSequenceOnSerialGatewaySender.
+   */
+  public static long getVersionTimestampAfterPutAllOp() {
+    Region region = cache.getRegion("repRegion");
+    
+    while (!(region.containsKey("testKey") /*&& region.get("testKey").equals("testValue2") */)) {
+      Wait.pause(10);
+    }
+    assertEquals(1, region.size());
+
+    Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true);
+    RegionEntry re = null;
+    if (entry instanceof EntrySnapshot) {
+      re = ((EntrySnapshot)entry).getRegionEntry();
+    } else if (entry instanceof NonTXEntry) {
+      re = ((NonTXEntry)entry).getRegionEntry();
+    }
+    if (re != null) {
+      LogWriterUtils.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region));
+      
+      VersionTag tag = re.getVersionStamp().asVersionTag();
+      return tag.getVersionTimeStamp();
+    } else {
+      return -1;
+    }
+  }
+
+  /*
+   * For VM3 in ds 2.
+   */
+  public static long getVersionTimestampAfterOp() {
+    Region region = cache.getRegion("repRegion");
+    assertEquals(1, region.size());
+    
+    region.destroy("testKey");
+
+    Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true);
+    RegionEntry re = ((EntrySnapshot)entry).getRegionEntry();
+    LogWriterUtils.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region));
+    assertTrue(re.getValueInVM((LocalRegion) region) instanceof Tombstone);
+    
+    VersionTag tag = re.getVersionStamp().asVersionTag();
+    return tag.getVersionTimeStamp();
+  }
+
+  /*
+   * For VM 5 in ds 3.
+   */
+  public static void verifyTimestampAfterOp(long timestamp, int memberid) {
+    Region region = cache.getRegion("repRegion");
+    assertEquals(0, region.size());
+
+    Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true);
+    RegionEntry re = ((EntrySnapshot)entry).getRegionEntry();
+    assertTrue(re.getValueInVM((LocalRegion) region) instanceof Tombstone);
+    
+    VersionTag tag = re.getVersionStamp().asVersionTag();
+    assertEquals(timestamp, tag.getVersionTimeStamp());
+    assertEquals(memberid, tag.getDistributedSystemId());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java
new file mode 100644
index 0000000..76940ea
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java
@@ -0,0 +1,469 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import org.apache.geode.security.templates.SampleSecurityManager;
+import org.apache.logging.log4j.Logger;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.security.AuthInitialize;
+import com.gemstone.gemfire.security.AuthenticationFailedException;
+import com.gemstone.gemfire.security.SecurityTestUtils;
+import com.gemstone.gemfire.security.generator.CredentialGenerator;
+import com.gemstone.gemfire.security.generator.DummyCredentialGenerator;
+import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class NewWanAuthenticationDUnitTest extends WANTestBase {
+
+  public static final Logger logger = LogService.getLogger();
+
+  public static boolean isDifferentServerInGetCredentialCall = false;
+
+  /**
+   * Authentication test for new WAN with valid credentials. Although, nothing
+   * related to authentication has been changed in new WAN, this test case is
+   * added on request from QA for defect 44650.
+   */
+  @Test
+  public void testWanAuthValidCredentials() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    logger.info("Created locator on local site");
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    logger.info("Created locator on remote site");
+
+
+    CredentialGenerator gen = new DummyCredentialGenerator();
+    Properties extraProps = gen.getSystemProperties();
+
+    String clientauthenticator = gen.getAuthenticator();
+    String clientauthInit = gen.getAuthInit();
+
+    Properties credentials1 = gen.getValidCredentials(1);
+    if (extraProps != null) {
+      credentials1.putAll(extraProps);
+    }
+    Properties javaProps1 = gen.getJavaProperties();
+
+    // vm3's invalid credentials
+    Properties credentials2 = gen.getInvalidCredentials(1);
+    if (extraProps != null) {
+      credentials2.putAll(extraProps);
+    }
+    Properties javaProps2 = gen.getJavaProperties();
+
+    Properties props1 = buildProperties(clientauthenticator, clientauthInit,
+      null, credentials1, null);
+
+    // have vm 3 start a cache with invalid credentails
+    Properties props2 = buildProperties(clientauthenticator, clientauthInit,
+      null, credentials2, null);
+
+    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props1, javaProps1, lnPort ));
+    logger.info("Created secured cache in vm2");
+
+    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props2, javaProps2, nyPort ));
+    logger.info("Created secured cache in vm3");
+
+    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    logger.info("Created sender in vm2");
+
+    vm3.invoke(() -> createReceiverInSecuredCache());
+    logger.info("Created receiver in vm3");
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    logger.info("Created RR in vm2");
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+    logger.info("Created RR in vm3");
+
+    // this tests verifies that even though vm3 has invalid credentials, vm2 can still send data to vm3 because
+    // vm2 has valid credentials
+    vm2.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    vm2.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1));
+    vm3.invoke(() -> {
+      Region r = cache.getRegion(Region.SEPARATOR + getTestMethodName() + "_RR");
+      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> assertTrue(r.size() > 0));
+    });
+    logger.info("Done successfully.");
+  }
+
+  @Test
+  public void testWanIntegratedSecurityWithValidCredentials() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    logger.info("Created locator on local site");
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    logger.info("Created locator on remote site");
+
+
+    Properties props1 = buildSecurityProperties("admin", "secret");
+    Properties props2 = buildSecurityProperties("guest", "guest");
+
+    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props1, null, lnPort ));
+    logger.info("Created secured cache in vm2");
+
+    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props2, null, nyPort ));
+    logger.info("Created secured cache in vm3");
+
+    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    logger.info("Created sender in vm2");
+
+    vm3.invoke(() -> createReceiverInSecuredCache());
+    logger.info("Created receiver in vm3");
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    logger.info("Created RR in vm2");
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+    logger.info("Created RR in vm3");
+
+    vm2.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm2.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1));
+    vm3.invoke(() -> {
+      Region r = cache.getRegion(Region.SEPARATOR + getTestMethodName() + "_RR");
+      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> assertTrue(r.size() > 0));
+
+    });
+    logger.info("Done successfully.");
+  }
+
+  /**
+   * Test authentication with new WAN with invalid credentials. Although,
+   * nothing related to authentication has been changed in new WAN, this test
+   * case is added on request from QA for defect 44650.
+   */
+  @Test
+  public void testWanAuthInvalidCredentials() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    logger.info("Created locator on local site");
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    logger.info("Created locator on remote site");
+
+
+    CredentialGenerator gen = new DummyCredentialGenerator();
+    logger.info("Picked up credential: " + gen);
+
+    Properties extraProps = gen.getSystemProperties();
+
+    String clientauthenticator = gen.getAuthenticator();
+    String clientauthInit = gen.getAuthInit();
+
+    Properties credentials1 = gen.getInvalidCredentials(1);
+    if (extraProps != null) {
+      credentials1.putAll(extraProps);
+    }
+    Properties javaProps1 = gen.getJavaProperties();
+    Properties credentials2 = gen.getInvalidCredentials(2);
+    if (extraProps != null) {
+      credentials2.putAll(extraProps);
+    }
+    Properties javaProps2 = gen.getJavaProperties();
+
+    Properties props1 = buildProperties(clientauthenticator, clientauthInit,
+      null, credentials1, null);
+    Properties props2 = buildProperties(clientauthenticator, clientauthInit,
+      null, credentials2, null);
+
+    logger.info("Done building auth properties");
+
+    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props1, javaProps1, lnPort ));
+    logger.info("Created secured cache in vm2");
+
+    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props2, javaProps2, nyPort ));
+    logger.info("Created secured cache in vm3");
+
+    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    logger.info("Created sender in vm2");
+
+    vm3.invoke(() -> createReceiverInSecuredCache());
+    logger.info("Created receiver in vm3");
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    logger.info("Created RR in vm2");
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+    logger.info("Created RR in vm3");
+
+    try {
+      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
+      fail("Authentication Failed: While starting the sender, an exception should have been thrown");
+    } catch (Exception e) {
+      if (!(e.getCause().getCause() instanceof AuthenticationFailedException)) {
+        fail("Authentication is not working as expected", e);
+      }
+    }
+  }
+
+  /**
+   * Test authentication with new WAN with invalid credentials. Although,
+   * nothing related to authentication has been changed in new WAN, this test
+   * case is added on request from QA for defect 44650.
+   */
+  @Test
+  public void testWanSecurityManagerWithInvalidCredentials() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    logger.info("Created locator on local site");
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    logger.info("Created locator on remote site");
+
+    Properties props1 = buildSecurityProperties("admin", "wrongPswd");
+    Properties props2 = buildSecurityProperties("guest", "wrongPswd");
+
+    logger.info("Done building auth properties");
+
+    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props1, null, lnPort ));
+    logger.info("Created secured cache in vm2");
+
+    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+      props2, null, nyPort ));
+    logger.info("Created secured cache in vm3");
+
+    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    logger.info("Created sender in vm2");
+
+    vm3.invoke(() -> createReceiverInSecuredCache());
+    logger.info("Created receiver in vm3");
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    logger.info("Created RR in vm2");
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+    logger.info("Created RR in vm3");
+
+    try {
+      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
+      fail("Authentication Failed: While starting the sender, an exception should have been thrown");
+    } catch (Exception e) {
+      if (!(e.getCause().getCause() instanceof AuthenticationFailedException)) {
+        fail("Authentication is not working as expected", e);
+      }
+    }
+  }
+
+  private static Properties buildProperties(String clientauthenticator,
+                                            String clientAuthInit, String accessor, Properties extraAuthProps,
+                                            Properties extraAuthzProps) {
+    Properties authProps = new Properties();
+    if (clientauthenticator != null) {
+      authProps.setProperty(
+        SECURITY_CLIENT_AUTHENTICATOR,
+        clientauthenticator);
+    }
+    if (accessor != null) {
+      authProps.setProperty(SECURITY_CLIENT_ACCESSOR,
+        accessor);
+    }
+    if (clientAuthInit != null) {
+      authProps.setProperty(SECURITY_CLIENT_AUTH_INIT, clientAuthInit);
+    }
+    if (extraAuthProps != null) {
+      authProps.putAll(extraAuthProps);
+    }
+    if (extraAuthzProps != null) {
+      authProps.putAll(extraAuthzProps);
+    }
+    return authProps;
+  }
+
+  private static Properties buildSecurityProperties(String username, String password){
+    Properties props = new Properties();
+    props.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
+    props.put("security-json", "org/apache/geode/security/templates/security.json");
+    props.put(SECURITY_CLIENT_AUTH_INIT, UserPasswdAI.class.getName());
+    props.put("security-username", username);
+    props.put("security-password", password);
+    return props;
+  }
+
+  public static void createSecuredCache(Properties authProps, Object javaProps, Integer locPort) {
+    authProps.setProperty(MCAST_PORT, "0");
+    authProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
+
+    logger.info("Set the server properties to: " + authProps);
+    logger.info("Set the java properties to: " + javaProps);
+
+    SecurityTestUtils tmpInstance = new SecurityTestUtils("temp");
+    DistributedSystem ds = tmpInstance.createSystem(authProps, (Properties)javaProps);
+    assertNotNull(ds);
+    assertTrue(ds.isConnected());
+    cache = CacheFactory.create(ds);
+    assertNotNull(cache);
+  }
+
+  public static class UserPasswdAI extends UserPasswordAuthInit {
+
+    public static AuthInitialize createAI() {
+      return new UserPasswdAI();
+    }
+
+    @Override
+    public Properties getCredentials(Properties props,
+                                     DistributedMember server, boolean isPeer)
+      throws AuthenticationFailedException {
+      boolean val = ( CacheFactory.getAnyInstance().getDistributedSystem().getDistributedMember().getProcessId() != server.getProcessId());
+      Assert.assertTrue(val, "getCredentials: Server should be different");
+      Properties p = super.getCredentials(props, server, isPeer);
+      if(val) {
+        isDifferentServerInGetCredentialCall = true;
+        CacheFactory.getAnyInstance().getLoggerI18n().convertToLogWriter().config("setting  isDifferentServerInGetCredentialCall " + isDifferentServerInGetCredentialCall);
+      } else {
+        CacheFactory.getAnyInstance().getLoggerI18n().convertToLogWriter().config("setting22  isDifferentServerInGetCredentialCall " + isDifferentServerInGetCredentialCall);
+      }
+      return p;
+    }
+  }
+
+  public static void verifyDifferentServerInGetCredentialCall(){
+    Assert.assertTrue(isDifferentServerInGetCredentialCall, "verifyDifferentServerInGetCredentialCall: Server should be different");
+    isDifferentServerInGetCredentialCall = false;
+  }
+
+  @Test
+  public void testWanAuthValidCredentialsWithServer() {
+    disconnectAllFromDS();
+    {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      logger.info("Created locator on local site");
+
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+      logger.info("Created locator on remote site");
+
+      DummyCredentialGenerator gen = new DummyCredentialGenerator();
+      gen.init();
+      Properties extraProps = gen.getSystemProperties();
+
+      String clientauthenticator = gen.getAuthenticator();
+      String clientauthInit = UserPasswdAI.class.getName() + ".createAI";
+
+      Properties credentials1 = gen.getValidCredentials(1);
+      if (extraProps != null) {
+        credentials1.putAll(extraProps);
+      }
+      Properties javaProps1 = gen.getJavaProperties();
+
+      Properties credentials2 = gen.getInvalidCredentials(2);
+      if (extraProps != null) {
+        credentials2.putAll(extraProps);
+      }
+      Properties javaProps2 = gen.getJavaProperties();
+
+      Properties props1 = buildProperties(clientauthenticator, clientauthInit,
+        null, credentials1, null);
+      Properties props2 = buildProperties(clientauthenticator, clientauthInit,
+        null, credentials2, null);
+
+      vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+        props1, javaProps1, lnPort ));
+      logger.info("Created secured cache in vm2");
+
+      vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+        props2, javaProps2, nyPort ));
+      logger.info("Created secured cache in vm3");
+
+      vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+      logger.info("Created sender in vm2");
+
+      vm3.invoke(() -> createReceiverInSecuredCache());
+      logger.info("Created receiver in vm3");
+
+      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
+      vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+      vm2.invoke(() -> verifyDifferentServerInGetCredentialCall());
+      vm3.invoke(() -> verifyDifferentServerInGetCredentialCall());
+    }
+  }
+
+  @Test
+  public void testWanSecurityManagerAuthValidCredentialsWithServer() {
+    disconnectAllFromDS();
+    {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      logger.info("Created locator on local site");
+
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+      logger.info("Created locator on remote site");
+
+      Properties props1 = buildSecurityProperties("admin", "secret");
+      Properties props2 = buildSecurityProperties("guest", "guest");
+
+      vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+        props1, null, lnPort ));
+      logger.info("Created secured cache in vm2");
+
+      vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
+        props2, null, nyPort ));
+      logger.info("Created secured cache in vm3");
+
+      vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+      logger.info("Created sender in vm2");
+
+      vm3.invoke(() -> createReceiverInSecuredCache());
+      logger.info("Created receiver in vm3");
+
+      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
+      vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+      vm2.invoke(() -> verifyDifferentServerInGetCredentialCall());
+
+      // this would fail for now because for integrated security, we are not sending the receiver's credentials back
+      // to the sender. Because in the old security implementation, even though the receiver's credentials are sent back to the sender
+      // the sender is not checking it.
+      //vm3.invoke(() -> verifyDifferentServerInGetCredentialCall());
+    }
+  }
+}


[14/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java
new file mode 100644
index 0000000..3ae9a01
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java
@@ -0,0 +1,1063 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.internal.cache.ForceReattemptException;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+@Category(DistributedTest.class)
+public class ReplicatedRegion_ParallelWANPropagationDUnitTest extends WANTestBase{
+
+  public ReplicatedRegion_ParallelWANPropagationDUnitTest() {
+    super();
+    // TODO Auto-generated constructor stub
+  }
+
+  final String expectedExceptions = null;
+  
+  
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  @Test
+  public void test_DR_PGS_1Nodes_Put_Receiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> WANTestBase.createReceiver());
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", null, isOffHeap() ));
+
+      createCacheInVMs(lnPort, vm4);
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, true ));
+
+      vm4.invoke(() -> WANTestBase.startSender( "ln1" ));
+      fail("Expected GatewaySenderConfigException where parallel gateway sender can not be used with replicated region");
+    }
+    catch (Exception e) {
+      if (!e.getCause().getMessage()
+          .contains("can not be used with replicated region")) {
+        fail("Expected GatewaySenderConfigException where parallel gateway sender can not be used with replicated region");
+      }
+    }
+  }
+  
+  /*1. Validate that parallelGatewaySenderId can be added to distributed region
+   *Region distributed ack/noack + PGS
+   *1. Find out the restrictions on totalNumBuckets on shadowPR
+   *2. Find out the restrictions on redundancy on shadowPR
+   *3. Find out the restrictions on localMaxMemory on shadowPR
+   *4. Find out the best way user will specify PR attributes to PGS
+   *5. Find out the restrictions on ordering.
+   *6. put on region populates the queue    
+   *7. put on region reaches to remote site. Dispatcher works as expected
+   *8. m1 and m2 has DR(ack/noack). put on DR from m1 populates queue on both m1 and m2. Validate that remote site got all the events
+   *9. m1 and m2 has DR(ack/noack). create/put/destroy/operations populates the queue. Validate that remote site got correct events
+   *10. m1 and m2 has DR(ack/noack). localDestroy is called on m1's DR. This locally destroys M1's shadowPr
+   *11. m1 and m2 has DR(ack/noack). destroy is called on m1's DR. This destroys entire shadowPr on m1 and m2
+   *12. m1 and m2 has DR(ack/noack). close Region is called on m1's DR. This locally destroys shadowPr on m1
+   *13. m1 and m2 has DR(ack/noack). cache.close on m1'. This locally destroys shadowPr on m1
+   *14. Validate HA scenario does not cause any event loss
+   *15. PDX events of DR are propagated to remote sites
+   *16. validate stats
+   *17: PR and DR regions with same name.. Can this be created. If yes then how to differentiate these 2 different shadowPR. 
+   *18. test for redundancy. FOR SPR's redundancy will be equal to the number of nodes where DR is present. Max is 3. I know this needs to be figure it out at runtime. 
+   *19. test without providing diskStoreName..I suspect some problem with this code. diskStoreName=null looks like this is not handled very well. need to verify
+   *20. ParallelGatewaySenderQueue#addPR method has multiple check for inPersistenceEnabled. Can's we do it with only one check.
+  */
+  
+  /**
+   * Test to validate that created parallel gatewaySenders id can be added to
+   * distributed region
+   * Below test is disabled intentionally
+    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+    3> We have to enabled it in next release
+    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0
+   */
+  @Ignore
+  @Test
+  public void test_PGS_Started_DR_CREATED_NO_RECEIVER() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+/*      ExpectedException exp1 = addExpectedException(GatewaySenderException.class
+          .getName(), vm4);
+      ExpectedException exp2 = addExpectedException(InterruptedException.class
+          .getName(), vm4);
+      try {
+*/        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+            true, 10, 100, false, false, null, false ));
+        vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+            getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+        vm4.invoke(() -> WANTestBase.doPuts(
+            getTestMethodName() + "_RR", 1000 ));
+        vm4.invoke(() -> WANTestBase.validateQueueContents(
+            "ln1", 1000 ));
+
+/*      }
+      finally {
+        exp1.remove();
+        exp2.remove();
+      }
+*/    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+
+  /**
+   * Test to validate that distributed region with given parallelGatewaySender id
+   * is created first and then a same parallelGatewaySender is created
+   * a single put in DR is enqueued in parallelQueue
+   * Below test is disabled intentionally
+    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+    3> We have to enabled it in next release
+    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0
+   */
+  @Ignore
+  @Test
+  public void test_DR_CREATED_PGS_STARTED_NO_RECEIVER() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+/*      ExpectedException exp1 = addExpectedException(GatewaySenderException.class
+          .getName(), vm4);
+      ExpectedException exp2 = addExpectedException(InterruptedException.class
+          .getName(), vm4);
+      try {*/
+        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+            true, 10, 100, false, false, null, false ));
+        vm4.invoke(() -> WANTestBase.doPuts(
+            getTestMethodName() + "_RR", 1000 ));
+        vm4.invoke(() -> WANTestBase.validateQueueContents(
+            "ln1", 1000 ));
+/*      }
+      finally {
+        exp1.remove();
+        exp2.remove();
+      }
+*/    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_1Node_Put_ValidateQueue_No_Receiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+      
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      
+/*      ExpectedException exp1 = addExpectedException(GatewaySenderException.class
+          .getName(), vm4);
+      ExpectedException exp2 = addExpectedException(InterruptedException.class
+          .getName(), vm4);
+      try {*/
+        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+            true, 10, 100, false, false, null, true ));
+        vm4.invoke(() -> WANTestBase.startSender( "ln1" ));
+
+        vm4.invoke(() -> WANTestBase.doPuts(
+            getTestMethodName() + "_RR", 10000 ));
+
+        vm4.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 10000 ));
+        vm4.invoke(() -> WANTestBase.validateQueueContents(
+            "ln1", 10000 ));
+/*      }
+    finally {
+      exp1.remove();
+      exp2.remove();
+    }
+     */ 
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_2Nodes_Put_ValidateQueue_No_Receiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+      vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+      
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      
+/*      ExpectedException exp1 = addExpectedException(
+          GatewaySenderException.class.getName());
+      ExpectedException exp2 = addExpectedException(
+          InterruptedException.class.getName());
+      ExpectedException exp3 = addExpectedException(
+          CacheClosedException.class.getName());
+      try {
+*/        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+            true, 10, 100, false, false, null, true ));
+        vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
+            true, 10, 100, false, false, null, true ));
+
+        startSenderInVMs("ln1", vm4, vm5);
+
+        vm4.invoke(() -> WANTestBase.doPuts(
+            getTestMethodName() + "_RR", 1000 ));
+
+        vm4.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 1000 ));
+        vm5.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 1000 ));
+
+        vm4.invoke(() -> WANTestBase.validateQueueContents(
+            "ln1", 1000 ));
+        vm5.invoke(() -> WANTestBase.validateQueueContents(
+            "ln1", 1000 ));
+
+/*      }
+      finally {
+        exp1.remove();
+        exp2.remove();
+        exp3.remove();
+      }
+*/      
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+//  public void test_DR_PGS_ORDERPOLICY_PARTITION_EXPECTException(){
+//    
+//  }
+//  public void test_DR_PGS_DISKSTORE_NAME_PROVIDED_VALIDATE_DISK(){
+//    
+//  }
+//  public void test_DR_PGS_DISKSTORE_NAME_NOT_PROVIDED_VALIDATE_DISK(){
+//    
+//  }
+//  
+//  public void test_DR_PGS_START_STOP_START(){
+//    
+//  }
+//
+//  public void test_DR_PGS_PERSISTENCE_START_STOP_START(){
+//    
+//  }
+//  
+//  public void test_DR_PGS_START_PAUSE_STOP(){
+//    
+//  }
+//
+//  public void test_DR_PGS_START_PAUSE_RESUME_VALIDATE_RECEIVER(){
+//    
+//  }
+
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_1Nodes_Put_Receiver_2() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> WANTestBase.createReceiver());
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+      createCacheInVMs(lnPort, vm4);
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+        true, 10, 100, false, false, null, true));
+
+      vm4.invoke(() -> WANTestBase.startSender( "ln1"));
+      
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000));
+     
+      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000));
+      
+      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000));
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_2Nodes_Put_Receiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+      vm2.invoke(() -> WANTestBase.createReceiver());
+
+      createCacheInVMs(lnPort, vm4, vm5);
+      
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+        true, 10, 100, false, false, null, true));
+      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      true, 10, 100, false, false, null, true));
+
+      startSenderInVMs("ln1", vm4, vm5);
+      
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+     
+      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      
+      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_2Nodes_EMPTY_Put_Receiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+      vm2.invoke(() -> WANTestBase.createReceiver());
+
+      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+      vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+      
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", Scope.DISTRIBUTED_ACK, DataPolicy.EMPTY, isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1", Scope.DISTRIBUTED_ACK, DataPolicy.REPLICATE, isOffHeap()  ));
+      
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+        true, 10, 100, false, false, null, true));
+      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      true, 10, 100, false, false, null, true));
+
+      startSenderInVMs("ln1", vm4, vm5);
+      
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+     
+//      vm4.invoke(() -> WANTestBase.validateRegionSize( testName + "_RR",
+//        1000 ));
+      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      
+      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PR_PGS_4Nodes_Put_Receiver_2Nodes() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2, vm3);
+      vm2.invoke(() -> WANTestBase.createReceiver());
+      vm3.invoke(() -> WANTestBase.createReceiver());
+      
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+      vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+      
+      vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
+      vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
+
+      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+      
+      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+      vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+      vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 10, 100, false, false, null, true ));
+      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 10, 100, false, false, null, true ));
+      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 10, 100, false, false, null, true ));
+      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 10, 100, false, false, null, true ));
+
+      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+      vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+      vm5.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_PR",
+        1000, 2000 ));
+      
+      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_PR",
+        1000 ));
+      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      
+      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+      
+/*      ExpectedException exp1 = addExpectedException(CacheClosedException.class
+          .getName());
+      try {*/
+        vm2.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 1000 ));
+        vm3.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 1000 ));
+        vm2.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_PR", 1000 ));
+        vm3.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_PR", 1000 ));
+/*      }
+      finally {
+        exp1.remove();
+      }
+*/    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_NOMANUALSTART_4Nodes_Put_ValidateReceiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> WANTestBase.createReceiver());
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+      
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+      vm6.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+      vm7.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+    
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+     
+      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      vm6.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      vm7.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+
+      
+      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      vm6.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      vm7.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      
+/*      ExpectedException exp1 = addExpectedException(CacheClosedException.class
+          .getName());
+      try {*/
+        vm2.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 1000 ));
+/*      }
+      finally {
+        exp1.remove();
+      }*/
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_4Nodes_Put_CLOSE4NODESCACHE_RECREATE_PUT_ValidateReceiver()
+      throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2, vm3);
+      createReceiverInVMs(vm2, vm3);
+
+      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", null, isOffHeap()  ));
+      vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+      // before doing any puts, let the senders be running in order to ensure
+      // that
+      // not a single event will be lost
+      vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+          1000 ));
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 1000 ));
+
+/*      ExpectedException exp1 = addExpectedException(CacheClosedException.class
+          .getName());
+      try {*/
+        vm4.invoke(() -> WANTestBase.killSender());
+        vm5.invoke(() -> WANTestBase.killSender());
+        vm6.invoke(() -> WANTestBase.killSender());
+        vm7.invoke(() -> WANTestBase.killSender());
+/*      }
+      finally {
+        exp1.remove();
+      }*/
+
+      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+          true, 100, 10, false, false, null, true ));
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+      vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+      // ------------------------------------------------------------------------------------
+
+      vm4.invoke(() -> WANTestBase.doNextPuts(
+          getTestMethodName() + "_RR", 1000, 2000 ));
+
+      // verify all buckets drained on all sender nodes.
+      vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+      vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+      vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+      vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+
+/*      exp1 = addExpectedException(CacheClosedException.class.getName());
+      try {*/
+        vm2.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 2000 ));
+        vm3.invoke(() -> WANTestBase.validateRegionSize(
+            getTestMethodName() + "_RR", 2000 ));
+/*      }
+      finally {
+        exp1.remove();
+      }*/
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_NO_ACK_PGS_2Nodes_Put_ValidateQueue_Receiver() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+      vm2.invoke(() -> WANTestBase.createReceiver());
+
+      createCacheInVMs(lnPort, vm4, vm5);
+      
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln1",
+              Scope.DISTRIBUTED_NO_ACK, DataPolicy.REPLICATE, isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln1",
+              Scope.DISTRIBUTED_NO_ACK, DataPolicy.REPLICATE, isOffHeap()   ));
+      
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+        true, 10, 100, false, false, null, true));
+      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      true, 10, 100, false, false, null, true));
+
+      startSenderInVMs("ln1", vm4, vm5);
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+     
+      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
+        1000 ));
+      
+      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
+        0 ));
+      
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    }
+    catch (Exception e) {
+      Assert.fail("Unexpected exception", e);
+    }
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_2NODES_1NODESDOWN_Validate_Receiver() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    Thread.sleep(60000);;
+    
+/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
+        .getName());
+    try {*/
+      AsyncInvocation inv1 = vm4.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts0(
+              getTestMethodName() + "_RR", 1000 ));
+      Wait.pause(1000);
+      AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.killSender());
+      try {
+        inv1.join();
+        inv2.join();
+      }
+      catch (Exception e) {
+        Assert.fail("UnExpected Exception", e);
+      }
+/*    }
+    finally {
+      exp1.remove();
+    }*/
+
+    Integer size = (Integer)vm4.invoke(() -> WANTestBase.getQueueContentSize( "ln" ));
+    LogWriterUtils.getLogWriter().info("The size of the queue is in vm4 " + size);
+    
+
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    
+    size = (Integer)vm4.invoke(() -> WANTestBase.getQueueContentSize( "ln" ));
+    LogWriterUtils.getLogWriter().info("The size of the queue is in vm4 " + size);
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGS_4NODES_2NODESDOWN_Validate_Receiver() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    Thread.sleep(60000);
+/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
+        .getName());
+    try */{
+      AsyncInvocation inv1 = vm7.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts0(
+              getTestMethodName() + "_RR", 10000 ));
+      Thread.sleep(1000);
+      AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+      Thread.sleep(2000);
+      AsyncInvocation inv3 = vm6.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts1(
+              getTestMethodName() + "_RR", 10000 ));
+      Thread.sleep(1500);
+      AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
+      try {
+        inv1.join();
+        inv2.join();
+        inv3.join();
+        inv4.join();
+      }
+      catch (Exception e) {
+        Assert.fail("UnExpected Exception", e);
+      }
+    }/*
+    finally {
+      exp1.remove();
+    }*/
+
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+    
+  }
+  
+  public static void doPuts0(String regionName, int numPuts) {
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class
+        .getName());
+    try {
+
+      Region r = cache.getRegion(Region.SEPARATOR + regionName);
+      assertNotNull(r);
+      for (long i = 0; i < numPuts; i++) {
+        LogWriterUtils.getLogWriter().info("Put : key : " + i);
+        r.put(i, "0_" + i);
+      }
+    } finally {
+      exp.remove();
+      exp1.remove();
+    }
+  }
+  
+  public static void doPuts1(String regionName, int numPuts){
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class
+        .getName());
+    try {
+
+      Region r = cache.getRegion(Region.SEPARATOR + regionName);
+      assertNotNull(r);
+      for (long i = 0; i < numPuts; i++) {
+        LogWriterUtils.getLogWriter().info("Put : key : " + i);
+        r.put(i, "1_" + i);
+      }
+    } finally {
+      exp.remove();
+      exp1.remove();
+    }
+  }
+  
+  public static void doPuts2(String regionName, int numPuts){
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class
+        .getName());
+    try {
+      Region r = cache.getRegion(Region.SEPARATOR + regionName);
+      assertNotNull(r);
+      for (long i = 0; i < numPuts; i++) {
+        LogWriterUtils.getLogWriter().info("Put : key : " + i);
+        r.put(i, "2_" + i);
+      }
+    } finally {
+      exp.remove();
+      exp1.remove();
+    }
+  }
+    
+  /**
+   * Test to validate that put on DR with no ack on multiple nodes are propagated to parallelQueue on multiple nodes
+   */
+  
+  /**
+   * Test to validate that the single put in DR is propagated to remote site through parallelGatewaySender
+   */
+  
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java
new file mode 100644
index 0000000..0ee78c5
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java
@@ -0,0 +1,228 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.zip.Adler32;
+import java.util.zip.CheckedInputStream;
+import java.util.zip.CheckedOutputStream;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class SenderWithTransportFilterDUnitTest extends WANTestBase {
+
+  @Test
+  public void testSerialSenderWithTransportFilter() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> SenderWithTransportFilterDUnitTest.createReceiverWithTransportFilters( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm3.invoke(() -> SenderWithTransportFilterDUnitTest.createSenderWithTransportFilter( "ln", 2, false, 100,
+            1, false, false, true ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 100 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+  }
+
+  @Test
+  public void testParallelSenderWithTransportFilter() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> SenderWithTransportFilterDUnitTest.createReceiverWithTransportFilters( nyPort ));
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 10, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm3.invoke(() -> SenderWithTransportFilterDUnitTest.createSenderWithTransportFilter( "ln", 2, true, 100,
+            1, false, false, true ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 0, 10, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 100 ));
+  }
+  
+  public static int createReceiverWithTransportFilters(int locPort) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
+    transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
+    if (!transportFilters.isEmpty()) {
+      for (GatewayTransportFilter filter : transportFilters) {
+        fact.addGatewayTransportFilter(filter);
+      }
+    }
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port, e);
+    }
+    return port;
+  }
+
+  public static void createSenderWithTransportFilter(String dsName,
+      int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize,
+      boolean isConflation, boolean isPersistent, boolean isManualStart) {
+    File persistentDirectory = new File(dsName + "_disk_"
+        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File[] dirs1 = new File[] { persistentDirectory };
+
+    if (isParallel) {
+      GatewaySenderFactory gateway = cache
+          .createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
+      ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
+      transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
+      if (!transportFilters.isEmpty()) {
+        for (GatewayTransportFilter filter : transportFilters) {
+          gateway.addGatewayTransportFilter(filter);
+        }
+      }
+      if (isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+            .getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsId);
+
+    }
+    else {
+      GatewaySenderFactory gateway = cache
+          .createGatewaySenderFactory();
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      ((InternalGatewaySenderFactory)gateway)
+          .setLocatorDiscoveryCallback(new MyLocatorCallback());
+      ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
+      transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
+      if (!transportFilters.isEmpty()) {
+        for (GatewayTransportFilter filter : transportFilters) {
+          gateway.addGatewayTransportFilter(filter);
+        }
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      if (isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+            .getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.create(dsName, remoteDsId);
+    }
+  }
+
+  static class CheckSumTransportFilter implements GatewayTransportFilter {
+
+    Adler32 checker = new Adler32();
+    
+    private String name;
+    
+    public CheckSumTransportFilter(String name){
+      this.name = name;
+    }
+
+    @Override
+    public String toString(){
+      return this.name;
+    }
+
+    @Override
+    public InputStream getInputStream(InputStream stream) {
+      return new CheckedInputStream(stream, checker);
+    }
+
+    @Override
+    public OutputStream getOutputStream(OutputStream stream) {
+      return new CheckedOutputStream(stream, checker);
+    }
+
+    @Override
+    public void close() {
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java
new file mode 100644
index 0000000..6e2581e
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java
@@ -0,0 +1,206 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import static org.junit.Assert.*;
+
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.admin.AdminDistributedSystemFactory;
+import com.gemstone.gemfire.admin.AdminException;
+import com.gemstone.gemfire.admin.DistributedSystemConfig;
+import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.internal.cache.CacheObserverAdapter;
+import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase {
+
+  private static final long MAX_WAIT = 70000;
+
+  private static final int NUM_KEYS = 1000;
+
+  public ShutdownAllPersistentGatewaySenderDUnitTest() {
+    super();
+  }
+  
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("Cache is being closed by ShutdownAll");
+  }
+
+  private static final long serialVersionUID = 1L;
+
+  @Test
+  public void testGatewaySender() throws Exception {
+    IgnoredException.addIgnoredException("Cache is shutting down");
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 400, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    // set the CacheObserver to block the ShutdownAll
+    SerializableRunnable waitAtShutdownAll = new SerializableRunnable() {
+      @Override
+      public void run() {
+        LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
+        CacheObserverHolder.setInstance(new CacheObserverAdapter() {
+          @Override
+          public void beforeShutdownAll() {
+            final Region region = cache.getRegion(getTestMethodName() + "_PR");
+            Wait.waitForCriterion(new WaitCriterion() {
+              @Override
+              public boolean done() {
+                return region.size() >= 2;
+              }
+
+              @Override
+              public String description() {
+                return "Wait for wan to have processed several events";
+              }
+            }, 30000, 100, true);
+          }
+        });
+      }
+    };
+    vm2.invoke(waitAtShutdownAll);
+    vm3.invoke(waitAtShutdownAll);
+    
+    AsyncInvocation vm4_future = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", NUM_KEYS ));
+
+    // ShutdownAll will be suspended at observer, so puts will continue
+    AsyncInvocation future = shutDownAllMembers(vm2, 2, MAX_WAIT);
+    future.join(MAX_WAIT);
+
+    // now restart vm1 with gatewayHub
+    LogWriterUtils.getLogWriter().info("restart in VM2");
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
+    AsyncInvocation vm3_future = vm3.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR",
+            "ln", 1, 100, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm3_future.join(MAX_WAIT);
+
+    vm3.invoke(new SerializableRunnable() {
+      public void run() {
+        final Region region = cache.getRegion(getTestMethodName() + "_PR");
+        cache.getLogger().info(
+            "vm1's region size before restart gatewayHub is " + region.size());
+      }
+    });
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    // wait for vm0 to finish its work
+    vm4_future.join(MAX_WAIT);
+    vm4.invoke(new SerializableRunnable() {
+      public void run() {
+        Region region = cache.getRegion(getTestMethodName() + "_PR");
+        assertEquals(NUM_KEYS, region.size());
+      }
+    });
+
+    // verify the other side (vm1)'s entries received from gateway
+    vm2.invoke(new SerializableRunnable() {
+      public void run() {
+        final Region region = cache.getRegion(getTestMethodName() + "_PR");
+
+        cache.getLogger().info(
+            "vm1's region size after restart gatewayHub is " + region.size());
+        Wait.waitForCriterion(new WaitCriterion() {
+          public boolean done() {
+            Object lastValue = region.get(NUM_KEYS - 1);
+            if (lastValue != null && lastValue.equals(NUM_KEYS - 1)) {
+              region.getCache().getLogger().info(
+                  "Last key has arrived, its value is " + lastValue
+                      + ", end of wait.");
+              return true;
+            }
+            else
+              return (region.size() == NUM_KEYS);
+          }
+
+          public String description() {
+            return "Waiting for destination region to reach size: " + NUM_KEYS
+                + ", current is " + region.size();
+          }
+        }, MAX_WAIT, 100, true);
+        assertEquals(NUM_KEYS, region.size());
+      }
+    });
+
+  }
+
+  private AsyncInvocation shutDownAllMembers(VM vm, final int expectedNumber, final long timeout) {
+      AsyncInvocation future = vm.invokeAsync(new SerializableRunnable("Shutdown all the members") {
+
+      public void run() {
+        DistributedSystemConfig config;
+        AdminDistributedSystemImpl adminDS = null;
+        try {
+          config = AdminDistributedSystemFactory.defineDistributedSystem(cache
+              .getDistributedSystem(), "");
+          adminDS = (AdminDistributedSystemImpl)AdminDistributedSystemFactory
+              .getDistributedSystem(config);
+          adminDS.connect();
+          Set members = adminDS.shutDownAllMembers(timeout);
+          int num = members == null ? 0 : members.size();
+          assertEquals(expectedNumber, num);
+        }
+        catch (AdminException e) {
+          throw new RuntimeException(e);
+        }
+        finally {
+          if (adminDS != null) {
+            adminDS.disconnect();
+          }
+        }
+      }
+    });
+    return future;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java
new file mode 100644
index 0000000..b504f87
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java
@@ -0,0 +1,601 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.wan.*;
+import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.wan.GatewayReceiverException;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
+import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory;
+import com.gemstone.gemfire.internal.cache.wan.MyGatewaySenderEventListener;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.junit.Assert.*;
+
+@Category(IntegrationTest.class)
+public class WANConfigurationJUnitTest {
+
+  private Cache cache;
+
+  /**
+   * Test to validate that the sender can not be started without configuring
+   * locator
+   * @throws IOException 
+   * 
+   * @throws IOException
+   */
+  @Test
+  public void test_GatewaySender_without_Locator() throws IOException {
+    try {
+      cache = new CacheFactory().set(MCAST_PORT, "0").create();
+      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+      fact.setParallel(true);
+      GatewaySender sender1 = fact.create("NYSender", 2);
+      sender1.start();
+      fail("Expected IllegalStateException but not thrown");
+    }
+    catch (Exception e) {
+      if ((e instanceof IllegalStateException && e
+          .getMessage()
+          .startsWith(
+              LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
+                  .toLocalizedString()))) {
+      }
+      else {
+        fail("Expected IllegalStateException but received :" + e);
+      }
+    }
+  }
+
+  /**
+   * Test to validate that sender with same Id can not be added to cache.
+   */
+  @Test
+  public void test_SameGatewaySenderCreatedTwice() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    try {
+      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+      fact.setParallel(true);
+      fact.setManualStart(true);
+      fact.create("NYSender", 2);
+      fact.create("NYSender", 2);
+      fail("Expected IllegalStateException but not thrown");
+    }
+    catch (Exception e) {
+      if (e instanceof IllegalStateException
+          && e.getMessage().contains("A GatewaySender with id")) {
+
+      }
+      else {
+        fail("Expected IllegalStateException but received :" + e);
+      }
+    }
+  }
+  
+  /**
+   * Test to validate that same gatewaySender Id can not be added to the region attributes.
+   */
+  @Test
+  public void test_SameGatewaySenderIdAddedTwice() {
+    try {
+      cache = new CacheFactory().set(MCAST_PORT, "0").create();
+      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+      fact.setParallel(true);
+      fact.setManualStart(true);
+      GatewaySender sender1 = fact.create("NYSender", 2);
+      AttributesFactory factory = new AttributesFactory();
+      factory.addGatewaySenderId(sender1.getId());
+      factory.addGatewaySenderId(sender1.getId());
+      fail("Expected IllegalArgumentException but not thrown");
+    }
+    catch (Exception e) {
+      if (e instanceof IllegalArgumentException
+          && e.getMessage().contains("is already added")) {
+
+      }
+      else {
+        fail("Expected IllegalStateException but received :" + e);
+      }
+    }
+  }
+  
+  @Test
+  public void test_GatewaySenderIdAndAsyncEventId() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+      AttributesFactory factory = new AttributesFactory();
+      factory.addGatewaySenderId("ln");
+      factory.addGatewaySenderId("ny");
+      factory.addAsyncEventQueueId("Async_LN");
+      RegionAttributes attrs = factory.create();
+      
+      Set<String> senderIds = new HashSet<String>();
+      senderIds.add("ln");
+      senderIds.add("ny");
+      Set<String> attrsSenderIds = attrs.getGatewaySenderIds();
+      assertEquals(senderIds, attrsSenderIds);
+      Region r = cache.createRegion("Customer", attrs);
+      assertEquals(senderIds, ((LocalRegion)r).getGatewaySenderIds());
+  }
+
+  /**
+   * Test to validate that distributed region can not have the gateway sender
+   * with parallel distribution policy
+   * 
+   */
+  @Ignore("Bug51491")
+  @Test
+  public void test_GatewaySender_Parallel_DistributedRegion() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setParallel(true);
+    fact.setManualStart(true);
+    GatewaySender sender1 = fact.create("NYSender", 2);
+    AttributesFactory factory = new AttributesFactory();
+    factory.addGatewaySenderId(sender1.getId());
+    factory.setScope(Scope.DISTRIBUTED_ACK);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    try {
+      RegionFactory regionFactory = cache.createRegionFactory(factory.create());
+      Region region = regionFactory
+          .create("test_GatewaySender_Parallel_DistributedRegion");
+    }
+    catch (Exception e) {
+      fail("Unexpected Exception :" + e);
+    }
+  }
+  
+  @Test
+  public void test_GatewaySender_Parallel_MultipleDispatcherThread() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setParallel(true);
+    fact.setManualStart(true);
+    fact.setDispatcherThreads(4);
+    try {
+      GatewaySender sender1 = fact.create("NYSender", 2);
+    }
+    catch (GatewaySenderException e) {
+       fail("UnExpected Exception " + e);
+    }
+  }
+  
+  @Test
+  public void test_GatewaySender_Serial_ZERO_DispatcherThread() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setManualStart(true);
+    fact.setDispatcherThreads(0);
+    try {
+      GatewaySender sender1 = fact.create("NYSender", 2);
+      fail("Expected GatewaySenderException but not thrown");
+    }
+    catch (GatewaySenderException e) {
+      if (e.getMessage().contains("can not be created with dispatcher threads less than 1")) {
+      }
+      else {
+        fail("Expected IllegalStateException but received :" + e);
+      }
+    }
+  }
+
+  /**
+   * Test to validate the gateway receiver attributes are correctly set
+   */
+  @Test
+  public void test_ValidateGatewayReceiverAttributes() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    int[] randomAvailableTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+    int port1 = randomAvailableTCPPorts[0];
+    int port2 = randomAvailableTCPPorts[1];
+    
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    if(port1 < port2){
+      fact.setStartPort(port1);
+      fact.setEndPort(port2);  
+    }else{
+      fact.setStartPort(port2);
+      fact.setEndPort(port1);
+    }
+    
+    fact.setMaximumTimeBetweenPings(2000);
+    fact.setSocketBufferSize(200);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayReceiver receiver1 = fact.create();
+    
+
+    Region region = cache.createRegionFactory().create(
+        "test_ValidateGatewayReceiverAttributes");
+    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+    GatewayReceiver rec = receivers.iterator().next();
+    assertEquals(receiver1.getHost(), rec.getHost());
+    assertEquals(receiver1.getStartPort(), rec.getStartPort());
+    assertEquals(receiver1.getEndPort(), rec.getEndPort());
+    assertEquals(receiver1.getBindAddress(), rec.getBindAddress());
+    assertEquals(receiver1.getMaximumTimeBetweenPings(), rec
+        .getMaximumTimeBetweenPings());
+    assertEquals(receiver1.getSocketBufferSize(), rec
+        .getSocketBufferSize());
+    assertEquals(receiver1.getGatewayTransportFilters().size(), rec
+        .getGatewayTransportFilters().size());
+
+  }
+
+  @Test
+  public void test_ValidateGatewayReceiverStatus() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    int[] randomAvailableTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+    int port1 = randomAvailableTCPPorts[0];
+    int port2 = randomAvailableTCPPorts[1];
+    
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    if(port1 < port2){
+      fact.setStartPort(port1);
+      fact.setEndPort(port2);  
+    }else{
+      fact.setStartPort(port2);
+      fact.setEndPort(port1);
+    }
+    
+    fact.setMaximumTimeBetweenPings(2000);
+    fact.setSocketBufferSize(200);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayReceiver receiver1 = fact.create();
+    assertTrue(receiver1.isRunning());
+  }
+  
+  /**
+   * Test to validate that serial gateway sender attributes are correctly set
+   */
+  @Test
+  public void test_ValidateSerialGatewaySenderAttributes() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setManualStart(true);
+    fact.setBatchConflationEnabled(true);
+    fact.setBatchSize(200);
+    fact.setBatchTimeInterval(300);
+    fact.setPersistenceEnabled(false);
+    fact.setDiskStoreName("FORNY");
+    fact.setMaximumQueueMemory(200);
+    fact.setAlertThreshold(1200);
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    fact.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    GatewaySender sender1 = fact.create("TKSender", 2);
+    
+
+    AttributesFactory factory = new AttributesFactory();
+    factory.addGatewaySenderId(sender1.getId());
+    factory.setDataPolicy(DataPolicy.PARTITION);
+    Region region = cache.createRegionFactory(factory.create()).create(
+        "test_ValidateGatewaySenderAttributes");
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    assertEquals(senders.size(), 1);
+    GatewaySender gatewaySender = senders.iterator().next();
+    assertEquals(sender1.getRemoteDSId(), gatewaySender
+        .getRemoteDSId());
+    assertEquals(sender1.isManualStart(), gatewaySender.isManualStart());
+    assertEquals(sender1.isBatchConflationEnabled(), gatewaySender
+        .isBatchConflationEnabled());
+    assertEquals(sender1.getBatchSize(), gatewaySender.getBatchSize());
+    assertEquals(sender1.getBatchTimeInterval(), gatewaySender
+        .getBatchTimeInterval());
+    assertEquals(sender1.isPersistenceEnabled(), gatewaySender
+        .isPersistenceEnabled());
+    assertEquals(sender1.getDiskStoreName(), gatewaySender.getDiskStoreName());
+    assertEquals(sender1.getMaximumQueueMemory(), gatewaySender
+        .getMaximumQueueMemory());
+    assertEquals(sender1.getAlertThreshold(), gatewaySender
+        .getAlertThreshold());
+    assertEquals(sender1.getGatewayEventFilters().size(), gatewaySender
+        .getGatewayEventFilters().size());
+    assertEquals(sender1.getGatewayTransportFilters().size(), gatewaySender
+        .getGatewayTransportFilters().size());
+
+  }
+  
+  /**
+   * Test to validate that parallel gateway sender attributes are correctly set
+   */
+  @Test
+  public void test_ValidateParallelGatewaySenderAttributes() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setParallel(true);
+    fact.setManualStart(true);
+    fact.setBatchConflationEnabled(true);
+    fact.setBatchSize(200);
+    fact.setBatchTimeInterval(300);
+    fact.setPersistenceEnabled(false);
+    fact.setDiskStoreName("FORNY");
+    fact.setMaximumQueueMemory(200);
+    fact.setAlertThreshold(1200);
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    fact.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    GatewaySender sender1 = fact.create("TKSender", 2);
+    
+
+    AttributesFactory factory = new AttributesFactory();
+    factory.addGatewaySenderId(sender1.getId());
+    factory.setDataPolicy(DataPolicy.PARTITION);
+    Region region = cache.createRegionFactory(factory.create()).create(
+        "test_ValidateGatewaySenderAttributes");
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    assertEquals(1, senders.size());
+    GatewaySender gatewaySender = senders.iterator().next();
+    assertEquals(sender1.getRemoteDSId(), gatewaySender
+        .getRemoteDSId());
+    assertEquals(sender1.isManualStart(), gatewaySender.isManualStart());
+    assertEquals(sender1.isBatchConflationEnabled(), gatewaySender
+        .isBatchConflationEnabled());
+    assertEquals(sender1.getBatchSize(), gatewaySender.getBatchSize());
+    assertEquals(sender1.getBatchTimeInterval(), gatewaySender
+        .getBatchTimeInterval());
+    assertEquals(sender1.isPersistenceEnabled(), gatewaySender
+        .isPersistenceEnabled());
+    assertEquals(sender1.getDiskStoreName(), gatewaySender.getDiskStoreName());
+    assertEquals(sender1.getMaximumQueueMemory(), gatewaySender
+        .getMaximumQueueMemory());
+    assertEquals(sender1.getAlertThreshold(), gatewaySender
+        .getAlertThreshold());
+    assertEquals(sender1.getGatewayEventFilters().size(), gatewaySender
+        .getGatewayEventFilters().size());
+    assertEquals(sender1.getGatewayTransportFilters().size(), gatewaySender
+        .getGatewayTransportFilters().size());
+
+  }
+  
+  @Test
+  public void test_GatewaySenderWithGatewaySenderEventListener1() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    InternalGatewaySenderFactory fact = (InternalGatewaySenderFactory)cache.createGatewaySenderFactory();
+    AsyncEventListener listener = new MyGatewaySenderEventListener();
+    ((InternalGatewaySenderFactory)fact).addAsyncEventListener(listener);
+    try {
+      fact.create("ln", 2);
+      fail("Expected GatewaySenderException. When a sender is added , remoteDSId should not be provided.");
+    } catch (Exception e) {
+      if (e instanceof GatewaySenderException
+          && e.getMessage()
+              .contains(
+                  "cannot define a remote site because at least AsyncEventListener is already added.")) {
+
+      } else {
+        fail("Expected GatewaySenderException but received :" + e);
+      }
+    }
+  }  
+  
+  @Test
+  public void test_GatewaySenderWithGatewaySenderEventListener2() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    AsyncEventListener listener = new MyGatewaySenderEventListener();
+    ((InternalGatewaySenderFactory)fact).addAsyncEventListener(listener);
+    try {
+      ((InternalGatewaySenderFactory)fact).create("ln");
+    } catch (Exception e) {
+      fail("Received Exception :" + e);
+    }
+  }
+  
+  @Test
+  public void test_ValidateGatewayReceiverAttributes_2() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setStartPort(50504);
+    fact.setMaximumTimeBetweenPings(1000);
+    fact.setSocketBufferSize(4000);
+    fact.setEndPort(70707);
+    fact.setManualStart(true);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      fail("The test failed with IOException");
+    }
+
+    assertEquals(50504, receiver.getStartPort());
+    assertEquals(1000, receiver.getMaximumTimeBetweenPings());
+    assertEquals(4000,receiver.getSocketBufferSize());
+    assertEquals(70707, receiver.getEndPort());
+  }
+
+  /**
+   * This test takes a minimum of 120s to execute. It is known to hang on Mac OS
+   * X Yosemite do to changes in the the message string checked in
+   * GatewayReceiverImpl around line 167. Expects
+   * "Cannot assign requested address" but gets
+   * "Can't assign requested address". Timeout after 150s to safeguard against
+   * hanging on other platforms that may differ.
+   */
+  @Test(timeout = 150000)
+  public void test_ValidateGatewayReceiverAttributes_WrongBindAddress() {
+    if (System.getProperty("os.name").equals("Mac OS X")) {
+     fail("Failing to avoid known hang on Mac OS X.");
+    }
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setStartPort(50504);
+    fact.setMaximumTimeBetweenPings(1000);
+    fact.setSocketBufferSize(4000);
+    fact.setEndPort(70707);
+    fact.setManualStart(true);
+    fact.setBindAddress("200.112.204.10");
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+      fail("Expected GatewayReceiverException");
+    }
+    catch (GatewayReceiverException gRE){
+      assertTrue(gRE.getMessage().contains("Failed to create server socket on"));
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+      fail("The test failed with IOException");
+    }
+  }
+  
+  @Test
+  public void test_ValidateGatewayReceiverDefaultStartPortAndDefaultEndPort() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setMaximumTimeBetweenPings(1000);
+    fact.setSocketBufferSize(4000);
+    fact.setManualStart(true);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      fail("The test failed with IOException");
+    }
+    int port = receiver.getPort();
+    if((port < 5000) || (port > 5500)) {
+      fail("GatewayReceiver started on out of range port");
+    }
+  }
+  
+  @Test
+  public void test_ValidateGatewayReceiverDefaultStartPortAndEndPortProvided() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setMaximumTimeBetweenPings(1000);
+    fact.setSocketBufferSize(4000);
+    fact.setEndPort(50707);
+    fact.setManualStart(true);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      fail("The test failed with IOException");
+    }
+    int port = receiver.getPort();
+    if((port < GatewayReceiver.DEFAULT_START_PORT) || (port > 50707)) {
+      fail("GatewayReceiver started on out of range port");
+    }
+  }
+  
+  @Test
+  public void test_ValidateGatewayReceiverWithManualStartFALSE() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setMaximumTimeBetweenPings(1000);
+    fact.setSocketBufferSize(4000);
+    fact.setStartPort(5303);
+    fact.setManualStart(false);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayReceiver receiver = fact.create();
+    int port = receiver.getPort();
+    if ((port < 5303) || (port > GatewayReceiver.DEFAULT_END_PORT)) {
+      fail("GatewayReceiver started on out of range port");
+    }
+  }
+  
+  @Test
+  public void test_ValidateGatewayReceiverWithStartPortAndDefaultEndPort() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setMaximumTimeBetweenPings(1000);
+    fact.setSocketBufferSize(4000);
+    fact.setStartPort(5303);
+    fact.setManualStart(true);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      fail("The test failed with IOException");
+    }
+    int port = receiver.getPort();
+    if ((port < 5303) || (port > GatewayReceiver.DEFAULT_END_PORT)) {
+      fail("GatewayReceiver started on out of range port");
+    }
+  }
+  
+  @Test
+  public void test_ValidateGatewayReceiverWithWrongEndPortProvided() {
+    cache = new CacheFactory().set(MCAST_PORT, "0").create();
+    try {
+      GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+      fact.setMaximumTimeBetweenPings(1000);
+      fact.setSocketBufferSize(4000);
+      fact.setEndPort(4999);
+      GatewayReceiver receiver = fact.create();  
+      fail("wrong end port set in the GatewayReceiver");
+    } catch (IllegalStateException expected) {
+      if(!expected.getMessage().contains("Please specify either start port a value which is less than end port.")){
+        fail("Caught IllegalStateException");
+        expected.printStackTrace();
+      }
+    }
+  }
+  
+  @After
+  public void tearDown() throws Exception {
+    if (this.cache != null) {
+      this.cache.close();
+    }
+  }
+}



[34/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java
deleted file mode 100644
index 3ae9a01..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropagationDUnitTest.java
+++ /dev/null
@@ -1,1063 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.internal.cache.ForceReattemptException;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-@Category(DistributedTest.class)
-public class ReplicatedRegion_ParallelWANPropagationDUnitTest extends WANTestBase{
-
-  public ReplicatedRegion_ParallelWANPropagationDUnitTest() {
-    super();
-    // TODO Auto-generated constructor stub
-  }
-
-  final String expectedExceptions = null;
-  
-  
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  @Test
-  public void test_DR_PGS_1Nodes_Put_Receiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> WANTestBase.createReceiver());
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", null, isOffHeap() ));
-
-      createCacheInVMs(lnPort, vm4);
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, true ));
-
-      vm4.invoke(() -> WANTestBase.startSender( "ln1" ));
-      fail("Expected GatewaySenderConfigException where parallel gateway sender can not be used with replicated region");
-    }
-    catch (Exception e) {
-      if (!e.getCause().getMessage()
-          .contains("can not be used with replicated region")) {
-        fail("Expected GatewaySenderConfigException where parallel gateway sender can not be used with replicated region");
-      }
-    }
-  }
-  
-  /*1. Validate that parallelGatewaySenderId can be added to distributed region
-   *Region distributed ack/noack + PGS
-   *1. Find out the restrictions on totalNumBuckets on shadowPR
-   *2. Find out the restrictions on redundancy on shadowPR
-   *3. Find out the restrictions on localMaxMemory on shadowPR
-   *4. Find out the best way user will specify PR attributes to PGS
-   *5. Find out the restrictions on ordering.
-   *6. put on region populates the queue    
-   *7. put on region reaches to remote site. Dispatcher works as expected
-   *8. m1 and m2 has DR(ack/noack). put on DR from m1 populates queue on both m1 and m2. Validate that remote site got all the events
-   *9. m1 and m2 has DR(ack/noack). create/put/destroy/operations populates the queue. Validate that remote site got correct events
-   *10. m1 and m2 has DR(ack/noack). localDestroy is called on m1's DR. This locally destroys M1's shadowPr
-   *11. m1 and m2 has DR(ack/noack). destroy is called on m1's DR. This destroys entire shadowPr on m1 and m2
-   *12. m1 and m2 has DR(ack/noack). close Region is called on m1's DR. This locally destroys shadowPr on m1
-   *13. m1 and m2 has DR(ack/noack). cache.close on m1'. This locally destroys shadowPr on m1
-   *14. Validate HA scenario does not cause any event loss
-   *15. PDX events of DR are propagated to remote sites
-   *16. validate stats
-   *17: PR and DR regions with same name.. Can this be created. If yes then how to differentiate these 2 different shadowPR. 
-   *18. test for redundancy. FOR SPR's redundancy will be equal to the number of nodes where DR is present. Max is 3. I know this needs to be figure it out at runtime. 
-   *19. test without providing diskStoreName..I suspect some problem with this code. diskStoreName=null looks like this is not handled very well. need to verify
-   *20. ParallelGatewaySenderQueue#addPR method has multiple check for inPersistenceEnabled. Can's we do it with only one check.
-  */
-  
-  /**
-   * Test to validate that created parallel gatewaySenders id can be added to
-   * distributed region
-   * Below test is disabled intentionally
-    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-    3> We have to enabled it in next release
-    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0
-   */
-  @Ignore
-  @Test
-  public void test_PGS_Started_DR_CREATED_NO_RECEIVER() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-/*      ExpectedException exp1 = addExpectedException(GatewaySenderException.class
-          .getName(), vm4);
-      ExpectedException exp2 = addExpectedException(InterruptedException.class
-          .getName(), vm4);
-      try {
-*/        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-            true, 10, 100, false, false, null, false ));
-        vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-            getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-        vm4.invoke(() -> WANTestBase.doPuts(
-            getTestMethodName() + "_RR", 1000 ));
-        vm4.invoke(() -> WANTestBase.validateQueueContents(
-            "ln1", 1000 ));
-
-/*      }
-      finally {
-        exp1.remove();
-        exp2.remove();
-      }
-*/    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-
-  /**
-   * Test to validate that distributed region with given parallelGatewaySender id
-   * is created first and then a same parallelGatewaySender is created
-   * a single put in DR is enqueued in parallelQueue
-   * Below test is disabled intentionally
-    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-    3> We have to enabled it in next release
-    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0
-   */
-  @Ignore
-  @Test
-  public void test_DR_CREATED_PGS_STARTED_NO_RECEIVER() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-/*      ExpectedException exp1 = addExpectedException(GatewaySenderException.class
-          .getName(), vm4);
-      ExpectedException exp2 = addExpectedException(InterruptedException.class
-          .getName(), vm4);
-      try {*/
-        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-            true, 10, 100, false, false, null, false ));
-        vm4.invoke(() -> WANTestBase.doPuts(
-            getTestMethodName() + "_RR", 1000 ));
-        vm4.invoke(() -> WANTestBase.validateQueueContents(
-            "ln1", 1000 ));
-/*      }
-      finally {
-        exp1.remove();
-        exp2.remove();
-      }
-*/    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_1Node_Put_ValidateQueue_No_Receiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-      
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      
-/*      ExpectedException exp1 = addExpectedException(GatewaySenderException.class
-          .getName(), vm4);
-      ExpectedException exp2 = addExpectedException(InterruptedException.class
-          .getName(), vm4);
-      try {*/
-        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-            true, 10, 100, false, false, null, true ));
-        vm4.invoke(() -> WANTestBase.startSender( "ln1" ));
-
-        vm4.invoke(() -> WANTestBase.doPuts(
-            getTestMethodName() + "_RR", 10000 ));
-
-        vm4.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 10000 ));
-        vm4.invoke(() -> WANTestBase.validateQueueContents(
-            "ln1", 10000 ));
-/*      }
-    finally {
-      exp1.remove();
-      exp2.remove();
-    }
-     */ 
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_2Nodes_Put_ValidateQueue_No_Receiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-      vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-      
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      
-/*      ExpectedException exp1 = addExpectedException(
-          GatewaySenderException.class.getName());
-      ExpectedException exp2 = addExpectedException(
-          InterruptedException.class.getName());
-      ExpectedException exp3 = addExpectedException(
-          CacheClosedException.class.getName());
-      try {
-*/        vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-            true, 10, 100, false, false, null, true ));
-        vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
-            true, 10, 100, false, false, null, true ));
-
-        startSenderInVMs("ln1", vm4, vm5);
-
-        vm4.invoke(() -> WANTestBase.doPuts(
-            getTestMethodName() + "_RR", 1000 ));
-
-        vm4.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 1000 ));
-        vm5.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 1000 ));
-
-        vm4.invoke(() -> WANTestBase.validateQueueContents(
-            "ln1", 1000 ));
-        vm5.invoke(() -> WANTestBase.validateQueueContents(
-            "ln1", 1000 ));
-
-/*      }
-      finally {
-        exp1.remove();
-        exp2.remove();
-        exp3.remove();
-      }
-*/      
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-//  public void test_DR_PGS_ORDERPOLICY_PARTITION_EXPECTException(){
-//    
-//  }
-//  public void test_DR_PGS_DISKSTORE_NAME_PROVIDED_VALIDATE_DISK(){
-//    
-//  }
-//  public void test_DR_PGS_DISKSTORE_NAME_NOT_PROVIDED_VALIDATE_DISK(){
-//    
-//  }
-//  
-//  public void test_DR_PGS_START_STOP_START(){
-//    
-//  }
-//
-//  public void test_DR_PGS_PERSISTENCE_START_STOP_START(){
-//    
-//  }
-//  
-//  public void test_DR_PGS_START_PAUSE_STOP(){
-//    
-//  }
-//
-//  public void test_DR_PGS_START_PAUSE_RESUME_VALIDATE_RECEIVER(){
-//    
-//  }
-
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_1Nodes_Put_Receiver_2() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> WANTestBase.createReceiver());
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-      createCacheInVMs(lnPort, vm4);
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-        true, 10, 100, false, false, null, true));
-
-      vm4.invoke(() -> WANTestBase.startSender( "ln1"));
-      
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000));
-     
-      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000));
-      
-      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000));
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_2Nodes_Put_Receiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-      vm2.invoke(() -> WANTestBase.createReceiver());
-
-      createCacheInVMs(lnPort, vm4, vm5);
-      
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-        true, 10, 100, false, false, null, true));
-      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      true, 10, 100, false, false, null, true));
-
-      startSenderInVMs("ln1", vm4, vm5);
-      
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-     
-      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      
-      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_2Nodes_EMPTY_Put_Receiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-      vm2.invoke(() -> WANTestBase.createReceiver());
-
-      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-      vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-      
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", Scope.DISTRIBUTED_ACK, DataPolicy.EMPTY, isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1", Scope.DISTRIBUTED_ACK, DataPolicy.REPLICATE, isOffHeap()  ));
-      
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-        true, 10, 100, false, false, null, true));
-      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      true, 10, 100, false, false, null, true));
-
-      startSenderInVMs("ln1", vm4, vm5);
-      
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-     
-//      vm4.invoke(() -> WANTestBase.validateRegionSize( testName + "_RR",
-//        1000 ));
-      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      
-      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PR_PGS_4Nodes_Put_Receiver_2Nodes() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2, vm3);
-      vm2.invoke(() -> WANTestBase.createReceiver());
-      vm3.invoke(() -> WANTestBase.createReceiver());
-      
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-      vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-      
-      vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
-      vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
-
-      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-      
-      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-      vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-      vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 10, 100, false, false, null, true ));
-      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 10, 100, false, false, null, true ));
-      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 10, 100, false, false, null, true ));
-      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 10, 100, false, false, null, true ));
-
-      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-      vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-      vm5.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_PR",
-        1000, 2000 ));
-      
-      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_PR",
-        1000 ));
-      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      
-      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-      
-/*      ExpectedException exp1 = addExpectedException(CacheClosedException.class
-          .getName());
-      try {*/
-        vm2.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 1000 ));
-        vm3.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 1000 ));
-        vm2.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_PR", 1000 ));
-        vm3.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_PR", 1000 ));
-/*      }
-      finally {
-        exp1.remove();
-      }
-*/    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_NOMANUALSTART_4Nodes_Put_ValidateReceiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> WANTestBase.createReceiver());
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-      
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-      vm6.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-      vm7.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-    
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-     
-      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      vm6.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      vm7.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-
-      
-      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      vm6.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      vm7.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      
-/*      ExpectedException exp1 = addExpectedException(CacheClosedException.class
-          .getName());
-      try {*/
-        vm2.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 1000 ));
-/*      }
-      finally {
-        exp1.remove();
-      }*/
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_4Nodes_Put_CLOSE4NODESCACHE_RECREATE_PUT_ValidateReceiver()
-      throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2, vm3);
-      createReceiverInVMs(vm2, vm3);
-
-      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", null, isOffHeap()  ));
-      vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-      // before doing any puts, let the senders be running in order to ensure
-      // that
-      // not a single event will be lost
-      vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-          1000 ));
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 1000 ));
-
-/*      ExpectedException exp1 = addExpectedException(CacheClosedException.class
-          .getName());
-      try {*/
-        vm4.invoke(() -> WANTestBase.killSender());
-        vm5.invoke(() -> WANTestBase.killSender());
-        vm6.invoke(() -> WANTestBase.killSender());
-        vm7.invoke(() -> WANTestBase.killSender());
-/*      }
-      finally {
-        exp1.remove();
-      }*/
-
-      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-          true, 100, 10, false, false, null, true ));
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-      vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-      vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-      // ------------------------------------------------------------------------------------
-
-      vm4.invoke(() -> WANTestBase.doNextPuts(
-          getTestMethodName() + "_RR", 1000, 2000 ));
-
-      // verify all buckets drained on all sender nodes.
-      vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-      vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-      vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-      vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-
-/*      exp1 = addExpectedException(CacheClosedException.class.getName());
-      try {*/
-        vm2.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 2000 ));
-        vm3.invoke(() -> WANTestBase.validateRegionSize(
-            getTestMethodName() + "_RR", 2000 ));
-/*      }
-      finally {
-        exp1.remove();
-      }*/
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_NO_ACK_PGS_2Nodes_Put_ValidateQueue_Receiver() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-      vm2.invoke(() -> WANTestBase.createReceiver());
-
-      createCacheInVMs(lnPort, vm4, vm5);
-      
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln1",
-              Scope.DISTRIBUTED_NO_ACK, DataPolicy.REPLICATE, isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln1",
-              Scope.DISTRIBUTED_NO_ACK, DataPolicy.REPLICATE, isOffHeap()   ));
-      
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-        true, 10, 100, false, false, null, true));
-      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      true, 10, 100, false, false, null, true));
-
-      startSenderInVMs("ln1", vm4, vm5);
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-     
-      vm4.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      vm5.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName() + "_RR",
-        1000 ));
-      
-      vm4.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      vm5.invoke(() -> WANTestBase.validateQueueContents( "ln1",
-        0 ));
-      
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    }
-    catch (Exception e) {
-      Assert.fail("Unexpected exception", e);
-    }
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_2NODES_1NODESDOWN_Validate_Receiver() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    Thread.sleep(60000);;
-    
-/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
-        .getName());
-    try {*/
-      AsyncInvocation inv1 = vm4.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts0(
-              getTestMethodName() + "_RR", 1000 ));
-      Wait.pause(1000);
-      AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.killSender());
-      try {
-        inv1.join();
-        inv2.join();
-      }
-      catch (Exception e) {
-        Assert.fail("UnExpected Exception", e);
-      }
-/*    }
-    finally {
-      exp1.remove();
-    }*/
-
-    Integer size = (Integer)vm4.invoke(() -> WANTestBase.getQueueContentSize( "ln" ));
-    LogWriterUtils.getLogWriter().info("The size of the queue is in vm4 " + size);
-    
-
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    
-    size = (Integer)vm4.invoke(() -> WANTestBase.getQueueContentSize( "ln" ));
-    LogWriterUtils.getLogWriter().info("The size of the queue is in vm4 " + size);
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGS_4NODES_2NODESDOWN_Validate_Receiver() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    Thread.sleep(60000);
-/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
-        .getName());
-    try */{
-      AsyncInvocation inv1 = vm7.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts0(
-              getTestMethodName() + "_RR", 10000 ));
-      Thread.sleep(1000);
-      AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-      Thread.sleep(2000);
-      AsyncInvocation inv3 = vm6.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts1(
-              getTestMethodName() + "_RR", 10000 ));
-      Thread.sleep(1500);
-      AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
-      try {
-        inv1.join();
-        inv2.join();
-        inv3.join();
-        inv4.join();
-      }
-      catch (Exception e) {
-        Assert.fail("UnExpected Exception", e);
-      }
-    }/*
-    finally {
-      exp1.remove();
-    }*/
-
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-    
-  }
-  
-  public static void doPuts0(String regionName, int numPuts) {
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class
-        .getName());
-    try {
-
-      Region r = cache.getRegion(Region.SEPARATOR + regionName);
-      assertNotNull(r);
-      for (long i = 0; i < numPuts; i++) {
-        LogWriterUtils.getLogWriter().info("Put : key : " + i);
-        r.put(i, "0_" + i);
-      }
-    } finally {
-      exp.remove();
-      exp1.remove();
-    }
-  }
-  
-  public static void doPuts1(String regionName, int numPuts){
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class
-        .getName());
-    try {
-
-      Region r = cache.getRegion(Region.SEPARATOR + regionName);
-      assertNotNull(r);
-      for (long i = 0; i < numPuts; i++) {
-        LogWriterUtils.getLogWriter().info("Put : key : " + i);
-        r.put(i, "1_" + i);
-      }
-    } finally {
-      exp.remove();
-      exp1.remove();
-    }
-  }
-  
-  public static void doPuts2(String regionName, int numPuts){
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class
-        .getName());
-    try {
-      Region r = cache.getRegion(Region.SEPARATOR + regionName);
-      assertNotNull(r);
-      for (long i = 0; i < numPuts; i++) {
-        LogWriterUtils.getLogWriter().info("Put : key : " + i);
-        r.put(i, "2_" + i);
-      }
-    } finally {
-      exp.remove();
-      exp1.remove();
-    }
-  }
-    
-  /**
-   * Test to validate that put on DR with no ack on multiple nodes are propagated to parallelQueue on multiple nodes
-   */
-  
-  /**
-   * Test to validate that the single put in DR is propagated to remote site through parallelGatewaySender
-   */
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java
deleted file mode 100644
index 0ee78c5..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/SenderWithTransportFilterDUnitTest.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.zip.Adler32;
-import java.util.zip.CheckedInputStream;
-import java.util.zip.CheckedOutputStream;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class SenderWithTransportFilterDUnitTest extends WANTestBase {
-
-  @Test
-  public void testSerialSenderWithTransportFilter() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> SenderWithTransportFilterDUnitTest.createReceiverWithTransportFilters( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm3.invoke(() -> SenderWithTransportFilterDUnitTest.createSenderWithTransportFilter( "ln", 2, false, 100,
-            1, false, false, true ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 100 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-  }
-
-  @Test
-  public void testParallelSenderWithTransportFilter() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> SenderWithTransportFilterDUnitTest.createReceiverWithTransportFilters( nyPort ));
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 10, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm3.invoke(() -> SenderWithTransportFilterDUnitTest.createSenderWithTransportFilter( "ln", 2, true, 100,
-            1, false, false, true ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 0, 10, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 100 ));
-  }
-  
-  public static int createReceiverWithTransportFilters(int locPort) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
-    transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
-    if (!transportFilters.isEmpty()) {
-      for (GatewayTransportFilter filter : transportFilters) {
-        fact.addGatewayTransportFilter(filter);
-      }
-    }
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port, e);
-    }
-    return port;
-  }
-
-  public static void createSenderWithTransportFilter(String dsName,
-      int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize,
-      boolean isConflation, boolean isPersistent, boolean isManualStart) {
-    File persistentDirectory = new File(dsName + "_disk_"
-        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File[] dirs1 = new File[] { persistentDirectory };
-
-    if (isParallel) {
-      GatewaySenderFactory gateway = cache
-          .createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
-      ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
-      transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
-      if (!transportFilters.isEmpty()) {
-        for (GatewayTransportFilter filter : transportFilters) {
-          gateway.addGatewayTransportFilter(filter);
-        }
-      }
-      if (isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-            .getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsId);
-
-    }
-    else {
-      GatewaySenderFactory gateway = cache
-          .createGatewaySenderFactory();
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      ((InternalGatewaySenderFactory)gateway)
-          .setLocatorDiscoveryCallback(new MyLocatorCallback());
-      ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
-      transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
-      if (!transportFilters.isEmpty()) {
-        for (GatewayTransportFilter filter : transportFilters) {
-          gateway.addGatewayTransportFilter(filter);
-        }
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      if (isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-            .getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.create(dsName, remoteDsId);
-    }
-  }
-
-  static class CheckSumTransportFilter implements GatewayTransportFilter {
-
-    Adler32 checker = new Adler32();
-    
-    private String name;
-    
-    public CheckSumTransportFilter(String name){
-      this.name = name;
-    }
-
-    @Override
-    public String toString(){
-      return this.name;
-    }
-
-    @Override
-    public InputStream getInputStream(InputStream stream) {
-      return new CheckedInputStream(stream, checker);
-    }
-
-    @Override
-    public OutputStream getOutputStream(OutputStream stream) {
-      return new CheckedOutputStream(stream, checker);
-    }
-
-    @Override
-    public void close() {
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java
deleted file mode 100644
index 6e2581e..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import static org.junit.Assert.*;
-
-import java.util.Set;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.admin.AdminDistributedSystemFactory;
-import com.gemstone.gemfire.admin.AdminException;
-import com.gemstone.gemfire.admin.DistributedSystemConfig;
-import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.cache.CacheObserverAdapter;
-import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase {
-
-  private static final long MAX_WAIT = 70000;
-
-  private static final int NUM_KEYS = 1000;
-
-  public ShutdownAllPersistentGatewaySenderDUnitTest() {
-    super();
-  }
-  
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("Cache is being closed by ShutdownAll");
-  }
-
-  private static final long serialVersionUID = 1L;
-
-  @Test
-  public void testGatewaySender() throws Exception {
-    IgnoredException.addIgnoredException("Cache is shutting down");
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 400, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    // set the CacheObserver to block the ShutdownAll
-    SerializableRunnable waitAtShutdownAll = new SerializableRunnable() {
-      @Override
-      public void run() {
-        LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
-        CacheObserverHolder.setInstance(new CacheObserverAdapter() {
-          @Override
-          public void beforeShutdownAll() {
-            final Region region = cache.getRegion(getTestMethodName() + "_PR");
-            Wait.waitForCriterion(new WaitCriterion() {
-              @Override
-              public boolean done() {
-                return region.size() >= 2;
-              }
-
-              @Override
-              public String description() {
-                return "Wait for wan to have processed several events";
-              }
-            }, 30000, 100, true);
-          }
-        });
-      }
-    };
-    vm2.invoke(waitAtShutdownAll);
-    vm3.invoke(waitAtShutdownAll);
-    
-    AsyncInvocation vm4_future = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", NUM_KEYS ));
-
-    // ShutdownAll will be suspended at observer, so puts will continue
-    AsyncInvocation future = shutDownAllMembers(vm2, 2, MAX_WAIT);
-    future.join(MAX_WAIT);
-
-    // now restart vm1 with gatewayHub
-    LogWriterUtils.getLogWriter().info("restart in VM2");
-    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
-    AsyncInvocation vm3_future = vm3.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR",
-            "ln", 1, 100, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm3_future.join(MAX_WAIT);
-
-    vm3.invoke(new SerializableRunnable() {
-      public void run() {
-        final Region region = cache.getRegion(getTestMethodName() + "_PR");
-        cache.getLogger().info(
-            "vm1's region size before restart gatewayHub is " + region.size());
-      }
-    });
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    // wait for vm0 to finish its work
-    vm4_future.join(MAX_WAIT);
-    vm4.invoke(new SerializableRunnable() {
-      public void run() {
-        Region region = cache.getRegion(getTestMethodName() + "_PR");
-        assertEquals(NUM_KEYS, region.size());
-      }
-    });
-
-    // verify the other side (vm1)'s entries received from gateway
-    vm2.invoke(new SerializableRunnable() {
-      public void run() {
-        final Region region = cache.getRegion(getTestMethodName() + "_PR");
-
-        cache.getLogger().info(
-            "vm1's region size after restart gatewayHub is " + region.size());
-        Wait.waitForCriterion(new WaitCriterion() {
-          public boolean done() {
-            Object lastValue = region.get(NUM_KEYS - 1);
-            if (lastValue != null && lastValue.equals(NUM_KEYS - 1)) {
-              region.getCache().getLogger().info(
-                  "Last key has arrived, its value is " + lastValue
-                      + ", end of wait.");
-              return true;
-            }
-            else
-              return (region.size() == NUM_KEYS);
-          }
-
-          public String description() {
-            return "Waiting for destination region to reach size: " + NUM_KEYS
-                + ", current is " + region.size();
-          }
-        }, MAX_WAIT, 100, true);
-        assertEquals(NUM_KEYS, region.size());
-      }
-    });
-
-  }
-
-  private AsyncInvocation shutDownAllMembers(VM vm, final int expectedNumber, final long timeout) {
-      AsyncInvocation future = vm.invokeAsync(new SerializableRunnable("Shutdown all the members") {
-
-      public void run() {
-        DistributedSystemConfig config;
-        AdminDistributedSystemImpl adminDS = null;
-        try {
-          config = AdminDistributedSystemFactory.defineDistributedSystem(cache
-              .getDistributedSystem(), "");
-          adminDS = (AdminDistributedSystemImpl)AdminDistributedSystemFactory
-              .getDistributedSystem(config);
-          adminDS.connect();
-          Set members = adminDS.shutDownAllMembers(timeout);
-          int num = members == null ? 0 : members.size();
-          assertEquals(expectedNumber, num);
-        }
-        catch (AdminException e) {
-          throw new RuntimeException(e);
-        }
-        finally {
-          if (adminDS != null) {
-            adminDS.disconnect();
-          }
-        }
-      }
-    });
-    return future;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANConfigurationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANConfigurationJUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANConfigurationJUnitTest.java
deleted file mode 100644
index b504f87..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANConfigurationJUnitTest.java
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.wan.*;
-import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.wan.GatewayReceiverException;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
-import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory;
-import com.gemstone.gemfire.internal.cache.wan.MyGatewaySenderEventListener;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class WANConfigurationJUnitTest {
-
-  private Cache cache;
-
-  /**
-   * Test to validate that the sender can not be started without configuring
-   * locator
-   * @throws IOException 
-   * 
-   * @throws IOException
-   */
-  @Test
-  public void test_GatewaySender_without_Locator() throws IOException {
-    try {
-      cache = new CacheFactory().set(MCAST_PORT, "0").create();
-      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-      fact.setParallel(true);
-      GatewaySender sender1 = fact.create("NYSender", 2);
-      sender1.start();
-      fail("Expected IllegalStateException but not thrown");
-    }
-    catch (Exception e) {
-      if ((e instanceof IllegalStateException && e
-          .getMessage()
-          .startsWith(
-              LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
-                  .toLocalizedString()))) {
-      }
-      else {
-        fail("Expected IllegalStateException but received :" + e);
-      }
-    }
-  }
-
-  /**
-   * Test to validate that sender with same Id can not be added to cache.
-   */
-  @Test
-  public void test_SameGatewaySenderCreatedTwice() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    try {
-      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-      fact.setParallel(true);
-      fact.setManualStart(true);
-      fact.create("NYSender", 2);
-      fact.create("NYSender", 2);
-      fail("Expected IllegalStateException but not thrown");
-    }
-    catch (Exception e) {
-      if (e instanceof IllegalStateException
-          && e.getMessage().contains("A GatewaySender with id")) {
-
-      }
-      else {
-        fail("Expected IllegalStateException but received :" + e);
-      }
-    }
-  }
-  
-  /**
-   * Test to validate that same gatewaySender Id can not be added to the region attributes.
-   */
-  @Test
-  public void test_SameGatewaySenderIdAddedTwice() {
-    try {
-      cache = new CacheFactory().set(MCAST_PORT, "0").create();
-      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-      fact.setParallel(true);
-      fact.setManualStart(true);
-      GatewaySender sender1 = fact.create("NYSender", 2);
-      AttributesFactory factory = new AttributesFactory();
-      factory.addGatewaySenderId(sender1.getId());
-      factory.addGatewaySenderId(sender1.getId());
-      fail("Expected IllegalArgumentException but not thrown");
-    }
-    catch (Exception e) {
-      if (e instanceof IllegalArgumentException
-          && e.getMessage().contains("is already added")) {
-
-      }
-      else {
-        fail("Expected IllegalStateException but received :" + e);
-      }
-    }
-  }
-  
-  @Test
-  public void test_GatewaySenderIdAndAsyncEventId() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-      AttributesFactory factory = new AttributesFactory();
-      factory.addGatewaySenderId("ln");
-      factory.addGatewaySenderId("ny");
-      factory.addAsyncEventQueueId("Async_LN");
-      RegionAttributes attrs = factory.create();
-      
-      Set<String> senderIds = new HashSet<String>();
-      senderIds.add("ln");
-      senderIds.add("ny");
-      Set<String> attrsSenderIds = attrs.getGatewaySenderIds();
-      assertEquals(senderIds, attrsSenderIds);
-      Region r = cache.createRegion("Customer", attrs);
-      assertEquals(senderIds, ((LocalRegion)r).getGatewaySenderIds());
-  }
-
-  /**
-   * Test to validate that distributed region can not have the gateway sender
-   * with parallel distribution policy
-   * 
-   */
-  @Ignore("Bug51491")
-  @Test
-  public void test_GatewaySender_Parallel_DistributedRegion() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setParallel(true);
-    fact.setManualStart(true);
-    GatewaySender sender1 = fact.create("NYSender", 2);
-    AttributesFactory factory = new AttributesFactory();
-    factory.addGatewaySenderId(sender1.getId());
-    factory.setScope(Scope.DISTRIBUTED_ACK);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    try {
-      RegionFactory regionFactory = cache.createRegionFactory(factory.create());
-      Region region = regionFactory
-          .create("test_GatewaySender_Parallel_DistributedRegion");
-    }
-    catch (Exception e) {
-      fail("Unexpected Exception :" + e);
-    }
-  }
-  
-  @Test
-  public void test_GatewaySender_Parallel_MultipleDispatcherThread() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setParallel(true);
-    fact.setManualStart(true);
-    fact.setDispatcherThreads(4);
-    try {
-      GatewaySender sender1 = fact.create("NYSender", 2);
-    }
-    catch (GatewaySenderException e) {
-       fail("UnExpected Exception " + e);
-    }
-  }
-  
-  @Test
-  public void test_GatewaySender_Serial_ZERO_DispatcherThread() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setManualStart(true);
-    fact.setDispatcherThreads(0);
-    try {
-      GatewaySender sender1 = fact.create("NYSender", 2);
-      fail("Expected GatewaySenderException but not thrown");
-    }
-    catch (GatewaySenderException e) {
-      if (e.getMessage().contains("can not be created with dispatcher threads less than 1")) {
-      }
-      else {
-        fail("Expected IllegalStateException but received :" + e);
-      }
-    }
-  }
-
-  /**
-   * Test to validate the gateway receiver attributes are correctly set
-   */
-  @Test
-  public void test_ValidateGatewayReceiverAttributes() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    int[] randomAvailableTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-    int port1 = randomAvailableTCPPorts[0];
-    int port2 = randomAvailableTCPPorts[1];
-    
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    if(port1 < port2){
-      fact.setStartPort(port1);
-      fact.setEndPort(port2);  
-    }else{
-      fact.setStartPort(port2);
-      fact.setEndPort(port1);
-    }
-    
-    fact.setMaximumTimeBetweenPings(2000);
-    fact.setSocketBufferSize(200);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayReceiver receiver1 = fact.create();
-    
-
-    Region region = cache.createRegionFactory().create(
-        "test_ValidateGatewayReceiverAttributes");
-    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-    GatewayReceiver rec = receivers.iterator().next();
-    assertEquals(receiver1.getHost(), rec.getHost());
-    assertEquals(receiver1.getStartPort(), rec.getStartPort());
-    assertEquals(receiver1.getEndPort(), rec.getEndPort());
-    assertEquals(receiver1.getBindAddress(), rec.getBindAddress());
-    assertEquals(receiver1.getMaximumTimeBetweenPings(), rec
-        .getMaximumTimeBetweenPings());
-    assertEquals(receiver1.getSocketBufferSize(), rec
-        .getSocketBufferSize());
-    assertEquals(receiver1.getGatewayTransportFilters().size(), rec
-        .getGatewayTransportFilters().size());
-
-  }
-
-  @Test
-  public void test_ValidateGatewayReceiverStatus() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    int[] randomAvailableTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-    int port1 = randomAvailableTCPPorts[0];
-    int port2 = randomAvailableTCPPorts[1];
-    
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    if(port1 < port2){
-      fact.setStartPort(port1);
-      fact.setEndPort(port2);  
-    }else{
-      fact.setStartPort(port2);
-      fact.setEndPort(port1);
-    }
-    
-    fact.setMaximumTimeBetweenPings(2000);
-    fact.setSocketBufferSize(200);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayReceiver receiver1 = fact.create();
-    assertTrue(receiver1.isRunning());
-  }
-  
-  /**
-   * Test to validate that serial gateway sender attributes are correctly set
-   */
-  @Test
-  public void test_ValidateSerialGatewaySenderAttributes() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setManualStart(true);
-    fact.setBatchConflationEnabled(true);
-    fact.setBatchSize(200);
-    fact.setBatchTimeInterval(300);
-    fact.setPersistenceEnabled(false);
-    fact.setDiskStoreName("FORNY");
-    fact.setMaximumQueueMemory(200);
-    fact.setAlertThreshold(1200);
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    fact.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    GatewaySender sender1 = fact.create("TKSender", 2);
-    
-
-    AttributesFactory factory = new AttributesFactory();
-    factory.addGatewaySenderId(sender1.getId());
-    factory.setDataPolicy(DataPolicy.PARTITION);
-    Region region = cache.createRegionFactory(factory.create()).create(
-        "test_ValidateGatewaySenderAttributes");
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    assertEquals(senders.size(), 1);
-    GatewaySender gatewaySender = senders.iterator().next();
-    assertEquals(sender1.getRemoteDSId(), gatewaySender
-        .getRemoteDSId());
-    assertEquals(sender1.isManualStart(), gatewaySender.isManualStart());
-    assertEquals(sender1.isBatchConflationEnabled(), gatewaySender
-        .isBatchConflationEnabled());
-    assertEquals(sender1.getBatchSize(), gatewaySender.getBatchSize());
-    assertEquals(sender1.getBatchTimeInterval(), gatewaySender
-        .getBatchTimeInterval());
-    assertEquals(sender1.isPersistenceEnabled(), gatewaySender
-        .isPersistenceEnabled());
-    assertEquals(sender1.getDiskStoreName(), gatewaySender.getDiskStoreName());
-    assertEquals(sender1.getMaximumQueueMemory(), gatewaySender
-        .getMaximumQueueMemory());
-    assertEquals(sender1.getAlertThreshold(), gatewaySender
-        .getAlertThreshold());
-    assertEquals(sender1.getGatewayEventFilters().size(), gatewaySender
-        .getGatewayEventFilters().size());
-    assertEquals(sender1.getGatewayTransportFilters().size(), gatewaySender
-        .getGatewayTransportFilters().size());
-
-  }
-  
-  /**
-   * Test to validate that parallel gateway sender attributes are correctly set
-   */
-  @Test
-  public void test_ValidateParallelGatewaySenderAttributes() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setParallel(true);
-    fact.setManualStart(true);
-    fact.setBatchConflationEnabled(true);
-    fact.setBatchSize(200);
-    fact.setBatchTimeInterval(300);
-    fact.setPersistenceEnabled(false);
-    fact.setDiskStoreName("FORNY");
-    fact.setMaximumQueueMemory(200);
-    fact.setAlertThreshold(1200);
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    fact.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    GatewaySender sender1 = fact.create("TKSender", 2);
-    
-
-    AttributesFactory factory = new AttributesFactory();
-    factory.addGatewaySenderId(sender1.getId());
-    factory.setDataPolicy(DataPolicy.PARTITION);
-    Region region = cache.createRegionFactory(factory.create()).create(
-        "test_ValidateGatewaySenderAttributes");
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    assertEquals(1, senders.size());
-    GatewaySender gatewaySender = senders.iterator().next();
-    assertEquals(sender1.getRemoteDSId(), gatewaySender
-        .getRemoteDSId());
-    assertEquals(sender1.isManualStart(), gatewaySender.isManualStart());
-    assertEquals(sender1.isBatchConflationEnabled(), gatewaySender
-        .isBatchConflationEnabled());
-    assertEquals(sender1.getBatchSize(), gatewaySender.getBatchSize());
-    assertEquals(sender1.getBatchTimeInterval(), gatewaySender
-        .getBatchTimeInterval());
-    assertEquals(sender1.isPersistenceEnabled(), gatewaySender
-        .isPersistenceEnabled());
-    assertEquals(sender1.getDiskStoreName(), gatewaySender.getDiskStoreName());
-    assertEquals(sender1.getMaximumQueueMemory(), gatewaySender
-        .getMaximumQueueMemory());
-    assertEquals(sender1.getAlertThreshold(), gatewaySender
-        .getAlertThreshold());
-    assertEquals(sender1.getGatewayEventFilters().size(), gatewaySender
-        .getGatewayEventFilters().size());
-    assertEquals(sender1.getGatewayTransportFilters().size(), gatewaySender
-        .getGatewayTransportFilters().size());
-
-  }
-  
-  @Test
-  public void test_GatewaySenderWithGatewaySenderEventListener1() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    InternalGatewaySenderFactory fact = (InternalGatewaySenderFactory)cache.createGatewaySenderFactory();
-    AsyncEventListener listener = new MyGatewaySenderEventListener();
-    ((InternalGatewaySenderFactory)fact).addAsyncEventListener(listener);
-    try {
-      fact.create("ln", 2);
-      fail("Expected GatewaySenderException. When a sender is added , remoteDSId should not be provided.");
-    } catch (Exception e) {
-      if (e instanceof GatewaySenderException
-          && e.getMessage()
-              .contains(
-                  "cannot define a remote site because at least AsyncEventListener is already added.")) {
-
-      } else {
-        fail("Expected GatewaySenderException but received :" + e);
-      }
-    }
-  }  
-  
-  @Test
-  public void test_GatewaySenderWithGatewaySenderEventListener2() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    AsyncEventListener listener = new MyGatewaySenderEventListener();
-    ((InternalGatewaySenderFactory)fact).addAsyncEventListener(listener);
-    try {
-      ((InternalGatewaySenderFactory)fact).create("ln");
-    } catch (Exception e) {
-      fail("Received Exception :" + e);
-    }
-  }
-  
-  @Test
-  public void test_ValidateGatewayReceiverAttributes_2() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setStartPort(50504);
-    fact.setMaximumTimeBetweenPings(1000);
-    fact.setSocketBufferSize(4000);
-    fact.setEndPort(70707);
-    fact.setManualStart(true);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      fail("The test failed with IOException");
-    }
-
-    assertEquals(50504, receiver.getStartPort());
-    assertEquals(1000, receiver.getMaximumTimeBetweenPings());
-    assertEquals(4000,receiver.getSocketBufferSize());
-    assertEquals(70707, receiver.getEndPort());
-  }
-
-  /**
-   * This test takes a minimum of 120s to execute. It is known to hang on Mac OS
-   * X Yosemite do to changes in the the message string checked in
-   * GatewayReceiverImpl around line 167. Expects
-   * "Cannot assign requested address" but gets
-   * "Can't assign requested address". Timeout after 150s to safeguard against
-   * hanging on other platforms that may differ.
-   */
-  @Test(timeout = 150000)
-  public void test_ValidateGatewayReceiverAttributes_WrongBindAddress() {
-    if (System.getProperty("os.name").equals("Mac OS X")) {
-     fail("Failing to avoid known hang on Mac OS X.");
-    }
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setStartPort(50504);
-    fact.setMaximumTimeBetweenPings(1000);
-    fact.setSocketBufferSize(4000);
-    fact.setEndPort(70707);
-    fact.setManualStart(true);
-    fact.setBindAddress("200.112.204.10");
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-      fail("Expected GatewayReceiverException");
-    }
-    catch (GatewayReceiverException gRE){
-      assertTrue(gRE.getMessage().contains("Failed to create server socket on"));
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-      fail("The test failed with IOException");
-    }
-  }
-  
-  @Test
-  public void test_ValidateGatewayReceiverDefaultStartPortAndDefaultEndPort() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setMaximumTimeBetweenPings(1000);
-    fact.setSocketBufferSize(4000);
-    fact.setManualStart(true);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      fail("The test failed with IOException");
-    }
-    int port = receiver.getPort();
-    if((port < 5000) || (port > 5500)) {
-      fail("GatewayReceiver started on out of range port");
-    }
-  }
-  
-  @Test
-  public void test_ValidateGatewayReceiverDefaultStartPortAndEndPortProvided() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setMaximumTimeBetweenPings(1000);
-    fact.setSocketBufferSize(4000);
-    fact.setEndPort(50707);
-    fact.setManualStart(true);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      fail("The test failed with IOException");
-    }
-    int port = receiver.getPort();
-    if((port < GatewayReceiver.DEFAULT_START_PORT) || (port > 50707)) {
-      fail("GatewayReceiver started on out of range port");
-    }
-  }
-  
-  @Test
-  public void test_ValidateGatewayReceiverWithManualStartFALSE() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setMaximumTimeBetweenPings(1000);
-    fact.setSocketBufferSize(4000);
-    fact.setStartPort(5303);
-    fact.setManualStart(false);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayReceiver receiver = fact.create();
-    int port = receiver.getPort();
-    if ((port < 5303) || (port > GatewayReceiver.DEFAULT_END_PORT)) {
-      fail("GatewayReceiver started on out of range port");
-    }
-  }
-  
-  @Test
-  public void test_ValidateGatewayReceiverWithStartPortAndDefaultEndPort() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setMaximumTimeBetweenPings(1000);
-    fact.setSocketBufferSize(4000);
-    fact.setStartPort(5303);
-    fact.setManualStart(true);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      fail("The test failed with IOException");
-    }
-    int port = receiver.getPort();
-    if ((port < 5303) || (port > GatewayReceiver.DEFAULT_END_PORT)) {
-      fail("GatewayReceiver started on out of range port");
-    }
-  }
-  
-  @Test
-  public void test_ValidateGatewayReceiverWithWrongEndPortProvided() {
-    cache = new CacheFactory().set(MCAST_PORT, "0").create();
-    try {
-      GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-      fact.setMaximumTimeBetweenPings(1000);
-      fact.setSocketBufferSize(4000);
-      fact.setEndPort(4999);
-      GatewayReceiver receiver = fact.create();  
-      fail("wrong end port set in the GatewayReceiver");
-    } catch (IllegalStateException expected) {
-      if(!expected.getMessage().contains("Please specify either start port a value which is less than end port.")){
-        fail("Caught IllegalStateException");
-        expected.printStackTrace();
-      }
-    }
-  }
-  
-  @After
-  public void tearDown() throws Exception {
-    if (this.cache != null) {
-      this.cache.close();
-    }
-  }
-}



[57/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java
new file mode 100644
index 0000000..815932e
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java
@@ -0,0 +1,122 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.internal.Connection;
+import com.gemstone.gemfire.cache.client.internal.pooling.ConnectionDestroyedException;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderConfigurationException;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventCallbackDispatcher;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventDispatcher;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderStats;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+public class RemoteParallelGatewaySenderEventProcessor extends ParallelGatewaySenderEventProcessor {
+  private static final Logger logger = LogService.getLogger();
+  
+  protected RemoteParallelGatewaySenderEventProcessor(
+      AbstractGatewaySender sender) {
+    super(sender);
+  }
+  
+  /**
+   * use in concurrent scenario where queue is to be shared among all the processors.
+   */
+  protected RemoteParallelGatewaySenderEventProcessor(AbstractGatewaySender sender,  Set<Region> userRegions, int id, int nDispatcher) {
+    super(sender,  userRegions, id, nDispatcher);
+  }
+  
+  @Override
+  protected void rebalance() {
+    GatewaySenderStats statistics = this.sender.getStatistics();
+    long startTime = statistics.startLoadBalance();
+    try {
+      if (this.dispatcher.isRemoteDispatcher()) {
+        GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) this.dispatcher;
+        if (remoteDispatcher.isConnectedToRemote()) {
+          remoteDispatcher.stopAckReaderThread();
+          remoteDispatcher.destroyConnection();
+        }
+      }
+    } finally {
+      statistics.endLoadBalance(startTime);
+    }
+  }
+  
+  public void initializeEventDispatcher() {
+    if (logger.isDebugEnabled()) {
+      logger.debug(" Creating the GatewayEventRemoteDispatcher");
+    }
+    if (this.sender.getRemoteDSId() != GatewaySender.DEFAULT_DISTRIBUTED_SYSTEM_ID) {
+      this.dispatcher = new GatewaySenderEventRemoteDispatcher(this);
+    }
+  }
+  
+  /**
+   * Returns if corresponding receiver WAN site of this GatewaySender has
+   * GemfireVersion > 7.0.1
+   * 
+   * @param disp
+   * @return true if remote site Gemfire Version is >= 7.0.1
+   */
+  private boolean shouldSendVersionEvents(GatewaySenderEventDispatcher disp)
+      throws GatewaySenderException {
+      try {
+        GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) disp;
+        // This will create a new connection if no batch has been sent till
+        // now.
+        Connection conn = remoteDispatcher.getConnection(false);
+        if (conn != null) {
+          short remoteSiteVersion = conn.getWanSiteVersion();
+          if (Version.GFE_701.compareTo(remoteSiteVersion) <= 0) {
+            return true;
+          }
+        }
+      } catch (GatewaySenderException e) {
+        Throwable cause = e.getCause();
+        if (cause instanceof IOException
+            || e instanceof GatewaySenderConfigurationException
+            || cause instanceof ConnectionDestroyedException) {
+          try {
+            int sleepInterval = GatewaySender.CONNECTION_RETRY_INTERVAL;
+            if (logger.isDebugEnabled()) {
+              logger.debug("Sleeping for {} milliseconds", sleepInterval);
+            }
+            Thread.sleep(sleepInterval);
+          } catch (InterruptedException ie) {
+            // log the exception
+            if (logger.isDebugEnabled()){
+              logger.debug(ie.getMessage(), ie);
+            }
+          }
+        }
+        throw e;
+      }
+    return false;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java
new file mode 100644
index 0000000..8a25ab6
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java
@@ -0,0 +1,45 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+public class RemoteConcurrentSerialGatewaySenderEventProcessor extends
+    ConcurrentSerialGatewaySenderEventProcessor {
+
+  private static final Logger logger = LogService.getLogger();
+  
+  public RemoteConcurrentSerialGatewaySenderEventProcessor(
+      AbstractGatewaySender sender) {
+    super(sender);
+  }
+
+  @Override
+  protected void initializeMessageQueue(String id) {
+    for (int i = 0; i < sender.getDispatcherThreads(); i++) {
+      processors.add(new RemoteSerialGatewaySenderEventProcessor(this.sender, id
+          + "." + i));
+      if (logger.isDebugEnabled()) {
+        logger.debug("Created the RemoteSerialGatewayEventProcessor_{}->{}", i, processors.get(i));
+      }
+    }
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java
new file mode 100644
index 0000000..82fa585
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventCallbackDispatcher;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+public class RemoteSerialGatewaySenderEventProcessor extends
+    SerialGatewaySenderEventProcessor {
+
+  private static final Logger logger = LogService.getLogger();
+  public RemoteSerialGatewaySenderEventProcessor(AbstractGatewaySender sender,
+      String id) {
+    super(sender, id);
+  }
+
+  public void initializeEventDispatcher() {
+    if (logger.isDebugEnabled()) {
+      logger.debug(" Creating the GatewayEventRemoteDispatcher");
+    }
+    // In case of serial there is a way to create gatewaySender and attach
+    // asyncEventListener. Not sure of the use-case but there are dunit tests
+    // To make them pass uncommenting the below condition
+    if (this.sender.getRemoteDSId() != GatewaySender.DEFAULT_DISTRIBUTED_SYSTEM_ID) {
+      this.dispatcher = new GatewaySenderEventRemoteDispatcher(this);
+    }else{
+      this.dispatcher = new GatewaySenderEventCallbackDispatcher(this);
+    }
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
new file mode 100644
index 0000000..85e1bc0
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
@@ -0,0 +1,256 @@
+/*
+ * 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.internal.cache.wan.serial;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.distributed.DistributedLockService;
+import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.ResourceEvent;
+import com.gemstone.gemfire.internal.cache.EntryEventImpl;
+import com.gemstone.gemfire.internal.cache.EventID;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
+import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySenderEventProcessor;
+import com.gemstone.gemfire.internal.cache.wan.AbstractRemoteGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderConfigurationException;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+
+/**
+ * @since GemFire 7.0
+ *
+ */
+public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
+
+  private static final Logger logger = LogService.getLogger();
+  
+  final ThreadGroup loggerGroup = LoggingThreadGroup.createThreadGroup(
+      "Remote Site Discovery Logger Group", logger);
+
+  public SerialGatewaySenderImpl(){
+    super();
+    this.isParallel = false;
+  }
+  public SerialGatewaySenderImpl(Cache cache,
+      GatewaySenderAttributes attrs) {
+    super(cache, attrs);
+  }
+  
+  @Override
+  public void start() {
+    if (logger.isDebugEnabled()) {
+      logger.debug("Starting gatewaySender : {}", this);
+    }
+    
+    this.getLifeCycleLock().writeLock().lock();
+    try {
+      if (isRunning()) {
+        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_SENDER_0_IS_ALREADY_RUNNING, this.getId()));
+        return;
+      }
+      if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
+        String locators = ((GemFireCacheImpl)this.cache).getDistributedSystem()
+            .getConfig().getLocators();
+        if (locators.length() == 0) {
+          throw new GatewaySenderConfigurationException(
+              LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
+                  .toLocalizedString());
+        }
+      }
+      getSenderAdvisor().initDLockService();
+      if (!isPrimary()) {
+        if (getSenderAdvisor().volunteerForPrimary()) {
+          getSenderAdvisor().makePrimary();
+        } else {
+          getSenderAdvisor().makeSecondary();
+        }
+      }
+      if (getDispatcherThreads() > 1) {
+        eventProcessor = new RemoteConcurrentSerialGatewaySenderEventProcessor(
+            SerialGatewaySenderImpl.this);
+      } else {
+        eventProcessor = new RemoteSerialGatewaySenderEventProcessor(
+            SerialGatewaySenderImpl.this, getId());
+      }
+      eventProcessor.start();
+      waitForRunningStatus();
+      this.startTime = System.currentTimeMillis();
+      
+      //Only notify the type registry if this is a WAN gateway queue
+      if(!isAsyncEventQueue()) {
+        ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
+      }
+      new UpdateAttributesProcessor(this).distribute(false);
+
+      
+      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
+          .getDistributedSystem();
+      system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
+      
+      logger.info(LocalizedMessage.create(LocalizedStrings.SerialGatewaySenderImpl_STARTED__0, this));
+  
+      enqueueTempEvents();
+    } finally {
+      this.getLifeCycleLock().writeLock().unlock();
+    }
+  }
+  
+  @Override
+  public void stop() {
+    if (logger.isDebugEnabled()) {
+      logger.debug("Stopping Gateway Sender : {}", this);
+    }
+    this.getLifeCycleLock().writeLock().lock();
+    try {
+      // Stop the dispatcher
+      AbstractGatewaySenderEventProcessor ev = this.eventProcessor;
+      if (ev != null && !ev.isStopped()) {
+        ev.stopProcessing();
+      }
+      
+      // Stop the proxy (after the dispatcher, so the socket is still
+      // alive until after the dispatcher has stopped)
+      stompProxyDead();
+
+      // Close the listeners
+      for (AsyncEventListener listener : this.listeners) {
+        listener.close();
+      }
+      logger.info(LocalizedMessage.create(LocalizedStrings.GatewayImpl_STOPPED__0, this));
+
+      clearTempEventsAfterSenderStopped();
+    } finally {
+      this.getLifeCycleLock().writeLock().unlock();
+    }
+   
+    if (this.isPrimary()) {
+      try {
+        DistributedLockService
+            .destroy(getSenderAdvisor().getDLockServiceName());
+      } catch (IllegalArgumentException e) {
+        // service not found... ignore
+      }
+    }
+    Set<RegionQueue> queues = getQueues();
+    if (queues != null && !queues.isEmpty()) {
+      for (RegionQueue q : queues) {
+        ((SerialGatewaySenderQueue)q).cleanUp();
+      }
+    }
+   
+    this.setIsPrimary(false);
+    new UpdateAttributesProcessor(this).distribute(false);
+    Thread lockObtainingThread = getSenderAdvisor().getLockObtainingThread();
+    if (lockObtainingThread != null && lockObtainingThread.isAlive()) {
+      // wait a while for thread to terminate
+      try {
+        lockObtainingThread.join(3000);
+      } catch (InterruptedException ex) {
+        // we allowed our join to be canceled
+        // reset interrupt bit so this thread knows it has been interrupted
+        Thread.currentThread().interrupt();
+      }
+      if (lockObtainingThread.isAlive()) {
+        logger.info(LocalizedMessage.create(LocalizedStrings.GatewaySender_COULD_NOT_STOP_LOCK_OBTAINING_THREAD_DURING_GATEWAY_SENDER_STOP));
+      }
+    }
+    
+    InternalDistributedSystem system = (InternalDistributedSystem) this.cache
+        .getDistributedSystem();
+    system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_STOP, this);
+    
+    this.eventProcessor = null;
+  }
+  
+  @Override
+  public String toString() {
+    StringBuffer sb = new StringBuffer();
+    sb.append("SerialGatewaySender{");
+    sb.append("id=" + getId());
+    sb.append(",remoteDsId="+ getRemoteDSId());
+    sb.append(",isRunning ="+ isRunning());
+    sb.append(",isPrimary ="+ isPrimary());
+    sb.append("}");
+    return sb.toString();
+  }
+ 
+  @Override
+  public void fillInProfile(Profile profile) {
+    assert profile instanceof GatewaySenderProfile;
+    GatewaySenderProfile pf = (GatewaySenderProfile)profile;
+    pf.Id = getId();
+    pf.startTime = getStartTime();
+    pf.remoteDSId = getRemoteDSId();
+    pf.isRunning = isRunning();
+    pf.isPrimary = isPrimary();
+    pf.isParallel = false;
+    pf.isBatchConflationEnabled = isBatchConflationEnabled();
+    pf.isPersistenceEnabled = isPersistenceEnabled();
+    pf.alertThreshold = getAlertThreshold();
+    pf.manualStart = isManualStart();
+    for (com.gemstone.gemfire.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
+      pf.eventFiltersClassNames.add(filter.getClass().getName());
+    }
+    for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
+      pf.transFiltersClassNames.add(filter.getClass().getName());
+    }
+    for (AsyncEventListener listener : getAsyncEventListeners()) {
+      pf.senderEventListenerClassNames.add(listener.getClass().getName());
+    }
+    pf.isDiskSynchronous = isDiskSynchronous();
+    pf.dispatcherThreads = getDispatcherThreads();
+    pf.orderPolicy = getOrderPolicy();
+    pf.serverLocation = this.getServerLocation(); 
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(com.gemstone.gemfire.internal.cache.EntryEventImpl)
+   */
+  @Override
+  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
+    EventID originalEventId = clonedEvent.getEventId();
+    long originalThreadId = originalEventId.getThreadID();
+    long newThreadId = originalThreadId;
+    if (ThreadIdentifier.isWanTypeThreadID(newThreadId)) {
+      // This thread id has already been converted. Do nothing.
+    } else {
+      newThreadId = ThreadIdentifier
+        .createFakeThreadIDForParallelGSPrimaryBucket(0, originalThreadId,
+            getEventIdIndex());
+    }
+    EventID newEventId = new EventID(originalEventId.getMembershipID(),
+        newThreadId, originalEventId.getSequenceID());
+    if (logger.isDebugEnabled()) {
+      logger.debug("{}: Generated event id for event with key={}, original event id={}, originalThreadId={}, new event id={}, newThreadId={}",
+          this, clonedEvent.getKey(), originalEventId, originalThreadId, newEventId, newThreadId);
+    }
+    clonedEvent.setEventId(newEventId);
+  }
+
+}


[20/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/UpdateVersionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/UpdateVersionDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/UpdateVersionDUnitTest.java
new file mode 100644
index 0000000..a1aec80
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/UpdateVersionDUnitTest.java
@@ -0,0 +1,962 @@
+/*
+ * 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.internal.cache;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.EntryNotFoundException;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Region.Entry;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.internal.LocatorDiscoveryCallbackAdapter;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.LocalRegion.NonTXEntry;
+import com.gemstone.gemfire.internal.cache.partitioned.PRLocallyDestroyedException;
+import com.gemstone.gemfire.internal.cache.versions.VersionSource;
+import com.gemstone.gemfire.internal.cache.versions.VersionStamp;
+import com.gemstone.gemfire.internal.cache.versions.VersionTag;
+import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+/**
+ * @since GemFire 7.0.1
+ */
+@Category(DistributedTest.class)
+public class UpdateVersionDUnitTest extends JUnit4DistributedTestCase {
+
+  protected static final String regionName = "testRegion";
+  protected static Cache cache;
+  private static Set<IgnoredException>expectedExceptions = new HashSet<IgnoredException>();
+
+  @Override
+  public final void preTearDown() throws Exception {
+    closeCache();
+    Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() {
+      closeCache();
+     } });
+  }
+  
+  @Test
+  public void testUpdateVersionAfterCreateWithSerialSender() {
+    Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0); // server1 site1
+    VM vm1 = host.getVM(1); // server2 site1
+
+    VM vm2 = host.getVM(2); // server1 site2
+    VM vm3 = host.getVM(3); // server2 site2
+
+    final String key = "key-1";
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
+
+    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort));
+    vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, false, 10, 1, false, false, null, true ));
+    
+    vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1));
+    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
+    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
+
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
+    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
+
+    vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
+    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort));
+    vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));    
+    
+    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Update a single entry and get its version") {
+      
+      @Override
+      public Object call() throws CacheException {
+        Cache cache = CacheFactory.getAnyInstance();
+        Region region = cache.getRegion(regionName);
+        assertTrue(region instanceof PartitionedRegion);
+
+        region.put(key, "value-1");
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        // Create a duplicate entry version tag from stamp with newer
+        // time-stamp.
+        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
+        VersionTag tag = VersionTag.create(memberId);
+
+        int entryVersion = stamp.getEntryVersion()-1;
+        int dsid = stamp.getDistributedSystemId();
+        long time = System.currentTimeMillis();
+
+        tag.setEntryVersion(entryVersion);
+        tag.setDistributedSystemId(dsid);
+        tag.setVersionTimeStamp(time);
+        tag.setIsRemoteForTesting();
+
+        EntryEventImpl event = createNewEvent((PartitionedRegion) region, tag,
+            entry.getKey(), "value-2");
+
+        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
+
+        // Verify the new stamp
+        entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        stamp = regionEntry.getVersionStamp();
+        assertEquals(
+            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
+            time, stamp.getVersionTimeStamp());
+        assertEquals(++entryVersion, stamp.getEntryVersion());
+        assertEquals(dsid, stamp.getDistributedSystemId());
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
+      
+      @Override
+      public Object call() throws Exception {
+        
+        Cache cache = CacheFactory.getAnyInstance();
+        final PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
+
+        // wait for entry to be received
+        WaitCriterion wc = new WaitCriterion() {
+          public boolean done() {
+            Entry<?,?> entry = null;
+            try {
+              entry = region.getDataStore().getEntryLocally(0, key, false, false);
+            } catch (EntryNotFoundException e) {
+              // expected
+            } catch (ForceReattemptException e) {
+              // expected
+            } catch (PRLocallyDestroyedException e) {
+              throw new RuntimeException("unexpected exception", e);
+            }
+            if (entry != null) {
+              LogWriterUtils.getLogWriter().info("found entry " + entry);
+            }
+            return (entry != null);
+          }
+
+          public String description() {
+            return "Expected "+key+" to be received on remote WAN site";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        wc = new WaitCriterion() {
+          public boolean done() {
+            Entry entry = region.getEntry(key);
+            assertTrue(entry instanceof EntrySnapshot);
+            RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
+          }
+          public String description() {
+            return "waiting for timestamp to be updated";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        Entry entry = region.getEntry(key);
+        assertTrue("entry class is wrong: " + entry, entry instanceof EntrySnapshot);
+        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
+  }
+
+  @Test
+  public void testUpdateVersionAfterCreateWithSerialSenderOnDR() {
+    Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0); // server1 site1
+    VM vm1 = host.getVM(1); // server2 site1
+
+    VM vm2 = host.getVM(2); // server1 site2
+    VM vm3 = host.getVM(3); // server2 site2
+
+    final String key = "key-1";
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
+
+    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort));
+    vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, false, 10, 1, false, false, null, true ));
+    
+    vm0.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, "ln1"));
+    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
+    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
+
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
+    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
+
+    vm2.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, ""));
+    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort ));
+    vm3.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, ""));    
+    
+    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Update a single entry and get its version") {
+      
+      @Override
+      public Object call() throws CacheException {
+        Cache cache = CacheFactory.getAnyInstance();
+        Region region = cache.getRegion(regionName);
+        assertTrue(region instanceof DistributedRegion);
+
+        region.put(key, "value-1");
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof NonTXEntry);
+        RegionEntry regionEntry = ((NonTXEntry) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        // Create a duplicate entry version tag from stamp with newer
+        // time-stamp.
+        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
+        VersionTag tag = VersionTag.create(memberId);
+
+        int entryVersion = stamp.getEntryVersion()-1;
+        int dsid = stamp.getDistributedSystemId();
+        long time = System.currentTimeMillis();
+
+        tag.setEntryVersion(entryVersion);
+        tag.setDistributedSystemId(dsid);
+        tag.setVersionTimeStamp(time);
+        tag.setIsRemoteForTesting();
+
+        EntryEventImpl event = createNewEvent((DistributedRegion) region, tag,
+            entry.getKey(), "value-2");
+
+        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
+
+        // Verify the new stamp
+        entry = region.getEntry(key);
+        assertTrue(entry instanceof NonTXEntry);
+        regionEntry = ((NonTXEntry) entry).getRegionEntry();
+
+        stamp = regionEntry.getVersionStamp();
+        assertEquals(
+            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
+            time, stamp.getVersionTimeStamp());
+        assertEquals(entryVersion+1, stamp.getEntryVersion());
+        assertEquals(dsid, stamp.getDistributedSystemId());
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
+      
+      @Override
+      public Object call() throws Exception {
+        
+        Cache cache = CacheFactory.getAnyInstance();
+        final Region region = cache.getRegion(regionName);
+
+        // wait for entry to be received
+        WaitCriterion wc = new WaitCriterion() {
+          public boolean done() {
+            return (region.getEntry(key) != null);
+          }
+
+          public String description() {
+            return "Expected key-1 to be received on remote WAN site";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        wc = new WaitCriterion() {
+          public boolean done() {
+            Entry entry = region.getEntry(key);
+            assertTrue(entry instanceof NonTXEntry);
+            RegionEntry regionEntry = ((NonTXEntry) entry).getRegionEntry();
+            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
+          }
+          public String description() {
+            return "waiting for timestamp to be updated";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof NonTXEntry);
+        RegionEntry regionEntry = ((NonTXEntry) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
+  }
+
+  @Test
+  public void testUpdateVersionAfterCreateWithParallelSender() {
+    Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0); // server1 site1
+    VM vm1 = host.getVM(1); // server2 site1
+
+    VM vm2 = host.getVM(2); // server1 site2
+    VM vm3 = host.getVM(3); // server2 site2
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
+
+    final String key = "key-1";
+
+    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort));
+    vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, true, 10, 1, false, false, null, true ));
+    
+    vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1));
+    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
+    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
+    
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
+    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
+
+    vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
+
+    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort));
+    vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
+    
+    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Put a single entry and get its version") {
+      
+      @Override
+      public Object call() throws CacheException {
+        Cache cache = CacheFactory.getAnyInstance();
+        Region region = cache.getRegion(regionName);
+        assertTrue(region instanceof PartitionedRegion);
+
+        region.put(key, "value-1");
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        // Create a duplicate entry version tag from stamp with newer
+        // time-stamp.
+        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
+        VersionTag tag = VersionTag.create(memberId);
+
+        int entryVersion = stamp.getEntryVersion()-1;
+        int dsid = stamp.getDistributedSystemId();
+        long time = System.currentTimeMillis();
+
+        tag.setEntryVersion(entryVersion);
+        tag.setDistributedSystemId(dsid);
+        tag.setVersionTimeStamp(time);
+        tag.setIsRemoteForTesting();
+
+        EntryEventImpl event = createNewEvent((PartitionedRegion) region, tag,
+            entry.getKey(), "value-2");
+
+        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
+
+        // Verify the new stamp
+        entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        stamp = regionEntry.getVersionStamp();
+        assertEquals(
+            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
+            time, stamp.getVersionTimeStamp());
+        assertEquals(++entryVersion, stamp.getEntryVersion());
+        assertEquals(dsid, stamp.getDistributedSystemId());
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
+      
+      @Override
+      public Object call() throws Exception {
+        
+        Cache cache = CacheFactory.getAnyInstance();
+        final PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
+
+        // wait for entry to be received
+        WaitCriterion wc = new WaitCriterion() {
+          public boolean done() {
+            Entry<?,?> entry = null;
+            try {
+              entry = region.getDataStore().getEntryLocally(0, key, false, false);
+            } catch (EntryNotFoundException e) {
+              // expected
+            } catch (ForceReattemptException e) {
+              // expected
+            } catch (PRLocallyDestroyedException e) {
+              throw new RuntimeException("unexpected exception", e);
+            }
+            if (entry != null) {
+              LogWriterUtils.getLogWriter().info("found entry " + entry);
+            }
+            return (entry != null);
+          }
+
+          public String description() {
+            return "Expected key-1 to be received on remote WAN site";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        wc = new WaitCriterion() {
+          public boolean done() {
+            Entry entry = region.getEntry(key);
+            assertTrue(entry instanceof EntrySnapshot);
+            RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
+          }
+          public String description() {
+            return "waiting for timestamp to be updated";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
+  }
+
+  @Test
+  public void testUpdateVersionAfterCreateWithConcurrentSerialSender() {
+    Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0); // server1 site1
+    VM vm1 = host.getVM(1); // server2 site1
+
+    VM vm2 = host.getVM(2); // server1 site2
+    VM vm3 = host.getVM(3); // server2 site2
+
+    // Site 1
+    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
+
+    final String key = "key-1";
+
+    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort ));
+    vm0.invoke(() -> UpdateVersionDUnitTest.createConcurrentSender( "ln1", 2, false, 10, 2, false, false, null, true, 2 ));
+    
+    vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1));
+    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
+    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
+    
+    //Site 2
+    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
+    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
+
+    vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
+
+    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort ));
+    vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));    
+    
+    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Put a single entry and get its version") {
+      
+      @Override
+      public Object call() throws CacheException {
+        Cache cache = CacheFactory.getAnyInstance();
+        Region region = cache.getRegion(regionName);
+        assertTrue(region instanceof PartitionedRegion);
+
+        region.put(key, "value-1");
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        // Create a duplicate entry version tag from stamp with newer
+        // time-stamp.
+        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
+        VersionTag tag = VersionTag.create(memberId);
+
+        int entryVersion = stamp.getEntryVersion()-1;
+        int dsid = stamp.getDistributedSystemId();
+        long time = System.currentTimeMillis();
+
+        tag.setEntryVersion(entryVersion);
+        tag.setDistributedSystemId(dsid);
+        tag.setVersionTimeStamp(time);
+        tag.setIsRemoteForTesting();
+
+        EntryEventImpl event = createNewEvent((PartitionedRegion) region, tag,
+            entry.getKey(), "value-2");
+
+        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
+
+        // Verify the new stamp
+        entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        stamp = regionEntry.getVersionStamp();
+        assertEquals(
+            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
+            time, stamp.getVersionTimeStamp());
+        assertEquals(++entryVersion, stamp.getEntryVersion());
+        assertEquals(dsid, stamp.getDistributedSystemId());
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
+      
+      @Override
+      public Object call() throws Exception {
+        
+        Cache cache = CacheFactory.getAnyInstance();
+        final PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
+
+        // wait for entry to be received
+        WaitCriterion wc = new WaitCriterion() {
+          public boolean done() {
+            Entry<?,?> entry = null;
+            try {
+              entry = region.getDataStore().getEntryLocally(0, key, false, false);
+            } catch (EntryNotFoundException e) {
+              // expected
+            } catch (ForceReattemptException e) {
+              // expected
+            } catch (PRLocallyDestroyedException e) {
+              throw new RuntimeException("unexpected exception", e);
+            }
+            if (entry != null) {
+              LogWriterUtils.getLogWriter().info("found entry " + entry);
+            }
+            return (entry != null);
+          }
+
+          public String description() {
+            return "Expected key-1 to be received on remote WAN site";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        wc = new WaitCriterion() {
+          public boolean done() {
+            Entry entry = region.getEntry(key);
+            assertTrue(entry instanceof EntrySnapshot);
+            RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
+          }
+          public String description() {
+            return "waiting for timestamp to be updated";
+          }
+        };
+        Wait.waitForCriterion(wc, 30000, 500, true);
+
+        Entry entry = region.getEntry(key);
+        assertTrue(entry instanceof EntrySnapshot);
+        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
+
+        VersionStamp stamp = regionEntry.getVersionStamp();
+
+        return stamp.asVersionTag();
+      }
+    });
+
+    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
+  }
+
+  private VersionTagHolder createNewEvent(LocalRegion region, VersionTag tag, Object key, Object value) {
+    VersionTagHolder updateEvent = new VersionTagHolder(tag);
+    updateEvent.setOperation(Operation.UPDATE);
+    updateEvent.setRegion(region);
+    if (region instanceof PartitionedRegion) {
+      updateEvent.setKeyInfo(((PartitionedRegion)region).getKeyInfo(key));
+    } else {
+      updateEvent.setKeyInfo(new KeyInfo(key, value, null));
+    }
+    updateEvent.setNewValue(value);
+    updateEvent.setGenerateCallbacks(true);
+    updateEvent.distributedMember = region.getSystem().getDistributedMember();
+    updateEvent.setNewEventId(region.getSystem());
+    return updateEvent;
+  }
+
+  /*
+   * Helper Methods
+   */
+
+  private static void createCache(Integer locPort) {
+    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+    props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
+    props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds); 
+    IgnoredException ex = new IgnoredException("could not get remote locator information for remote site");
+    cache.getLogger().info(ex.getAddMessage());
+    expectedExceptions.add(ex);
+    ex = new IgnoredException("Pool ln1 is not available");
+    cache.getLogger().info(ex.getAddMessage());
+    expectedExceptions.add(ex);
+  }
+  
+  private static void closeCache() {
+    if (cache != null && !cache.isClosed()) {
+      for (IgnoredException expectedException: expectedExceptions) {
+        cache.getLogger().info(expectedException.getRemoveMessage());
+      }
+      expectedExceptions.clear();
+      cache.getDistributedSystem().disconnect();
+      cache.close();
+    }
+    cache = null;
+  }
+
+  public static void createSender(String dsName, int remoteDsId,
+      boolean isParallel, Integer maxMemory, Integer batchSize,
+      boolean isConflation, boolean isPersistent, GatewayEventFilter filter,
+      boolean isManualStart) {
+    File persistentDirectory = new File(dsName + "_disk_"
+        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File[] dirs1 = new File[] { persistentDirectory };
+    if (isParallel) {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      ((InternalGatewaySenderFactory) gateway)
+          .setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      if (isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+            .getName());
+      } else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsId);
+
+    } else {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      ((InternalGatewaySenderFactory) gateway)
+          .setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      if (isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+            .getName());
+      } else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.create(dsName, remoteDsId);
+    }
+  }
+
+  public static void createPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    PartitionAttributesFactory pFact = new PartitionAttributesFactory();
+    pFact.setTotalNumBuckets(totalNumBuckets);
+    pFact.setRedundantCopies(redundantCopies);
+    pFact.setRecoveryDelay(0);
+    fact.setPartitionAttributes(pFact.create());
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void createReplicatedRegion(String regionName, String senderIds){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    fact.setDataPolicy(DataPolicy.REPLICATE);
+    fact.setScope(Scope.DISTRIBUTED_ACK);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void waitForSenderRunningState(String senderId){
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    final GatewaySender sender = getGatewaySenderById(senders, senderId);
+    
+    WaitCriterion wc = new WaitCriterion() {
+      public boolean done() {
+        if (sender != null && sender.isRunning()) {
+          return true;
+        }
+        return false;
+      }
+
+      public String description() {
+        return "Expected sender isRunning state to be true but is false";
+      }
+    };
+    Wait.waitForCriterion(wc, 300000, 500, true);
+  }
+
+  public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
+    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
+    props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static void createConcurrentSender(String dsName, int remoteDsId,
+      boolean isParallel, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isPersistent,
+      GatewayEventFilter filter, boolean isManualStart, int concurrencyLevel) {
+    File persistentDirectory = new File(dsName +"_disk_"+System.currentTimeMillis()+"_" + VM.getCurrentVMNum());
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File [] dirs1 = new File[] {persistentDirectory};
+    
+    if(isParallel) {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      if(isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsId);
+      
+    }else {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      if(isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.setDispatcherThreads(concurrencyLevel);
+      gateway.create(dsName, remoteDsId);
+    }
+  }
+
+  public static int createReceiver(int locPort) {
+    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);    
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    } catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port);
+    }
+    return port;
+  }
+
+  public static void startSender(String senderId){
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        sender = s;
+        break;
+      }
+    }
+    sender.start();
+  }
+
+  protected static class MyLocatorCallback extends LocatorDiscoveryCallbackAdapter {
+
+    private final Set discoveredLocators = new HashSet();
+
+    private final Set removedLocators = new HashSet();
+
+    @Override
+    public synchronized void locatorsDiscovered(List locators) {
+      discoveredLocators.addAll(locators);
+      notifyAll();
+    }
+
+    @Override
+    public synchronized void locatorsRemoved(List locators) {
+      removedLocators.addAll(locators);
+      notifyAll();
+    }
+
+    public boolean waitForDiscovery(InetSocketAddress locator, long time)
+        throws InterruptedException {
+      return waitFor(discoveredLocators, locator, time);
+    }
+
+    public boolean waitForRemove(InetSocketAddress locator, long time)
+        throws InterruptedException {
+      return waitFor(removedLocators, locator, time);
+    }
+
+    private synchronized boolean waitFor(Set set, InetSocketAddress locator,
+        long time) throws InterruptedException {
+      long remaining = time;
+      long endTime = System.currentTimeMillis() + time;
+      while (!set.contains(locator) && remaining >= 0) {
+        wait(remaining);
+        remaining = endTime - System.currentTimeMillis();
+      }
+      return set.contains(locator);
+    }
+
+    public synchronized Set getDiscovered() {
+      return new HashSet(discoveredLocators);
+    }
+
+    public synchronized Set getRemoved() {
+      return new HashSet(removedLocators);
+    }
+  }
+
+  private static GatewaySender getGatewaySenderById(Set<GatewaySender> senders, String senderId) {
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        return s;
+      }
+    }
+    //if none of the senders matches with the supplied senderId, return null
+    return null;
+  }
+
+  public static Integer createFirstLocatorWithDSId(int dsId) {
+    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
+    props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    test.getSystem(props);
+    return port;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/CacheClientNotifierDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/CacheClientNotifierDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/CacheClientNotifierDUnitTest.java
new file mode 100755
index 0000000..96d441c
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/CacheClientNotifierDUnitTest.java
@@ -0,0 +1,276 @@
+/*
+ * 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.internal.cache.wan;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.ha.HAContainerRegion;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class CacheClientNotifierDUnitTest extends WANTestBase {
+
+  private static final int NUM_KEYS = 10;
+  
+  private int createCacheServerWithCSC(VM vm, final boolean withCSC, final int capacity,
+      final String policy, final String diskStoreName) {
+    final int serverPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+
+    SerializableRunnable createCacheServer = new SerializableRunnable() {
+      @Override
+      public void run() throws Exception {
+        CacheServerImpl server = (CacheServerImpl)cache.addCacheServer();
+        server.setPort(serverPort);
+        if (withCSC) {
+          if (diskStoreName != null) {
+            DiskStore ds = cache.findDiskStore(diskStoreName);
+            if(ds == null) {
+              ds = cache.createDiskStoreFactory().create(diskStoreName);
+            }
+          }
+          ClientSubscriptionConfig csc = server.getClientSubscriptionConfig();
+          csc.setCapacity(capacity);
+          csc.setEvictionPolicy(policy);
+          csc.setDiskStoreName(diskStoreName);
+          server.setHostnameForClients("localhost");
+          //server.setGroups(new String[]{"serv"});
+        }
+        try {
+          server.start();
+        } catch (IOException e) {
+          com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e);
+        }
+      }
+    };
+    vm.invoke(createCacheServer);
+    return serverPort;
+  }
+
+  private void checkCacheServer(VM vm, final int serverPort, final boolean withCSC, final int capacity) {
+    SerializableRunnable checkCacheServer = new SerializableRunnable() {
+
+      @Override
+      public void run() throws Exception {
+        List<CacheServer> cacheServers = ((GemFireCacheImpl)cache).getCacheServersAndGatewayReceiver();
+        CacheServerImpl server = null;
+        for (CacheServer cs:cacheServers) {
+          if (cs.getPort() == serverPort) {
+            server = (CacheServerImpl)cs;
+            break;
+          }
+        }
+        assertNotNull(server);
+        CacheClientNotifier ccn = server.getAcceptor().getCacheClientNotifier();
+        HAContainerRegion haContainer = (HAContainerRegion)ccn.getHaContainer();
+        if (server.getAcceptor().isGatewayReceiver()) {
+          assertNull(haContainer);
+          return;
+        }
+        Region internalRegion = haContainer.getMapForTest();
+        RegionAttributes ra = internalRegion.getAttributes();
+        EvictionAttributes ea = ra.getEvictionAttributes();
+        if (withCSC) {
+          assertNotNull(ea);
+          assertEquals(capacity, ea.getMaximum());
+          assertEquals(EvictionAction.OVERFLOW_TO_DISK, ea.getAction());
+        } else {
+          assertNull(ea);
+        }
+      }
+    };
+    vm.invoke(checkCacheServer);
+  }
+
+  public static void closeACacheServer(final int serverPort) {
+    List<CacheServer> cacheServers = cache.getCacheServers();
+    CacheServerImpl server = null;
+    for (CacheServer cs:cacheServers) {
+      if (cs.getPort() == serverPort) {
+        server = (CacheServerImpl)cs;
+        break;
+      }
+    }
+    assertNotNull(server);
+    server.stop();
+  }
+
+  private void verifyRegionSize(VM vm, final int expect) {
+    SerializableRunnable verifyRegionSize = new SerializableRunnable() {
+      @Override
+      public void run() throws Exception {
+        final Region region = cache.getRegion(getTestMethodName() + "_PR");
+
+        Wait.waitForCriterion(new WaitCriterion() {
+          public boolean done() {
+            return region.size() == expect; 
+          }
+          public String description() {
+            return null;
+          }
+        }, 60000, 100, false);
+        assertEquals(expect, region.size());
+      }
+    };
+    vm.invoke(verifyRegionSize);
+  }
+  
+  /**
+   * The test will start several cache servers, including gateway receivers.
+   * Shutdown them and verify the CacheClientNotifier for each server is correct
+   */
+  @Test
+  public void testNormalClient2MultipleCacheServer() throws Exception {
+    doMultipleCacheServer(false);
+  }
+
+  public void doMultipleCacheServer(boolean durable) throws Exception {
+    /* test scenario: */
+    /* create 1 GatewaySender on vm0 */
+    /* create 1 GatewayReceiver on vm1 */
+    /* create 2 cache servers on vm1, one with overflow. */
+    /* verify if the cache server2 still has the overflow attributes */
+    /* create 1 cache client1 on vm2 to register interest on cache server1 */
+    /* create 1 cache client2 on vm3 to register interest on cache server1 */
+    /* do some puts to GatewaySender on vm0 */
+    
+    // create sender at ln
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    
+    // create receiver and cache servers will be at ny
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    vm1.invoke(() -> WANTestBase.createCache( nyPort ));
+    int receiverPort = vm1.invoke(() -> WANTestBase.createReceiver());
+    checkCacheServer(vm1, receiverPort, false, 0);
+    
+    // create PR for receiver
+    vm1.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    
+    // create cache server1 with overflow
+    int serverPort = createCacheServerWithCSC(vm1, true, 3, "entry", "DEFAULT");
+    checkCacheServer(vm1, serverPort, true, 3);
+    
+    // create cache server 2
+    final int serverPort2 = createCacheServerWithCSC(vm1, false, 0, null, null);
+    // Currently, only the first cache server's overflow attributes will take effect
+    // It will be enhanced in GEODE-1102
+    checkCacheServer(vm1, serverPort2, true, 3);
+    LogService.getLogger().info("receiverPort="+receiverPort+",serverPort="+serverPort+",serverPort2="+serverPort2);
+    
+    vm2.invoke(() -> createClientWithLocator(nyPort, "localhost", getTestMethodName() + "_PR", "123", durable));
+    vm3.invoke(() -> createClientWithLocator(nyPort, "localhost", getTestMethodName() + "_PR", "124", durable));
+
+    vm0.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm0.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 400, false, false, null, true ));
+    vm0.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm0.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm0.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", NUM_KEYS ));
+    
+    /* verify */
+    verifyRegionSize(vm0, NUM_KEYS);
+    verifyRegionSize(vm1, NUM_KEYS);
+    verifyRegionSize(vm3, NUM_KEYS);
+    verifyRegionSize(vm2, NUM_KEYS);
+
+    // close a cache server, then re-test
+    vm1.invoke(() -> closeACacheServer(serverPort2));
+
+    vm0.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", NUM_KEYS*2 ));
+
+    /* verify */
+    verifyRegionSize(vm0, NUM_KEYS*2);
+    verifyRegionSize(vm1, NUM_KEYS*2);
+    verifyRegionSize(vm3, NUM_KEYS*2);
+    verifyRegionSize(vm2, NUM_KEYS*2);
+    
+    disconnectAllFromDS();
+  }
+
+  public static void createClientWithLocator(int port0,String host,
+      String regionName, String clientId, boolean isDurable) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "");
+    if (isDurable) {
+      props.setProperty(DURABLE_CLIENT_ID, clientId);
+      props.setProperty(DURABLE_CLIENT_TIMEOUT, "" + 200);
+    }
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+
+    assertNotNull(cache);
+    CacheServerTestUtil.disableShufflingOfEndpoints();
+    Pool p;
+    try {
+      p = PoolManager.createFactory().addLocator(host, port0)
+          .setPingInterval(250).setSubscriptionEnabled(true)
+          .setSubscriptionRedundancy(-1).setReadTimeout(2000)
+          .setSocketBufferSize(1000).setMinConnections(6).setMaxConnections(10)
+          .setRetryAttempts(3).create(regionName);
+    } finally {
+      CacheServerTestUtil.enableShufflingOfEndpoints();
+    }
+
+    AttributesFactory factory = new AttributesFactory();
+    factory.setPoolName(p.getName());
+    factory.setDataPolicy(DataPolicy.NORMAL);
+    RegionAttributes attrs = factory.create();
+    region = cache.createRegion(regionName, attrs);
+    region.registerInterest("ALL_KEYS");
+    assertNotNull(region);
+    if (isDurable) {
+      cache.readyForEvents();
+    }
+    LogWriterUtils.getLogWriter().info(
+        "Distributed Region " + regionName + " created Successfully :"
+            + region.toString() + " in a "+(isDurable?"durable":"")+" client");
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/Simple2CacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/Simple2CacheServerDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/Simple2CacheServerDUnitTest.java
new file mode 100755
index 0000000..1d4e947
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/Simple2CacheServerDUnitTest.java
@@ -0,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.internal.cache.wan;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.client.internal.PoolImpl;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.distributed.internal.ServerLocation;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
+import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
+import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.ha.HAContainerRegion;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.jayway.awaitility.Awaitility;
+
+@Category(DistributedTest.class)
+public class Simple2CacheServerDUnitTest extends WANTestBase {
+  private static final int NUM_KEYS = 10;
+  static int afterPrimaryCount = 0;
+  static int afterProxyReinitialized = 0;
+  
+  public Simple2CacheServerDUnitTest() {
+    super();
+  }
+  
+  @Test
+  public void testNormalClient2MultipleCacheServer() throws Exception {
+    doMultipleCacheServer(false);
+  }
+  
+  public void doMultipleCacheServer(boolean durable) throws Exception {
+    Integer lnPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    vm1.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm1.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    int serverPort = vm1.invoke(() -> WANTestBase.createCacheServer());
+    int serverPort2 = vm1.invoke(() -> WANTestBase.createCacheServer());
+
+    if (durable) {
+      vm1.invoke(() -> setCacheClientProxyTestHook());
+    } else {
+      vm2.invoke(() -> setClientServerObserver());
+    }
+    vm2.invoke(() -> CacheClientNotifierDUnitTest.createClientWithLocator(lnPort, "localhost", getTestMethodName() + "_PR" , "123", durable));
+
+    vm0.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm0.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    int serverPort3 = vm0.invoke(() -> WANTestBase.createCacheServer());
+    
+    if (durable) {
+      vm1.invoke(() -> checkResultAndUnsetCacheClientProxyTestHook());
+    } else {
+      vm2.invoke(() -> checkResultAndUnsetClientServerObserver());
+    }
+    Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
+    
+    // close the current primary cache server, then re-test
+    int serverPortAtVM1 = vm1.invoke(()-> findCacheServerForPrimaryProxy());
+    if (serverPortAtVM1 != 0) {
+      vm1.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPortAtVM1));
+      LogService.getLogger().info("Closed cache server on vm1:"+serverPortAtVM1);
+      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
+    } else {
+      vm0.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPort3));
+      LogService.getLogger().info("Closed cache server on vm0:"+serverPort3);
+      assertTrue(checkProxyIsPrimary(vm1));
+    }
+    disconnectAllFromDS();
+  }
+  
+  private static int findCacheServerForPrimaryProxy() {
+    List<CacheServer> cacheServers = ((GemFireCacheImpl)cache).getCacheServers();
+    CacheServerImpl server = null;
+    for (CacheServer cs:cacheServers) {
+      server = (CacheServerImpl)cs;
+      long acceptorId = server.getAcceptor().getAcceptorId();
+      for (CacheClientProxy proxy:CacheClientNotifier.getInstance().getClientProxies()) {
+        if (proxy.isPrimary() == false) {
+          continue;
+        }
+        if (proxy.getAcceptorId() == acceptorId) {
+          LogService.getLogger().info("Found cache server "+server+" for the primary proxy "+proxy);
+          return server.getPort();
+        }
+      }
+    }
+    return 0;
+  }
+  
+  public static void setClientServerObserver()
+  {
+    PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = true;
+    ClientServerObserverHolder
+    .setInstance(new ClientServerObserverAdapter() {
+      public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint)
+      {
+        LogService.getLogger().info("After primary is set");
+        afterPrimaryCount++;
+      }
+    });
+  }
+
+  public static void checkResultAndUnsetClientServerObserver()
+  {
+    PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = false;
+    // setPrimary only happened once
+    assertEquals(1, afterPrimaryCount);
+    afterPrimaryCount = 0;
+  }
+
+  public static void setCacheClientProxyTestHook()
+  {
+    CacheClientProxy.testHook = new CacheClientProxy.TestHook() {
+      @Override
+      public void doTestHook(String spot) {
+        if (spot.equals("CLIENT_RECONNECTED")) {
+          afterProxyReinitialized++;
+        }
+      }
+    };
+  }
+
+  public static void checkResultAndUnsetCacheClientProxyTestHook()
+  {
+    // Reinitialize only happened once
+    CacheClientProxy.testHook = null;
+    assertEquals(1, afterProxyReinitialized);
+    afterProxyReinitialized = 0;
+  }
+  
+  private boolean checkProxyIsPrimary(VM vm) {
+    SerializableCallable checkProxyIsPrimary = new SerializableCallable() {
+      @Override
+      public Object call() throws Exception {
+        final CacheClientNotifier ccn = CacheClientNotifier.getInstance();
+        Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return (ccn.getClientProxies().size() == 1); }); 
+        
+        Iterator iter_prox = ccn.getClientProxies().iterator();
+        CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
+        return proxy.isPrimary();
+      }
+    };
+    return (Boolean)vm.invoke(checkProxyIsPrimary);
+  }
+}


[29/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java
deleted file mode 100644
index 427054a..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-@Category(DistributedTest.class)
-public class ParallelWANPropagationConcurrentOpsDUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-  
-  public ParallelWANPropagationConcurrentOpsDUnitTest() {
-    super();
-  }
-  
-  /**
-   * Normal propagation scenario test case for a PR with only one bucket.
-   * This has been added for bug# 44284.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithSingleBucketPR() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5);
- 
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
- 
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 1, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 1, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 1, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 1, isOffHeap() ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //pause the senders
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    Wait.pause(5000);
-    
-    AsyncInvocation async1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 700 ));
-    AsyncInvocation async2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    AsyncInvocation async3 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 800 ));
-    AsyncInvocation async4 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    async1.join();
-    async2.join();
-    async3.join();
-    async4.join();
-    
-    int queueSize = (Integer) vm4.invoke(() -> WANTestBase.getQueueContentSize( "ln" ));
-    assertEquals("Actual queue size is not matching with the expected", 3500, queueSize);
-    
-    //resume the senders now
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  /**
-   * Normal propagation scenario test case for a PR with less number of buckets.
-   * Buckets have been kept to 10 for this test.
-   * This has been added for bug# 44287.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithLowNumberOfBuckets() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5);
- 
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
- 
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    AsyncInvocation async1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 700 ));
-    AsyncInvocation async2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    AsyncInvocation async3 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 800 ));
-    AsyncInvocation async4 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    async1.join();
-    async2.join();
-    async3.join();
-    async4.join();
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testParallelQueueDrainInOrder_PR() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 3, 4, isOffHeap() ));
-  
-    vm2.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_PR"));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.addQueueListener( "ln", true));
-    vm5.invoke(() -> WANTestBase.addQueueListener( "ln", true));
-    vm6.invoke(() -> WANTestBase.addQueueListener( "ln", true));
-    vm7.invoke(() -> WANTestBase.addQueueListener( "ln", true));
-
-    Wait.pause(2000);
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln"));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln"));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln"));
-    
-    Wait.pause(2000);
-    
-    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      4 ));
-    vm4.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4));
-    vm5.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4));
-    vm6.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4 ));
-    vm7.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4));
-    
-    vm4.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4));
-    vm5.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4));
-    vm6.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4 ));
-    vm7.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4));
-    
-    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-    
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-    
-    HashMap vm4BRUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
-    HashMap vm5BRUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
-    HashMap vm6BRUpdates = (HashMap)vm6.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
-    HashMap vm7BRUpdates = (HashMap)vm7.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
-    
-    List b0SenderUpdates = (List)vm4BRUpdates.get("Create0");
-    List b1SenderUpdates = (List)vm4BRUpdates.get("Create1");
-    List b2SenderUpdates = (List)vm4BRUpdates.get("Create2");
-    List b3SenderUpdates = (List)vm4BRUpdates.get("Create3");
-    
-    HashMap vm4QueueBRUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
-    HashMap vm5QueueBRUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
-    HashMap vm6QueueBRUpdates = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
-    HashMap vm7QueueBRUpdates = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
-    
-    assertEquals(vm4QueueBRUpdates, vm5QueueBRUpdates);
-    assertEquals(vm4QueueBRUpdates, vm6QueueBRUpdates);
-    assertEquals(vm4QueueBRUpdates, vm7QueueBRUpdates);
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln"));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln"));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln"));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-    HashMap receiverUpdates = (HashMap)vm2.invoke(() -> WANTestBase.checkPR(
-      getTestMethodName() + "_PR"));
-    List<Long> createList = (List)receiverUpdates.get("Create");
-    ArrayList<Long> b0ReceiverUpdates = new ArrayList<Long>();
-    ArrayList<Long> b1ReceiverUpdates = new ArrayList<Long>();
-    ArrayList<Long> b2ReceiverUpdates = new ArrayList<Long>();
-    ArrayList<Long> b3ReceiverUpdates = new ArrayList<Long>();
-    for (Long key : createList) {
-      long mod = key % 4;
-      if (mod == 0) {
-        b0ReceiverUpdates.add(key);
-      }
-      else if (mod == 1) {
-        b1ReceiverUpdates.add(key);
-      }
-      else if (mod == 2) {
-        b2ReceiverUpdates.add(key);
-      }
-      else if (mod == 3) {
-        b3ReceiverUpdates.add(key);
-      }
-    }
-    b0ReceiverUpdates.remove(0);
-    b1ReceiverUpdates.remove(0);
-    b2ReceiverUpdates.remove(0);
-    b3ReceiverUpdates.remove(0);
-    
-    assertEquals(b0SenderUpdates, b0ReceiverUpdates);
-    assertEquals(b1SenderUpdates, b1ReceiverUpdates);
-    assertEquals(b2SenderUpdates, b2ReceiverUpdates);
-    assertEquals(b3SenderUpdates, b3ReceiverUpdates);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java
deleted file mode 100644
index 7b0cf3e..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java
+++ /dev/null
@@ -1,1234 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.Set;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.EntryExistsException;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.client.ServerOperationException;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.RegionQueue;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.BatchException70;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class ParallelWANPropagationDUnitTest extends WANTestBase {
-  private static final long serialVersionUID = 1L;
-
-  public ParallelWANPropagationDUnitTest() {
-    super();
-  }
-
-  @Test
-  public void test_ParallelGatewaySenderMetaRegionNotExposedToUser_Bug44216() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCache(lnPort);
-    createSender("ln", 2, true, 100, 300, false, false,
-        null, true);
-    createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap());
-
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals("ln")) {
-        sender = s;
-        break;
-      }
-    }
-    try {
-      sender.start();
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail("Failed with IOException");
-    }
-
-    GemFireCacheImpl gemCache = (GemFireCacheImpl)cache;
-    Set regionSet = gemCache.rootRegions();
-
-    for (Object r : regionSet) {
-      if (((Region)r).getName().equals(
-          ((AbstractGatewaySender)sender).getQueues().toArray(new RegionQueue[1])[0].getRegion().getName())) {
-        fail("The shadowPR is exposed to the user");
-      }
-    }
-  }
-  
-  @Test
-  public void testParallelPropagation_withoutRemoteSite() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //keep a larger batch to minimize number of exception occurrences in the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 300, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 300, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 300, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 300, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-    createReceiverInVMs(vm2, vm3);
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    // Just making sure that though the remote site is started later,
-    // remote site is still able to get the data. Since the receivers are
-    // started before creating partition region it is quite possible that the
-    // region may loose some of the events. This needs to be handled by the code
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  /**
-   * Normal happy scenario test case.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  protected SerializableRunnableIF createReceiverPartitionedRegionRedundancy1() {
-    return () -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  );
-  }
-
-  protected SerializableRunnableIF createPartitionedRegionRedundancy1Runnable() {
-    return () -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  );
-  }
-
-  protected SerializableRunnableIF waitForSenderRunnable() {
-    return () -> WANTestBase.waitForSenderRunningState( "ln" );
-  }
-
-  @Test
-  public void testParallelPropagation_ManualStart() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, false ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  /**
-   * Normal happy scenario test case2.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationPutBeforeSenderStart() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  /**
-   * Local and remote sites are up and running.
-   * Local site cache is closed and the site is built again.
-   * Puts are done to local site.
-   * Expected: Remote site should receive all the events put after the local
-   * site was built back.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithLocalCacheClosedAndRebuilt() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-              getTestMethodName() + "_PR", 1000 ));
-    //-------------------Close and rebuild local site ---------------------------------
-
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-    vm6.invoke(() -> WANTestBase.killSender());
-    vm7.invoke(() -> WANTestBase.killSender());
-    
-    Integer regionSize = 
-      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_PR" ));
-    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    //------------------------------------------------------------------------------------
-    
-    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  @Test
-  public void testParallelColocatedPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-  }
-  /**
-   * Create colocated partitioned regions.
-   * Parent region has PGS attached and child region doesn't.
-   * 
-   * Validate that events for parent region reaches remote site.
-   * 
-   * @throws Exception
-   */
-
-  @Test
-  public void testParallelColocatedPropagation2() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), null, 1, 100, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"_child1", 1000 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"_child2", 1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName()+"_child1", 0 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName()+"_child2", 0 ));
-  }
-
-  
-  @Test
-  public void testParallelPropagationWithOverflow() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap()  ));
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //let all the senders start before doing any puts to ensure that none of the events is lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), 150 ));
-
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 150 ));
-  }
-
-  @Test
-  public void testSerialReplicatedAndParallelPartitionedPropagation()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial",
-        2, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnParallel",
-        2, true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnParallel",
-        2, true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "lnParallel",
-        2, true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "lnParallel",
-        2, true, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("lnSerial", vm4, vm5);
-
-    startSenderInVMs("lnParallel", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testPartitionedParallelPropagationToTwoWanSites()
-      throws Exception {
-    Integer lnPort = createFirstLocatorWithDSId(1);
-    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    createReceiverInVMs(vm2);
-
-    createCacheInVMs(tkPort, vm3);
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-    createReceiverInVMs(vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnParallel1",
-        2, true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnParallel1",
-        2, true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "lnParallel1",
-        2, true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "lnParallel1",
-        2, true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnParallel2",
-        3, true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnParallel2",
-        3, true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "lnParallel2",
-        3, true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "lnParallel2",
-        3, true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("lnParallel1", vm4, vm5, vm6, vm7);
-
-    startSenderInVMs("lnParallel2", vm4, vm5, vm6, vm7);
-
-
-    //before doing puts, make sure that the senders are started.
-    //this will ensure that not a single events is lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
-    
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Category(FlakyTest.class) // GEODE-1008 and GEODE-1180: random ports, async actions, thread sleeps, time sensitive, waitForCriterion
-  @Test
-  public void testPartitionedParallelPropagationHA() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    AsyncInvocation inv1 = vm7.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
-    Wait.pause(500);
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));
-    Wait.pause(1500);
-    AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
-    inv1.join();
-    inv2.join();
-    inv3.join();
-    inv4.join();
-    
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-    
-    //verify all buckets drained on the sender nodes that up and running.
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-  }
-
-  @Test
-  public void testParallelPropagationWithFilter() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap()  ));
-
-    //wait for senders to be running before doing any puts. This will ensure that
-    //not a single events is lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-  }
-  
-  
-  @Test
-  public void testParallelPropagationWithPutAll() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPutAll( getTestMethodName() + "_PR",
-        100 , 50 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 5000 ));
-  
-  }
-  
-  /**
-   * There was a bug that all destroy events were being put into different buckets of sender queue
-   * against the key 0. Bug# 44304
-   *  
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithDestroy() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 100, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 100, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 100, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 100, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    Wait.pause(2000);
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    vm4.invoke(() -> WANTestBase.doDestroys( getTestMethodName() + "_PR", 500 ));
-    
-    
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
-
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    //give some time for the queue to drain
-    Wait.pause(5000);
-    
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 500 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 500 ));
-  
-  }
-  
-  /**
-   * Normal happy scenario test case. But with Tx operations
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationTxOperations() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5);
-    //vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    //vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    //vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-    //    true, 100, 10, false, false, null, true ));
-    //vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-    //    true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-//    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-//        testName + "_PR", "ln", true, 1, 100, isOffHeap()  ));
-//    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-//        testName + "_PR", "ln", true, 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-//    vm6.invoke(() -> WANTestBase.startSender( "ln" ));
-//    vm7.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
-    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-//    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-//    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm4.invoke(() -> WANTestBase.doTxPuts( getTestMethodName() + "_PR"));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-//    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-//    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 3 ));
-  }
-
-  @Ignore
-  @Test
-  public void testParallelGatewaySenderQueueLocalSize() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    /*
-     * Remember pausing sender does not guarantee that peek will be paused
-     * immediately as its quite possible event processor is already in peeking
-     * events and send them after peeking without a check for pause. hence below
-     * pause of 1 sec to allow dispatching to be paused
-     */
-//    vm4.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
-//    vm5.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
-    Wait.pause(1000);
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
-    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
-    
-    // instead of checking size as 5 and 5. check that combined size is 10
-    Integer localSize1 = (Integer)vm4.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
-    Integer localSize2 = (Integer)vm5.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
-    assertEquals(10,  localSize1 + localSize2);
-  }
-  
-
-
-  public void tParallelGatewaySenderQueueLocalSizeWithHA() {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
-    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    /*
-     * Remember pausing sender does not guarantee that peek will be paused
-     * immediately as its quite possible event processor is already in peeking
-     * events and send them after peeking without a check for pause. hence below
-     * pause of 1 sec to allow dispatching to be paused
-     */
-//    vm4.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
-//    vm5.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
-    Wait.pause(1000);
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
-    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
-    
-    Integer localSize1 = (Integer)vm4.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
-    Integer localSize2 = (Integer)vm5.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
-    assertEquals(10,  localSize1 + localSize2);
-    
-    vm5.invoke(() -> WANTestBase.killSender( ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
-    vm4.invoke(() -> WANTestBase.checkPRQLocalSize( "ln", 10 ));
-    
-  }
-  
-  /**
-   * Added for defect #50364 Can't colocate region that has AEQ with a region that does not have that same AEQ
-   */
-  @Test
-  public void testParallelSenderAttachedToChildRegionButNotToParentRegion() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-	  //create cache and receiver on site2
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-	  //create cache on site1
-    createCacheInVMs(lnPort, vm3);
-
-	  //create sender on site1
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    
-    //start sender on site1
-    startSenderInVMs("ln", vm3);
-
-    //create leader (parent) PR on site1
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "PARENT_PR", null, 0, 100, isOffHeap() ));
-    String parentRegionFullPath = 
-      (String) vm3.invoke(() -> WANTestBase.getRegionFullPath( getTestMethodName() + "PARENT_PR"));
-    
-    //create colocated (child) PR on site1
-    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegion(
-        getTestMethodName() + "CHILD_PR", "ln", 0, 100, parentRegionFullPath ));
-    
-    //create leader and colocated PR on site2
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "PARENT_PR", null, 0, 100, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegion(
-        getTestMethodName() + "CHILD_PR", null, 0, 100, parentRegionFullPath ));
-    
-    //do puts in colocated (child) PR on site1
-    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "CHILD_PR", 1000 ));
-    
-    //verify the puts reach site2
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "CHILD_PR", 1000 ));
-  }
-  
-  @Test
-  public void testParallelPropagationWithFilter_AfterAck() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm6, vm7);
-    createReceiverInVMs(vm6, vm7);
-
-    createCacheInVMs(lnPort, vm2, vm3, vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm2, vm3, vm4, vm5);
-
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    // wait for senders to be running before doing any puts. This will ensure
-    // that
-    // not a single events is lost
-    vm2.invoke(waitForSenderRunnable());
-    vm3.invoke(waitForSenderRunnable());
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-    vm3.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    
-    Integer vm2Acks = (Integer)vm2.invoke(() -> WANTestBase.validateAfterAck( "ln"));
-    Integer vm3Acks = (Integer)vm3.invoke(() -> WANTestBase.validateAfterAck( "ln"));
-    Integer vm4Acks = (Integer)vm4.invoke(() -> WANTestBase.validateAfterAck( "ln"));
-    Integer vm5Acks = (Integer)vm5.invoke(() -> WANTestBase.validateAfterAck( "ln"));
-
-    assertEquals(2000, (vm2Acks + vm3Acks + vm4Acks + vm5Acks));
-        
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java
deleted file mode 100644
index 07a6223..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-@Category(DistributedTest.class)
-public class ParallelWANPropagationLoopBackDUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-  
-  public ParallelWANPropagationLoopBackDUnitTest() {
-    super();
-  }
-  
-  /**
-   * Test loop back issue between 2 WAN sites (LN & NY). LN -> NY -> LN.
-   * Site1 (LN): vm2, vm4, vm5
-   * Site2 (NY): vm3, vm6, vm7
-   */
-  @Test
-  public void testParallelPropagationLoopBack() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on site1 and site2
-    createCacheInVMs(lnPort, vm2, vm4, vm5);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    createCacheInVMs(nyPort, vm3, vm6, vm7);
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    //create senders on site1
-    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    
-    //create senders on site2
-    vm3.invoke(() -> WANTestBase.createSender( "ny", 1,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ny", 1,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny", 1,
-      true, 100, 10, false, false, null, true ));
-    
-    //create PR on site1
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap()  ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap()  ));
-    
-    //create PR on site2
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap()  ));
-    
-    //start sender on site1
-    startSenderInVMs("ln", vm2, vm4, vm5);
-
-
-    //start sender on site2
-    startSenderInVMs("ny", vm3, vm6, vm7);
-
-
-    //pause senders on site1
-    vm2.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //pause senders on site2
-    vm3.invoke(() -> WANTestBase.pauseSender( "ny" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ny" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ny" ));
-    
-    //this is required since sender pause doesn't take effect immediately
-    Wait.pause(1000);
-    
-    //Do 100 puts on site1
-    vm2.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      100 ));
-    //do next 100 puts on site2
-    vm3.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR",
-      100, 200 ));
-    //verify queue size on both sites
-    vm2.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
-    
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
-    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
-    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
-    
-    //resume sender on site1
-    vm2.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-     
-    //validate events reached site2 from site1
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 200 ));
-    
-    //on site2, verify queue size again
-    //this ensures that loopback is not happening since the queue size is same as before
-    //the event coming from site1 are not enqueued again
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
-    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
-    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
-    
-    //resume sender on site2
-    vm3.invoke(() -> WANTestBase.resumeSender( "ny" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ny" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ny" ));
-    
-    //validate region size on both the sites
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-  }
-  
-  /**
-   * Test loop back issue among 3 WAN sites with Ring topology i.e. LN -> NY -> TK -> LN
-   * Site1 (LN): vm3, vm6
-   * Site2 (NY): vm4, vm7
-   * Site3 (TK): vm5
-   */
-  @Test
-  public void testParallelPropagationLoopBack3Sites() {
-    //Create locators
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-    
-    //create cache and receivers on all the 3 sites
-    createCacheInVMs(lnPort, vm3, vm6);
-    createReceiverInVMs(vm3, vm6);
-    createCacheInVMs(nyPort, vm4, vm7);
-    createReceiverInVMs(vm4, vm7);
-    createCacheInVMs(tkPort, vm5);
-    createReceiverInVMs(vm5);
-
-
-    //create senders on all the 3 sites
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    
-    vm4.invoke(() -> WANTestBase.createSender( "ny", 3,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny", 3,
-      true, 100, 10, false, false, null, true ));
-    
-    vm5.invoke(() -> WANTestBase.createSender( "tk", 1,
-      true, 100, 10, false, false, null, true ));
-    
-    //create PR on the 3 sites
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap() ));
-    
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "tk", 0, 100, isOffHeap() ));
-    
-    //start senders on all the sites 
-    startSenderInVMs("ln", vm3, vm6);
-
-    startSenderInVMs("ny", vm4, vm7);
-
-    vm5.invoke(() -> WANTestBase.startSender( "tk" ));
-    
-    //pause senders on site1 and site3. Site2 has the sender running to pass along events
-    vm3.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    vm5.invoke(() -> WANTestBase.pauseSender( "tk" ));
-    
-    //need to have this pause since pauseSender doesn't take effect immediately
-    Wait.pause(1000);
-    
-    //do puts on site1
-    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      100 ));
-    
-    //do more puts on site3
-    vm5.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR",
-      100, 200 ));
-    
-    //verify queue size on site1 and site3
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 100 ));
-
-    //resume sender on site1 so that events reach site2 and from there to site3
-    vm3.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    //validate region size on site2 (should have 100) and site3 (should have 200)
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 100 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 200 ));
-    
-    //verify queue size remains same on site3 which means event loopback did not happen
-    //this means events coming from site1 are not enqueued back into the sender
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 100 ));
-    
-    //resume sender on site3
-    vm5.invoke(() -> WANTestBase.resumeSender( "tk" ));
-    
-    //validate region size
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-  }
-  
-  /**
-   * Test loop back issue among 3 WAN sites with N to N topology 
-   * i.e. each site connected to all other sites.
-   * Puts are done to only one DS.
-   * LN site: vm3, vm6
-   * NY site: vm4, vm7
-   * TK site: vm5
-   */
-  @Test
-  public void testParallelPropagationLoopBack3SitesNtoNTopologyPutFromOneDS() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(lnPort, vm3, vm6);
-    createCacheInVMs(nyPort, vm4, vm7);
-    createCacheInVMs(tkPort, vm5);
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    vm5.invoke(() -> WANTestBase.createReceiver());
-
-    //site1
-    vm3.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      true, 100, 10, false, false, null, true ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln2", 3,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln2", 3,
-      true, 100, 10, false, false, null, true ));
-    
-    //site2
-    vm4.invoke(() -> WANTestBase.createSender( "ny1", 1,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny1", 1,
-      true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ny2", 3,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny2", 3,
-      true, 100, 10, false, false, null, true ));
-
-    //site3
-    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
-      true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "tk2", 2,
-      true, 100, 10, false, false, null, true ));
-
-    //create PR
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln1,ln2", 0, 1, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln1,ln2", 0, 1, isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny1,ny2", 0, 1, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ny1,ny2", 0, 1, isOffHeap() ));
-    
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "tk1,tk2", 0, 1, isOffHeap() ));
-
-    //start all the senders
-    vm3.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm3.invoke(() -> WANTestBase.startSender( "ln2" ));
-    vm6.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm6.invoke(() -> WANTestBase.startSender( "ln2" ));
-    
-    vm4.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm4.invoke(() -> WANTestBase.startSender( "ny2" ));
-    vm7.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm7.invoke(() -> WANTestBase.startSender( "ny2" ));
-    
-    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk2" ));
-    
-    //pause senders on all the sites
-    vm3.invoke(() -> WANTestBase.pauseSender( "ln1" ));
-    vm3.invoke(() -> WANTestBase.pauseSender( "ln2" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln1" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln2" ));
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ny1" ));
-    vm4.invoke(() -> WANTestBase.pauseSender( "ny2" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ny1" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ny2" ));
-    
-    vm5.invoke(() -> WANTestBase.pauseSender( "tk1" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "tk2" ));
-    
-    //this is required since sender pause doesn't take effect immediately
-    Wait.pause(1000);
-
-    //do puts on site1
-    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      100 ));
-    
-    //verify queue size on site1 and site3
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln1", 100 ));
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln2", 100 ));
-    
-    //resume sender (from site1 to site2) on site1
-    vm3.invoke(() -> WANTestBase.resumeSender( "ln1" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln1" ));
-
-    //validate region size on site2
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 100 ));
-
-    //verify queue size on site2 (sender 2 to 1)
-    //should remain at 0 as the events from site1 should not go back to site1
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
-    
-    //verify queue size on site2 (sender 2 to 3)
-    //should remain at 0 as events from site1 will reach site3 directly..site2 need not send to site3 again  
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
-    
-    //do more puts on site3
-    vm5.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR",
-      100, 200 ));
-    
-    //resume sender (from site3 to site2) on site3
-    vm5.invoke(() -> WANTestBase.resumeSender( "tk2" ));
-    
-    //validate region size on site2
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-    
-    //verify queue size on site2 (sender 2 to 3)
-    //should remain at 0 as the events from site3 should not go back to site3
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
-    
-    //verify queue size on site2 (sender 2 to 1)
-    //should remain at 0 as events from site3 will reach site1 directly..site2 need not send to site1 again  
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
-    
-    //resume all senders
-    vm3.invoke(() -> WANTestBase.resumeSender( "ln2" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln2" ));
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ny1" ));
-    vm4.invoke(() -> WANTestBase.resumeSender( "ny2" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ny1" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ny2" ));
-    
-    vm5.invoke(() -> WANTestBase.resumeSender( "tk1" ));
-    
-    //validate region size on all sites
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 200 ));
-  }
-  
-
-
-}



[25/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java
deleted file mode 100644
index 47dee96..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.CancelException;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.internal.cache.ForceReattemptException;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class SerialWANPropagation_PartitionedRegionDUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  public SerialWANPropagation_PartitionedRegionDUnitTest() {
-    super();
-  }
-
-  @Test
-  public void testPartitionedSerialPropagation() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    //vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testBothReplicatedAndPartitionedSerialPropagation()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testSerialReplicatedAndPartitionedPropagation() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial",
-        2, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "lnSerial" ));
-    vm5.invoke(() -> WANTestBase.startSender( "lnSerial" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testSerialReplicatedAndSerialPartitionedPropagation()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        2, false, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("lnSerial1", vm4, vm5);
-
-    startSenderInVMs("lnSerial2", vm5, vm6);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  @Test
-  public void testPartitionedSerialPropagationToTwoWanSites() throws Exception {
-
-    Integer lnPort = createFirstLocatorWithDSId(1);
-    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort ));
-    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(3,lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    createCacheInVMs(tkPort, vm3);
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    startSenderInVMs("lnSerial1", vm4, vm5);
-    startSenderInVMs("lnSerial2", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testPartitionedSerialPropagationHA() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    //do initial 100 puts to create all the buckets
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-    
-    IgnoredException.addIgnoredException(CancelException.class.getName());
-    IgnoredException.addIgnoredException(CacheClosedException.class.getName());
-    IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
-    //start async puts
-    AsyncInvocation inv = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    //close the cache on vm4 in between the puts
-    vm4.invoke(() -> WANTestBase.killSender());
-
-    inv.join();
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-
-  @Test
-  public void testPartitionedSerialPropagationWithParallelThreads() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    createReceiverInVMs(vm2, vm3);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-
-
-    vm4.invoke(() -> WANTestBase.doMultiThreadedPuts( // TODO: eats exceptions
-        getTestMethodName() + "_PR", 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java
deleted file mode 100644
index f3b6765..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-
-
-@Category(DistributedTest.class)
-public class SerialWANPropagationsFeatureDUnitTest extends WANTestBase{
-
-  private static final long serialVersionUID = 1L;
-
-  public SerialWANPropagationsFeatureDUnitTest() {
-    super();
-  }
-
-  @Test
-  public void testSerialReplicatedWanWithOverflow() {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 10, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 10, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-    vm2.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
-    vm3.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doHeavyPuts(
-        getTestMethodName() + "_RR", 15 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 15, 240000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 15, 240000 ));
-  }
-
-  @Test
-  public void testSerialReplicatedWanWithPersistence() {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithConflation() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 1000, true, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 1000, true, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationWithParallelThreads()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doMultiThreadedPuts(
-        getTestMethodName() + "_RR", 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  @Test
-  public void testSerialPropagationWithFilter() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithFilter() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationWithFilter_AfterAck()
-      throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm6, vm7);
-    createReceiverInVMs(vm6, vm7);
-
-    createCacheInVMs(lnPort, vm2, vm3, vm4, vm5);
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 10, false, false,
-            new MyGatewayEventFilter_AfterAck(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 10, false, false,
-            new MyGatewayEventFilter_AfterAck(), true ));
-
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), null, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-
-    Integer vm4Acks = (Integer)vm4.invoke(() -> WANTestBase.validateAfterAck( "ln"));
-    Integer vm5Acks = (Integer)vm5.invoke(() -> WANTestBase.validateAfterAck( "ln"));
-
-    assertEquals(2000, (vm4Acks + vm5Acks));
-
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
deleted file mode 100644
index 2019cac..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import static com.gemstone.gemfire.test.dunit.Wait.*;
-import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.jayway.awaitility.Awaitility;
-
-@Category(DistributedTest.class)
-public class SerialWANStatsDUnitTest extends WANTestBase {
-  
-  private static final long serialVersionUID = 1L;
-
-  private String testName;
-  
-  public SerialWANStatsDUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    this.testName = getTestMethodName();
-    addIgnoredException("java.net.ConnectException");
-    addIgnoredException("java.net.SocketException");
-    addIgnoredException("Unexpected IOException");
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-
-    vm5.invoke(() -> WANTestBase.doPuts( testName + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName + "_RR", 1000 ));
-    
-    pause(2000);
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 1000, 1000, 1000));
-    vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
-      100));
-    
-    vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 1000, 0, 0));
-    vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
-      0));
-    
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationWithMultipleDispatchers() throws Exception {
-	 Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-	 Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-	vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
-		false, 100, 10, false, false, null, true, 2, OrderPolicy.KEY ));
-	vm5.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
-		false, 100, 10, false, false, null, true, 2, OrderPolicy.KEY ));
-
-	vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-		testName + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-		testName + "_RR", "ln", isOffHeap()  ));
-	vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-		testName + "_RR", "ln", isOffHeap()  ));
-	vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-		testName + "_RR", "ln", isOffHeap()  ));
-	vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-		testName + "_RR", "ln", isOffHeap()  ));
-
-	vm5.invoke(() -> WANTestBase.doPuts( testName + "_RR",
-		1000 ));
-
-	vm2.invoke(() -> WANTestBase.validateRegionSize(
-		testName + "_RR", 1000 ));
-	    
-	pause(2000);
-	vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
-	    
-	vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
-		0, 1000, 1000, 1000));
-	vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
-		100));
-	    
-	vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
-		0, 1000, 0, 0));
-	vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
-		0));
-	    
-	  }
-  
-  @Test
-  public void testWANStatsTwoWanSites() throws Exception {
-
-    Integer lnPort = createFirstLocatorWithDSId(1);
-    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    createCacheInVMs(tkPort, vm3);
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("lnSerial1", vm4, vm5);
-    startSenderInVMs("lnSerial2", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        testName + "_RR", 1000 ));
-    
-    pause(2000);
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
-    vm3.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.checkQueueStats("lnSerial1",
-      0, 1000, 1000, 1000));
-    vm4.invoke(() -> WANTestBase.checkBatchStats("lnSerial1",
-      100));
-    vm4.invoke(() -> WANTestBase.checkQueueStats("lnSerial2",
-      0, 1000, 1000, 1000));
-    vm4.invoke(() -> WANTestBase.checkBatchStats("lnSerial2",
-      100));
-    vm5.invoke(() -> WANTestBase.checkQueueStats("lnSerial1",
-      0, 1000, 0, 0));
-    vm5.invoke(() -> WANTestBase.checkBatchStats("lnSerial1",
-      0));
-    vm5.invoke(() -> WANTestBase.checkQueueStats("lnSerial2",
-      0, 1000, 0, 0));
-    vm5.invoke(() -> WANTestBase.checkBatchStats("lnSerial2",
-      0));
-    
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationHA() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR", "ln", isOffHeap()  ));
-    
-    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( testName + "_RR", 10000 ));
-    pause(2000);
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender( "ln" ));
-    Boolean isKilled = Boolean.FALSE;
-    try {
-      isKilled = (Boolean)inv2.getResult();
-    }
-    catch (Throwable e) {
-      fail("Unexpected exception while killing a sender");
-    }
-    AsyncInvocation inv3 = null; 
-    if(!isKilled){
-      inv3 = vm5.invokeAsync(() -> WANTestBase.killSender( "ln" ));
-      inv3.join();
-    }
-    inv1.join();
-    inv2.join();
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName + "_RR", 10000 ));
-  
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStatsHA(1000, 10000, 10000 ));
-    
-    vm5.invoke(() -> WANTestBase.checkStats_Failover("ln", 10000));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationUnprocessedEvents() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 20, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 20, false, false, null, true ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", null, isOffHeap()  ));
-
-    //create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_2", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_2", null, isOffHeap()  ));
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-
-    //create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_2", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_2", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_2", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_2", "ln", isOffHeap()  ));
-    
-    //start puts in RR_1 in another thread
-    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR_1", 1000 ));
-    //do puts in RR_2 in main thread
-    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR_2", 500 ));
-    //sleep for some time to let all the events propagate to remote site
-    Thread.sleep(20);
-    //vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName + "_RR_1", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        testName + "_RR_2", 500 ));
-    
-    pause(2000);
-    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 1500, 1500, 1500));
-    vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
-      75));
-    vm4.invoke(() -> WANTestBase.checkUnProcessedStats("ln", 0));
-    
-    
-    vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 1500, 0, 0));
-    vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
-      0));
-    vm5.invoke(() -> WANTestBase.checkUnProcessedStats("ln", 1500));
-  }
-  
-  /**
-   * 
-   * Not Disabled - see ticket #52118
-   *
-   * NOTE: The test failure is avoided by having a larger number of puts operation so
-   * that WANTestBase.verifyRegionQueueNotEmpty("ln" )) is successful as there is a
-   * significant delay during the high number of puts.
-   *
-   * In future if this failure reappears, the put operations must be increase or a better fix must be found.
-   * 
-   * 1 region and sender configured on local site and 1 region and a 
-   * receiver configured on remote site. Puts to the local region are in progress.
-   * Remote region is destroyed in the middle.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy() throws Exception {
-  int numEntries = 20000;
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    //these are part of local site
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 100, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 100, false, false, null, true ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", null, isOffHeap()  ));
-    //This is to cause a scenario where we have received at least X events and want to slow the receiver
-    vm2.invoke(() -> WANTestBase.longPauseAfterNumEvents(500, 200));
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        testName + "_RR_1", "ln", isOffHeap()  ));
-
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( testName + "_RR_1", numEntries ));
-    //destroy RR_1 in remote site
-    vm2.invoke(() -> WANTestBase.destroyRegion( testName + "_RR_1", 500));
-
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-
-    //assuming some events might have been dispatched before the remote region was destroyed,
-    //sender's region queue will have events less than 1000 but the queue will not be empty.
-    //NOTE: this much verification might be sufficient in DUnit. Hydra will take care of 
-    //more in depth validations.
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty("ln" ));
-
-    //verify that all is well in local site. All the events should be present in local region
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      testName + "_RR_1", numEntries ));
-
-    //like a latch to guarantee at least one exception returned
-    vm4.invoke(() -> Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> WANTestBase.verifyQueueSize("ln", 0)));
-    
-    vm4.invoke(() -> WANTestBase.checkBatchStats("ln", true, true));
-    
-    vm5.invoke(() -> WANTestBase.checkUnProcessedStats("ln", numEntries));
-    
-    vm2.invoke(() -> WANTestBase.checkExceptionStats(1));
-    
-  }
-  
-  @Test
-  public void testSerialPropagationWithFilter() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, null, 1, 100, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( testName, 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, 800 ));
-    
-    pause(2000);
-    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 1000, 900, 800));
-    vm4.invoke(() -> WANTestBase.checkEventFilteredStats("ln",
-      200));
-    vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
-      80));
-    vm4.invoke(() -> WANTestBase.checkUnProcessedStats("ln", 0));
-    
-    
-    vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 1000, 0, 0));
-    vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
-      0));
-    vm5.invoke(() -> WANTestBase.checkUnProcessedStats("ln",900));
-  }
-  
-  @Test
-  public void testSerialPropagationConflation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, true, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 0, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 0, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 0, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", 0, 100, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, null,1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, null,1, 100, isOffHeap()  ));
-
-    final Map keyValues = new HashMap();
-    final Map updateKeyValues = new HashMap();
-    for(int i=0; i< 1000; i++) {
-      keyValues.put(i, i);
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, keyValues ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() ));
-    for(int i=0;i<500;i++) {
-      updateKeyValues.put(i, i+"_updated");
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size()  + updateKeyValues.size() ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, 0 ));
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size()  + updateKeyValues.size() ));
-
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-
-    keyValues.putAll(updateKeyValues);
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, keyValues.size() ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      testName, keyValues.size() ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionContents(
-        testName, keyValues ));
-    vm3.invoke(() -> WANTestBase.validateRegionContents(
-        testName, keyValues ));
-    
-    pause(2000);
-    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
-      0, 2000, 2000, 1500));
-    vm4.invoke(() -> WANTestBase.checkConflatedStats("ln",
-      500));
-  }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
deleted file mode 100644
index f9b46ef..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.wan.*;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
-import com.gemstone.gemfire.test.dunit.*;
-
-import javax.management.remote.JMXConnectorServer;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.assertEquals;
-import static com.gemstone.gemfire.test.dunit.Assert.fail;
-
-public abstract class WANCommandTestBase extends CliCommandTestBase {
-
-  static Cache cache;
-  private JMXConnectorServer jmxConnectorServer;
-  private ManagementService managementService;
-//  public String jmxHost;
-//  public int jmxPort;
-
-  static VM vm0;
-  static VM vm1;
-  static VM vm2;
-  static VM vm3;
-  static VM vm4;
-  static VM vm5;
-  static VM vm6;
-  static VM vm7;
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    final Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    vm2 = host.getVM(2);
-    vm3 = host.getVM(3);
-    vm4 = host.getVM(4);
-    vm5 = host.getVM(5);
-    vm6 = host.getVM(6);
-    vm7 = host.getVM(7);
-    enableManagement();
-  }
-
-  public Integer createFirstLocatorWithDSId(int dsId) {
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-    return port;
-  }
-
-  public Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    getSystem(props);
-    return port;
-  }
-
-  public void createCache(Integer locPort){
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-  }
-
-  public void createCacheWithGroups(Integer locPort, String groups){
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
-    props.setProperty(GROUPS, groups);
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-  }
-
-  public void createSender(String dsName, int remoteDsId,
-      boolean isParallel, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isPersistent,
-      GatewayEventFilter filter, boolean isManualStart) {
-    File persistentDirectory = new File(dsName +"_disk_"+System.currentTimeMillis()+"_" + VM.getCurrentVMNum());
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File [] dirs1 = new File[] {persistentDirectory};
-    if(isParallel) {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      if(isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsId);
-
-    }else {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      if(isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.create(dsName, remoteDsId);
-    }
-  }
-
-  public void startSender(String senderId){
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      GatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = s;
-          break;
-        }
-      }
-      sender.start();
-    } finally {
-      exln.remove();
-    }
-  }
-
-  public void pauseSender(String senderId){
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      GatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = s;
-          break;
-        }
-      }
-      sender.pause();
-    } finally {
-      exln.remove();
-    }
-  }
-
-  public int createAndStartReceiver(int locPort) {
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-         receiver.start();
-    } catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + getName() + " failed to start GatewayReceiver");
-    }
-    return port;
-  }
-
-  public int createReceiver(int locPort) {
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
-    fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    return receiver.getPort();
-  }
-
-  public int createReceiverWithGroup(int locPort, String groups) {
-    Properties props =  getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-    props.setProperty(GROUPS, groups);
-
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
-    fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    return receiver.getPort();
-
-  }
-
-  public void startReceiver() {
-    try {
-      Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-      for (GatewayReceiver receiver : receivers) {
-        receiver.start();
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + getName() + " failed to start GatewayReceiver");
-    }
-  }
-
-  public void stopReceiver() {
-    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-    for (GatewayReceiver receiver : receivers) {
-      receiver.stop();
-    }
-  }
-
-  public int createAndStartReceiverWithGroup(int locPort, String groups) {
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-    props.setProperty(GROUPS, groups);
-
-    InternalDistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    } catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + getName() + " failed to start GatewayReceiver on port " + port);
-    }
-    return port;
-  }
-
-  public DistributedMember getMember(){
-    return cache.getDistributedSystem().getDistributedMember();
-  }
-
-
-  public int getLocatorPort(){
-    return Locator.getLocators().get(0).getPort();
-  }
-
-  /**
-   * Enable system property gemfire.disableManagement false in each VM.
-   */
-  public void enableManagement() {
-    Invoke.invokeInEveryVM(new SerializableRunnable("Enable Management") {
-      public void run() {
-        System.setProperty(InternalDistributedSystem.DISABLE_MANAGEMENT_PROPERTY, "false");
-      }
-    });
-
-  }
-
-  public void verifySenderState(String senderId, boolean isRunning, boolean isPaused) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      AbstractGatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = (AbstractGatewaySender) s;
-          break;
-        }
-      }
-
-      assertEquals(isRunning, sender.isRunning());
-      assertEquals(isPaused, sender.isPaused());
-    } finally {
-      exln.remove();
-    }
-  }
-
-  public void verifySenderAttributes(String senderId, int remoteDsID,
-      boolean isParallel, boolean manualStart, int socketBufferSize,
-      int socketReadTimeout, boolean enableBatchConflation, int batchSize,
-      int batchTimeInterval, boolean enablePersistence,
-      boolean diskSynchronous, int maxQueueMemory, int alertThreshold,
-      int dispatcherThreads, OrderPolicy orderPolicy,
-      List<String> expectedGatewayEventFilters,
-      List<String> expectedGatewayTransportFilters) {
-
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertEquals("remoteDistributedSystemId", remoteDsID, sender
-        .getRemoteDSId());
-    assertEquals("isParallel", isParallel, sender.isParallel());
-    assertEquals("manualStart", manualStart, sender.isManualStart());
-    assertEquals("socketBufferSize", socketBufferSize, sender
-        .getSocketBufferSize());
-    assertEquals("socketReadTimeout", socketReadTimeout, sender
-        .getSocketReadTimeout());
-    assertEquals("enableBatchConflation", enableBatchConflation, sender
-        .isBatchConflationEnabled());
-    assertEquals("batchSize", batchSize, sender.getBatchSize());
-    assertEquals("batchTimeInterval", batchTimeInterval, sender
-        .getBatchTimeInterval());
-    assertEquals("enablePersistence", enablePersistence, sender
-        .isPersistenceEnabled());
-    assertEquals("diskSynchronous", diskSynchronous, sender.isDiskSynchronous());
-    assertEquals("maxQueueMemory", maxQueueMemory, sender
-        .getMaximumQueueMemory());
-    assertEquals("alertThreshold", alertThreshold, sender.getAlertThreshold());
-    assertEquals("dispatcherThreads", dispatcherThreads, sender
-        .getDispatcherThreads());
-    assertEquals("orderPolicy", orderPolicy, sender.getOrderPolicy());
-
-    // verify GatewayEventFilters
-    if (expectedGatewayEventFilters != null) {
-      assertEquals("gatewayEventFilters", expectedGatewayEventFilters.size(),
-          sender.getGatewayEventFilters().size());
-
-      List<GatewayEventFilter> actualGatewayEventFilters = sender
-          .getGatewayEventFilters();
-      List<String> actualEventFilterClassNames = new ArrayList<String>(
-          actualGatewayEventFilters.size());
-      for (GatewayEventFilter filter : actualGatewayEventFilters) {
-        actualEventFilterClassNames.add(filter.getClass().getName());
-      }
-
-      for (String expectedGatewayEventFilter : expectedGatewayEventFilters) {
-        if (!actualEventFilterClassNames.contains(expectedGatewayEventFilter)) {
-          fail("GatewayEventFilter " + expectedGatewayEventFilter
-              + " is not added to the GatewaySender");
-        }
-      }
-    }
-
-    // verify GatewayTransportFilters
-    if (expectedGatewayTransportFilters != null) {
-      assertEquals("gatewayTransportFilters", expectedGatewayTransportFilters
-          .size(), sender.getGatewayTransportFilters().size());
-      List<GatewayTransportFilter> actualGatewayTransportFilters = sender
-          .getGatewayTransportFilters();
-      List<String> actualTransportFilterClassNames = new ArrayList<String>(
-          actualGatewayTransportFilters.size());
-      for (GatewayTransportFilter filter : actualGatewayTransportFilters) {
-        actualTransportFilterClassNames.add(filter.getClass().getName());
-      }
-
-      for (String expectedGatewayTransportFilter : expectedGatewayTransportFilters) {
-        if (!actualTransportFilterClassNames
-            .contains(expectedGatewayTransportFilter)) {
-          fail("GatewayTransportFilter " + expectedGatewayTransportFilter
-              + " is not added to the GatewaySender.");
-        }
-      }
-    }
-  }
-
-  public void verifyReceiverState(boolean isRunning) {
-    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-    for (GatewayReceiver receiver : receivers) {
-      assertEquals(isRunning, receiver.isRunning());
-    }
-  }
-
-  public void verifyReceiverCreationWithAttributes(boolean isRunning,
-      int startPort, int endPort, String bindAddress, int maxTimeBetweenPings,
-      int socketBufferSize, List<String> expectedGatewayTransportFilters) {
-
-    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-    assertEquals("Number of receivers is incorrect", 1, receivers.size());
-    for (GatewayReceiver receiver : receivers) {
-      assertEquals("isRunning", isRunning, receiver.isRunning());
-      assertEquals("startPort", startPort, receiver.getStartPort());
-      assertEquals("endPort", endPort, receiver.getEndPort());
-      assertEquals("bindAddress", bindAddress, receiver.getBindAddress());
-      assertEquals("maximumTimeBetweenPings", maxTimeBetweenPings, receiver
-          .getMaximumTimeBetweenPings());
-      assertEquals("socketBufferSize", socketBufferSize, receiver
-          .getSocketBufferSize());
-
-      // verify GatewayTransportFilters
-      if (expectedGatewayTransportFilters != null) {
-        assertEquals("gatewayTransportFilters", expectedGatewayTransportFilters
-            .size(), receiver.getGatewayTransportFilters().size());
-        List<GatewayTransportFilter> actualGatewayTransportFilters = receiver
-            .getGatewayTransportFilters();
-        List<String> actualTransportFilterClassNames = new ArrayList<String>(
-            actualGatewayTransportFilters.size());
-        for (GatewayTransportFilter filter : actualGatewayTransportFilters) {
-          actualTransportFilterClassNames.add(filter.getClass().getName());
-        }
-
-        for (String expectedGatewayTransportFilter : expectedGatewayTransportFilters) {
-          if (!actualTransportFilterClassNames
-              .contains(expectedGatewayTransportFilter)) {
-            fail("GatewayTransportFilter " + expectedGatewayTransportFilter
-                + " is not added to the GatewayReceiver.");
-          }
-        }
-      }
-    }
-  }
-
-  @Override
-  public final void postTearDownCacheTestCase() throws Exception {
-    closeCacheAndDisconnect();
-    vm0.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm1.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm2.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm3.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm4.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm5.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm6.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-    vm7.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
-  }
-
-  public static void closeCacheAndDisconnect() {
-    if (cache != null && !cache.isClosed()) {
-      cache.close();
-      cache.getDistributedSystem().disconnect();
-    }
-  }
-}


[52/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/05e6d966
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/05e6d966
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/05e6d966

Branch: refs/heads/feature/GEODE-37_2
Commit: 05e6d966a2244ef48beb7e45f6b58b5b32a5b97d
Parents: c47228e
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Sep 13 15:43:20 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Tue Sep 13 15:43:20 2016 -0700

----------------------------------------------------------------------
 .../gemfire/cache/lucene/LuceneIndex.java       |  66 ---
 .../gemfire/cache/lucene/LuceneQuery.java       |  66 ---
 .../cache/lucene/LuceneQueryException.java      |  40 --
 .../cache/lucene/LuceneQueryFactory.java        |  98 ----
 .../cache/lucene/LuceneQueryProvider.java       |  47 --
 .../cache/lucene/LuceneResultStruct.java        |  61 ---
 .../gemfire/cache/lucene/LuceneService.java     | 129 -----
 .../cache/lucene/LuceneServiceProvider.java     |  45 --
 .../lucene/PageableLuceneQueryResults.java      |  58 ---
 .../AbstractPartitionedRepositoryManager.java   | 124 -----
 .../cache/lucene/internal/IndexListener.java    |  35 --
 .../lucene/internal/IndexListenerAdapter.java   |  41 --
 .../lucene/internal/IndexRepositoryFactory.java |  66 ---
 .../lucene/internal/InternalLuceneIndex.java    |  34 --
 .../lucene/internal/InternalLuceneService.java  |  29 --
 .../lucene/internal/LuceneEventListener.java    | 107 -----
 .../internal/LuceneIndexCreationProfile.java    | 172 -------
 .../lucene/internal/LuceneIndexFactory.java     |  30 --
 .../LuceneIndexForPartitionedRegion.java        | 176 -------
 .../cache/lucene/internal/LuceneIndexImpl.java  | 236 ----------
 .../cache/lucene/internal/LuceneIndexStats.java | 202 --------
 .../lucene/internal/LuceneQueryFactoryImpl.java |  71 ---
 .../cache/lucene/internal/LuceneQueryImpl.java  | 148 ------
 .../cache/lucene/internal/LuceneRawIndex.java   |  43 --
 .../lucene/internal/LuceneRawIndexFactory.java  |  27 --
 .../lucene/internal/LuceneResultStructImpl.java |  94 ----
 .../lucene/internal/LuceneServiceImpl.java      | 334 -------------
 .../PageableLuceneQueryResultsImpl.java         | 147 ------
 .../internal/PartitionedRepositoryManager.java  |  50 --
 .../internal/RawIndexRepositoryFactory.java     |  63 ---
 .../internal/RawLuceneRepositoryManager.java    |  46 --
 .../lucene/internal/StringQueryProvider.java    | 116 -----
 .../lucene/internal/cli/LuceneCliStrings.java   |  79 ----
 .../internal/cli/LuceneIndexCommands.java       | 470 -------------------
 .../lucene/internal/cli/LuceneIndexDetails.java | 153 ------
 .../lucene/internal/cli/LuceneIndexInfo.java    |  63 ---
 .../lucene/internal/cli/LuceneQueryInfo.java    |  70 ---
 .../internal/cli/LuceneSearchResults.java       |  76 ---
 .../functions/LuceneCreateIndexFunction.java    | 112 -----
 .../functions/LuceneDescribeIndexFunction.java  |  74 ---
 .../cli/functions/LuceneListIndexFunction.java  |  71 ---
 .../functions/LuceneSearchIndexFunction.java    | 107 -----
 .../internal/directory/DumpDirectoryFiles.java  | 116 -----
 .../internal/directory/FileIndexInput.java      | 131 ------
 .../internal/directory/RegionDirectory.java     | 132 ------
 .../lucene/internal/directory/package-info.java |  23 -
 .../internal/distributed/CollectorManager.java  |  54 ---
 .../lucene/internal/distributed/EntryScore.java |  84 ----
 .../internal/distributed/LuceneFunction.java    | 126 -----
 .../distributed/LuceneFunctionContext.java      | 115 -----
 .../lucene/internal/distributed/TopEntries.java | 135 ------
 .../distributed/TopEntriesCollector.java        | 102 ----
 .../distributed/TopEntriesCollectorManager.java | 178 -------
 .../TopEntriesFunctionCollector.java            | 158 -------
 .../internal/distributed/package-info.java      |  25 -
 .../lucene/internal/filesystem/ChunkKey.java    | 123 -----
 .../cache/lucene/internal/filesystem/File.java  | 170 -------
 .../internal/filesystem/FileInputStream.java    | 166 -------
 .../internal/filesystem/FileOutputStream.java   | 103 ----
 .../lucene/internal/filesystem/FileSystem.java  | 196 --------
 .../internal/filesystem/FileSystemStats.java    | 128 -----
 .../filesystem/SeekableInputStream.java         |  43 --
 .../internal/filesystem/package-info.java       |  26 -
 .../internal/management/LuceneIndexMetrics.java | 218 ---------
 .../management/LuceneIndexStatsMonitor.java     |  93 ----
 .../management/LuceneServiceBridge.java         |  86 ----
 .../internal/management/LuceneServiceMBean.java |  62 ---
 .../management/LuceneServiceMXBean.java         |  59 ---
 .../management/ManagementIndexListener.java     |  38 --
 .../lucene/internal/management/StatsKey.java    |  35 --
 .../cache/lucene/internal/package-info.java     |  23 -
 .../internal/repository/IndexRepository.java    |  89 ----
 .../repository/IndexRepositoryImpl.java         | 182 -------
 .../repository/IndexResultCollector.java        |  47 --
 .../internal/repository/RepositoryManager.java  |  44 --
 .../internal/repository/package-info.java       |  25 -
 .../HeterogeneousLuceneSerializer.java          | 107 -----
 .../repository/serializer/LuceneSerializer.java |  35 --
 .../serializer/PdxLuceneSerializer.java         |  57 ---
 .../serializer/PrimitiveSerializer.java         |  35 --
 .../serializer/ReflectionLuceneSerializer.java  |  85 ----
 .../repository/serializer/SerializerUtil.java   | 190 --------
 .../repository/serializer/package-info.java     |  23 -
 .../internal/xml/LuceneIndexCreation.java       | 113 -----
 .../internal/xml/LuceneIndexXmlGenerator.java   |  70 ---
 .../internal/xml/LuceneServiceXmlGenerator.java |  39 --
 .../lucene/internal/xml/LuceneXmlConstants.java |  32 --
 .../lucene/internal/xml/LuceneXmlParser.java    | 119 -----
 .../cache/lucene/internal/xml/package-info.java |  24 -
 .../gemfire/cache/lucene/package-info.java      |  32 --
 .../apache/geode/cache/lucene/LuceneIndex.java  |  66 +++
 .../apache/geode/cache/lucene/LuceneQuery.java  |  66 +++
 .../cache/lucene/LuceneQueryException.java      |  40 ++
 .../geode/cache/lucene/LuceneQueryFactory.java  |  98 ++++
 .../geode/cache/lucene/LuceneQueryProvider.java |  47 ++
 .../geode/cache/lucene/LuceneResultStruct.java  |  61 +++
 .../geode/cache/lucene/LuceneService.java       | 129 +++++
 .../cache/lucene/LuceneServiceProvider.java     |  45 ++
 .../lucene/PageableLuceneQueryResults.java      |  58 +++
 .../AbstractPartitionedRepositoryManager.java   | 124 +++++
 .../cache/lucene/internal/IndexListener.java    |  35 ++
 .../lucene/internal/IndexListenerAdapter.java   |  41 ++
 .../lucene/internal/IndexRepositoryFactory.java |  66 +++
 .../lucene/internal/InternalLuceneIndex.java    |  34 ++
 .../lucene/internal/InternalLuceneService.java  |  29 ++
 .../lucene/internal/LuceneEventListener.java    | 107 +++++
 .../internal/LuceneIndexCreationProfile.java    | 172 +++++++
 .../lucene/internal/LuceneIndexFactory.java     |  30 ++
 .../LuceneIndexForPartitionedRegion.java        | 176 +++++++
 .../cache/lucene/internal/LuceneIndexImpl.java  | 236 ++++++++++
 .../cache/lucene/internal/LuceneIndexStats.java | 202 ++++++++
 .../lucene/internal/LuceneQueryFactoryImpl.java |  71 +++
 .../cache/lucene/internal/LuceneQueryImpl.java  | 148 ++++++
 .../cache/lucene/internal/LuceneRawIndex.java   |  43 ++
 .../lucene/internal/LuceneRawIndexFactory.java  |  27 ++
 .../lucene/internal/LuceneResultStructImpl.java |  94 ++++
 .../lucene/internal/LuceneServiceImpl.java      | 334 +++++++++++++
 .../PageableLuceneQueryResultsImpl.java         | 147 ++++++
 .../internal/PartitionedRepositoryManager.java  |  50 ++
 .../internal/RawIndexRepositoryFactory.java     |  63 +++
 .../internal/RawLuceneRepositoryManager.java    |  46 ++
 .../lucene/internal/StringQueryProvider.java    | 116 +++++
 .../lucene/internal/cli/LuceneCliStrings.java   |  79 ++++
 .../internal/cli/LuceneIndexCommands.java       | 470 +++++++++++++++++++
 .../lucene/internal/cli/LuceneIndexDetails.java | 153 ++++++
 .../lucene/internal/cli/LuceneIndexInfo.java    |  63 +++
 .../lucene/internal/cli/LuceneQueryInfo.java    |  70 +++
 .../internal/cli/LuceneSearchResults.java       |  76 +++
 .../functions/LuceneCreateIndexFunction.java    | 112 +++++
 .../functions/LuceneDescribeIndexFunction.java  |  74 +++
 .../cli/functions/LuceneListIndexFunction.java  |  71 +++
 .../functions/LuceneSearchIndexFunction.java    | 107 +++++
 .../internal/directory/DumpDirectoryFiles.java  | 116 +++++
 .../internal/directory/FileIndexInput.java      | 131 ++++++
 .../internal/directory/RegionDirectory.java     | 132 ++++++
 .../lucene/internal/directory/package-info.java |  23 +
 .../internal/distributed/CollectorManager.java  |  54 +++
 .../lucene/internal/distributed/EntryScore.java |  84 ++++
 .../internal/distributed/LuceneFunction.java    | 126 +++++
 .../distributed/LuceneFunctionContext.java      | 115 +++++
 .../lucene/internal/distributed/TopEntries.java | 135 ++++++
 .../distributed/TopEntriesCollector.java        | 102 ++++
 .../distributed/TopEntriesCollectorManager.java | 178 +++++++
 .../TopEntriesFunctionCollector.java            | 158 +++++++
 .../internal/distributed/package-info.java      |  25 +
 .../lucene/internal/filesystem/ChunkKey.java    | 123 +++++
 .../cache/lucene/internal/filesystem/File.java  | 170 +++++++
 .../internal/filesystem/FileInputStream.java    | 166 +++++++
 .../internal/filesystem/FileOutputStream.java   | 103 ++++
 .../lucene/internal/filesystem/FileSystem.java  | 196 ++++++++
 .../internal/filesystem/FileSystemStats.java    | 128 +++++
 .../filesystem/SeekableInputStream.java         |  43 ++
 .../internal/filesystem/package-info.java       |  26 +
 .../internal/management/LuceneIndexMetrics.java | 218 +++++++++
 .../management/LuceneIndexStatsMonitor.java     |  93 ++++
 .../management/LuceneServiceBridge.java         |  86 ++++
 .../internal/management/LuceneServiceMBean.java |  62 +++
 .../management/LuceneServiceMXBean.java         |  59 +++
 .../management/ManagementIndexListener.java     |  38 ++
 .../lucene/internal/management/StatsKey.java    |  35 ++
 .../cache/lucene/internal/package-info.java     |  23 +
 .../internal/repository/IndexRepository.java    |  89 ++++
 .../repository/IndexRepositoryImpl.java         | 182 +++++++
 .../repository/IndexResultCollector.java        |  47 ++
 .../internal/repository/RepositoryManager.java  |  44 ++
 .../internal/repository/package-info.java       |  25 +
 .../HeterogeneousLuceneSerializer.java          | 107 +++++
 .../repository/serializer/LuceneSerializer.java |  35 ++
 .../serializer/PdxLuceneSerializer.java         |  57 +++
 .../serializer/PrimitiveSerializer.java         |  35 ++
 .../serializer/ReflectionLuceneSerializer.java  |  85 ++++
 .../repository/serializer/SerializerUtil.java   | 190 ++++++++
 .../repository/serializer/package-info.java     |  23 +
 .../internal/xml/LuceneIndexCreation.java       | 113 +++++
 .../internal/xml/LuceneIndexXmlGenerator.java   |  70 +++
 .../internal/xml/LuceneServiceXmlGenerator.java |  39 ++
 .../lucene/internal/xml/LuceneXmlConstants.java |  32 ++
 .../lucene/internal/xml/LuceneXmlParser.java    | 119 +++++
 .../cache/lucene/internal/xml/package-info.java |  24 +
 .../apache/geode/cache/lucene/package-info.java |  32 ++
 180 files changed, 8572 insertions(+), 8572 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
deleted file mode 100644
index 6b1a4b4..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.lucene;
-
-import java.util.Map;
-
-import org.apache.lucene.analysis.Analyzer;
-
-import com.gemstone.gemfire.annotations.Experimental;
-
-
-/**
- * An lucene index is built over the data stored in a GemFire Region.
- * <p>
- * An index is specified using a index name, field names, region name.
- * <p>
- * The index name and region name together uniquely identifies the lucene index.
- * <p>
- * 
- */
-@Experimental
-public interface LuceneIndex {
-
-  /**
-   * @return the index name of this index
-   */
-  public String getName();
-
-  /**
-   * @return the region name for this index
-   */
-  public String getRegionPath();
-      
-  /**
-   * @return the indexed field names in a Set
-   */
-  public String[] getFieldNames();
-  
-  /**
-   * @return the field to analyzer map
-   */
-  public Map<String, Analyzer> getFieldAnalyzers();
-  
-  /* 
-   * wait until the current entries in cache are indexed
-   * @param maxWaitInMilliseconds max wait time in millisecond
-   * @return if entries are flushed within maxWait
-   */
-  public boolean waitUntilFlushed(int maxWaitInMillisecond);
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java
deleted file mode 100644
index 7cc0977..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.lucene;
-
-import java.util.Collection;
-import java.util.List;
-
-import com.gemstone.gemfire.annotations.Experimental;
-
-/**
- * Provides wrapper object of Lucene's Query object and execute the search. 
- * <p>Instances of this interface are created using
- * {@link LuceneQueryFactory#create}.
- * 
- */
-@Experimental
-public interface LuceneQuery<K, V> {
-  /**
-   * Execute search and return keys.
-   */
-  public Collection<K> findKeys() throws LuceneQueryException;
-
-  /**
-   * Execute search and return values.
-   */
-  public Collection<V> findValues() throws LuceneQueryException;
-
-  /**
-   * Execute search and return list of LuceneResultStruct.
-   */
-  public List<LuceneResultStruct<K, V>> findResults() throws LuceneQueryException;
-  /**
-   * Execute the search and get results. 
-   */
-  public PageableLuceneQueryResults<K, V> findPages() throws LuceneQueryException;
-  
-  /**
-   * Get page size setting of current query. 
-   */
-  public int getPageSize();
-  
-  /**
-   * Get limit size setting of current query. 
-   */
-  public int getLimit();
-
-  /**
-   * Get projected fields setting of current query. 
-   */
-  public String[] getProjectedFieldNames();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryException.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryException.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryException.java
deleted file mode 100644
index fb03b4a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.lucene;
-
-import com.gemstone.gemfire.GemFireCheckedException;
-
-/**
- * Thrown when a lucene query fails.
- */
-public class LuceneQueryException extends GemFireCheckedException {
-
-  public LuceneQueryException(final String message) {
-    super(message);
-  }
-
-  public LuceneQueryException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-  public LuceneQueryException(final Throwable cause) {
-    super(cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java
deleted file mode 100644
index 8e36bbb..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.lucene;
-
-import org.apache.lucene.queryparser.classic.ParseException;
-
-import com.gemstone.gemfire.annotations.Experimental;
-
-/**
- * Factory for creating instances of {@link LuceneQuery}.
- * To get an instance of this factory call {@link LuceneService#createLuceneQueryFactory}.
- * <P>
- * To use this factory configure it with the <code>set</code> methods and then
- * call {@link #create} to produce a {@link LuceneQuery} instance.
- * 
- */
-@Experimental
-public interface LuceneQueryFactory {
-  
-  /**
-   * Default query result limit is 100
-   */
-  public static final int DEFAULT_LIMIT = 100;
-  
-  /**
-   *  Default page size of result is 0, which means no pagination
-   */
-  public static final int DEFAULT_PAGESIZE = 0;
-  
-  /**
-   * Set page size for a query result. The default page size is 0 which means no pagination.
-   * If specified negative value, throw IllegalArgumentException
-   * @param pageSize
-   * @return itself
-   */
-  LuceneQueryFactory setPageSize(int pageSize);
-  
-  /**
-   * Set max limit of result for a query
-   * If specified limit is less or equal to zero, throw IllegalArgumentException
-   * @param limit
-   * @return itself
-   */
-  LuceneQueryFactory setResultLimit(int limit);
-  
-  /**
-   * Set a list of fields for result projection.
-   * 
-   * @param fieldNames
-   * @return itself
-   * 
-   * @deprecated TODO This feature is not yet implemented
-   */
-  @Deprecated
-  LuceneQueryFactory setProjectionFields(String... fieldNames);
-  
-  /**
-   * Create wrapper object for lucene's QueryParser object using default standard analyzer.
-   * The queryString is using lucene QueryParser's syntax. QueryParser is for easy-to-use 
-   * with human understandable syntax. 
-   *  
-   * @param regionName region name
-   * @param indexName index name
-   * @param queryString query string in lucene QueryParser's syntax
-   * @param defaultField default field used by the Lucene Query Parser
-   * @param <K> the key type in the query results
-   * @param <V> the value type in the query results
-   * @return LuceneQuery object
-   */
-  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, String queryString, String defaultField);
-
-  /**
-   * Creates a wrapper object for Lucene's Query object. This {@link LuceneQuery} builder method could be used in
-   * advanced cases, such as cases where Lucene's Query object construction needs Lucene's API over query string.
-   * 
-   * @param indexName index name
-   * @param regionName region name
-   * @param provider constructs and provides a Lucene Query object
-   * @param <K> the key type in the query results
-   * @param <V> the value type in the query results
-   * @return LuceneQuery object
-   */
-  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, LuceneQueryProvider provider);
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryProvider.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryProvider.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryProvider.java
deleted file mode 100644
index 7f1c269..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.lucene;
-
-import java.io.Serializable;
-
-import org.apache.lucene.search.Query;
-
-import com.gemstone.gemfire.annotations.Experimental;
-import com.gemstone.gemfire.cache.query.QueryException;
-
-/**
- * The instances of this class will be used for distributing Lucene Query objects and re-constructing the Query object.
- * If necessary the implementation needs to take care of serializing and de-serializing Lucene Query object. Geode
- * respects the DataSerializable contract to provide optimal object serialization. For instance,
- * {@link LuceneQueryProvider}'s toData method will be used to serialize it when it is sent to another member of the
- * distributed system. Implementation of DataSerializable can provide a zero-argument constructor that will be invoked
- * when they are read with DataSerializer.readObject.
- */
-@Experimental
-public interface LuceneQueryProvider extends Serializable {
-  /**
-   * @return A Lucene Query object which could be used for executing Lucene Search on indexed data
-   * @param index local lucene index the query is being constructed against.
-   * @throws LuceneQueryException if the provider fails to construct the query object
-   */
-
-  public Query getQuery(LuceneIndex index) throws LuceneQueryException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java
deleted file mode 100644
index bc587f5..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.lucene;
-
-import com.gemstone.gemfire.annotations.Experimental;
-
-/**
- * <p>
- * Abstract data structure for one item in query result.
- * 
- */
-@Experimental
-public interface LuceneResultStruct<K, V> {
-  /**
-   * Return the value associated with the given field name
-   *
-   * @param fieldName the String name of the field
-   * @return the value associated with the specified field
-   * @throws IllegalArgumentException If this struct does not have a field named fieldName
-   */
-  public Object getProjectedField(String fieldName);
-  
-  /**
-   * Return key of the entry
-   *
-   * @return key
-   * @throws IllegalArgumentException If this struct does not contain key
-   */
-  public K getKey();
-  
-  /**
-   * Return value of the entry
-   *
-   * @return value the whole domain object
-   * @throws IllegalArgumentException If this struct does not contain value
-   */
-  public V getValue();
-  
-  /**
-   * Return score of the query 
-   *
-   * @return score
-   * @throws IllegalArgumentException If this struct does not contain score
-   */
-  public float getScore();
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
deleted file mode 100644
index cf1f735..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.lucene;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.lucene.analysis.Analyzer;
-
-import com.gemstone.gemfire.annotations.Experimental;
-import com.gemstone.gemfire.cache.GemFireCache;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
-
-/**
- * LuceneService instance is a singleton for each cache.
- * 
- * It provides handle for managing the {@link LuceneIndex} and create the {@link LuceneQuery}
- * via {@link LuceneQueryFactory}
- * 
- * </p>
- * Example: <br>
- * 
- * <pre>
- * At client and server JVM, initializing cache will create the LuceneServiceImpl object, 
- * which is a singleton at each JVM. 
- * 
- * At each server JVM, for data region to create index, create the index on fields with default analyzer:
- * LuceneIndex index = luceneService.createIndex(indexName, regionName, "field1", "field2", "field3"); 
- * or create index on fields with specified analyzer:
- * LuceneIndex index = luceneService.createIndex(indexName, regionName, analyzerPerField);
- * 
- * We can also create index via cache.xml or gfsh.
- * 
- * At client side, create query and run the search:
- * 
- * LuceneQuery query = luceneService.createLuceneQueryFactory().setLimit(200).setPageSize(20)
- * .setResultTypes(SCORE, VALUE, KEY).setFieldProjection("field1", "field2")
- * .create(indexName, regionName, querystring, analyzer);
- * 
- * The querystring is using lucene's queryparser syntax, such as "field1:zhou* AND field2:gzhou@pivotal.io"
- *  
- * PageableLuceneQueryResults results = query.search();
- * 
- * If pagination is not specified:
- * List list = results.getNextPage(); // return all results in one getNextPage() call
- * or if paging is specified:
- * if (results.hasNextPage()) {
- *   List page = results.nextPage(); // return resules page by page
- * }
- * 
- * The item of the list is either the domain object or instance of {@link LuceneResultStruct}
- * </pre>
- * 
- *
- */
-@Experimental
-public interface LuceneService {
-
-  /**
-   * A special field name that indicates that the entire region value should
-   * be indexed. This will only work if the region value is a String or Number, in
-   * which case a lucene document will be created with a single field with this name.
-   */
-  String REGION_VALUE_FIELD = "__REGION_VALUE_FIELD";
-
-  /**
-   * Create a lucene index using default analyzer.
-   * @param fields The fields of the object to index. Only fields listed here will be stored
-   * in the index. Fields should map to PDX fieldNames if the object is serialized with PDX, or
-   * to java fields on the object otherwise. The special field name {{@link #REGION_VALUE_FIELD}}
-   * indicates that the entire value should be stored as a single field in the index.
-   */
-  public void createIndex(String indexName, String regionPath, String... fields);
-  
-  /**
-   * Create a lucene index using specified analyzer per field
-   * 
-   * @param indexName index name
-   * @param regionPath region name
-   * @param analyzerPerField A map of fields to analyzers. See {{@link #createIndex(String, String, String...)}}
-   * for details on valid values for fields. Each field will be tokenized using the provided Analyzer.
-   */
-  public void createIndex(String indexName, String regionPath,
-      Map<String, Analyzer> analyzerPerField);
-
-  /**
-   * Destroy the lucene index
-   * 
-   * @param index index object
-   * @deprecated TODO This feature is not yet implemented
-   */
-  @Deprecated
-  public void destroyIndex(LuceneIndex index);
-  
-  /**
-   * Get the lucene index object specified by region name and index name
-   * @param indexName index name
-   * @param regionPath region name
-   * @return LuceneIndex object
-   */
-  public LuceneIndex getIndex(String indexName, String regionPath);
-  
-  /**
-   * get all the lucene indexes.
-   * @return all index objects in a Collection
-   */
-  public Collection<LuceneIndex> getAllIndexes();
-
-  /**
-   * create LuceneQueryFactory
-   * @return LuceneQueryFactory object
-   */
-  public LuceneQueryFactory createLuceneQueryFactory();
-
- }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneServiceProvider.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneServiceProvider.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneServiceProvider.java
deleted file mode 100644
index f83dffa..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneServiceProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.lucene;
-
-import com.gemstone.gemfire.annotations.Experimental;
-import com.gemstone.gemfire.cache.GemFireCache;
-import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneService;
-import com.gemstone.gemfire.internal.cache.InternalCache;
-
-/**
- * Class for retrieving or creating the currently running
- * instance of the LuceneService.
- *
- */
-@Experimental
-public class LuceneServiceProvider {
-  /**
-   * Retrieve or create the lucene service for this cache
-   */
-  public static LuceneService get(GemFireCache cache) {
-    InternalCache internalCache = (InternalCache) cache;
-    return internalCache.getService(InternalLuceneService.class);
-  }
-
-  private LuceneServiceProvider() {
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/PageableLuceneQueryResults.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/PageableLuceneQueryResults.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/PageableLuceneQueryResults.java
deleted file mode 100644
index c2def44..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/PageableLuceneQueryResults.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.lucene;
-
-import java.util.Iterator;
-import java.util.List;
-
-import com.gemstone.gemfire.annotations.Experimental;
-
-/**
- * <p>
- * Defines the interface for a container of lucene query result collected from function execution.<br>
- * 
- * 
- * @param <K> The type of the key
- * @param <V> The type of the value
- */
-@Experimental
-public interface PageableLuceneQueryResults<K, V> extends Iterator<List<LuceneResultStruct<K,V>>> {
-  /**
-   * @return total number of hits for this query
-   */
-  public int size();
-
-  /**
-   * Returns the maximum score value encountered. Note that in case scores are not tracked, this returns {@link Float#NaN}.
-   */
-  public float getMaxScore();
-
-  /**
-   * Get the next page of results.
-   * 
-   * @return a page of results, or null if there are no more pages
-   */
-  public List<LuceneResultStruct<K, V>> next();
-
-  /**
-   *  True if there another page of results. 
-   */
-  public boolean hasNext();
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/AbstractPartitionedRepositoryManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
deleted file mode 100755
index 1dc716c..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-import com.gemstone.gemfire.internal.cache.BucketRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.execute.InternalRegionFunctionContext;
-
-public abstract class AbstractPartitionedRepositoryManager implements RepositoryManager {
-
-  /** map of the parent bucket region to the index repository
-   * 
-   * This is based on the BucketRegion in case a bucket is rebalanced, we don't want to 
-   * return a stale index repository. If a bucket moves off of this node and
-   * comes back, it will have a new BucketRegion object.
-   * 
-   * It is weak so that the old BucketRegion will be garbage collected. 
-   */
-  protected final ConcurrentHashMap<Integer, IndexRepository> indexRepositories = new ConcurrentHashMap<Integer, IndexRepository>();
-  
-  /** The user region for this index */
-  protected final PartitionedRegion userRegion;
-  protected final LuceneSerializer serializer;
-  protected final LuceneIndexImpl index; 
-
-  public AbstractPartitionedRepositoryManager(
-      LuceneIndexImpl index,
-      LuceneSerializer serializer) {
-    this.index = index;
-    this.userRegion = (PartitionedRegion)index.getCache().getRegion(index.getRegionPath());
-    this.serializer = serializer;
-  }
-
-  @Override
-  public IndexRepository getRepository(Region region, Object key,
-      Object callbackArg) throws BucketNotFoundException {
-    BucketRegion userBucket = userRegion.getBucketRegion(key, callbackArg);
-    if(userBucket == null) {
-      throw new BucketNotFoundException("User bucket was not found for region " + region + "key " +  key + " callbackarg " + callbackArg);
-    }
-    
-    return getRepository(userBucket.getId());
-  }
-
-  @Override
-  public Collection<IndexRepository> getRepositories(RegionFunctionContext ctx) throws BucketNotFoundException {
-    Region<Object, Object> region = ctx.getDataSet();
-    Set<Integer> buckets = ((InternalRegionFunctionContext) ctx).getLocalBucketSet(region);
-    ArrayList<IndexRepository> repos = new ArrayList<IndexRepository>(buckets.size());
-    for(Integer bucketId : buckets) {
-      BucketRegion userBucket = userRegion.getDataStore().getLocalBucketById(bucketId);
-      if(userBucket == null) {
-        throw new BucketNotFoundException("User bucket was not found for region " + region + "bucket id " + bucketId);
-      } else {
-        repos.add(getRepository(userBucket.getId()));
-      }
-    }
-
-    return repos;
-  }
-
-  public abstract IndexRepository createOneIndexRepository(final Integer bucketId,
-      LuceneSerializer serializer,
-      LuceneIndexImpl index, PartitionedRegion userRegion) throws IOException;
-  
-  /**
-   * Return the repository for a given user bucket
-   */
-  protected IndexRepository getRepository(Integer bucketId) throws BucketNotFoundException {
-    IndexRepository repo = indexRepositories.get(bucketId);
-    if(repo != null && !repo.isClosed()) {
-      return repo;
-    }
-
-    repo = indexRepositories.compute(bucketId, (key, oldRepository) -> {
-      if(oldRepository != null && !oldRepository.isClosed()) {
-        return oldRepository;
-      }
-      if(oldRepository != null) {
-        oldRepository.cleanup();
-      }
-
-      try {
-        return createOneIndexRepository(bucketId, serializer, index, userRegion);
-      } catch(IOException e) {
-        throw new InternalGemFireError("Unable to create index repository", e);
-      }
-
-    });
-
-    if(repo == null) {
-      throw new BucketNotFoundException("Colocated index buckets not found for bucket id " + bucketId);
-    }
-
-    return repo;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java
deleted file mode 100644
index c9c03a5..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import org.apache.lucene.analysis.Analyzer;
-
-import java.util.Map;
-
-public interface IndexListener {
-
-  public void beforeIndexCreated(final String indexName, String regionPath,
-      final Analyzer analyzer, final Map<String, Analyzer> fieldAnalyzers,
-      final String... fields);
-
-  public void afterIndexCreated(LuceneIndex index);
-
-  public void beforeIndexDestroyed(LuceneIndex index);
-
-  public void afterIndexDestroyed(LuceneIndex index);
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListenerAdapter.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListenerAdapter.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListenerAdapter.java
deleted file mode 100644
index dd916ac..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListenerAdapter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import org.apache.lucene.analysis.Analyzer;
-
-import java.util.Map;
-
-public class IndexListenerAdapter implements IndexListener {
-  @Override
-  public void beforeIndexCreated(String indexName, String regionPath, Analyzer analyzer,
-      Map<String, Analyzer> fieldAnalyzers, String... fields) {
-  }
-
-  @Override
-  public void afterIndexCreated(LuceneIndex index) {
-  }
-
-  @Override
-  public void beforeIndexDestroyed(LuceneIndex index) {
-  }
-
-  @Override
-  public void afterIndexDestroyed(LuceneIndex index) {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexRepositoryFactory.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexRepositoryFactory.java
deleted file mode 100644
index e6f01b0..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexRepositoryFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.IOException;
-
-import com.gemstone.gemfire.cache.lucene.internal.directory.RegionDirectory;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepositoryImpl;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-import com.gemstone.gemfire.internal.cache.BucketRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-
-public class IndexRepositoryFactory {
-
-  public IndexRepositoryFactory() {
-  }
-
-  public IndexRepository createIndexRepository(final Integer bucketId,
-                                        LuceneSerializer serializer,
-                                        LuceneIndexImpl index, PartitionedRegion userRegion)
-    throws IOException
-  {
-    final IndexRepository repo;
-    LuceneIndexForPartitionedRegion indexForPR = (LuceneIndexForPartitionedRegion)index; 
-    BucketRegion fileBucket = getMatchingBucket(indexForPR.getFileRegion(), bucketId);
-    BucketRegion chunkBucket = getMatchingBucket(indexForPR.getChunkRegion(), bucketId);
-    BucketRegion dataBucket = getMatchingBucket(userRegion, bucketId);
-    if(fileBucket == null || chunkBucket == null) {
-      return null;
-    }
-    RegionDirectory dir = new RegionDirectory(fileBucket, chunkBucket, indexForPR.getFileSystemStats());
-    IndexWriterConfig config = new IndexWriterConfig(indexForPR.getAnalyzer());
-    IndexWriter writer = new IndexWriter(dir, config);
-    repo = new IndexRepositoryImpl(fileBucket, writer, serializer, indexForPR.getIndexStats(), dataBucket);
-    return repo;
-  }
-
-  /**
-   * Find the bucket in region2 that matches the bucket id from region1.
-   */
-  protected BucketRegion getMatchingBucket(PartitionedRegion region, Integer bucketId) {
-    //Force the bucket to be created if it is not already
-    region.getOrCreateNodeForBucketWrite(bucketId, null);
-
-    return region.getDataStore().getLocalBucketById(bucketId);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneIndex.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneIndex.java
deleted file mode 100644
index 27b4820..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneIndex.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-
-public interface InternalLuceneIndex extends LuceneIndex {
-  
-  public RepositoryManager getRepositoryManager();
-
-  /**
-   * Dump the files for this index to the given directory.
-   */
-  public void dumpFiles(String directory);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneService.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneService.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneService.java
deleted file mode 100644
index 403853e..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/InternalLuceneService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.internal.cache.CacheService;
-import com.gemstone.gemfire.internal.cache.extension.Extension;
-
-public interface InternalLuceneService extends LuceneService, Extension<Cache>, CacheService {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
deleted file mode 100644
index 29fb159..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.cache.Operation;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionDestroyedException;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
-import com.gemstone.gemfire.internal.cache.PrimaryBucketException;
-import com.gemstone.gemfire.internal.cache.partitioned.Bucket;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy.TestHook;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * An Async event queue listener that writes all of the
- * events in batches to Lucene
- */
-public class LuceneEventListener implements AsyncEventListener {
-  Logger logger = LogService.getLogger();
-
-  private final RepositoryManager repositoryManager;
-  
-  public LuceneEventListener(RepositoryManager repositoryManager) {
-    this.repositoryManager = repositoryManager;
-  }
-
-  @Override
-  public void close() {
-  }
-
-  @Override
-  public boolean processEvents(List<AsyncEvent> events) {
-    // Try to get a PDX instance if possible, rather than a deserialized object
-    DefaultQuery.setPdxReadSerialized(true);
-
-    Set<IndexRepository> affectedRepos = new HashSet<IndexRepository>();
-
-    try {
-      for (AsyncEvent event : events) {
-        Region region = event.getRegion();
-        Object key = event.getKey();
-        Object callbackArgument = event.getCallbackArgument();
-
-        IndexRepository repository = repositoryManager.getRepository(region, key, callbackArgument);
-
-        Operation op = event.getOperation();
-
-        if (op.isCreate()) {
-          repository.update(key, event.getDeserializedValue());
-        } else if (op.isUpdate()) {
-          repository.update(key, event.getDeserializedValue());
-        } else if (op.isDestroy()) {
-          repository.delete(key);
-        } else if (op.isInvalidate()) {
-          repository.delete(key);
-        } else {
-          throw new InternalGemFireError("Unhandled operation " + op + " on " + event.getRegion());
-        }
-        affectedRepos.add(repository);
-      }
-
-      for(IndexRepository repo : affectedRepos) {
-        repo.commit();
-      }
-      return true;
-    } catch(BucketNotFoundException | RegionDestroyedException | PrimaryBucketException e) {
-      logger.debug("Bucket not found while saving to lucene index: " + e.getMessage());
-      return false;
-    } catch(IOException e) {
-      logger.error("Unable to save to lucene index", e);
-      return false;
-    } finally {
-      DefaultQuery.setPdxReadSerialized(false);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
deleted file mode 100644
index de331ea..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.cache.CacheServiceProfile;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-
-public class LuceneIndexCreationProfile implements CacheServiceProfile, DataSerializable {
-
-  private String indexName;
-
-  private String[] fieldNames;
-
-  private String analyzerClass;
-
-  private Map<String, String> fieldAnalyzers;
-
-  private String regionPath;
-
-  /* Used by DataSerializer */
-  public LuceneIndexCreationProfile() {}
-
-  public LuceneIndexCreationProfile(String indexName, String regionPath, String[] fieldNames, Analyzer analyzer,
-                                    Map<String, Analyzer> fieldAnalyzers) {
-    this.indexName = indexName;
-    this.regionPath = regionPath;
-    this.fieldNames = fieldNames;
-    this.analyzerClass = analyzer.getClass().getSimpleName();
-    initializeFieldAnalyzers(fieldAnalyzers);
-  }
-
-  public String getIndexName() {
-    return this.indexName;
-  }
-
-  public String[] getFieldNames() {
-    return this.fieldNames;
-  }
-
-  public String getAnalyzerClass() {
-    return this.analyzerClass;
-  }
-
-  public Map<String, String> getFieldAnalyzers() {
-    return this.fieldAnalyzers;
-  }
-
-  protected void initializeFieldAnalyzers(Map<String, Analyzer> fieldAnalyzers) {
-    this.fieldAnalyzers = new HashMap<>();
-    for (String field : fieldNames) {
-     if(fieldAnalyzers != null && !fieldAnalyzers.isEmpty())  {
-        this.fieldAnalyzers.put(field, fieldAnalyzers.get(field) == null ? StandardAnalyzer.class.getSimpleName() : fieldAnalyzers.get(field).getClass().getSimpleName());
-      } else {
-        this.fieldAnalyzers.put(field, StandardAnalyzer.class.getSimpleName());
-      }
-    }
-  }
-
-  @Override
-  public String getId() {
-    return "lucene_"+LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
-  }
-
-  @Override
-  public String checkCompatibility(String regionPath, CacheServiceProfile profile) {
-    String result = null;
-    LuceneIndexCreationProfile remoteProfile = (LuceneIndexCreationProfile) profile;
-    if (remoteProfile == null) {
-      // TODO This can occur if one member defines no indexes but another one does. Currently this is caught by the async event id checks.
-    } else {
-      // Verify fields are the same
-      if (!Arrays.equals(remoteProfile.getFieldNames(), getFieldNames())) {
-        return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
-            .toString(getIndexName(), regionPath, Arrays.toString(getFieldNames()), Arrays.toString(remoteProfile.getFieldNames()));
-      }
-
-      // Verify the analyzer class is the same
-      // Note: This test will currently only fail if per-field analyzers are used in one member but not another,
-      // This condition will be caught in the tests below so this test is commented out. If we ever allow the user
-      // to configure a single analyzer for all fields, then this test will be useful again.
-      /*
-      if (!remoteLuceneIndexProfile.getAnalyzerClass().isInstance(getAnalyzer())) {
-        result = LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_3
-            .toString(indexName, regionPath, remoteLuceneIndexProfile.getAnalyzerClass().getName(), analyzer.getClass().getName());
-      }
-      */
-
-      // Iterate the existing analyzers and compare them to the input analyzers
-      // Note: This is currently destructive to the input field analyzers map which should be ok since its a transient object.
-      if (!getFieldAnalyzers().equals(remoteProfile.getFieldAnalyzers())) {
-        if (getFieldAnalyzers().size() != remoteProfile.getFieldAnalyzers().size()) {
-          return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
-              .toString(getIndexName(), regionPath, 
-                  Arrays.toString(getFieldAnalyzers().keySet().toArray()),
-                  Arrays.toString(remoteProfile.getFieldAnalyzers().keySet().toArray()));
-        }
-        // now the 2 maps should have the same size
-        for (String field:getFieldAnalyzers().keySet()) {
-          if (!remoteProfile.getFieldAnalyzers().get(field).equals(getFieldAnalyzers().get(field))) {
-            return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_ON_FIELD_3_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_4_ON_THAT_FIELD
-              .toString(getIndexName(), regionPath,
-                    getFieldAnalyzers().get(field), field,
-                    remoteProfile.getFieldAnalyzers().get(field)); 
-          }
-        }
-      }
-    }
-    return result;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeString(this.indexName, out);
-    DataSerializer.writeString(this.regionPath, out);
-    DataSerializer.writeStringArray(this.fieldNames, out);
-    DataSerializer.writeString(this.analyzerClass, out);
-    DataSerializer.writeHashMap(this.fieldAnalyzers, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.indexName = DataSerializer.readString(in);
-    this.regionPath = DataSerializer.readString(in);
-    this.fieldNames = DataSerializer.readStringArray(in);
-    this.analyzerClass = DataSerializer.readString(in);
-    this.fieldAnalyzers = DataSerializer.readHashMap(in);
-  }
-
-  public String toString() {
-    return new StringBuilder()
-        .append(getClass().getSimpleName())
-        .append("[")
-        .append("indexName=")
-        .append(this.indexName)
-        .append("; fieldNames=")
-        .append(Arrays.toString(this.fieldNames))
-        .append("; analyzerClass=")
-        .append(this.analyzerClass)
-        .append("; fieldAnalyzers=")
-        .append(this.fieldAnalyzers)
-        .append("]")
-        .toString();
-  }
-
-  public String getRegionPath() {
-    return this.regionPath;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexFactory.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexFactory.java
deleted file mode 100755
index b6ac867..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexFactory.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-
-public class LuceneIndexFactory {
-  public LuceneIndexFactory() {
-  }
-  
-  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
-    return new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
deleted file mode 100644
index b64e026..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.DataPolicy;
-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.RegionShortcut;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.cache.lucene.internal.directory.DumpDirectoryFiles;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemStats;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-
-/* wrapper of IndexWriter */
-public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
-  protected Region<String, File> fileRegion;
-  protected Region<ChunkKey, byte[]> chunkRegion;
-  protected final FileSystemStats fileSystemStats;
-
-  public LuceneIndexForPartitionedRegion(String indexName, String regionPath, Cache cache) {
-    super(indexName, regionPath, cache);
-
-    final String statsName = indexName + "-" + regionPath;
-    this.fileSystemStats = new FileSystemStats(cache.getDistributedSystem(), statsName);
-  }
-
-  protected RepositoryManager createRepositoryManager() {
-    RegionShortcut regionShortCut;
-    final boolean withPersistence = withPersistence(); 
-    RegionAttributes regionAttributes = dataRegion.getAttributes();
-    final boolean withStorage = regionAttributes.getPartitionAttributes().getLocalMaxMemory()>0;
-
-    // TODO: 1) dataRegion should be withStorage
-    //       2) Persistence to Persistence
-    //       3) Replicate to Replicate, Partition To Partition
-    //       4) Offheap to Offheap
-    if (!withStorage) {
-      throw new IllegalStateException("The data region to create lucene index should be with storage");
-    }
-    if (withPersistence) {
-      // TODO: add PartitionedRegionAttributes instead
-      regionShortCut = RegionShortcut.PARTITION_PERSISTENT;
-    } else {
-      regionShortCut = RegionShortcut.PARTITION;
-    }
-    
-    // create PR fileRegion, but not to create its buckets for now
-    final String fileRegionName = createFileRegionName();
-    PartitionAttributes partitionAttributes = dataRegion.getPartitionAttributes();
-    if (!fileRegionExists(fileRegionName)) {
-      fileRegion = createFileRegion(regionShortCut, fileRegionName, partitionAttributes, regionAttributes);
-    }
-
-    // create PR chunkRegion, but not to create its buckets for now
-    final String chunkRegionName = createChunkRegionName();
-    if (!chunkRegionExists(chunkRegionName)) {
-      chunkRegion = createChunkRegion(regionShortCut, fileRegionName, partitionAttributes, chunkRegionName, regionAttributes);
-    }
-    fileSystemStats.setFileSupplier(() -> (int) getFileRegion().getLocalSize());
-    fileSystemStats.setChunkSupplier(() -> (int) getChunkRegion().getLocalSize());
-    fileSystemStats.setBytesSupplier(() -> getChunkRegion().getPrStats().getDataStoreBytesInUse());
-
-    // we will create RegionDirectories on the fly when data comes in
-    HeterogeneousLuceneSerializer mapper = new HeterogeneousLuceneSerializer(getFieldNames());
-    return new PartitionedRepositoryManager(this, mapper);
-  }
-  
-  public PartitionedRegion getFileRegion() {
-    return (PartitionedRegion) fileRegion;
-  }
-
-  public PartitionedRegion getChunkRegion() {
-    return (PartitionedRegion) chunkRegion;
-  }
-
-  public FileSystemStats getFileSystemStats() {
-    return fileSystemStats;
-  }
-  
-  boolean fileRegionExists(String fileRegionName) {
-    return cache.<String, File> getRegion(fileRegionName) != null;
-  }
-
-  Region createFileRegion(final RegionShortcut regionShortCut,
-                                final String fileRegionName,
-                                final PartitionAttributes partitionAttributes,
-                                final RegionAttributes regionAttributes) {
-    return createRegion(fileRegionName, regionShortCut, this.regionPath, partitionAttributes, regionAttributes);
-  }
-
-  public String createFileRegionName() {
-    return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath)+".files";
-  }
-
-  boolean chunkRegionExists(String chunkRegionName) {
-    return cache.<ChunkKey, byte[]> getRegion(chunkRegionName) != null;
-  }
-
-  Region<ChunkKey, byte[]> createChunkRegion(final RegionShortcut regionShortCut,
-                           final String fileRegionName,
-                           final PartitionAttributes partitionAttributes, final String chunkRegionName, final RegionAttributes regionAttributes) {
-    return createRegion(chunkRegionName, regionShortCut, fileRegionName, partitionAttributes, regionAttributes);
-  }
-
-  public String createChunkRegionName() {
-    return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath) + ".chunks";
-  }
-
-  private PartitionAttributesFactory configureLuceneRegionAttributesFactory(PartitionAttributesFactory attributesFactory, PartitionAttributes<?,?> dataRegionAttributes) {
-    attributesFactory.setTotalNumBuckets(dataRegionAttributes.getTotalNumBuckets());
-    attributesFactory.setRedundantCopies(dataRegionAttributes.getRedundantCopies());
-    return attributesFactory;
-  }
-
-  protected <K, V> Region<K, V> createRegion(final String regionName,
-                                             final RegionShortcut regionShortCut,
-                                             final String colocatedWithRegionName,
-                                             final PartitionAttributes partitionAttributes,
-                                             final RegionAttributes regionAttributes)
-  {
-    PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory<String, File>();
-    partitionAttributesFactory.setColocatedWith(colocatedWithRegionName);
-    configureLuceneRegionAttributesFactory(partitionAttributesFactory, partitionAttributes);
-
-    // Create AttributesFactory based on input RegionShortcut
-    RegionAttributes baseAttributes = this.cache.getRegionAttributes(regionShortCut.toString());
-    AttributesFactory factory = new AttributesFactory(baseAttributes);
-    factory.setPartitionAttributes(partitionAttributesFactory.create());
-    factory.setDiskStoreName(regionAttributes.getDiskStoreName());
-    RegionAttributes<K, V> attributes = factory.create();
-
-    return createRegion(regionName, attributes);
-  }
-
-  public void close() {
-    // TODO Auto-generated method stub
-    
-  }
-
-  @Override
-  public void dumpFiles(final String directory) {
-    ResultCollector results = FunctionService.onRegion(getDataRegion())
-      .withArgs(new String[] {directory, indexName})
-      .execute(DumpDirectoryFiles.ID);
-    results.getResult();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
deleted file mode 100644
index 67461a9..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemStats;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.lucene.internal.xml.LuceneIndexCreation;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-public abstract class LuceneIndexImpl implements InternalLuceneIndex {
-  protected static final Logger logger = LogService.getLogger();
-  
-  protected final String indexName;
-  protected final String regionPath;
-  protected final Cache cache;
-  protected final LuceneIndexStats indexStats;
-
-  protected boolean hasInitialized = false;
-  protected Map<String, Analyzer> fieldAnalyzers;
-  protected String[] searchableFieldNames;
-  protected RepositoryManager repositoryManager;
-  protected Analyzer analyzer;
-  protected LocalRegion dataRegion;
-
-  protected LuceneIndexImpl(String indexName, String regionPath, Cache cache) {
-    this.indexName = indexName;
-    this.regionPath = regionPath;
-    this.cache = cache;
-    
-    final String statsName = indexName + "-" + regionPath;
-    this.indexStats = new LuceneIndexStats(cache.getDistributedSystem(), statsName);
-  }
-
-  @Override
-  public String getName() {
-    return this.indexName;
-  }
-
-  @Override
-  public String getRegionPath() {
-    return this.regionPath;
-  }
- 
-  protected LocalRegion getDataRegion() {
-    return (LocalRegion)cache.getRegion(regionPath);
-  }
-
-  protected boolean withPersistence() {
-    RegionAttributes ra = dataRegion.getAttributes();
-    DataPolicy dp = ra.getDataPolicy();
-    final boolean withPersistence = dp.withPersistence();
-    return withPersistence;
-  }
-  
-  protected void setSearchableFields(String[] fields) {
-    searchableFieldNames = fields;
-  }
-
-  @Override
-  public boolean waitUntilFlushed(int maxWaitInMillisecond) {
-    String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
-    AsyncEventQueue queue = (AsyncEventQueue)cache.getAsyncEventQueue(aeqId);
-    boolean flushed = false;
-    if (queue != null) {
-      long start = System.nanoTime();
-      while (System.nanoTime() - start < TimeUnit.MILLISECONDS.toNanos(maxWaitInMillisecond)) {
-        if (0 == queue.size()) {
-          flushed = true;
-          break;
-        } else {
-          try {
-            Thread.sleep(200);
-          } catch (InterruptedException e) {
-          }
-        }
-      }
-    } else { 
-      throw new IllegalArgumentException("The AEQ does not exist for the index "+indexName+" region "+regionPath);
-    }
-
-    return flushed;
-  }
-
-  @Override
-  public String[] getFieldNames() {
-    return searchableFieldNames;
-  }
-
-  @Override
-  public Map<String, Analyzer> getFieldAnalyzers() {
-    return this.fieldAnalyzers;
-  }
-
-  public RepositoryManager getRepositoryManager() {
-    return this.repositoryManager;
-  }
-  
-  public void setAnalyzer(Analyzer analyzer) {
-    if (analyzer == null) {
-      this.analyzer = new StandardAnalyzer();
-    } else {
-      this.analyzer = analyzer;
-    }
-  }
-
-  public Analyzer getAnalyzer() {
-    return this.analyzer;
-  }
-
-  public Cache getCache() {
-    return this.cache;
-  }
-  
-  public void setFieldAnalyzers(Map<String, Analyzer> fieldAnalyzers) {
-    this.fieldAnalyzers = fieldAnalyzers == null ? null : Collections.unmodifiableMap(fieldAnalyzers);
-  }
-
-  public LuceneIndexStats getIndexStats() {
-    return indexStats;
-  }
-
-  protected void initialize() {
-    if (!hasInitialized) {
-      /* create index region */
-      dataRegion = getDataRegion();
-      //assert dataRegion != null;
-
-      repositoryManager = createRepositoryManager();
-      
-      // create AEQ, AEQ listener and specify the listener to repositoryManager
-      createAEQ(dataRegion);
-
-      addExtension(dataRegion);
-      hasInitialized = true;
-    }
-  }
-  
-  protected abstract RepositoryManager createRepositoryManager();
-  
-  protected AsyncEventQueue createAEQ(Region dataRegion) {
-    return createAEQ(createAEQFactory(dataRegion));
-  }
-
-  private AsyncEventQueueFactoryImpl createAEQFactory(final Region dataRegion) {
-    AsyncEventQueueFactoryImpl factory = (AsyncEventQueueFactoryImpl) cache.createAsyncEventQueueFactory();
-    if (dataRegion instanceof PartitionedRegion) {
-      factory.setParallel(true); // parallel AEQ for PR
-    } else {
-      factory.setParallel(false); // TODO: not sure if serial AEQ working or not
-    }
-    factory.setMaximumQueueMemory(1000);
-    factory.setDispatcherThreads(10);
-    factory.setIsMetaQueue(true);
-    if (dataRegion.getAttributes().getDataPolicy().withPersistence()) {
-      factory.setPersistent(true);
-    }
-    factory.setDiskStoreName(dataRegion.getAttributes().getDiskStoreName());
-    factory.setDiskSynchronous(dataRegion.getAttributes().isDiskSynchronous());
-    factory.setForwardExpirationDestroy(true);
-    return factory;
-  }
-
-  private AsyncEventQueue createAEQ(AsyncEventQueueFactoryImpl factory) {
-    LuceneEventListener listener = new LuceneEventListener(repositoryManager);
-    String aeqId = LuceneServiceImpl.getUniqueIndexName(getName(), regionPath);
-    AsyncEventQueue indexQueue = factory.create(aeqId, listener);
-    return indexQueue;
-  }
-
-/**
-   * Register an extension with the region
-   * so that xml will be generated for this index.
-   */
-  protected void addExtension(LocalRegion dataRegion) {
-    LuceneIndexCreation creation = new LuceneIndexCreation();
-    creation.setName(this.getName());
-    creation.addFieldNames(this.getFieldNames());
-    creation.setRegion(dataRegion);
-    creation.setFieldAnalyzers(this.getFieldAnalyzers());
-    dataRegion.getExtensionPoint().addExtension(creation);
-  }
-
-  protected <K, V> Region<K, V> createRegion(final String regionName, final RegionAttributes<K, V> attributes) {
-    // Create InternalRegionArguments to set isUsedForMetaRegion true to suppress xml generation (among other things)
-    InternalRegionArguments ira = new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
-        .setSnapshotInputStream(null).setImageTarget(null).setIsUsedForMetaRegion(true);
-
-    // Create the region
-    try {
-      return ((GemFireCacheImpl)this.cache).createVMRegion(regionName, attributes, ira);
-    } catch (Exception e) {
-      InternalGemFireError ige = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
-      ige.initCause(e);
-      throw ige;
-    }
-  }
-}



[07/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java
new file mode 100644
index 0000000..411396b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java
@@ -0,0 +1,327 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class SerialGatewaySenderQueueDUnitTest extends WANTestBase {
+
+  @Test
+  public void testPrimarySecondaryQueueDrainInOrder_RR() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createCache(nyPort ));
+    vm3.invoke(() -> WANTestBase.createCache(nyPort ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
+        false, 100, 10, false, false, null, true, 1, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
+        false, 100, 10, false, false, null, true, 1, OrderPolicy.KEY ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.addQueueListener( "ln", false));
+    vm5.invoke(() -> WANTestBase.addQueueListener( "ln", false));
+    
+    vm2.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_RR"));
+    vm3.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_RR"));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
+    
+    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+    Wait.pause(5000);
+    HashMap primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    HashMap secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    assertEquals(primarySenderUpdates, secondarySenderUpdates);
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
+    Wait.pause(2000);
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
+    Wait.pause(2000);
+    // We should wait till primarySenderUpdates and secondarySenderUpdates become same
+    // If in 300000ms they don't then throw error.
+    primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    
+    checkPrimarySenderUpdatesOnVM5(primarySenderUpdates);
+//    assertIndexDetailsEquals(primarySenderUpdates, secondarySenderUpdates);
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
+    Wait.pause(5000);
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 1000 ));
+    primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    HashMap receiverUpdates = (HashMap)vm2.invoke(() -> WANTestBase.checkQueue());
+    
+    List destroyList = (List)primarySenderUpdates.get("Destroy");
+    List createList = (List)receiverUpdates.get("Create");
+    for(int i = 0; i< 1000; i++){
+      assertEquals(destroyList.get(i), createList.get(i));
+    }
+    assertEquals(primarySenderUpdates.get("Destroy"), receiverUpdates.get("Create"));
+    
+    Wait.pause(5000);
+    // We expect that after this much time secondary would have got batch removal message
+    // removing all the keys.
+    secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    assertEquals(secondarySenderUpdates.get("Destroy"), receiverUpdates.get("Create"));
+  }
+
+  protected void checkPrimarySenderUpdatesOnVM5(HashMap primarySenderUpdates) {
+    vm5.invoke(() -> WANTestBase.checkQueueOnSecondary( primarySenderUpdates ));
+  }
+  
+  @Test
+  public void testPrimarySecondaryQueueDrainInOrder_PR() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+  
+    vm2.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_PR"));
+    vm3.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_PR"));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
+        false, 100, 10, false, false, null, true, 1, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
+        false, 100, 10, false, false, null, true,1, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.addQueueListener( "ln", false));
+    vm5.invoke(() -> WANTestBase.addQueueListener( "ln", false));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
+    
+    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+    Wait.pause(5000);
+    HashMap primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    HashMap secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    checkPrimarySenderUpdatesOnVM5(primarySenderUpdates);
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
+    Wait.pause(4000);
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
+    Wait.pause(15000);
+    primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    assertEquals(primarySenderUpdates, secondarySenderUpdates);
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
+    Wait.pause(5000);
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  /**
+   * Test to validate that serial gateway sender queue diskSynchronous attribute
+   * when persistence of sender is enabled. 
+   */
+  @Test
+  public void test_ValidateSerialGatewaySenderQueueAttributes_1() {
+    Integer localLocPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer remoteLocPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
+
+    WANTestBase test = new WANTestBase(getTestMethodName());
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost["
+        + localLocPort + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+
+    File directory = new File("TKSender" + "_disk_"
+        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    directory.mkdir();
+    File[] dirs1 = new File[] { directory };
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    dsf.setDiskDirs(dirs1);
+    DiskStore diskStore = dsf.create("FORNY");
+
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setBatchConflationEnabled(true);
+    fact.setBatchSize(200);
+    fact.setBatchTimeInterval(300);
+    fact.setPersistenceEnabled(true);// enable the persistence
+    fact.setDiskSynchronous(true);
+    fact.setDiskStoreName("FORNY");
+    fact.setMaximumQueueMemory(200);
+    fact.setAlertThreshold(1200);
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    fact.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    final IgnoredException exTKSender = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      GatewaySender sender1 = fact.create("TKSender", 2);
+
+      AttributesFactory factory = new AttributesFactory();
+      factory.addGatewaySenderId(sender1.getId());
+      factory.setDataPolicy(DataPolicy.PARTITION);
+      Region region = cache.createRegionFactory(factory.create()).create(
+          "test_ValidateGatewaySenderAttributes");
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      assertEquals(senders.size(), 1);
+      GatewaySender gatewaySender = senders.iterator().next();
+      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
+          .getQueues();
+      assertEquals(regionQueues.size(), GatewaySender.DEFAULT_DISPATCHER_THREADS);
+      RegionQueue regionQueue = regionQueues.iterator().next();
+      assertEquals(true, regionQueue.getRegion().getAttributes()
+          .isDiskSynchronous());
+    } finally {
+      exTKSender.remove();
+    }
+  }
+  
+  /**
+   * Test to validate that serial gateway sender queue diskSynchronous attribute
+   * when persistence of sender is not enabled. 
+   */
+  @Test
+  public void test_ValidateSerialGatewaySenderQueueAttributes_2() {
+    Integer localLocPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    
+    Integer remoteLocPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
+    
+    WANTestBase test = new WANTestBase(getTestMethodName());
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);  
+
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setBatchConflationEnabled(true);
+    fact.setBatchSize(200);
+    fact.setBatchTimeInterval(300);
+    fact.setPersistenceEnabled(false);//set persistence to false
+    fact.setDiskSynchronous(true);
+    fact.setMaximumQueueMemory(200);
+    fact.setAlertThreshold(1200);
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    fact.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    final IgnoredException exp = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      GatewaySender sender1 = fact.create("TKSender", 2);
+
+      AttributesFactory factory = new AttributesFactory();
+      factory.addGatewaySenderId(sender1.getId());
+      factory.setDataPolicy(DataPolicy.PARTITION);
+      Region region = cache.createRegionFactory(factory.create()).create(
+          "test_ValidateGatewaySenderAttributes");
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      assertEquals(senders.size(), 1);
+      GatewaySender gatewaySender = senders.iterator().next();
+      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
+          .getQueues();
+      assertEquals(regionQueues.size(), GatewaySender.DEFAULT_DISPATCHER_THREADS);
+      RegionQueue regionQueue = regionQueues.iterator().next();
+
+      assertEquals(false, regionQueue.getRegion().getAttributes()
+          .isDiskSynchronous());
+    } finally {
+      exp.remove();
+    }
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java
new file mode 100644
index 0000000..7664ab4
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java
@@ -0,0 +1,547 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+/**
+ * 
+ */
+@Category(DistributedTest.class)
+public class SerialWANPersistenceEnabledGatewaySenderDUnitTest extends
+    WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  public SerialWANPersistenceEnabledGatewaySenderDUnitTest() {
+    super();
+  }
+
+  /**
+   * Just enable the persistence for GatewaySender and see if it remote site
+   * receives all the events.
+   */
+  @Test
+  public void testReplicatedRegionWithGatewaySenderPersistenceEnabled() {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+
+  /**
+   * Enable persistence for the Region and see if the remote site gets all the
+   * events.
+   */
+  @Test
+  public void testPersistentReplicatedRegionWithGatewaySender() {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+
+  /**
+   * Enable persistence for region as well as GatewaySender and see if remote
+   * site receives all the events.
+   * 
+   */
+  @Test
+  public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+
+  /**
+   * Enable persistence for GatewaySender, kill the sender and restart it. Check
+   * if the remote site receives all the event.
+   */
+  @Test
+  public void testReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    String firstDStore = (String)vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, null, true ));
+    String secondDStore = (String)vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
+    LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+
+    // verify if the queue has all the events
+    // vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
+    // ));
+    // vm5.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
+    // ));
+    //
+    // vm2.invoke(() -> WANTestBase.validateRegionSize(
+    // testName + "_RR", 0 ));
+    // vm3.invoke(() -> WANTestBase.validateRegionSize(
+    // testName + "_RR", 0 ));
+
+    // kill the vm
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+    vm6.invoke(() -> WANTestBase.killSender());
+    vm7.invoke(() -> WANTestBase.killSender());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the sender. ");
+    // restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore(
+        "ln", 2, false, 100, 10, false, true, null,
+        firstDStore, true ));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore(
+        "ln", 2, false, 100, 10, false, true, null,
+        secondDStore, true ));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
+
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      fail("Got interrupted exception while waiting for startSender to finish.");
+    }
+
+    Wait.pause(5000);
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+
+  /**
+   * Enable persistence for Region and persistence for GatewaySender. Kill the
+   * vm with regions and bring that up again. Check if the remote site receives
+   * all the event. again?
+   * 
+   */
+  @Test
+  public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    String firstDStore = (String)vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, null, true ));
+    String secondDStore = (String)vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, null, true  ));
+
+    LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
+    LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+
+    // kill the vm
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+
+    LogWriterUtils.getLogWriter().info("Killed the sender. ");
+    // restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+      100, 10, false, true, null, firstDStore, true  ));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, secondDStore, true  ));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
+    
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+  
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
+
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      fail("Got interrupted exception while waiting for startSender to finish.");
+    }
+
+    Wait.pause(5000);
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+  
+  /**
+   * Enable persistence for Region. No persistence for GatewaySender. Kill the
+   * vm with regions and bring that up again. Check if the remote site receives
+   * all the event. again?
+   * 
+   */
+  @Test
+  public void testPersistentReplicatedRegionWithGatewaySender_Restart() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false,
+            100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, false,
+            100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+
+    // verify if the queue has all the events
+    // vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
+    // ));
+    // vm5.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
+    // ));
+    //
+    // vm2.invoke(() -> WANTestBase.validateRegionSize(
+    // testName + "_RR", 0 ));
+    // vm3.invoke(() -> WANTestBase.validateRegionSize(
+    // testName + "_RR", 0 ));
+
+    // kill the vm
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+
+    LogWriterUtils.getLogWriter().info("Killed the sender. ");
+    // restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm4.invoke(() -> WANTestBase.createSender(
+        "ln", 2, false, 100, 10, false, false, null, true));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
+    vm5.invoke(() -> WANTestBase.createSender(
+        "ln", 2, false, 100, 10, false, false, null, true));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
+    
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
+
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
+    
+    AsyncInvocation inv1 =  vm4.invokeAsync(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      fail("Got interrupted exception while waiting for startSender to finish.");
+    }
+
+    Wait.pause(5000);
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+  
+  
+  /**
+   * Enable persistence for Region and persistence for GatewaySender. Kill the
+   * vm with regions and bring that up again. Check if the remote site receives
+   * all the event. again?
+   * In this case put is continuously happening while the vm is down.
+   */
+  @Test
+  public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart2() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    String firstDStore = (String)vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, null, true  ));
+    String secondDStore = (String)vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, null, true  ));
+
+    LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
+    LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+
+    // kill the vm
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+
+    LogWriterUtils.getLogWriter().info("Killed the sender. ");
+    // restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+      100, 10, false, true, null, firstDStore, true  ));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
+            100, 10, false, true, null, secondDStore, true  ));
+    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
+    
+    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+  
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
+
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      fail("Got interrupted exception while waiting for startSender to finish.");
+    }
+
+    Wait.pause(5000);
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+}



[10/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
new file mode 100644
index 0000000..359a56d
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
@@ -0,0 +1,1593 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.io.IOException;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.internal.cache.ColocationHelper;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
+
+@Category(DistributedTest.class)
+public class ParallelWANPersistenceEnabledGatewaySenderDUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+  
+  public ParallelWANPersistenceEnabledGatewaySenderDUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    //The restart tests log this string
+    IgnoredException.addIgnoredException("failed accepting client connection");
+  }
+  
+  @Test
+  public void testPartitionedRegionWithGatewaySenderPersistenceEnabled() throws IOException {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+      createCache(lnPort);
+      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+      fact.setPersistenceEnabled(true);
+      fact.setParallel(true);
+      final IgnoredException ex = IgnoredException.addIgnoredException("Could not connect");
+      try {
+        GatewaySender sender1 = fact.create("NYSender", 2);
+
+        AttributesFactory rFact = new AttributesFactory();
+        rFact.addGatewaySenderId(sender1.getId());
+
+        PartitionAttributesFactory pFact = new PartitionAttributesFactory();
+        pFact.setTotalNumBuckets(100);
+        pFact.setRedundantCopies(1);
+        rFact.setPartitionAttributes(pFact.create());
+        Region r = cache.createRegionFactory(rFact.create()).create("MyRegion");
+        sender1.start();
+      } finally {
+        ex.remove();
+      }
+      
+    }
+    catch (Exception e) {
+      fail("Unexpected Exception :" + e);
+    }
+  }
+  
+  /**
+   * Enable persistence for region as well as GatewaySender and see if remote
+   * site receives all the events.
+   */
+  @Test
+  public void testPersistentPartitionedRegionWithGatewaySenderPersistenceEnabled() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+
+  }
+
+  /**
+   * Enable persistence for the GatewaySender but not the region
+   */
+  @Test
+  public void testPartitionedRegionWithPersistentGatewaySender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    
+    LogWriterUtils.getLogWriter().info("Created remote receivers");
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+    
+    LogWriterUtils.getLogWriter().info("Created local site cache");
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+  
+    LogWriterUtils.getLogWriter().info("Created local site senders");
+
+    vm4.invoke(createPartitionedRegionRunnable());
+    vm5.invoke(createPartitionedRegionRunnable());
+    vm6.invoke(createPartitionedRegionRunnable());
+    vm7.invoke(createPartitionedRegionRunnable());
+
+    LogWriterUtils.getLogWriter().info("Created local site persistent PR");
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Started the senders");
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+  }
+
+  protected SerializableRunnableIF createPartitionedRegionRunnable() {
+    return () -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() );
+  }
+
+
+
+  
+  /**
+   * Enable persistence for GatewaySender.
+   * Pause the sender and do some puts in local region.  
+   * Close the local site and rebuild the region and sender from disk store.
+   * Dispatcher should not start dispatching events recovered from persistent sender.
+   * Check if the remote site receives all the events.
+   */
+  @Test
+  public void testPRWithGatewaySenderPersistenceEnabled_Restart() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(createPartitionedRegionRunnable());
+    vm5.invoke(createPartitionedRegionRunnable());
+    vm6.invoke(createPartitionedRegionRunnable());
+    vm7.invoke(createPartitionedRegionRunnable());
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(createPartitionedRegionRunnable());
+    AsyncInvocation inv2 = vm5.invokeAsync(createPartitionedRegionRunnable());
+    AsyncInvocation inv3 = vm6.invokeAsync(createPartitionedRegionRunnable());
+    AsyncInvocation inv4 = vm7.invokeAsync(createPartitionedRegionRunnable());
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+    
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 3000 ));
+  }
+
+  protected SerializableRunnableIF killSenderRunnable() {
+    return () -> WANTestBase.killSender();
+  }
+
+  protected SerializableRunnableIF pauseSenderRunnable() {
+    return () -> WANTestBase.pauseSender( "ln" );
+  }
+
+  protected SerializableRunnableIF waitForSenderRunnable() {
+    return () -> WANTestBase.waitForSenderRunningState( "ln" );
+  }
+  
+  /**
+   * Enable persistence for PR and GatewaySender.
+   * Pause the sender and do some puts in local region.  
+   * Close the local site and rebuild the region and sender from disk store.
+   * Dispatcher should not start dispatching events recovered from persistent sender.
+   * Check if the remote site receives all the events.
+   */
+  @Test
+  public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 3000 ));
+  }
+  
+  /**
+   * Enable persistence for PR and GatewaySender.
+   * Pause the sender and do some puts in local region.  
+   * Close the local site and rebuild the region and sender from disk store.
+   * Dispatcher should not start dispatching events recovered from persistent sender.
+   * Check if the remote site receives all the events.
+   */
+  @Test
+  public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart2() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 300 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+  //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+    
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+
+
+    LogWriterUtils.getLogWriter().info("Creating the receiver.");
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    //create PR on remote site
+    
+    LogWriterUtils.getLogWriter().info("Creating the partitioned region at receiver. ");
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Doing some extra puts. ");
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPutsAfter300( getTestMethodName(), 1000 ));
+    //----------------------------------------------------------------------------------------------------
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("Validating the region size at the receiver end. ");
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+  }
+  
+  
+  /**
+   * Enable persistence for PR and GatewaySender.
+   * Pause the sender and do some puts in local region.  
+   * Close the local site and rebuild the region and sender from disk store.
+   * Dispatcher should not start dispatching events recovered from persistent sender.
+   * --> At the same time, do some more puts on the local region.  
+   * Check if the remote site receives all the events.
+   */
+  @Test
+  public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart_Scenario2() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+    
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    //Dispatcher should be dispatching now. Do some more puts through async thread
+    AsyncInvocation async1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    try {
+      async1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    }
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 3000 ));
+  }
+
+  /**
+   * Test case for bug# 44275.
+   * Enable persistence for PR and GatewaySender. 
+   * Do puts into region with key as a String.
+   * Close the local site and rebuild the region and sender from disk store. 
+   * Check if the remote site receives all the events.
+   */
+  @Test
+  public void testPersistentPRWithPersistentGatewaySender_Restart_Bug44275() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString( getTestMethodName(), 1000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+  //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+    getTestMethodName(), 1000 ));
+  }
+  
+  /**
+   * Test case for bug# 44275.
+   * Enable persistence for PR and GatewaySender. 
+   * Do puts into region with key as a String.
+   * Close the local site and rebuild the region and sender from disk store. 
+   * Check if the remote site receives all the events.
+   */
+  @Test
+  public void testPersistentPRWithPersistentGatewaySender_Restart_DoOps() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString( getTestMethodName(), 1000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+  //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    // create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+    getTestMethodName(), 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    
+   //do some extra puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString( getTestMethodName(), 10000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+    getTestMethodName(), 10000 ));
+  }
+  
+  @Test
+  public void testPersistentPR_Restart() {
+    // create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    // create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    // create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    // start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString(
+        getTestMethodName(), 1000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+
+    // --------------------close and rebuild local site
+    // -------------------------------------------------
+    // kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+
+    // restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+
+//    // create PR on local site
+//    vm4.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
+//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
+//    vm5.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
+//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
+//    vm6.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
+//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
+//    vm7.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
+//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
+
+    // create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
+            100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
+            100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
+            100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
+            100, isOffHeap() ));
+
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    }
+    catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+  }
+
+  /**
+   * Enable persistence for PR and GatewaySender. 
+   * Close the local site. 
+   * Create the local cache.
+   * Don't create back the partitioned region but create just the sender.  
+   * Check if the remote site receives all the events.
+   * NOTE: This use case is not supported yet. 
+   * For ParallelGatewaySender to start, it must be associated with a partitioned region. 
+   */
+  @Ignore("NotSupported")
+  @Test
+  public void testPersistentPartitionedRegionWithGatewaySenderPersistenceEnabled_Restart2() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+    
+    //create senders from disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    
+    //start the senders. NOTE that the senders are not associated with partitioned region
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Started the senders.");
+    
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+  }
+  
+  /**
+   * Create a non persistent PR and enable persistence for GatewaySender attached to the PR.
+   * Close the local site and rebuild it. Check if the remote site receives all the events.
+   * NOTE: This use case is not supported for now. For persistent parallel gateway sender,
+   * the PR to which it is attached should also be persistent.
+   */
+  @Ignore("NotSupported")
+  @Test
+  public void testNonPersistentPartitionedRegionWithGatewaySenderPersistenceEnabled_Restart() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create non persistent PR on local site
+    vm4.invoke(createPartitionedRegionRunnable());
+    vm5.invoke(createPartitionedRegionRunnable());
+    vm6.invoke(createPartitionedRegionRunnable());
+    vm7.invoke(createPartitionedRegionRunnable());
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders. The local site has been brought down.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+  //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    vm4.invoke(createPartitionedRegionRunnable());
+    vm5.invoke(createPartitionedRegionRunnable());
+    vm6.invoke(createPartitionedRegionRunnable());
+    vm7.invoke(createPartitionedRegionRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+    
+    //start the senders
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Started the senders.");
+    
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+    getTestMethodName(), 1000 ));
+  }
+
+
+  /**
+   * Create persistent PR and non-persistent GatewaySender.
+   * After doing puts, close the local site. 
+   * Rebuild the PR from persistent disk store and create the sender again. 
+   * Do more puts. Check if the remote site receives newly added events.
+   * 
+   * This test can be used as DUnit test for defect #50247 reported by Indian Railways.
+   * At present, customer is using this configuration and which is not recommended 
+   * since it can lead to event loss of GatewaySender events.
+   */
+  @Ignore("Bug50247")
+  @Test
+  public void testPersistentPartitionedRegionWithGatewaySender_Restart() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+
+    //create PR on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap() ));
+    
+    //create PR on local site
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //wait for senders to become running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    //pause the senders
+    vm4.invoke(pauseSenderRunnable());
+    vm5.invoke(pauseSenderRunnable());
+    vm6.invoke(pauseSenderRunnable());
+    vm7.invoke(pauseSenderRunnable());
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //----------------- Close and rebuild local site -------------------------------------
+    //kill the senders
+    vm4.invoke(killSenderRunnable());
+    vm5.invoke(killSenderRunnable());
+    vm6.invoke(killSenderRunnable());
+    vm7.invoke(killSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create back the senders
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders again");
+    
+    //start the senders
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Started the senders.");
+    
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+
+    //wait for senders running
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
+
+    //-------------------------------------------------------------------------------------------
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 3000 ));
+  }
+  
+  /**
+   * LocalMaxMemory of user PR is 0 (accessor region).
+   * Parallel sender persistence is enabled. 
+   * In this scenario, the PR for Parallel sender should be created with persistence = false.
+   * This is because since the region is accessor region, it won't host any buckets and 
+   * hence Parallel sender PR is not required to be persistent.
+   * This test is added for defect # 45747. 
+   */
+  @Test
+  public void testParallelPropagationWithSenderPersistenceEnabledForAccessor() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, true, null, true ));
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
+      getTestMethodName() + "_PR", "ln", 1, 100 ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
+      getTestMethodName() + "_PR", "ln", 1, 100 ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  /**
+   * Test for bug 50120 see if we can recover after deleting the parallel gateway
+   * sender files and not recoverying the sender when we have a persistent PR.
+   * @throws Throwable 
+   */
+  @Test
+  public void testRemoveGatewayFromPersistentRegionOnRestart() throws Throwable {
+    
+
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2, vm3);
+      createReceiverInVMs(vm2, vm3);
+
+      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, true, null, true ));
+
+      vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+      vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+      vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+      vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+      vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+      vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 113 ));
+
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 113 ));
+      vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 113 ));
+
+      //Bounce vm4, vm5, vm6, vm7 without the parallel queue
+      vm4.invoke(WANTestBase.class, "closeCache", new Object [] {});
+      vm5.invoke(WANTestBase.class, "closeCache", new Object [] {});
+      vm6.invoke(WANTestBase.class, "closeCache", new Object [] {});
+      vm7.invoke(WANTestBase.class, "closeCache", new Object [] {});
+
+      vm4.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
+      vm5.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
+      vm6.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
+      vm7.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
+
+      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+      AsyncInvocation async4 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+      AsyncInvocation async5 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+      AsyncInvocation async6 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+      AsyncInvocation async7 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+      async7.getResult(30 * 1000);
+      async5.getResult(30 * 1000);
+      async6.getResult(30 * 1000);
+      async4.getResult(30 * 1000);
+
+      //This should succeed, because the region recovered even though
+      //the queue was removed.
+      vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 113 ));
+    } finally {
+      vm4.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
+      vm5.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
+      vm6.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
+      vm7.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
+    }
+  }
+  
+  public static void setIgnoreQueue(boolean shouldIgnore) {
+    ColocationHelper.IGNORE_UNRECOVERED_QUEUE = shouldIgnore;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java
new file mode 100644
index 0000000..2e84c4e
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class ParallelWANPropagationClientServerDUnitTest extends WANTestBase {
+
+  /**
+   * Normal happy scenario test case.
+   */
+  @Category(FlakyTest.class) // GEODE-1775: fails intermittently
+  @Test
+  public void testParallelPropagationWithClientServer() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiverAndServer( nyPort ));
+    vm3.invoke(() -> WANTestBase.createReceiverAndServer( nyPort ));
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createClientWithLocator(
+        nyPort, "localhost", getTestMethodName() + "_PR" ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      100 ));
+
+    vm5.invoke(() -> WANTestBase.createServer( lnPort ));
+    vm6.invoke(() -> WANTestBase.createServer( lnPort ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+         100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+         100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm7.invoke(() -> WANTestBase.createClientWithLocator(
+      lnPort, "localhost", getTestMethodName() + "_PR" ));
+
+    startSenderInVMsAsync("ln", vm5, vm6);
+
+    // before doing any puts, let the senders be running in order to ensure that
+    // not a single event will be lost
+    
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm7.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10000 ));
+
+    
+    // verify all buckets drained on all sender nodes.
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+
+  }
+}


[23/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
deleted file mode 100644
index c627353..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewayReceiverStopDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Test wan commands for error in input 1> start gateway-sender command needs
-   * only one of member or group.
-   */
-  @Test
-  public void testStopGatewayReceiver_ErrorConditions() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createReceiver( punePort ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
-        + CliStrings.STOP_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId()
-        + " --" + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1";
-
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewayReceiver_ErrorConditions stringResult : "
-              + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStopGatewayReceiver_ErrorConditions failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testStopGatewayReceiver() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createAndStartReceiver( punePort ));
-    vm4.invoke(() -> createAndStartReceiver( punePort ));
-    vm5.invoke(() -> createAndStartReceiver( punePort ));
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYRECEIVER;
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertTrue(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStopGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a member
-   */
-  @Test
-  public void testStopGatewayReceiver_onMember() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createAndStartReceiver( punePort ));
-    vm4.invoke(() -> createAndStartReceiver( punePort ));
-    vm5.invoke(() -> createAndStartReceiver( punePort ));
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
-        + CliStrings.STOP_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId();
-
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewayReceiver_onMember stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains("stopped on member"));
-    } else {
-      fail("testStopGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a group of members
-   */
-  @Test
-  public void testStopGatewayReceiver_Group() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
-    vm4.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
-    vm5.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
-        + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewayReceiver_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStopGatewayReceiver_Group failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-  }
-
-  /**
-   * Test to validate the scenario gateway sender is started when one or more
-   * sender members belongs to multiple groups
-   * 
-   */
-  @Test
-  public void testStopGatewayReceiver_MultipleGroup() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
-    vm4.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
-    vm5.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
-    vm6.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1, RG2" ));
-    vm7.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG3" ));
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-    vm6.invoke(() -> verifyReceiverState( true ));
-    vm7.invoke(() -> verifyReceiverState( true ));
-
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
-        + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1,RG2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewayReceiver_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStopGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-    vm6.invoke(() -> verifyReceiverState( false ));
-    vm7.invoke(() -> verifyReceiverState( true ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
deleted file mode 100644
index 74839a9..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewaySenderStartDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Test wan commands for error in input 1> start gateway-sender command needs
-   * only one of member or group.
-   */
-  @Test
-  public void testStartGatewaySender_ErrorConditions() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-    
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.START_GATEWAYSENDER + " --"
-        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.START_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId() + " --"
-        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenserGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  private CommandResult executeCommandWithIgnoredExceptions(String command) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      CommandResult commandResult = executeCommand(command);
-      return commandResult;
-    } finally {
-      exln.remove();
-    }
-  }
-
-  @Test
-  public void testStartGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-
-    pause(10000);
-    String command = CliStrings.START_GATEWAYSENDER + " --"
-        + CliStrings.START_GATEWAYSENDER__ID + "=ln";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(5, status.size());
-      assertTrue(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a member
-   */
-  @Test
-  public void testStartGatewaySender_onMember() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    pause(10000);
-    String command = CliStrings.START_GATEWAYSENDER + " --"
-        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.START_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains("is started on member"));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a group of members
-   */
-  @Test
-  public void testStartGatewaySender_Group() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-    
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-
-    pause(10000);
-    String command = CliStrings.START_GATEWAYSENDER + " --"
-        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewaySender_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  /**
-   * Test to validate the scenario gateway sender is started when one or more
-   * sender members belongs to multiple groups
-   */
-  @Test
-  public void testStartGatewaySender_MultipleGroup() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1, SenderGroup2" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm6.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1, SenderGroup2" ));
-    vm6.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm7.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup3" ));
-    vm7.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", false, false ));
-
-    pause(10000);
-    String command = CliStrings.START_GATEWAYSENDER + " --"
-        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenderGroup1,SenderGroup2";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewaySender_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", false, false ));
-  }
-
-  /**
-   * Test to validate the test scenario when one of the member ion group does
-   * not have the sender.
-   */
-  @Test
-  public void testStartGatewaySender_Group_MissingSenderFromGroup() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-
-    pause(10000);
-    String command = CliStrings.START_GATEWAYSENDER + " --"
-        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      assertTrue(strCmdResult.contains("Error"));
-      assertTrue(strCmdResult.contains("is not available"));
-      getLogWriter().info(
-          "testStartGatewaySender_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertTrue(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
deleted file mode 100644
index a33d793..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewaySenderStopDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  private CommandResult executeCommandWithIgnoredExceptions(String command) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    CommandResult commandResult =  executeCommand(command);
-    exln.remove();
-    return commandResult;
-  }
-
-  @Test
-  public void testStopGatewaySender_ErrorConditions() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.STOP_GATEWAYSENDER + " --"
-        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.STOP_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
-        + " --" + CliStrings.STOP_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStopGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testStopGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYSENDER + " --"
-        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(5, status.size());
-      assertTrue(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStopGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a member
-   */
-  @Test
-  public void testStopGatewaySender_onMember() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYSENDER + " --"
-        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.STOP_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains("is stopped on member"));
-    } else {
-      fail("testStopGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a group of members
-   */
-  @Test
-  public void testStopGatewaySender_Group() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYSENDER + " --"
-        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.STOP_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter()
-          .info(
-              "testStopGatewaySender_Group stringResult : " + strCmdResult
-                  + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStopGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-  }
-
-  /**
-   * Test to validate the scenario gateway sender is started when one or more
-   * sender members belongs to multiple groups
-   */
-  @Test
-  public void testStopGatewaySender_MultipleGroup() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1, SenderGroup2" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm6.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup2" ));
-    vm6.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm7.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup3" ));
-    vm7.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-    vm6.invoke(() -> startSender( "ln" ));
-    vm7.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    pause(10000);
-    String command = CliStrings.STOP_GATEWAYSENDER + " --"
-        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.STOP_GATEWAYSENDER__GROUP + "=SenderGroup1,SenderGroup2";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter()
-          .info(
-              "testStopGatewaySender_Group stringResult : " + strCmdResult
-                  + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStopGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
deleted file mode 100644
index 0c91f33..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandListDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  @Test
-  public void testListGatewayWithNoSenderReceiver() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-    
-    pause(10000);
-    String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testListGatewaySender : : " + strCmdResult);
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testListGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-    vm7.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-    vm3.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
-    vm4.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-    vm4.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
-    vm5.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
-    pause(10000);
-    String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testListGatewaySender" + strCmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableResultData =
-      ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_senderIds = tableResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertTrue(result_senderIds.contains("ln_Serial"));
-      assertTrue(result_senderIds.contains("ln_Parallel"));
-      assertEquals(5, result_senderIds.size());
-      
-      assertEquals(null, ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER));
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testListGatewayReceiver() {
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm3.invoke(() -> createAndStartReceiver( lnPort ));
-    vm4.invoke(() -> createAndStartReceiver( lnPort ));
-
-    vm5
-        .invoke(() -> createCache( nyPort ));
-    vm5.invoke(() -> createSender(
-        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
-    vm6
-        .invoke(() -> createCache( nyPort ));
-    vm6.invoke(() -> createSender(
-        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
-    vm6.invoke(() -> createSender(
-        "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
-
-    pause(10000);
-    String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testListGatewayReceiver" + strCmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> ports = tableResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-      assertEquals(2, ports.size());
-      List<String> hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(2, hosts.size());
-      
-      assertEquals(null, ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER));
-      
-      
-    } else {
-      fail("testListGatewayReceiver failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testListGatewaySenderGatewayReceiver() throws GfJsonException {
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createCache( lnPort ));
-    vm3.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-    vm3.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
-    vm4.invoke(() -> createCache( lnPort ));
-    vm4.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-    vm4.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
-    vm5.invoke(() -> createAndStartReceiver( lnPort ));
-
-    vm7.invoke(() -> createCache( nyPort ));
-    vm7.invoke(() -> createSender(
-        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
-    vm7.invoke(() -> createSender(
-        "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
-
-    pause(10000);
-    String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = executeCommand(command);
-    
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testListGatewaySenderGatewayReceiver : " + strCmdResult );
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableSenderResultData = ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertEquals(4, senders.size());
-      List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(4, hosts.size());
-      
-      
-      TabularResultData tableReceiverResultData = ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-      assertEquals(1, ports.size());
-      hosts = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(1, hosts.size());
-    } else {
-      fail("testListGatewaySenderGatewayReceiver failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testListGatewaySenderGatewayReceiver_group() {
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createCacheWithGroups( lnPort, "Serial_Sender, Parallel_Sender"));
-    vm3.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-    vm3.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
-    vm4.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender, Parallel_Sender"));
-    vm4.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-    vm4.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
-    vm5.invoke(() -> createAndStartReceiverWithGroup( lnPort, "Parallel_Sender,Receiver_Group" ));
-    vm5.invoke(() -> createSender(
-      "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-    
-
-    vm7.invoke(() -> createCache( nyPort ));
-    vm7.invoke(() -> createSender(
-        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
-    vm7.invoke(() -> createSender(
-        "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
-
-    pause(10000);
-    String command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableSenderResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertEquals(4, senders.size());
-      List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(4, hosts.size());
-      
-    } else {
-      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
-    }
-    
-    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Parallel_Sender";
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      TabularResultData tableSenderResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertEquals(5, senders.size());
-      
-      TabularResultData tableReceiverResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-      assertEquals(1, ports.size());
-      
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
-    }
-    
-    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Receiver_Group";
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableSenderResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertEquals(1, senders.size());
-      
-      TabularResultData tableReceiverResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-      assertEquals(1, ports.size());
-      
-    } else {
-      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
-    }
-
-    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender,Parallel_Sender";
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableSenderResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertEquals(5, senders.size());
-      
-      TabularResultData tableReceiverResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-      assertEquals(1, ports.size());
-    } else {
-      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
-    }
-
-    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender,Parallel_Sender,Receiver_Group";
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableSenderResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertEquals(5, senders.size());
-      
-      TabularResultData tableReceiverResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-      assertEquals(1, ports.size());
-      
-    } else {
-      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
-    }
-    
-  }
-}


[17/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java
new file mode 100644
index 0000000..41f01f3
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java
@@ -0,0 +1,625 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.concurrent.TimeUnit;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.jayway.awaitility.Awaitility;
+
+/**
+ *
+ */
+@Category(DistributedTest.class)
+public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+  
+  public ConcurrentParallelGatewaySenderOperation_2_DUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("RegionDestroyedException");
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+  }
+  
+  // to test that when userPR is locally destroyed, shadow Pr is also locally
+  // destroyed and on recreation userPr , shadow Pr is also recreated.
+  @Test
+  public void testParallelGatewaySender_SingleNode_UserPR_localDestroy_RecreateRegion() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    try {
+      String regionName = getTestMethodName() + "_PR";
+
+      createCacheInVMs(lnPort, vm4);
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
+      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 5, OrderPolicy.KEY));
+      vm4.invoke(() -> startSender("ln"));
+      vm4.invoke(() -> pauseSender("ln"));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+      vm2.invoke(() -> createReceiver());
+
+      vm4.invoke(() -> doPuts(regionName, 10));
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+
+      vm2.invoke(() -> validateRegionSize(regionName, 0));
+
+      vm4.invoke(() -> localDestroyRegion(getTestMethodName() + "_PR"));
+
+      vm2.invoke(() -> validateRegionSize(regionName, 0));
+
+      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
+
+      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 0)));
+
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+    } finally {
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
+    }
+  }
+  
+  @Test
+  public void testParallelGatewaySender_SingleNode_UserPR_Destroy_RecreateRegion() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    try {
+      String regionName = getTestMethodName() + "_PR";
+
+      createCacheInVMs(lnPort, vm4);
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
+      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 4, OrderPolicy.KEY));
+      vm4.invoke(() -> startSender("ln"));
+      vm4.invoke(() -> pauseSender("ln"));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+      vm2.invoke(() -> createReceiver());
+
+      vm4.invoke(() -> doPuts(regionName, 10));
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+
+      vm2.invoke(() -> validateRegionSize(regionName, 0));
+
+      vm4.invoke(() -> resumeSender("ln"));
+      vm4.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
+      vm4.invoke(() -> localDestroyRegion(getTestMethodName() + "_PR"));
+
+      vm2.invoke(() -> validateRegionSize(regionName, 10));
+
+      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
+
+      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 20)));
+
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+
+    } finally {
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
+    }
+  }
+
+  @Test
+  public void testParallelGatewaySender_SingleNode_UserPR_Close_RecreateRegion() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+    try {
+      String regionName = getTestMethodName() + "_PR";
+      createCacheInVMs(lnPort, vm4);
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
+      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 7, OrderPolicy.KEY));
+      vm4.invoke(() -> startSender("ln"));
+      vm4.invoke(() -> pauseSender("ln"));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+      vm2.invoke(() -> createReceiver());
+
+      vm4.invoke(() -> doPuts(regionName, 10));
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+      vm4.invoke(() -> closeRegion(getTestMethodName() + "_PR"));
+      vm4.invoke(() -> resumeSender("ln"));
+
+      Thread.sleep(500);
+
+      vm2.invoke(() -> validateRegionSize(regionName, 0));
+
+      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
+
+      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 10)));
+
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+    }
+    finally {
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
+    }
+  }
+
+  @Test
+  public void testParallelGatewaySender_SingleNode_UserPR_Destroy_SimultaneousPut_RecreateRegion() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    try {
+      createAndStartSender(vm4, lnPort, 6, false, true);
+
+      vm4.invoke(() -> addCacheListenerAndDestroyRegion(getTestMethodName() + "_PR"));
+
+      createReceiverAndDoPutsInPausedSender(nyPort);
+
+      vm4.invoke(() -> resumeSender("ln"));
+
+      AsyncInvocation putAsync = vm4.invokeAsync(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR", 10, 101 ));
+      try {
+        putAsync.join();
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+        fail("Interrupted the async invocation.");
+      }
+
+      if (putAsync.getException() != null
+          && !(putAsync.getException() instanceof RegionDestroyedException)) {
+        Assert.fail("Expected RegionDestroyedException but got",
+            putAsync.getException());
+      }
+
+      // before destroy, there is wait for queue to drain, so data will be
+      // dispatched
+      vm2.invoke(() -> validateRegionSizeWithinRange(getTestMethodName() + "_PR", 10, 101)); // possible size is more than 10
+
+      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
+
+      vm4.invoke(() -> doPutsFrom(getTestMethodName() + "_PR", 10, 20));
+
+      vm4.invoke(() -> validateRegionSize(getTestMethodName() + "_PR", 10));
+
+      vm2.invoke(() -> validateRegionSizeWithinRange(getTestMethodName() + "_PR", 20, 101)); // possible size is more than 20
+    } finally {
+      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+  }
+  
+  @Test
+  public void testParallelGatewaySender_SingleNode_UserPR_Destroy_NodeDown()
+      throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    try {
+      createAndStartSender(vm4, lnPort, 5, false, true);
+      createAndStartSender(vm5, lnPort, 5, false, true);
+      createAndStartSender(vm6, lnPort, 5, false, true);
+
+      createReceiverAndDoPutsInPausedSender(nyPort);
+
+      vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+      vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+      vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+
+      Wait.pause(200);
+      AsyncInvocation localDestroyAsync = vm4.invokeAsync(() -> WANTestBase.destroyRegion( getTestMethodName() + "_PR" ));
+
+      AsyncInvocation closeAsync = vm4.invokeAsync(() -> WANTestBase.closeCache());
+      try {
+        localDestroyAsync.join();
+        closeAsync.join();
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+        fail("Interrupted the async invocation.");
+      }
+
+      vm2.invoke(() -> validateRegionSize(getTestMethodName() + "_PR", 10));
+    } finally {
+      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+      vm6.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+
+  }
+  
+  @Test
+  public void testParallelGatewaySender_SingleNode_UserPR_Close_SimultaneousPut_RecreateRegion() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    try {
+      String regionName = getTestMethodName() + "_PR";
+
+      createCacheInVMs(lnPort, vm4);
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
+      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 5, OrderPolicy.KEY));
+      vm4.invoke(() -> startSender("ln"));
+      vm4.invoke(() -> pauseSender("ln"));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+      vm2.invoke(() -> createReceiver());
+
+      vm4.invoke(() -> doPuts(regionName, 10));
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+
+      vm2.invoke(() -> validateRegionSize(regionName, 0));
+
+      AsyncInvocation putAsync = vm4.invokeAsync(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR", 10, 2000 ));
+      AsyncInvocation localDestroyAsync = vm4.invokeAsync(() -> ConcurrentParallelGatewaySenderOperation_2_DUnitTest.
+        closeRegion( getTestMethodName() + "_PR" ));
+      try {
+        putAsync.join();
+        localDestroyAsync.join();
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+        fail("Interrupted the async invocation.");
+      }
+      vm2.invoke(() -> validateRegionSize(regionName, 0));
+
+      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
+      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
+
+      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 0)));
+
+      vm4.invoke(() -> validateRegionSize(regionName, 10));
+    } finally {
+      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
+    }
+  }
+
+  @Test
+  public void testParallelGatewaySenders_SingleNode_UserPR_localDestroy_RecreateRegion() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+    Integer tkPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator(3, lnPort));
+    Integer pnPort = (Integer)vm3.invoke(() -> createFirstRemoteLocator(4, lnPort));
+
+    createCacheInVMs(nyPort, vm4);
+    vm4.invoke(() -> createReceiver());
+    createCacheInVMs(tkPort, vm5);
+    vm5.invoke(() -> createReceiver());
+    createCacheInVMs(pnPort, vm6);
+    vm6.invoke(() -> createReceiver());
+
+    try {
+      vm7.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(lnPort));
+
+      LogWriterUtils.getLogWriter().info("Created cache on local site");
+
+      vm7.invoke(() -> createConcurrentSender("ln1", 2, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY));
+      vm7.invoke(() -> createConcurrentSender("ln2", 3, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY));
+      vm7.invoke(() -> createConcurrentSender("ln3", 4, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY));
+
+      vm7.invoke(() -> startSender("ln1"));
+      vm7.invoke(() -> startSender("ln2"));
+      vm7.invoke(() -> startSender("ln3"));
+
+      String regionName = getTestMethodName() + "_PR";
+      vm7.invoke(() -> createPartitionedRegion(regionName, "ln1,ln2,ln3", 1, 10, isOffHeap()));
+
+      LogWriterUtils.getLogWriter().info("Created PRs on local site");
+
+      vm4.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+      vm5.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+      vm6.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+
+      vm7.invoke(() -> doPuts(regionName, 10));
+
+      vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln1"));
+      vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln2"));
+      vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln3"));
+
+      vm7.invoke(() -> localDestroyRegion(regionName));
+
+      vm7.invoke(() -> createPartitionedRegion(regionName, "ln1,ln2,ln3", 1, 10, isOffHeap()));
+
+      vm7.invoke(() -> doPutsFrom(regionName, 10, 20));
+
+      vm7.invoke(() -> validateRegionSize(regionName, 10));
+
+      validateRegionSizes(regionName, 20, vm4, vm5, vm6);
+    } finally {
+      vm7.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+  }
+  
+  @Test
+  public void testParallelGatewaySender_MultipleNode_UserPR_localDestroy_Recreate() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> createReceiver());
+
+    try {
+      createAndStartSender(vm4, lnPort, 5, true, false);
+      createAndStartSender(vm5, lnPort, 5, true, false);
+
+      String regionName = getTestMethodName() + "_PR";
+      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+
+      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( regionName, 10 ));
+      Wait.pause(1000);
+      vm5.invoke(() -> localDestroyRegion(regionName));
+
+      try {
+        inv1.join();
+      } catch (InterruptedException ex) {
+        ex.printStackTrace();
+        fail("Interrupted the async invocation.");
+      }
+
+
+      validateRegionSizes(regionName, 10, vm4, vm2);
+
+      vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
+
+      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
+
+      validateRegionSizes(regionName, 20, vm4, vm2);
+    } finally {
+      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+  }
+  
+  @Test
+  public void testParallelGatewaySenders_MultipleNode_UserPR_localDestroy_Recreate() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+    Integer tkPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator(3, lnPort));
+
+    createCacheInVMs(nyPort, vm6);
+    vm6.invoke(() -> createReceiver());
+    createCacheInVMs(tkPort, vm7);
+    vm7.invoke(() -> createReceiver());
+
+    try {
+      createAndStartTwoSenders(vm4, lnPort, 4);
+      createAndStartTwoSenders(vm5, lnPort, 4);
+
+      String regionName = getTestMethodName() + "_PR";
+      vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+          regionName, null, 1, 100, isOffHeap() ));
+      vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+          regionName, null, 1, 100, isOffHeap() ));
+
+      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( regionName, 10 ));
+
+      Wait.pause(1000);
+      vm5.invoke(() -> WANTestBase.localDestroyRegion( regionName ));
+
+      try {
+        inv1.join();
+      } catch (InterruptedException ex) {
+        ex.printStackTrace();
+        fail("Interrupted the async invocation.");
+      }
+
+      validateRegionSizes(regionName, 10, vm4, vm6, vm7);
+
+      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+          regionName, "ln1,ln2", 1, 100, isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.doPutsFrom(
+          regionName, 10, 20 ));
+
+      validateRegionSizes(regionName, 20, vm4, vm6, vm7);
+    } finally {
+      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+  }
+
+  @Test
+  public void testParallelGatewaySender_ColocatedPartitionedRegions_localDestroy() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> createReceiver());
+
+    try {
+      createAndStartSenderWithCustomerOrderShipmentRegion(vm4, lnPort, 5, true);
+      createAndStartSenderWithCustomerOrderShipmentRegion(vm5, lnPort, 5, true);
+
+      LogWriterUtils.getLogWriter().info("Created PRs on local site");
+
+      vm2.invoke(() -> createCustomerOrderShipmentPartitionedRegion(null, 1, 100, isOffHeap()));
+
+      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.putcolocatedPartitionedRegion( 10 ));
+      Wait.pause(1000);
+
+      try {
+        vm5.invoke(() -> localDestroyRegion(customerRegionName));
+      } catch (Exception ex) {
+        assertTrue(ex.getCause() instanceof UnsupportedOperationException);
+      }
+
+      try {
+        inv1.join();
+      } catch (Exception e) {
+        Assert.fail("Unexpected exception", e);
+      }
+
+      validateRegionSizes(customerRegionName, 10, vm4, vm5, vm2);
+    } finally {
+      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+  }
+
+  @Test
+  public void testParallelGatewaySender_ColocatedPartitionedRegions_destroy() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    try {
+      createAndStartSenderWithCustomerOrderShipmentRegion(vm4, lnPort, 6, true);
+      createAndStartSenderWithCustomerOrderShipmentRegion(vm5, lnPort, 6, true);
+
+      LogWriterUtils.getLogWriter().info("Created PRs on local site");
+
+      vm2.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion(null, 1, 100, isOffHeap() ));
+
+      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.putcolocatedPartitionedRegion( 2000 ));
+      Wait.pause(1000);
+
+      try {
+        vm5.invoke(() -> WANTestBase.destroyRegion( customerRegionName ));
+      } catch (Exception ex) {
+        assertTrue(ex.getCause() instanceof IllegalStateException);
+        return;
+      }
+      fail("Expected UnsupportedOperationException");
+    } finally {
+      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
+    }
+  }
+
+  public static void clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME() {
+    AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0;
+  }
+  
+  public static void closeRegion(String regionName) {
+    Region r = cache.getRegion(Region.SEPARATOR + regionName);
+    assertNotNull(r);
+    r.close();
+  }
+
+  public static void validateRegionSizeWithinRange(String regionName,
+      final int min, final int max) {
+    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
+    assertNotNull(r);
+    WaitCriterion wc = new WaitCriterion() {
+      public boolean done() {
+        if (r.keySet().size() > min && r.keySet().size() <= max) {
+          return true;
+        }
+        return false;
+      }
+
+      public String description() {
+        return "Expected region entries to be within range : " + min + " "
+            + max + " but actual entries: " + r.keySet().size();
+      }
+    };
+    Wait.waitForCriterion(wc, 120000, 500, true);
+  }
+
+  protected static void createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(
+      Integer locPort) {
+    createCache(false, locPort);
+    AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1;
+  }
+
+  protected void createAndStartSender(VM vm, int port, int concurrencyLevel, boolean manualStart, boolean pause) {
+    vm.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(port));
+    vm.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
+    createSender(vm, concurrencyLevel, manualStart);
+    vm.invoke(() -> startSender("ln"));
+    if (pause) {
+      vm.invoke(() -> pauseSender("ln"));
+    }
+    LogWriterUtils.getLogWriter().info("Created PRs on local site");
+  }
+
+  protected void createReceiverAndDoPutsInPausedSender(int port) {
+    // Note: This is a test-specific method used by several tests to do puts from vm4 to vm2.
+    String regionName = getTestMethodName() + "_PR";
+    createCacheInVMs(port, vm2);
+    vm2.invoke(() -> createReceiver());
+    vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
+    vm4.invoke(() -> doPuts(regionName, 10));
+    vm4.invoke(() -> validateRegionSize(regionName, 10));
+    // since sender is paused, no dispatching
+    vm2.invoke(() -> validateRegionSize(regionName, 0));
+  }
+
+  protected void createAndStartTwoSenders(VM vm, int port, int concurrencyLevel) {
+    // Note: This is a test-specific method used to create and start 2 senders.
+    vm.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(port));
+    vm.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln1,ln2", 1, 100, isOffHeap()));
+    createSenders(vm, concurrencyLevel);
+    vm.invoke(() -> startSender("ln1"));
+    vm.invoke(() -> startSender("ln2"));
+  }
+
+  protected void createAndStartSenderWithCustomerOrderShipmentRegion(VM vm, int port, int concurrencyLevel, boolean manualStart) {
+    vm.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(port));
+    vm.invoke(() -> createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap()));
+    createSender(vm, concurrencyLevel, manualStart);
+    vm.invoke(() -> startSender("ln"));
+  }
+
+  protected void createSender(VM vm, int concurrencyLevel, boolean manualStart) {
+    vm.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, manualStart, concurrencyLevel, OrderPolicy.KEY));
+  }
+
+  protected void createSenders(VM vm, int concurrencyLevel) {
+    vm.invoke(() -> createConcurrentSender("ln1", 2, true, 100, 10, false, false, null, true, concurrencyLevel, OrderPolicy.KEY));
+    vm.invoke(() -> createConcurrentSender("ln2", 3, true, 100, 10, false, false, null, true, concurrencyLevel, OrderPolicy.KEY));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
new file mode 100644
index 0000000..f09e19c
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderOperationsDUnitTest;
+import com.gemstone.gemfire.test.dunit.VM;
+
+/**
+ *
+ */
+@Category(DistributedTest.class)
+public class ConcurrentSerialGatewaySenderOperationsDUnitTest  extends SerialGatewaySenderOperationsDUnitTest {
+
+  private static final long serialVersionUID = 1L;
+
+  public ConcurrentSerialGatewaySenderOperationsDUnitTest() {
+    super();
+  }
+
+  protected void createSenderVM5() {
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY ));
+  }
+
+  protected void createSenderVM4() {
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY ));
+  }
+
+  protected void validateQueueClosedVM4() {
+    vm4.invoke(() -> WANTestBase.validateQueueClosedForConcurrentSerialGatewaySender( "ln"));
+  }
+  
+  private void validateQueueContents(VM vm, String site, int size) {
+    vm.invoke(() -> WANTestBase.validateQueueContentsForConcurrentSerialGatewaySender( site, size));
+  }
+
+  public static void verifySenderPausedState(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertTrue(sender.isPaused());
+  }
+
+  public static void verifySenderResumedState(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertFalse(sender.isPaused());
+    assertTrue(sender.isRunning());
+  }
+
+  public static void verifySenderStoppedState(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertFalse(sender.isRunning());
+    assertFalse(sender.isPaused());
+  }
+
+  public static void verifyGatewaySenderOperations(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    assertFalse(sender.isPaused());
+    assertFalse(((AbstractGatewaySender)sender).isRunning());
+    sender.pause();
+    sender.resume();
+    sender.stop();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java
new file mode 100644
index 0000000..3a0caef
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest extends
+    ConcurrentSerialGatewaySenderOperationsDUnitTest {
+
+  public ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java
new file mode 100644
index 0000000..ead62e0
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java
@@ -0,0 +1,568 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.EntryExistsException;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.cache.wan.BatchException70;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+
+/**
+ * All the test cases are similar to SerialWANPropagationDUnitTest except that
+ * the we create concurrent serial GatewaySender with concurrency of 4
+ *
+ */
+@Category(DistributedTest.class)
+public class ConcurrentWANPropagation_1_DUnitTest extends WANTestBase {
+
+  /**
+   * @param name
+   */
+  public ConcurrentWANPropagation_1_DUnitTest() {
+    super();
+  }
+
+  private static final long serialVersionUID = 1L;
+  
+  /**
+   * All the test cases are similar to SerialWANPropagationDUnitTest
+   * @throws Exception
+   */
+  @Test
+  public void testReplicatedSerialPropagation_withoutRemoteSite() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //keep the batch size high enough to reduce the number of exceptions in the log
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 400, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 400, false, false, null, true, 4, OrderPolicy.KEY ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+  
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  
+  @Test
+  public void testReplicatedSerialPropagationWithLocalSiteClosedAndRebuilt() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+    
+    //---------close local site and build again-----------------------------------------
+    vm4.invoke(() -> WANTestBase.killSender( ));
+    vm5.invoke(() -> WANTestBase.killSender( ));
+    vm6.invoke(() -> WANTestBase.killSender( ));
+    vm7.invoke(() -> WANTestBase.killSender( ));
+    
+    Integer regionSize = 
+      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_RR" ));
+    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+    //----------------------------------------------------------------------------------
+
+    //verify remote site receives all the events
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  /**
+   * Two regions configured with the same sender and put is in progress 
+   * on both the regions.
+   * One of the two regions is destroyed in the middle.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithLocalRegionDestroy() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 20, false, false, null, true, 3, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 20, false, false, null, true ,3, OrderPolicy.THREAD));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+
+    //create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap() ));
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+
+    //create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+    //do puts in RR_2 in main thread
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 500 ));
+    //destroy RR_2 after above puts are complete
+    vm4.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
+    
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    //sleep for some time to let all the events propagate to remote site
+    Thread.sleep(20);
+    //vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_2", 500 ));
+  }
+
+  /**
+   * 1 region and sender configured on local site and 1 region and a 
+   * receiver configured on remote site. Puts to the local region are in progress.
+   * Remote region is destroyed in the middle.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 500, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 500, false, false, null, true, 5, OrderPolicy.KEY ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 10000 ));
+    //destroy RR_1 in remote site
+    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_1"));
+    
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+
+    //verify that all is well in local site. All the events should be present in local region
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 10000 ));
+    //assuming some events might have been dispatched before the remote region was destroyed,
+    //sender's region queue will have events less than 1000 but the queue will not be empty.
+    //NOTE: this much verification might be sufficient in DUnit. Hydra will take care of 
+    //more in depth validations.
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmptyForConcurrentSender("ln" ));
+  }
+  
+  /**
+   * Two regions configured in local with the same sender and put is in progress 
+   * on both the regions. Same two regions are configured on remote site as well.
+   * One of the two regions is destroyed in the middle on remote site.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy2() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+
+    //create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap() ));
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
+
+    //create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
+    //destroy RR_2 on remote site in the middle
+    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
+    
+    //expected exceptions in the logs
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    //start puts in RR_2 in another thread
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
+    
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+   
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    //though region RR_2 is destroyed, RR_1 should still get all the events put in it 
+    //in local site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 1000 ));
+
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy3()
+      throws Exception {
+    final String senderId = "ln";
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    // these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    // senders are created on local site
+    vm4.invoke(() -> WANTestBase.createConcurrentSender(  senderId, 2,
+        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( senderId, 2,
+        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap() ));
+
+    // create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap() ));
+
+
+    // start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
+
+    // create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
+
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+    // start puts in RR_2 in another thread
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
+    // destroy RR_2 on remote site in the middle
+    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName()
+        + "_RR_2" ));
+
+    try {
+      inv1.join();
+      inv2.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    // though region RR_2 is destroyed, RR_1 should still get all the events put
+    // in it
+    // in local site
+    try {
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR_1", 1000 ));
+    } finally {
+      System.setProperty(
+          DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
+      vm4.invoke(new CacheSerializableRunnable("UnSetting system property ") {
+        public void run2() throws CacheException {
+          System.setProperty(
+              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
+        }
+      });
+
+      vm5.invoke(new CacheSerializableRunnable("UnSetting system property ") {
+        public void run2() throws CacheException {
+          System.setProperty(
+              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
+        }
+      });
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java
new file mode 100644
index 0000000..cfe4169
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java
@@ -0,0 +1,448 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+/**
+ * All the test cases are similar to SerialWANPropagationDUnitTest except that
+ * the we create concurrent serial GatewaySender with concurrency of 4
+ */
+@Category(DistributedTest.class)
+public class ConcurrentWANPropagation_2_DUnitTest extends WANTestBase {
+
+  public ConcurrentWANPropagation_2_DUnitTest() {
+    super();
+  }
+
+  private static final long serialVersionUID = 1L;
+
+  @Test
+  public void testSerialReplicatedWanWithOverflow() {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //keep the maxQueueMemory low enough to trigger eviction
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 10, 5, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 10, 5, false, false, null, true, 5, OrderPolicy.KEY ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+    vm2.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
+    vm3.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doHeavyPuts(
+        getTestMethodName() + "_RR", 15 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 15, 240000));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 15, 240000 ));
+  }
+
+  @Ignore("Bug46921")
+  @Test
+  public void testSerialReplicatedWanWithPersistence() {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, true, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, true, null, true, 5, OrderPolicy.THREAD ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationToTwoWanSites() throws Exception {
+
+    Integer lnPort = createFirstLocatorWithDSId(1);
+    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createCacheInVMs(tkPort, vm3);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true, 5 , OrderPolicy.THREAD));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("lnSerial1", vm4, vm5);
+
+    startSenderInVMs("lnSerial2", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationHA() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
+    Wait.pause(2000);
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    
+    inv1.join();
+    inv2.join();
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithConflation() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 1000, true, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 1000, true, false, null, true, 5, OrderPolicy.THREAD ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithParallelThreads()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 4, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 4, OrderPolicy.THREAD ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doMultiThreadedPuts(
+        getTestMethodName() + "_RR", 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+
+  @Test
+  public void testSerialPropagationWithFilter() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithFilter() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName(), null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName(), null, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+  }
+  
+  @Test
+  public void testNormalRegionSerialPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createCache(nyPort));
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    WANTestBase.createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
+
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createNormalRegion(
+        getTestMethodName() + "_RR", "ln" ));
+    vm5.invoke(() -> WANTestBase.createNormalRegion(
+        getTestMethodName() + "_RR", "ln" ));
+
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
+        0, 0, 0));
+
+    vm5.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
+        1000, 0, 0 ));
+    
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 1000));
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 0));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 0 ));
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 0, 0));
+    
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/disttx/DistTXWANDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/disttx/DistTXWANDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/disttx/DistTXWANDUnitTest.java
new file mode 100644
index 0000000..0ac13d4
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/disttx/DistTXWANDUnitTest.java
@@ -0,0 +1,182 @@
+/*
+ * 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.internal.cache.wan.disttx;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class DistTXWANDUnitTest extends WANTestBase {
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    Invoke.invokeInEveryVM(new SerializableCallable() {
+      @Override
+      public Object call() throws Exception {
+        System.setProperty(DistributionConfig.GEMFIRE_PREFIX + LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+        return null;
+      }
+    }); 
+  }
+
+  /**
+   * Disabled because it hangs with current implementation of notifying
+   * adjunct receivers by sending DistTXAdjunctCommitMessage from primary at the
+   * time of commit.
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void testPartitionedSerialPropagation_SenderSameAsCoordinator() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doDistTXPuts( getTestMethodName() + "_PR",
+        50 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 50 ));
+  }
+
+  @Test
+  public void testPartitionedSerialPropagation_SenderNotSameAsCoordinator() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm6.invoke(() -> WANTestBase.doDistTXPuts( getTestMethodName() + "_PR",
+        50 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 50 ));
+  }
+
+  @Test
+  public void testPartitionedRegionParallelPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doDistTXPuts( getTestMethodName() + "_PR",
+        5 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 5 ));
+  }
+}


[21/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
deleted file mode 100644
index b1e070d..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
+++ /dev/null
@@ -1,1013 +0,0 @@
-/*
- * 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.management.internal.configuration;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.query.Index;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.internal.ClassBuilder;
-import com.gemstone.gemfire.internal.JarClassLoader;
-import com.gemstone.gemfire.internal.JarDeployer;
-import com.gemstone.gemfire.internal.admin.remote.ShutdownAllRequest;
-import com.gemstone.gemfire.internal.cache.DiskStoreImpl;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.extension.Extensible;
-import com.gemstone.gemfire.internal.cache.extension.Extension;
-import com.gemstone.gemfire.internal.cache.extension.mock.MockCacheExtension;
-import com.gemstone.gemfire.internal.cache.extension.mock.MockExtensionCommands;
-import com.gemstone.gemfire.internal.cache.extension.mock.MockRegionExtension;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlParser;
-import com.gemstone.gemfire.management.cli.Result.Status;
-import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
-import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.*;
-import java.util.Map.Entry;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static com.gemstone.gemfire.internal.FileUtil.delete;
-import static com.gemstone.gemfire.internal.FileUtil.deleteMatching;
-import static com.gemstone.gemfire.internal.lang.StringUtils.isBlank;
-import static com.gemstone.gemfire.management.internal.cli.CliUtil.getAllNormalMembers;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.Host.getHost;
-import static com.gemstone.gemfire.test.dunit.IgnoredException.addIgnoredException;
-import static com.gemstone.gemfire.test.dunit.Wait.waitForCriterion;
-import static org.apache.commons.io.FileUtils.*;
-
-@Category(DistributedTest.class)
-public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
-
-  private static final int TIMEOUT = 10000;
-  private static final int INTERVAL = 500;
-
-  private static final String REPLICATE_REGION = "ReplicateRegion1";
-  private static final String PARTITION_REGION = "PartitionRegion1";
-  private static final String DISK_REGION1 = "DR1";
-  private static final String INDEX1 = "ID1";
-  private static final String INDEX2 = "ID2";
-  private static final String GROUP1 = "G1";
-  private static final String GROUP2 = "G2";
-  private static final String JAR1 = "D1.jar";
-  private static final String JAR2 = "D2.jar";
-  private static final String JAR3 = "D3.jar";
-  private static final String AsyncEventQueue1 = "Q1";
-
-  private static final String dataMember = "DataMember";
-  private static final String newMember = "NewMember";
-
-  private static Set<String> serverNames = new HashSet<>();
-  private static Set<String> jarFileNames = new HashSet<>();
-
-  private transient ClassBuilder classBuilder = new ClassBuilder();
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    disconnectAllFromDS();
-  }
-
-  @Override
-  public final void preTearDownCliCommandTestBase() throws Exception {
-    shutdownAll();
-
-    serverNames.clear();
-    jarFileNames.clear();
-  }
-
-  @Test
-  public void testConfigDistribution() throws Exception {
-    addIgnoredException("could not get remote locator");
-    addIgnoredException("EntryDestroyedException");
-
-    String workingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator;
-
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-    final String jmxHost = (String) result[1];
-    final int jmxPort = (Integer) result[2];
-    final int httpPort = (Integer) result[3];
-    final String locatorString = "localHost[" + locatorPort + "]";
-
-    String gatewayReceiverStartPort = "10000";
-    String gatewayReceiverEndPort = "20000";
-    final String gsId = "GatewaySender1";
-    final String batchSize = "1000";
-    final String dispatcherThreads = "5";
-    final String enableConflation = "false";
-    final String manualStart = "false";
-    final String receiverManualStart = "true";
-    final String alertThreshold = "1000";
-    final String batchTimeInterval = "20";
-    final String maxQueueMemory = "100";
-    final String orderPolicy = OrderPolicy.KEY.toString();
-    final String parallel = "true";
-    final String rmDsId = "250";
-    final String socketBufferSize = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000);
-    final String socketReadTimeout = String.valueOf(GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+200);
-    final String DESTROY_REGION = "regionToBeDestroyed";
-
-    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
-    createRegion(PARTITION_REGION, RegionShortcut.PARTITION, null);
-    createRegion(DESTROY_REGION, RegionShortcut.REPLICATE, null);
-    createIndex(INDEX1, "AAPL", REPLICATE_REGION, null);
-    createIndex(INDEX2, "VMW", PARTITION_REGION, null);
-
-    createAndDeployJar(workingDir + JAR1, null);
-    createAndDeployJar(workingDir + JAR2, null);
-    createAndDeployJar(workingDir + JAR3, null);
-
-    createAsyncEventQueue(AsyncEventQueue1, "false", null, "1000", "1000",  null);
-    destroyRegion(DESTROY_REGION);
-    destroyIndex(INDEX2, PARTITION_REGION, null);
-
-    undeployJar(JAR3, null);
-
-    alterRuntime("true", "", "", "");
-    createGatewayReceiver(receiverManualStart, "", gatewayReceiverStartPort, gatewayReceiverEndPort, "20", "");
-    createGatewaySender(gsId, batchSize, alertThreshold, batchTimeInterval, dispatcherThreads, enableConflation, manualStart, maxQueueMemory, orderPolicy, parallel, rmDsId, socketBufferSize, socketReadTimeout);
-
-    //alterRegion(PARTITION_REGION, "false", AsyncEventQueue1, "", "", "", "", "", "", gsId);
-    //Start a new member which receives the shared configuration
-    //Verify the config creation on this member
-
-    final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-
-        assertNotNull(cache);
-        assertTrue(cache.getCopyOnRead());
-
-        Region region1 = cache.getRegion(REPLICATE_REGION);
-        assertNotNull(region1);
-        Region region2 = cache.getRegion(PARTITION_REGION);
-        assertNotNull(region2);
-
-        Region region3 = cache.getRegion(DESTROY_REGION);
-        assertNull(region3);
-
-        //Index verification
-        Index index1 = cache.getQueryService().getIndex(region1, INDEX1);
-        assertNotNull(index1);
-        assertNull(cache.getQueryService().getIndex(region2, INDEX2));
-
-        final JarDeployer jarDeployer = new JarDeployer(((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
-
-        final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
-
-        Set<String> jarNames = new HashSet<String>();
-
-        for (JarClassLoader jarClassLoader : jarClassLoaders) {
-          jarNames.add(jarClassLoader.getJarName());
-        }
-
-        assertTrue(jarNames.contains(JAR1));
-        assertTrue(jarNames.contains(JAR2));
-        assertFalse(jarNames.contains(JAR3));
-
-        //ASYNC-EVENT-QUEUE verification
-        AsyncEventQueue aeq = cache.getAsyncEventQueue(AsyncEventQueue1);
-        assertNotNull(aeq);
-        assertFalse(aeq.isPersistent());
-        assertTrue(aeq.getBatchSize() == 1000);
-        assertTrue(aeq.getMaximumQueueMemory() == 1000);
-
-        //GatewayReceiver verification
-        Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
-        assertFalse(gatewayReceivers.isEmpty());
-        assertTrue(gatewayReceivers.size() == 1);
-
-        //Gateway Sender verification
-        GatewaySender gs = cache.getGatewaySender(gsId);
-        assertNotNull(gs);
-        assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
-        assertTrue(batchSize.equals(Integer.toString(gs.getBatchSize())));
-        assertTrue(dispatcherThreads.equals(Integer.toString(gs.getDispatcherThreads())));
-        assertTrue(enableConflation.equals(Boolean.toString(gs.isBatchConflationEnabled())));
-        assertTrue(manualStart.equals(Boolean.toString(gs.isManualStart())));
-        assertTrue(alertThreshold.equals(Integer.toString(gs.getAlertThreshold())));
-        assertTrue(batchTimeInterval.equals(Integer.toString(gs.getBatchTimeInterval())));
-        assertTrue(maxQueueMemory.equals(Integer.toString(gs.getMaximumQueueMemory())));
-        assertTrue(orderPolicy.equals(gs.getOrderPolicy().toString()));
-        assertTrue(parallel.equals(Boolean.toString(gs.isParallel())));
-        assertTrue(rmDsId.equals(Integer.toString(gs.getRemoteDSId())));
-        assertTrue(socketBufferSize.equals(Integer.toString(gs.getSocketBufferSize())));
-        assertTrue(socketReadTimeout.equals(Integer.toString(gs.getSocketReadTimeout())));
-
-        return getAllNormalMembers(cache);
-      }
-    });
-  }
-
-  /**
-   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser},
-   * {@link XmlGenerator}, {@link XmlEntity} as it applies to Extensions.
-   * Asserts that Mock Extension is created and altered on region and cache.
-   * 
-   * @since GemFire 8.1
-   */
-  @Test
-  public void testCreateExtensions() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-
-    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
-    createMockRegionExtension(REPLICATE_REGION, "value1");
-    alterMockRegionExtension(REPLICATE_REGION, "value2");
-    createMockCacheExtension("value1");
-    alterMockCacheExtension("value2");
-
-    //Start a new member which receives the shared configuration
-    //Verify the config creation on this member
-
-    final String newMemberWorkDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-
-        assertNotNull(cache);
-
-        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
-        assertNotNull(region1);
-
-        //MockRegionExtension verification
-        @SuppressWarnings("unchecked")
-        // should only be one region extension
-        final MockRegionExtension mockRegionExtension = (MockRegionExtension) ((Extensible<Region<?,?>>) region1).getExtensionPoint().getExtensions().iterator().next();
-        assertNotNull(mockRegionExtension);
-        assertEquals(1, mockRegionExtension.beforeCreateCounter.get());
-        assertEquals(1, mockRegionExtension.onCreateCounter.get());
-        assertEquals("value2", mockRegionExtension.getValue());
-
-        //MockCacheExtension verification
-        @SuppressWarnings("unchecked")
-        // should only be one cache extension
-        final MockCacheExtension mockCacheExtension = (MockCacheExtension) ((Extensible<Cache>) cache).getExtensionPoint().getExtensions().iterator().next();
-        assertNotNull(mockCacheExtension);
-        assertEquals(1, mockCacheExtension.beforeCreateCounter.get());
-        assertEquals(1, mockCacheExtension.onCreateCounter.get());
-        assertEquals("value2", mockCacheExtension.getValue());
-
-        return getAllNormalMembers(cache);
-      }
-    });
-  }
-
-  /**
-   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser},
-   * {@link XmlGenerator}, {@link XmlEntity} as it applies to Extensions.
-   * Asserts that Mock Extension is created and destroyed on region and cache.
-   * 
-   * @since GemFire 8.1
-   */
-  @Test
-  public void testDestroyExtensions() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-
-    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
-    createMockRegionExtension(REPLICATE_REGION, "value1");
-    destroyMockRegionExtension(REPLICATE_REGION);
-    createMockCacheExtension("value1");
-    destroyMockCacheExtension();
-
-    //Start a new member which receives the shared configuration
-    //Verify the config creation on this member
-
-    final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-
-        assertNotNull(cache);
-
-        Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
-        assertNotNull(region1);
-
-        //MockRegionExtension verification
-        @SuppressWarnings("unchecked")
-        final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?,?>>) region1;
-        // Should not be any region extensions
-        assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
-
-        //MockCacheExtension verification
-        @SuppressWarnings("unchecked")
-        final Extensible<Cache> extensibleCache = (Extensible<Cache>) cache;
-        // Should not be any cache extensions
-        assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
-
-        return getAllNormalMembers(cache);
-      }
-    });
-  }
-
-  @Ignore("disabled for unknown reason") // this passes when @Ignore is removed
-  @Test
-  public void testCreateDiskStore () throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-    final String jmxHost = (String) result[1];
-    final int jmxPort = (Integer) result[2];
-    final int httpPort = (Integer) result[3];
-    final String locatorString = "localHost[" + locatorPort + "]";
-
-    final String diskStoreName = "clusterConfigTestDiskStore";
-    final String diskDirs = "dir1";
-
-    //final String
-    //createPersistentRegion(peersRegion, RegionShortcut.PARTITION_PERSISTENT, "", diskStoreName);
-
-    final String autoCompact = "true";
-    final String allowForceCompaction = "true";
-    final String compactionThreshold = "50";
-    final String duCritical = "90";
-    final String duWarning = "85";
-    final String maxOplogSize = "1000";
-    final String queueSize = "300";
-    final String timeInterval = "10";
-    final String writeBufferSize="100";
-
-    createDiskStore(diskStoreName, diskDirs, autoCompact, allowForceCompaction, compactionThreshold, duCritical, duWarning, maxOplogSize, queueSize, timeInterval, writeBufferSize);
-
-    //createAsyncEventQueue(id, persistent, diskStoreName, batchSize, maxQueueMemory, group)
-
-    //Stop the existing data member
-    VM dataMember = getHost(0).getVM(1);
-    dataMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-
-        CacheFactory cf = new CacheFactory();
-        GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
-        File[] diskDirs = null;
-        Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
-
-        assertFalse(diskStoreList.isEmpty());
-        assertTrue(diskStoreList.size() == 1);
-
-        for (DiskStoreImpl diskStore : diskStoreList) {
-          diskDirs = diskStore.getDiskDirs();
-          break;
-        }
-
-        assertNotNull(diskDirs);
-        assertTrue(diskDirs.length > 0);
-
-        //close the cache
-        cache.close();
-
-        //Delete the disk-store files
-        for (File diskDir : diskDirs) {
-          deleteDirectory(diskDir);
-        }
-        return getAllNormalMembers(cache);
-      }
-    });
-
-    final String newMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
-
-    //Now start the new data member and it should create all the disk-store artifacts
-    VM newMember = getHost(0).getVM(2);
-    newMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-
-        File workingDir = new File(newMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locatorPort+"]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
-        assertNotNull(cache);
-
-
-        Collection<DiskStoreImpl> diskStoreList = cache.listDiskStores();
-
-        assertFalse(diskStoreList.isEmpty());
-        assertTrue(diskStoreList.size() == 1);
-
-        for (DiskStoreImpl diskStore : diskStoreList) {
-          assertTrue(diskStore.getName().equals(diskStoreName));
-          assertTrue(Boolean.toString(diskStore.getAutoCompact()).equals(autoCompact));
-          assertTrue(Boolean.toString(diskStore.getAllowForceCompaction()).equals(allowForceCompaction));
-          assertTrue(Integer.toString(diskStore.getCompactionThreshold()).equals(compactionThreshold));
-          assertTrue(Long.toString(diskStore.getMaxOplogSize()).equals(maxOplogSize));
-          assertTrue(Integer.toString(diskStore.getQueueSize()).equals(queueSize));
-          assertTrue(Integer.toString(diskStore.getWriteBufferSize()).equals(writeBufferSize));
-          assertTrue(Long.toString(diskStore.getTimeInterval()).equals(timeInterval));
-          break;
-        }
-        cache.close();
-        return null;
-      }
-    });
-  }
-
-  @Ignore("disabled for unknown reason") // this fails in configurePDX when @Ignore is removed
-  @Test
-  public void testConfigurePDX() throws Exception {
-    Object[] result = setup();
-    final int locatorPort = (Integer) result[0];
-    final String jmxHost = (String) result[1];
-    final int jmxPort = (Integer) result[2];
-    final int httpPort = (Integer) result[3];
-    final String locatorString = "localHost[" + locatorPort + "]";
-
-    configurePDX("com.foo.*", "true", "true", null, "true");
-
-    VM dataMember = getHost(0).getVM(1);
-    dataMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        GemFireCacheImpl cache = (GemFireCacheImpl)getCache();
-        assertTrue(cache.getPdxReadSerialized());
-        assertTrue(cache.getPdxIgnoreUnreadFields());
-        assertTrue(cache.getPdxPersistent());
-        return null;
-      }
-    });
-  }
-  
-  @Test
-  public void testClusterConfigDir() throws Exception {
-    final int [] ports = getRandomAvailableTCPPorts(3);
-    final int locator1Port = ports[0];
-    final String locator1Name = "locator1-" + locator1Port;
-
-    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
-    final String clusterConfigPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "userSpecifiedDir";
-
-    VM locatorAndMgr = getHost(0).getVM(3);
-    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        int httpPort;
-        int jmxPort;
-        String jmxHost;
-        
-        try {
-          jmxHost = InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException ignore) {
-          jmxHost = "localhost";
-        }
-
-        final int[] ports = getRandomAvailableTCPPorts(2);
-
-        jmxPort = ports[0];
-        httpPort = ports[1];
-        
-        final File locatorLogFile = new File(locatorLogPath);
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, locator1Name);
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "config");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-        locatorProps.setProperty(JMX_MANAGER, "true");
-        locatorProps.setProperty(JMX_MANAGER_START, "true");
-        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
-        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
-        
-        File clusterConfigDir = new File(clusterConfigPath);
-        assertTrue(clusterConfigDir.mkdir());
-        
-        locatorProps.setProperty(CLUSTER_CONFIGURATION_DIR, clusterConfigDir.getCanonicalPath());
-        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
-
-        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
-
-        WaitCriterion wc = new WaitCriterion() {
-          @Override
-          public boolean done() {
-            return locator.isSharedConfigurationRunning();
-          }
-          @Override
-          public String description() {
-            return "Waiting for shared configuration to be started";
-          }
-        };
-        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        assertTrue(clusterConfigDir.list().length > 0);
-
-        final Object[] result = new Object[4];
-        result[0] = locator1Port;
-        result[1] = jmxHost;
-        result[2] = jmxPort;
-        result[3] = httpPort;
-        return result;
-      }
-    });
-  }
-  
-  private Object[] setup() throws IOException {
-    final int [] ports = getRandomAvailableTCPPorts(3);
-    final int locator1Port = ports[0];
-    final String locator1Name = "locator1-" + locator1Port;
-    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "locator-" + locator1Port + ".log";
-
-    VM locatorAndMgr = getHost(0).getVM(3);
-    Object[] result = (Object[]) locatorAndMgr.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        int httpPort;
-        int jmxPort;
-        String jmxHost;
-        
-        try {
-          jmxHost = InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException ignore) {
-          jmxHost = "localhost";
-        }
-
-        final int[] ports = getRandomAvailableTCPPorts(2);
-
-        jmxPort = ports[0];
-        httpPort = ports[1];
-        
-        final File locatorLogFile = new File(locatorLogPath);
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, locator1Name);
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "config");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-        locatorProps.setProperty(JMX_MANAGER, "true");
-        locatorProps.setProperty(JMX_MANAGER_START, "true");
-        locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
-        locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
-        locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
-
-        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port, locatorLogFile, null, locatorProps);
-
-        WaitCriterion wc = new WaitCriterion() {
-          @Override
-          public boolean done() {
-            return locator.isSharedConfigurationRunning();
-          }
-          @Override
-          public String description() {
-            return "Waiting for shared configuration to be started";
-          }
-        };
-        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        final Object[] result = new Object[4];
-        result[0] = locator1Port;
-        result[1] = jmxHost;
-        result[2] = jmxPort;
-        result[3] = httpPort;
-        return result;
-      }
-    });
-
-    HeadlessGfsh gfsh = getDefaultShell();
-    String jmxHost = (String)result[1];
-    int jmxPort = (Integer)result[2];
-    int httpPort = (Integer)result[3];
-    
-    connect(jmxHost, jmxPort, httpPort, gfsh);
-
-    final String dataMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + dataMember;
-
-    // Create a cache in VM 1
-    VM dataMember = getHost(0).getVM(1);
-    dataMember.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        Properties localProps = new Properties();
-        File workingDir = new File(dataMemberWorkingDir);
-        workingDir.mkdirs();
-
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locator1Port+"]");
-        localProps.setProperty(NAME, ClusterConfigurationDUnitTest.dataMember);
-        localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-        localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
-
-        getSystem(localProps);
-        Cache cache = getCache();
-        assertNotNull(cache);
-        return getAllNormalMembers(cache);
-      }
-    });
-
-    return result;
-  }
-  
-  private void createRegion(String regionName, RegionShortcut regionShortCut, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
-    csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
-    csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createMockRegionExtension(final String regionName, final String value) {
-    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_REGION_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void alterMockRegionExtension(final String regionName, final String value) {
-    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_REGION_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void destroyMockRegionExtension(final String regionName) {
-    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_REGION_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createMockCacheExtension(final String value) {
-    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_CACHE_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void alterMockCacheExtension(final String value) {
-    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.ALTER_MOCK_CACHE_EXTENSION);
-    csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void destroyMockCacheExtension() {
-    CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.DESTROY_MOCK_CACHE_EXTENSION);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void createPersistentRegion(String regionName, RegionShortcut regionShortCut, String group, String diskStoreName) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGION, regionName);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__DISKSTORE, diskStoreName);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-  
-  private void destroyRegion(String regionName) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_REGION);
-    csb.addOption(CliStrings.DESTROY_REGION__REGION, regionName);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-  
-  private void alterRegion(String regionName,
-                           String cloningEnabled,
-                           String aeqId,
-                           String cacheListener,
-                           String cacheWriter,
-                           String cacheLoader,
-                           String entryExpIdleTime,
-                           String entryExpIdleTimeAction,
-                           String evictionMax,
-                           String gsId) {
-
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_REGION);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, "false");
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, aeqId);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHELISTENER, cacheListener);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHEWRITER, cacheWriter);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CACHELOADER, cacheLoader);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__CLONINGENABLED, cloningEnabled);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME, entryExpIdleTime);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION, entryExpIdleTimeAction);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__EVICTIONMAX, evictionMax);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_REGION__GATEWAYSENDERID, gsId);
-
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void executeAndVerifyCommand(String commandString) {
-    CommandResult cmdResult = executeCommand(commandString);
-    com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Command : " + commandString);
-    com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Command Result : " + commandResultToString(cmdResult));
-    assertEquals(Status.OK, cmdResult.getStatus());
-    assertFalse(cmdResult.failedToPersist());
-  }
-  
-  private void createIndex(String indexName, String expression, String regionName, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
-    csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
-    csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
-    csb.addOption(CliStrings.CREATE_INDEX__REGION, regionName);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void destroyIndex(String indexName, String regionName, String group) {
-    if (isBlank(indexName) && isBlank(regionName) && isBlank(group)) {
-      return;
-    }
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__NAME, indexName);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__REGION, regionName);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_INDEX__GROUP, group);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-  
-  private void createDiskStore(String diskStoreName,
-                               String diskDirs,
-                               String autoCompact,
-                               String allowForceCompaction,
-                               String compactionThreshold,
-                               String duCritical,
-                               String duWarning,
-                               String maxOplogSize,
-                               String queueSize,
-                               String timeInterval,
-                               String writeBufferSize) {
-
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
-    csb.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreName);
-    csb.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE, diskDirs);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT, autoCompact);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION, allowForceCompaction);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__COMPACTION_THRESHOLD, compactionThreshold);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__DISK_USAGE_CRITICAL_PCT, duCritical);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__DISK_USAGE_WARNING_PCT, duWarning);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__MAX_OPLOG_SIZE, maxOplogSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__QUEUE_SIZE, queueSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, timeInterval);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, writeBufferSize);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-  
-  private void destroyDiskStore(String diskStoreName, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESTROY_DISK_STORE);
-    csb.addOption(CliStrings.DESTROY_DISK_STORE__NAME, diskStoreName);
-    csb.addOptionWithValueCheck(CliStrings.DESTROY_DISK_STORE__GROUP, group);
-    executeAndVerifyCommand(csb.toString());
-  }
-  
-  private void createGatewayReceiver(String manualStart, String bindAddress, String startPort, String endPort, String maxTimeBetweenPings, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYRECEIVER);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART, manualStart);
-    csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT, startPort);
-    csb.addOption(CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT, endPort);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS, bindAddress);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__GROUP, group);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS, maxTimeBetweenPings);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-  
-  private void createGatewaySender(String id, 
-                                   String batchSize,
-                                   String alertThreshold,
-                                   String batchTimeInterval,
-                                   String dispatcherThreads,
-                                   String enableConflation,
-                                   String manualStart,
-                                   String maxQueueMemory,
-                                   String orderPolicy,
-                                   String parallel,
-                                   String rmDsId,
-                                   String socketBufferSize,
-                                   String socketReadTimeout) {
-    
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_GATEWAYSENDER);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ID, id);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE, batchSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD, alertThreshold);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL, batchTimeInterval);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS, dispatcherThreads);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION, enableConflation);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__MANUALSTART, manualStart);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY, maxQueueMemory);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY, orderPolicy);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__PARALLEL, parallel);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID, rmDsId);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE, socketBufferSize);
-    csb.addOptionWithValueCheck(CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT, socketReadTimeout);
-    
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-  
-  private void createAsyncEventQueue(String id, String persistent , String diskStoreName, String batchSize, String maxQueueMemory, String group) throws IOException {
-    String queueCommandsJarName = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + "testEndToEndSC-QueueCommands.jar";
-    final File jarFile = new File(queueCommandsJarName);
-
-    try {
-      ClassBuilder classBuilder = new ClassBuilder();
-      byte[] jarBytes = classBuilder.createJarFromClassContent("com/qcdunit/QueueCommandsDUnitTestListener",
-          "package com.qcdunit;" +
-          "import java.util.List; import java.util.Properties;" +
-          "import com.gemstone.gemfire.internal.cache.xmlcache.Declarable2; import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;" +
-          "import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;" +
-          "public class QueueCommandsDUnitTestListener implements Declarable2, AsyncEventListener {" +
-          "Properties props;" +
-          "public boolean processEvents(List<AsyncEvent> events) { return true; }" +
-          "public void close() {}" +
-          "public void init(final Properties props) {this.props = props;}" +
-          "public Properties getConfig() {return this.props;}}");
-      
-      writeByteArrayToFile(jarFile, jarBytes);
-      CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
-      csb.addOption(CliStrings.DEPLOY__JAR, queueCommandsJarName);
-      executeAndVerifyCommand(csb.getCommandString());
-      
-      csb = new CommandStringBuilder(CliStrings.CREATE_ASYNC_EVENT_QUEUE);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__ID, id);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER, "com.qcdunit.QueueCommandsDUnitTestListener");
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISK_STORE, diskStoreName);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__BATCH_SIZE, batchSize);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GROUP, group);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__PERSISTENT, persistent);
-      csb.addOptionWithValueCheck(CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY, maxQueueMemory);
-      executeAndVerifyCommand(csb.getCommandString());
-      
-    } finally {
-      deleteQuietly(jarFile);
-    }
-  }
-
-  private void configurePDX(String autoSerializerClasses, String ignoreUnreadFields, String persistent, String portableAutoSerializerClasses, String readSerialized) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CONFIGURE_PDX);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__AUTO__SERIALIZER__CLASSES, autoSerializerClasses);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__IGNORE__UNREAD_FIELDS, ignoreUnreadFields);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__PERSISTENT, persistent);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__PORTABLE__AUTO__SERIALIZER__CLASSES, portableAutoSerializerClasses);
-    csb.addOptionWithValueCheck(CliStrings.CONFIGURE_PDX__READ__SERIALIZED, readSerialized);
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void createAndDeployJar(String jarName, String group) throws IOException {
-    File newDeployableJarFile = new File(jarName);
-    this.classBuilder.writeJarFromName("ShareConfigClass", newDeployableJarFile);
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEPLOY);
-    csb.addOption(CliStrings.DEPLOY__JAR, jarName);
-    if (!isBlank(group)) {
-      csb.addOption(CliStrings.DEPLOY__GROUP, group);
-    }
-    executeAndVerifyCommand(csb.getCommandString());
-    jarFileNames.add(jarName);
-  }
-
-  private void undeployJar(String jarName, String group) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.UNDEPLOY);
-    if (!isBlank(jarName)) {
-      csb.addOption(CliStrings.UNDEPLOY__JAR, jarName);
-    }
-    if (!isBlank(group)) {
-      csb.addOption(CliStrings.UNDEPLOY__GROUP, group);
-    }
-    executeAndVerifyCommand(csb.getCommandString());
-  }
-
-  private void alterRuntime(String copyOnRead, String lockLease, String lockTimeout, String messageSyncInterval) {
-    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ, copyOnRead);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE, lockLease);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT, lockTimeout);
-    csb.addOptionWithValueCheck(CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL, messageSyncInterval);
-    executeAndVerifyCommand(csb.toString());
-  }
-
-  private void deleteSavedJarFiles() throws IOException {
-    deleteMatching(new File("."), "^" + JarDeployer.JAR_PREFIX + "Deploy1.*#\\d++$");
-    delete(new File("Deploy1.jar"));
-  }
-
-  private void shutdownAll() throws IOException {
-    VM locatorAndMgr = getHost(0).getVM(3);
-    locatorAndMgr.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        GemFireCacheImpl cache = (GemFireCacheImpl)CacheFactory.getAnyInstance();
-        ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
-        return null;
-      }
-    });
-
-    locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
-    //Clean up the directories
-    if (serverNames != null && !serverNames.isEmpty()) {
-      for (String serverName : serverNames) {
-        final File serverDir = new File(serverName);
-        cleanDirectory(serverDir);
-        deleteDirectory(serverDir);
-      }
-    }
-  }
-
-  private static class CommandBuilder {
-
-    private CommandStringBuilder csb;
-
-    public CommandBuilder(String commandName, Map<String, String> options) {
-      csb = new CommandStringBuilder(commandName);
-
-      Set<Entry<String, String>> entries = options.entrySet();
-
-      Iterator<Entry<String, String>> iter = entries.iterator();
-
-      while (iter.hasNext()) {
-        Entry<String, String> entry = iter.next();
-        String option = entry.getKey();
-
-        if (isBlank(option)) {
-          csb.addOption(option, entry.getValue());
-        }
-      }
-    }
-
-    public String getCommandString() {
-      return csb.toString();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
deleted file mode 100644
index 4829523..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * 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.management.internal.pulse;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.management.DistributedSystemMXBean;
-import com.gemstone.gemfire.management.GatewayReceiverMXBean;
-import com.gemstone.gemfire.management.GatewaySenderMXBean;
-import com.gemstone.gemfire.management.MBeanUtil;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.management.ManagementTestBase;
-import com.gemstone.gemfire.management.RegionMXBean;
-
-import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-
-/**
- * This is for testing remote Cluster
- * 
- * 
- */
-
-@Category(DistributedTest.class)
-public class TestRemoteClusterDUnitTest extends ManagementTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  public static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-
-  public TestRemoteClusterDUnitTest() throws Exception {
-    super();
-  }
-
-  @Test
-  public void testMBeanCallback() throws Exception {
-
-    VM nyLocator = getManagedNodeList().get(0);
-    VM nyReceiver = getManagedNodeList().get(1);
-    VM puneSender = getManagedNodeList().get(2);
-    VM managing = getManagingNode();
-    VM puneLocator = Host.getLocator();
-
-    int punePort = (Integer) puneLocator.invoke(() -> TestRemoteClusterDUnitTest.getLocatorPort());
-
-    Integer nyPort = (Integer) nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
-
-    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
-    managing.invoke(() -> WANTestBase.createManagementCache( punePort ));
-    startManagingNode(managing);
-
-    puneSender.invoke(() -> WANTestBase.createSender( "pn",
-        12, true, 100, 300, false, false, null, true ));
-    managing.invoke(() -> WANTestBase.createSender( "pn", 12,
-        true, 100, 300, false, false, null, true ));
-
-    puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
-    managing.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "pn", 1, 100, false ));
-
-    WANTestBase.createCacheInVMs(nyPort, nyReceiver);
-    nyReceiver.invoke(() -> WANTestBase.createReceiver());
-    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
-
-    WANTestBase.startSenderInVMs("pn", puneSender, managing);
-
-    // make sure all the senders are running before doing any puts
-    puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
-    managing.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
-
-    checkSenderMBean(puneSender, getTestMethodName() + "_PR");
-    checkSenderMBean(managing, getTestMethodName() + "_PR");
-
-    checkReceiverMBean(nyReceiver);
-
-    stopGatewaySender(puneSender);
-    startGatewaySender(puneSender);
-
-    DistributedMember puneMember = (DistributedMember) puneSender.invoke(() -> TestRemoteClusterDUnitTest.getMember());
-
-    checkRemoteClusterStatus(managing, puneMember);
-
-  }
-
-  private static int getLocatorPort() {
-    return Locator.getLocators().get(0).getPort();
-  }
-
-  private static DistributedMember getMember() {
-    return GemFireCacheImpl.getInstance().getMyId();
-  }
-
-  /**
-   * Checks Proxy GatewaySender
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkRemoteClusterStatus(final VM vm,
-      final DistributedMember senderMember) {
-    SerializableRunnable checkProxySender = new SerializableRunnable(
-        "DS Map Size") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-          final WaitCriterion waitCriteria2 = new WaitCriterion() {
-            @Override
-            public boolean done() {
-              Cache cache = GemFireCacheImpl.getInstance();
-              final ManagementService service = ManagementService
-                  .getManagementService(cache);
-              final DistributedSystemMXBean dsBean = service
-                  .getDistributedSystemMXBean();
-              if (dsBean != null) {
-                return true;
-              }
-              return false;
-            }
-            @Override
-            public String description() {
-              return "wait for getDistributedSystemMXBean to complete and get results";
-            }
-          };
-          Wait.waitForCriterion(waitCriteria2, 2 * 60 * 1000, 5000, true);
-          ManagementService service = ManagementService
-              .getManagementService(cache);
-          final DistributedSystemMXBean dsBean = service
-              .getDistributedSystemMXBean();
-          assertNotNull(dsBean);
-          Map<String, Boolean> dsMap = dsBean.viewRemoteClusterStatus();
-          LogWriterUtils.getLogWriter().info(
-              "Ds Map is: " + dsMap.size());
-          assertNotNull(dsMap);
-          assertEquals(true, dsMap.size() > 0 ? true : false);
-        }      
-    };
-    vm.invoke(checkProxySender);
-  }
-
-
-  /**
-   * stops a gateway sender
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void stopGatewaySender(final VM vm) {
-    SerializableRunnable stopGatewaySender = new SerializableRunnable(
-        "Stop Gateway Sender") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
-        assertNotNull(bean);
-        bean.stop();
-        assertFalse(bean.isRunning());
-      }
-    };
-    vm.invoke(stopGatewaySender);
-  }
-
-  /**
-   * start a gateway sender
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void startGatewaySender(final VM vm) {
-    SerializableRunnable stopGatewaySender = new SerializableRunnable(
-        "Start Gateway Sender") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
-        assertNotNull(bean);
-        bean.start();
-        assertTrue(bean.isRunning());
-      }
-    };
-    vm.invoke(stopGatewaySender);
-  }
-
-  /**
-   * Checks whether a GatewayReceiverMBean is created or not
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkReceiverMBean(final VM vm) {
-    SerializableRunnable checkMBean = new SerializableRunnable(
-        "Check Receiver MBean") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        GatewayReceiverMXBean bean = service.getLocalGatewayReceiverMXBean();
-        assertNotNull(bean);
-      }
-    };
-    vm.invoke(checkMBean);
-  }
-
-  /**
-   * Checks whether a GatewayReceiverMBean is created or not
-   * 
-   * @param vm reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkSenderMBean(final VM vm, final String regionPath) {
-    SerializableRunnable checkMBean = new SerializableRunnable(
-        "Check Sender MBean") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-
-        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
-        assertNotNull(bean);
-        assertTrue(bean.isConnected());
-
-        ObjectName regionBeanName = service.getRegionMBeanName(cache
-            .getDistributedSystem().getDistributedMember(), "/" + regionPath);
-        RegionMXBean rBean = service.getMBeanInstance(regionBeanName,
-            RegionMXBean.class);
-        assertTrue(rBean.isGatewayEnabled());
-
-      }
-    };
-    vm.invoke(checkMBean);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java
new file mode 100644
index 0000000..3014b1b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java
@@ -0,0 +1,255 @@
+/*
+ * 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;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewayQueueEvent;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.cache30.CacheXml70DUnitTest;
+import com.gemstone.gemfire.cache30.CacheXmlTestCase;
+import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
+import com.gemstone.gemfire.internal.cache.xmlcache.ParallelGatewaySenderCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.SerialGatewaySenderCreation;
+
+@Category(DistributedTest.class)
+public class CacheXml70GatewayDUnitTest extends CacheXmlTestCase {
+
+  public CacheXml70GatewayDUnitTest() {
+    super();
+  }
+
+  protected String getGemFireVersion() {
+    return CacheXml.VERSION_7_0;
+  }
+  
+  /**
+   * Added to test the scenario of defect #50600.
+   */
+  @Test
+  public void testAsyncEventQueueWithGatewayEventFilter() {
+    getSystem();
+    CacheCreation cache = new CacheCreation();
+            
+    String id = "WBCLChannel";
+    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
+    factory.setBatchSize(100);
+    factory.setBatchTimeInterval(500);
+    factory.setBatchConflationEnabled(true);
+    factory.setMaximumQueueMemory(200);
+    factory.setDiskSynchronous(true);
+    factory.setParallel(false);
+    factory.setDispatcherThreads(33);
+    factory.addGatewayEventFilter(new MyGatewayEventFilter());
+            
+    AsyncEventListener eventListener = new CacheXml70DUnitTest.MyAsyncEventListener();
+    AsyncEventQueue asyncEventQueue = factory.create(id, eventListener);
+            
+    RegionAttributesCreation attrs = new RegionAttributesCreation();
+    attrs.addAsyncEventQueueId(asyncEventQueue.getId());
+    cache.createRegion("UserRegion", attrs);
+            
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+    
+    Set<AsyncEventQueue> asyncEventQueuesOnCache = c.getAsyncEventQueues();
+    assertTrue("Size of asyncEventQueues should be greater than 0", asyncEventQueuesOnCache.size() > 0);
+            
+    for (AsyncEventQueue asyncEventQueueOnCache : asyncEventQueuesOnCache) {
+      CacheXml70DUnitTest.validateAsyncEventQueue(asyncEventQueue, asyncEventQueueOnCache);
+    }
+  }
+
+  @Test
+  public void testGatewayReceiver() throws Exception{
+    getSystem();
+    CacheCreation cache = new CacheCreation();
+    
+    GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
+    gatewayReceiverFactory.setBindAddress("");
+    gatewayReceiverFactory.setStartPort(20000);
+    gatewayReceiverFactory.setEndPort(29999);
+    gatewayReceiverFactory.setMaximumTimeBetweenPings(2000);
+    gatewayReceiverFactory.setSocketBufferSize(1500);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter2);
+    GatewayReceiver receiver1 = gatewayReceiverFactory.create();
+
+    receiver1.start();
+
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+    Set<GatewayReceiver> receivers = c.getGatewayReceivers();
+    for(GatewayReceiver receiver : receivers){
+      validateGatewayReceiver(receiver1, receiver);
+    }
+  }
+  
+  @Test
+  public void testParallelGatewaySender() throws CacheException{
+    getSystem();
+    CacheCreation cache = new CacheCreation();
+    
+    GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
+    gatewaySenderFactory.setParallel(true);
+    gatewaySenderFactory.setDispatcherThreads(13);
+    gatewaySenderFactory.setManualStart(true);
+    gatewaySenderFactory.setSocketBufferSize(1234);
+    gatewaySenderFactory.setSocketReadTimeout(1050);          
+    gatewaySenderFactory.setBatchConflationEnabled(false);
+    gatewaySenderFactory.setBatchSize(88);
+    gatewaySenderFactory.setBatchTimeInterval(9);           
+    gatewaySenderFactory.setPersistenceEnabled(true);          
+    gatewaySenderFactory.setDiskStoreName("LNSender");  
+    gatewaySenderFactory.setDiskSynchronous(true);
+    gatewaySenderFactory.setMaximumQueueMemory(211);           
+    gatewaySenderFactory.setAlertThreshold(35);
+    
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
+    GatewaySender parallelGatewaySender = gatewaySenderFactory.create("LN", 2);
+    
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+    Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
+    for(GatewaySender sender : sendersOnCache){
+      assertEquals(true, sender.isParallel());
+      validateGatewaySender(parallelGatewaySender, sender);
+    }
+  }
+  
+  @Test
+  public void testSerialGatewaySender() throws CacheException{
+    getSystem();
+    CacheCreation cache = new CacheCreation();
+    GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
+    gatewaySenderFactory.setParallel(false);
+    gatewaySenderFactory.setManualStart(true);
+    gatewaySenderFactory.setSocketBufferSize(124);
+    gatewaySenderFactory.setSocketReadTimeout(1000);          
+    gatewaySenderFactory.setBatchConflationEnabled(false);
+    gatewaySenderFactory.setBatchSize(100);
+    gatewaySenderFactory.setBatchTimeInterval(10);           
+    gatewaySenderFactory.setPersistenceEnabled(true);          
+    gatewaySenderFactory.setDiskStoreName("LNSender"); 
+    gatewaySenderFactory.setDiskSynchronous(true);
+    gatewaySenderFactory.setMaximumQueueMemory(200);           
+    gatewaySenderFactory.setAlertThreshold(30);
+    
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
+    GatewaySender serialGatewaySender = gatewaySenderFactory.create("LN", 2);
+    
+    RegionAttributesCreation attrs = new RegionAttributesCreation();
+    attrs.addGatewaySenderId(serialGatewaySender.getId());
+    cache.createRegion("UserRegion", attrs);
+    
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+    Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
+    for(GatewaySender sender : sendersOnCache){
+      assertEquals(false, sender.isParallel());
+      validateGatewaySender(serialGatewaySender, sender);
+    }
+  }
+  
+  public static class MyGatewayEventFilter implements GatewayEventFilter, Declarable {
+    public void afterAcknowledgement(GatewayQueueEvent event) {
+    }
+    public boolean beforeEnqueue(GatewayQueueEvent event) {
+      return true;
+    }
+    public boolean beforeTransmit(GatewayQueueEvent event) {
+      return true;
+    }
+    public void close() {
+    }
+    public void init(Properties properties) {
+    }
+  }
+
+  static void validateGatewayReceiver(GatewayReceiver receiver1, GatewayReceiver gatewayReceiver) {
+    assertEquals(receiver1.getHost(), gatewayReceiver.getHost());
+    assertEquals(receiver1.getStartPort(), gatewayReceiver.getStartPort());
+    assertEquals(receiver1.getEndPort(), gatewayReceiver.getEndPort());
+    assertEquals(receiver1.getMaximumTimeBetweenPings(), gatewayReceiver.getMaximumTimeBetweenPings());
+    assertEquals(receiver1.getSocketBufferSize(), gatewayReceiver.getSocketBufferSize());
+    assertEquals(receiver1.getGatewayTransportFilters().size(), gatewayReceiver.getGatewayTransportFilters().size());
+  } 
+
+  static void validateGatewaySender(GatewaySender sender1, GatewaySender gatewaySender) {
+    assertEquals(sender1.getId(), gatewaySender.getId());
+    assertEquals(sender1.getRemoteDSId(), gatewaySender.getRemoteDSId());
+    assertEquals(sender1.isParallel(), gatewaySender.isParallel());
+    assertEquals(sender1.isBatchConflationEnabled(), gatewaySender.isBatchConflationEnabled());
+    assertEquals(sender1.getBatchSize(), gatewaySender.getBatchSize());
+    assertEquals(sender1.getBatchTimeInterval(), gatewaySender.getBatchTimeInterval());
+    assertEquals(sender1.isPersistenceEnabled(), gatewaySender.isPersistenceEnabled());
+    assertEquals(sender1.getDiskStoreName(),gatewaySender.getDiskStoreName());
+    assertEquals(sender1.isDiskSynchronous(),gatewaySender.isDiskSynchronous());
+    assertEquals(sender1.getMaximumQueueMemory(), gatewaySender.getMaximumQueueMemory());
+    assertEquals(sender1.getAlertThreshold(), gatewaySender.getAlertThreshold());
+    assertEquals(sender1.getGatewayEventFilters().size(), gatewaySender.getGatewayEventFilters().size());
+    assertEquals(sender1.getGatewayTransportFilters().size(), gatewaySender.getGatewayTransportFilters().size());
+    
+    boolean isParallel = sender1.isParallel();
+    if (isParallel) {
+      assertTrue("sender should be instanceof Creation", sender1 instanceof ParallelGatewaySenderCreation);
+    } else {
+      assertTrue("sender should be instanceof Creation", sender1 instanceof SerialGatewaySenderCreation);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/cache/CacheXml80GatewayDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/cache/CacheXml80GatewayDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/cache/CacheXml80GatewayDUnitTest.java
new file mode 100644
index 0000000..c140ebc
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/cache/CacheXml80GatewayDUnitTest.java
@@ -0,0 +1,150 @@
+/*
+ * 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;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.io.IOException;
+import java.util.Properties;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
+import com.gemstone.gemfire.cache.wan.*;
+import com.gemstone.gemfire.cache30.*;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
+
+@Category(DistributedTest.class)
+public class CacheXml80GatewayDUnitTest extends CacheXmlTestCase {
+
+  public CacheXml80GatewayDUnitTest() {
+    super();
+  }
+
+  protected String getGemFireVersion() {
+    return CacheXml.VERSION_8_0;
+  }
+  
+  @Test
+  public void testGatewayReceiverWithManualStartTRUE() throws CacheException{
+    //getSystem();
+    CacheCreation cache = new CacheCreation();
+    
+    GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
+    gatewayReceiverFactory.setBindAddress("");
+    gatewayReceiverFactory.setStartPort(20000);
+    gatewayReceiverFactory.setEndPort(29999);
+    gatewayReceiverFactory.setMaximumTimeBetweenPings(2000);
+    gatewayReceiverFactory.setSocketBufferSize(1500);
+    gatewayReceiverFactory.setManualStart(true);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter2);
+    GatewayReceiver receiver1 = gatewayReceiverFactory.create();
+    try {
+      receiver1.start();
+    }
+    catch (IOException e) {
+      fail("Could not start GatewayReceiver");
+    }
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+    Set<GatewayReceiver> receivers = c.getGatewayReceivers();
+    for(GatewayReceiver receiver : receivers){
+      validateGatewayReceiver(receiver1, receiver);
+    }
+  }
+
+  @Test
+  public void testAsyncEventQueueWithSubstitutionFilter() {
+    getSystem();
+    CacheCreation cache = new CacheCreation();
+
+    // Create an AsyncEventQueue with GatewayEventSubstitutionFilter.
+    String id = getName();
+    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
+    factory.setGatewayEventSubstitutionListener(new MyGatewayEventSubstitutionFilter());
+    AsyncEventQueue queue = factory.create(id, new CacheXml70DUnitTest.MyAsyncEventListener());
+
+    // Verify the GatewayEventSubstitutionFilter is set on the AsyncEventQueue.
+    assertNotNull(queue.getGatewayEventSubstitutionFilter());
+
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+
+    // Get the AsyncEventQueue. Verify the GatewayEventSubstitutionFilter is not null.
+    AsyncEventQueue queueOnCache = c.getAsyncEventQueue(id);
+    assertNotNull(queueOnCache);
+    assertNotNull(queueOnCache.getGatewayEventSubstitutionFilter());
+  }
+
+  @Test
+  public void testGatewaySenderWithSubstitutionFilter() {
+    getSystem();
+    CacheCreation cache = new CacheCreation();
+
+    // Create a GatewaySender with GatewayEventSubstitutionFilter.
+    // Don't start the sender to avoid 'Locators must be configured before starting gateway-sender' exception.
+    String id = getName();
+    GatewaySenderFactory factory = cache.createGatewaySenderFactory();
+    factory.setManualStart(true);
+    factory.setGatewayEventSubstitutionFilter(new MyGatewayEventSubstitutionFilter());
+    GatewaySender sender = factory.create(id, 2);
+
+    // Verify the GatewayEventSubstitutionFilter is set on the GatewaySender.
+    assertNotNull(sender.getGatewayEventSubstitutionFilter());
+
+    testXml(cache);
+    Cache c = getCache();
+    assertNotNull(c);
+
+    // Get the GatewaySender. Verify the GatewayEventSubstitutionFilter is not null.
+    GatewaySender senderOnCache = c.getGatewaySender(id);
+    assertNotNull(senderOnCache);
+    assertNotNull(senderOnCache.getGatewayEventSubstitutionFilter());
+  }
+
+  protected void validateGatewayReceiver(GatewayReceiver receiver1,
+      GatewayReceiver gatewayReceiver){
+    CacheXml70GatewayDUnitTest.validateGatewayReceiver(receiver1, gatewayReceiver);
+    assertEquals(receiver1.isManualStart(), gatewayReceiver.isManualStart());
+  }
+
+  public static class MyGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter, Declarable {
+
+    public Object getSubstituteValue(EntryEvent event) {
+      return event.getKey();
+    }
+
+    public void close() {
+    }
+
+    public void init(Properties properties) {
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java b/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
new file mode 100755
index 0000000..d94920b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.codeAnalysis;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.AfterClass;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.codeAnalysis.decode.CompiledClass;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.util.test.TestUtil;
+
+/**
+ * 
+ */
+@Category(IntegrationTest.class)
+public class AnalyzeWANSerializablesJUnitTest extends AnalyzeSerializablesJUnitTest {
+  
+  @Before
+  public void loadClasses() throws Exception {
+    if (classes.size() > 0) {
+      return;
+    }
+    System.out.println("loadClasses starting");
+    List<String> excludedClasses = loadExcludedClasses(new File(TestUtil.getResourcePath(AnalyzeWANSerializablesJUnitTest.class, "excludedClasses.txt")));
+    List<String> openBugs = loadOpenBugs(new File(TestUtil.getResourcePath(AnalyzeWANSerializablesJUnitTest.class, "openBugs.txt")));
+    excludedClasses.addAll(openBugs);
+    
+    String cp = System.getProperty("java.class.path");
+    System.out.println("java classpath is " + cp);
+    System.out.flush();
+    String[] entries = cp.split(File.pathSeparator);
+    String buildDirName =
+         "geode-wan"+File.separatorChar
+        +"build"+File.separatorChar
+        +"classes"+File.separatorChar
+        +"main";
+    String buildDir = null;
+    
+    for (int i=0; i<entries.length  &&  buildDir==null; i++) {
+      System.out.println("examining '" + entries[i] + "'");
+      System.out.flush();
+      if (entries[i].endsWith(buildDirName)) {
+        buildDir = entries[i];
+      }
+    }
+    if (buildDir != null) {
+      System.out.println("loading class files from " + buildDir);
+      System.out.flush();
+      long start = System.currentTimeMillis();
+      loadClassesFromBuild(new File(buildDir), excludedClasses);
+      long finish = System.currentTimeMillis();
+      System.out.println("done loading " + classes.size() + " classes.  elapsed time = "
+          + (finish-start)/1000 + " seconds");
+    }
+    else {
+      fail("unable to find WAN classes");
+    }
+  }
+  
+  @AfterClass
+  public static void cleanup() {
+    if (classes != null) {
+      classes.clear();
+    }
+  }
+  
+}


[15/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/PDXNewWanDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/PDXNewWanDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/PDXNewWanDUnitTest.java
new file mode 100644
index 0000000..17c76ed
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/PDXNewWanDUnitTest.java
@@ -0,0 +1,767 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+@Category(DistributedTest.class)
+public class PDXNewWanDUnitTest extends WANTestBase{
+
+  private static final long serialVersionUID = 1L;
+  
+  public PDXNewWanDUnitTest() {
+    super();
+  }
+
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 1 member
+   *   2> Site 2 : 1 locator, 1 member
+   *   3> DR is defined on  member 1 on site1
+   *   4> Serial GatewaySender is defined on member 1 on site1
+   *   5> Same DR is defined on site2 member 1
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.    
+   */
+  @Test
+  public void testWANPDX_RR_SerialSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_RR", 1 ));
+  }
+  
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 1 member
+   *   2> Site 2 : 1 locator, 1 member
+   *   3> DR is defined on  member 1 on site1
+   *   4> Serial GatewaySender is defined on member 1 on site1
+   *   5> Same DR is defined on site2 member 1
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.
+   *   8> Bounce site 1 and delete all of it's data
+   *   9> Make sure that site 1 get the the PDX types along with entries
+   *   and can deserialize entries.     
+   */
+  @Test
+  public void testWANPDX_RemoveRemoteData() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_RR", 1 ));
+    
+    
+    //bounce vm2
+    vm2.invoke(() -> WANTestBase.closeCache());
+    
+    vm2.invoke(() -> WANTestBase.deletePDXDir());
+    
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+    
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+      2 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_RR", 2 ));
+  }
+  
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 1 member
+   *   2> Site 2 : 1 locator, 1 member
+   *   3> DR is defined on  member 1 on site1
+   *   4> Serial GatewaySender is defined on member 1 on site1
+   *   5> Same DR is defined on site2 member 1
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.
+   *   8> Bounce site 1 and delete all of it's data
+   *   9> Make some conflicting PDX registries in site 1 before the reconnect
+   *   10> Make sure we flag a warning about the conflicting updates.     
+   */
+  @Test
+  public void testWANPDX_ConflictingData() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_RR", 1 ));
+    
+    //bounce vm3
+    vm3.invoke(() -> WANTestBase.closeCache());
+    
+    IgnoredException ex1 = IgnoredException.addIgnoredException("Trying to add a PDXType with the same id");
+    IgnoredException ex2 = IgnoredException.addIgnoredException("CacheWriterException");
+    IgnoredException ex3 = IgnoredException.addIgnoredException("does match the existing PDX type");
+    IgnoredException ex4 = IgnoredException.addIgnoredException("ServerOperationException");
+    IgnoredException ex5 = IgnoredException.addIgnoredException("Stopping the processor");
+    
+    try {
+    //blow away vm3's PDX data
+    vm3.invoke(() -> WANTestBase.deletePDXDir());
+    
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    //Define a different type from vm3
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable2( getTestMethodName() + "_RR",
+      2 ));
+    
+    //Give the updates some time to make it over the WAN
+    Wait.pause(10000);
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_RR", 1 ));
+    
+    vm3.invoke(() -> WANTestBase.closeCache());
+    } finally {
+      ex1.remove();
+      ex2.remove();
+      ex3.remove();
+      ex4.remove();
+      ex5.remove();
+    }
+  }
+  
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 1 member
+   *   2> Site 2 : 1 locator, 1 member
+   *   3> Site 3 : 1 locator, 1 member
+   *   3> DR is defined on  member 1 on site1
+   *   4> Serial GatewaySender is defined on member 1 on site1
+   *   5> Same DR is defined on site2 member 1
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.    
+   */
+  @Test
+  public void testWANPDX_RR_SerialSender3Sites() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    
+    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(lnPort, vm3);
+    createCacheInVMs(nyPort, vm4);
+    createCacheInVMs(tkPort, vm5);
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    vm5.invoke(() -> WANTestBase.createReceiver());
+
+
+    //Create all of our gateway senders
+    vm3.invoke(() -> WANTestBase.createSender( "ny", 2,
+        false, 100, 10, false, false, null, true ));
+    vm3.invoke(() -> WANTestBase.createSender( "tk", 3,
+      false, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 1,
+      false, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.createSender( "tk", 3,
+    false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 1,
+      false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ny", 2,
+    false, 100, 10, false, false, null, true ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ny,tk", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln,tk", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln,ny", isOffHeap() ));
+    
+    //Start all of the senders
+    vm3.invoke(() -> WANTestBase.startSender( "ny" ));
+    vm3.invoke(() -> WANTestBase.startSender( "tk" ));
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm4.invoke(() -> WANTestBase.startSender( "tk" ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.startSender( "ny" ));
+    
+    //Pause ln to ny. This means the PDX type will not be dispatched
+    //to ny from ln
+    vm3.invoke(() -> WANTestBase.pauseSender( "ny" ));
+    
+    Wait.pause(5000);
+    
+    //Do some puts that define a PDX type in ln
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+      1 ));
+    
+    //Make sure that tk received the update
+    vm5.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_RR", 1 ));
+    
+    //Make ny didn't receive the update because the sender is paused 
+    vm4.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_RR", 0 ));
+    
+    //Now, do a put from tk. This serialized object will be distributed
+    //to ny from tk, using the type defined by ln.
+    vm5.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+      2 ));
+    
+    //Verify the ny can read the object
+    vm4.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_RR", 2 ));
+    
+    //Wait for vm3 to receive the update (prevents a broken pipe suspect string) 
+    vm3.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_RR", 2 ));
+  }
+  
+  @Test
+  public void testWANPDX_RR_SerialSender_StartedLater() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+        10 ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+      40 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_RR", 40 ));
+  }
+  
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 1 member
+   *   2> Site 2 : 1 locator, 1 member
+   *   3> PR is defined on  member 1 on site1
+   *   4> Serial GatewaySender is defined on member 1 on site1
+   *   5> Same PR is defined on site2 member 1
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.    
+   */
+  
+  @Test
+  public void testWANPDX_PR_SerialSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 1 ));
+  }
+  
+  @Test
+  public void testWANPDX_PR_SerialSender_StartedLater() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        20 ));
+    
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+      40 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 40 ));
+  }
+  
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 2 member
+   *   2> Site 2 : 1 locator, 2 member
+   *   3> PR is defined on  member 1, 2 on site1
+   *   4> Serial GatewaySender is defined on member 1 on site1
+   *   5> Same PR is defined on site2 member 1, 2
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.    
+   */
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_SerialSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null,1, 5, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 10 ));
+  }
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_SerialSender_StartedLater() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+    vm4.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+    
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 5, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+      40 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 40 ));
+  }
+  
+  /**
+   * Test
+   *   1> Site 1 : 1 locator, 1 member
+   *   2> Site 2 : 1 locator, 1 member
+   *   3> PR is defined on  member 1 on site1
+   *   4> Parallel GatewaySender is defined on member 1 on site1
+   *   5> Same PR is defined on site2 member 1
+   *   6> Put is done with value which is PDXSerializable
+   *   7> Validate whether other sites member receive this put operation.    
+   */
+  
+  @Test
+  public void testWANPDX_PR_ParallelSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 0, 1, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 1, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 1));
+  }
+  
+  @Test
+  public void testWANPDX_PR_ParallelSender_47826() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 0, 1, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, null, true ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 0, 1, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable(
+        getTestMethodName() + "_PR", 1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 1 ));
+  }
+  
+  @Test
+  public void testWANPDX_PR_ParallelSender_StartedLater() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+      40 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 40 ));
+  }
+  
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_ParallelSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+
+    startSenderInVMs("ln", vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 10 ));
+  }
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_ParallelSender_StartedLater() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+    vm4.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+   vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    startSenderInVMsAsync("ln", vm3, vm4);
+
+    vm4.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+      40 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 40 ));
+  }
+  
+  
+  @Test
+  public void testWANPDX_RR_SerialSenderWithFilter() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, new PDXGatewayEventFilter(), true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_RR", 1 ));
+    
+    vm3.invoke(() -> PDXNewWanDUnitTest.verifyFilterInvocation( 1));
+  }
+  
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_ParallelSenderWithFilter() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, new PDXGatewayEventFilter(), true ));
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, new PDXGatewayEventFilter(), true ));
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+
+    startSenderInVMs("ln", vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 10 ));
+    
+    vm3.invoke(() -> PDXNewWanDUnitTest.verifyFilterInvocation( 5));
+    vm4.invoke(() -> PDXNewWanDUnitTest.verifyFilterInvocation( 5));
+  }
+  
+  
+  /**
+   * When remote site bounces then we should send pdx event again.
+   */
+  @Ignore
+  @Test
+  public void testWANPDX_PR_SerialSender_RemoteSite_Bounce() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3);
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        1 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 1 ));
+    
+    vm2.invoke(() -> WANTestBase.killSender());
+
+    createReceiverInVMs(vm2, vm4);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 2, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 2, isOffHeap() ));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+      1 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+      getTestMethodName() + "_PR", 1 ));
+  }
+  
+
+  
+  
+  public static void verifyFilterInvocation(int invocation) {
+    assertEquals(((PDXGatewayEventFilter)eventFilter).beforeEnqueueInvoked, invocation);
+    assertEquals(((PDXGatewayEventFilter)eventFilter).beforeTransmitInvoked, invocation);
+    assertEquals(((PDXGatewayEventFilter)eventFilter).afterAckInvoked, invocation);
+  }
+
+  
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java
new file mode 100644
index 0000000..1981feb
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java
@@ -0,0 +1,670 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+
+@Category(DistributedTest.class)
+public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBase {
+  
+  public ReplicatedRegion_ParallelWANPersistenceDUnitTest() {
+    super();
+    // TODO Auto-generated constructor stub
+  }
+
+  final String expectedExceptions = null;
+
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DR_PGSPERSISTENCE_VALIDATEQUEUE_Restart_Validate_Receiver() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
+        .getName());
+    try {
+*/      vm4.invoke(() -> WANTestBase.killSender());
+      vm5.invoke(() -> WANTestBase.killSender());
+      vm6.invoke(() -> WANTestBase.killSender());
+      vm7.invoke(() -> WANTestBase.killSender());
+/*    }
+    finally {
+      exp1.remove();
+    }
+*/    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm4.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_RR", 3000, 10000 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 10000 ));
+    
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DRPERSISTENCE_PGSPERSISTENCE_VALIDATEQUEUE_Restart_Validate_Receiver() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    //create cache in local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
+            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
+            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
+            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
+            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
+        .getName());
+    try {*/
+      vm4.invoke(() -> WANTestBase.killSender());
+      vm5.invoke(() -> WANTestBase.killSender());
+      vm6.invoke(() -> WANTestBase.killSender());
+      vm7.invoke(() -> WANTestBase.killSender());
+/*    }
+    finally {
+      exp1.remove();
+    }*/
+    
+    //restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    
+/*    exp1 = addExpectedException(CacheClosedException.class.getName());
+    try {
+*/      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 3000 ));
+      vm3.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 3000 ));
+
+      vm4.invoke(() -> WANTestBase.doNextPuts(
+          getTestMethodName() + "_RR", 3000, 10000 ));
+
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 10000 ));
+      vm3.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 10000 ));
+/*    }
+    finally {
+      exp1.remove();
+    }
+*/  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DRPERSISTENCE_PRPERSISTENCE_PGSPERSISTENCE_VALIDATEQUEUE_Restart_Validate_Receiver() {
+    //create locator on local site
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    //create locator on remote site
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on remote site
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    
+    //create cache in local site
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    //create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
+    
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //start puts in region on local site
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 3000 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 3000 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    //--------------------close and rebuild local site -------------------------------------------------
+    //kill the senders
+/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
+        .getName());
+    try {
+*/      vm4.invoke(() -> WANTestBase.killSender());
+      vm5.invoke(() -> WANTestBase.killSender());
+      vm6.invoke(() -> WANTestBase.killSender());
+      vm7.invoke(() -> WANTestBase.killSender());
+/*    }
+    finally {
+      exp1.remove();
+    }
+*/    
+    LogWriterUtils.getLogWriter().info("Killed all the senders.");
+    
+    //restart the vm
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+    
+   //create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
+    
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+    
+    //create PR on local site
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
+            100, isOffHeap() ));
+    inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
+            100, isOffHeap() ));
+    inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
+            100, isOffHeap() ));
+    inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
+            100, isOffHeap() ));
+
+    try {
+      inv1.join();
+      inv2.join();
+      inv3.join();
+      inv4.join();
+    }
+    catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    //start the senders in async mode. This will ensure that the 
+    //node of shadow PR that went down last will come up first
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    //wait for senders running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now running...");
+    
+    //----------------------------------------------------------------------------------------------------
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 3000 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 3000 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 3000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 3000 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 3000 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 3000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 3000 ));
+    
+    vm4.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_RR", 3000, 10000 ));
+    vm4.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_PR", 3000, 10000 ));
+    
+/*    exp1 = addExpectedException(CacheClosedException.class.getName());
+    try {*/
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 10000 ));
+      vm3.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 10000 ));
+
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_PR", 10000 ));
+      vm3.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_PR", 10000 ));
+/*    }
+    finally {
+      exp1.remove();
+    }
+*/    
+  }
+  
+  /**Below test is disabled intentionally
+  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
+  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
+      ParallelGatewaySenderQueue#convertPathToName
+  3> We have to enabled it in next release
+  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
+     and version prior to 8.0*/
+  @Ignore
+  @Test
+  public void test_DRPERSISTENCE_PGSPERSISTENCE_4NODES_2NODESDOWN_Validate_Receiver()
+      throws Exception {
+
+    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    // create senders with disk store
+    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
+            false, true, null, null, true ));
+    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
+            false, true, null, null, true ));
+    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
+            false, true, null, null, true ));
+    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
+            false, true, null, null, true ));
+
+    LogWriterUtils.getLogWriter().info(
+        "The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + ","
+            + diskStore4);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    Thread.sleep(60000);
+    {
+      AsyncInvocation inv1 = vm7.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts0(getTestMethodName() + "_RR", 10000 ));
+      Thread.sleep(1000);
+      AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+      Thread.sleep(2000);
+      AsyncInvocation inv3 = vm6.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts1(getTestMethodName() + "_RR", 10000 ));
+      Thread.sleep(1500);
+      AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
+      try {
+        inv1.join();
+        inv2.join();
+        inv3.join();
+        inv4.join();
+      } catch (Exception e) {
+        Assert.fail("UnExpected Exception", e);
+      }
+    }
+
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    LogWriterUtils.getLogWriter().info("Created back the cache");
+
+    // create senders with disk store
+    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore(
+        "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore(
+        "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
+
+    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
+
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+            DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
+            DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts2(getTestMethodName() + "_RR", 15000 ));
+    try {
+      inv1.join();
+      inv2.join();
+
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+
+    startSenderInVMsAsync("ln", vm4, vm5);
+
+    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
+    // wait for senders running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 15000 ));
+  }
+}


[46/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
new file mode 100755
index 0000000..200a14f
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -0,0 +1,470 @@
+/*
+ * 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.lucene.internal.cli;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.geode.security.ResourcePermission.Operation;
+import org.apache.geode.security.ResourcePermission.Resource;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import com.gemstone.gemfire.SystemFailure;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+
+import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneCreateIndexFunction;
+import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneDescribeIndexFunction;
+import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneListIndexFunction;
+import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneSearchIndexFunction;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.cache.execute.AbstractExecution;
+import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
+import com.gemstone.gemfire.internal.security.SecurityService;
+import com.gemstone.gemfire.management.cli.CliMetaData;
+import com.gemstone.gemfire.management.cli.ConverterHint;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.CliUtil;
+import com.gemstone.gemfire.management.internal.cli.commands.AbstractCommandsSupport;
+import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResultException;
+import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
+import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
+import com.gemstone.gemfire.management.internal.security.ResourceOperation;
+
+/**
+ * The LuceneIndexCommands class encapsulates all Geode shell (Gfsh) commands related to Lucene indexes defined in Geode.
+ * </p>
+ * @see AbstractCommandsSupport
+ * @see LuceneIndexDetails
+ * @see LuceneListIndexFunction
+ */
+@SuppressWarnings("unused")
+public class LuceneIndexCommands extends AbstractCommandsSupport {
+  private static final LuceneCreateIndexFunction createIndexFunction = new LuceneCreateIndexFunction();
+  private static final LuceneDescribeIndexFunction describeIndexFunction = new LuceneDescribeIndexFunction();
+  private static final LuceneSearchIndexFunction searchIndexFunction = new LuceneSearchIndexFunction();
+  private List<LuceneSearchResults> searchResults=null;
+
+  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
+
+  @CliCommand(value = LuceneCliStrings.LUCENE_LIST_INDEX, help = LuceneCliStrings.LUCENE_LIST_INDEX__HELP)
+  @CliMetaData(shellOnly = false, relatedTopic={CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA })
+  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
+  public Result listIndex(
+    @CliOption(key = LuceneCliStrings.LUCENE_LIST_INDEX__STATS,
+      mandatory=false,
+      specifiedDefaultValue = "true",
+      unspecifiedDefaultValue = "false",
+      help = LuceneCliStrings.LUCENE_LIST_INDEX__STATS__HELP) final boolean stats) {
+
+    try {
+      return toTabularResult(getIndexListing(),stats);
+    }
+    catch (FunctionInvocationTargetException ignore) {
+      return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN,
+        LuceneCliStrings.LUCENE_LIST_INDEX));
+    }
+    catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    }
+    catch (Throwable t) {
+      SystemFailure.checkFailure();
+      getCache().getLogger().info(t);
+      return ResultBuilder.createGemFireErrorResult(String.format(LuceneCliStrings.LUCENE_LIST_INDEX__ERROR_MESSAGE,
+        toString(t, isDebugging())));
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  protected List<LuceneIndexDetails> getIndexListing() {
+    final Execution functionExecutor = getMembersFunctionExecutor(getMembers(getCache()));
+
+    if (functionExecutor instanceof AbstractExecution) {
+      ((AbstractExecution) functionExecutor).setIgnoreDepartedMembers(true);
+    }
+
+    final ResultCollector resultsCollector = functionExecutor.execute(new LuceneListIndexFunction());
+    final List<Set<LuceneIndexDetails>> results = (List<Set<LuceneIndexDetails>>) resultsCollector.getResult();
+
+    return results.stream()
+      .flatMap(set -> set.stream())
+      .sorted()
+      .collect(Collectors.toList());
+  }
+
+  protected Result toTabularResult(final List<LuceneIndexDetails> indexDetailsList, boolean stats) {
+    if (!indexDetailsList.isEmpty()) {
+      final TabularResultData indexData = ResultBuilder.createTabularResultData();
+
+      for (final LuceneIndexDetails indexDetails : indexDetailsList) {
+        indexData.accumulate("Index Name", indexDetails.getIndexName());
+        indexData.accumulate("Region Path", indexDetails.getRegionPath());
+        indexData.accumulate("Indexed Fields", indexDetails.getSearchableFieldNamesString());
+        indexData.accumulate("Field Analyzer", indexDetails.getFieldAnalyzersString());
+        indexData.accumulate("Status", indexDetails.getInitialized() == true ? "Initialized" : "Defined");
+
+        if (stats == true) {
+          if (!indexDetails.getInitialized()) {
+            indexData.accumulate("Query Executions", "NA");
+            indexData.accumulate("Updates", "NA");
+            indexData.accumulate("Commits", "NA");
+            indexData.accumulate("Documents", "NA");
+          }
+          else {
+            indexData.accumulate("Query Executions", indexDetails.getIndexStats().get("queryExecutions"));
+            indexData.accumulate("Updates", indexDetails.getIndexStats().get("updates"));
+            indexData.accumulate("Commits", indexDetails.getIndexStats().get("commits"));
+            indexData.accumulate("Documents", indexDetails.getIndexStats().get("documents"));
+          }
+        }
+      }
+      return ResultBuilder.buildResult(indexData);
+    }
+    else {
+      return ResultBuilder.createInfoResult(LuceneCliStrings.LUCENE_LIST_INDEX__INDEXES_NOT_FOUND_MESSAGE);
+    }
+  }
+
+  @CliCommand(value = LuceneCliStrings.LUCENE_CREATE_INDEX, help = LuceneCliStrings.LUCENE_CREATE_INDEX__HELP)
+  @CliMetaData(shellOnly = false, relatedTopic={CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA }, writesToSharedConfiguration=true)
+  //TODO : Add optionContext for indexName
+  public Result createIndex(
+    @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
+      mandatory=true,
+      help = LuceneCliStrings.LUCENE_CREATE_INDEX__NAME__HELP) final String indexName,
+
+    @CliOption (key = LuceneCliStrings.LUCENE__REGION_PATH,
+      mandatory = true,
+      optionContext = ConverterHint.REGIONPATH,
+      help = LuceneCliStrings.LUCENE_CREATE_INDEX__REGION_HELP) final String regionPath,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD,
+      mandatory = true,
+      help = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD_HELP)
+    @CliMetaData (valueSeparator = ",") final String[] fields,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER,
+      mandatory = false,
+      unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+      help = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER_HELP)
+    @CliMetaData (valueSeparator = ",") final String[] analyzers,
+
+    @CliOption (key = LuceneCliStrings.LUCENE_CREATE_INDEX__GROUP,
+      optionContext = ConverterHint.MEMBERGROUP,
+      unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+      help = LuceneCliStrings.LUCENE_CREATE_INDEX__GROUP__HELP)
+    @CliMetaData (valueSeparator = ",") final String[] groups) {
+
+    Result result = null;
+    XmlEntity xmlEntity = null;
+
+    this.securityService.authorizeRegionManage(regionPath);
+    try {
+      final Cache cache = getCache();
+      LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath, fields, analyzers);
+      final ResultCollector<?, ?> rc = this.executeFunctionOnGroups(createIndexFunction, groups, indexInfo);
+      final List<CliFunctionResult> funcResults = (List<CliFunctionResult>) rc.getResult();
+
+      final TabularResultData tabularResult = ResultBuilder.createTabularResultData();
+      for (final CliFunctionResult cliFunctionResult : funcResults) {
+        tabularResult.accumulate("Member",cliFunctionResult.getMemberIdOrName());
+
+          if (cliFunctionResult.isSuccessful()) {
+            tabularResult.accumulate("Status","Successfully created lucene index");
+//            if (xmlEntity == null) {
+//              xmlEntity = cliFunctionResult.getXmlEntity();
+//            }
+          }
+          else {
+            tabularResult.accumulate("Status","Failed: "+cliFunctionResult.getMessage());
+          }
+      }
+        result = ResultBuilder.buildResult(tabularResult);
+      }
+     catch (CommandResultException crex) {
+      result = crex.getResult();
+    } catch (Exception e) {
+      result = ResultBuilder.createGemFireErrorResult(e.getMessage());
+    }
+//    TODO - store in cluster config
+//    if (xmlEntity != null) {
+//      result.setCommandPersisted((new SharedConfigurationWriter()).addXmlEntity(xmlEntity, groups));
+//    }
+
+    return result;
+  }
+
+  @CliCommand(value = LuceneCliStrings.LUCENE_DESCRIBE_INDEX, help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__HELP)
+  @CliMetaData(shellOnly = false, relatedTopic={CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA })
+  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
+  public Result describeIndex(
+    @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
+      mandatory=true,
+      help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__NAME__HELP) final String indexName,
+
+    @CliOption (key = LuceneCliStrings.LUCENE__REGION_PATH,
+      mandatory = true,
+      optionContext = ConverterHint.REGIONPATH,
+      help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__REGION_HELP) final String regionPath) {
+    try {
+      LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath);
+      return toTabularResult(getIndexDetails(indexInfo),true);
+    }
+    catch (FunctionInvocationTargetException ignore) {
+      return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN,
+        LuceneCliStrings.LUCENE_DESCRIBE_INDEX));
+    }
+    catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    }
+    catch (IllegalArgumentException e) {
+      return ResultBuilder.createInfoResult(e.getMessage());
+    }
+    catch (Throwable t) {
+      SystemFailure.checkFailure();
+      getCache().getLogger().info(t);
+      return ResultBuilder.createGemFireErrorResult(String.format(LuceneCliStrings.LUCENE_DESCRIBE_INDEX__ERROR_MESSAGE,
+        toString(t, isDebugging())));
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  protected List<LuceneIndexDetails> getIndexDetails(LuceneIndexInfo indexInfo) throws Exception {
+    this.securityService.authorizeRegionManage(indexInfo.getRegionPath());
+    final ResultCollector<?, ?> rc = this.executeFunctionOnGroups(describeIndexFunction, new String[] {}, indexInfo);
+    final List<LuceneIndexDetails> funcResults = (List<LuceneIndexDetails>) rc.getResult();
+    return funcResults.stream().filter(indexDetails -> indexDetails != null).collect(Collectors.toList());
+  }
+
+  @CliCommand(value = LuceneCliStrings.LUCENE_SEARCH_INDEX, help = LuceneCliStrings.LUCENE_SEARCH_INDEX__HELP)
+  @CliMetaData(shellOnly = false, relatedTopic = { CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA })
+  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
+  public Result searchIndex(
+    @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
+      mandatory = true,
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__NAME__HELP) final String indexName,
+
+    @CliOption(key = LuceneCliStrings.LUCENE__REGION_PATH,
+      mandatory = true,
+      optionContext = ConverterHint.REGIONPATH,
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__REGION_HELP) final String regionPath,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING,
+      mandatory = true,
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING__HELP) final String queryString,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD,
+      mandatory = true,
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD__HELP) final String defaultField,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT,
+      mandatory = false,
+      unspecifiedDefaultValue = "-1",
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT__HELP) final int limit,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE,
+      mandatory = false,
+      unspecifiedDefaultValue = "-1",
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE__HELP) int pageSize,
+
+    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY,
+      mandatory = false,
+      unspecifiedDefaultValue = "false",
+      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY__HELP) boolean keysOnly)
+  {
+    try {
+      LuceneQueryInfo queryInfo = new LuceneQueryInfo(indexName, regionPath, queryString, defaultField, limit, keysOnly);
+      if (pageSize == -1) {
+        pageSize = Integer.MAX_VALUE;
+      }
+      searchResults = getSearchResults(queryInfo);
+      return displayResults(pageSize, keysOnly);
+    }
+    catch (FunctionInvocationTargetException ignore) {
+      return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN,
+        LuceneCliStrings.LUCENE_SEARCH_INDEX));
+    }
+    catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    }
+    catch (IllegalArgumentException e) {
+      return ResultBuilder.createInfoResult(e.getMessage());
+    }
+    catch (Throwable t) {
+      SystemFailure.checkFailure();
+      getCache().getLogger().info(t);
+      return ResultBuilder.createGemFireErrorResult(String.format(LuceneCliStrings.LUCENE_SEARCH_INDEX__ERROR_MESSAGE,
+        toString(t, isDebugging())));
+    }
+  }
+
+  private Result displayResults(int pageSize, boolean keysOnly) throws Exception {
+    if (searchResults.size() == 0) {
+      return ResultBuilder.createInfoResult(LuceneCliStrings.LUCENE_SEARCH_INDEX__NO_RESULTS_MESSAGE);
+    }
+
+    Gfsh gfsh = initGfsh();
+    boolean pagination = searchResults.size() > pageSize;
+    int fromIndex = 0;
+    int toIndex = pageSize < searchResults.size() ? pageSize : searchResults.size();
+    int currentPage = 1;
+    int totalPages = (int) Math.ceil((float) searchResults.size() / pageSize);
+    boolean skipDisplay = false;
+    String step = null;
+    do {
+
+      if (!skipDisplay) {
+        CommandResult commandResult = (CommandResult) getResults(fromIndex, toIndex, keysOnly);
+        if (!pagination) {
+          return commandResult;
+        }
+        Gfsh.println();
+        while (commandResult.hasNextLine()) {
+          gfsh.printAsInfo(commandResult.nextLine());
+        }
+        gfsh.printAsInfo("\t\tPage " + currentPage + " of " + totalPages);
+        String message = ("Press n to move to next page, q to quit and p to previous page : ");
+        step = gfsh.interact(message);
+      }
+
+      switch (step) {
+        case "n":
+        {
+          if (currentPage == totalPages) {
+            gfsh.printAsInfo("No more results to display.");
+            step = gfsh.interact("Press p to move to last page and q to quit.");
+            skipDisplay = true;
+            continue;
+          }
+
+          if(skipDisplay) {
+            skipDisplay=false;
+          }
+          else {
+            currentPage++;
+            int current = fromIndex;
+            fromIndex = toIndex;
+            toIndex = (pageSize + fromIndex >= searchResults.size()) ? searchResults.size() : pageSize + fromIndex;
+          }
+          break;
+        }
+        case "p": {
+          if (currentPage == 1) {
+            gfsh.printAsInfo("At the top of the search results.");
+            step = gfsh.interact("Press n to move to the first page and q to quit.");
+            skipDisplay=true;
+            continue;
+          }
+
+          if (skipDisplay) {
+            skipDisplay = false;
+          }
+          else {
+            currentPage--;
+            int current = fromIndex;
+            toIndex = fromIndex;
+            fromIndex = current - pageSize <= 0 ? 0 : current - pageSize;
+          }
+          break;
+        }
+        case "q":
+          return ResultBuilder.createInfoResult("Search complete.");
+        default:
+          Gfsh.println("Invalid option");
+          break;
+      }
+    } while(true);
+  }
+
+  protected Gfsh initGfsh() {
+    return Gfsh.getCurrentInstance();
+  }
+
+  private List<LuceneSearchResults> getSearchResults(final LuceneQueryInfo queryInfo) throws Exception {
+    securityService.authorizeRegionManage(queryInfo.getRegionPath());
+
+    final String[] groups = {};
+    final ResultCollector<?, ?> rc = this.executeSearch(queryInfo);
+    final List<Set<LuceneSearchResults>> functionResults = (List<Set<LuceneSearchResults>>) rc.getResult();
+
+    return functionResults.stream()
+      .flatMap(set -> set.stream())
+      .sorted()
+      .collect(Collectors.toList());
+  }
+
+  private Result getResults(int fromIndex, int toIndex, boolean keysonly) throws Exception {
+    final TabularResultData data = ResultBuilder.createTabularResultData();
+    for (int i = fromIndex; i < toIndex; i++) {
+      if (!searchResults.get(i).getExeptionFlag()) {
+        data.accumulate("key", searchResults.get(i).getKey());
+        if (!keysonly) {
+          data.accumulate("value", searchResults.get(i).getValue());
+          data.accumulate("score", searchResults.get(i).getScore());
+        }
+      }
+      else {
+        throw new Exception(searchResults.get(i).getExceptionMessage());
+      }
+    }
+    return ResultBuilder.buildResult(data);
+  }
+
+  protected ResultCollector<?, ?> executeFunctionOnGroups(FunctionAdapter function,
+                                                          String[] groups,
+                                                          final LuceneIndexInfo indexInfo) throws IllegalArgumentException, CommandResultException
+  {
+    final Set<DistributedMember> targetMembers;
+    if (function != createIndexFunction) {
+      targetMembers = CliUtil.getMembersForeRegionViaFunction(getCache(), indexInfo.getRegionPath());
+      if (targetMembers.isEmpty()) {
+        throw new IllegalArgumentException("Region not found.");
+      }
+    }
+    else {
+      targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+    }
+    return CliUtil.executeFunction(function, indexInfo, targetMembers);
+  }
+
+  protected ResultCollector<?, ?> executeSearch(final LuceneQueryInfo queryInfo) throws Exception {
+    final Set<DistributedMember> targetMembers = CliUtil.getMembersForeRegionViaFunction(getCache(),queryInfo.getRegionPath());
+    if (targetMembers.isEmpty())
+      throw new IllegalArgumentException("Region not found.");
+    return CliUtil.executeFunction(searchIndexFunction, queryInfo, targetMembers);
+  }
+
+  @CliAvailabilityIndicator({LuceneCliStrings.LUCENE_SEARCH_INDEX, LuceneCliStrings.LUCENE_CREATE_INDEX,
+    LuceneCliStrings.LUCENE_DESCRIBE_INDEX, LuceneCliStrings.LUCENE_LIST_INDEX})
+  public boolean indexCommandsAvailable() {
+    return (!CliUtil.isGfshVM() || (getGfsh() != null && getGfsh().isConnectedAndReady()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
new file mode 100644
index 0000000..eaec4a0
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
@@ -0,0 +1,153 @@
+/*
+ * 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.lucene.internal.cli;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
+
+import org.apache.lucene.analysis.Analyzer;
+
+public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>, Serializable {
+  private static final long serialVersionUID = 1L;
+  private final String indexName;
+  private final String regionPath;
+  private final String[] searchableFieldNames;
+  private Map<String, String> fieldAnalyzers=null;
+  private final Map<String,Integer> indexStats;
+  private boolean initialized;
+
+  public LuceneIndexDetails(final String indexName, final String regionPath, final String[] searchableFieldNames, final Map<String, Analyzer> fieldAnalyzers, LuceneIndexStats indexStats, boolean initialized) {
+    this.indexName = indexName;
+    this.regionPath = regionPath;
+    this.searchableFieldNames = searchableFieldNames;
+    this.fieldAnalyzers = getFieldAnalyzerStrings(fieldAnalyzers);
+    this.indexStats=getIndexStatsMap(indexStats);
+    this.initialized = initialized;
+  }
+
+  public LuceneIndexDetails(LuceneIndexImpl index) {
+    this(index.getName(), index.getRegionPath(), index.getFieldNames(),index.getFieldAnalyzers(),index.getIndexStats(), true);
+  }
+
+  public LuceneIndexDetails(LuceneIndexCreationProfile indexProfile) {
+    this(indexProfile.getIndexName(), indexProfile.getRegionPath(), indexProfile.getFieldNames(), null, null, false);
+    this.fieldAnalyzers=getFieldAnalyzerStringsFromProfile(indexProfile.getFieldAnalyzers());
+  }
+
+  public Map<String,Integer> getIndexStats() {
+    return indexStats;
+  }
+  private  Map<String,Integer> getIndexStatsMap(LuceneIndexStats indexStats) {
+    Map<String,Integer> statsMap = new HashMap<>();
+    if (indexStats==null) return statsMap;
+    statsMap.put("queryExecutions",indexStats.getQueryExecutions());
+    statsMap.put("updates",indexStats.getUpdates());
+    statsMap.put("commits",indexStats.getCommits());
+    statsMap.put("documents",indexStats.getDocuments());
+    return statsMap;
+  }
+
+  public String getIndexStatsString() {
+    return indexStats.toString();
+  }
+
+  private Map<String, String> getFieldAnalyzerStrings(Map<String, Analyzer> fieldAnalyzers) {
+    if(fieldAnalyzers == null) {
+      return Collections.emptyMap();
+    }
+
+    Map<String, String> results = new HashMap<>();
+
+    for (Entry<String, Analyzer> entry : fieldAnalyzers.entrySet()) {
+      final Analyzer analyzer = entry.getValue();
+      if(analyzer != null) {
+        results.put(entry.getKey(), analyzer.getClass().getSimpleName());
+      }
+    }
+    return results;
+  }
+
+  private Map<String, String> getFieldAnalyzerStringsFromProfile(Map<String, String> fieldAnalyzers) {
+    if(fieldAnalyzers == null) {
+      return Collections.emptyMap();
+
+    }
+
+    Map<String, String> results = new HashMap<>();
+
+    for (Entry<String, String> entry : fieldAnalyzers.entrySet()) {
+      final String analyzer = entry.getValue();
+      if(analyzer != null) {
+        results.put(entry.getKey(), analyzer);
+      }
+    }
+    return results;
+  }
+
+  public String getSearchableFieldNamesString() {
+    return Arrays.asList(searchableFieldNames).toString();
+  }
+
+
+  public String getFieldAnalyzersString() {
+    return fieldAnalyzers.toString();
+  }
+
+  @Override
+  public String toString() {
+    final StringBuffer buffer = new StringBuffer();
+    buffer.append("{\n\tIndex Name = "+indexName);
+    buffer.append(",\tRegion Path = "+regionPath);
+    buffer.append(",\tIndexed Fields = "+getSearchableFieldNamesString());
+    buffer.append(",\tField Analyzer = "+getFieldAnalyzersString());
+    buffer.append(",\tStatus =\n\t"+ getInitialized());
+    buffer.append(",\tIndex Statistics =\n\t"+getIndexStatsString());
+    buffer.append("\n}\n");
+    return buffer.toString();
+  }
+
+  public boolean getInitialized() {
+    return initialized;
+  }
+
+  public String getIndexName() {
+    return indexName;
+  }
+
+  public String getRegionPath() {
+    return regionPath;
+  }
+
+  private static <T extends Comparable<T>> int compare(final T obj1, final T obj2) {
+    return (obj1 == null && obj2 == null ? 0 : (obj1 == null ? 1 : (obj2 == null ? -1 : obj1.compareTo(obj2))));
+  }
+
+  @Override
+  public int compareTo(final LuceneIndexDetails indexDetails) {
+    int comparisonValue = compare(getIndexName(), indexDetails.getIndexName());
+    return (comparisonValue != 0 ? comparisonValue : compare(getRegionPath(), indexDetails.getRegionPath()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexInfo.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexInfo.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexInfo.java
new file mode 100644
index 0000000..3df292c
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexInfo.java
@@ -0,0 +1,63 @@
+/*
+ * 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.lucene.internal.cli;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+
+import org.apache.lucene.analysis.Analyzer;
+
+public class LuceneIndexInfo implements Serializable {
+  private static final long serialVersionUID = 1L;
+
+  private final String indexName;
+  private final String regionPath;
+  private final String[] searchableFieldNames;
+  private final String[] fieldAnalyzers;
+
+  public LuceneIndexInfo(final String indexName, final String regionPath, final String[] searchableFieldNames, String[] fieldAnalyzers) {
+    this.indexName = indexName;
+    this.regionPath = regionPath;
+    this.searchableFieldNames = searchableFieldNames;
+    this.fieldAnalyzers = fieldAnalyzers;
+  }
+
+  public LuceneIndexInfo(final String indexName, final String regionPath) {
+    this(indexName,regionPath,null,null);
+  }
+
+  public String getIndexName() {
+    return indexName;
+  }
+
+  public String getRegionPath() {
+    return regionPath;
+  }
+
+  public String[] getSearchableFieldNames() {
+    return searchableFieldNames;
+  }
+
+  public String[] getFieldAnalyzers() {
+    return fieldAnalyzers;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneQueryInfo.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneQueryInfo.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneQueryInfo.java
new file mode 100644
index 0000000..0dbe2fe
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneQueryInfo.java
@@ -0,0 +1,70 @@
+/*
+ * 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.lucene.internal.cli;
+
+import java.io.Serializable;
+
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+
+public class LuceneQueryInfo implements Serializable {
+  private static final long serialVersionUID = 1L;
+  private String indexName;
+  private String regionPath;
+  private String queryString;
+  private String defaultField;
+  private int limit;
+  private boolean keysOnly;
+
+  public LuceneQueryInfo(final String indexName,
+                         final String regionPath,
+                         final String queryString,
+                         final String defaultField,
+                         final int limit,
+                         final boolean keysOnly)
+  {
+    this.indexName = indexName;
+    this.regionPath = regionPath;
+    this.queryString = queryString;
+    this.defaultField = defaultField;
+    this.limit = limit;
+    this.keysOnly = keysOnly;
+  }
+
+  public String getIndexName() {
+    return indexName;
+  }
+
+  public String getRegionPath() {
+    return regionPath;
+  }
+
+  public String getQueryString() {
+    return queryString;
+  }
+
+  public String getDefaultField() {
+    return defaultField;
+  }
+
+  public int getLimit() {
+    if (limit == -1) return LuceneQueryFactory.DEFAULT_LIMIT;
+    else return limit; }
+
+  public boolean getKeysOnly() { return keysOnly; }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneSearchResults.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneSearchResults.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneSearchResults.java
new file mode 100644
index 0000000..9f03873
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneSearchResults.java
@@ -0,0 +1,76 @@
+/*
+ * 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.lucene.internal.cli;
+
+import java.io.Serializable;
+
+public class LuceneSearchResults<K,V> implements Comparable<LuceneSearchResults>, Serializable {
+
+  private String key;
+  private String value;
+  private float score;
+  private boolean exceptionFlag = false;
+  private String exceptionMessage;
+
+
+  public LuceneSearchResults(final String key, final String value, final float score) {
+    this.key = key;
+    this.value = value;
+    this.score = score;
+  }
+
+  public LuceneSearchResults(final String key) {
+    this.key = key;
+  }
+
+  public LuceneSearchResults(final boolean exceptionFlag, final String exceptionMessage) {
+    this.exceptionFlag=exceptionFlag;
+    this.exceptionMessage=exceptionMessage;
+  }
+
+  public String getKey() {
+    return key;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public float getScore() {
+    return score;
+  }
+
+  @Override
+  public int compareTo(final LuceneSearchResults searchResults) {
+    return Float.compare(getScore(),searchResults.getScore());
+  }
+
+  public boolean getExeptionFlag() { return exceptionFlag; }
+
+  public String getExceptionMessage() { return exceptionMessage; }
+
+  @Override public String toString() {
+    return "LuceneSearchResults{" +
+      "key='" + key + '\'' +
+      ", value='" + value + '\'' +
+      ", score=" + score +
+      ", exceptionFlag=" + exceptionFlag +
+      ", exceptionMessage='" + exceptionMessage + '\'' +
+      '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
new file mode 100644
index 0000000..cb45f7b
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
@@ -0,0 +1,112 @@
+/*
+ * 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.lucene.internal.cli.functions;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneCliStrings;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
+import com.gemstone.gemfire.internal.InternalEntity;
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.management.internal.cli.CliUtil;
+import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+
+/**
+ * The LuceneCreateIndexFunction class is a function used to create Lucene indexes.
+ * </p>
+ * @see Cache
+ * @see com.gemstone.gemfire.cache.execute.Function
+ * @see FunctionAdapter
+ * @see FunctionContext
+ * @see InternalEntity
+ * @see LuceneIndexDetails
+ */
+@SuppressWarnings("unused")
+public class LuceneCreateIndexFunction extends FunctionAdapter implements InternalEntity {
+
+  protected Cache getCache() {
+    return CacheFactory.getAnyInstance();
+  }
+
+  public String getId() {
+    return LuceneListIndexFunction.class.getName();
+  }
+
+  public void execute(final FunctionContext context) {
+    String memberId = null;
+    try {
+      final LuceneIndexInfo indexInfo = (LuceneIndexInfo) context.getArguments();
+      final Cache cache = getCache();
+      memberId = cache.getDistributedSystem().getDistributedMember().getId();
+      LuceneService service = LuceneServiceProvider.get(cache);
+
+      String[] fields = indexInfo.getSearchableFieldNames();
+      String[] analyzerName = indexInfo.getFieldAnalyzers();
+
+      if (analyzerName == null || analyzerName.length == 0) {
+        service.createIndex(indexInfo.getIndexName(), indexInfo.getRegionPath(), fields);
+      }
+      else {
+        if (analyzerName.length != fields.length) throw new Exception("Mismatch in lengths of fields and analyzers");
+        Map<String, Analyzer> fieldAnalyzer = new HashMap<>();
+        for (int i = 0; i < fields.length; i++) {
+          Analyzer analyzer = toAnalyzer(analyzerName[i]);
+          fieldAnalyzer.put(fields[i], analyzer);
+        }
+        service.createIndex(indexInfo.getIndexName(), indexInfo.getRegionPath(), fieldAnalyzer);
+      }
+
+      //TODO - update cluster configuration by returning a valid XmlEntity
+      XmlEntity xmlEntity = null;
+      context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity));
+    }
+    catch (Exception e) {
+      String exceptionMessage = CliStrings.format(CliStrings.EXCEPTION_CLASS_AND_MESSAGE, e.getClass().getName(),
+        e.getMessage());
+      context.getResultSender().lastResult(new CliFunctionResult(memberId, e, e.getMessage()));
+    }
+  }
+
+  private Analyzer toAnalyzer(String className)
+  {
+    if (className==null)
+      className=StandardAnalyzer.class.getCanonicalName();
+    else if (StringUtils.trim(className).equals("") | StringUtils.trim(className).equals("null") )
+      className = StandardAnalyzer.class.getCanonicalName();
+
+    Class<? extends Analyzer> clazz = CliUtil.forName(className, LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER);
+    return CliUtil.newInstance(clazz, LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
new file mode 100755
index 0000000..015828a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
@@ -0,0 +1,74 @@
+/*
+ * 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.lucene.internal.cli.functions;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
+import com.gemstone.gemfire.internal.InternalEntity;
+
+/**
+ * The LuceneDescribeIndexFunction class is a function used to collect the information on a particular lucene index.
+ * </p>
+ * @see Cache
+ * @see com.gemstone.gemfire.cache.execute.Function
+ * @see FunctionAdapter
+ * @see FunctionContext
+ * @see InternalEntity
+ * @see LuceneIndexDetails
+ * @see LuceneIndexInfo
+ */
+@SuppressWarnings("unused")
+public class LuceneDescribeIndexFunction extends FunctionAdapter implements InternalEntity {
+
+  protected Cache getCache() {
+    return CacheFactory.getAnyInstance();
+  }
+
+  public String getId() {
+    return LuceneDescribeIndexFunction.class.getName();
+  }
+
+  public void execute(final FunctionContext context) {
+    LuceneIndexDetails result = null;
+
+    final Cache cache = getCache();
+    final LuceneIndexInfo indexInfo = (LuceneIndexInfo) context.getArguments();
+    LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
+    LuceneIndex index = service.getIndex(indexInfo.getIndexName(), indexInfo.getRegionPath());
+    LuceneIndexCreationProfile profile = service.getDefinedIndex(indexInfo.getIndexName(),indexInfo.getRegionPath());
+    if (index != null) {
+      result = new LuceneIndexDetails((LuceneIndexImpl) index);
+    } else if (profile != null) {
+     result = new LuceneIndexDetails(profile);
+    }
+    context.getResultSender().lastResult(result);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
new file mode 100755
index 0000000..bb74410
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
@@ -0,0 +1,71 @@
+/*
+ * 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.lucene.internal.cli.functions;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
+import com.gemstone.gemfire.internal.InternalEntity;
+
+/**
+ * The LuceneListIndexFunction class is a function used to collect the information on all lucene indexes in
+ * the entire Cache.
+ * </p>
+ * @see Cache
+ * @see com.gemstone.gemfire.cache.execute.Function
+ * @see FunctionAdapter
+ * @see FunctionContext
+ * @see InternalEntity
+ * @see LuceneIndexDetails
+ */
+@SuppressWarnings("unused")
+public class LuceneListIndexFunction extends FunctionAdapter implements InternalEntity {
+
+  protected Cache getCache() {
+    return CacheFactory.getAnyInstance();
+  }
+
+  public String getId() {
+    return LuceneListIndexFunction.class.getName();
+  }
+
+  public void execute(final FunctionContext context) {
+    final Set<LuceneIndexDetails> indexDetailsSet = new HashSet<>();
+    final Cache cache = getCache();
+    LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
+    for (LuceneIndex index : service.getAllIndexes()) {
+      indexDetailsSet.add(new LuceneIndexDetails((LuceneIndexImpl) index));
+    }
+
+    for(LuceneIndexCreationProfile profile : service.getAllDefinedIndexes()) {
+      indexDetailsSet.add(new LuceneIndexDetails(profile));
+    }
+    context.getResultSender().lastResult(indexDetailsSet);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
new file mode 100755
index 0000000..234583c
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
@@ -0,0 +1,107 @@
+/*
+ * 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.lucene.internal.cli.functions;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.lucene.LuceneQuery;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
+import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneQueryInfo;
+import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneSearchResults;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
+import com.gemstone.gemfire.internal.InternalEntity;
+
+/**
+ * The LuceneSearchIndexFunction class is a function used to collect the information on a particular lucene index.
+ * </p>
+ * @see Cache
+ * @see com.gemstone.gemfire.cache.execute.Function
+ * @see FunctionAdapter
+ * @see FunctionContext
+ * @see InternalEntity
+ * @see LuceneIndexDetails
+ * @see LuceneIndexInfo
+ */
+@SuppressWarnings("unused")
+public class LuceneSearchIndexFunction<K, V> extends FunctionAdapter implements InternalEntity {
+
+  protected Cache getCache() {
+    return CacheFactory.getAnyInstance();
+  }
+
+  public String getId() {
+    return LuceneSearchIndexFunction.class.getName();
+  }
+
+  public void execute(final FunctionContext context) {
+    Set<LuceneSearchResults> result = new HashSet<>();
+    final Cache cache = getCache();
+    final LuceneQueryInfo queryInfo = (LuceneQueryInfo) context.getArguments();
+
+    LuceneService luceneService = LuceneServiceProvider.get(getCache());
+    try {
+      if (luceneService.getIndex(queryInfo.getIndexName(), queryInfo.getRegionPath()) == null) {
+        throw new Exception("Index " + queryInfo.getIndexName() + " not found on region " + queryInfo.getRegionPath());
+      }
+      final LuceneQuery<K, V> query = luceneService.createLuceneQueryFactory()
+        .setResultLimit(queryInfo.getLimit())
+        .create(queryInfo.getIndexName(), queryInfo.getRegionPath(), queryInfo.getQueryString(),
+          queryInfo.getDefaultField());
+      if (queryInfo.getKeysOnly()) {
+        query.findKeys().forEach(key -> result.add(new LuceneSearchResults(key.toString())));
+      }
+      else {
+        PageableLuceneQueryResults pageableLuceneQueryResults = query.findPages();
+        while (pageableLuceneQueryResults.hasNext()) {
+          List<LuceneResultStruct> page = pageableLuceneQueryResults.next();
+          page.stream()
+            .forEach(searchResult ->
+              result.add(
+                new LuceneSearchResults<K, V>(searchResult.getKey().toString(), searchResult.getValue().toString(),
+                  searchResult.getScore())));
+        }
+      }
+      if (result != null) {
+        context.getResultSender().lastResult(result);
+      }
+    }
+    catch (LuceneQueryException e) {
+      result.add(new LuceneSearchResults(true, e.getRootCause().getMessage()));
+      context.getResultSender().lastResult(result);
+    }
+    catch (Exception e) {
+      result.add(new LuceneSearchResults(true, e.getMessage()));
+      context.getResultSender().lastResult(result);
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFiles.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFiles.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFiles.java
new file mode 100644
index 0000000..0d18144
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFiles.java
@@ -0,0 +1,116 @@
+/*
+ * 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.lucene.internal.directory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
+import com.gemstone.gemfire.cache.execute.ResultSender;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneIndex;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.CollectorManager;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunctionContext;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollector;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollectorManager;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepositoryImpl;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.query.QueryException;
+import com.gemstone.gemfire.internal.InternalEntity;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.store.Directory;
+
+public class DumpDirectoryFiles implements Function, InternalEntity {
+  private static final long serialVersionUID = 1L;
+
+  private static final Logger logger = LogService.getLogger();
+  public static final String ID = DumpDirectoryFiles.class.getSimpleName();
+
+  @Override
+  public void execute(FunctionContext context) {
+    RegionFunctionContext ctx = (RegionFunctionContext) context;
+
+    if(!(context.getArguments() instanceof String[])) {
+      throw new IllegalArgumentException("Arguments should be a string array");
+    }
+    String[] args = (String[]) context.getArguments();
+    if(args.length != 2) {
+      throw new IllegalArgumentException("Expected 2 arguments: exportLocation, indexName");
+    }
+
+
+    String exportLocation =args[0];
+    String indexName =args[1];
+
+    final Region<Object, Object> region = ctx.getDataSet();
+    LuceneService service = LuceneServiceProvider.get(ctx.getDataSet().getCache());
+    InternalLuceneIndex index = (InternalLuceneIndex) service.getIndex(indexName, region.getFullPath());
+    if(index == null) {
+      throw new IllegalStateException("Index not found for region " + region + " index " + indexName);
+    }
+
+    final RepositoryManager repoManager = index.getRepositoryManager();
+    try {
+      final Collection<IndexRepository> repositories = repoManager.getRepositories(ctx);
+      repositories.stream().forEach(repo -> {
+        final IndexWriter writer = repo.getWriter();
+        RegionDirectory directory = (RegionDirectory) writer.getDirectory();
+        FileSystem fs = directory.getFileSystem();
+
+        String bucketName = index.getName() + "_" + repo.getRegion().getFullPath();
+        bucketName = bucketName.replace("/", "_");
+        File bucketDirectory = new File(exportLocation, bucketName);
+        bucketDirectory.mkdirs();
+        fs.export(bucketDirectory);
+      });
+      context.getResultSender().lastResult(null);
+    }
+    catch (BucketNotFoundException e) {
+      throw new FunctionException(e);
+    }
+  }
+
+  @Override public String getId() {
+    return ID;
+  }
+
+  @Override
+  public boolean optimizeForWrite() {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/FileIndexInput.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/FileIndexInput.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/FileIndexInput.java
new file mode 100644
index 0000000..9ebef51
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/FileIndexInput.java
@@ -0,0 +1,131 @@
+/*
+ * 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.lucene.internal.directory;
+
+import java.io.EOFException;
+import java.io.IOException;
+
+import org.apache.lucene.store.IndexInput;
+
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.SeekableInputStream;
+
+final class FileIndexInput extends IndexInput {
+  private final File file;
+  SeekableInputStream in;
+  private long position;
+  
+  //Used for slice operations
+  private long sliceOffset;
+  private long sliceLength;
+  
+  FileIndexInput(String resourceDesc, File file) {
+    this(resourceDesc, file, 0L, file.getLength());
+  }
+
+  /**
+   * Constructor for a slice.
+   */
+  private FileIndexInput(String resourceDesc, File file, long offset, long length) {
+    super(resourceDesc);
+    this.file = file;
+    in = file.getInputStream();
+    this.sliceOffset = offset;
+    this.sliceLength = length;
+  }
+
+  @Override
+  public long length() {
+    return sliceLength;
+  }
+
+  @Override
+  public void close() throws IOException {
+    in.close();
+  }
+  
+  @Override
+  public FileIndexInput clone() {
+    FileIndexInput clone = (FileIndexInput)super.clone();
+    clone.in = in.clone();
+    return clone;
+  }
+
+  @Override
+  public long getFilePointer() {
+    return position;
+  }
+
+  @Override
+  public void seek(long pos) throws IOException {
+    in.seek(pos + sliceOffset);
+    this.position = pos;
+  }
+
+  @Override
+  public IndexInput slice(String sliceDescription, long offset, long length)
+      throws IOException {
+    if(length > (this.sliceLength - offset)) {
+      throw new IllegalArgumentException("Slice length is to large. Asked for " + length + " file length is " + sliceLength + ": " + this.file.getName());
+    }
+    if(offset < 0 || offset >= this.sliceLength) {
+      throw new IllegalArgumentException("Slice offset is invalid: " + this.file.getName());
+    }
+    
+    FileIndexInput result = new FileIndexInput(sliceDescription, file, sliceOffset + offset, length);
+    result.seek(0);
+    return result;
+  }
+
+  @Override
+  public byte readByte() throws IOException {
+    if(++position > sliceLength) {
+      throw new EOFException("Read past end of file " + file.getName());
+    }
+    
+    int result = in.read();
+    if(result == -1) {
+      throw new EOFException("Read past end of file " + file.getName());
+    } else {
+      return (byte) result;
+    }
+  }
+
+  @Override
+  public void readBytes(byte[] b, int offset, int len) throws IOException {
+    if(len == 0) {
+      return;
+    }
+    
+    if(position + len > sliceLength) {
+      throw new EOFException("Read past end of file " + file.getName());
+    }
+    
+    //For the FileSystemInputStream, it will always read all bytes, up
+    //until the end of the file. So if we didn't get enough bytes, it's
+    //because we reached the end of the file.
+    int numRead = in.read(b, offset, len);
+    if(numRead < len) {
+      throw new EOFException("Read past end of file " + file.getName());
+    }
+    
+    position+=len;
+  } 
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/RegionDirectory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/RegionDirectory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/RegionDirectory.java
new file mode 100644
index 0000000..45b9c97
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/RegionDirectory.java
@@ -0,0 +1,132 @@
+/*
+ * 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.lucene.internal.directory;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.lucene.store.BaseDirectory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.store.OutputStreamIndexOutput;
+import org.apache.lucene.store.SingleInstanceLockFactory;
+
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemStats;
+
+/**
+ * An implementation of Directory that stores data in geode regions.
+ * 
+ * Directory is an interface to file/RAM storage for lucene. This class uses
+ * the {@link FileSystem} class to store the data in the provided geode
+ * regions.
+ */
+public class RegionDirectory extends BaseDirectory {
+
+  private final FileSystem fs;
+
+  /**
+   * Create a region directory with a given file and chunk region. These regions
+   * may be bucket regions or they may be replicated regions.
+   */
+  public RegionDirectory(ConcurrentMap<String, File> fileRegion, ConcurrentMap<ChunkKey, byte[]> chunkRegion, FileSystemStats stats) {
+    super(new SingleInstanceLockFactory());
+    fs = new FileSystem(fileRegion, chunkRegion, stats);
+  }
+
+  @Override
+  public String[] listAll() throws IOException {
+    ensureOpen();
+    String[] array = fs.listFileNames().toArray(new String[]{});
+    Arrays.sort(array);
+    return array;
+  }
+
+  @Override
+  public void deleteFile(String name) throws IOException {
+    ensureOpen();
+    fs.deleteFile(name);
+  }
+
+  @Override
+  public long fileLength(String name) throws IOException {
+    ensureOpen();
+    return fs.getFile(name).getLength();
+  }
+
+  @Override
+  public IndexOutput createOutput(final String name, final IOContext context) throws IOException {
+    ensureOpen();
+    final File file = fs.createFile(name);
+    final OutputStream out = file.getOutputStream();
+
+    return new OutputStreamIndexOutput(name, name, out, 1000);
+  }
+
+  public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException {
+    String name = prefix + "_temp_" + UUID.randomUUID() + suffix;
+    final File file = fs.createTemporaryFile(name);
+    final OutputStream out = file.getOutputStream();
+
+    return new OutputStreamIndexOutput(name, name, out, 1000);
+  }
+
+  @Override
+  public void sync(Collection<String> names) throws IOException {
+    ensureOpen();
+    // Region does not need to sync to disk
+  }
+
+  @Override
+  public void renameFile(String source, String dest) throws IOException {
+    ensureOpen();
+    fs.renameFile(source, dest);
+  }
+
+  @Override
+  public IndexInput openInput(String name, IOContext context) throws IOException {
+    ensureOpen();
+    final File file = fs.getFile(name);
+
+    return new FileIndexInput(name, file);
+  }
+
+  @Override
+  public void close() throws IOException {
+    isOpen = false;
+  }
+
+  /**
+   * For testing, the file system
+   */
+  public FileSystem getFileSystem() {
+    return fs;
+  }
+  
+  
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/package-info.java
new file mode 100644
index 0000000..2dd0606
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/directory/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * An implementation of Lucene's {@link org.apache.lucene.store.Directory} interface that uses the filesystem
+ * API in {@link com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem}
+ */
+package com.gemstone.gemfire.cache.lucene.internal.directory;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/CollectorManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/CollectorManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/CollectorManager.java
new file mode 100644
index 0000000..4d1d1c2
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/CollectorManager.java
@@ -0,0 +1,54 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import com.gemstone.gemfire.annotations.Experimental;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
+
+/**
+ * {@link CollectorManager}s create instances of {@link IndexResultCollector} and utility methods to aggregate results
+ * collected by individual collectors. The collectors created by this class are primarily used for collecting results
+ * from {@link IndexRepository}s. The collectors can also be used for aggregating results of other collectors of same
+ * type. Typically search result aggregation is completed in two phases. First at a member level for merging results
+ * from local buckets. And then at search coordinator level for merging results from members. Use of same collector in
+ * both phases is expected to produce deterministic merge result irrespective of the way buckets are distributed.
+ * 
+ * @param <C> Type of IndexResultCollector created by this manager
+ */
+@Experimental
+public interface CollectorManager<C extends IndexResultCollector> {
+  /**
+   * @param name Name/Identifier for this collector. For e.g. region/bucketId.
+   * @return a new {@link IndexResultCollector}. This must return a different instance on
+   *         each call. A new collector would be created for each bucket on a member node.
+   */
+  C newCollector(String name);
+
+  /**
+   * Reduce the results of individual collectors into a meaningful result. This method must be called after collection
+   * is finished on all provided collectors.
+   * 
+   */
+  C reduce(Collection<C> results);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/EntryScore.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/EntryScore.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/EntryScore.java
new file mode 100644
index 0000000..e891156
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/EntryScore.java
@@ -0,0 +1,84 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * Holds one entry matching search query and its metadata
+ *
+ * @param <K> the type of the key
+ */
+public class EntryScore<K> implements DataSerializableFixedID {
+  // Key of the entry matching search query
+  private K key;
+
+  // The score of this document for the query.
+  private float score;
+
+  public EntryScore() {
+  }
+
+  public EntryScore(K key, float score) {
+    this.key = key;
+    this.score = score;
+  }
+  
+  public K getKey() {
+    return key;
+  }
+
+  public float getScore() {
+    return score;
+  }
+
+  @Override
+  public String toString() {
+    return "key=" + key + " score=" + score;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_ENTRY_SCORE;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeObject(key, out);
+    out.writeFloat(score);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    key = DataSerializer.readObject(in);
+    score = in.readFloat();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
new file mode 100644
index 0000000..3c6c0d2
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunction.java
@@ -0,0 +1,126 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.search.Query;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
+import com.gemstone.gemfire.cache.execute.ResultSender;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneIndex;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.query.QueryException;
+import com.gemstone.gemfire.internal.InternalEntity;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.execute.BucketMovedException;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * {@link LuceneFunction} coordinates text search on a member. It receives text search query from the coordinator
+ * and arguments like region and buckets. It invokes search on the local index and provides a result collector. The
+ * locally collected results are sent to the search coordinator.
+ */
+public class LuceneFunction extends FunctionAdapter implements InternalEntity {
+  private static final long serialVersionUID = 1L;
+  public static final String ID = LuceneFunction.class.getName();
+
+  private static final Logger logger = LogService.getLogger();
+
+  @Override
+  public void execute(FunctionContext context) {
+    RegionFunctionContext ctx = (RegionFunctionContext) context;
+    ResultSender<TopEntriesCollector> resultSender = ctx.getResultSender();
+
+    Region region = ctx.getDataSet();
+
+    LuceneFunctionContext<IndexResultCollector> searchContext = (LuceneFunctionContext) ctx.getArguments();
+    if (searchContext == null) {
+      throw new IllegalArgumentException("Missing search context");
+    }
+
+    LuceneQueryProvider queryProvider = searchContext.getQueryProvider();
+    if (queryProvider == null) {
+      throw new IllegalArgumentException("Missing query provider");
+    }
+    
+    LuceneService service = LuceneServiceProvider.get(region.getCache());
+    InternalLuceneIndex index = (InternalLuceneIndex) service.getIndex(searchContext.getIndexName(), region.getFullPath());
+    RepositoryManager repoManager = index.getRepositoryManager();
+
+    Query query = null;
+    try {
+      query = queryProvider.getQuery(index);
+    } catch (LuceneQueryException e) {
+      logger.warn("", e);
+      throw new FunctionException(e);
+    }
+
+    if (logger.isDebugEnabled()) {
+      logger.debug("Executing lucene query: {}, on region {}", query, region.getFullPath());
+    }
+
+    int resultLimit = searchContext.getLimit();
+    CollectorManager manager = (searchContext == null) ? null : searchContext.getCollectorManager();
+    if (manager == null) {
+      manager = new TopEntriesCollectorManager(null, resultLimit);
+    }
+
+    Collection<IndexResultCollector> results = new ArrayList<>();
+    try {
+      Collection<IndexRepository> repositories = repoManager.getRepositories(ctx);
+      for (IndexRepository repo : repositories) {
+        IndexResultCollector collector = manager.newCollector(repo.toString());
+        logger.debug("Executing search on repo: " + repo.toString());
+        repo.query(query, resultLimit, collector);
+        results.add(collector);
+      }
+      TopEntriesCollector mergedResult = (TopEntriesCollector) manager.reduce(results);
+      resultSender.lastResult(mergedResult);
+    } catch (IOException|BucketNotFoundException e) {
+      logger.warn("", e);
+      throw new FunctionException(e);
+    }
+  }
+
+
+  @Override
+  public String getId() {
+    return ID;
+  }
+  
+  @Override
+  public boolean optimizeForWrite() {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionContext.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionContext.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionContext.java
new file mode 100644
index 0000000..b0b2c60
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneFunctionContext.java
@@ -0,0 +1,115 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * Contains function arguments for text / lucene search
+ */
+public class LuceneFunctionContext<C extends IndexResultCollector> implements DataSerializableFixedID {
+  private CollectorManager<C> manager;
+  private int limit;
+  private LuceneQueryProvider queryProvider;
+  private String indexName;
+
+  public LuceneFunctionContext() {
+    this(null, null, null);
+  }
+
+  public LuceneFunctionContext(LuceneQueryProvider provider, String indexName) {
+    this(provider, indexName, null);
+  }
+
+  public LuceneFunctionContext(LuceneQueryProvider provider, String indexName, CollectorManager<C> manager) {
+    this(provider, indexName, manager, LuceneQueryFactory.DEFAULT_LIMIT);
+  }
+
+  public LuceneFunctionContext(LuceneQueryProvider provider, String indexName, CollectorManager<C> manager, int limit) {
+    this.queryProvider = provider;
+    this.indexName = indexName;
+    this.manager = manager;
+    this.limit = limit;
+  }
+
+  /**
+   * @return The maximum count of result objects to be produced by the function
+   */
+  public int getLimit() {
+    return limit;
+  }
+
+  /**
+   * Get the name of the index to query
+   */
+  public String getIndexName() {
+    return indexName;
+  }
+
+  /**
+   * On each member, search query is executed on one or more {@link IndexRepository}s. A {@link CollectorManager} could
+   * be provided to customize the way results from these repositories is collected and merged.
+   * 
+   * @return {@link CollectorManager} instance to be used by function
+   */
+  public CollectorManager<C> getCollectorManager() {
+    return this.manager;
+  }
+
+  public LuceneQueryProvider getQueryProvider() {
+    return queryProvider;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_FUNCTION_CONTEXT;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    out.writeInt(limit);
+    DataSerializer.writeObject(queryProvider, out);
+    DataSerializer.writeObject(manager, out);
+    DataSerializer.writeString(indexName, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    limit = in.readInt();
+    queryProvider = DataSerializer.readObject(in);
+    manager = DataSerializer.readObject(in);
+    this.indexName = DataSerializer.readString(in);
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+}



[09/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java
new file mode 100644
index 0000000..427054a
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationConcurrentOpsDUnitTest.java
@@ -0,0 +1,285 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+@Category(DistributedTest.class)
+public class ParallelWANPropagationConcurrentOpsDUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+  
+  public ParallelWANPropagationConcurrentOpsDUnitTest() {
+    super();
+  }
+  
+  /**
+   * Normal propagation scenario test case for a PR with only one bucket.
+   * This has been added for bug# 44284.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithSingleBucketPR() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5);
+ 
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+ 
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 1, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 1, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 1, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 1, isOffHeap() ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //pause the senders
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    Wait.pause(5000);
+    
+    AsyncInvocation async1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 700 ));
+    AsyncInvocation async2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    AsyncInvocation async3 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 800 ));
+    AsyncInvocation async4 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    async1.join();
+    async2.join();
+    async3.join();
+    async4.join();
+    
+    int queueSize = (Integer) vm4.invoke(() -> WANTestBase.getQueueContentSize( "ln" ));
+    assertEquals("Actual queue size is not matching with the expected", 3500, queueSize);
+    
+    //resume the senders now
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  /**
+   * Normal propagation scenario test case for a PR with less number of buckets.
+   * Buckets have been kept to 10 for this test.
+   * This has been added for bug# 44287.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithLowNumberOfBuckets() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5);
+ 
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+ 
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    AsyncInvocation async1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 700 ));
+    AsyncInvocation async2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    AsyncInvocation async3 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 800 ));
+    AsyncInvocation async4 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    async1.join();
+    async2.join();
+    async3.join();
+    async4.join();
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testParallelQueueDrainInOrder_PR() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 3, 4, isOffHeap() ));
+  
+    vm2.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_PR"));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 3, 4, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.addQueueListener( "ln", true));
+    vm5.invoke(() -> WANTestBase.addQueueListener( "ln", true));
+    vm6.invoke(() -> WANTestBase.addQueueListener( "ln", true));
+    vm7.invoke(() -> WANTestBase.addQueueListener( "ln", true));
+
+    Wait.pause(2000);
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln"));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln"));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln"));
+    
+    Wait.pause(2000);
+    
+    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      4 ));
+    vm4.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4));
+    vm5.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4));
+    vm6.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4 ));
+    vm7.invoke(() -> WANTestBase.addListenerOnBucketRegion(getTestMethodName() + "_PR", 4));
+    
+    vm4.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4));
+    vm5.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4));
+    vm6.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4 ));
+    vm7.invoke(() -> WANTestBase.addListenerOnQueueBucketRegion( "ln" , 4));
+    
+    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+    
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+    
+    HashMap vm4BRUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
+    HashMap vm5BRUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
+    HashMap vm6BRUpdates = (HashMap)vm6.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
+    HashMap vm7BRUpdates = (HashMap)vm7.invoke(() -> WANTestBase.checkBR(getTestMethodName() + "_PR", 4));
+    
+    List b0SenderUpdates = (List)vm4BRUpdates.get("Create0");
+    List b1SenderUpdates = (List)vm4BRUpdates.get("Create1");
+    List b2SenderUpdates = (List)vm4BRUpdates.get("Create2");
+    List b3SenderUpdates = (List)vm4BRUpdates.get("Create3");
+    
+    HashMap vm4QueueBRUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
+    HashMap vm5QueueBRUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
+    HashMap vm6QueueBRUpdates = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
+    HashMap vm7QueueBRUpdates = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue_BR("ln", 4));
+    
+    assertEquals(vm4QueueBRUpdates, vm5QueueBRUpdates);
+    assertEquals(vm4QueueBRUpdates, vm6QueueBRUpdates);
+    assertEquals(vm4QueueBRUpdates, vm7QueueBRUpdates);
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln"));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln"));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln"));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+    HashMap receiverUpdates = (HashMap)vm2.invoke(() -> WANTestBase.checkPR(
+      getTestMethodName() + "_PR"));
+    List<Long> createList = (List)receiverUpdates.get("Create");
+    ArrayList<Long> b0ReceiverUpdates = new ArrayList<Long>();
+    ArrayList<Long> b1ReceiverUpdates = new ArrayList<Long>();
+    ArrayList<Long> b2ReceiverUpdates = new ArrayList<Long>();
+    ArrayList<Long> b3ReceiverUpdates = new ArrayList<Long>();
+    for (Long key : createList) {
+      long mod = key % 4;
+      if (mod == 0) {
+        b0ReceiverUpdates.add(key);
+      }
+      else if (mod == 1) {
+        b1ReceiverUpdates.add(key);
+      }
+      else if (mod == 2) {
+        b2ReceiverUpdates.add(key);
+      }
+      else if (mod == 3) {
+        b3ReceiverUpdates.add(key);
+      }
+    }
+    b0ReceiverUpdates.remove(0);
+    b1ReceiverUpdates.remove(0);
+    b2ReceiverUpdates.remove(0);
+    b3ReceiverUpdates.remove(0);
+    
+    assertEquals(b0SenderUpdates, b0ReceiverUpdates);
+    assertEquals(b1SenderUpdates, b1ReceiverUpdates);
+    assertEquals(b2SenderUpdates, b2ReceiverUpdates);
+    assertEquals(b3SenderUpdates, b3ReceiverUpdates);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java
new file mode 100644
index 0000000..7b0cf3e
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationDUnitTest.java
@@ -0,0 +1,1234 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.Set;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.EntryExistsException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.BatchException70;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class ParallelWANPropagationDUnitTest extends WANTestBase {
+  private static final long serialVersionUID = 1L;
+
+  public ParallelWANPropagationDUnitTest() {
+    super();
+  }
+
+  @Test
+  public void test_ParallelGatewaySenderMetaRegionNotExposedToUser_Bug44216() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCache(lnPort);
+    createSender("ln", 2, true, 100, 300, false, false,
+        null, true);
+    createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap());
+
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals("ln")) {
+        sender = s;
+        break;
+      }
+    }
+    try {
+      sender.start();
+    } catch (Exception e) {
+      e.printStackTrace();
+      fail("Failed with IOException");
+    }
+
+    GemFireCacheImpl gemCache = (GemFireCacheImpl)cache;
+    Set regionSet = gemCache.rootRegions();
+
+    for (Object r : regionSet) {
+      if (((Region)r).getName().equals(
+          ((AbstractGatewaySender)sender).getQueues().toArray(new RegionQueue[1])[0].getRegion().getName())) {
+        fail("The shadowPR is exposed to the user");
+      }
+    }
+  }
+  
+  @Test
+  public void testParallelPropagation_withoutRemoteSite() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //keep a larger batch to minimize number of exception occurrences in the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 300, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 300, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 300, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 300, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+    createReceiverInVMs(vm2, vm3);
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    // Just making sure that though the remote site is started later,
+    // remote site is still able to get the data. Since the receivers are
+    // started before creating partition region it is quite possible that the
+    // region may loose some of the events. This needs to be handled by the code
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  /**
+   * Normal happy scenario test case.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  protected SerializableRunnableIF createReceiverPartitionedRegionRedundancy1() {
+    return () -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  );
+  }
+
+  protected SerializableRunnableIF createPartitionedRegionRedundancy1Runnable() {
+    return () -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  );
+  }
+
+  protected SerializableRunnableIF waitForSenderRunnable() {
+    return () -> WANTestBase.waitForSenderRunningState( "ln" );
+  }
+
+  @Test
+  public void testParallelPropagation_ManualStart() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, false ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  /**
+   * Normal happy scenario test case2.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationPutBeforeSenderStart() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  /**
+   * Local and remote sites are up and running.
+   * Local site cache is closed and the site is built again.
+   * Puts are done to local site.
+   * Expected: Remote site should receive all the events put after the local
+   * site was built back.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithLocalCacheClosedAndRebuilt() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+              getTestMethodName() + "_PR", 1000 ));
+    //-------------------Close and rebuild local site ---------------------------------
+
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+    vm6.invoke(() -> WANTestBase.killSender());
+    vm7.invoke(() -> WANTestBase.killSender());
+    
+    Integer regionSize = 
+      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_PR" ));
+    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    //------------------------------------------------------------------------------------
+    
+    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  @Test
+  public void testParallelColocatedPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+  }
+  /**
+   * Create colocated partitioned regions.
+   * Parent region has PGS attached and child region doesn't.
+   * 
+   * Validate that events for parent region reaches remote site.
+   * 
+   * @throws Exception
+   */
+
+  @Test
+  public void testParallelColocatedPropagation2() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions2( getTestMethodName(), null, 1, 100, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"_child1", 1000 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"_child2", 1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName()+"_child1", 0 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName()+"_child2", 0 ));
+  }
+
+  
+  @Test
+  public void testParallelPropagationWithOverflow() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName(), null, 1, 100, isOffHeap()  ));
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //let all the senders start before doing any puts to ensure that none of the events is lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), 150 ));
+
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 150 ));
+  }
+
+  @Test
+  public void testSerialReplicatedAndParallelPartitionedPropagation()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial",
+        2, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnParallel",
+        2, true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnParallel",
+        2, true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "lnParallel",
+        2, true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "lnParallel",
+        2, true, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("lnSerial", vm4, vm5);
+
+    startSenderInVMs("lnParallel", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testPartitionedParallelPropagationToTwoWanSites()
+      throws Exception {
+    Integer lnPort = createFirstLocatorWithDSId(1);
+    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    createReceiverInVMs(vm2);
+
+    createCacheInVMs(tkPort, vm3);
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+    createReceiverInVMs(vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnParallel1",
+        2, true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnParallel1",
+        2, true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "lnParallel1",
+        2, true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "lnParallel1",
+        2, true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnParallel2",
+        3, true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnParallel2",
+        3, true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "lnParallel2",
+        3, true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "lnParallel2",
+        3, true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnParallel1,lnParallel2", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("lnParallel1", vm4, vm5, vm6, vm7);
+
+    startSenderInVMs("lnParallel2", vm4, vm5, vm6, vm7);
+
+
+    //before doing puts, make sure that the senders are started.
+    //this will ensure that not a single events is lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel1" ));
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "lnParallel2" ));
+    
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel1"));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("lnParallel2"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Category(FlakyTest.class) // GEODE-1008 and GEODE-1180: random ports, async actions, thread sleeps, time sensitive, waitForCriterion
+  @Test
+  public void testPartitionedParallelPropagationHA() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    AsyncInvocation inv1 = vm7.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
+    Wait.pause(500);
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));
+    Wait.pause(1500);
+    AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
+    inv1.join();
+    inv2.join();
+    inv3.join();
+    inv4.join();
+    
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+    
+    //verify all buckets drained on the sender nodes that up and running.
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+  }
+
+  @Test
+  public void testParallelPropagationWithFilter() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap()  ));
+
+    //wait for senders to be running before doing any puts. This will ensure that
+    //not a single events is lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+  }
+  
+  
+  @Test
+  public void testParallelPropagationWithPutAll() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPutAll( getTestMethodName() + "_PR",
+        100 , 50 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 5000 ));
+  
+  }
+  
+  /**
+   * There was a bug that all destroy events were being put into different buckets of sender queue
+   * against the key 0. Bug# 44304
+   *  
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithDestroy() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 100, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 100, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 100, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 100, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm6.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm7.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    vm6.invoke(waitForSenderRunnable());
+    vm7.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    Wait.pause(2000);
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    vm4.invoke(() -> WANTestBase.doDestroys( getTestMethodName() + "_PR", 500 ));
+    
+    
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueBucketSize( "ln", 15 ));
+
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    //give some time for the queue to drain
+    Wait.pause(5000);
+    
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 500 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 500 ));
+  
+  }
+  
+  /**
+   * Normal happy scenario test case. But with Tx operations
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationTxOperations() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5);
+    //vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    //vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    //vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+    //    true, 100, 10, false, false, null, true ));
+    //vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+    //    true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+//    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+//        testName + "_PR", "ln", true, 1, 100, isOffHeap()  ));
+//    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+//        testName + "_PR", "ln", true, 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+//    vm6.invoke(() -> WANTestBase.startSender( "ln" ));
+//    vm7.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm2.invoke(createReceiverPartitionedRegionRedundancy1());
+    vm3.invoke(createReceiverPartitionedRegionRedundancy1());
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+//    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+//    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm4.invoke(() -> WANTestBase.doTxPuts( getTestMethodName() + "_PR"));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+//    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+//    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 3 ));
+  }
+
+  @Ignore
+  @Test
+  public void testParallelGatewaySenderQueueLocalSize() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    /*
+     * Remember pausing sender does not guarantee that peek will be paused
+     * immediately as its quite possible event processor is already in peeking
+     * events and send them after peeking without a check for pause. hence below
+     * pause of 1 sec to allow dispatching to be paused
+     */
+//    vm4.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
+//    vm5.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
+    Wait.pause(1000);
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
+    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
+    
+    // instead of checking size as 5 and 5. check that combined size is 10
+    Integer localSize1 = (Integer)vm4.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
+    Integer localSize2 = (Integer)vm5.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
+    assertEquals(10,  localSize1 + localSize2);
+  }
+  
+
+
+  public void tParallelGatewaySenderQueueLocalSizeWithHA() {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(createPartitionedRegionRedundancy1Runnable());
+    vm5.invoke(createPartitionedRegionRedundancy1Runnable());
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    /*
+     * Remember pausing sender does not guarantee that peek will be paused
+     * immediately as its quite possible event processor is already in peeking
+     * events and send them after peeking without a check for pause. hence below
+     * pause of 1 sec to allow dispatching to be paused
+     */
+//    vm4.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
+//    vm5.invoke(() -> WANTestBase.waitForSenderPausedState( "ln" ));
+    Wait.pause(1000);
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
+    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
+    
+    Integer localSize1 = (Integer)vm4.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
+    Integer localSize2 = (Integer)vm5.invoke(() -> WANTestBase.getPRQLocalSize( "ln"));
+    assertEquals(10,  localSize1 + localSize2);
+    
+    vm5.invoke(() -> WANTestBase.killSender( ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 10 ));
+    vm4.invoke(() -> WANTestBase.checkPRQLocalSize( "ln", 10 ));
+    
+  }
+  
+  /**
+   * Added for defect #50364 Can't colocate region that has AEQ with a region that does not have that same AEQ
+   */
+  @Test
+  public void testParallelSenderAttachedToChildRegionButNotToParentRegion() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+	  //create cache and receiver on site2
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+	  //create cache on site1
+    createCacheInVMs(lnPort, vm3);
+
+	  //create sender on site1
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    
+    //start sender on site1
+    startSenderInVMs("ln", vm3);
+
+    //create leader (parent) PR on site1
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "PARENT_PR", null, 0, 100, isOffHeap() ));
+    String parentRegionFullPath = 
+      (String) vm3.invoke(() -> WANTestBase.getRegionFullPath( getTestMethodName() + "PARENT_PR"));
+    
+    //create colocated (child) PR on site1
+    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegion(
+        getTestMethodName() + "CHILD_PR", "ln", 0, 100, parentRegionFullPath ));
+    
+    //create leader and colocated PR on site2
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "PARENT_PR", null, 0, 100, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegion(
+        getTestMethodName() + "CHILD_PR", null, 0, 100, parentRegionFullPath ));
+    
+    //do puts in colocated (child) PR on site1
+    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "CHILD_PR", 1000 ));
+    
+    //verify the puts reach site2
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "CHILD_PR", 1000 ));
+  }
+  
+  @Test
+  public void testParallelPropagationWithFilter_AfterAck() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm6, vm7);
+    createReceiverInVMs(vm6, vm7);
+
+    createCacheInVMs(lnPort, vm2, vm3, vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
+        100, 10, false, false, new MyGatewayEventFilter_AfterAck(), true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm2, vm3, vm4, vm5);
+
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    // wait for senders to be running before doing any puts. This will ensure
+    // that
+    // not a single events is lost
+    vm2.invoke(waitForSenderRunnable());
+    vm3.invoke(waitForSenderRunnable());
+    vm4.invoke(waitForSenderRunnable());
+    vm5.invoke(waitForSenderRunnable());
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+    vm3.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName(), 1000 ));
+    
+    Integer vm2Acks = (Integer)vm2.invoke(() -> WANTestBase.validateAfterAck( "ln"));
+    Integer vm3Acks = (Integer)vm3.invoke(() -> WANTestBase.validateAfterAck( "ln"));
+    Integer vm4Acks = (Integer)vm4.invoke(() -> WANTestBase.validateAfterAck( "ln"));
+    Integer vm5Acks = (Integer)vm5.invoke(() -> WANTestBase.validateAfterAck( "ln"));
+
+    assertEquals(2000, (vm2Acks + vm3Acks + vm4Acks + vm5Acks));
+        
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java
new file mode 100644
index 0000000..07a6223
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPropagationLoopBackDUnitTest.java
@@ -0,0 +1,415 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+@Category(DistributedTest.class)
+public class ParallelWANPropagationLoopBackDUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+  
+  public ParallelWANPropagationLoopBackDUnitTest() {
+    super();
+  }
+  
+  /**
+   * Test loop back issue between 2 WAN sites (LN & NY). LN -> NY -> LN.
+   * Site1 (LN): vm2, vm4, vm5
+   * Site2 (NY): vm3, vm6, vm7
+   */
+  @Test
+  public void testParallelPropagationLoopBack() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //create receiver on site1 and site2
+    createCacheInVMs(lnPort, vm2, vm4, vm5);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    createCacheInVMs(nyPort, vm3, vm6, vm7);
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    //create senders on site1
+    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    
+    //create senders on site2
+    vm3.invoke(() -> WANTestBase.createSender( "ny", 1,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ny", 1,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny", 1,
+      true, 100, 10, false, false, null, true ));
+    
+    //create PR on site1
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap()  ));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap()  ));
+    
+    //create PR on site2
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap()  ));
+    
+    //start sender on site1
+    startSenderInVMs("ln", vm2, vm4, vm5);
+
+
+    //start sender on site2
+    startSenderInVMs("ny", vm3, vm6, vm7);
+
+
+    //pause senders on site1
+    vm2.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //pause senders on site2
+    vm3.invoke(() -> WANTestBase.pauseSender( "ny" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ny" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ny" ));
+    
+    //this is required since sender pause doesn't take effect immediately
+    Wait.pause(1000);
+    
+    //Do 100 puts on site1
+    vm2.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      100 ));
+    //do next 100 puts on site2
+    vm3.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR",
+      100, 200 ));
+    //verify queue size on both sites
+    vm2.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
+    
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
+    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
+    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
+    
+    //resume sender on site1
+    vm2.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+     
+    //validate events reached site2 from site1
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 200 ));
+    
+    //on site2, verify queue size again
+    //this ensures that loopback is not happening since the queue size is same as before
+    //the event coming from site1 are not enqueued again
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
+    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
+    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 100 ));
+    
+    //resume sender on site2
+    vm3.invoke(() -> WANTestBase.resumeSender( "ny" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ny" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ny" ));
+    
+    //validate region size on both the sites
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+  }
+  
+  /**
+   * Test loop back issue among 3 WAN sites with Ring topology i.e. LN -> NY -> TK -> LN
+   * Site1 (LN): vm3, vm6
+   * Site2 (NY): vm4, vm7
+   * Site3 (TK): vm5
+   */
+  @Test
+  public void testParallelPropagationLoopBack3Sites() {
+    //Create locators
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+    
+    //create cache and receivers on all the 3 sites
+    createCacheInVMs(lnPort, vm3, vm6);
+    createReceiverInVMs(vm3, vm6);
+    createCacheInVMs(nyPort, vm4, vm7);
+    createReceiverInVMs(vm4, vm7);
+    createCacheInVMs(tkPort, vm5);
+    createReceiverInVMs(vm5);
+
+
+    //create senders on all the 3 sites
+    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    
+    vm4.invoke(() -> WANTestBase.createSender( "ny", 3,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny", 3,
+      true, 100, 10, false, false, null, true ));
+    
+    vm5.invoke(() -> WANTestBase.createSender( "tk", 1,
+      true, 100, 10, false, false, null, true ));
+    
+    //create PR on the 3 sites
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 100, isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny", 0, 100, isOffHeap() ));
+    
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "tk", 0, 100, isOffHeap() ));
+    
+    //start senders on all the sites 
+    startSenderInVMs("ln", vm3, vm6);
+
+    startSenderInVMs("ny", vm4, vm7);
+
+    vm5.invoke(() -> WANTestBase.startSender( "tk" ));
+    
+    //pause senders on site1 and site3. Site2 has the sender running to pass along events
+    vm3.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    vm5.invoke(() -> WANTestBase.pauseSender( "tk" ));
+    
+    //need to have this pause since pauseSender doesn't take effect immediately
+    Wait.pause(1000);
+    
+    //do puts on site1
+    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      100 ));
+    
+    //do more puts on site3
+    vm5.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR",
+      100, 200 ));
+    
+    //verify queue size on site1 and site3
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln", 100 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 100 ));
+
+    //resume sender on site1 so that events reach site2 and from there to site3
+    vm3.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    //validate region size on site2 (should have 100) and site3 (should have 200)
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 100 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 200 ));
+    
+    //verify queue size remains same on site3 which means event loopback did not happen
+    //this means events coming from site1 are not enqueued back into the sender
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 100 ));
+    
+    //resume sender on site3
+    vm5.invoke(() -> WANTestBase.resumeSender( "tk" ));
+    
+    //validate region size
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+  }
+  
+  /**
+   * Test loop back issue among 3 WAN sites with N to N topology 
+   * i.e. each site connected to all other sites.
+   * Puts are done to only one DS.
+   * LN site: vm3, vm6
+   * NY site: vm4, vm7
+   * TK site: vm5
+   */
+  @Test
+  public void testParallelPropagationLoopBack3SitesNtoNTopologyPutFromOneDS() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(lnPort, vm3, vm6);
+    createCacheInVMs(nyPort, vm4, vm7);
+    createCacheInVMs(tkPort, vm5);
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    vm5.invoke(() -> WANTestBase.createReceiver());
+
+    //site1
+    vm3.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln1", 2,
+      true, 100, 10, false, false, null, true ));
+
+    vm3.invoke(() -> WANTestBase.createSender( "ln2", 3,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln2", 3,
+      true, 100, 10, false, false, null, true ));
+    
+    //site2
+    vm4.invoke(() -> WANTestBase.createSender( "ny1", 1,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny1", 1,
+      true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ny2", 3,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny2", 3,
+      true, 100, 10, false, false, null, true ));
+
+    //site3
+    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
+      true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "tk2", 2,
+      true, 100, 10, false, false, null, true ));
+
+    //create PR
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln1,ln2", 0, 1, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln1,ln2", 0, 1, isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny1,ny2", 0, 1, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ny1,ny2", 0, 1, isOffHeap() ));
+    
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "tk1,tk2", 0, 1, isOffHeap() ));
+
+    //start all the senders
+    vm3.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm3.invoke(() -> WANTestBase.startSender( "ln2" ));
+    vm6.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm6.invoke(() -> WANTestBase.startSender( "ln2" ));
+    
+    vm4.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm4.invoke(() -> WANTestBase.startSender( "ny2" ));
+    vm7.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm7.invoke(() -> WANTestBase.startSender( "ny2" ));
+    
+    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk2" ));
+    
+    //pause senders on all the sites
+    vm3.invoke(() -> WANTestBase.pauseSender( "ln1" ));
+    vm3.invoke(() -> WANTestBase.pauseSender( "ln2" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln1" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln2" ));
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ny1" ));
+    vm4.invoke(() -> WANTestBase.pauseSender( "ny2" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ny1" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ny2" ));
+    
+    vm5.invoke(() -> WANTestBase.pauseSender( "tk1" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "tk2" ));
+    
+    //this is required since sender pause doesn't take effect immediately
+    Wait.pause(1000);
+
+    //do puts on site1
+    vm3.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      100 ));
+    
+    //verify queue size on site1 and site3
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln1", 100 ));
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln2", 100 ));
+    
+    //resume sender (from site1 to site2) on site1
+    vm3.invoke(() -> WANTestBase.resumeSender( "ln1" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln1" ));
+
+    //validate region size on site2
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 100 ));
+
+    //verify queue size on site2 (sender 2 to 1)
+    //should remain at 0 as the events from site1 should not go back to site1
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
+    
+    //verify queue size on site2 (sender 2 to 3)
+    //should remain at 0 as events from site1 will reach site3 directly..site2 need not send to site3 again  
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
+    
+    //do more puts on site3
+    vm5.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR",
+      100, 200 ));
+    
+    //resume sender (from site3 to site2) on site3
+    vm5.invoke(() -> WANTestBase.resumeSender( "tk2" ));
+    
+    //validate region size on site2
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+    
+    //verify queue size on site2 (sender 2 to 3)
+    //should remain at 0 as the events from site3 should not go back to site3
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
+    
+    //verify queue size on site2 (sender 2 to 1)
+    //should remain at 0 as events from site3 will reach site1 directly..site2 need not send to site1 again  
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
+    
+    //resume all senders
+    vm3.invoke(() -> WANTestBase.resumeSender( "ln2" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln2" ));
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ny1" ));
+    vm4.invoke(() -> WANTestBase.resumeSender( "ny2" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ny1" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ny2" ));
+    
+    vm5.invoke(() -> WANTestBase.resumeSender( "tk1" ));
+    
+    //validate region size on all sites
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 200 ));
+  }
+  
+
+
+}



[11/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
new file mode 100644
index 0000000..5e32bb6
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialWANPersistenceEnabledGatewaySenderDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest extends
+    SerialWANPersistenceEnabledGatewaySenderDUnitTest {
+
+  public SerialWANPersistenceEnabledGatewaySenderOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java
new file mode 100644
index 0000000..d6cecd1
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagationOffHeapDUnitTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialWANPropagationDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class SerialWANPropagationOffHeapDUnitTest extends SerialWANPropagationDUnitTest {
+
+  public SerialWANPropagationOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java
new file mode 100644
index 0000000..4abd6e6
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialWANPropagation_PartitionedRegionOffHeapDUnitTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialWANPropagation_PartitionedRegionDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class SerialWANPropagation_PartitionedRegionOffHeapDUnitTest
+  extends SerialWANPropagation_PartitionedRegionDUnitTest {
+
+  public SerialWANPropagation_PartitionedRegionOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java
new file mode 100644
index 0000000..e0f29db
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperation_2_DUnitTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.concurrent.ConcurrentParallelGatewaySenderOperation_2_DUnitTest;
+import com.gemstone.gemfire.test.dunit.VM;
+
+@Category(DistributedTest.class)
+public class ParallelGatewaySenderOperation_2_DUnitTest extends ConcurrentParallelGatewaySenderOperation_2_DUnitTest {
+
+  private static final long serialVersionUID = 1L;
+
+  public ParallelGatewaySenderOperation_2_DUnitTest() {
+    super();
+  }
+
+  protected void createSender(VM vm, int concurrencyLevel, boolean manualStart) {
+    vm.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, manualStart));
+  }
+
+  protected void createSenders(VM vm, int concurrencyLevel) {
+    vm.invoke(() -> createSender("ln1", 2, true, 100, 10, false, false, null, true));
+    vm.invoke(() -> createSender("ln2", 3, true, 100, 10, false, false, null, true));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java
new file mode 100644
index 0000000..4981c97
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java
@@ -0,0 +1,692 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.GemFireIOException;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
+import com.gemstone.gemfire.internal.cache.tier.sockets.MessageTooLargeException;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.RMIException;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+/**
+ * DUnit test for operations on ParallelGatewaySender
+ */
+@Category(DistributedTest.class)
+public class ParallelGatewaySenderOperationsDUnitTest extends WANTestBase {
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe||Unexpected IOException");
+  }
+  
+  @Test
+  public void testParallelGatewaySenderWithoutStarting() {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, false);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    vm5.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    vm6.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    vm7.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    
+    validateRegionSizes(getTestMethodName() + "_PR", 0, vm2, vm3);
+  }
+  
+  /**
+   * Defect 44323 (ParallelGatewaySender should not be started on Accessor node)
+   */
+  @Test
+  public void testParallelGatewaySenderStartOnAccessorNode() {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, true, true);
+
+    Wait.pause(2000);
+    
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10 ));
+
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    validateRegionSizes(getTestMethodName() + "_PR", 10, vm2, vm3);
+  }
+
+  /**
+   * Normal scenario in which the sender is paused in between.
+   */
+  @Test
+  public void testParallelPropagationSenderPause() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    //make sure all the senders are running before doing any puts
+    waitForSendersRunning();
+    
+    //FIRST RUN: now, the senders are started. So, start the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+    
+    //now, pause all of the senders
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //SECOND RUN: keep one thread doing puts to the region
+    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //verify region size remains on remote vm and is restricted below a specified limit (i.e. number of puts in the first run)
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
+  }
+
+  /**
+   * Normal scenario in which a paused sender is resumed.
+   */
+  @Test
+  public void testParallelPropagationSenderResume() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    //make sure all the senders are running before doing any puts
+    waitForSendersRunning();
+    
+    //now, the senders are started. So, start the puts
+    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //now, pause all of the senders
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //sleep for a second or two
+    Wait.pause(2000);
+    
+    //resume the senders
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    Wait.pause(2000);
+
+    validateParallelSenderQueueAllBucketsDrained();
+    
+    //find the region size on remote vm
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+  }
+
+  /**
+   * Negative scenario in which a sender that is stopped (and not paused) is resumed.
+   * Expected: resume is only valid for pause. If a sender which is stopped is resumed,
+   * it will not be started again.
+   */
+  @Test
+  public void testParallelPropagationSenderResumeNegativeScenario() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    //wait till the senders are running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    //start the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+
+    //let the queue drain completely
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
+    
+    //stop the senders
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    //now, try to resume a stopped sender
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    //do more puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //validate region size on remote vm to contain only the events put in local site 
+    //before the senders are stopped.
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 100 ));
+  }
+
+  /**
+   * Normal scenario in which a sender is stopped.
+   */
+  @Test
+  public void testParallelPropagationSenderStop() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    //make sure all the senders are running before doing any puts
+    waitForSendersRunning();
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+    
+    //now, stop all of the senders
+    stopSenders();
+    
+    //SECOND RUN: keep one thread doing puts
+    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //verify region size remains on remote vm and is restricted below a specified limit (number of puts in the first run)
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
+  }
+
+  /**
+   * Normal scenario in which a sender is stopped and then started again.
+   */
+  @Test
+  public void testParallelPropagationSenderStartAfterStop() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+    String regionName = getTestMethodName() + "_PR";
+
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    vm3.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+
+    createReceiverInVMs(vm2, vm3);
+
+    vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    vm6.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    vm7.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+
+    vm4.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+    vm5.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+    vm6.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+    vm7.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> waitForSenderRunningState("ln"));
+    vm5.invoke(() -> waitForSenderRunningState("ln"));
+    vm6.invoke(() -> waitForSenderRunningState("ln"));
+    vm7.invoke(() -> waitForSenderRunningState("ln"));
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( regionName, 200 ));
+    
+    //now, stop all of the senders
+    vm4.invoke(() -> stopSender("ln"));
+    vm5.invoke(() -> stopSender("ln"));
+    vm6.invoke(() -> stopSender("ln"));
+    vm7.invoke(() -> stopSender("ln"));
+
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 ));
+
+    //SECOND RUN: do some of the puts after the senders are stopped
+    vm4.invoke(() -> WANTestBase.doPuts( regionName, 1000 ));
+    
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 ));
+    
+    //start the senders again
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> waitForSenderRunningState("ln"));
+    vm5.invoke(() -> waitForSenderRunningState("ln"));
+    vm6.invoke(() -> waitForSenderRunningState("ln"));
+    vm7.invoke(() -> waitForSenderRunningState("ln"));
+
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 ));
+
+    //SECOND RUN: do some more puts
+    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( regionName, 1000 ));
+    async.join();
+    
+    //verify all the buckets on all the sender nodes are drained
+    validateParallelSenderQueueAllBucketsDrained();
+    
+    //verify the events propagate to remote site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(regionName, 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm6.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm7.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+  }
+
+  /**
+   * Normal scenario in which a sender is stopped and then started again.
+   * Differs from above test case in the way that when the sender is starting from
+   * stopped state, puts are simultaneously happening on the region by another thread.
+   */
+  @Test
+  public void testParallelPropagationSenderStartAfterStop_Scenario2() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    //make sure all the senders are running before doing any puts
+    waitForSendersRunning();
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now started");
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
+    
+    LogWriterUtils.getLogWriter().info("Done few puts");
+
+    //Make sure the puts make it to the remote side
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
+
+    //now, stop all of the senders
+    stopSenders();
+    
+    LogWriterUtils.getLogWriter().info("All the senders are stopped");
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 200, 120000));
+    
+    //SECOND RUN: do some of the puts after the senders are stopped
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Done some more puts in second run");
+    
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+    
+    //SECOND RUN: start async puts on region
+    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
+    LogWriterUtils.getLogWriter().info("Started high number of puts by async thread");
+
+    LogWriterUtils.getLogWriter().info("Starting the senders at the same time");
+    //when puts are happening by another thread, start the senders
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("All the senders are started");
+    
+    async.join();
+
+    //verify all the buckets on all the sender nodes are drained
+    validateParallelSenderQueueAllBucketsDrained();
+    
+    //verify that the queue size ultimately becomes zero. That means all the events propagate to remote site.
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
+  }
+  
+  /**
+   * Normal scenario in which a sender is stopped and then started again on accessor node.
+   */
+  @Test
+  public void testParallelPropagationSenderStartAfterStopOnAccessorNode() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, true, true);
+
+    //make sure all the senders are not running on accessor nodes and running on non-accessor nodes
+    waitForSendersRunning();
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
+    
+    //now, stop all of the senders
+    stopSenders();
+    
+    Wait.pause(2000);
+    
+    //SECOND RUN: do some of the puts after the senders are stopped
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+    
+    //start the senders again
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+
+    //SECOND RUN: do some more puts
+    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    async.join();
+    Wait.pause(5000);
+    
+    //verify all buckets drained only on non-accessor nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    //verify the events propagate to remote site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+  }
+
+  /**
+   * Normal scenario in which a combinations of start, pause, resume operations
+   * is tested
+   */
+  @Test
+  public void testStartPauseResumeParallelGatewaySender() throws Exception {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Done 1000 puts on local site");
+    
+    //Since puts are already done on userPR, it will have the buckets created. 
+    //During sender start, it will wait until those buckets are created for shadowPR as well.
+    //Start the senders in async threads, so colocation of shadowPR will be complete and 
+    //missing buckets will be created in PRHARedundancyProvider.createMissingBuckets().
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    waitForSendersRunning();
+    
+    LogWriterUtils.getLogWriter().info("Started senders on local site");
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
+    LogWriterUtils.getLogWriter().info("Done 5000 puts on local site");
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Paused senders on local site");
+    
+    vm4.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    vm5.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    vm6.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    vm7.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Started 1000 async puts on local site");
+
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Resumed senders on local site");
+
+    vm4.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+    vm5.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+    vm6.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+    vm7.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      fail("Interrupted the async invocation.", e);
+    }
+    
+    //verify all buckets drained on all sender nodes.
+    validateParallelSenderQueueAllBucketsDrained();
+
+    validateRegionSizes(getTestMethodName() + "_PR", 5000, vm2, vm3);
+  }
+
+  /**
+   * Since the sender is attached to a region and in use, it can not be
+   * destroyed. Hence, exception is thrown by the sender API.
+   */
+  @Test
+  public void testDestroyParallelGatewaySenderExceptionScenario() {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    // make sure all the senders are running before doing any puts
+    waitForSendersRunning();
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    // try destroying on couple of nodes
+    try {
+      vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
+    }
+    catch (RMIException e) {
+      assertTrue("Cause of the exception should be GatewaySenderException", e
+          .getCause() instanceof GatewaySenderException);
+    }
+    try {
+      vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
+    }
+    catch (RMIException e) {
+      assertTrue("Cause of the exception should be GatewaySenderException", e
+          .getCause() instanceof GatewaySenderException);
+    }
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testDestroyParallelGatewaySender() {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true);
+
+    // make sure all the senders are running
+    waitForSendersRunning();
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    Wait.pause(2000);
+    
+    //stop the sender and remove from region before calling destroy on it
+    stopSenders();
+
+    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion(
+        "ln", getTestMethodName() + "_PR" ));
+    vm5.invoke(() -> WANTestBase.removeSenderFromTheRegion(
+        "ln", getTestMethodName() + "_PR" ));
+    vm6.invoke(() -> WANTestBase.removeSenderFromTheRegion(
+        "ln", getTestMethodName() + "_PR" ));
+    vm7.invoke(() -> WANTestBase.removeSenderFromTheRegion(
+        "ln", getTestMethodName() + "_PR" ));
+
+    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
+    vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
+    vm6.invoke(() -> WANTestBase.destroySender( "ln" ));
+    vm7.invoke(() -> WANTestBase.destroySender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
+    vm5.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
+    vm6.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
+    vm7.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", true ));
+  }
+
+  @Test
+  public void testParallelGatewaySenderMessageTooLargeException() {
+    Integer[] locatorPorts = createLNAndNYLocators();
+    Integer lnPort = locatorPorts[0];
+    Integer nyPort = locatorPorts[1];
+
+    // Create and start sender with reduced maximum message size and 1 dispatcher thread
+    String regionName = getTestMethodName() + "_PR";
+    vm4.invoke(() -> setMaximumMessageSize( 1024*1024 ));
+    vm4.invoke(() -> createCache( lnPort ));
+    vm4.invoke(() -> setNumDispatcherThreadsForTheRun( 1 ));
+    vm4.invoke(() -> createSender( "ln", 2, true, 100, 100, false, false, null, false ));
+    vm4.invoke(() -> createPartitionedRegion( regionName, "ln", 0, 100, isOffHeap() ));
+
+    // Do puts
+    int numPuts = 200;
+    vm4.invoke(() -> doPuts( regionName, numPuts, new byte[11000] ));
+    validateRegionSizes(regionName, numPuts, vm4);
+
+    // Start receiver
+    IgnoredException ignoredMTLE = IgnoredException.addIgnoredException(MessageTooLargeException.class.getName(), vm4);
+    IgnoredException ignoredGIOE = IgnoredException.addIgnoredException(GemFireIOException.class.getName(), vm4);
+    vm2.invoke(() -> createCache( nyPort ));
+    vm2.invoke(() -> createPartitionedRegion( regionName, null, 0, 100, isOffHeap() ));
+    vm2.invoke(() -> createReceiver());
+    validateRegionSizes( regionName, numPuts, vm2 );
+
+    vm4.invoke(() -> {
+      final AbstractGatewaySender sender = (AbstractGatewaySender) cache.getGatewaySender("ln");
+      assertTrue(sender.getStatistics().getBatchesResized() > 0);
+    });
+    ignoredMTLE.remove();
+    ignoredGIOE.remove();
+  }
+
+  private void setMaximumMessageSize(int maximumMessageSizeBytes) {
+    Message.MAX_MESSAGE_SIZE = maximumMessageSizeBytes;
+    LogWriterUtils.getLogWriter()
+        .info("Set gemfire.client.max-message-size: " + System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "client.max-message-size"));
+  }
+
+  private void createSendersReceiversAndPartitionedRegion(Integer lnPort, Integer nyPort, boolean createAccessors,
+      boolean startSenders) {
+    // Note: This is a test-specific method used by several test to create
+    // receivers, senders and partitioned regions.
+    createSendersAndReceivers(lnPort, nyPort);
+
+    createPartitionedRegions(createAccessors);
+
+    if (startSenders) {
+      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    }
+  }
+
+  private void createSendersAndReceivers(Integer lnPort, Integer nyPort) {
+    // Note: This is a test-specific method used by several test to create
+    // receivers and senders.
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+    vm5.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+    vm6.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+    vm7.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true));
+  }
+
+  private void createPartitionedRegions(boolean createAccessors) {
+    // Note: This is a test-specific method used by several test to create
+    // partitioned regions.
+    String regionName = getTestMethodName() + "_PR";
+    vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+
+    if (createAccessors) {
+      vm6.invoke(() -> createPartitionedRegionAsAccessor(regionName, "ln", 1, 100));
+      vm7.invoke(() -> createPartitionedRegionAsAccessor(regionName, "ln", 1, 100));
+    } else {
+      vm6.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+      vm7.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    }
+
+    vm2.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+    vm3.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap()));
+  }
+
+  private void stopSenders() {
+    vm4.invoke(() -> stopSender("ln"));
+    vm5.invoke(() -> stopSender("ln"));
+    vm6.invoke(() -> stopSender("ln"));
+    vm7.invoke(() -> stopSender("ln"));
+  }
+
+  private void waitForSendersRunning() {
+    vm4.invoke(() -> waitForSenderRunningState("ln"));
+    vm5.invoke(() -> waitForSenderRunningState("ln"));
+    vm6.invoke(() -> waitForSenderRunningState("ln"));
+    vm7.invoke(() -> waitForSenderRunningState("ln"));
+  }
+
+  private void validateParallelSenderQueueAllBucketsDrained() {
+    vm4.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java
new file mode 100644
index 0000000..a248520
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueueOverflowDUnitTest.java
@@ -0,0 +1,500 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+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.junit.categories.DistributedTest;
+import com.jayway.awaitility.Awaitility;
+
+/**
+ * DUnit for ParallelSenderQueue overflow operations.
+ */
+@Category(DistributedTest.class)
+public class ParallelGatewaySenderQueueOverflowDUnitTest extends WANTestBase {
+
+  @Test
+  public void testParallelSenderQueueEventsOverflow_NoDiskStoreSpecified() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
+    vm5.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
+    vm6.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
+    vm7.invoke(() -> WANTestBase.createSenderWithoutDiskStore( "ln", 2, 10, 10, false, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //give some time for the senders to pause
+    Wait.pause(1000);
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    int numEventPuts = 50;
+    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
+    
+    
+    //considering a memory limit of 40 MB, maximum of 40 events can be in memory. Rest should be on disk.
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(()-> 
+    {
+      long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+      long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+      long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+      long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+      
+      long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+      long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+      long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+      long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+      
+      LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
+      LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
+      long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
+      assertTrue("Total number of entries overflown to disk should be at least greater than 55", (totalOverflown > 55));
+
+      long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
+      //expected is twice the number of events put due to redundancy level of 1  
+      assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
+      
+    });
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50, 240000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50, 240000 ));
+  }
+  
+  /**
+   * Keep same max memory limit for all the VMs
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void testParallelSenderQueueEventsOverflow() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //give some time for the senders to pause
+    Wait.pause(1000);
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    int numEventPuts = 50;
+    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
+    
+    long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    
+    long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
+    LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
+    
+    long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
+    //considering a memory limit of 40 MB, maximum of 40 events can be in memory. Rest should be on disk.
+    assertTrue("Total number of entries overflown to disk should be at least greater than 55", (totalOverflown > 55));
+    
+    long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
+    //expected is twice the number of events put due to redundancy level of 1  
+    assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
+  }
+
+  /**
+   * Set a different memory limit for each VM and make sure that all the VMs are utilized to
+   * full extent of available memory.
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void testParallelSenderQueueEventsOverflow_2() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 5, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 5, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 20, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //give some time for the senders to pause
+    Wait.pause(1000);
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    int numEventPuts = 50;
+    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
+    
+    long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    
+    long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
+    LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
+    
+    long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
+    //considering a memory limit of 40 MB, maximum of 40 events can be in memory. Rest should be on disk.
+    assertTrue("Total number of entries overflown to disk should be at least greater than 55", (totalOverflown > 55));
+    
+    long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
+    //expected is twice the number of events put due to redundancy level of 1  
+    assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
+    
+    //assert the numbers for each VM
+    assertTrue("Number of entries in memory VM4 is incorrect. Should be less than 10", (numMemVm4 < 10));
+    assertTrue("Number of entries in memory VM5 is incorrect. Should be less than 5", (numMemVm5 < 5));
+    assertTrue("Number of entries in memory VM6 is incorrect. Should be less than 5", (numMemVm6 < 5));
+    assertTrue("Number of entries in memory VM7 is incorrect. Should be less than 20", (numMemVm7 < 20));
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 50 ));
+  }
+
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void testParallelSenderQueueNoEventsOverflow() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 10, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //give some time for the senders to pause
+    Wait.pause(1000);
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    int numEventPuts = 15;
+    vm4.invoke(() -> WANTestBase.doHeavyPuts( getTestMethodName(), numEventPuts ));
+    
+    long numOvVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    long numOvVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesOverflownToDisk( "ln" ));
+    
+    long numMemVm4 = (Long) vm4.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm5 = (Long) vm5.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm6 = (Long) vm6.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    long numMemVm7 = (Long) vm7.invoke(() -> WANTestBase.getNumberOfEntriesInVM( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("Entries overflown to disk: " + numOvVm4 + "," + numOvVm5 + "," + numOvVm6 + "," + numOvVm7);
+    LogWriterUtils.getLogWriter().info("Entries in VM: " + numMemVm4 + "," + numMemVm5 + "," + numMemVm6 + "," + numMemVm7);
+    
+    long totalOverflown = numOvVm4 + numOvVm5 + numOvVm6 + numOvVm7; 
+    //all 30 (considering redundant copies) events should accommodate in 40 MB space given to 4 senders
+    assertEquals("Total number of entries overflown to disk is incorrect", 0, totalOverflown);
+    
+    long totalInMemory = numMemVm4 + numMemVm5 + numMemVm6 + numMemVm7;
+    //expected is twice the number of events put due to redundancy level of 1  
+    assertEquals("Total number of entries on disk and in VM is incorrect", (numEventPuts*2), (totalOverflown + totalInMemory));
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 15 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 15 ));
+  }
+  
+  /**
+   * Test to validate that ParallelGatewaySenderQueue diskSynchronous attribute
+   * when persistence of sender is enabled. 
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void test_ValidateParallelGatewaySenderQueueAttributes_1() {
+    Integer localLocPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    
+    Integer remoteLocPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
+    
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);  
+
+    File directory = new File("TKSender" + "_disk_"
+        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    directory.mkdir();
+    File[] dirs1 = new File[] { directory };
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    dsf.setDiskDirs(dirs1);
+    DiskStore diskStore = dsf.create("FORNY");
+    
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setParallel(true);//set parallel to true
+    fact.setBatchConflationEnabled(true);
+    fact.setBatchSize(200);
+    fact.setBatchTimeInterval(300);
+    fact.setPersistenceEnabled(true);//enable the persistence
+    fact.setDiskSynchronous(true);
+    fact.setDiskStoreName("FORNY");
+    fact.setMaximumQueueMemory(200);
+    fact.setAlertThreshold(1200);
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    fact.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    final IgnoredException exTKSender = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      GatewaySender sender1 = fact.create("TKSender", 2);
+
+      AttributesFactory factory = new AttributesFactory();
+      factory.addGatewaySenderId(sender1.getId());
+      factory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+      Region region = cache.createRegionFactory(factory.create()).create(
+          "test_ValidateGatewaySenderAttributes");
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      assertEquals(senders.size(), 1);
+      GatewaySender gatewaySender = senders.iterator().next();
+      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
+          .getQueues();
+      assertEquals(regionQueues.size(), 1);
+      RegionQueue regionQueue = regionQueues.iterator().next();
+      assertEquals(true, regionQueue.getRegion().getAttributes()
+          .isDiskSynchronous());
+    } finally {
+      exTKSender.remove();
+    }
+  }
+  
+  /**
+   * Test to validate that ParallelGatewaySenderQueue diskSynchronous attribute
+   * when persistence of sender is not enabled. 
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void test_ValidateParallelGatewaySenderQueueAttributes_2() {
+    Integer localLocPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    
+    Integer remoteLocPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
+    
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);  
+
+    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
+    fact.setParallel(true);//set parallel to true
+    fact.setBatchConflationEnabled(true);
+    fact.setBatchSize(200);
+    fact.setBatchTimeInterval(300);
+    fact.setPersistenceEnabled(false);//set persistence to false
+    fact.setDiskSynchronous(true);
+    fact.setMaximumQueueMemory(200);
+    fact.setAlertThreshold(1200);
+    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
+    fact.addGatewayEventFilter(myEventFilter1);
+    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
+    fact.addGatewayTransportFilter(myStreamFilter1);
+    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
+    fact.addGatewayTransportFilter(myStreamFilter2);
+    final IgnoredException ex = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      GatewaySender sender1 = fact.create("TKSender", 2);
+      AttributesFactory factory = new AttributesFactory();
+      factory.addGatewaySenderId(sender1.getId());
+      factory.setDataPolicy(DataPolicy.PARTITION);
+      Region region = cache.createRegionFactory(factory.create()).create(
+          "test_ValidateGatewaySenderAttributes");
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      assertEquals(senders.size(), 1);
+      GatewaySender gatewaySender = senders.iterator().next();
+      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
+          .getQueues();
+      assertEquals(regionQueues.size(), 1);
+      RegionQueue regionQueue = regionQueues.iterator().next();
+      assertEquals(false, regionQueue.getRegion().getAttributes()
+          .isDiskSynchronous());
+    } finally {
+      ex.remove();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
new file mode 100644
index 0000000..87a74b9
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANConflationDUnitTest.java
@@ -0,0 +1,497 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+
+/**
+ * 
+ */
+@Category(DistributedTest.class)
+public class ParallelWANConflationDUnitTest extends WANTestBase {
+  private static final long serialVersionUID = 1L;
+
+  public ParallelWANConflationDUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("java.net.ConnectException");
+  }
+
+  @Test
+  public void testParallelPropagationConflationDisabled() throws Exception {
+    initialSetUp();
+
+    createSendersNoConflation();
+
+    createSenderPRs();
+
+    startPausedSenders();
+
+    createReceiverPrs();
+
+    final Map keyValues = putKeyValues();
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() ));
+    
+    final Map updateKeyValues = updateKeyValues();
+
+    vm4.invoke(() ->checkQueueSize( "ln", (keyValues.size() + updateKeyValues.size()) ));
+
+    vm2.invoke(() ->validateRegionSize(
+        getTestMethodName(), 0 ));
+
+    resumeSenders();
+
+    keyValues.putAll(updateKeyValues);
+    validateReceiverRegionSize(keyValues);
+    
+  }
+
+  /**
+   * This test is disabled as it is not guaranteed to pass it everytime. This
+   * test is related to the conflation in batch. yet did find any way to
+   * ascertain that the vents in the batch will always be conflated.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationBatchConflation() throws Exception {
+    initialSetUp();
+    
+    vm4.invoke(() ->createSender( "ln", 2,
+        true, 100, 50, false, false, null, true ));
+    vm5.invoke(() ->createSender( "ln", 2,
+      true, 100, 50, false, false, null, true ));
+    vm6.invoke(() ->createSender( "ln", 2,
+      true, 100, 50, false, false, null, true ));
+    vm7.invoke(() ->createSender( "ln", 2,
+    true, 100, 50, false, false, null, true ));
+  
+    createSenderPRs();
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    pauseSenders();
+    
+    createReceiverPrs();
+
+    final Map keyValues = new HashMap();
+    
+    for (int i = 1; i <= 10; i++) {
+      for (int j = 1; j <= 10; j++) {
+        keyValues.put(j, i) ;
+      }
+      vm4.invoke(() ->putGivenKeyValue(
+        getTestMethodName(), keyValues ));
+    }
+    
+    vm4.invoke(() ->enableConflation( "ln" ));
+    vm5.invoke(() ->enableConflation( "ln" ));
+    vm6.invoke(() ->enableConflation( "ln" ));
+    vm7.invoke(() ->enableConflation( "ln" ));
+    
+    resumeSenders();
+    
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> 
+        WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> 
+        WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> 
+        WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> 
+        WANTestBase.getSenderStats( "ln", 0 ));
+    
+    assertTrue("No events conflated in batch", (v4List.get(8) + v5List.get(8) + v6List.get(8) + v7List.get(8)) > 0);
+    
+    vm2.invoke(() ->validateRegionSize(
+      getTestMethodName(), 10 ));
+
+  }
+  
+  @Test
+  public void testParallelPropagationConflation() throws Exception {
+    doTestParallelPropagationConflation(0);
+  }
+  
+  @Test
+  public void testParallelPropagationConflationRedundancy2() throws Exception {
+    doTestParallelPropagationConflation(2);
+  }
+  
+  public void doTestParallelPropagationConflation(int redundancy) throws Exception {
+    initialSetUp();
+
+    createSendersWithConflation();
+
+    createSenderPRs(redundancy);
+
+    startPausedSenders();
+
+    createReceiverPrs();
+
+    final Map keyValues = putKeyValues();
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() ));
+    final Map updateKeyValues = updateKeyValues();
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() )); // creates aren't conflated
+    
+    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() )); // creates aren't conflated
+
+    vm2.invoke(() ->validateRegionSize(
+        getTestMethodName(), 0 ));
+
+    resumeSenders();
+
+    keyValues.putAll(updateKeyValues);
+    validateReceiverRegionSize(keyValues);
+  }
+  
+  @Test
+  public void testParallelPropagationConflationOfRandomKeys() throws Exception {
+    initialSetUp();
+
+    createSendersWithConflation();
+
+    createSenderPRs();
+
+    startPausedSenders();
+
+    createReceiverPrs();
+
+    final Map keyValues = putKeyValues();
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() ));
+    
+    final Map updateKeyValues = new HashMap();
+    while(updateKeyValues.size()!=10) {
+      int key = (new Random()).nextInt(keyValues.size());
+      updateKeyValues.put(key, key+"_updated");
+    }
+    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() ));
+
+    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
+
+    vm4.invoke(() ->checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() ));
+
+    vm2.invoke(() ->validateRegionSize(
+        getTestMethodName(), 0 ));
+
+    resumeSenders();
+
+    
+    keyValues.putAll(updateKeyValues);
+    validateReceiverRegionSize(keyValues);
+    
+  }
+  
+  @Test
+  public void testParallelPropagationColocatedRegionConflation()
+      throws Exception {
+    initialSetUp();
+
+    createSendersWithConflation();
+
+    createOrderShipmentOnSenders();
+
+    startPausedSenders();
+
+    createOrderShipmentOnReceivers();
+
+    Map custKeyValues = (Map)vm4.invoke(() ->putCustomerPartitionedRegion( 20 ));
+    Map orderKeyValues = (Map)vm4.invoke(() ->putOrderPartitionedRegion( 20 ));
+    Map shipmentKeyValues = (Map)vm4.invoke(() ->putShipmentPartitionedRegion( 20 ));
+
+    vm4.invoke(() -> 
+        WANTestBase.checkQueueSize(
+            "ln",
+            (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
+                .size()) ));
+
+    Map updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
+    Map updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegion( 10 ));
+    Map updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegion( 10 ));
+    int sum = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
+        .size())
+        + updatedCustKeyValues.size()
+        + updatedOrderKeyValues.size()
+        + updatedShipmentKeyValues.size();
+    vm4.invoke(() -> 
+        WANTestBase.checkQueueSize(
+            "ln",
+            sum));
+
+    
+    updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
+    updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegion( 10 ));
+    updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegion( 10 ));
+    int sum2 = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
+        .size())
+        + updatedCustKeyValues.size()
+        + updatedOrderKeyValues.size()
+        + updatedShipmentKeyValues.size();
+    vm4.invoke(() -> 
+        WANTestBase.checkQueueSize(
+            "ln",
+            sum2));
+
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.customerRegionName, 0 ));
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.orderRegionName, 0 ));
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.shipmentRegionName, 0 ));
+
+    resumeSenders();
+    
+    custKeyValues.putAll(updatedCustKeyValues);
+    orderKeyValues.putAll(updatedOrderKeyValues);
+    shipmentKeyValues.putAll(updatedShipmentKeyValues);
+    
+    validateColocatedRegionContents(custKeyValues, orderKeyValues,
+        shipmentKeyValues);
+    
+  }
+  
+  //
+  //This is the same as the previous test, except for the UsingCustId methods
+  @Test
+  public void testParallelPropagationColocatedRegionConflationSameKey()
+      throws Exception {
+    initialSetUp();
+
+    createSendersWithConflation();
+
+    createOrderShipmentOnSenders();
+
+    startPausedSenders();
+
+    createOrderShipmentOnReceivers();
+
+    Map custKeyValues = (Map)vm4.invoke(() ->putCustomerPartitionedRegion( 20 ));
+    Map orderKeyValues = (Map)vm4.invoke(() ->putOrderPartitionedRegionUsingCustId( 20 ));
+    Map shipmentKeyValues = (Map)vm4.invoke(() ->putShipmentPartitionedRegionUsingCustId( 20 ));
+
+    vm4.invoke(() ->checkQueueSize( "ln", (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
+      .size()) ));
+
+    Map updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
+    Map updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegionUsingCustId( 10 ));
+    Map updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegionUsingCustId( 10 ));
+    int sum = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
+        .size()) + updatedCustKeyValues.size() + updatedOrderKeyValues.size() + updatedShipmentKeyValues.size() ;
+
+    vm4.invoke(() ->checkQueueSize( "ln", sum));
+
+    updatedCustKeyValues = (Map)vm4.invoke(() ->updateCustomerPartitionedRegion( 10 ));
+    updatedOrderKeyValues = (Map)vm4.invoke(() ->updateOrderPartitionedRegionUsingCustId( 10 ));
+    updatedShipmentKeyValues = (Map)vm4.invoke(() ->updateShipmentPartitionedRegionUsingCustId( 10 ));
+
+    int sum2 = (custKeyValues.size() + orderKeyValues.size() + shipmentKeyValues
+        .size()) + updatedCustKeyValues.size() + updatedOrderKeyValues.size() + updatedShipmentKeyValues.size();
+    vm4.invoke(() ->checkQueueSize( "ln", sum2));
+
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.customerRegionName, 0 ));
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.orderRegionName, 0 ));
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.shipmentRegionName, 0 ));
+
+    resumeSenders();
+
+    custKeyValues.putAll(updatedCustKeyValues);
+    orderKeyValues.putAll(updatedOrderKeyValues);
+    shipmentKeyValues.putAll(updatedShipmentKeyValues);
+    
+    validateColocatedRegionContents(custKeyValues, orderKeyValues,
+        shipmentKeyValues);
+  }
+  
+  protected void validateColocatedRegionContents(Map custKeyValues,
+      Map orderKeyValues, Map shipmentKeyValues) {
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.customerRegionName, custKeyValues.size() ));
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.orderRegionName, orderKeyValues.size() ));
+    vm2.invoke(() ->validateRegionSize(
+        WANTestBase.shipmentRegionName, shipmentKeyValues.size() ));
+
+    vm2.invoke(() ->validateRegionContents(
+        WANTestBase.customerRegionName, custKeyValues ));
+    vm2.invoke(() ->validateRegionContents(
+        WANTestBase.orderRegionName, orderKeyValues ));
+    vm2.invoke(() ->validateRegionContents(
+        WANTestBase.shipmentRegionName, shipmentKeyValues ));
+    
+    vm3.invoke(() ->validateRegionSize(
+        WANTestBase.customerRegionName, custKeyValues.size() ));
+    vm3.invoke(() ->validateRegionSize(
+        WANTestBase.orderRegionName, orderKeyValues.size() ));
+    vm3.invoke(() ->validateRegionSize(
+        WANTestBase.shipmentRegionName, shipmentKeyValues.size() ));
+
+    vm3.invoke(() ->validateRegionContents(
+        WANTestBase.customerRegionName, custKeyValues ));
+    vm3.invoke(() ->validateRegionContents(
+        WANTestBase.orderRegionName, orderKeyValues ));
+    vm3.invoke(() ->validateRegionContents(
+        WANTestBase.shipmentRegionName, shipmentKeyValues ));
+  }
+
+  protected void createOrderShipmentOnReceivers() {
+    vm2.invoke(() ->createCustomerOrderShipmentPartitionedRegion(null, 1, 8, isOffHeap() ));
+    vm3.invoke(() ->createCustomerOrderShipmentPartitionedRegion(null, 1, 8, isOffHeap() ));
+  }
+
+  protected void createOrderShipmentOnSenders() {
+    vm4.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
+    vm5.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
+    vm6.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
+    vm7.invoke(() ->createCustomerOrderShipmentPartitionedRegion("ln", 0, 8, isOffHeap() ));
+  }
+  
+  protected Map updateKeyValues() {
+    final Map updateKeyValues = new HashMap();
+    for(int i=0;i<10;i++) {
+      updateKeyValues.put(i, i+"_updated");
+    }
+    
+    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), updateKeyValues ));
+    return updateKeyValues;
+  }
+
+  protected Map putKeyValues() {
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 20; i++) {
+      keyValues.put(i, i);
+    }
+    
+    
+    vm4.invoke(() ->putGivenKeyValue( getTestMethodName(), keyValues ));
+    return keyValues;
+  }
+
+  protected void validateReceiverRegionSize(final Map keyValues) {
+    vm2.invoke(() ->validateRegionSize(
+        getTestMethodName(), keyValues.size() ));
+    vm3.invoke(() ->validateRegionSize(
+      getTestMethodName(), keyValues.size() ));
+    
+    vm2.invoke(() ->validateRegionContents(
+        getTestMethodName(), keyValues ));
+    vm3.invoke(() ->validateRegionContents(
+        getTestMethodName(), keyValues ));
+  }
+
+  protected void resumeSenders() {
+    vm4.invoke(() ->resumeSender( "ln" ));
+    vm5.invoke(() ->resumeSender( "ln" ));
+    vm6.invoke(() ->resumeSender( "ln" ));
+    vm7.invoke(() ->resumeSender( "ln" ));
+  }
+
+  protected void createReceiverPrs() {
+    vm2.invoke(() ->createPartitionedRegion(
+        getTestMethodName(), null, 1, 8, isOffHeap() ));
+    vm3.invoke(() ->createPartitionedRegion(
+        getTestMethodName(), null, 1, 8, isOffHeap() ));
+  }
+
+  protected void startPausedSenders() {
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    pauseSenders();
+  }
+
+  protected void pauseSenders() {
+    vm4.invoke(() ->pauseSender( "ln" ));
+    vm5.invoke(() ->pauseSender( "ln" ));
+    vm6.invoke(() ->pauseSender( "ln" ));
+    vm7.invoke(() ->pauseSender( "ln" ));
+  }
+  
+  protected void createSenderPRs() {
+    createSenderPRs(0);
+  }
+
+  protected void createSenderPRs(int redundancy) {
+    vm4.invoke(() ->createPartitionedRegion(
+        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
+    vm5.invoke(() ->createPartitionedRegion(
+        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
+    vm6.invoke(() ->createPartitionedRegion(
+        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
+    vm7.invoke(() ->createPartitionedRegion(
+        getTestMethodName(), "ln", redundancy, 8, isOffHeap() ));
+  }
+
+  protected void initialSetUp() {
+    Integer lnPort = (Integer)vm0.invoke(() ->createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() ->createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+  }
+  
+  protected void createSendersNoConflation() {
+    vm4.invoke(() ->createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() ->createSender( "ln", 2,
+        true, 100, 10, false, false, null, true  ));
+    vm6.invoke(() ->createSender( "ln", 2,
+        true, 100, 10, false, false, null, true  ));
+    vm7.invoke(() ->createSender( "ln", 2,
+        true, 100, 10, false, false, null, true  ));
+  }
+  
+  protected void createSendersWithConflation() {
+    vm4.invoke(() ->createSender( "ln", 2,
+        true, 100, 2, true, false, null, true ));
+    vm5.invoke(() ->createSender( "ln", 2,
+        true, 100, 2, true, false, null, true ));
+    vm6.invoke(() ->createSender( "ln", 2,
+        true, 100, 2, true, false, null, true ));
+    vm7.invoke(() ->createSender( "ln", 2,
+        true, 100, 2, true, false, null, true ));
+  }
+  
+}


[24/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
deleted file mode 100644
index 9b0953e..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-
-/**
- * DUnit tests for 'create gateway-receiver' command.
- */
-@Category(DistributedTest.class)
-public class WanCommandCreateGatewayReceiverDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * GatewayReceiver with all default attributes
-   */
-  @Test
-  public void testCreateGatewayReceiverWithDefault() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER;
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());//expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START,
-            GatewayReceiver.DEFAULT_START_PORT,
-            GatewayReceiver.DEFAULT_END_PORT,
-            GatewayReceiver.DEFAULT_BIND_ADDRESS,
-            GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
-            GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START,
-            GatewayReceiver.DEFAULT_START_PORT,
-            GatewayReceiver.DEFAULT_END_PORT,
-            GatewayReceiver.DEFAULT_BIND_ADDRESS,
-            GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
-            GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null ));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START,
-            GatewayReceiver.DEFAULT_START_PORT,
-            GatewayReceiver.DEFAULT_END_PORT,
-            GatewayReceiver.DEFAULT_BIND_ADDRESS,
-            GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
-            GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null ));
-  }
-
-  /**
-   * GatewayReceiver with given attributes
-   */
-  @Test
-  public void testCreateGatewayReceiver() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART+ "=true"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());//expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-  }
-  
-  /**
-   * GatewayReceiver with given attributes and a single GatewayTransportFilter.
-   */
-  @Test
-  public void testCreateGatewayReceiverWithGatewayTransportFilter() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART+ "=false"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER + "=com.gemstone.gemfire.cache30.MyGatewayTransportFilter1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());//expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    List<String> transportFilters = new ArrayList<String>();
-    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter1");
-    
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( true, 10000,
-            11000, "localhost", 100000, 512000, transportFilters ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( true, 10000,
-            11000, "localhost", 100000, 512000, transportFilters ));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes( true, 10000,
-            11000, "localhost", 100000, 512000, transportFilters ));
-  }
-  
-  /**
-   * GatewayReceiver with given attributes and multiple GatewayTransportFilters.
-   */
-  @Test
-  public void testCreateGatewayReceiverWithMultipleGatewayTransportFilters() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER + " --"
-        + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost" + " --"
-        + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --"
-        + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
-        + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE
-        + "=512000" + " --"
-        + CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER
-        + "=com.gemstone.gemfire.cache30.MyGatewayTransportFilter1,com.gemstone.gemfire.cache30.MyGatewayTransportFilter2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());//expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    List<String> transportFilters = new ArrayList<String>();
-    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter1");
-    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter2");
-    
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START, 10000,
-            11000, "localhost", 100000, 512000, transportFilters ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START, 10000,
-            11000, "localhost", 100000, 512000, transportFilters ));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START, 10000,
-            11000, "localhost", 100000, 512000, transportFilters ));
-  }
-
-  /**
-   * GatewayReceiver with given attributes.
-   * Error scenario where startPort is greater than endPort.
-   */
-  @Test
-  public void testCreateGatewayReceiver_Error() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());// expected size 4 includes the manager
-                                     // node
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation should have failed", status.get(i)
-            .indexOf("ERROR:") != -1);
-      }
-    } else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-  }
-
-  /**
-   * GatewayReceiver with given attributes on the given member.
-   */
-  @Test
-  public void testCreateGatewayReceiver_onMember() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-    
-    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(1, status.size());
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-  }
-
-  /**
-   * GatewayReceiver with given attributes on multiple members.
-   */
-  @Test
-  public void testCreateGatewayReceiver_onMultipleMembers() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-    
-    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
-    final DistributedMember vm4Member = (DistributedMember) vm4.invoke(() -> getMember());
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId() + "," + vm4Member.getId();
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(2, status.size());
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-  }
-  
-  /**
-   * GatewayReceiver with given attributes on the given group.
-   */
-  @Test
-  public void testCreateGatewayReceiver_onGroup() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-    vm4.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-    vm5.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(3, status.size());//
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-  }
-
-  /**
-   * GatewayReceiver with given attributes on the given group.
-   * Only 2 of 3 members are part of the group.
-   */
-  @Test
-  public void testCreateGatewayReceiver_onGroup_Scenario2() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-    vm4.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-    vm5.invoke(() -> createCacheWithGroups( punePort, "receiverGroup2" ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(2, status.size());//
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-  }
-
-  /**
-   * GatewayReceiver with given attributes on multiple groups.
-   */
-  @Test
-  public void testCreateGatewayReceiver_onMultipleGroups() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-    vm4.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
-    vm5.invoke(() -> createCacheWithGroups( punePort, "receiverGroup2" ));
-
-    String command = CliStrings.CREATE_GATEWAYRECEIVER 
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
-        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1,receiverGroup2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData)cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(3, status.size());//
-      // verify there is no error in the status
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
-            status.get(i).indexOf("ERROR:") == -1);
-      }
-    }
-    else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
-            11000, "localhost", 100000, 512000, null ));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
deleted file mode 100644
index c084e76..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-
-@Category(DistributedTest.class)
-public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
-  
-  private static final long serialVersionUID = 1L;
-
-  private CommandResult executeCommandWithIgnoredExceptions(String command) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      CommandResult commandResult = executeCommand(command);
-      return commandResult;
-    } finally {
-      exln.remove();
-    }
-  }
-
-
-  /**
-   * GatewaySender with all default attributes
-   */
-  @Test
-  public void testCreateGatewaySenderWithDefault() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(5, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-  
-  /**
-   * GatewaySender with given attribute values
-   */
-  @Test
-  public void testCreateGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";   
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(5, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    
-    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
-    vm4.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
-    vm5.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
-  }
-
-  /**
-   * GatewaySender with given attribute values.
-   * Error scenario where dispatcher threads is set to more than 1 and 
-   * no order policy provided.
-   */
-  @Test
-  public void testCreateGatewaySender_Error() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(5, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation should fail", status.get(i).indexOf("ERROR:") != -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-  }
-
-  /**
-   * GatewaySender with given attribute values and event filters.
-   */
-  @Test
-  public void testCreateGatewaySenderWithGatewayEventFilters() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__GATEWAYEVENTFILTER + 
-        "=com.gemstone.gemfire.cache30.MyGatewayEventFilter1,com.gemstone.gemfire.cache30.MyGatewayEventFilter2";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(5, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    
-    List<String> eventFilters = new ArrayList<String>();
-    eventFilters.add("com.gemstone.gemfire.cache30.MyGatewayEventFilter1");
-    eventFilters.add("com.gemstone.gemfire.cache30.MyGatewayEventFilter2");
-    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, eventFilters, null ));
-    vm4.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, eventFilters, null ));
-    vm5.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, eventFilters, null ));
-  }
-
-  /**
-   * GatewaySender with given attribute values and transport filters.
-   */
-  @Test
-  public void testCreateGatewaySenderWithGatewayTransportFilters() {
-
-    Integer punePort = (Integer) vm1.invoke(() ->createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER + "=com.gemstone.gemfire.cache30.MyGatewayTransportFilter1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(5, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    
-    List<String> transportFilters = new ArrayList<String>();
-    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter1");
-    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters ));
-    vm4.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters ));
-    vm5.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters ));
-  }
-
-  /**
-   * GatewaySender with given attribute values on given member.
-   */
-  @Test
-  public void testCreateGatewaySender_OnMember() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-    
-    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MEMBER + "=" + vm3Member.getId()
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(1, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    
-    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
-  }
-
-  /**
-   * GatewaySender with given attribute values on given group
-   */
-  @Test
-  public void testCreateGatewaySender_Group() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__GROUP + "=SenderGroup1"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(3, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-  
-  /**
-   * GatewaySender with given attribute values on given group.
-   * Only 2 of 3 members are part of the group.
-   */
-  @Test
-  public void testCreateGatewaySender_Group_Scenario2() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createCacheWithGroups( punePort, "SenderGroup2" ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__GROUP + "=SenderGroup1"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(2, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-  
-  /**
-   * Parallel GatewaySender with given attribute values
-   */
-  @Test
-  public void testCreateParallelGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(5, status.size());
-      for (int i = 0; i < status.size(); i++) {
-        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
-      }
-    } else {
-      fail("testCreateGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", false, false ));
-    
-    vm3.invoke(() -> verifySenderAttributes( "ln", 2, true, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, GatewaySender.DEFAULT_DISPATCHER_THREADS, null, null, null ));
-    vm4.invoke(() -> verifySenderAttributes( "ln", 2, true, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, GatewaySender.DEFAULT_DISPATCHER_THREADS, null, null, null ));
-    vm5.invoke(() -> verifySenderAttributes( "ln", 2, true, true, 1000, socketReadTimeout, true, 1000, 5000,
-            true, false, 1000, 100, GatewaySender.DEFAULT_DISPATCHER_THREADS, null, null, null ));
-  }
-  
-  /**
-   * Parallel GatewaySender with given attribute values.
-   * Provide dispatcherThreads as 2 which is not valid for Parallel sender.
-   */
-  @Test
-  public void testCreateParallelGatewaySender_Error() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort
-        + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createCache( punePort ));
-
-    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
-    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=true" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true"
-        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" + " --"
-        + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
-    IgnoredException exp = IgnoredException.addIgnoredException(GatewaySenderException.class
-        .getName());
-    try {
-      CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-      if (cmdResult != null) {
-        String strCmdResult = commandResultToString(cmdResult);
-        getLogWriter().info(
-            "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
-        assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-        TabularResultData resultData = (TabularResultData) cmdResult
-            .getResultData();
-        List<String> status = resultData.retrieveAllValues("Status");
-        assertEquals(5, status.size());
-        for (int i = 0; i < status.size(); i++) {
-          assertTrue("GatewaySender creation should have failed", status.get(i)
-              .indexOf("ERROR:") != -1);
-        }
-      } else {
-        fail("testCreateGatewaySender failed as did not get CommandResult");
-      }
-    } finally {
-      exp.remove();
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java
deleted file mode 100644
index 23ca687..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewayReceiverStartDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Test wan commands for error in input 1> start gateway-sender command needs
-   * only one of member or group.
-   */
-  @Test
-  public void testStartGatewayReceiver_ErrorConditions() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createReceiver( punePort ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.START_GATEWAYRECEIVER + " --"
-        + CliStrings.START_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId() + " --"
-        + CliStrings.START_GATEWAYRECEIVER__GROUP + "=RG1";
-    
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewayReceiver_ErrorConditions stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStartGatewayReceiver_ErrorConditions failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testStartGatewayReceiver() {
-    
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createReceiver( punePort ));
-    vm4.invoke(() -> createReceiver( punePort ));
-    vm5.invoke(() -> createReceiver( punePort ));
-    
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-    
-    pause(10000);
-    String command = CliStrings.START_GATEWAYRECEIVER;
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertTrue(status.contains("Error"));
-    } else {
-      fail("testStartGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a member
-   */
-  @Test
-  public void testStartGatewayReceiver_onMember() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-    
-    vm3.invoke(() -> createReceiver( punePort ));
-    vm4.invoke(() -> createReceiver( punePort ));
-    vm5.invoke(() -> createReceiver( punePort ));
-
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-    
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    pause(10000);
-    String command = CliStrings.START_GATEWAYRECEIVER + " --"
-        + CliStrings.START_GATEWAYRECEIVER__MEMBER+ "=" + vm1Member.getId();
-    
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewayReceiver_onMember stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains("is started on member"));
-    } else {
-      fail("testStartGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a group of members
-   */
-  @Test
-  public void testStartGatewayReceiver_Group() {
-
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
-    vm4.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
-    vm5.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
-
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-    
-    pause(10000);
-    String command = CliStrings.START_GATEWAYRECEIVER + " --"
-        + CliStrings.START_GATEWAYRECEIVER__GROUP + "=RG1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewayReceiver_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStartGatewayReceiver_Group failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true ));
-    vm5.invoke(() -> verifyReceiverState( true ));
-  }
-
-  /**
-   * Test to validate the scenario gateway sender is started when one or more
-   * sender members belongs to multiple groups
-   * 
-   */
-  @Test
-  public void testStartGatewayReceiver_MultipleGroup() {
-    
-    VM puneLocator = Host.getLocator();
-    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-    
-    vm3.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
-    vm4.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
-    vm5.invoke(() -> createReceiverWithGroup( punePort, "RG1, RG2" ));
-    vm6.invoke(() -> createReceiverWithGroup( punePort, "RG1, RG2" ));
-    vm7.invoke(() -> createReceiverWithGroup( punePort, "RG3" ));
-    
-    vm3.invoke(() -> verifyReceiverState( false ));
-    vm4.invoke(() -> verifyReceiverState( false ));
-    vm5.invoke(() -> verifyReceiverState( false ));
-    vm6.invoke(() -> verifyReceiverState( false ));
-    vm7.invoke(() -> verifyReceiverState( false ));
-
-    pause(10000);
-    String command = CliStrings.START_GATEWAYRECEIVER + " --"
-        + CliStrings.START_GATEWAYRECEIVER__GROUP + "=RG1,RG2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testStartGatewayReceiver_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testStartGatewayReceiver failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifyReceiverState( true ));
-    vm4.invoke(() -> verifyReceiverState( true));
-    vm5.invoke(() -> verifyReceiverState( true ));
-    vm6.invoke(() -> verifyReceiverState( true ));
-    vm7.invoke(() -> verifyReceiverState( false ));
-  }
-
-}


[32/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanValidationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanValidationsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanValidationsDUnitTest.java
deleted file mode 100644
index 073056f..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanValidationsDUnitTest.java
+++ /dev/null
@@ -1,1507 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
-import com.gemstone.gemfire.internal.cache.wan.Filter70;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderConfigurationException;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
-import com.gemstone.gemfire.internal.cache.wan.MyGatewayTransportFilter3;
-import com.gemstone.gemfire.internal.cache.wan.MyGatewayTransportFilter4;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class WanValidationsDUnitTest extends WANTestBase {
-
-  public WanValidationsDUnitTest() {
-    super();
-  }
-
-  /**
-   * Test to make sure that serial sender Ids configured in Distributed Region
-   * is same across all DR nodes TODO : Should this validation hold tru now.
-   * Discuss. If I have 2 members on Which DR is defined. But sender is defined
-   * on only one member. How can I add the instance on the sender in Region
-   * which does not have a sender. I can bypass the existing validation for the
-   * DR with SerialGatewaySender. But for PR with SerialGatewaySender, we need
-   * to send the adjunct message. Find out the way to send the adjunct message
-   * to the member on which serialGatewaySender is available.
-   */
-  
-  @Test
-  public void testSameSerialGatewaySenderIdAcrossSameDistributedRegion()
-      throws Exception {
-    IgnoredException.addIgnoredException("another cache has the same region defined");
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
-
-      createCacheInVMs(lnPort, vm4, vm5);
-
-      vm4.invoke(() -> WANTestBase.createSender("ln1", 2, false, 10, 100, false, false, null, true));
-      vm4.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
-      
-      vm5.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
-      vm5.invoke(() -> WANTestBase.createSender("ln3", 2, false, 10, 100, false, false, null, true));
-      
-     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() ));
-      
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln2,ln3", isOffHeap() ));
-      fail("Expected IllegalStateException with incompatible gateway sender ids message");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
-        Assert.fail(
-            "Expected IllegalStateException with incompatible gateway sender ids message",
-            e);
-      }
-    }
-  }
-
-
-  /**
-   * Validate that ParallelGatewaySender can be added to Distributed region
-   * 
-   * @throws Exception
-   * 
-   * 
-   * Below test is disabled intentionally Replicated region with Parallel Async
-   * Event queue is not supported. Test is added for the same
-   * ReplicatedRegion_ParallelWANPropagationDUnitTest#test_DR_PGS_1Nodes_Put_Receiver
-   * 
-   * We are gone support this configuration in upcoming releases
-   */
-
-  @Ignore("Bug51491")
-  @Test
-  public void testParallelGatewaySenderForDistributedRegion() throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(lnPort, vm4, vm5);
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-
-      vm5.invoke(() -> WANTestBase.createSender( "ln2", 2,
-          true, 10, 100, false, false, null, false ));
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-
-      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-
-    }
-    catch (Exception e) {
-      Assert.fail("Caught Exception", e);
-    }
-  }
-  
-  /**
-   * Test to make sure that serial sender Ids configured in partitioned regions
-   * should be same across all PR members
-   */
-  @Test
-  public void testSameSerialGatewaySenderIdAcrossSamePartitionedRegion()
-      throws Exception {
-    IgnoredException.addIgnoredException("another cache has the same region defined");
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-
-      createCacheInVMs(lnPort, vm4, vm5);
-
-      vm4.invoke(() -> WANTestBase.createSender("ln1", 2, false, 10, 100, false, false, null, true));
-      vm4.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
-      
-      vm5.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
-      vm5.invoke(() -> WANTestBase.createSender("ln3", 2, false, 10, 100, false, false, null, true));
-      
-      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln1,ln2", 1, 100, isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln2,ln3", 1, 100, isOffHeap()  ));
-      fail("Expected IllegalStateException with incompatible gateway sender ids message");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
-        Assert.fail(
-            "Expected IllegalStateException with incompatible gateway sender ids message",
-            e);
-      }
-    }
-  }
-  
-  
-  @Test
-  public void testReplicatedSerialAsyncEventQueueWithPersistenceEnabled() {
-    IgnoredException.addIgnoredException("another cache has the same region defined");
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-      createCacheInVMs(lnPort, vm4, vm5);
-
-
-      vm4.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
-              getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
-              getTestMethodName() + "_RR", "ln2", isOffHeap()  ));
-      fail("Expected IllegalStateException with incompatible gateway sender ids message");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
-        Assert.fail(
-            "Expected IllegalStateException with incompatible gateway sender ids message",
-            e);
-      }
-    }
-  }
-  
-  /**
-   * Test to make sure that parallel sender Ids configured in partitioned
-   * regions should be same across all PR members
-   */
-  @Test
-  public void testSameParallelGatewaySenderIdAcrossSamePartitionedRegion()
-      throws Exception {
-    IgnoredException.addIgnoredException("another cache has the same region defined");
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-
-      createCacheInVMs(lnPort, vm4, vm5);
-
-      vm4.invoke(() -> WANTestBase.createSender("ln1", 2, true, 10, 100, false, false, null, true));
-      vm4.invoke(() -> WANTestBase.createSender("ln2", 2, true, 10, 100, false, false, null, true));
-      
-      vm5.invoke(() -> WANTestBase.createSender("ln2", 2, true, 10, 100, false, false, null, true));
-      vm5.invoke(() -> WANTestBase.createSender("ln3", 2, true, 10, 100, false, false, null, true));
-
-      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln1,ln2", 1, 100, isOffHeap()  ));
-      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_PR", "ln2,ln3", 1, 100, isOffHeap()  ));
-      
-      fail("Expected IllegalStateException with incompatible gateway sender ids message");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
-        Assert.fail(
-            "Expected IllegalStateException with incompatible gateway sender ids message",
-            e);
-      }
-    }
-  }
-
-  /**
-   * Test to make sure that same parallel gateway sender id can be used by 2
-   * different PRs
-   * 
-   * @throws Exception
-   */
-  @Ignore
-  @Test
-  public void testSameParallelGatewaySenderIdAcrossDifferentPartitionedRegion()
-      throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-      createCacheInVMs(lnPort, vm1);
-
-      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
-      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
-      
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR1", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR2", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
-
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("cannot have the same parallel gateway sender id"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-
-  @Test
-  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion()
-      throws Exception {
-    IgnoredException.addIgnoredException("another cache has the same region defined");
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-      createCacheInVMs(lnPort, vm1);
-
-      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
-      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
-      
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR1", null, "ln1_Parallel", null, isOffHeap()  ));
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR2", null, "ln1_Parallel,ln2_Parallel", getTestMethodName() + "_PR1", isOffHeap()  ));
-      //now we support this
-      //fail("Expected IllegalStateException with incompatible gateway sender ids in colocated regions");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("should have same parallel gateway sender ids"))) {
-        Assert.fail(
-            "Expected IllegalStateException with incompatible gateway sender ids in colocated regions",
-            e);
-      }
-    }
-  }
-  
-  /**
-   * Validate that if Colocated partitioned region doesn't want to add a PGS even if its 
-   * parent has one then it is fine
-   * @throws Exception
-   */
-  
-  @Test
-  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion2()
-      throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-      createCacheInVMs(lnPort, vm1);
-
-      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
-      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
-      
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR1", null, "ln1_Parallel", null, isOffHeap()  ));
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR2", null, null, getTestMethodName() + "_PR1", isOffHeap()  ));
-      
-    }
-    catch (Exception e) {
-      Assert.fail("The tests caught Exception.", e);
-    }
-  }
-  
-  /**
-   * Validate that if Colocated partitioned region has a subset of PGS
-   * then it is fine. 
-   * @throws Exception
-   */
-  
-  @Test
-  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion3()
-      throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-      createCacheInVMs(lnPort, vm1);
-
-      vm1.invoke(() -> WANTestBase.createSender(
-          "ln1_Parallel", 2, true, 10, 100, false, false, null, true ));
-      vm1.invoke(() -> WANTestBase.createSender(
-          "ln2_Parallel", 2, true, 10, 100, false, false, null, true ));
-
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR1", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR2", null, "ln1_Parallel", getTestMethodName() + "_PR1", isOffHeap()  ));
-
-    } catch (Exception e) {
-      Assert.fail("The tests caught Exception.", e);
-    }
-  }
-  
-  /**
-   * Validate that if Colocated partitioned region has a superset of PGS
-   * then Exception is thrown. 
-   * @throws Exception
-   */
-  
-  @Test
-  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion4()
-      throws Exception {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-      createCacheInVMs(lnPort, vm1);
-
-      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
-      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
-      vm1.invoke(() -> WANTestBase.createSender("ln3_Parallel", 2, true, 10, 100, false, false, null, true));
-
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR1", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
-      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
-              getTestMethodName() + "_PR2", null, "ln1_Parallel,ln2_Parallel,ln3_Parallel", getTestMethodName() + "_PR1", isOffHeap()  ));
-      //now we support this
-      //fail("Expected IllegalStateException with incompatible gateway sender ids in colocated regions");
-    } catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("should have same parallel gateway sender ids"))) {
-        Assert.fail(
-            "Expected IllegalStateException with incompatible gateway sender ids in colocated regions",
-            e);
-      }
-    }
-  }
-  
-  /**
-   * SerialGatewaySender and ParallelGatewaySender with same name is allowed
-   */
-  @Test
-  public void testSerialGatewaySenderAndParallelGatewaySenderWithSameName() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null, null, true, false ));
-    try {
-      vm1.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 2, true, 100, false, false, null, null, true, false ));
-      fail("Expected IllegalStateException : Sender names should be different.");
-    } catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("is already defined in this cache"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  //remote ds ids should be same
-  @Test
-  public void testSameRemoteDSAcrossSameSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null, null,
-        true, false  ));
-
-    try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 3, false, 100, false, false, null, null,
-          true, false  ));
-      fail("Expected IllegalStateException : Remote Ds Ids should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same Gateway Sender defined with remote ds id"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  // sender with same name should be either serial or parallel but not both.
-  @Test
-  public void testSerialSenderOnBothCache() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null, null,
-        true, false  ));
-
-    try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 2, true, 100, false, false, null, null, true, false  ));
-      fail("Expected IllegalStateException : is not serial Gateway Sender");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same sender as serial gateway sender"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  // sender with same name should be either serial or parallel but not both.
-  @Test
-  public void testParallelSenderOnBothCache(){
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        true, 100,false, false,
-        null, null, true, false  ));
-    
-    try {
-      vm2
-          .invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-              false, 100, false, false,null, null,
-              true, false  ));
-      fail("Expected IllegalStateException : is not parallel Gateway Sender");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("because another cache has the same sender as parallel gateway sender"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  // isBatchConflation should be same across the same sender
-  @Test
-  public void testBatchConflation() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 100, false, false,
-        null, null, true, false  ));
-
-    // isBatchConflation
-    try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-          false, 100,true, false,
-          null, null, true, false  ));
-      fail("Expected IllegalStateException : isBatchConflation Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("another cache has the same Gateway Sender defined with isBatchConflationEnabled"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  //isPersistentEnabled should be same across the same sender
-  @Test
-  public void testisPersistentEnabled() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 100, false, false,
-        null, null, true, false  ));
-    try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 100,false, true, null, null, true, false  ));
-      fail("Expected IllegalStateException : isPersistentEnabled Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with isPersistentEnabled"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testAlertThreshold() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 100, false, false,
-        null, null, true, false ));
-    try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 50, false, false, null, null, true, false  ));
-      fail("Expected IllegalStateException : alertThreshold Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with alertThreshold"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testManualStart() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 100, false, false,
-        null, null, true, false  ));
-    try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
-        false, 100, false, false, null, null, false, false  ));
-      fail("Expected IllegalStateException : manualStart Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with manual start"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testGatewayEventFilters() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    ArrayList<GatewayEventFilter> eventFilters = new ArrayList<GatewayEventFilter>();
-    eventFilters.add(new MyGatewayEventFilter());
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, eventFilters,
-        null, true, false  ));
-    try {
-      eventFilters.clear();
-      eventFilters.add(new Filter70());
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 2, false, 100, false, false,
-          eventFilters, null, true, false  ));
-      fail("Expected IllegalStateException : GatewayEventFilters Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same Gateway Sender defined with GatewayEventFilters"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testGatewayEventFilters2() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    ArrayList<GatewayEventFilter> eventFilters = new ArrayList<GatewayEventFilter>();
-    eventFilters.add(new MyGatewayEventFilter());
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, eventFilters,
-        null, true, false  ));
-    try {
-      eventFilters.clear();
-      eventFilters.add(new MyGatewayEventFilter());
-      eventFilters.add(new Filter70());
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 2, false, 100, false, false,
-          eventFilters, null, true, false  ));
-      fail("Expected IllegalStateException : GatewayEventFilters Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same Gateway Sender defined with GatewayEventFilters"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testGatewayTransportFilters() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
-    transportFilters.add(new MyGatewayTransportFilter1());
-    transportFilters.add(new MyGatewayTransportFilter2());
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null,
-        transportFilters, true, false  ));
-   try {
-      transportFilters.clear();
-      transportFilters.add(new MyGatewayTransportFilter3());
-      transportFilters.add(new MyGatewayTransportFilter4());
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 2, false, 100, false, false,
-          null, transportFilters, true, false  ));
-      fail("Expected IllegalStateException : GatewayEventFilters Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same Gateway Sender defined with GatewayTransportFilters"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-
-  @Test
-  public void testGatewayTransportFiltersOrder() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
-    transportFilters.add(new MyGatewayTransportFilter1());
-    transportFilters.add(new MyGatewayTransportFilter2());
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null,
-        transportFilters, true, false  ));
-   try {
-      transportFilters.clear();
-      transportFilters.add(new MyGatewayTransportFilter2());
-      transportFilters.add(new MyGatewayTransportFilter1());
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-          "ln", 2, false, 100, false, false,
-          null, transportFilters, true, false ));
-      fail("Expected IllegalStateException : GatewayEventFilters Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same Gateway Sender defined with GatewayTransportFilters"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-
-  
-  @Test
-  public void testIsDiskSynchronous() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null,
-        null, true, false ));
-    
-   try {
-      vm2.invoke(() -> WANTestBase.createSenderForValidations(
-        "ln", 2, false, 100, false, false, null,
-        null, true, true ));
-      fail("Expected IllegalStateException : isDiskSynchronous Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("because another cache has the same Gateway Sender defined with isDiskSynchronous"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  /**
-   * This test has been added for the defect # 44372.
-   * A single VM hosts a bridge server as well as a Receiver.
-   * Expected: Cache.getCacheServer should return only the Bridge server and not the Receiver
-   */
-  @Test
-  public void test_GetCacheServersDoesNotReturnReceivers() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4);
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    
-    vm4.invoke(() -> WANTestBase.createCacheServer( ));
-    
-    Map cacheServers = (Map) vm4.invoke(() -> WANTestBase.getCacheServers( ));
-    
-    assertEquals("Cache.getCacheServers returned incorrect BridgeServers: ", 1, cacheServers.get("BridgeServer"));
-    assertEquals("Cache.getCacheServers returned incorrect ReceiverServers: ", 0, cacheServers.get("ReceiverServer"));
-  }
-  
-  /**
-   * Added for the defect # 44372.
-   * Two VMs are part of the DS. 
-   * One VM hosts a Bridge server while the other hosts a Receiver.
-   * Expected: Cache.getCacheServers should only return the bridge server and not the Receiver.
-   */
-  @Test
-  public void test_GetCacheServersDoesNotReturnReceivers_Scenario2() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    createCacheInVMs(lnPort, vm4);
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    createCacheInVMs(lnPort, vm5);
-    
-    vm5.invoke(() -> WANTestBase.createCacheServer( ));
-    
-    Map cacheServers_vm4 = (Map) vm4.invoke(() -> WANTestBase.getCacheServers( ));
-    Map cacheServers_vm5 = (Map) vm5.invoke(() -> WANTestBase.getCacheServers( ));
-    
-    assertEquals("Cache.getCacheServers on vm4 returned incorrect BridgeServers: ", 0, cacheServers_vm4.get("BridgeServer"));
-    assertEquals("Cache.getCacheServers on vm4 returned incorrect ReceiverServers: ", 0, cacheServers_vm4.get("ReceiverServer"));
-    
-    assertEquals("Cache.getCacheServers on vm5 returned incorrect BridgeServers: ", 1, cacheServers_vm5.get("BridgeServer"));
-    assertEquals("Cache.getCacheServers on vm5 returned incorrect ReceiverServers: ", 0, cacheServers_vm5.get("ReceiverServer"));
-
-  }
-  
-  
-  // dispatcher threads are same across all the nodes for ParallelGatewaySender
-  /*
-   * We are allowing number of dispatcher threads for parallel sender to differ
-   * on number of machines
-   */
-  @Ignore
-  @Test
-  public void testDispatcherThreadsForParallelGatewaySender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-
-    // dispatcher threads
-    try {
-      vm2.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-      fail("Expected IllegalStateException : dispatcher threads Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with dispatcherThread"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  
-  // dispatcher threads are same across all the nodes for ParallelGatewaySender
-  /*
-   * For Parallel sender, thread policy is not supported which is checked at the
-   * time of sender creation. policy KEY and Partition are same for PGS. Hence
-   * disabling the tests
-   */
-  @Ignore
-  @Test
-  public void testOrderPolicyForParallelGatewaySender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm1, vm2);
-
-    vm1.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-
-    // dispatcher threads
-    try {
-      vm2.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-      fail("Expected IllegalStateException : order policy Should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with orderPolicy"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-
-  @Test
-  public void testBug50434_RR_Serial() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(createReceiverReplicatedRegion());
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm4.invoke(createReceiverReplicatedRegion());
-    vm5.invoke(createReceiverReplicatedRegion());
-    vm6.invoke(createReceiverReplicatedRegion());
-    vm7.invoke(createReceiverReplicatedRegion());
-
-    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_RR", "ln"));
-    
-    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_RR", "ln"));
-
-    try {
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-          10 ));
-      fail("Expected GatewaySenderConfigurationException : Sender Ids should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
-          || !(e.getCause().getMessage()
-              .contains("For region across all members, gateway sender ids should be same."))) {
-        Assert.fail("Expected GatewaySenderConfigurationException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testBug50434_RR_SerialAsyncEventQueue() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-
-    vm4.invoke(createReceiverReplicatedRegion());
-    vm5.invoke(createReceiverReplicatedRegion());
-    vm6.invoke(createReceiverReplicatedRegion());
-    vm7.invoke(createReceiverReplicatedRegion());
-
-    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
-
-    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
-
-    try {
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-      fail("Expected GatewaySenderConfigurationException : AsyncEvent queue IDs should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
-          || !(e.getCause().getMessage()
-              .contains("For region across all members, AsyncEvent queue IDs should be same."))) {
-        Assert.fail("Expected GatewaySenderConfigurationException", e);
-      }
-    }
-  }
-
-  protected SerializableRunnableIF createReceiverReplicatedRegion() {
-    return () -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() );
-  }
-  
-  @Test
-  public void testBug50434_RR_Serial_Pass() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(createReceiverReplicatedRegion());
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm4.invoke(createReceiverReplicatedRegion());
-    vm5.invoke(createReceiverReplicatedRegion());
-    vm6.invoke(createReceiverReplicatedRegion());
-    vm7.invoke(createReceiverReplicatedRegion());
-
-    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_RR", "ln"));
-    
-    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_RR", "ln"));
-    
-    vm6.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_RR", "ln"));
-    
-    vm7.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_RR", "ln"));
-    
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10));
-  }
-  
-  @Test
-  public void testBug50434_RR_SerialAsyncEventQueue_Pass() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-
-    vm4.invoke(createReceiverReplicatedRegion());
-    vm5.invoke(createReceiverReplicatedRegion());
-    vm6.invoke(createReceiverReplicatedRegion());
-    vm7.invoke(createReceiverReplicatedRegion());
-
-    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
-    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
-    vm6.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
-    vm7.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm4.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 1000 ));// primary sender
-    vm5.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 0 ));// secondary
-    vm6.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 0 ));// secondary
-    vm7.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 0 ));// secondary
-  }
-  
-  @Test
-  public void testBug50434_PR_Serial() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_RR", null, 1, 100, isOffHeap() ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    
-    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    try {
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10));
-      fail("Expected GatewaySenderConfigurationException : Sender Ids should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
-          || !(e.getCause().getMessage()
-              .contains("For region across all members, gateway sender ids should be same."))) {
-        Assert.fail("Expected GatewaySenderConfigurationException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testBug50434_PR_SerialAsyncEventQueue() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-
-    try {
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-      fail("Expected GatewaySenderConfigurationException : AsyncEvent queue IDs should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
-          || !(e.getCause().getMessage()
-              .contains("For region across all members, AsyncEvent queue IDs should be same."))) {
-        Assert.fail("Expected GatewaySenderConfigurationException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testBug50434_PR_Serial_Pass() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm6.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm7.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10));
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-      0));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10));
-  }
-  
-  @Test
-  public void testBug50434_PR_SerialAsyncEventQueue_Pass() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        false, 100, 100, false, false, null, false ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm6.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm7.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-
-    vm4.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 1000 ));// primary sender
-    vm5.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 0 ));// secondary
-    vm6.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 0 ));// secondary
-    vm7.invoke(() -> WANTestBase.validateAsyncEventListener(
-        "ln", 0 ));// secondary
-  }
-  
-  @Test
-  public void testBug50434_PR_Parallel() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-
-    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    try {
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10));
-      fail("Expected GatewaySenderConfigurationException : Sender Ids should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
-          || !(e.getCause().getMessage()
-              .contains("For region across all members, gateway sender ids should be same."))) {
-        Assert.fail("Expected GatewaySenderConfigurationException", e);
-      }
-    }
-  }
-  
-  @Test
-  public void testBug50434_PR_ParallelAsyncEventQueue() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    
-    try {
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10));
-      fail("Expected GatewaySenderConfigurationException : AsyncEvent queue IDs should match");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
-          || !(e.getCause().getMessage()
-              .contains("For region across all members, AsyncEvent queue IDs should be same."))) {
-        Assert.fail("Expected GatewaySenderConfigurationException", e);
-      }
-    }
-  }
-
-  @Category(FlakyTest.class) // GEODE-1019: random ports, time sensitive, waitForCriterion, suspect string: loss of quorum
-  @Test
-  public void testBug50434_PR_Parallel_pass() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm6.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    vm7.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
-      getTestMethodName() + "_PR", "ln"));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10));
-  }
-  
-  @Test
-  public void testBug50434_PR_ParallelAsyncEventQueue_Pass() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
-        true, 100, 100, false, false, null, false ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm6.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    vm7.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        256 ));
-    
-    vm4.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
-    
-    int vm4size = (Integer)vm4.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
-    int vm5size = (Integer)vm5.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
-    int vm6size = (Integer)vm6.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
-    int vm7size = (Integer)vm7.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
-    
-    assertEquals(vm4size + vm5size + vm6size + vm7size, 256);
-  }
-  
-  @Test
-  public void testBug51367_WrongBindAddressOnGatewayReceiver() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    vm2.invoke(() -> WANTestBase.createReceiverWithBindAddress( lnPort ));
-  }
-  
-  
-  @Test
-  public void testBug50247_NonPersistentSenderWithPersistentRegion()
-      throws Exception {
-    IgnoredException.addIgnoredException("could not get remote locator information");
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    try {
-      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-      vm4.invoke(() -> WANTestBase.createPartitionedRegionWithPersistence( getTestMethodName() + "_PR", "ln1", 1, 100 ));
-      fail("Expected GatewaySenderException with incompatible gateway sender ids and region");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderException)
-          || !(e.getCause().getMessage()
-              .contains("can not be attached to persistent region "))) {
-        Assert.fail(
-            "Expected GatewaySenderException with incompatible gateway sender ids and region",
-            e);
-      }
-    }
-
-    try {
-      vm5.invoke(() -> WANTestBase.createPartitionedRegionWithPersistence( getTestMethodName() + "_PR", "ln1", 1, 100 ));
-      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
-          true, 10, 100, false, false, null, false ));
-      fail("Expected GatewaySenderException with incompatible gateway sender ids and region");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof GatewaySenderException)
-          || !(e.getCause().getMessage()
-              .contains("can not be attached to persistent region "))) {
-        Assert.fail(
-            "Expected GatewaySenderException with incompatible gateway sender ids and region",
-            e);
-      }
-    }
-  }
-  
-  /**
-   * Test configuration::
-   * 
-   * Region: Replicated WAN: Serial Number of WAN sites: 2 Region persistence
-   * enabled: false Async channel persistence enabled: false
-   */
-  @Test
-  public void testReplicatedSerialAsyncEventQueueWith2WANSites() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    // ------------ START - CREATE CACHE, REGION ON LOCAL SITE ------------//
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createAsyncEventQueue(
-        "lnAsync", false, 100, 100, false, false, null, false ));
-    vm5.invoke(() -> WANTestBase.createAsyncEventQueue(
-        "lnAsync", false, 100, 100, false, false, null, false ));
-    vm6.invoke(() -> WANTestBase.createAsyncEventQueue(
-        "lnAsync", false, 100, 100, false, false, null, false ));
-    vm7.invoke(() -> WANTestBase.createAsyncEventQueue(
-        "lnAsync", false, 100, 100, false, false, null, false ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
-            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
-            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
-            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
-            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
-    // ------------- END - CREATE CACHE, REGION ON LOCAL SITE -------------//
-
-    // ------------- START - CREATE CACHE ON REMOTE SITE ---------------//
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createSender( "ny", 1,
-        false, 100, 10, false, false, null, true ));
-    vm3.invoke(() -> WANTestBase.createSender( "ny", 1,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createAsyncEventQueue(
-        "nyAsync", false, 100, 100, false, false, null, false ));
-    vm3.invoke(() -> WANTestBase.createAsyncEventQueue(
-        "nyAsync", false, 100, 100, false, false, null, false ));
-
-    startSenderInVMs("ny", vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
-            getTestMethodName() + "_RR", "ny", "nyAsync", isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
-            getTestMethodName() + "_RR", "ny", "nyAsync", isOffHeap() ));
-
-    // ------------- END - CREATE CACHE, REGION ON REMOTE SITE -------------//
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    // validate AsyncEventListener on local site
-    vm4.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 1000 ));// primary sender
-    vm5.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 0 ));// secondary
-    vm6.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 0 ));// secondary
-    vm7.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 0 ));// secondary
-
-    // validate region size on remote site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-    // validate AsyncEventListener on remote site
-    vm2.invoke(() -> WANTestBase.validateAsyncEventListener( "nyAsync", 1000 ));// primary sender
-    vm3.invoke(() -> WANTestBase.validateAsyncEventListener( "nyAsync", 0 ));// secondary
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
deleted file mode 100644
index 1b8d2e7..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.concurrent.ConcurrentParallelGatewaySenderOperation_2_DUnitTest;
-
-@Category(DistributedTest.class)
-public class ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest
-    extends ConcurrentParallelGatewaySenderOperation_2_DUnitTest {
-
-  public ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
deleted file mode 100644
index 37631a8..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderOperation_2_DUnitTest;
-
-@Category(DistributedTest.class)
-public class ParallelGatewaySenderOperation_2_OffHeapDUnitTest
-    extends ParallelGatewaySenderOperation_2_DUnitTest{
-
-  public ParallelGatewaySenderOperation_2_OffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java
deleted file mode 100644
index b735a18..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderOperationsDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ParallelGatewaySenderOperationsOffHeapDUnitTest extends
-    ParallelGatewaySenderOperationsDUnitTest {
-
-  public ParallelGatewaySenderOperationsOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java
deleted file mode 100644
index de87b09..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQueueOverflowDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ParallelGatewaySenderQueueOverflowOffHeapDUnitTest extends
-    ParallelGatewaySenderQueueOverflowDUnitTest {
-
-  public ParallelGatewaySenderQueueOverflowOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java
deleted file mode 100644
index 44ebefd..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANConflationDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ParallelWANConflationOffHeapDUnitTest extends
-    ParallelWANConflationDUnitTest {
-
-  public ParallelWANConflationOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
deleted file mode 100644
index 31fe21b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANPersistenceEnabledGatewaySenderDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest extends
-    ParallelWANPersistenceEnabledGatewaySenderDUnitTest {
-
-  public ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java
deleted file mode 100644
index 1dca0c9..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANPropagationConcurrentOpsDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ParallelWANPropagationConcurrentOpsOffHeapDUnitTest extends
-    ParallelWANPropagationConcurrentOpsDUnitTest {
-
-  public ParallelWANPropagationConcurrentOpsOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java
deleted file mode 100644
index b08b5c2..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANPropagationDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ParallelWANPropagationOffHeapDUnitTest extends ParallelWANPropagationDUnitTest {
-
-  public ParallelWANPropagationOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java
deleted file mode 100644
index b75faf0..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.internal.cache.wan.offheap;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderQueueDUnitTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class SerialGatewaySenderQueueOffHeapDUnitTest extends
-    SerialGatewaySenderQueueDUnitTest {
-
-  public SerialGatewaySenderQueueOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}


[58/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
new file mode 100644
index 0000000..163a611
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
@@ -0,0 +1,166 @@
+/*
+ * 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.internal.cache.wan;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.client.internal.PoolImpl;
+import com.gemstone.gemfire.cache.client.internal.locator.wan.RemoteLocatorRequest;
+import com.gemstone.gemfire.cache.client.internal.locator.wan.RemoteLocatorResponse;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.net.ConnectException;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+public abstract class AbstractRemoteGatewaySender extends AbstractGatewaySender {
+  private static final Logger logger = LogService.getLogger();
+  
+  public AbstractRemoteGatewaySender() {
+    
+  }
+  public AbstractRemoteGatewaySender(Cache cache, GatewaySenderAttributes attrs){
+    super(cache, attrs);
+  }
+  
+  /** used to reduce warning logs in case remote locator is down (#47634) */ 
+  protected int proxyFailureTries = 0; 
+  
+  public synchronized void initProxy() {
+    // return if it is being used for WBCL or proxy is already created
+    if (this.remoteDSId == DEFAULT_DISTRIBUTED_SYSTEM_ID || this.proxy != null
+        && !this.proxy.isDestroyed()) {
+      return;
+    }
+
+    int locatorCount = 0;
+    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
+    pf.setPRSingleHopEnabled(false);
+    if (this.locatorDiscoveryCallback != null) {
+      pf.setLocatorDiscoveryCallback(locatorDiscoveryCallback);
+    }
+    pf.setReadTimeout(this.socketReadTimeout);
+    pf.setIdleTimeout(connectionIdleTimeOut);
+    pf.setSocketBufferSize(socketBufferSize);
+    pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
+    RemoteLocatorRequest request = new RemoteLocatorRequest(this.remoteDSId, pf
+        .getPoolAttributes().getServerGroup());
+    String locators = ((GemFireCacheImpl) this.cache).getDistributedSystem()
+        .getConfig().getLocators();
+    if (logger.isDebugEnabled()) {
+      logger.debug("Gateway Sender is attempting to configure pool with remote locator information");
+    }
+    StringTokenizer locatorsOnThisVM = new StringTokenizer(locators, ",");
+    while (locatorsOnThisVM.hasMoreTokens()) {
+      String localLocator = locatorsOnThisVM.nextToken();
+      DistributionLocatorId locatorID = new DistributionLocatorId(localLocator);
+      try {
+        RemoteLocatorResponse response = (RemoteLocatorResponse) new TcpClient()
+            .requestToServer(locatorID.getHost(), locatorID.getPort(), request,
+                WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
+
+        if (response != null) {
+          if (response.getLocators() == null) {
+            if (logProxyFailure()) {
+              logger.warn(LocalizedMessage.create(
+                  LocalizedStrings.AbstractGatewaySender_REMOTE_LOCATOR_FOR_REMOTE_SITE_0_IS_NOT_AVAILABLE_IN_LOCAL_LOCATOR_1,
+                      new Object[] { remoteDSId, localLocator }));
+            }
+            continue;
+          }
+          if (logger.isDebugEnabled()) {
+            logger.debug("Received the remote site {} location information:", this.remoteDSId, response.getLocators());
+          }
+          StringBuffer strBuffer = new StringBuffer();
+          Iterator<String> itr = response.getLocators().iterator();
+          while (itr.hasNext()) {
+            DistributionLocatorId locatorId = new DistributionLocatorId(itr.next());
+            pf.addLocator(locatorId.getHost().getHostName(), locatorId.getPort());
+            locatorCount++;
+          }
+          break;
+        }
+      } catch (IOException ioe) {
+        if (logProxyFailure()) {
+          // don't print stack trace for connection failures
+          String ioeStr = "";
+          if (!logger.isDebugEnabled() && ioe instanceof ConnectException) {
+            ioeStr = ": " + ioe.toString();
+            ioe = null;
+          }
+        logger.warn(LocalizedMessage.create(
+            LocalizedStrings.AbstractGatewaySender_SENDER_0_IS_NOT_ABLE_TO_CONNECT_TO_LOCAL_LOCATOR_1,
+                new Object[] { this.id, localLocator + ioeStr  }), ioe);        
+        }
+        continue;
+      } catch (ClassNotFoundException e) {
+        if (logProxyFailure()) {
+          logger.warn(LocalizedMessage.create(
+              LocalizedStrings.AbstractGatewaySender_SENDER_0_IS_NOT_ABLE_TO_CONNECT_TO_LOCAL_LOCATOR_1,
+                  new Object[] { this.id, localLocator }), e);
+        }
+        continue;
+      }
+    }
+
+    if (locatorCount == 0) {
+      if (logProxyFailure()) {
+        logger.fatal(LocalizedMessage.create(
+            LocalizedStrings.AbstractGatewaySender_SENDER_0_COULD_NOT_GET_REMOTE_LOCATOR_INFORMATION_FOR_SITE_1,
+                new Object[] { this.id, this.remoteDSId }));
+      }
+      this.proxyFailureTries++;
+      throw new GatewaySenderConfigurationException(
+          LocalizedStrings.AbstractGatewaySender_SENDER_0_COULD_NOT_GET_REMOTE_LOCATOR_INFORMATION_FOR_SITE_1
+              .toLocalizedString(new Object[] { this.id, this.remoteDSId}));
+    }
+    pf.init(this);
+    this.proxy = ((PoolImpl) pf.create(this.getId()));
+    if (this.proxyFailureTries > 0) {
+      logger.info(LocalizedMessage.create(LocalizedStrings.AbstractGatewaySender_SENDER_0_GOT_REMOTE_LOCATOR_INFORMATION_FOR_SITE_1,
+              new Object[] { this.id, this.remoteDSId, this.proxyFailureTries }));
+      this.proxyFailureTries = 0;
+    }
+  }
+  
+  protected boolean logProxyFailure() {
+    assert Thread.holdsLock(this);
+    // always log the first failure
+    if (logger.isDebugEnabled() || this.proxyFailureTries == 0) {
+      return true;
+    } else {
+      // subsequent failures will be logged on 30th, 300th, 3000th try
+      // each try is at 100millis from higher layer so this accounts for logging
+      // after 3s, 30s and then every 5mins
+      if (this.proxyFailureTries >= 3000) {
+        return (this.proxyFailureTries % 3000) == 0;
+      } else {
+        return (this.proxyFailureTries == 30 || this.proxyFailureTries == 300);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverFactoryImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverFactoryImpl.java
new file mode 100644
index 0000000..c5c2a2f
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverFactoryImpl.java
@@ -0,0 +1,145 @@
+/*
+ * 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.internal.cache.wan;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.ResourceEvent;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.GatewayReceiverCreation;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+
+/**
+ * 
+ * @since GemFire 7.0
+ */
+public class GatewayReceiverFactoryImpl implements GatewayReceiverFactory {
+
+  private int startPort = GatewayReceiver.DEFAULT_START_PORT;
+  
+  private int endPort = GatewayReceiver.DEFAULT_END_PORT;
+  
+  private int timeBetPings = GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS;
+
+  private int socketBuffSize = GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE;
+
+  private String bindAdd= GatewayReceiver.DEFAULT_BIND_ADDRESS; 
+  
+  private String hostnameForSenders = GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS;  
+  
+  private boolean manualStart = GatewayReceiver.DEFAULT_MANUAL_START;
+
+  private List<GatewayTransportFilter> filters = new ArrayList<GatewayTransportFilter>();
+  
+  private Cache cache;
+
+  public GatewayReceiverFactoryImpl() {
+    
+  }
+  public GatewayReceiverFactoryImpl(Cache cache) {
+   this.cache = cache;
+  }
+  
+  public GatewayReceiverFactory addGatewayTransportFilter(
+      GatewayTransportFilter filter) {
+    this.filters.add(filter);
+    return this;
+  }
+
+  public GatewayReceiverFactory removeGatewayTransportFilter(
+      GatewayTransportFilter filter) {
+    this.filters.remove(filter);
+    return this;
+  }
+
+  public GatewayReceiverFactory setMaximumTimeBetweenPings(int time) {
+    this.timeBetPings = time;
+    return this;
+  }
+
+  public GatewayReceiverFactory setStartPort(int port) {
+    this.startPort = port;
+    return this;
+  }
+  
+  public GatewayReceiverFactory setEndPort(int port) {
+    this.endPort = port;
+    return this;
+  }
+  
+  public GatewayReceiverFactory setSocketBufferSize(int size) {
+    this.socketBuffSize = size;
+    return this;
+  }
+
+  public GatewayReceiverFactory setBindAddress(String address) {
+    this.bindAdd = address;
+    return this;
+  }
+  
+  public GatewayReceiverFactory setHostnameForSenders(String address) {
+    this.hostnameForSenders = address;
+    return this;
+  } 
+
+  public GatewayReceiverFactory setManualStart(boolean start) {
+    this.manualStart = start;
+    return this;
+  }
+  
+  public GatewayReceiver create() {
+    if (this.startPort > this.endPort) {
+      throw new IllegalStateException(
+          "Please specify either start port a value which is less than end port.");
+    }
+    GatewayReceiver recv = null;
+    if (this.cache instanceof GemFireCacheImpl) {
+      recv = new GatewayReceiverImpl(this.cache, this.startPort, this.endPort,
+          this.timeBetPings, this.socketBuffSize, this.bindAdd, this.filters,
+          this.hostnameForSenders, this.manualStart);
+      ((GemFireCacheImpl)cache).addGatewayReceiver(recv);
+      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
+      .getDistributedSystem();
+      system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_CREATE, recv);
+      if (!this.manualStart) {
+        try {
+          recv.start();
+        }
+        catch (IOException ioe) {
+          throw new GatewayReceiverException(
+              LocalizedStrings.GatewayReceiver_EXCEPTION_WHILE_STARTING_GATEWAY_RECEIVER
+                  .toLocalizedString(), ioe);
+        }
+      }
+    } else if (this.cache instanceof CacheCreation) {
+      recv = new GatewayReceiverCreation(this.cache, this.startPort, this.endPort,
+          this.timeBetPings, this.socketBuffSize, this.bindAdd, this.filters,
+          this.hostnameForSenders, this.manualStart);
+      ((CacheCreation)cache).addGatewayReceiver(recv);
+    }
+    return recv;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
new file mode 100644
index 0000000..b8768d4
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
@@ -0,0 +1,251 @@
+/*
+ * 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.internal.cache.wan;
+
+import java.io.IOException;
+import java.net.BindException;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.ResourceEvent;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.net.SocketCreator;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+
+/**
+ * @since GemFire 7.0
+ */
+@SuppressWarnings("deprecation")
+public class GatewayReceiverImpl implements GatewayReceiver {
+
+  private static final Logger logger = LogService.getLogger();
+  
+  private String host;
+
+  private int startPort;
+  
+  private int endPort;
+  
+  private int port;
+
+  private int timeBetPings;
+
+  private int socketBufferSize;
+  
+  private boolean manualStart;
+
+  private final List<GatewayTransportFilter> filters;
+
+  private String bindAdd;
+  
+  private CacheServer receiver;
+
+  private final GemFireCacheImpl cache;
+  
+  public GatewayReceiverImpl(Cache cache, int startPort,
+      int endPort, int timeBetPings, int buffSize, String bindAdd,
+      List<GatewayTransportFilter> filters, String hostnameForSenders, boolean manualStart) {
+    this.cache = (GemFireCacheImpl)cache;
+    
+    /*
+     * If user has set hostNameForSenders then it should take precedence over
+     * bindAddress. If user hasn't set either hostNameForSenders or bindAddress
+     * then getLocalHost().getHostName() should be used.
+     */
+    if (hostnameForSenders == null || hostnameForSenders.isEmpty()) {
+      if (bindAdd == null || bindAdd.isEmpty()) {
+        try {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiverImpl_USING_LOCAL_HOST));
+          this.host = SocketCreator.getLocalHost().getHostName();
+        } catch (UnknownHostException e) {
+          throw new IllegalStateException(
+              LocalizedStrings.GatewayReceiverImpl_COULD_NOT_GET_HOST_NAME
+                  .toLocalizedString(),
+              e);
+        }
+      } else {
+        this.host = bindAdd;
+      }
+    } else {
+      this.host = hostnameForSenders;
+    }
+
+    this.startPort = startPort;
+    this.endPort = endPort;
+    this.timeBetPings = timeBetPings;
+    this.socketBufferSize = buffSize;
+    this.bindAdd = bindAdd;
+    this.filters = filters;
+    this.manualStart = manualStart;
+  }
+
+  public List<GatewayTransportFilter> getGatewayTransportFilters() {
+    return this.filters;
+  }
+
+  public int getMaximumTimeBetweenPings() {
+    return this.timeBetPings;
+  }
+
+  public int getPort() {
+    return this.port;
+  }
+
+  public int getStartPort() {
+    return this.startPort;
+  }
+  
+  public int getEndPort() {
+    return this.endPort;
+  }
+  
+  public int getSocketBufferSize() {
+    return this.socketBufferSize;
+  }
+
+  public boolean isManualStart() {
+    return this.manualStart;
+  }
+  
+  public CacheServer getServer() {
+    return receiver;
+  }
+  
+  public void start() throws IOException {
+    if (receiver == null) {
+      receiver = this.cache.addCacheServer(true);
+    }
+    if (receiver.isRunning()) {
+      logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_IS_ALREADY_RUNNING));
+      return;
+    }
+    boolean started = false;
+    this.port = getPortToStart();
+    while (!started && this.port != -1) {
+      receiver.setPort(this.port);
+      receiver.setSocketBufferSize(socketBufferSize);
+      receiver.setMaximumTimeBetweenPings(timeBetPings);
+      receiver.setHostnameForClients(host);
+      receiver.setBindAddress(bindAdd);
+      receiver.setGroups(new String[] { GatewayReceiverImpl.RECEIVER_GROUP });
+      ((CacheServerImpl)receiver).setGatewayTransportFilter(this.filters);
+      try {
+        ((CacheServerImpl)receiver).start();
+        started = true;
+      } catch (BindException be) {
+        if (be.getCause() != null
+            && be.getCause().getMessage()
+                .contains("assign requested address")) {
+          throw new GatewayReceiverException(
+              LocalizedStrings.SocketCreator_FAILED_TO_CREATE_SERVER_SOCKET_ON_0_1
+                  .toLocalizedString(new Object[] { bindAdd,
+                      Integer.valueOf(this.port) }));
+        }
+        // ignore as this port might have been used by other threads.
+        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_Address_Already_In_Use, this.port));
+        this.port = getPortToStart();
+      } catch (SocketException se) {
+        if (se.getMessage().contains("Address already in use")) {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_Address_Already_In_Use, this.port));
+          this.port = getPortToStart();
+
+        } else {
+          throw se;
+        }
+      }
+      
+    }
+    if (!started) {
+      throw new IllegalStateException(
+          "No available free port found in the given range.");
+    }
+    logger.info(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_STARTED_ON_PORT, this.port));
+
+    InternalDistributedSystem system = this.cache.getDistributedSystem();
+    system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_START, this);
+
+  }
+  
+  private int getPortToStart(){
+    // choose a random port from the given port range
+    int rPort;
+    if (this.startPort == this.endPort) {
+      rPort = this.startPort;
+    } else {
+      rPort = AvailablePort.getRandomAvailablePortInRange(this.startPort,
+          this.endPort, AvailablePort.SOCKET);
+    }
+    return rPort;
+  }
+  
+  public void stop() {
+    if(!isRunning()){
+      throw new GatewayReceiverException(LocalizedStrings.GatewayReceiver_IS_NOT_RUNNING.toLocalizedString());
+    }
+    receiver.stop();
+
+//    InternalDistributedSystem system = ((GemFireCacheImpl) this.cache)
+//        .getDistributedSystem();
+//    system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_STOP, this);
+
+  }
+
+  public String getHost() {
+    return this.host;
+  }
+
+  public String getBindAddress() {
+    return this.bindAdd;
+  }
+
+  public boolean isRunning() {
+    if (this.receiver != null) {
+      return this.receiver.isRunning();
+    }
+    return false;
+  }
+  
+  public String toString() {
+    return new StringBuffer()
+      .append("Gateway Receiver")
+      .append("@").append(Integer.toHexString(hashCode()))
+      .append(" [")
+      .append("host='").append(getHost())
+      .append("'; port=").append(getPort())
+      .append("; bindAddress=").append(getBindAddress())
+      .append("; maximumTimeBetweenPings=").append(getMaximumTimeBetweenPings())
+      .append("; socketBufferSize=").append(getSocketBufferSize())
+      .append("; isManualStart=").append(isManualStart())
+      .append("; group=").append(Arrays.toString(new String[]{GatewayReceiverImpl.RECEIVER_GROUP}))
+      .append("]")
+      .toString();
+  }
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
new file mode 100644
index 0000000..d2302c4
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
@@ -0,0 +1,802 @@
+/*
+ * 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.internal.cache.wan;
+
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import com.gemstone.gemfire.GemFireIOException;
+import com.gemstone.gemfire.internal.cache.tier.sockets.MessageTooLargeException;
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.CancelException;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.client.ServerConnectivityException;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.cache.client.internal.Connection;
+import com.gemstone.gemfire.cache.client.internal.pooling.ConnectionDestroyedException;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.distributed.internal.ServerLocation;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import com.gemstone.gemfire.pdx.PdxRegistryMismatchException;
+import com.gemstone.gemfire.security.GemFireSecurityException;
+import com.gemstone.gemfire.cache.client.internal.SenderProxy;
+
+/**
+ * @since GemFire 7.0
+ *
+ */
+public class GatewaySenderEventRemoteDispatcher implements
+    GatewaySenderEventDispatcher {
+
+  private static final Logger logger = LogService.getLogger();
+  
+  private final AbstractGatewaySenderEventProcessor processor;
+
+  private volatile Connection connection;
+
+  private final Set<String> notFoundRegions = new HashSet<String>();
+  
+  private final Object notFoundRegionsSync = new Object();
+  
+  private final AbstractGatewaySender sender;
+  
+  private AckReaderThread ackReaderThread;
+  
+  private ReentrantReadWriteLock connectionLifeCycleLock = new ReentrantReadWriteLock();
+  
+  /**
+   * This count is reset to 0 each time a successful connection is made.
+   */
+  private int failedConnectCount = 0;
+  
+  public GatewaySenderEventRemoteDispatcher(AbstractGatewaySenderEventProcessor eventProcessor) {
+    this.processor = eventProcessor;
+    this.sender = eventProcessor.getSender();
+//    this.ackReaderThread = new AckReaderThread(sender);
+    try {
+      initializeConnection();
+    }
+    catch (GatewaySenderException e) {
+      if (e.getCause() instanceof GemFireSecurityException) {
+        throw e;
+      }
+    }
+  }
+  
+  protected GatewayAck readAcknowledgement() {
+    SenderProxy sp = new SenderProxy(this.processor.getSender().getProxy());
+    GatewayAck ack = null;
+    Exception ex;
+    try {
+      connection = getConnection(false);
+      if (logger.isDebugEnabled()) {
+        logger.debug(" Receiving ack on the thread {}", connection);
+      }
+      this.connectionLifeCycleLock.readLock().lock();
+      try {
+        if (connection != null) {
+          ack = (GatewayAck)sp.receiveAckFromReceiver(connection);
+        }
+      } finally {
+        this.connectionLifeCycleLock.readLock().unlock();
+      }
+
+    } catch (Exception e) {
+      Throwable t = e.getCause();
+      if (t instanceof BatchException70) {
+        // A BatchException has occurred.
+        // Do not process the connection as dead since it is not dead.
+        ex = (BatchException70)t;
+      } else if (e instanceof GatewaySenderException) { //This Exception is thrown from getConnection
+        ex = (Exception) e.getCause();
+      }else {
+        ex = e;
+        // keep using the connection if we had a batch exception. Else, destroy
+        // it
+        destroyConnection();
+      }
+      if (this.sender.getProxy() == null || this.sender.getProxy().isDestroyed()) {
+        // if our pool is shutdown then just be silent
+      } else if (ex instanceof IOException
+          || (ex instanceof ServerConnectivityException && !(ex.getCause() instanceof PdxRegistryMismatchException))
+          || ex instanceof ConnectionDestroyedException) {
+        // If the cause is an IOException or a ServerException, sleep and retry.
+        // Sleep for a bit and recheck.
+        try {
+          Thread.sleep(100);
+        } catch (InterruptedException ie) {
+          Thread.currentThread().interrupt();
+        }
+      } else {
+        if (!(ex instanceof CancelException)) {
+          logger.fatal(LocalizedMessage.create(
+                  LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH),
+                  ex);
+        }
+        this.processor.setIsStopped(true);
+      }
+    }
+    return ack;
+  }
+  
+  @Override
+  public boolean dispatchBatch(List events, boolean isRetry) {
+    GatewaySenderStats statistics = this.sender.getStatistics();
+    boolean success = false;
+    try {
+      long start = statistics.startTime();
+      success =_dispatchBatch(events, isRetry);
+      if (success) {
+        statistics.endBatch(start, events.size());
+      }
+    } catch (GatewaySenderException ge) {
+
+      Throwable t = ge.getCause();
+      if (this.sender.getProxy() == null || this.sender.getProxy().isDestroyed()) {
+        // if our pool is shutdown then just be silent
+      } else if (t instanceof IOException
+          || t instanceof ServerConnectivityException
+          || t instanceof ConnectionDestroyedException
+          || t instanceof MessageTooLargeException
+          || t instanceof IllegalStateException) {
+        this.processor.handleException();
+        // If the cause is an IOException or a ServerException, sleep and retry.
+        // Sleep for a bit and recheck.
+        try {
+          Thread.sleep(100);
+        } catch (InterruptedException ie) {
+          Thread.currentThread().interrupt();
+        }
+        if (logger.isDebugEnabled()) {
+          logger.debug("Because of IOException, failed to dispatch a batch with id : {}", this.processor.getBatchId());
+        }
+      }
+      else {
+        logger.fatal(LocalizedMessage.create(
+            LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH), ge);
+        this.processor.setIsStopped(true);
+      }
+    }
+    catch (CancelException e) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Stopping the processor because cancellation occurred while processing a batch");
+      }
+      this.processor.setIsStopped(true);
+      throw e;
+    } catch (Exception e) {
+      this.processor.setIsStopped(true);
+      logger.fatal(LocalizedMessage.create(
+              LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH),
+              e);
+    }
+    return success;
+  }
+
+  private boolean _dispatchBatch(List events, boolean isRetry) {
+    Exception ex = null;
+    int currentBatchId = this.processor.getBatchId();
+    connection = getConnection(true);
+    int batchIdForThisConnection = this.processor.getBatchId();
+    GatewaySenderStats statistics = this.sender.getStatistics();
+    // This means we are writing to a new connection than the previous batch.
+    // i.e The connection has been reset. It also resets the batchId.
+    if (currentBatchId != batchIdForThisConnection
+        || this.processor.isConnectionReset()) {
+      return false;
+    }
+    try {
+      if (this.processor.isConnectionReset()) {
+        isRetry = true;
+      }
+      SenderProxy sp = new SenderProxy(this.sender.getProxy());
+      this.connectionLifeCycleLock.readLock().lock();
+      try {
+        if (connection != null) {
+          sp.dispatchBatch_NewWAN(connection, events, currentBatchId, isRetry);
+          if (logger.isDebugEnabled()) {
+            logger.debug("{} : Dispatched batch (id={}) of {} events, queue size: {} on connection {}",
+                this.processor.getSender(), currentBatchId,  events.size(), this.processor.getQueue().size(), connection);
+          }
+        } else {
+          throw new ConnectionDestroyedException();
+        }
+      }
+      finally{
+        this.connectionLifeCycleLock.readLock().unlock();
+      }
+      return true;
+    }
+    catch (ServerOperationException e) {
+      Throwable t = e.getCause();
+      if (t instanceof BatchException70) {
+        // A BatchException has occurred.
+        // Do not process the connection as dead since it is not dead.
+        ex = (BatchException70)t;
+      }
+      else {
+        ex = e;
+        // keep using the connection if we had a batch exception. Else, destroy it
+        destroyConnection();
+      }
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
+              new Object[] {this, Integer.valueOf(currentBatchId), connection}), ex);
+    }
+    catch (GemFireIOException e) {
+      Throwable t = e.getCause();
+      if (t instanceof MessageTooLargeException) {
+        // A MessageTooLargeException has occurred.
+        // Do not process the connection as dead since it is not dead.
+        ex = (MessageTooLargeException)t;
+        // Reduce the batch size by half of the configured batch size or number of events in the current batch (whichever is less)
+        int newBatchSize = Math.min(events.size(), this.processor.getBatchSize())/2;
+        logger.warn(LocalizedMessage.create(
+            LocalizedStrings.GatewaySenderEventRemoteDispatcher_MESSAGE_TOO_LARGE_EXCEPTION, new Object[] { events.size(), newBatchSize }), e);
+        this.processor.setBatchSize(newBatchSize);
+        statistics.incBatchesResized();
+      }
+      else {
+        ex = e;
+        // keep using the connection if we had a MessageTooLargeException. Else, destroy it
+        destroyConnection();
+      }
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
+              new Object[] {this, Integer.valueOf(currentBatchId), connection}), ex);
+    }
+    catch (IllegalStateException e) {
+      this.processor.setException(new GatewaySenderException(e));
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
+              new Object[] {this, Integer.valueOf(currentBatchId), connection}), e);
+    }
+    catch (Exception e) {
+      // An Exception has occurred. Get its cause.
+      Throwable t = e.getCause();
+      if (t instanceof IOException) {
+        // An IOException has occurred.
+        ex = (IOException)t;
+      } else {
+        ex = e;
+      }
+      //the cause is not going to be BatchException70. So, destroy the connection
+      destroyConnection();
+      
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
+              new Object[] {this, Integer.valueOf(currentBatchId), connection}), ex);
+    }
+  }
+  
+  /**
+   * Acquires or adds a new <code>Connection</code> to the corresponding
+   * <code>Gateway</code>
+   *
+   * @return the <code>Connection</code>
+   *
+   * @throws GatewaySenderException
+   */
+  public Connection getConnection(boolean startAckReaderThread) throws GatewaySenderException{
+    if (this.processor.isStopped()) {
+      return null;
+    }
+    // IF the connection is null 
+    // OR the connection's ServerLocation doesn't match with the one stored in sender
+    // THEN initialize the connection
+    if(!this.sender.isParallel()) {
+      if (this.connection == null || this.connection.isDestroyed()
+          || !this.connection.getServer().equals(this.sender.getServerLocation())) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Initializing new connection as serverLocation of old connection is : {} and the serverLocation to connect is {}",
+              ((this.connection == null) ? "null" : this.connection.getServer()),
+              this.sender.getServerLocation());
+        }
+        // Initialize the connection
+        initializeConnection();
+      }
+    } else {
+      if (this.connection == null || this.connection.isDestroyed()) {
+        initializeConnection();
+      }
+    }
+    
+    // Here we might wait on a connection to another server if I was secondary
+    // so don't start waiting until I am primary
+    Cache cache = this.sender.getCache();
+    if (cache != null && !cache.isClosed()) {
+      if (this.sender.isPrimary() && (this.connection != null)) {
+        if (this.ackReaderThread == null || !this.ackReaderThread.isRunning()) {
+          this.ackReaderThread = new AckReaderThread(this.sender, this.processor);
+          this.ackReaderThread.start();
+          this.ackReaderThread.waitForRunningAckReaderThreadRunningState();
+        }
+      }
+    }
+    return this.connection;
+  }
+  
+  public void destroyConnection() {
+    this.connectionLifeCycleLock.writeLock().lock();
+    try {
+      Connection con = this.connection;
+      if (con != null) {
+        if (!con.isDestroyed()) {
+          con.destroy();
+          this.sender.getProxy().returnConnection(con);
+        }
+        
+        // Reset the connection so the next time through a new one will be
+        // obtained
+        this.connection = null;
+        this.sender.setServerLocation(null);
+      }
+    }
+    finally {
+      this.connectionLifeCycleLock.writeLock().unlock();
+    }
+  }
+
+  /**
+   * Initializes the <code>Connection</code>.
+   *
+   * @throws GatewaySenderException
+   */
+  private void initializeConnection() throws GatewaySenderException,
+      GemFireSecurityException {
+    this.connectionLifeCycleLock.writeLock().lock(); 
+    try {
+      // Attempt to acquire a connection
+      if (this.sender.getProxy() == null
+          || this.sender.getProxy().isDestroyed()) {
+        this.sender.initProxy();
+      } else {
+        this.processor.resetBatchId();
+      }
+      Connection con;
+      try {
+        if (this.sender.isParallel()) {
+          /*
+           * TODO - The use of acquireConnection should be removed
+           * from the gateway code. This method is fine for tests,
+           * but these connections should really be managed inside
+           * the pool code. If the gateway needs to persistent connection
+           * to a single server, which should create have the OpExecutor
+           * that holds a reference to the connection (similar to the way
+           * we do with thread local connections).
+           * Use {@link ExecutablePool#setupServerAffinity(boolean)} for
+           * gateway code
+           */
+          con = this.sender.getProxy().acquireConnection();
+          // For parallel sender, setting server location will not matter.
+          // everytime it will ask for acquire connection whenever it needs it. I
+          // am saving this server location for command purpose
+          sender.setServerLocation(con.getServer());  
+        } else {
+          synchronized (this.sender
+              .getLockForConcurrentDispatcher()) {
+            ServerLocation server = this.sender.getServerLocation();
+            if (server != null) {
+              if (logger.isDebugEnabled()) {
+                logger.debug("ServerLocation is: {}. Connecting to this serverLocation...", server);
+              }
+              con = this.sender.getProxy().acquireConnection(server);
+            } else {
+              if (logger.isDebugEnabled()) {
+                logger.debug("ServerLocation is null. Creating new connection. ");
+              }
+              con = this.sender.getProxy().acquireConnection();
+              // Acquired connection from pool!! Update the server location
+              // information in the sender and
+              // distribute the information to other senders ONLY IF THIS SENDER
+              // IS
+              // PRIMARY
+              if (this.sender.isPrimary()) {
+                if (sender.getServerLocation() == null) {
+                  sender.setServerLocation(con.getServer());
+                }
+                new UpdateAttributesProcessor(this.sender).distribute(false);
+              }
+            }
+          }
+        }
+      } catch (ServerConnectivityException e) {
+        this.failedConnectCount++;
+        Throwable ex = null;
+
+        if (e.getCause() instanceof GemFireSecurityException) {
+          ex = e.getCause();
+          if (logConnectionFailure()) {
+            // only log this message once; another msg is logged once we connect
+            logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_0_COULD_NOT_CONNECT_1,
+                new Object[] { this.processor.getSender().getId(), ex.getMessage() }));
+          }
+          throw new GatewaySenderException(ex);
+        }
+        List<ServerLocation> servers = this.sender.getProxy()
+            .getCurrentServers();
+        String ioMsg = null;
+        if (servers.size() == 0) {
+          ioMsg = LocalizedStrings.GatewayEventRemoteDispatcher_THERE_ARE_NO_ACTIVE_SERVERS
+              .toLocalizedString();
+        } else {
+          final StringBuilder buffer = new StringBuilder();
+          for (ServerLocation server : servers) {
+            String endpointName = String.valueOf(server);
+            if (buffer.length() > 0) {
+              buffer.append(", ");
+            }
+            buffer.append(endpointName);
+          }
+          ioMsg = LocalizedStrings.GatewayEventRemoteDispatcher_NO_AVAILABLE_CONNECTION_WAS_FOUND_BUT_THE_FOLLOWING_ACTIVE_SERVERS_EXIST_0
+              .toLocalizedString(buffer.toString());
+        }
+        ex = new IOException(ioMsg);
+        // Set the serverLocation to null so that a new connection can be
+        // obtained in next attempt
+        this.sender.setServerLocation(null);
+        if (this.failedConnectCount == 1) {
+          // only log this message once; another msg is logged once we connect
+          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT,
+                  this.processor.getSender().getId()));
+
+        }
+        // Wrap the IOException in a GatewayException so it can be processed the
+        // same as the other exceptions that might occur in sendBatch.
+        throw new GatewaySenderException(
+            LocalizedStrings.GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT
+                .toLocalizedString(this.processor.getSender().getId()), ex);
+      }
+      if (this.failedConnectCount > 0) {
+        Object[] logArgs = new Object[] { this.processor.getSender().getId(),
+            con, Integer.valueOf(this.failedConnectCount) };
+        logger.info(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_0_USING_1_AFTER_2_FAILED_CONNECT_ATTEMPTS,
+                logArgs));
+        this.failedConnectCount = 0;
+      } else {
+        Object[] logArgs = new Object[] { this.processor.getSender().getId(),
+            con };
+        logger.info(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_0_USING_1, logArgs));
+      }
+      this.connection = con;
+      this.processor.checkIfPdxNeedsResend(this.connection.getQueueStatus().getPdxSize());
+    }
+    catch (ConnectionDestroyedException e) {
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT.toLocalizedString(this.processor
+              .getSender().getId()), e);
+    }
+    finally {
+      this.connectionLifeCycleLock.writeLock().unlock();
+    }
+  }
+
+  protected boolean logConnectionFailure() {
+    // always log the first failure
+	if (logger.isDebugEnabled() || this.failedConnectCount == 0) {
+	  return true;
+	}
+	else {
+	  // subsequent failures will be logged on 30th, 300th, 3000th try
+	  // each try is at 100millis from higher layer so this accounts for logging
+	  // after 3s, 30s and then every 5mins
+	  if (this.failedConnectCount >= 3000) {
+	    return (this.failedConnectCount % 3000) == 0;
+	  }
+	  else {
+	    return (this.failedConnectCount == 30 || this.failedConnectCount == 300);
+	  }
+    }
+  }
+  
+  public static class GatewayAck {
+    private int batchId;
+
+    private int numEvents;
+
+    private BatchException70 be;
+
+    public GatewayAck(BatchException70 be, int bId) {
+      this.be = be;
+      this.batchId = bId;
+    }
+
+    public GatewayAck(int batchId, int numEvents) {
+      this.batchId = batchId;
+      this.numEvents = numEvents;
+    }
+
+    /**
+     * @return the numEvents
+     */
+    public int getNumEvents() {
+      return numEvents;
+    }
+
+    /**
+     * @return the batchId
+     */
+    public int getBatchId() {
+      return batchId;
+    }
+
+    public BatchException70 getBatchException() {
+      return this.be;
+    }
+  }
+    
+  class AckReaderThread extends Thread {
+
+    private Object runningStateLock = new Object();
+
+    /**
+     * boolean to make a shutdown request
+     */
+    private volatile boolean shutdown = false;
+
+    private final GemFireCacheImpl cache;
+
+    private volatile boolean ackReaderThreadRunning = false;
+
+    public AckReaderThread(GatewaySender sender, AbstractGatewaySenderEventProcessor processor) {
+      super("AckReaderThread for : " + processor.getName());
+      this.setDaemon(true);
+      this.cache = (GemFireCacheImpl)((AbstractGatewaySender)sender).getCache();
+    }
+
+    public void waitForRunningAckReaderThreadRunningState() {
+      synchronized (runningStateLock) {
+        while (!this.ackReaderThreadRunning) {
+          try {
+            this.runningStateLock.wait();
+          } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            break;
+          }
+        }
+      }
+    }
+
+    private boolean checkCancelled() {
+      if (shutdown) {
+        return true;
+      }
+
+      if (cache.getCancelCriterion().isCancelInProgress()) {
+        return true;
+      }
+      return false;
+    }
+
+    @Override
+    public void run() {
+      if (logger.isDebugEnabled()) {
+        logger.debug("AckReaderThread started.. ");
+      }
+
+      synchronized (runningStateLock) {
+        ackReaderThreadRunning = true;
+        this.runningStateLock.notifyAll();
+      }
+
+      try {
+        for (;;) {
+          if (checkCancelled()) {
+            break;
+          }
+          GatewayAck ack = readAcknowledgement();
+          if (ack != null) {
+            boolean gotBatchException = ack.getBatchException() != null;
+            int batchId = ack.getBatchId();
+            int numEvents = ack.getNumEvents();
+
+            // If the batch is successfully processed, remove it from the
+            // queue.
+            if (gotBatchException) {
+              logger.info(LocalizedMessage.create(
+                  LocalizedStrings.GatewaySenderEventRemoteDispatcher_GATEWAY_SENDER_0_RECEIVED_ACK_FOR_BATCH_ID_1_WITH_EXCEPTION,
+                      new Object[] { processor.getSender(), ack.getBatchId() }, ack.getBatchException()));
+              // If we get PDX related exception in the batch exception then try
+              // to resend all the pdx events as well in the next batch.
+              final GatewaySenderStats statistics = sender.getStatistics();
+              statistics.incBatchesRedistributed();
+              // log batch exceptions and remove all the events if remove from
+              // exception is true
+              // do not remove if it is false
+              logBatchExceptions(ack.getBatchException());
+              processor.handleSuccessBatchAck(batchId);
+
+            } // unsuccessful batch
+            else { // The batch was successful.
+              if (logger.isDebugEnabled()) {
+                logger.debug("Gateway Sender {} : Received ack for batch id {} of {} events",
+                    processor.getSender(), ack.getBatchId(), ack.getNumEvents());
+              }
+              processor.handleSuccessBatchAck(batchId);
+            }
+          } else {
+            // If we have received IOException.
+            if (logger.isDebugEnabled()) {
+              logger.debug("{}: Received null ack from remote site.", processor.getSender());
+            }
+            processor.handleException();
+            try { // This wait is before trying to getting new connection to
+                  // receive ack. Without this there will be continuous call to
+                  // getConnection
+              Thread.sleep(GatewaySender.CONNECTION_RETRY_INTERVAL);
+            } catch (InterruptedException e) {
+              Thread.currentThread().interrupt();
+            }
+          }
+        }
+      } catch (Exception e) {
+        if (!checkCancelled()) {
+          logger.fatal(LocalizedMessage.create(
+              LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH) ,e);
+        }
+        sender.getLifeCycleLock().writeLock().lock();
+        try {
+          processor.stopProcessing();
+          sender.clearTempEventsAfterSenderStopped();
+        } finally {
+          sender.getLifeCycleLock().writeLock().unlock();
+        }
+        // destroyConnection();
+      } finally {
+        if (logger.isDebugEnabled()) {
+          logger.debug("AckReaderThread exiting. ");
+        }
+        ackReaderThreadRunning = false;
+      }
+
+    }
+
+    /**
+     * @param exception 
+     * 
+     */
+    private void logBatchExceptions(BatchException70 exception) {
+      for (BatchException70 be : exception.getExceptions()) {
+        boolean logWarning = true;
+        if (be.getCause() instanceof RegionDestroyedException) {
+          RegionDestroyedException rde = (RegionDestroyedException)be
+              .getCause();
+          synchronized (notFoundRegionsSync) {
+            if (notFoundRegions.contains(rde.getRegionFullPath())) {
+              logWarning = false;
+            } else {
+              notFoundRegions.add(rde.getRegionFullPath());
+            }
+          }
+        } else if (be.getCause() instanceof IllegalStateException
+            && be.getCause().getMessage().contains("Unknown pdx type")) {
+          List<GatewaySenderEventImpl> pdxEvents = processor
+              .getBatchIdToPDXEventsMap().get(be.getBatchId());
+          if (logWarning) {
+            logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_A_BATCHEXCEPTION_OCCURRED_PROCESSING_PDX_EVENT__0,
+                    be.getIndex()), be);
+          }
+          if (pdxEvents != null) {
+            for (GatewaySenderEventImpl senderEvent : pdxEvents) {
+              senderEvent.isAcked = false;
+            }
+            GatewaySenderEventImpl gsEvent = pdxEvents.get(be.getIndex());
+            if (logWarning) {
+              logger.warn(LocalizedMessage.create(
+                  LocalizedStrings.GatewayEventRemoteDispatcher_THE_EVENT_BEING_PROCESSED_WHEN_THE_BATCHEXCEPTION_OCCURRED_WAS__0, gsEvent));
+            }
+          }
+          continue;
+        }
+        if (logWarning) {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_A_BATCHEXCEPTION_OCCURRED_PROCESSING_EVENT__0,
+              be.getIndex()), be);
+        }
+        List<GatewaySenderEventImpl>[] eventsArr = processor.getBatchIdToEventsMap().get(be.getBatchId()); 
+        if (eventsArr != null) {
+          List<GatewaySenderEventImpl> filteredEvents = eventsArr[1];
+          GatewaySenderEventImpl gsEvent = (GatewaySenderEventImpl)filteredEvents
+              .get(be.getIndex());
+          if (logWarning) {
+            logger.warn(LocalizedMessage.create(
+                LocalizedStrings.GatewayEventRemoteDispatcher_THE_EVENT_BEING_PROCESSED_WHEN_THE_BATCHEXCEPTION_OCCURRED_WAS__0, gsEvent));
+          }
+        }
+      }
+    }
+
+    boolean isRunning() {
+      return this.ackReaderThreadRunning;
+    }
+
+    public void shutdown() {
+      // we need to destroy connection irrespective of we are listening on it or
+      // not. No need to take lock as the reader thread may be blocked and we might not
+      // get chance to destroy unless that returns.
+      if (connection != null) {
+        Connection conn = connection;
+        shutDownAckReaderConnection();
+        if (!conn.isDestroyed()) {
+          conn.destroy();
+          sender.getProxy().returnConnection(conn);
+        }
+      }
+      this.shutdown = true;
+      boolean interrupted = Thread.interrupted();
+      try {
+        this.join(15 * 1000);
+      } catch (InterruptedException e) {
+        interrupted = true;
+      } finally {
+        if (interrupted) {
+          Thread.currentThread().interrupt();
+        }
+      }
+      if (this.isAlive()) {
+        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_ACKREADERTHREAD_IGNORED_CANCELLATION));
+      }
+    }
+
+    private void shutDownAckReaderConnection() {
+      Connection conn = connection;
+      //attempt to unblock the ackReader thread by shutting down the inputStream, if it was stuck on a read
+      try {
+        if (conn != null && conn.getInputStream() != null) {
+          conn.getInputStream().close();
+        }
+      } catch (IOException e) {
+        logger.warn("Unable to shutdown AckReaderThread Connection");
+      } catch (ConnectionDestroyedException e) {
+        logger.info("AckReader shutting down and connection already destroyed");
+      }
+
+    }
+  }
+    
+  public void stopAckReaderThread() {
+    if (this.ackReaderThread != null) {
+      this.ackReaderThread.shutdown();
+    }
+  }
+  
+  @Override
+  public boolean isRemoteDispatcher() {
+    return true;
+  }
+
+  @Override
+  public boolean isConnectedToRemote() {
+      return connection != null;
+  }
+  
+  public void stop() {
+    stopAckReaderThread();
+    if(this.processor.isStopped()) {
+      destroyConnection();
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
new file mode 100644
index 0000000..4974c6f
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
@@ -0,0 +1,382 @@
+/*
+ * 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.internal.cache.wan;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.client.internal.LocatorDiscoveryCallback;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewayEventSubstitutionFilter;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderImpl;
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderImpl;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.ParallelGatewaySenderCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.SerialGatewaySenderCreation;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+
+/**
+ * 
+ * @since GemFire 7.0
+ * 
+ */
+public class GatewaySenderFactoryImpl implements
+    InternalGatewaySenderFactory {
+
+  private static final Logger logger = LogService.getLogger();
+  
+  /**
+   * Used internally to pass the attributes from this factory to the real
+   * GatewaySender it is creating.
+   */
+  private GatewaySenderAttributes attrs = new GatewaySenderAttributes();
+
+  private Cache cache;
+
+  private static final AtomicBoolean GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY_CHECKED = new AtomicBoolean(false);
+
+  public GatewaySenderFactoryImpl(Cache cache) {
+    this.cache = cache;
+  }
+
+  public GatewaySenderFactory setParallel(boolean isParallel){
+    this.attrs.isParallel = isParallel;
+    return this;
+  }
+  
+  public GatewaySenderFactory setForInternalUse(boolean isForInternalUse) {
+    this.attrs.isForInternalUse = isForInternalUse;
+    return this;
+  }
+  
+  public GatewaySenderFactory addGatewayEventFilter(
+      GatewayEventFilter filter) {
+    this.attrs.addGatewayEventFilter(filter);
+    return this;
+  }
+
+  public GatewaySenderFactory addGatewayTransportFilter(
+      GatewayTransportFilter filter) {
+    this.attrs.addGatewayTransportFilter(filter);
+    return this;
+  }
+
+  public GatewaySenderFactory addAsyncEventListener(
+      AsyncEventListener listener) {
+    this.attrs.addAsyncEventListener(listener);
+    return this;
+  }
+  
+  public GatewaySenderFactory setSocketBufferSize(int socketBufferSize) {
+    this.attrs.socketBufferSize = socketBufferSize;
+    return this;
+  }
+
+  public GatewaySenderFactory setSocketReadTimeout(int socketReadTimeout) {
+    this.attrs.socketReadTimeout = socketReadTimeout;
+    return this;
+  }
+
+  public GatewaySenderFactory setDiskStoreName(String diskStoreName) {
+    this.attrs.diskStoreName = diskStoreName;
+    return this;
+  }
+
+  public GatewaySenderFactory setMaximumQueueMemory(int maximumQueueMemory) {
+    this.attrs.maximumQueueMemory = maximumQueueMemory;
+    return this;
+  }
+
+  public GatewaySenderFactory setBatchSize(int batchSize) {
+    this.attrs.batchSize = batchSize;
+    return this;
+  }
+
+  public GatewaySenderFactory setBatchTimeInterval(int batchTimeInterval) {
+    this.attrs.batchTimeInterval = batchTimeInterval;
+    return this;
+  }
+
+  public GatewaySenderFactory setBatchConflationEnabled(
+      boolean enableBatchConflation) {
+    this.attrs.isBatchConflationEnabled = enableBatchConflation;
+    return this;
+  }
+
+  public GatewaySenderFactory setPersistenceEnabled(
+      boolean enablePersistence) {
+    this.attrs.isPersistenceEnabled = enablePersistence;
+    return this;
+  }
+
+  public GatewaySenderFactory setAlertThreshold(int threshold) {
+    this.attrs.alertThreshold = threshold;
+    return this;
+  }
+
+  public GatewaySenderFactory setManualStart(boolean start) {
+    this.attrs.manualStart = start;
+    return this;
+  }
+
+  public GatewaySenderFactory setLocatorDiscoveryCallback(
+      LocatorDiscoveryCallback locCallback) {
+    this.attrs.locatorDiscoveryCallback = locCallback;
+    return this;
+  }
+
+  @Override
+  public GatewaySenderFactory setDiskSynchronous(boolean isSynchronous) {
+    this.attrs.isDiskSynchronous = isSynchronous;
+    return this;
+  }
+  
+  @Override
+  public GatewaySenderFactory setDispatcherThreads(int numThreads) {
+    if ((numThreads > 1) && this.attrs.policy == null) {
+      this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
+    }
+    this.attrs.dispatcherThreads = numThreads;
+    return this;
+  }
+
+  public GatewaySenderFactory setParallelFactorForReplicatedRegion(int parallel) {
+    this.attrs.parallelism = parallel;
+    this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
+    return this;
+  }    
+    
+  @Override
+  public GatewaySenderFactory setOrderPolicy(OrderPolicy policy) {
+    this.attrs.policy = policy;
+    return this;
+  }
+  
+  public GatewaySenderFactory setBucketSorted(boolean isBucketSorted){
+    this.attrs.isBucketSorted = isBucketSorted;
+    return this;
+  }
+  public GatewaySender create(String id, int remoteDSId) {
+    int myDSId = InternalDistributedSystem.getAnyInstance()
+        .getDistributionManager().getDistributedSystemId();
+    if (remoteDSId == myDSId) {
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewaySenderImpl_GATEWAY_0_CANNOT_BE_CREATED_WITH_REMOTE_SITE_ID_EQUAL_TO_THIS_SITE_ID
+              .toLocalizedString(id));
+    }
+    if (remoteDSId < 0) {
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewaySenderImpl_GATEWAY_0_CANNOT_BE_CREATED_WITH_REMOTE_SITE_ID_LESS_THAN_ZERO
+              .toLocalizedString(id));
+    }
+    this.attrs.id = id;
+    this.attrs.remoteDs = remoteDSId;
+    GatewaySender sender = null;
+
+    if(this.attrs.getDispatcherThreads() <= 0){
+      throw new GatewaySenderException(
+          LocalizedStrings.GatewaySenderImpl_GATEWAY_SENDER_0_CANNOT_HAVE_DISPATCHER_THREADS_LESS_THAN_1
+              .toLocalizedString(id));
+    }
+
+    // Verify socket read timeout if a proper logger is available
+    if (this.cache instanceof GemFireCacheImpl) {
+      // If socket read timeout is less than the minimum, log a warning.
+      // Ideally, this should throw a GatewaySenderException, but wan dunit tests
+      // were failing, and we were running out of time to change them.
+      if (this.attrs.getSocketReadTimeout() != 0
+          && this.attrs.getSocketReadTimeout() < GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT) {
+        logger.warn(LocalizedMessage.create(LocalizedStrings.Gateway_CONFIGURED_SOCKET_READ_TIMEOUT_TOO_LOW,
+            new Object[] { "GatewaySender " + id, this.attrs.getSocketReadTimeout(), GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT }));
+        this.attrs.socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT;
+      }
+
+      // Log a warning if the old system property is set.
+      if (GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY_CHECKED.compareAndSet(false, true)) {
+        if (System.getProperty(GatewaySender.GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY) != null) {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.Gateway_OBSOLETE_SYSTEM_POPERTY,
+              new Object[] { GatewaySender.GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY, "GatewaySender socket read timeout" }));
+        }
+      }
+    }
+
+    if (this.attrs.isParallel()) {
+//      if(this.attrs.getDispatcherThreads() != 1){
+//        throw new GatewaySenderException(
+//            LocalizedStrings.GatewaySenderImpl_PARALLEL_GATEWAY_SENDER_0_CANNOT_BE_CREATED_WITH_DISPATCHER_THREADS_OTHER_THAN_1
+//                .toLocalizedString(id));
+//      }
+      if ((this.attrs.getOrderPolicy() != null)
+          && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) {
+        throw new GatewaySenderException(
+            LocalizedStrings.GatewaySenderImpl_PARALLEL_GATEWAY_SENDER_0_CANNOT_BE_CREATED_WITH_ORDER_POLICY_1
+                .toLocalizedString(id, this.attrs.getOrderPolicy()));
+      }
+      if (this.cache instanceof GemFireCacheImpl) {
+        sender = new ParallelGatewaySenderImpl(this.cache, this.attrs);
+        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
+        
+        if (!this.attrs.isManualStart()) {
+          sender.start();
+        }
+      }
+      else if (this.cache instanceof CacheCreation) {
+        sender = new ParallelGatewaySenderCreation(this.cache, this.attrs);
+        ((CacheCreation)this.cache).addGatewaySender(sender);
+      }
+    }
+    else {
+      if (this.attrs.getAsyncEventListeners().size() > 0) {
+        throw new GatewaySenderException(
+            LocalizedStrings.SerialGatewaySenderImpl_GATEWAY_0_CANNOT_DEFINE_A_REMOTE_SITE_BECAUSE_AT_LEAST_ONE_LISTENER_IS_ALREADY_ADDED
+                .toLocalizedString(id));
+      }
+//      if (this.attrs.getOrderPolicy() != null) {
+//        if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
+//          throw new GatewaySenderException(
+//              LocalizedStrings.SerialGatewaySender_INVALID_GATEWAY_SENDER_ORDER_POLICY_CONCURRENCY_0
+//                  .toLocalizedString(id));
+//        }
+//      }
+      if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
+        this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
+      }
+      if (this.cache instanceof GemFireCacheImpl) {
+        sender = new SerialGatewaySenderImpl(this.cache, this.attrs);
+        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
+
+        if (!this.attrs.isManualStart()) {
+          sender.start();
+        }
+      }
+      else if (this.cache instanceof CacheCreation) {
+        sender = new SerialGatewaySenderCreation(this.cache, this.attrs);
+        ((CacheCreation)this.cache).addGatewaySender(sender);
+      }
+    }
+    return sender;
+  }
+
+  public GatewaySender create(String id) {
+    this.attrs.id = id;
+    GatewaySender sender = null;
+
+    if(this.attrs.getDispatcherThreads() <= 0) {
+      throw new AsyncEventQueueConfigurationException(
+          LocalizedStrings.AsyncEventQueue_0_CANNOT_HAVE_DISPATCHER_THREADS_LESS_THAN_1
+              .toLocalizedString(id));
+    }
+    
+    if (this.attrs.isParallel()) {
+      if ((this.attrs.getOrderPolicy() != null)
+          && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) {
+        throw new AsyncEventQueueConfigurationException(
+            LocalizedStrings.AsyncEventQueue_0_CANNOT_BE_CREATED_WITH_ORDER_POLICY_1
+                .toLocalizedString(id, this.attrs.getOrderPolicy()));
+      }
+      
+      if (this.cache instanceof GemFireCacheImpl) {
+        sender = new ParallelGatewaySenderImpl(this.cache, this.attrs);
+        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
+        if (!this.attrs.isManualStart()) {
+          sender.start();
+        }
+      }
+      else if (this.cache instanceof CacheCreation) {
+        sender = new ParallelGatewaySenderCreation(this.cache, this.attrs);
+        ((CacheCreation)this.cache).addGatewaySender(sender);
+      }
+    }
+    else {
+//      if (this.attrs.getOrderPolicy() != null) {
+//        if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
+//          throw new AsyncEventQueueConfigurationException(
+//              LocalizedStrings.AsyncEventQueue_INVALID_ORDER_POLICY_CONCURRENCY_0
+//                  .toLocalizedString(id));
+//        }
+//      }
+      if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
+         this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
+      }
+      if (this.cache instanceof GemFireCacheImpl) {
+        sender = new SerialGatewaySenderImpl(this.cache, this.attrs);
+        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
+        if (!this.attrs.isManualStart()) {
+          sender.start();
+        }
+      }
+      else if (this.cache instanceof CacheCreation) {
+        sender = new SerialGatewaySenderCreation(this.cache, this.attrs);
+        ((CacheCreation)this.cache).addGatewaySender(sender);
+      }
+    }
+    return sender;
+  }
+  
+  public GatewaySenderFactory removeGatewayEventFilter(
+      GatewayEventFilter filter) {
+    this.attrs.eventFilters.remove(filter);
+    return this;
+  }
+
+  public GatewaySenderFactory removeGatewayTransportFilter(
+      GatewayTransportFilter filter) {
+    this.attrs.transFilters.remove(filter);
+    return this;
+  } 
+  
+  public GatewaySenderFactory setGatewayEventSubstitutionFilter(
+      GatewayEventSubstitutionFilter filter) {
+    this.attrs.eventSubstitutionFilter = filter;
+    return this;
+  }
+
+  public void configureGatewaySender(GatewaySender senderCreation) {
+    this.attrs.isParallel = senderCreation.isParallel();
+    this.attrs.manualStart = senderCreation.isManualStart();
+    this.attrs.socketBufferSize = senderCreation.getSocketBufferSize();
+    this.attrs.socketReadTimeout = senderCreation.getSocketReadTimeout();
+    this.attrs.isBatchConflationEnabled = senderCreation.isBatchConflationEnabled();
+    this.attrs.batchSize = senderCreation.getBatchSize();
+    this.attrs.batchTimeInterval = senderCreation.getBatchTimeInterval();
+    this.attrs.isPersistenceEnabled = senderCreation.isPersistenceEnabled();
+    this.attrs.diskStoreName = senderCreation.getDiskStoreName();
+    this.attrs.isDiskSynchronous = senderCreation.isDiskSynchronous();
+    this.attrs.maximumQueueMemory = senderCreation.getMaximumQueueMemory();
+    this.attrs.alertThreshold = senderCreation.getAlertThreshold();
+    this.attrs.dispatcherThreads = senderCreation.getDispatcherThreads();
+    this.attrs.policy = senderCreation.getOrderPolicy();
+    for(GatewayEventFilter filter : senderCreation.getGatewayEventFilters()){
+      this.attrs.eventFilters.add(filter);
+    }
+    for(GatewayTransportFilter filter : senderCreation.getGatewayTransportFilters()){
+      this.attrs.transFilters.add(filter);
+    }
+    this.attrs.eventSubstitutionFilter = senderCreation.getGatewayEventSubstitutionFilter();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
new file mode 100644
index 0000000..322b1ba
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
@@ -0,0 +1,263 @@
+/*
+ * 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.internal.cache.wan.parallel;
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.EntryOperation;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueStats;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
+import com.gemstone.gemfire.distributed.internal.DistributionAdvisor;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.ResourceEvent;
+import com.gemstone.gemfire.internal.cache.DistributedRegion;
+import com.gemstone.gemfire.internal.cache.EntryEventImpl;
+import com.gemstone.gemfire.internal.cache.EventID;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
+import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
+import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
+import com.gemstone.gemfire.internal.cache.wan.AbstractRemoteGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySenderEventProcessor;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAdvisor;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderStats;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+
+/**
+ * @since GemFire 7.0
+ *
+ */
+public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
+  
+  private static final Logger logger = LogService.getLogger();
+  
+  final ThreadGroup loggerGroup = LoggingThreadGroup.createThreadGroup(
+      "Remote Site Discovery Logger Group", logger);
+  
+  public ParallelGatewaySenderImpl(){
+    super();
+    this.isParallel = true;
+  }
+  
+  public ParallelGatewaySenderImpl(Cache cache, GatewaySenderAttributes attrs) {
+    super(cache, attrs);
+  }
+  
+  @Override
+  public void start() {
+    this.getLifeCycleLock().writeLock().lock(); 
+    try {
+      if (isRunning()) {
+        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_SENDER_0_IS_ALREADY_RUNNING, this.getId()));
+        return;
+      }
+
+      if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
+        String locators = ((GemFireCacheImpl)this.cache).getDistributedSystem()
+            .getConfig().getLocators();
+        if (locators.length() == 0) {
+          throw new IllegalStateException(
+              LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
+                  .toLocalizedString());
+        }
+      }
+      /*
+       * Now onwards all processing will happen through "ConcurrentParallelGatewaySenderEventProcessor"
+       * we have made "ParallelGatewaySenderEventProcessor" and "ParallelGatewaySenderQueue" as a
+       * utility classes of Concurrent version of processor and queue.
+       */
+      eventProcessor = new RemoteConcurrentParallelGatewaySenderEventProcessor(this);
+      /*if (getDispatcherThreads() > 1) {
+        eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this);
+      } else {
+        eventProcessor = new ParallelGatewaySenderEventProcessor(this);
+      }*/
+      
+      eventProcessor.start();
+      waitForRunningStatus();
+      //Only notify the type registry if this is a WAN gateway queue
+      if(!isAsyncEventQueue()) {
+        ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
+      }
+      new UpdateAttributesProcessor(this).distribute(false);
+     
+      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
+          .getDistributedSystem();
+      system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
+      
+      logger.info(LocalizedMessage.create(LocalizedStrings.ParallelGatewaySenderImpl_STARTED__0, this));
+      
+      enqueueTempEvents();
+    }
+    finally {
+      this.getLifeCycleLock().writeLock().unlock();
+    }
+  }
+  
+//  /**
+//   * The sender is not started but only the message queue i.e. shadowPR is created on the node.
+//   * @param targetPr
+//   */
+//  private void createMessageQueueOnAccessorNode(PartitionedRegion targetPr) {
+//    eventProcessor = new ParallelGatewaySenderEventProcessor(this, targetPr);
+//  }
+  
+
+  @Override
+  public void stop() {
+    this.getLifeCycleLock().writeLock().lock(); 
+    try {
+      if (!this.isRunning()) {
+        return;
+      }
+      // Stop the dispatcher
+      AbstractGatewaySenderEventProcessor ev = this.eventProcessor;
+      //try {
+      if (ev != null && !ev.isStopped()) {
+        ev.stopProcessing();
+      }
+
+      // Stop the proxy (after the dispatcher, so the socket is still
+      // alive until after the dispatcher has stopped)
+      stompProxyDead();
+
+      // Close the listeners
+      for (AsyncEventListener listener : this.listeners) {
+        listener.close();
+      }
+      //stop the running threads, open sockets if any
+      ((ConcurrentParallelGatewaySenderQueue)this.eventProcessor.getQueue()).cleanUp();
+
+      logger.info(LocalizedMessage.create(LocalizedStrings.GatewayImpl_STOPPED__0, this));
+      
+      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
+      .getDistributedSystem();
+      system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_STOP, this);
+      
+      clearTempEventsAfterSenderStopped();
+      // Keep the eventProcessor around so we can ask it for the regionQueues later.
+      // Tests expect to be able to do this. 
+//      } finally {
+//        this.eventProcessor = null;
+//      }
+    }
+    finally {
+      this.getLifeCycleLock().writeLock().unlock();
+    }
+  }
+  
+  @Override
+  public String toString() {
+    StringBuffer sb = new StringBuffer();
+    sb.append("ParallelGatewaySender{");
+    sb.append("id=" + getId());
+    sb.append(",remoteDsId="+ getRemoteDSId());
+    sb.append(",isRunning ="+ isRunning());
+    sb.append("}");
+    return sb.toString();
+  }
+
+  public void fillInProfile(Profile profile) {
+    assert profile instanceof GatewaySenderProfile;
+    GatewaySenderProfile pf = (GatewaySenderProfile)profile;
+    pf.Id = getId();
+    pf.remoteDSId = getRemoteDSId();
+    pf.isRunning = isRunning();
+    pf.isPrimary = isPrimary();
+    pf.isParallel = true;
+    pf.isBatchConflationEnabled = isBatchConflationEnabled();
+    pf.isPersistenceEnabled = isPersistenceEnabled();
+    pf.alertThreshold = getAlertThreshold();
+    pf.manualStart = isManualStart();
+    pf.dispatcherThreads = getDispatcherThreads();
+    pf.orderPolicy = getOrderPolicy();
+    for (com.gemstone.gemfire.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
+      pf.eventFiltersClassNames.add(filter.getClass().getName());
+    }
+    for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
+      pf.transFiltersClassNames.add(filter.getClass().getName());
+    }
+    for (AsyncEventListener listener : getAsyncEventListeners()) {
+      pf.senderEventListenerClassNames.add(listener.getClass().getName());
+    }
+    pf.isDiskSynchronous = isDiskSynchronous();
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(com.gemstone.gemfire.internal.cache.EntryEventImpl)
+   */
+  @Override
+  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
+    int bucketId = -1;
+    //merged from 42004
+    if (clonedEvent.getRegion() instanceof DistributedRegion) {
+//      if (getOrderPolicy() == OrderPolicy.THREAD) {
+//        bucketId = PartitionedRegionHelper.getHashKey(
+//            ((EntryEventImpl)clonedEvent).getEventId().getThreadID(),
+//            getMaxParallelismForReplicatedRegion());
+//      }
+//      else
+        bucketId = PartitionedRegionHelper.getHashKey(clonedEvent.getKey(),
+            getMaxParallelismForReplicatedRegion());
+    }
+    else {
+      bucketId = PartitionedRegionHelper
+          .getHashKey((EntryOperation)clonedEvent);
+    }
+    EventID originalEventId = clonedEvent.getEventId();
+    long originatingThreadId = ThreadIdentifier.getRealThreadID(originalEventId.getThreadID());
+
+    long newThreadId = ThreadIdentifier
+    .createFakeThreadIDForParallelGSPrimaryBucket(bucketId,
+        originatingThreadId, getEventIdIndex());
+    
+    // In case of parallel as all events go through primary buckets
+    // we don't need to generate different threadId for secondary buckets
+    // as they will be rejected if seen at PR level itself
+    
+//    boolean isPrimary = ((PartitionedRegion)getQueue().getRegion())
+//    .getRegionAdvisor().getBucketAdvisor(bucketId).isPrimary();
+//    if (isPrimary) {
+//      newThreadId = ThreadIdentifier
+//          .createFakeThreadIDForParallelGSPrimaryBucket(bucketId,
+//              originatingThreadId);
+//    } else {
+//      newThreadId = ThreadIdentifier
+//          .createFakeThreadIDForParallelGSSecondaryBucket(bucketId,
+//              originatingThreadId);
+//    }
+
+    EventID newEventId = new EventID(originalEventId.getMembershipID(),
+        newThreadId, originalEventId.getSequenceID(), bucketId);
+    if (logger.isDebugEnabled()) {
+      logger.debug("{}: Generated event id for event with key={}, bucketId={}, original event id={}, threadId={}, new event id={}, newThreadId={}",
+          this, clonedEvent.getKey(), bucketId, originalEventId, originatingThreadId, newEventId, newThreadId);
+    }
+    clonedEvent.setEventId(newEventId);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java
new file mode 100644
index 0000000..35cdece
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java
@@ -0,0 +1,66 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderStats;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderEventProcessor;
+/**
+ * Remote version of GatewaySenderEvent Processor
+ *
+ */
+public class RemoteConcurrentParallelGatewaySenderEventProcessor extends ConcurrentParallelGatewaySenderEventProcessor{
+  
+  public RemoteConcurrentParallelGatewaySenderEventProcessor(
+      AbstractGatewaySender sender) {
+    super(sender);
+  }
+
+  @Override
+  protected void createProcessors(int dispatcherThreads, Set<Region> targetRs) {
+    processors = new RemoteParallelGatewaySenderEventProcessor[sender.getDispatcherThreads()];
+    if (logger.isDebugEnabled()) {
+      logger.debug("Creating GatewaySenderEventProcessor");
+    }
+    for (int i = 0; i < sender.getDispatcherThreads(); i++) {
+      processors[i] = new RemoteParallelGatewaySenderEventProcessor(sender,
+          targetRs, i, sender.getDispatcherThreads());
+    }
+  }
+  
+  @Override
+  protected void rebalance() {
+    GatewaySenderStats statistics = this.sender.getStatistics();
+    long startTime = statistics.startLoadBalance();
+    try {
+      for (ParallelGatewaySenderEventProcessor parallelProcessor : this.processors) {
+        GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher)parallelProcessor.getDispatcher();
+        if (remoteDispatcher.isConnectedToRemote()) {
+          remoteDispatcher.stopAckReaderThread();
+          remoteDispatcher.destroyConnection();
+        }
+      }
+    } finally {
+      statistics.endLoadBalance(startTime);
+    }
+  }
+}


[50/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
deleted file mode 100644
index eaec4a0..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.lucene.internal.cli;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
-
-import org.apache.lucene.analysis.Analyzer;
-
-public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>, Serializable {
-  private static final long serialVersionUID = 1L;
-  private final String indexName;
-  private final String regionPath;
-  private final String[] searchableFieldNames;
-  private Map<String, String> fieldAnalyzers=null;
-  private final Map<String,Integer> indexStats;
-  private boolean initialized;
-
-  public LuceneIndexDetails(final String indexName, final String regionPath, final String[] searchableFieldNames, final Map<String, Analyzer> fieldAnalyzers, LuceneIndexStats indexStats, boolean initialized) {
-    this.indexName = indexName;
-    this.regionPath = regionPath;
-    this.searchableFieldNames = searchableFieldNames;
-    this.fieldAnalyzers = getFieldAnalyzerStrings(fieldAnalyzers);
-    this.indexStats=getIndexStatsMap(indexStats);
-    this.initialized = initialized;
-  }
-
-  public LuceneIndexDetails(LuceneIndexImpl index) {
-    this(index.getName(), index.getRegionPath(), index.getFieldNames(),index.getFieldAnalyzers(),index.getIndexStats(), true);
-  }
-
-  public LuceneIndexDetails(LuceneIndexCreationProfile indexProfile) {
-    this(indexProfile.getIndexName(), indexProfile.getRegionPath(), indexProfile.getFieldNames(), null, null, false);
-    this.fieldAnalyzers=getFieldAnalyzerStringsFromProfile(indexProfile.getFieldAnalyzers());
-  }
-
-  public Map<String,Integer> getIndexStats() {
-    return indexStats;
-  }
-  private  Map<String,Integer> getIndexStatsMap(LuceneIndexStats indexStats) {
-    Map<String,Integer> statsMap = new HashMap<>();
-    if (indexStats==null) return statsMap;
-    statsMap.put("queryExecutions",indexStats.getQueryExecutions());
-    statsMap.put("updates",indexStats.getUpdates());
-    statsMap.put("commits",indexStats.getCommits());
-    statsMap.put("documents",indexStats.getDocuments());
-    return statsMap;
-  }
-
-  public String getIndexStatsString() {
-    return indexStats.toString();
-  }
-
-  private Map<String, String> getFieldAnalyzerStrings(Map<String, Analyzer> fieldAnalyzers) {
-    if(fieldAnalyzers == null) {
-      return Collections.emptyMap();
-    }
-
-    Map<String, String> results = new HashMap<>();
-
-    for (Entry<String, Analyzer> entry : fieldAnalyzers.entrySet()) {
-      final Analyzer analyzer = entry.getValue();
-      if(analyzer != null) {
-        results.put(entry.getKey(), analyzer.getClass().getSimpleName());
-      }
-    }
-    return results;
-  }
-
-  private Map<String, String> getFieldAnalyzerStringsFromProfile(Map<String, String> fieldAnalyzers) {
-    if(fieldAnalyzers == null) {
-      return Collections.emptyMap();
-
-    }
-
-    Map<String, String> results = new HashMap<>();
-
-    for (Entry<String, String> entry : fieldAnalyzers.entrySet()) {
-      final String analyzer = entry.getValue();
-      if(analyzer != null) {
-        results.put(entry.getKey(), analyzer);
-      }
-    }
-    return results;
-  }
-
-  public String getSearchableFieldNamesString() {
-    return Arrays.asList(searchableFieldNames).toString();
-  }
-
-
-  public String getFieldAnalyzersString() {
-    return fieldAnalyzers.toString();
-  }
-
-  @Override
-  public String toString() {
-    final StringBuffer buffer = new StringBuffer();
-    buffer.append("{\n\tIndex Name = "+indexName);
-    buffer.append(",\tRegion Path = "+regionPath);
-    buffer.append(",\tIndexed Fields = "+getSearchableFieldNamesString());
-    buffer.append(",\tField Analyzer = "+getFieldAnalyzersString());
-    buffer.append(",\tStatus =\n\t"+ getInitialized());
-    buffer.append(",\tIndex Statistics =\n\t"+getIndexStatsString());
-    buffer.append("\n}\n");
-    return buffer.toString();
-  }
-
-  public boolean getInitialized() {
-    return initialized;
-  }
-
-  public String getIndexName() {
-    return indexName;
-  }
-
-  public String getRegionPath() {
-    return regionPath;
-  }
-
-  private static <T extends Comparable<T>> int compare(final T obj1, final T obj2) {
-    return (obj1 == null && obj2 == null ? 0 : (obj1 == null ? 1 : (obj2 == null ? -1 : obj1.compareTo(obj2))));
-  }
-
-  @Override
-  public int compareTo(final LuceneIndexDetails indexDetails) {
-    int comparisonValue = compare(getIndexName(), indexDetails.getIndexName());
-    return (comparisonValue != 0 ? comparisonValue : compare(getRegionPath(), indexDetails.getRegionPath()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexInfo.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexInfo.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexInfo.java
deleted file mode 100644
index 3df292c..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.lucene.internal.cli;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
-
-import org.apache.lucene.analysis.Analyzer;
-
-public class LuceneIndexInfo implements Serializable {
-  private static final long serialVersionUID = 1L;
-
-  private final String indexName;
-  private final String regionPath;
-  private final String[] searchableFieldNames;
-  private final String[] fieldAnalyzers;
-
-  public LuceneIndexInfo(final String indexName, final String regionPath, final String[] searchableFieldNames, String[] fieldAnalyzers) {
-    this.indexName = indexName;
-    this.regionPath = regionPath;
-    this.searchableFieldNames = searchableFieldNames;
-    this.fieldAnalyzers = fieldAnalyzers;
-  }
-
-  public LuceneIndexInfo(final String indexName, final String regionPath) {
-    this(indexName,regionPath,null,null);
-  }
-
-  public String getIndexName() {
-    return indexName;
-  }
-
-  public String getRegionPath() {
-    return regionPath;
-  }
-
-  public String[] getSearchableFieldNames() {
-    return searchableFieldNames;
-  }
-
-  public String[] getFieldAnalyzers() {
-    return fieldAnalyzers;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneQueryInfo.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneQueryInfo.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneQueryInfo.java
deleted file mode 100644
index 0dbe2fe..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneQueryInfo.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.lucene.internal.cli;
-
-import java.io.Serializable;
-
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-
-public class LuceneQueryInfo implements Serializable {
-  private static final long serialVersionUID = 1L;
-  private String indexName;
-  private String regionPath;
-  private String queryString;
-  private String defaultField;
-  private int limit;
-  private boolean keysOnly;
-
-  public LuceneQueryInfo(final String indexName,
-                         final String regionPath,
-                         final String queryString,
-                         final String defaultField,
-                         final int limit,
-                         final boolean keysOnly)
-  {
-    this.indexName = indexName;
-    this.regionPath = regionPath;
-    this.queryString = queryString;
-    this.defaultField = defaultField;
-    this.limit = limit;
-    this.keysOnly = keysOnly;
-  }
-
-  public String getIndexName() {
-    return indexName;
-  }
-
-  public String getRegionPath() {
-    return regionPath;
-  }
-
-  public String getQueryString() {
-    return queryString;
-  }
-
-  public String getDefaultField() {
-    return defaultField;
-  }
-
-  public int getLimit() {
-    if (limit == -1) return LuceneQueryFactory.DEFAULT_LIMIT;
-    else return limit; }
-
-  public boolean getKeysOnly() { return keysOnly; }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneSearchResults.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneSearchResults.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneSearchResults.java
deleted file mode 100644
index 9f03873..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneSearchResults.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.lucene.internal.cli;
-
-import java.io.Serializable;
-
-public class LuceneSearchResults<K,V> implements Comparable<LuceneSearchResults>, Serializable {
-
-  private String key;
-  private String value;
-  private float score;
-  private boolean exceptionFlag = false;
-  private String exceptionMessage;
-
-
-  public LuceneSearchResults(final String key, final String value, final float score) {
-    this.key = key;
-    this.value = value;
-    this.score = score;
-  }
-
-  public LuceneSearchResults(final String key) {
-    this.key = key;
-  }
-
-  public LuceneSearchResults(final boolean exceptionFlag, final String exceptionMessage) {
-    this.exceptionFlag=exceptionFlag;
-    this.exceptionMessage=exceptionMessage;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public float getScore() {
-    return score;
-  }
-
-  @Override
-  public int compareTo(final LuceneSearchResults searchResults) {
-    return Float.compare(getScore(),searchResults.getScore());
-  }
-
-  public boolean getExeptionFlag() { return exceptionFlag; }
-
-  public String getExceptionMessage() { return exceptionMessage; }
-
-  @Override public String toString() {
-    return "LuceneSearchResults{" +
-      "key='" + key + '\'' +
-      ", value='" + value + '\'' +
-      ", score=" + score +
-      ", exceptionFlag=" + exceptionFlag +
-      ", exceptionMessage='" + exceptionMessage + '\'' +
-      '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
deleted file mode 100644
index cb45f7b..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.lucene.internal.cli.functions;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneCliStrings;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
-import com.gemstone.gemfire.internal.InternalEntity;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.management.internal.cli.CliUtil;
-import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-
-
-/**
- * The LuceneCreateIndexFunction class is a function used to create Lucene indexes.
- * </p>
- * @see Cache
- * @see com.gemstone.gemfire.cache.execute.Function
- * @see FunctionAdapter
- * @see FunctionContext
- * @see InternalEntity
- * @see LuceneIndexDetails
- */
-@SuppressWarnings("unused")
-public class LuceneCreateIndexFunction extends FunctionAdapter implements InternalEntity {
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return LuceneListIndexFunction.class.getName();
-  }
-
-  public void execute(final FunctionContext context) {
-    String memberId = null;
-    try {
-      final LuceneIndexInfo indexInfo = (LuceneIndexInfo) context.getArguments();
-      final Cache cache = getCache();
-      memberId = cache.getDistributedSystem().getDistributedMember().getId();
-      LuceneService service = LuceneServiceProvider.get(cache);
-
-      String[] fields = indexInfo.getSearchableFieldNames();
-      String[] analyzerName = indexInfo.getFieldAnalyzers();
-
-      if (analyzerName == null || analyzerName.length == 0) {
-        service.createIndex(indexInfo.getIndexName(), indexInfo.getRegionPath(), fields);
-      }
-      else {
-        if (analyzerName.length != fields.length) throw new Exception("Mismatch in lengths of fields and analyzers");
-        Map<String, Analyzer> fieldAnalyzer = new HashMap<>();
-        for (int i = 0; i < fields.length; i++) {
-          Analyzer analyzer = toAnalyzer(analyzerName[i]);
-          fieldAnalyzer.put(fields[i], analyzer);
-        }
-        service.createIndex(indexInfo.getIndexName(), indexInfo.getRegionPath(), fieldAnalyzer);
-      }
-
-      //TODO - update cluster configuration by returning a valid XmlEntity
-      XmlEntity xmlEntity = null;
-      context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity));
-    }
-    catch (Exception e) {
-      String exceptionMessage = CliStrings.format(CliStrings.EXCEPTION_CLASS_AND_MESSAGE, e.getClass().getName(),
-        e.getMessage());
-      context.getResultSender().lastResult(new CliFunctionResult(memberId, e, e.getMessage()));
-    }
-  }
-
-  private Analyzer toAnalyzer(String className)
-  {
-    if (className==null)
-      className=StandardAnalyzer.class.getCanonicalName();
-    else if (StringUtils.trim(className).equals("") | StringUtils.trim(className).equals("null") )
-      className = StandardAnalyzer.class.getCanonicalName();
-
-    Class<? extends Analyzer> clazz = CliUtil.forName(className, LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER);
-    return CliUtil.newInstance(clazz, LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
deleted file mode 100755
index 015828a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.lucene.internal.cli.functions;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
-import com.gemstone.gemfire.internal.InternalEntity;
-
-/**
- * The LuceneDescribeIndexFunction class is a function used to collect the information on a particular lucene index.
- * </p>
- * @see Cache
- * @see com.gemstone.gemfire.cache.execute.Function
- * @see FunctionAdapter
- * @see FunctionContext
- * @see InternalEntity
- * @see LuceneIndexDetails
- * @see LuceneIndexInfo
- */
-@SuppressWarnings("unused")
-public class LuceneDescribeIndexFunction extends FunctionAdapter implements InternalEntity {
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return LuceneDescribeIndexFunction.class.getName();
-  }
-
-  public void execute(final FunctionContext context) {
-    LuceneIndexDetails result = null;
-
-    final Cache cache = getCache();
-    final LuceneIndexInfo indexInfo = (LuceneIndexInfo) context.getArguments();
-    LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
-    LuceneIndex index = service.getIndex(indexInfo.getIndexName(), indexInfo.getRegionPath());
-    LuceneIndexCreationProfile profile = service.getDefinedIndex(indexInfo.getIndexName(),indexInfo.getRegionPath());
-    if (index != null) {
-      result = new LuceneIndexDetails((LuceneIndexImpl) index);
-    } else if (profile != null) {
-     result = new LuceneIndexDetails(profile);
-    }
-    context.getResultSender().lastResult(result);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
deleted file mode 100755
index bb74410..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.lucene.internal.cli.functions;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
-import com.gemstone.gemfire.internal.InternalEntity;
-
-/**
- * The LuceneListIndexFunction class is a function used to collect the information on all lucene indexes in
- * the entire Cache.
- * </p>
- * @see Cache
- * @see com.gemstone.gemfire.cache.execute.Function
- * @see FunctionAdapter
- * @see FunctionContext
- * @see InternalEntity
- * @see LuceneIndexDetails
- */
-@SuppressWarnings("unused")
-public class LuceneListIndexFunction extends FunctionAdapter implements InternalEntity {
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return LuceneListIndexFunction.class.getName();
-  }
-
-  public void execute(final FunctionContext context) {
-    final Set<LuceneIndexDetails> indexDetailsSet = new HashSet<>();
-    final Cache cache = getCache();
-    LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
-    for (LuceneIndex index : service.getAllIndexes()) {
-      indexDetailsSet.add(new LuceneIndexDetails((LuceneIndexImpl) index));
-    }
-
-    for(LuceneIndexCreationProfile profile : service.getAllDefinedIndexes()) {
-      indexDetailsSet.add(new LuceneIndexDetails(profile));
-    }
-    context.getResultSender().lastResult(indexDetailsSet);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
deleted file mode 100755
index 234583c..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.lucene.internal.cli.functions;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.lucene.LuceneQuery;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
-import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneQueryInfo;
-import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneSearchResults;
-import com.gemstone.gemfire.cache.query.RegionNotFoundException;
-import com.gemstone.gemfire.internal.InternalEntity;
-
-/**
- * The LuceneSearchIndexFunction class is a function used to collect the information on a particular lucene index.
- * </p>
- * @see Cache
- * @see com.gemstone.gemfire.cache.execute.Function
- * @see FunctionAdapter
- * @see FunctionContext
- * @see InternalEntity
- * @see LuceneIndexDetails
- * @see LuceneIndexInfo
- */
-@SuppressWarnings("unused")
-public class LuceneSearchIndexFunction<K, V> extends FunctionAdapter implements InternalEntity {
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return LuceneSearchIndexFunction.class.getName();
-  }
-
-  public void execute(final FunctionContext context) {
-    Set<LuceneSearchResults> result = new HashSet<>();
-    final Cache cache = getCache();
-    final LuceneQueryInfo queryInfo = (LuceneQueryInfo) context.getArguments();
-
-    LuceneService luceneService = LuceneServiceProvider.get(getCache());
-    try {
-      if (luceneService.getIndex(queryInfo.getIndexName(), queryInfo.getRegionPath()) == null) {
-        throw new Exception("Index " + queryInfo.getIndexName() + " not found on region " + queryInfo.getRegionPath());
-      }
-      final LuceneQuery<K, V> query = luceneService.createLuceneQueryFactory()
-        .setResultLimit(queryInfo.getLimit())
-        .create(queryInfo.getIndexName(), queryInfo.getRegionPath(), queryInfo.getQueryString(),
-          queryInfo.getDefaultField());
-      if (queryInfo.getKeysOnly()) {
-        query.findKeys().forEach(key -> result.add(new LuceneSearchResults(key.toString())));
-      }
-      else {
-        PageableLuceneQueryResults pageableLuceneQueryResults = query.findPages();
-        while (pageableLuceneQueryResults.hasNext()) {
-          List<LuceneResultStruct> page = pageableLuceneQueryResults.next();
-          page.stream()
-            .forEach(searchResult ->
-              result.add(
-                new LuceneSearchResults<K, V>(searchResult.getKey().toString(), searchResult.getValue().toString(),
-                  searchResult.getScore())));
-        }
-      }
-      if (result != null) {
-        context.getResultSender().lastResult(result);
-      }
-    }
-    catch (LuceneQueryException e) {
-      result.add(new LuceneSearchResults(true, e.getRootCause().getMessage()));
-      context.getResultSender().lastResult(result);
-    }
-    catch (Exception e) {
-      result.add(new LuceneSearchResults(true, e.getMessage()));
-      context.getResultSender().lastResult(result);
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/DumpDirectoryFiles.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/DumpDirectoryFiles.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/DumpDirectoryFiles.java
deleted file mode 100644
index 0d18144..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/DumpDirectoryFiles.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.lucene.internal.directory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.execute.FunctionException;
-import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
-import com.gemstone.gemfire.cache.execute.ResultSender;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneIndex;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.CollectorManager;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunctionContext;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollector;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollectorManager;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepositoryImpl;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.query.QueryException;
-import com.gemstone.gemfire.internal.InternalEntity;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.store.Directory;
-
-public class DumpDirectoryFiles implements Function, InternalEntity {
-  private static final long serialVersionUID = 1L;
-
-  private static final Logger logger = LogService.getLogger();
-  public static final String ID = DumpDirectoryFiles.class.getSimpleName();
-
-  @Override
-  public void execute(FunctionContext context) {
-    RegionFunctionContext ctx = (RegionFunctionContext) context;
-
-    if(!(context.getArguments() instanceof String[])) {
-      throw new IllegalArgumentException("Arguments should be a string array");
-    }
-    String[] args = (String[]) context.getArguments();
-    if(args.length != 2) {
-      throw new IllegalArgumentException("Expected 2 arguments: exportLocation, indexName");
-    }
-
-
-    String exportLocation =args[0];
-    String indexName =args[1];
-
-    final Region<Object, Object> region = ctx.getDataSet();
-    LuceneService service = LuceneServiceProvider.get(ctx.getDataSet().getCache());
-    InternalLuceneIndex index = (InternalLuceneIndex) service.getIndex(indexName, region.getFullPath());
-    if(index == null) {
-      throw new IllegalStateException("Index not found for region " + region + " index " + indexName);
-    }
-
-    final RepositoryManager repoManager = index.getRepositoryManager();
-    try {
-      final Collection<IndexRepository> repositories = repoManager.getRepositories(ctx);
-      repositories.stream().forEach(repo -> {
-        final IndexWriter writer = repo.getWriter();
-        RegionDirectory directory = (RegionDirectory) writer.getDirectory();
-        FileSystem fs = directory.getFileSystem();
-
-        String bucketName = index.getName() + "_" + repo.getRegion().getFullPath();
-        bucketName = bucketName.replace("/", "_");
-        File bucketDirectory = new File(exportLocation, bucketName);
-        bucketDirectory.mkdirs();
-        fs.export(bucketDirectory);
-      });
-      context.getResultSender().lastResult(null);
-    }
-    catch (BucketNotFoundException e) {
-      throw new FunctionException(e);
-    }
-  }
-
-  @Override public String getId() {
-    return ID;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/FileIndexInput.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/FileIndexInput.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/FileIndexInput.java
deleted file mode 100644
index 9ebef51..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/FileIndexInput.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.lucene.internal.directory;
-
-import java.io.EOFException;
-import java.io.IOException;
-
-import org.apache.lucene.store.IndexInput;
-
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.SeekableInputStream;
-
-final class FileIndexInput extends IndexInput {
-  private final File file;
-  SeekableInputStream in;
-  private long position;
-  
-  //Used for slice operations
-  private long sliceOffset;
-  private long sliceLength;
-  
-  FileIndexInput(String resourceDesc, File file) {
-    this(resourceDesc, file, 0L, file.getLength());
-  }
-
-  /**
-   * Constructor for a slice.
-   */
-  private FileIndexInput(String resourceDesc, File file, long offset, long length) {
-    super(resourceDesc);
-    this.file = file;
-    in = file.getInputStream();
-    this.sliceOffset = offset;
-    this.sliceLength = length;
-  }
-
-  @Override
-  public long length() {
-    return sliceLength;
-  }
-
-  @Override
-  public void close() throws IOException {
-    in.close();
-  }
-  
-  @Override
-  public FileIndexInput clone() {
-    FileIndexInput clone = (FileIndexInput)super.clone();
-    clone.in = in.clone();
-    return clone;
-  }
-
-  @Override
-  public long getFilePointer() {
-    return position;
-  }
-
-  @Override
-  public void seek(long pos) throws IOException {
-    in.seek(pos + sliceOffset);
-    this.position = pos;
-  }
-
-  @Override
-  public IndexInput slice(String sliceDescription, long offset, long length)
-      throws IOException {
-    if(length > (this.sliceLength - offset)) {
-      throw new IllegalArgumentException("Slice length is to large. Asked for " + length + " file length is " + sliceLength + ": " + this.file.getName());
-    }
-    if(offset < 0 || offset >= this.sliceLength) {
-      throw new IllegalArgumentException("Slice offset is invalid: " + this.file.getName());
-    }
-    
-    FileIndexInput result = new FileIndexInput(sliceDescription, file, sliceOffset + offset, length);
-    result.seek(0);
-    return result;
-  }
-
-  @Override
-  public byte readByte() throws IOException {
-    if(++position > sliceLength) {
-      throw new EOFException("Read past end of file " + file.getName());
-    }
-    
-    int result = in.read();
-    if(result == -1) {
-      throw new EOFException("Read past end of file " + file.getName());
-    } else {
-      return (byte) result;
-    }
-  }
-
-  @Override
-  public void readBytes(byte[] b, int offset, int len) throws IOException {
-    if(len == 0) {
-      return;
-    }
-    
-    if(position + len > sliceLength) {
-      throw new EOFException("Read past end of file " + file.getName());
-    }
-    
-    //For the FileSystemInputStream, it will always read all bytes, up
-    //until the end of the file. So if we didn't get enough bytes, it's
-    //because we reached the end of the file.
-    int numRead = in.read(b, offset, len);
-    if(numRead < len) {
-      throw new EOFException("Read past end of file " + file.getName());
-    }
-    
-    position+=len;
-  } 
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/RegionDirectory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/RegionDirectory.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/RegionDirectory.java
deleted file mode 100644
index 45b9c97..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/RegionDirectory.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.lucene.internal.directory;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.lucene.store.BaseDirectory;
-import org.apache.lucene.store.IOContext;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.store.OutputStreamIndexOutput;
-import org.apache.lucene.store.SingleInstanceLockFactory;
-
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemStats;
-
-/**
- * An implementation of Directory that stores data in geode regions.
- * 
- * Directory is an interface to file/RAM storage for lucene. This class uses
- * the {@link FileSystem} class to store the data in the provided geode
- * regions.
- */
-public class RegionDirectory extends BaseDirectory {
-
-  private final FileSystem fs;
-
-  /**
-   * Create a region directory with a given file and chunk region. These regions
-   * may be bucket regions or they may be replicated regions.
-   */
-  public RegionDirectory(ConcurrentMap<String, File> fileRegion, ConcurrentMap<ChunkKey, byte[]> chunkRegion, FileSystemStats stats) {
-    super(new SingleInstanceLockFactory());
-    fs = new FileSystem(fileRegion, chunkRegion, stats);
-  }
-
-  @Override
-  public String[] listAll() throws IOException {
-    ensureOpen();
-    String[] array = fs.listFileNames().toArray(new String[]{});
-    Arrays.sort(array);
-    return array;
-  }
-
-  @Override
-  public void deleteFile(String name) throws IOException {
-    ensureOpen();
-    fs.deleteFile(name);
-  }
-
-  @Override
-  public long fileLength(String name) throws IOException {
-    ensureOpen();
-    return fs.getFile(name).getLength();
-  }
-
-  @Override
-  public IndexOutput createOutput(final String name, final IOContext context) throws IOException {
-    ensureOpen();
-    final File file = fs.createFile(name);
-    final OutputStream out = file.getOutputStream();
-
-    return new OutputStreamIndexOutput(name, name, out, 1000);
-  }
-
-  public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException {
-    String name = prefix + "_temp_" + UUID.randomUUID() + suffix;
-    final File file = fs.createTemporaryFile(name);
-    final OutputStream out = file.getOutputStream();
-
-    return new OutputStreamIndexOutput(name, name, out, 1000);
-  }
-
-  @Override
-  public void sync(Collection<String> names) throws IOException {
-    ensureOpen();
-    // Region does not need to sync to disk
-  }
-
-  @Override
-  public void renameFile(String source, String dest) throws IOException {
-    ensureOpen();
-    fs.renameFile(source, dest);
-  }
-
-  @Override
-  public IndexInput openInput(String name, IOContext context) throws IOException {
-    ensureOpen();
-    final File file = fs.getFile(name);
-
-    return new FileIndexInput(name, file);
-  }
-
-  @Override
-  public void close() throws IOException {
-    isOpen = false;
-  }
-
-  /**
-   * For testing, the file system
-   */
-  public FileSystem getFileSystem() {
-    return fs;
-  }
-  
-  
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/package-info.java
deleted file mode 100644
index 2dd0606..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/directory/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * An implementation of Lucene's {@link org.apache.lucene.store.Directory} interface that uses the filesystem
- * API in {@link com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem}
- */
-package com.gemstone.gemfire.cache.lucene.internal.directory;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/CollectorManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/CollectorManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/CollectorManager.java
deleted file mode 100644
index 4d1d1c2..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/CollectorManager.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import com.gemstone.gemfire.annotations.Experimental;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
-
-/**
- * {@link CollectorManager}s create instances of {@link IndexResultCollector} and utility methods to aggregate results
- * collected by individual collectors. The collectors created by this class are primarily used for collecting results
- * from {@link IndexRepository}s. The collectors can also be used for aggregating results of other collectors of same
- * type. Typically search result aggregation is completed in two phases. First at a member level for merging results
- * from local buckets. And then at search coordinator level for merging results from members. Use of same collector in
- * both phases is expected to produce deterministic merge result irrespective of the way buckets are distributed.
- * 
- * @param <C> Type of IndexResultCollector created by this manager
- */
-@Experimental
-public interface CollectorManager<C extends IndexResultCollector> {
-  /**
-   * @param name Name/Identifier for this collector. For e.g. region/bucketId.
-   * @return a new {@link IndexResultCollector}. This must return a different instance on
-   *         each call. A new collector would be created for each bucket on a member node.
-   */
-  C newCollector(String name);
-
-  /**
-   * Reduce the results of individual collectors into a meaningful result. This method must be called after collection
-   * is finished on all provided collectors.
-   * 
-   */
-  C reduce(Collection<C> results);
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
deleted file mode 100644
index e891156..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * Holds one entry matching search query and its metadata
- *
- * @param <K> the type of the key
- */
-public class EntryScore<K> implements DataSerializableFixedID {
-  // Key of the entry matching search query
-  private K key;
-
-  // The score of this document for the query.
-  private float score;
-
-  public EntryScore() {
-  }
-
-  public EntryScore(K key, float score) {
-    this.key = key;
-    this.score = score;
-  }
-  
-  public K getKey() {
-    return key;
-  }
-
-  public float getScore() {
-    return score;
-  }
-
-  @Override
-  public String toString() {
-    return "key=" + key + " score=" + score;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_ENTRY_SCORE;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeObject(key, out);
-    out.writeFloat(score);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    key = DataSerializer.readObject(in);
-    score = in.readFloat();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
deleted file mode 100644
index 3c6c0d2..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.search.Query;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.execute.FunctionException;
-import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
-import com.gemstone.gemfire.cache.execute.ResultSender;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneIndex;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.query.QueryException;
-import com.gemstone.gemfire.internal.InternalEntity;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-import com.gemstone.gemfire.internal.cache.execute.BucketMovedException;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * {@link LuceneFunction} coordinates text search on a member. It receives text search query from the coordinator
- * and arguments like region and buckets. It invokes search on the local index and provides a result collector. The
- * locally collected results are sent to the search coordinator.
- */
-public class LuceneFunction extends FunctionAdapter implements InternalEntity {
-  private static final long serialVersionUID = 1L;
-  public static final String ID = LuceneFunction.class.getName();
-
-  private static final Logger logger = LogService.getLogger();
-
-  @Override
-  public void execute(FunctionContext context) {
-    RegionFunctionContext ctx = (RegionFunctionContext) context;
-    ResultSender<TopEntriesCollector> resultSender = ctx.getResultSender();
-
-    Region region = ctx.getDataSet();
-
-    LuceneFunctionContext<IndexResultCollector> searchContext = (LuceneFunctionContext) ctx.getArguments();
-    if (searchContext == null) {
-      throw new IllegalArgumentException("Missing search context");
-    }
-
-    LuceneQueryProvider queryProvider = searchContext.getQueryProvider();
-    if (queryProvider == null) {
-      throw new IllegalArgumentException("Missing query provider");
-    }
-    
-    LuceneService service = LuceneServiceProvider.get(region.getCache());
-    InternalLuceneIndex index = (InternalLuceneIndex) service.getIndex(searchContext.getIndexName(), region.getFullPath());
-    RepositoryManager repoManager = index.getRepositoryManager();
-
-    Query query = null;
-    try {
-      query = queryProvider.getQuery(index);
-    } catch (LuceneQueryException e) {
-      logger.warn("", e);
-      throw new FunctionException(e);
-    }
-
-    if (logger.isDebugEnabled()) {
-      logger.debug("Executing lucene query: {}, on region {}", query, region.getFullPath());
-    }
-
-    int resultLimit = searchContext.getLimit();
-    CollectorManager manager = (searchContext == null) ? null : searchContext.getCollectorManager();
-    if (manager == null) {
-      manager = new TopEntriesCollectorManager(null, resultLimit);
-    }
-
-    Collection<IndexResultCollector> results = new ArrayList<>();
-    try {
-      Collection<IndexRepository> repositories = repoManager.getRepositories(ctx);
-      for (IndexRepository repo : repositories) {
-        IndexResultCollector collector = manager.newCollector(repo.toString());
-        logger.debug("Executing search on repo: " + repo.toString());
-        repo.query(query, resultLimit, collector);
-        results.add(collector);
-      }
-      TopEntriesCollector mergedResult = (TopEntriesCollector) manager.reduce(results);
-      resultSender.lastResult(mergedResult);
-    } catch (IOException|BucketNotFoundException e) {
-      logger.warn("", e);
-      throw new FunctionException(e);
-    }
-  }
-
-
-  @Override
-  public String getId() {
-    return ID;
-  }
-  
-  @Override
-  public boolean optimizeForWrite() {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionContext.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionContext.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionContext.java
deleted file mode 100644
index b0b2c60..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionContext.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * Contains function arguments for text / lucene search
- */
-public class LuceneFunctionContext<C extends IndexResultCollector> implements DataSerializableFixedID {
-  private CollectorManager<C> manager;
-  private int limit;
-  private LuceneQueryProvider queryProvider;
-  private String indexName;
-
-  public LuceneFunctionContext() {
-    this(null, null, null);
-  }
-
-  public LuceneFunctionContext(LuceneQueryProvider provider, String indexName) {
-    this(provider, indexName, null);
-  }
-
-  public LuceneFunctionContext(LuceneQueryProvider provider, String indexName, CollectorManager<C> manager) {
-    this(provider, indexName, manager, LuceneQueryFactory.DEFAULT_LIMIT);
-  }
-
-  public LuceneFunctionContext(LuceneQueryProvider provider, String indexName, CollectorManager<C> manager, int limit) {
-    this.queryProvider = provider;
-    this.indexName = indexName;
-    this.manager = manager;
-    this.limit = limit;
-  }
-
-  /**
-   * @return The maximum count of result objects to be produced by the function
-   */
-  public int getLimit() {
-    return limit;
-  }
-
-  /**
-   * Get the name of the index to query
-   */
-  public String getIndexName() {
-    return indexName;
-  }
-
-  /**
-   * On each member, search query is executed on one or more {@link IndexRepository}s. A {@link CollectorManager} could
-   * be provided to customize the way results from these repositories is collected and merged.
-   * 
-   * @return {@link CollectorManager} instance to be used by function
-   */
-  public CollectorManager<C> getCollectorManager() {
-    return this.manager;
-  }
-
-  public LuceneQueryProvider getQueryProvider() {
-    return queryProvider;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_FUNCTION_CONTEXT;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    out.writeInt(limit);
-    DataSerializer.writeObject(queryProvider, out);
-    DataSerializer.writeObject(manager, out);
-    DataSerializer.writeString(indexName, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    limit = in.readInt();
-    queryProvider = DataSerializer.readObject(in);
-    manager = DataSerializer.readObject(in);
-    this.indexName = DataSerializer.readString(in);
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
deleted file mode 100644
index 48a2ca9..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * Holds a ordered collection of entries matching a search query.
- *
- * @param <K> the type of key
- */
-public class TopEntries<K> implements DataSerializableFixedID {
-  // ordered collection of entries
-  private List<EntryScore<K>> hits = new ArrayList<>();
-
-  // the maximum number of entries stored in this
-  private int limit;
-
-  // comparator to order entryScore instances
-  final Comparator<EntryScore<K>> comparator = new EntryScoreComparator();
-
-  public TopEntries() {
-    this(LuceneQueryFactory.DEFAULT_LIMIT);
-  }
-
-  public TopEntries(int limit) {
-    if (limit < 0) {
-      throw new IllegalArgumentException();
-    }
-    this.limit = limit;
-  }
-
-  /**
-   * Adds an entry to the collection. The new entry must have a lower score than all previous entries added to the
-   * collection. The new entry will be ignored if the limit is already reached.
-   * 
-   * @param entry
-   */
-  public void addHit(EntryScore<K> entry) {
-    if (hits.size() > 0) {
-      EntryScore lastEntry = hits.get(hits.size() - 1);
-      if (comparator.compare(lastEntry, entry) < 0) {
-        throw new IllegalArgumentException();
-      }
-    }
-
-    if (hits.size() >= limit) {
-      return;
-    }
-
-    hits.add(entry);
-  }
-
-  /**
-   * @return count of entries in the collection
-   */
-  public int size() {
-    return hits.size();
-  }
-
-  /**
-   * @return The entries collection managed by this instance
-   */
-  public List<EntryScore<K>> getHits() {
-    return hits;
-  }
-
-  /**
-   * @return The maximum capacity of this collection
-   */
-  public int getLimit() {
-    return limit;
-  }
-
-  /**
-   * Compares scores of two entries using natural ordering. I.e. it returns -1 if the first entry's score is less than
-   * the second one.
-   */
-  class EntryScoreComparator implements Comparator<EntryScore<K>> {
-    @Override
-    public int compare(EntryScore<K> o1, EntryScore<K> o2) {
-      return Float.compare(o1.getScore(), o2.getScore());
-    }
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_TOP_ENTRIES;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    out.writeInt(limit);
-    DataSerializer.writeObject(hits, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    limit = in.readInt();
-    hits = DataSerializer.readObject(in);
-  };
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollector.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollector.java
deleted file mode 100644
index 94b8a3a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollector.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * An implementation of {@link IndexResultCollector} to collect {@link EntryScore}. It is expected that the results will
- * be ordered by score of the entry.
- */
-public class TopEntriesCollector implements IndexResultCollector, DataSerializableFixedID {
-  private String name;
-
-  private TopEntries entries;
-
-  public TopEntriesCollector() {
-    this(null);
-  }
-
-  public TopEntriesCollector(String name) {
-    this(name, LuceneQueryFactory.DEFAULT_LIMIT);
-  }
-
-  public TopEntriesCollector(String name, int limit) {
-    this.name = name;
-    this.entries = new TopEntries(limit);
-  }
-
-  @Override
-  public void collect(Object key, float score) {
-    collect(new EntryScore(key, score));
-  }
-
-  public void collect(EntryScore entry) {
-    entries.addHit(entry);
-  }
-
-  @Override
-  public String getName() {
-    return name;
-  }
-
-  @Override
-  public int size() {
-    TopEntries entries = getEntries();
-    return entries == null ? 0 : entries.size();
-  }
-
-  /**
-   * @return The entries collected by this collector
-   */
-  public TopEntries getEntries() {
-    return entries;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_TOP_ENTRIES_COLLECTOR;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeString(name, out);
-    DataSerializer.writeObject(entries, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    name = DataSerializer.readString(in);
-    entries = DataSerializer.readObject(in);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorManager.java
deleted file mode 100644
index cf6e420..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorManager.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.PriorityQueue;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntries.EntryScoreComparator;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * An implementation of {@link CollectorManager} for managing {@link TopEntriesCollector}. This is used by a member to
- * collect top matching entries from local buckets
- */
-public class TopEntriesCollectorManager implements CollectorManager<TopEntriesCollector>, DataSerializableFixedID {
-  private static final Logger logger = LogService.getLogger();
-
-  private int limit;
-  private String id;
-
-  public TopEntriesCollectorManager() {
-    this(null, 0);
-  }
-
-  public TopEntriesCollectorManager(String id) {
-    this(id, 0);
-  }
-
-  public TopEntriesCollectorManager(String id, int resultLimit) {
-    this.limit = resultLimit <= 0 ? LuceneQueryFactory.DEFAULT_LIMIT : resultLimit;
-    this.id = id == null ? String.valueOf(this.hashCode()) : id;
-    logger.debug("Max count of entries to be produced by {} is {}", id, limit);
-  }
-
-  @Override
-  public TopEntriesCollector newCollector(String name) {
-    return new TopEntriesCollector(name, limit);
-  }
-
-  @Override
-  public TopEntriesCollector reduce(Collection<TopEntriesCollector> collectors) {
-    TopEntriesCollector mergedResult = new TopEntriesCollector(id, limit);
-    if (collectors.isEmpty()) {
-      return mergedResult;
-    }
-
-    final EntryScoreComparator scoreComparator = new TopEntries().new EntryScoreComparator();
-
-    // orders a entry with higher score above a doc with lower score
-    Comparator<ListScanner> entryListComparator = new Comparator<ListScanner>() {
-      @Override
-      public int compare(ListScanner l1, ListScanner l2) {
-        EntryScore o1 = l1.peek();
-        EntryScore o2 = l2.peek();
-        return scoreComparator.compare(o1, o2);
-      }
-    };
-
-    // The queue contains iterators for all bucket results. The queue puts the entry with the highest score at the head
-    // using score comparator.
-    PriorityQueue<ListScanner> entryListsPriorityQueue;
-    entryListsPriorityQueue = new PriorityQueue<ListScanner>(collectors.size(),
-        Collections.reverseOrder(entryListComparator));
-
-    for (IndexResultCollector collector : collectors) {
-      logger.debug("Number of entries found in collector {} is {}", collector.getName(), collector.size());
-
-      if (collector.size() > 0) {
-        entryListsPriorityQueue.add(new ListScanner(((TopEntriesCollector) collector).getEntries().getHits()));
-      }
-    }
-
-    logger.debug("Only {} count of entries will be reduced. Other entries will be ignored", limit);
-    while (entryListsPriorityQueue.size() > 0 && limit > mergedResult.size()) {
-
-      ListScanner scanner = entryListsPriorityQueue.remove();
-      EntryScore entry = scanner.next();
-      mergedResult.collect(entry);
-
-      if (scanner.hasNext()) {
-        entryListsPriorityQueue.add(scanner);
-      }
-    }
-
-    logger.debug("Reduced size of {} is {}", mergedResult.getName(), mergedResult.size());
-    return mergedResult;
-  }
-
-  /*
-   * Utility class to iterate on hits without modifying it
-   */
-  static class ListScanner {
-    private List<EntryScore> hits;
-    private int index = 0;
-
-    ListScanner(List<EntryScore> hits) {
-      this.hits = hits;
-    }
-
-    boolean hasNext() {
-      return index < hits.size();
-    }
-
-    EntryScore peek() {
-      return hits.get(index);
-    }
-
-    EntryScore next() {
-      return hits.get(index++);
-    }
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_TOP_ENTRIES_COLLECTOR_MANAGER;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeString(id, out);
-    out.writeInt(limit);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    id = DataSerializer.readString(in);
-    limit = in.readInt();
-  }
-
-  /**
-   * @return Id of this collector, if any
-   */
-  public String getId() {
-    return id;
-  }
-
-  /**
-   * @return Result limit enforced by the collectors created by this manager
-   */
-  public int getLimit() {
-    return limit;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
deleted file mode 100644
index 4a99bf8..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.lucene.internal.distributed;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.cache.execute.FunctionException;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.cache.lucene.LuceneQuery;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * A {@link ResultCollector} implementation for collecting and ordering {@link TopEntries}. The {@link TopEntries}
- * objects will be created by members when a {@link LuceneQuery} is executed on the local data hosted by the member. The
- * member executing this logic must have sufficient space to hold all the {@link EntryScore} documents returned from the
- * members.
- * 
- * <p>
- * This class will perform a lazy merge operation. Merge will take place if the merge {@link ResultCollector#getResult}
- * is invoked or if the combined result size is more than the limit set. In the later case, merge will be performed
- * whenever {@link ResultCollector#addResult} is invoked.
- */
-public class TopEntriesFunctionCollector implements ResultCollector<TopEntriesCollector, TopEntries> {
-  // Use this instance to perform reduce operation
-  final CollectorManager<TopEntriesCollector> manager;
-
-  // latch to wait till all results are collected
-  private final CountDownLatch waitForResults = new CountDownLatch(1);
-
-  final String id;
-
-  // Instance of gemfire cache to check status and other utility methods
-  final private GemFireCacheImpl cache;
-  private static final Logger logger = LogService.getLogger();
-
-  private final Collection<TopEntriesCollector> subResults = new ArrayList<>();
-  private TopEntriesCollector mergedResults;
-
-  public TopEntriesFunctionCollector() {
-    this(null);
-  }
-
-  public TopEntriesFunctionCollector(LuceneFunctionContext<TopEntriesCollector> context) {
-    this(context, null);
-  }
-
-  public TopEntriesFunctionCollector(LuceneFunctionContext<TopEntriesCollector> context, GemFireCacheImpl cache) {
-    this.cache = cache;
-    id = cache == null ? String.valueOf(this.hashCode()) : cache.getName();
-
-    int limit = context == null ? 0 : context.getLimit();
-    
-    if (context != null && context.getCollectorManager() != null) {
-      this.manager = context.getCollectorManager();
-    } else {
-      this.manager = new TopEntriesCollectorManager(id, limit);
-    }
-  }
-
-  @Override
-  public TopEntries getResult() throws FunctionException {
-    try {
-      waitForResults.await();
-    } catch (InterruptedException e) {
-      logger.debug("Interrupted while waiting for result collection", e);
-      Thread.currentThread().interrupt();
-      if (cache != null) {
-        cache.getCancelCriterion().checkCancelInProgress(e);
-      }
-      throw new FunctionException(e);
-    }
-
-    return aggregateResults();
-  }
-
-  @Override
-  public TopEntries getResult(long timeout, TimeUnit unit) throws FunctionException {
-    try {
-      boolean result = waitForResults.await(timeout, unit);
-      if (!result) {
-        throw new FunctionException("Did not receive results from all members within wait time");
-      }
-    } catch (InterruptedException e) {
-      logger.debug("Interrupted while waiting for result collection", e);
-      Thread.currentThread().interrupt();
-      if (cache != null) {
-        cache.getCancelCriterion().checkCancelInProgress(e);
-      }
-      throw new FunctionException(e);
-    }
-
-    return aggregateResults();
-  }
-
-  private TopEntries aggregateResults() {
-    synchronized (subResults) {
-      if (mergedResults != null) {
-        return mergedResults.getEntries();
-      }
-      
-      mergedResults = manager.reduce(subResults);
-      return mergedResults.getEntries();
-    }
-  }
-
-  @Override
-  public void endResults() {
-    synchronized (subResults) {
-      waitForResults.countDown();
-    }
-  }
-
-  @Override
-  public void clearResults() {
-    synchronized (subResults) {
-      if (waitForResults.getCount() == 0) {
-        throw new IllegalStateException("This collector is closed and cannot accept anymore results");
-      }
-
-      subResults.clear();
-    }
-  }
-
-  @Override
-  public void addResult(DistributedMember memberID, TopEntriesCollector resultOfSingleExecution) {
-    synchronized (subResults) {
-      if (waitForResults.getCount() == 0) {
-        throw new IllegalStateException("This collector is closed and cannot accept anymore results");
-      }
-      subResults.add(resultOfSingleExecution);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/package-info.java
deleted file mode 100644
index 4079ad4..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-/**
- * Classes used for distributing lucene queries to geode nodes. Contains the lucene related functions
- * like {@link com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction} as well as objects that are
- * passed between nodes like {@link com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore}
- */
-
-package com.gemstone.gemfire.cache.lucene.internal.distributed;
\ No newline at end of file



[56/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-web/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-web/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
GEODE-37 change package name from com.gemstone.gemfire (for ./geode-web/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-web/src/test/java/org/apache/geode)


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7c20e693
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7c20e693
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7c20e693

Branch: refs/heads/feature/GEODE-37_2
Commit: 7c20e693180198ff6787b2ac4508eb375b7199e5
Parents: 92e2464
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Sep 13 15:43:20 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Tue Sep 13 15:43:20 2016 -0700

----------------------------------------------------------------------
 .../cli/commands/CommandOverHttpDUnitTest.java  |  58 ---
 .../ConnectCommandWithHttpAndSSLDUnitTest.java  | 319 ------------
 .../DataCommandsOverHttpDistributedTest.java    | 151 ------
 .../GfshCommandsOverHttpSecurityTest.java       |  30 --
 .../internal/web/AbstractWebTestCase.java       |  96 ----
 .../ShellCommandsControllerJUnitTest.java       | 238 ---------
 .../LoginHandlerInterceptorJUnitTest.java       | 273 ----------
 .../internal/web/domain/LinkIndexJUnitTest.java | 236 ---------
 .../internal/web/domain/LinkJUnitTest.java      | 123 -----
 .../domain/QueryParameterSourceJUnitTest.java   |  92 ----
 .../web/http/ClientHttpRequestJUnitTest.java    | 509 -------------------
 ...ableObjectHttpMessageConverterJUnitTest.java | 165 ------
 .../RestHttpOperationInvokerJUnitTest.java      | 453 -----------------
 .../SimpleHttpOperationInvokerJUnitTest.java    | 198 --------
 .../web/util/ConvertUtilsJUnitTest.java         | 170 -------
 .../internal/web/util/UriUtilsJUnitTest.java    | 118 -----
 .../cli/commands/CommandOverHttpDUnitTest.java  |  58 +++
 .../ConnectCommandWithHttpAndSSLDUnitTest.java  | 319 ++++++++++++
 .../DataCommandsOverHttpDistributedTest.java    | 151 ++++++
 .../GfshCommandsOverHttpSecurityTest.java       |  30 ++
 .../internal/web/AbstractWebTestCase.java       |  96 ++++
 .../ShellCommandsControllerJUnitTest.java       | 238 +++++++++
 .../LoginHandlerInterceptorJUnitTest.java       | 273 ++++++++++
 .../internal/web/domain/LinkIndexJUnitTest.java | 236 +++++++++
 .../internal/web/domain/LinkJUnitTest.java      | 123 +++++
 .../domain/QueryParameterSourceJUnitTest.java   |  92 ++++
 .../web/http/ClientHttpRequestJUnitTest.java    | 509 +++++++++++++++++++
 ...ableObjectHttpMessageConverterJUnitTest.java | 165 ++++++
 .../RestHttpOperationInvokerJUnitTest.java      | 453 +++++++++++++++++
 .../SimpleHttpOperationInvokerJUnitTest.java    | 198 ++++++++
 .../web/util/ConvertUtilsJUnitTest.java         | 170 +++++++
 .../internal/web/util/UriUtilsJUnitTest.java    | 118 +++++
 32 files changed, 3229 insertions(+), 3229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
deleted file mode 100644
index 2f5348f..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.management.internal.cli.commands;
-
-import org.junit.ClassRule;
-import org.junit.contrib.java.lang.system.ProvideSystemProperty;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-import com.gemstone.gemfire.test.junit.runner.SuiteRunner;
-
-@Category({ DistributedTest.class, SecurityTest.class })
-@RunWith(SuiteRunner.class)
-@Suite.SuiteClasses({
-  ConfigCommandsDUnitTest.class,
-  DeployCommandsDUnitTest.class,
-  DiskStoreCommandsDUnitTest.class,
-  FunctionCommandsDUnitTest.class,
-  GemfireDataCommandsDUnitTest.class,
-  GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.class,
-  IndexCommandsDUnitTest.class,
-  ListAndDescribeDiskStoreCommandsDUnitTest.class,
-  ListIndexCommandDUnitTest.class,
-  MemberCommandsDUnitTest.class,
-  MiscellaneousCommandsDUnitTest.class,
-  MiscellaneousCommandsExportLogsPart1DUnitTest.class,
-  MiscellaneousCommandsExportLogsPart2DUnitTest.class,
-  MiscellaneousCommandsExportLogsPart3DUnitTest.class,
-  MiscellaneousCommandsExportLogsPart4DUnitTest.class,
-  QueueCommandsDUnitTest.class,
-  SharedConfigurationCommandsDUnitTest.class,
-  ShellCommandsDUnitTest.class,
-  ShowDeadlockDUnitTest.class,
-  ShowMetricsDUnitTest.class,
-  ShowStackTraceDUnitTest.class,
-  UserCommandsDUnitTest.class
-})
-public class CommandOverHttpDUnitTest {
-  @ClassRule
-  public static ProvideSystemProperty provideSystemProperty = new ProvideSystemProperty(CliCommandTestBase.USE_HTTP_SYSTEM_PROPERTY, "true");
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
deleted file mode 100644
index dab762b..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * 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.management.internal.cli.commands;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
-import static com.gemstone.gemfire.util.test.TestUtil.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Properties;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-import com.gemstone.gemfire.test.junit.runners.CategoryWithParameterizedRunnerFactory;
-
-/**
- * @since GemFire  8.1
- */
-@Category({ DistributedTest.class, SecurityTest.class })
-@RunWith(Parameterized.class)
-@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
-public class ConnectCommandWithHttpAndSSLDUnitTest extends CliCommandTestBase {
-
-  private static final ThreadLocal<Properties> sslInfoHolder = new ThreadLocal<>();
-
-  private File jks;
-
-  @Parameterized.Parameter
-  public String urlContext;
-
-  @Parameterized.Parameters
-  public static Collection<String> data() {
-    return Arrays.asList("/geode-mgmt", "/gemfire");
-  }
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    this.jks = new File(getResourcePath(getClass(), "/ssl/trusted.keystore"));
-  }
-  
-  @Override
-  protected final void preTearDownCliCommandTestBase() throws Exception {
-    destroyDefaultSetup();
-  }
-  
-  @Override
-  public final void postTearDownCacheTestCase() throws Exception {
-    sslInfoHolder.set(null);
-  }
-
-  @Test
-  public void testMutualAuthentication() throws Exception {
-    Properties serverProps = new Properties();
-    serverProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE, "JKS");
-    serverProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL");
-    serverProps.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION, "true");
-    serverProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE, jks.getCanonicalPath());
-    serverProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, "password");
-
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__KEY_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__KEY_STORE_PASSWORD, "password");
-    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "SSL");
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(serverProps);
-  }
-
-  @Test
-  public void testSimpleSSL() throws Exception {
-    Properties serverProps = new Properties();
-    serverProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE, "JKS");
-
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(serverProps);
-  }
-
-  @Test
-  public void testSSLWithoutKeyStoreType() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-  
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithSSLProtocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithTLSProtocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLS");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithTLSv11Protocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.1");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithTLSv12Protocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testWithMultipleProtocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL,TLSv1.2");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Ignore("TODO: disabled for unknown reason")
-  @Test
-  public void testSSLWithCipherSuite() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
-
-    //Its bad to hard code here. But using SocketFactory.getDefaultCiphers() somehow is not working with the option 
-    //"https.cipherSuites" which is required to restrict cipher suite with HttpsURLConnection
-    //Keeping the below code for further investigation on different Java versions ( 7 & 8) @TODO
-    
-    /*SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
-    
-    sslContext.init(null, null, new java.security.SecureRandom());
-    String[] cipherSuites = sslContext.getSocketFactory().getSupportedCipherSuites();*/
-
-    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
-
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    clientProps.setProperty(CONNECT__SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
-    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Ignore("TODO: disabled for unknown reason")
-  @Test
-  public void testSSLWithMultipleCipherSuite() throws Exception {
-    System.setProperty("javax.net.debug", "ssl,handshake,failure");
-    
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
-    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_EMPTY_RENEGOTIATION_INFO_SCSV");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Override
-  protected void connect(final String host, final int jmxPort, final int httpPort, final HeadlessGfsh shell) {
-    assertNotNull(host);
-    assertNotNull(shell);
-
-    final CommandStringBuilder command = new CommandStringBuilder(CONNECT);
-    String endpoint;
-
-    // This is for testing purpose only. If we remove this piece of code we will
-    // get a java.security.cert.CertificateException
-    // as matching hostname can not be obtained in all test environment.
-    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
-      @Override
-      public boolean verify(String string, SSLSession ssls) {
-        return true;
-      }
-    });
-    
-    endpoint = "https://" + host + ":" + httpPort + urlContext + "/v1";
-    
-    command.addOption(CONNECT__USE_HTTP, Boolean.TRUE.toString());
-    command.addOption(CONNECT__URL, endpoint);
-    command.addOption(CONNECT__USE_SSL,Boolean.TRUE.toString());
-
-    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE) != null){
-      command.addOption(CONNECT__KEY_STORE, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD) != null){
-      command.addOption(CONNECT__KEY_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE) != null){
-      command.addOption(CONNECT__TRUST_STORE, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD) != null){
-      command.addOption(CONNECT__TRUST_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS) != null){
-      command.addOption(CONNECT__SSL_PROTOCOLS, sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS) != null){
-      command.addOption(CONNECT__SSL_CIPHERS, sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS));
-    }
-
-    CommandResult result = executeCommand(shell, command.toString());
-
-    if (!shell.isConnectedAndReady()) {
-      fail("Connect command failed to connect to manager " + endpoint + " result=" + commandResultToString(result));
-    }
-
-    info("Successfully connected to managing node using HTTPS");
-    assertEquals(true, shell.isConnectedAndReady());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java
deleted file mode 100644
index 11b8ab1..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.management.internal.cli.commands;
-
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
-import static com.gemstone.gemfire.test.dunit.Wait.*;
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionFactory;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.management.DistributedRegionMXBean;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.ProvideSystemProperty;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
-@SuppressWarnings("deprecated")
-public class DataCommandsOverHttpDistributedTest extends CliCommandTestBase {
-
-  private static final String REBALANCE_REGION_NAME = DataCommandsOverHttpDistributedTest.class.getSimpleName() + "Region";
-
-  @ClassRule
-  public static ProvideSystemProperty provideSystemProperty = new ProvideSystemProperty(CliCommandTestBase.USE_HTTP_SYSTEM_PROPERTY, "true");
-
-  @Test
-  public void testSimulateForEntireDSWithTimeout() {
-    setupTestRebalanceForEntireDS();
-    //check if DistributedRegionMXBean is available so that command will not fail
-    final VM manager = Host.getHost(0).getVM(0);
-    manager.invoke(checkRegionMBeans);
-
-    getLogWriter().info("testSimulateForEntireDS verified MBean and executing command");
-
-    String command = "rebalance --simulate=true --time-out=-1";
-
-    CommandResult cmdResult = executeCommand(command);
-
-    getLogWriter().info("testSimulateForEntireDS just after executing " + cmdResult);
-
-    if (cmdResult != null) {
-      String stringResult = commandResultToString(cmdResult);
-      getLogWriter().info("testSimulateForEntireDS stringResult : " + stringResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
-    }
-  }
-
-  SerializableRunnable checkRegionMBeans = new SerializableRunnable() {
-    @Override
-    public void run() {
-      final WaitCriterion waitForMaangerMBean = new WaitCriterion() {
-        @Override
-        public boolean done() {
-          final ManagementService service = ManagementService.getManagementService(getCache());
-          final DistributedRegionMXBean bean = service.getDistributedRegionMXBean(
-            Region.SEPARATOR + REBALANCE_REGION_NAME);
-          if (bean == null) {
-            getLogWriter().info("Still probing for checkRegionMBeans ManagerMBean");
-            return false;
-          } else {
-            // verify that bean is proper before executing tests
-            if (bean.getMembers() != null && bean.getMembers().length > 1 && bean.getMemberCount() > 0 && service.getDistributedSystemMXBean().listRegions().length >= 2) {
-              return true;
-            } else {
-              return false;
-            }
-          }
-        }
-
-        @Override
-        public String description() {
-          return "Probing for testRebalanceCommandForSimulateWithNoMember ManagerMBean";
-        }
-      };
-      waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
-      DistributedRegionMXBean bean = ManagementService.getManagementService(getCache()).getDistributedRegionMXBean(
-        "/" + REBALANCE_REGION_NAME);
-      assertNotNull(bean);
-    }
-  };
-
-  void setupTestRebalanceForEntireDS() {
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-    setUpJmxManagerOnVm0ThenConnect(null);
-
-    vm1.invoke(new SerializableRunnable() {
-      public void run() {
-
-        // no need to close cache as it will be closed as part of teardown2
-        Cache cache = getCache();
-
-        RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
-        Region region = dataRegionFactory.create(REBALANCE_REGION_NAME);
-        for (int i = 0; i < 10; i++) {
-          region.put("key" + (i + 200), "value" + (i + 200));
-        }
-        region = dataRegionFactory.create(REBALANCE_REGION_NAME + "Another1");
-        for (int i = 0; i < 100; i++) {
-          region.put("key" + (i + 200), "value" + (i + 200));
-        }
-      }
-    });
-
-    vm2.invoke(new SerializableRunnable() {
-      public void run() {
-
-        // no need to close cache as it will be closed as part of teardown2
-        Cache cache = getCache();
-
-        RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
-        Region region = dataRegionFactory.create(REBALANCE_REGION_NAME);
-        for (int i = 0; i < 100; i++) {
-          region.put("key" + (i + 400), "value" + (i + 400));
-        }
-        region = dataRegionFactory.create(REBALANCE_REGION_NAME + "Another2");
-        for (int i = 0; i < 10; i++) {
-          region.put("key" + (i + 200), "value" + (i + 200));
-        }
-      }
-    });
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java
deleted file mode 100644
index 313f31a..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.management.internal.security;
-
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-import org.junit.experimental.categories.Category;
-
-@Category({ IntegrationTest.class, SecurityTest.class })
-public class GfshCommandsOverHttpSecurityTest extends GfshCommandsSecurityTest {
-  public GfshCommandsOverHttpSecurityTest(){
-    gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, true);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/AbstractWebTestCase.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/AbstractWebTestCase.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/AbstractWebTestCase.java
deleted file mode 100644
index ae5c749..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/AbstractWebTestCase.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.management.internal.web;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.management.internal.web.domain.Link;
-
-/**
- * The AbstractWebDomainTests class is abstract base class containing functionality common to a test suite classes
- * in the com.gemstone.gemfire.management.internal.web.domain package.
- * <p/>
- * @see java.net.URI
- * @see java.net.URLDecoder
- * @see java.net.URLEncoder
- * @see com.gemstone.gemfire.management.internal.web.domain.Link
- * @since GemFire 8.0
- */
-@SuppressWarnings("unused")
-public abstract class AbstractWebTestCase {
-
-  protected <E> E[] createArray(final E... array) {
-    return array;
-  }
-
-  protected <K, V> Map<K, V> createMap(final K[] keys, final V[] values) {
-    assert keys != null : "The Keys for the Map cannot be null!";
-    assert values != null : "The Values for the Map cannot be null!";
-    assert keys.length == values.length;
-
-    final Map<K, V> map = new HashMap<K, V>(keys.length);
-    int index = 0;
-
-    for (final K key : keys) {
-      map.put(key, values[index++]);
-    }
-
-    return map;
-  }
-
-  protected String decode(final String encodedValue) throws UnsupportedEncodingException {
-    return URLDecoder.decode(encodedValue, StringUtils.UTF_8);
-  }
-
-  protected String encode(final String value) throws UnsupportedEncodingException {
-    return URLEncoder.encode(value, StringUtils.UTF_8);
-  }
-
-  protected String toString(final Link... links) throws UnsupportedEncodingException {
-    final StringBuilder buffer = new StringBuilder("[");
-    int count = 0;
-
-    for (final Link link : links) {
-      buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(toString(link));
-
-    }
-
-    buffer.append("]");
-
-    return buffer.toString();
-  }
-
-  protected String toString(final Link link) throws UnsupportedEncodingException {
-    return link.toHttpRequestLine();
-  }
-
-  protected String toString(final URI uri) throws UnsupportedEncodingException {
-    return decode(uri.toString());
-  }
-
-  protected URI toUri(final String uriString) throws UnsupportedEncodingException, URISyntaxException {
-    return new URI(encode(uriString));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
deleted file mode 100644
index 8fd3127..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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.management.internal.web.controllers;
-
-import static org.junit.Assert.*;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import com.gemstone.gemfire.management.cli.CliMetaData;
-import com.gemstone.gemfire.management.internal.cli.util.ClasspathScanLoadHelper;
-import com.gemstone.gemfire.management.internal.web.domain.Link;
-import com.gemstone.gemfire.management.internal.web.domain.LinkIndex;
-import com.gemstone.gemfire.management.internal.web.util.UriUtils;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * The ShellCommandsControllerJUnitTest class is a test suite of test cases testing the contract and functionality of the
- * ShellCommandsController class, and specifically ensuring that all GemFire Gfsh commands have a corresponding
- * Management REST API call and web service endpoint in the GemFire Management REST Interface.
- * <p/>
- * @see org.junit.Test
- * @see com.gemstone.gemfire.management.internal.web.controllers.ShellCommandsController
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class ShellCommandsControllerJUnitTest {
-
-  private static ShellCommandsController controller;
-
-  @BeforeClass
-  public static void setupBeforeClass() {
-    controller = new ShellCommandsController();
-    MockHttpServletRequest request = new MockHttpServletRequest();
-    request.setContextPath("gemfire");
-    RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
-  }
-
-  @AfterClass
-  public static void tearDownAfterClass() {
-    controller = null;
-  }
-
-  private List<String> getCliCommands() {
-    try {
-      Set<Class<?>> commandClasses = ClasspathScanLoadHelper.loadAndGet(
-        "com.gemstone.gemfire.management.internal.cli.commands", CommandMarker.class, true);
-
-      List<String> commands = new ArrayList<>(commandClasses.size());
-
-      for (Class<?> commandClass : commandClasses) {
-        for (Method method : commandClass.getMethods()) {
-          if (method.isAnnotationPresent(CliCommand.class)) {
-            if (!(method.isAnnotationPresent(CliMetaData.class)
-              && method.getAnnotation(CliMetaData.class).shellOnly()))
-            {
-              CliCommand commandAnnotation = method.getAnnotation(CliCommand.class);
-              commands.addAll(Arrays.asList(commandAnnotation.value()));
-            }
-          }
-        }
-      }
-
-      return commands;
-    }
-    catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  private List<String> getControllerWebServiceEndpoints() {
-    RequestAttributes requestAttrs = RequestContextHolder.getRequestAttributes();
-    HttpServletRequest servletRequest = ((ServletRequestAttributes) requestAttrs).getRequest();
-    String scheme = servletRequest.getScheme();
-
-    try {
-      Set<Class<?>> controllerClasses = ClasspathScanLoadHelper.loadAndGet(
-        "com.gemstone.gemfire.management.internal.web.controllers", AbstractCommandsController.class, true);
-
-      List<String> controllerWebServiceEndpoints = new ArrayList<>(controllerClasses.size());
-
-      for (Class<?> controllerClass : controllerClasses) {
-        if (!AbstractCommandsController.class.equals(controllerClass)) {
-          for (Method method : controllerClass.getMethods()) {
-            if (method.isAnnotationPresent(RequestMapping.class)) {
-              RequestMapping requestMappingAnnotation = method.getAnnotation(RequestMapping.class);
-
-              String webServiceEndpoint = String.format("%1$s %2$s", requestMappingAnnotation.method()[0],
-                UriUtils.decode(controller.toUri(requestMappingAnnotation.value()[0], scheme).toString()));
-
-              String[] requestParameters = requestMappingAnnotation.params();
-
-              if (requestParameters.length > 0) {
-                webServiceEndpoint += "?".concat(
-                  com.gemstone.gemfire.internal.lang.StringUtils.concat(requestParameters, "&amp;"));
-              }
-
-              controllerWebServiceEndpoints.add(webServiceEndpoint);
-            }
-          }
-        }
-      }
-
-      return controllerWebServiceEndpoints;
-    }
-    catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Test
-  public void testUniqueIndex() {
-    LinkIndex linkIndex = controller.index("https");
-
-    List<String> conflicts = new ArrayList<>();
-    Map<String, String> uriRelationMapping = new HashMap<>(linkIndex.size());
-
-    for (Link link : linkIndex) {
-      if (uriRelationMapping.containsKey(link.toHttpRequestLine())) {
-        conflicts.add(String.format("REST API endpoint (%1$s) for (%2$s) conflicts with the REST API endpoint for (%3$s)",
-          link.toHttpRequestLine(), link.getRelation(), uriRelationMapping.get(link.toHttpRequestLine())));
-      }
-      else {
-        uriRelationMapping.put(link.toHttpRequestLine(), link.getRelation());
-      }
-    }
-
-    assertTrue(String.format("Conflicts: %1$s!", conflicts), conflicts.isEmpty());
-  }
-
-  @Test
-  public void testIndex() {
-    List<String> commands = getCliCommands();
-
-    assertNotNull(commands);
-    assertFalse(commands.isEmpty());
-
-    LinkIndex linkIndex = controller.index("https");
-
-    assertNotNull(linkIndex);
-    assertFalse(linkIndex.isEmpty());
-
-    List<String> linkCommands = new ArrayList<>(linkIndex.size());
-
-    for (Link link : linkIndex) {
-      linkCommands.add(link.getRelation());
-    }
-
-    assertEquals(linkIndex.size(), linkCommands.size());
-
-    List<String> missingLinkCommands = new ArrayList<>(commands);
-
-    missingLinkCommands.removeAll(linkCommands);
-
-    assertTrue(String.format(
-      "The GemFire Management REST API Link Index is missing Link(s) for the following command(s): %1$s",
-        missingLinkCommands), missingLinkCommands.isEmpty());
-  }
-
-  @Test
-  public void testCommandHasRestApiControllerWebServiceEndpoint() {
-    List<String> controllerWebServiceEndpoints = getControllerWebServiceEndpoints();
-
-    assertNotNull(controllerWebServiceEndpoints);
-    assertFalse(controllerWebServiceEndpoints.isEmpty());
-
-    LinkIndex linkIndex = controller.index("http");
-
-    assertNotNull(linkIndex);
-    assertFalse(linkIndex.isEmpty());
-
-    List<String> linkWebServiceEndpoints = new ArrayList<>(linkIndex.size());
-
-    for (Link link : linkIndex) {
-      linkWebServiceEndpoints.add(link.toHttpRequestLine());
-    }
-
-    assertEquals(linkIndex.size(), linkWebServiceEndpoints.size());
-
-    List<String> missingControllerWebServiceEndpoints = new ArrayList<>(linkWebServiceEndpoints);
-
-    missingControllerWebServiceEndpoints.removeAll(controllerWebServiceEndpoints);
-
-    assertTrue(String.format(
-        "The Management REST API Web Service Controllers in (%1$s) are missing the following REST API Web Service Endpoint(s): %2$s!",
-        getClass().getPackage().getName(), missingControllerWebServiceEndpoints), missingControllerWebServiceEndpoints.isEmpty());
-  }
-
-  @Test
-  public void testIndexUrisHaveCorrectScheme() {
-    String versionCmd = "version";
-    List<String> controllerWebServiceEndpoints = getControllerWebServiceEndpoints();
-
-    assertNotNull(controllerWebServiceEndpoints);
-    assertFalse(controllerWebServiceEndpoints.isEmpty());
-
-    String testScheme = "xyz";
-    LinkIndex linkIndex = controller.index(testScheme);
-
-    assertNotNull(linkIndex);
-    assertFalse(linkIndex.isEmpty());
-
-    assertTrue(String.format("Link does not have correct scheme %1$s", linkIndex.find(versionCmd)),
-        testScheme.equals(linkIndex.find(versionCmd).getHref().getScheme()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java
deleted file mode 100644
index 0037a48..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * 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.management.internal.web.controllers.support;
-
-import static org.junit.Assert.*;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-
-import edu.umd.cs.mtc.MultithreadedTestCase;
-import edu.umd.cs.mtc.TestFramework;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.concurrent.Synchroniser;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * The LoginHandlerInterceptorJUnitTest class is a test suite of test cases to test the contract
- * and functionality of the Spring HandlerInterceptor, LoginHandlerInterceptor class.
- * 
- * @see org.jmock.Mockery
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class LoginHandlerInterceptorJUnitTest {
-
-  private Mockery mockContext;
-
-  @Before
-  public void setUp() {
-    mockContext = new Mockery();
-    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
-    mockContext.setThreadingPolicy(new Synchroniser());
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  private String createEnvironmentVariable(final String name) {
-    return (LoginHandlerInterceptor.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + name);
-  }
-
-  private <T> Enumeration<T> enumeration(final Iterator<T> iterator) {
-    return new Enumeration<T>() {
-      public boolean hasMoreElements() {
-        return iterator.hasNext();
-      }
-      public T nextElement() {
-        return iterator.next();
-      }
-    };
-  }
-
-  @Test
-  public void testPreHandleAfterCompletion() throws Exception {
-    final Map<String, String> requestParameters = new HashMap<>(2);
-    final Map<String, String> requestHeaders = new HashMap<>();
-
-    requestParameters.put("parameter", "one");
-    requestParameters.put(createEnvironmentVariable("variable"), "two");
-
-    final HttpServletRequest mockHttpRequest = mockContext.mock(HttpServletRequest.class, "testPreHandleAfterCompletion.HttpServletRequest");
-
-    mockContext.checking(new Expectations() {{
-      oneOf(mockHttpRequest).getParameterNames();
-      will(returnValue(enumeration(requestParameters.keySet().iterator())));
-      oneOf(mockHttpRequest).getHeaderNames();
-      will(returnValue(enumeration(requestHeaders.keySet().iterator())));
-      oneOf(mockHttpRequest).getParameter(with(equal(createEnvironmentVariable("variable"))));
-      will(returnValue(requestParameters.get(createEnvironmentVariable("variable"))));
-    }});
-
-    LoginHandlerInterceptor handlerInterceptor = new LoginHandlerInterceptor();
-
-    Map<String, String> envBefore = LoginHandlerInterceptor.getEnvironment();
-
-    assertNotNull(envBefore);
-    assertTrue(envBefore.isEmpty());
-    assertTrue(handlerInterceptor.preHandle(mockHttpRequest, null, null));
-
-    Map<String, String> envSet = LoginHandlerInterceptor.getEnvironment();
-
-    assertNotNull(envSet);
-    assertNotSame(envBefore, envSet);
-    assertEquals(1, envSet.size());
-    assertTrue(envSet.containsKey("variable"));
-    assertEquals("two", envSet.get("variable"));
-
-    handlerInterceptor.afterCompletion(mockHttpRequest, null, null, null);
-
-    Map<String, String> envAfter = LoginHandlerInterceptor.getEnvironment();
-
-    assertNotNull(envAfter);
-    assertTrue(envAfter.isEmpty());
-  }
-
-  @Test
-  public void testHandlerInterceptorThreadSafety() throws Throwable {
-    TestFramework.runOnce(new HandlerInterceptorThreadSafetyMultiThreadedTestCase());
-  }
-
-  private final class HandlerInterceptorThreadSafetyMultiThreadedTestCase extends MultithreadedTestCase {
-
-    private LoginHandlerInterceptor handlerInterceptor;
-
-    private HttpServletRequest mockHttpRequestOne;
-    private HttpServletRequest mockHttpRequestTwo;
-
-    @Override
-    public void initialize() {
-      super.initialize();
-
-      final Map<String, String> requestParametersOne = new HashMap<>(3);
-      final Map<String, String> requestHeaders = new HashMap<>();
-
-      requestParametersOne.put("param", "one");
-      requestParametersOne.put(createEnvironmentVariable("STAGE"), "test");
-      requestParametersOne.put(createEnvironmentVariable("GEMFIRE"), "/path/to/gemfire/700");
-
-      mockHttpRequestOne = mockContext.mock(HttpServletRequest.class, "testHandlerInterceptorThreadSafety.HttpServletRequest.1");
-
-      mockContext.checking(new Expectations() {{
-        oneOf(mockHttpRequestOne).getParameterNames();
-        will(returnValue(enumeration(requestParametersOne.keySet().iterator())));
-        oneOf(mockHttpRequestOne).getHeaderNames();
-        will(returnValue(enumeration(requestHeaders.keySet().iterator())));
-        oneOf(mockHttpRequestOne).getParameter(with(equal(createEnvironmentVariable("STAGE"))));
-        will(returnValue(requestParametersOne.get(createEnvironmentVariable("STAGE"))));
-        oneOf(mockHttpRequestOne).getParameter(with(equal(createEnvironmentVariable("GEMFIRE"))));
-        will(returnValue(requestParametersOne.get(createEnvironmentVariable("GEMFIRE"))));
-      }});
-
-      mockHttpRequestTwo = mockContext.mock(HttpServletRequest.class, "testHandlerInterceptorThreadSafety.HttpServletRequest.2");
-
-      final Map<String, String> requestParametersTwo = new HashMap<>(3);
-
-      requestParametersTwo.put("parameter", "two");
-      requestParametersTwo.put(createEnvironmentVariable("HOST"), "localhost");
-      requestParametersTwo.put(createEnvironmentVariable("GEMFIRE"), "/path/to/gemfire/75");
-
-      mockContext.checking(new Expectations() {{
-        oneOf(mockHttpRequestTwo).getParameterNames();
-        will(returnValue(enumeration(requestParametersTwo.keySet().iterator())));
-        oneOf(mockHttpRequestTwo).getHeaderNames();
-        will(returnValue(enumeration(requestHeaders.keySet().iterator())));
-        oneOf(mockHttpRequestTwo).getParameter(with(equal(createEnvironmentVariable("HOST"))));
-        will(returnValue(requestParametersTwo.get(createEnvironmentVariable("HOST"))));
-        oneOf(mockHttpRequestTwo).getParameter(with(equal(createEnvironmentVariable("GEMFIRE"))));
-        will(returnValue(requestParametersTwo.get(createEnvironmentVariable("GEMFIRE"))));
-      }});
-
-      handlerInterceptor =  new LoginHandlerInterceptor();
-    }
-
-    public void thread1() throws Exception {
-      assertTick(0);
-      Thread.currentThread().setName("HTTP Request Processing Thread 1");
-
-      Map<String, String> env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertTrue(env.isEmpty());
-      assertTrue(handlerInterceptor.preHandle(mockHttpRequestOne, null, null));
-
-      env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertEquals(2, env.size());
-      assertFalse(env.containsKey("param"));
-      assertFalse(env.containsKey("parameter"));
-      assertFalse(env.containsKey("HOST"));
-      assertEquals("test", env.get("STAGE"));
-      assertEquals("/path/to/gemfire/700", env.get("GEMFIRE"));
-
-      waitForTick(2);
-
-      env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertEquals(2, env.size());
-      assertFalse(env.containsKey("param"));
-      assertFalse(env.containsKey("parameter"));
-      assertFalse(env.containsKey("HOST"));
-      assertEquals("test", env.get("STAGE"));
-      assertEquals("/path/to/gemfire/700", env.get("GEMFIRE"));
-
-      waitForTick(4);
-
-      env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertEquals(2, env.size());
-      assertFalse(env.containsKey("param"));
-      assertFalse(env.containsKey("parameter"));
-      assertFalse(env.containsKey("HOST"));
-      assertEquals("test", env.get("STAGE"));
-      assertEquals("/path/to/gemfire/700", env.get("GEMFIRE"));
-
-      handlerInterceptor.afterCompletion(mockHttpRequestOne, null, null, null);
-
-      env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertTrue(env.isEmpty());
-    }
-
-    public void thread2() throws Exception {
-      assertTick(0);
-      Thread.currentThread().setName("HTTP Request Processing Thread 2");
-      waitForTick(1);
-
-      Map<String, String> env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertTrue(env.isEmpty());
-      assertTrue(handlerInterceptor.preHandle(mockHttpRequestTwo, null, null));
-
-      env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertEquals(2, env.size());
-      assertFalse(env.containsKey("parameter"));
-      assertFalse(env.containsKey("param"));
-      assertFalse(env.containsKey("STAGE"));
-      assertEquals("localhost", env.get("HOST"));
-      assertEquals("/path/to/gemfire/75", env.get("GEMFIRE"));
-
-      waitForTick(3);
-
-      handlerInterceptor.afterCompletion(mockHttpRequestTwo, null, null, null);
-
-      env = LoginHandlerInterceptor.getEnvironment();
-
-      assertNotNull(env);
-      assertTrue(env.isEmpty());
-    }
-
-    @Override
-    public void finish() {
-      super.finish();
-      handlerInterceptor = null;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkIndexJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkIndexJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkIndexJUnitTest.java
deleted file mode 100644
index 61a9736..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkIndexJUnitTest.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * 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.management.internal.web.domain;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.gemstone.gemfire.internal.util.CollectionUtils;
-import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
-import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * The LinkIndexJUnitTest class is a test suite of test cases testing the contract and functionality of the LinkIndex class.
- * <p/>
- * @see java.net.URI
- * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
- * @see com.gemstone.gemfire.management.internal.web.domain.LinkIndex
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class LinkIndexJUnitTest extends AbstractWebTestCase {
-
-  @Test
-  public void testAdd() throws Exception {
-    final Link link = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(0, linkIndex.size());
-    assertEquals(linkIndex, linkIndex.add(link));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(1, linkIndex.size());
-    assertEquals(linkIndex, linkIndex.add(link)); // test duplicate addition
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(1, linkIndex.size());
-  }
-
-  @Test(expected = AssertionError.class)
-  public void testAddNullLink() {
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-
-    try {
-      linkIndex.add(null);
-    }
-    finally {
-      assertTrue(linkIndex.isEmpty());
-    }
-  }
-
-  @Test
-  public void testAddAll() throws Exception {
-    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
-    final Link retrieve = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
-    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(linkIndex, linkIndex.addAll(create, retrieve, update, delete));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(4, linkIndex.size());
-  }
-
-  @Test(expected = AssertionError.class)
-  public void testAddAllWithNullLinks() {
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-
-    try {
-      linkIndex.addAll((Iterable<Link>) null);
-    }
-    finally {
-      assertTrue(linkIndex.isEmpty());
-    }
-  }
-
-  @Test
-  public void testFind() throws Exception {
-    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
-    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
-    final Link retrieve = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
-    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieve, update, delete));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(5, linkIndex.size());
-    assertEquals(list, linkIndex.find("get-resources"));
-    assertEquals(retrieve, linkIndex.find("get-resource"));
-    assertEquals(update, linkIndex.find("UPDATE-RESOURCE"));
-    assertEquals(delete, linkIndex.find("Delete-Resource"));
-    assertNull(linkIndex.find("destroy-resource"));
-    assertNull(linkIndex.find("save-resource"));
-  }
-
-  @Test
-  public void testFindAll() throws Exception {
-    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
-    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
-    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
-    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
-    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(6, linkIndex.size());
-
-    final Link[] retrieveLinks = linkIndex.findAll("get-resource");
-
-    assertNotNull(retrieveLinks);
-    assertEquals(2, retrieveLinks.length);
-    assertTrue(Arrays.asList(retrieveLinks).containsAll(Arrays.asList(retrieveById, retrieveByName)));
-
-    final Link[] saveLinks = linkIndex.findAll("save-resource");
-
-    assertNotNull(saveLinks);
-    assertEquals(0, saveLinks.length);
-  }
-
-  @Test
-  public void testIterator() throws Exception {
-    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
-    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
-    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
-    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
-    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(6, linkIndex.size());
-
-    final Collection<Link> expectedLinks = Arrays.asList(list, create, retrieveById, retrieveByName, update, delete);
-
-    final Collection<Link> actualLinks = new ArrayList<Link>(linkIndex.size());
-
-    for (final Link link : linkIndex) {
-      actualLinks.add(link);
-    }
-
-    assertTrue(actualLinks.containsAll(expectedLinks));
-  }
-
-  @Test
-  public void testToList() throws Exception {
-    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
-    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
-    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
-    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
-    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(6, linkIndex.size());
-
-    final List<Link> expectedList = CollectionUtils.asList(list, create, retrieveById, retrieveByName, update, delete);
-
-    Collections.sort(expectedList);
-
-    assertEquals(expectedList, linkIndex.toList());
-  }
-
-  @Test
-  public void testToMap() throws Exception {
-    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
-    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
-    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
-    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
-    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final LinkIndex linkIndex = new LinkIndex();
-
-    assertTrue(linkIndex.isEmpty());
-    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
-    assertFalse(linkIndex.isEmpty());
-    assertEquals(6, linkIndex.size());
-
-    final Map<String, List<Link>> expectedMap = new HashMap<String, List<Link>>(5);
-
-    expectedMap.put("get-resources", Arrays.asList(list));
-    expectedMap.put("create-resource", Arrays.asList(create));
-    expectedMap.put("get-resource", Arrays.asList(retrieveById, retrieveByName));
-    expectedMap.put("update-resource", Arrays.asList(update));
-    expectedMap.put("delete-resource", Arrays.asList(delete));
-
-    assertEquals(expectedMap, linkIndex.toMap());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkJUnitTest.java
deleted file mode 100644
index c0b1620..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/LinkJUnitTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.management.internal.web.domain;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import com.gemstone.gemfire.internal.util.CollectionUtils;
-import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
-import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * The LinkJUnitTest class is a test suite of test cases testing the contract and functionality of the Link class.
- * <p/>
- * @see java.net.URI
- * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
- * @see com.gemstone.gemfire.management.internal.web.domain.Link
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class LinkJUnitTest extends AbstractWebTestCase {
-
-  @Test
-  public void testConstructDefaultLink() {
-    final Link link = new Link();
-
-    assertNotNull(link);
-    assertNull(link.getHref());
-    assertNull(link.getMethod());
-    assertNull(link.getRelation());
-  }
-
-  @Test
-  public void testConstructLinkWithRelationAndHref() throws Exception {
-    final Link link = new Link("get-resource", toUri("http://host:port/service/v1/resources/{id}"));
-
-    assertNotNull(link);
-    assertEquals("http://host:port/service/v1/resources/{id}", toString(link.getHref()));
-    assertEquals(HttpMethod.GET, link.getMethod());
-    assertEquals("get-resource", link.getRelation());
-  }
-
-  @Test
-  public void testConstructLinkWithRelationHrefAndMethod() throws Exception {
-    final Link link = new Link("create-resource", toUri("http://host:port/service/v1/resources"), HttpMethod.POST);
-
-    assertNotNull(link);
-    assertEquals("http://host:port/service/v1/resources", toString(link.getHref()));
-    assertEquals(HttpMethod.POST, link.getMethod());
-    assertEquals("create-resource", link.getRelation());
-  }
-
-  @Test
-  public void testSetAndGetMethod() {
-    final Link link = new Link();
-
-    assertNotNull(link);
-    assertNull(link.getMethod());
-
-    link.setMethod(HttpMethod.POST);
-
-    assertEquals(HttpMethod.POST, link.getMethod());
-
-    link.setMethod(null);
-
-    assertEquals(HttpMethod.GET, link.getMethod());
-  }
-
-  @Test
-  public void testCompareTo() throws Exception {
-    final Link link0 = new Link("resources", toUri("http://host:port/service/v1/resources"));
-    final Link link1 = new Link("resource", toUri("http://host:port/service/v1/resources"), HttpMethod.POST);
-    final Link link2 = new Link("resource", toUri("http://host:port/service/v1/resources/{id}"));
-    final Link link3 = new Link("resource", toUri("http://host:port/service/v1/resources/{name}"));
-    final Link link4 = new Link("resource", toUri("http://host:port/service/v1/resources/{id}"), HttpMethod.DELETE);
-
-    final List<Link> expectedList = new ArrayList<Link>(Arrays.asList(link1, link4, link2, link3, link0));
-
-    final List<Link> actualList = CollectionUtils.asList(link0, link1, link2, link3, link4);
-
-    Collections.sort(actualList);
-
-    System.out.println(toString(expectedList.toArray(new Link[expectedList.size()])));
-    System.out.println(toString(actualList.toArray(new Link[actualList.size()])));
-
-    assertEquals(expectedList, actualList);
-  }
-
-  @Test
-  public void testToHttpRequestLine() throws Exception {
-    final Link link = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
-
-    assertNotNull(link);
-    assertEquals(HttpMethod.GET, link.getMethod());
-    assertEquals("http://host.domain.com:port/service/v1/resources/{id}", toString(link.getHref()));
-    assertEquals("GET ".concat("http://host.domain.com:port/service/v1/resources/{id}"), link.toHttpRequestLine());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/QueryParameterSourceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/QueryParameterSourceJUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/QueryParameterSourceJUnitTest.java
deleted file mode 100644
index ae2f87b..0000000
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/web/domain/QueryParameterSourceJUnitTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.management.internal.web.domain;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * The QueryParameterSourceJUnitTest class is a test suite of test cases testing the contract and functionality of the
- * QueryParameterSource class.
- * <p/>
- * @see com.gemstone.gemfire.management.internal.web.domain.QueryParameterSource
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 8.0
- */
-@Category(UnitTest.class)
-public class QueryParameterSourceJUnitTest {
-
-  @Test
-  public void testCreateQueryParameterSource() throws MalformedObjectNameException {
-    final ObjectName expectedObjectName = ObjectName.getInstance("GemFire:type=Member,*");
-    
-    final QueryExp expectedQueryExpression = Query.eq(Query.attr("id"), Query.value("12345"));
-
-    final QueryParameterSource query = new QueryParameterSource(expectedObjectName, expectedQueryExpression);
-
-    assertNotNull(query);
-    assertSame(expectedObjectName, query.getObjectName());
-    assertSame(expectedQueryExpression, query.getQueryExpression());
-  }
-
-  @Test
-  public void testSerialization() throws ClassNotFoundException, IOException, MalformedObjectNameException {
-    final ObjectName expectedObjectName = ObjectName.getInstance("GemFire:type=Member,*");
-    
-    final QueryExp expectedQueryExpression = Query.or(
-      Query.eq(Query.attr("name"), Query.value("myName")),
-      Query.eq(Query.attr("id"), Query.value("myId"))
-    );
-
-    final QueryParameterSource expectedQuery = new QueryParameterSource(expectedObjectName, expectedQueryExpression);
-
-    assertNotNull(expectedQuery);
-    assertSame(expectedObjectName, expectedQuery.getObjectName());
-    assertSame(expectedQueryExpression, expectedQuery.getQueryExpression());
-
-    final byte[] queryBytes = IOUtils.serializeObject(expectedQuery);
-
-    assertNotNull(queryBytes);
-    assertTrue(queryBytes.length != 0);
-
-    final Object queryObj = IOUtils.deserializeObject(queryBytes);
-
-    assertTrue(queryObj instanceof QueryParameterSource);
-
-    final QueryParameterSource actualQuery = (QueryParameterSource) queryObj;
-
-    assertNotSame(expectedQuery, actualQuery);
-    assertNotNull(actualQuery.getObjectName());
-    assertEquals(expectedQuery.getObjectName().toString(), actualQuery.getObjectName().toString());
-    assertNotNull(actualQuery.getQueryExpression());
-    assertEquals(expectedQuery.getQueryExpression().toString(), actualQuery.getQueryExpression().toString());
-  }
-
-}


[22/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java
deleted file mode 100644
index 609885d..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java
+++ /dev/null
@@ -1,688 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandPauseResumeDUnitTest extends WANCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  @Test
-  public void testPauseGatewaySender_ErrorConditions() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
-        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.PAUSE_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
-        + " --" + CliStrings.PAUSE_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a member
-   */
-  @Test
-  public void testPauseGatewaySender_onMember() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    pause(10000);
-    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
-        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.PAUSE_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains("is paused on member"));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-  }
-
-  @Test
-  public void testPauseGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-            2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createSender( "ln",
-            2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createSender( "ln",
-            2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-            "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-            "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-            "ln", true, false ));
-
-    pause(10000);
-    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
-            + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-              "testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-              .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(5, status.size());
-      assertTrue(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-            "ln", true, true ));
-    vm4.invoke(() -> verifySenderState(
-            "ln", true, true ));
-    vm5.invoke(() -> verifySenderState(
-            "ln", true, true ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a group of members
-   */
-  @Test
-  public void testPauseGatewaySender_Group() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    pause(10000);
-    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
-        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.PAUSE_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testPauseGatewaySender_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, true ));
-  }
-
-  /**
-   * Test to validate the scenario gateway sender is started when one or more
-   * sender members belongs to multiple groups
-   */
-  @Test
-  public void testPauseGatewaySender_MultipleGroup() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1, SenderGroup2" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm6.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup2" ));
-    vm6.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm7.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup3" ));
-    vm7.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-    vm6.invoke(() -> startSender( "ln" ));
-    vm7.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    pause(10000);
-    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
-        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.PAUSE_GATEWAYSENDER__GROUP + "=SenderGroup1,SenderGroup2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testPauseGatewaySender_Group stringResult : " + strCmdResult
-              + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  @Test
-  public void testResumeGatewaySender_ErrorConditions() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
-    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
-        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.RESUME_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
-        + " --" + CliStrings.RESUME_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testResumeGatewaySender_ErrorConditions stringResult : "
-              + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testResumeGatewaySender() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCache( punePort ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCache( punePort ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    vm3.invoke(() -> pauseSender( "ln" ));
-    vm4.invoke(() -> pauseSender( "ln" ));
-    vm5.invoke(() -> pauseSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, true ));
-
-    pause(10000);
-    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
-        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(5, status.size());
-      assertTrue(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testResumeGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a member
-   */
-  @Test
-  public void testResumeGatewaySender_onMember() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCache( punePort ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    vm3.invoke(() -> pauseSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    pause(10000);
-    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
-        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.RESUME_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains("is resumed on member"));
-    } else {
-      fail("testResumeGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  /**
-   * test to validate that the start gateway sender starts the gateway sender on
-   * a group of members
-   */
-  @Test
-  public void testResumeGatewaySender_Group() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    vm3.invoke(() -> pauseSender( "ln" ));
-    vm4.invoke(() -> pauseSender( "ln" ));
-    vm5.invoke(() -> pauseSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, true ));
-
-    pause(10000);
-    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
-        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.RESUME_GATEWAYSENDER__GROUP + "=SenderGroup1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(3, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testResumeGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-  }
-
-  /**
-   * Test to validate the scenario gateway sender is started when one or more
-   * sender members belongs to multiple groups
-   */
-  @Test
-  public void testResumeGatewaySender_MultipleGroup() {
-
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
-    vm3.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm3.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm4.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1" ));
-    vm4.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup1, SenderGroup2" ));
-    vm5.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm6.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup2" ));
-    vm6.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-    vm7.invoke(() -> createCacheWithGroups(
-        punePort, "SenderGroup3" ));
-    vm7.invoke(() -> createSender( "ln",
-        2, false, 100, 400, false, false, null, true ));
-
-    vm3.invoke(() -> startSender( "ln" ));
-    vm4.invoke(() -> startSender( "ln" ));
-    vm5.invoke(() -> startSender( "ln" ));
-    vm6.invoke(() -> startSender( "ln" ));
-    vm7.invoke(() -> startSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, false ));
-
-    vm3.invoke(() -> pauseSender( "ln" ));
-    vm4.invoke(() -> pauseSender( "ln" ));
-    vm5.invoke(() -> pauseSender( "ln" ));
-    vm6.invoke(() -> pauseSender( "ln" ));
-    vm7.invoke(() -> pauseSender( "ln" ));
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, true ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, true ));
-
-    pause(10000);
-    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
-        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
-        + CliStrings.RESUME_GATEWAYSENDER__GROUP
-        + "=SenderGroup1,SenderGroup2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      TabularResultData resultData = (TabularResultData) cmdResult
-          .getResultData();
-      List<String> status = resultData.retrieveAllValues("Result");
-      assertEquals(4, status.size());
-      assertFalse(status.contains("Error"));
-      assertTrue(status.contains("OK"));
-    } else {
-      fail("testResumeGatewaySender failed as did not get CommandResult");
-    }
-
-    vm3.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm4.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm5.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm6.invoke(() -> verifySenderState(
-        "ln", true, false ));
-    vm7.invoke(() -> verifySenderState(
-        "ln", true, true ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java
deleted file mode 100644
index 9271614..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * 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.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandStatusDUnitTest extends WANCommandTestBase{
-  
-  private static final long serialVersionUID = 1L;
-
-  @Test
-  public void testGatewaySenderStatus(){
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-    
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createCache( lnPort ));
-    vm3.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, true ));
-    vm3.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-
-    vm4.invoke(() -> createCache( lnPort ));
-    vm4.invoke(() -> createSender(
-      "ln_Serial", 2, false, 100, 400, false, false, null, true));
-    vm4.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-    
-    vm5.invoke(() -> createCache( lnPort ));
-    vm5.invoke(() -> createSender(
-      "ln_Serial", 2, false, 100, 400, false, false, null, true));
-    vm5.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-
-    pause(10000);
-    String command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(3, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-      
-      tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(2, result_hosts.size());
-      
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewaySenderStatus : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-    
-    vm3.invoke(() -> startSender( "ln_Serial" ));
-    vm3.invoke(() -> startSender( "ln_Parallel" ));
-
-    vm4.invoke(() -> startSender( "ln_Serial" ));
-    vm4.invoke(() -> startSender( "ln_Parallel" ));
-
-    vm5.invoke(() -> startSender( "ln_Serial" ));
-    vm5.invoke(() -> startSender( "ln_Parallel" ));
-
-    pause(10000);
-    command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial";
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(3, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      
-      tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(2, result_hosts.size());
-      
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewaySenderStatus : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testGatewaySenderStatus_OnMember(){
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createCache( lnPort ));
-    vm3.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, true ));
-    vm3.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-
-    vm4.invoke(() -> createCache( lnPort ));
-    vm4.invoke(() -> createSender(
-      "ln_Serial", 2, false, 100, 400, false, false, null, true));
-    vm4.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-    
-    vm5.invoke(() -> createCache( lnPort ));
-
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    
-    pause(10000);
-    String command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --"
-        + CliStrings.STATUS_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
-    
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
-      TabularResultData tableResultData =
-          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(1, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-        
-    
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-    
-    vm3.invoke(() -> startSender( "ln_Serial" ));
-    vm3.invoke(() -> startSender( "ln_Parallel" ));
-
-    vm4.invoke(() -> startSender( "ln_Serial" ));
-    vm4.invoke(() -> startSender( "ln_Parallel" ));
-
-    pause(10000);
-    command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --"
-        + CliStrings.STATUS_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
-    
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-//      TabularResultData tableResultData =
-//        (TabularResultData) cmdResult.getResultData();
-//      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-//      assertIndexDetailsEquals(1, result_Status.size());
-//      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
-      TabularResultData tableResultData =
-          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(1, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-    
-    final DistributedMember vm5Member = (DistributedMember) vm5.invoke(() -> getMember());
-   
-    command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --"
-        + CliStrings.STATUS_GATEWAYSENDER__MEMBER + "=" + vm5Member.getId();
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-//      ErrorResultData errorResultData =
-//        (ErrorResultData) cmdResult.getResultData();
-      assertTrue(cmdResult != null);
-      
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testGatewaySenderStatus_OnGroups(){
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm7.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createCacheWithGroups( lnPort, "Serial_Sender, Parallel_Sender"));
-    vm3.invoke(() -> createSender(
-        "ln_Serial", 2, false, 100, 400, false, false, null, true ));
-    vm3.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-
-    vm4.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender, Parallel_Sender"));
-    vm4.invoke(() -> createSender(
-      "ln_Serial", 2, false, 100, 400, false, false, null, true));
-    vm4.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-    
-    vm5.invoke(() -> createCacheWithGroups( lnPort,"Parallel_Sender"));
-    vm5.invoke(() -> createSender(
-      "ln_Serial", 2, false, 100, 400, false, false, null, true));
-    vm5.invoke(() -> createSender(
-        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
-
-    vm6.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender"));
-    
-    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-    
-    pause(10000);
-    String command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --" + CliStrings.STATUS_GATEWAYSENDER__GROUP + "=Serial_Sender";
-    
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(2, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-      
-      tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(1, result_hosts.size());
-      
-      
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewaySenderStatus_OnGroups : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-    
-    vm3.invoke(() -> startSender( "ln_Serial" ));
-    vm3.invoke(() -> startSender( "ln_Parallel" ));
-
-    vm4.invoke(() -> startSender( "ln_Serial" ));
-    vm4.invoke(() -> startSender( "ln_Parallel" ));
-
-    pause(10000);
-    command = CliStrings.STATUS_GATEWAYSENDER + " --"
-    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --" + CliStrings.STATUS_GATEWAYSENDER__GROUP + "=Serial_Sender";
-    
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(2, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      
-      tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(1, result_hosts.size());
-      
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewaySenderStatus_OnGroups : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    } else {
-      fail("testListGatewaySender failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testGatewayReceiverStatus(){
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createAndStartReceiver( lnPort ));
-    vm4.invoke(() -> createAndStartReceiver( lnPort ));
-    vm5.invoke(() -> createAndStartReceiver( lnPort ));
-    
-    pause(10000);
-    String command = CliStrings.STATUS_GATEWAYRECEIVER; 
-    CommandResult cmdResult = executeCommand(command);
-    
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
-      
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(3, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      
-      tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(2, result_hosts.size());
-      
-    } else {
-      fail("testGatewayReceiverStatus failed as did not get CommandResult");
-    }
-    
-    vm3.invoke(() -> stopReceiver());
-    vm4.invoke(() -> stopReceiver());
-    vm5.invoke(() -> stopReceiver());
-    
-    pause(10000);
-    
-    command = CliStrings.STATUS_GATEWAYRECEIVER; 
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
-      
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(3, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-      
-      tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-      assertEquals(2, result_hosts.size());
-      
-    } else {
-      fail("testGatewayReceiverStatus failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testGatewayReceiverStatus_OnMember(){
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createAndStartReceiver( lnPort ));
-    vm4.invoke(() -> createAndStartReceiver( lnPort ));
-    vm5.invoke(() -> createAndStartReceiver( lnPort ));
-    
-    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
-    
-    pause(10000);
-    String command = CliStrings.STATUS_GATEWAYRECEIVER+ " --"
-    + CliStrings.STATUS_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
-    
-    CommandResult cmdResult = executeCommand(command);
-    
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      //TabularResultData tableResultData = (TabularResultData) cmdResult.getResultData();
-      //List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      //assertIndexDetailsEquals(1, result_Status.size());
-      //assertFalse(strCmdResult.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      TabularResultData tableResultData =
-          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(1, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-    } else {
-      fail("testGatewayReceiverStatus failed as did not get CommandResult");
-    }
-    
-    vm3.invoke(() -> stopReceiver());
-    vm4.invoke(() -> stopReceiver());
-    vm5.invoke(() -> stopReceiver());
-    
-    pause(10000);
-    
-    command = CliStrings.STATUS_GATEWAYRECEIVER+ " --"
-    + CliStrings.STATUS_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
-    
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
-      
-//      TabularResultData tableResultData =
-//        (TabularResultData) cmdResult.getResultData();
-//      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-//      assertIndexDetailsEquals(1, result_Status.size());
-//      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-      
-      TabularResultData tableResultData =
-          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(1, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-    } else {
-      fail("testGatewayReceiverStatus failed as did not get CommandResult");
-    }
-  }
-
-  @Test
-  public void testGatewayReceiverStatus_OnGroups(){
-
-    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
-    vm7.invoke(() -> createAndStartReceiver( nyPort ));
-
-    vm3.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG1, RG2" ));
-    vm4.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG1, RG2"  ));
-    vm5.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG1"  ));
-    vm6.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG2"  ));
-    
-    pause(10000);
-    String command = CliStrings.STATUS_GATEWAYRECEIVER + " --"
-        + CliStrings.STATUS_GATEWAYRECEIVER__GROUP + "=RG1";
-    
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
-      
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(3, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
-      
-    } else {
-      fail("testGatewayReceiverStatus failed as did not get CommandResult");
-    }
-    
-    vm3.invoke(() -> stopReceiver());
-    vm4.invoke(() -> stopReceiver());
-    vm5.invoke(() -> stopReceiver());
-
-    pause(10000);
-    command = CliStrings.STATUS_GATEWAYRECEIVER + " --"+ CliStrings.STATUS_GATEWAYRECEIVER__GROUP + "=RG1";
-    
-    cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info(
-          "testGatewayReceiverStatus_OnGroups : " + strCmdResult + ">>>>> ");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData tableResultData =
-        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-      
-      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
-      assertEquals(3, result_Status.size());
-      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
-      
-    } else {
-      fail("testGatewayReceiverStatus failed as did not get CommandResult");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
deleted file mode 100644
index c21cf26..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * 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.management;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-
-/**
- * Tests for WAN artifacts like Sender and Receiver. The purpose of this test is
- * not to check WAN functionality , but to verify ManagementServices running
- * properly and reflecting WAN behaviour and data properly
- * 
- * 
- */
-@Category(DistributedTest.class)
-public class WANManagementDUnitTest extends ManagementTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-   
-  public static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-
-  public WANManagementDUnitTest() throws Exception {
-    super();
-    }
-
-  @Test
-  public void testMBeanCallback() throws Exception {
-
-    VM nyLocator =   getManagedNodeList().get(0);
-    VM nyReceiver =  getManagedNodeList().get(1);
-    VM puneSender =  getManagedNodeList().get(2);
-    VM managing =    getManagingNode();
-    VM puneLocator = Host.getLocator();
-    
-    int punePort = (Integer) puneLocator.invoke(() -> WANManagementDUnitTest.getLocatorPort());
-
-    Integer nyPort = (Integer)nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
-    
- 
-
-    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
-    managing.invoke(() -> WANTestBase.createManagementCache( punePort ));
-    startManagingNode(managing);
-
-    // keep a larger batch to minimize number of exception occurrences in the
-    // log
-    puneSender.invoke(() -> WANTestBase.createSender( "pn",
-        12, true, 100, 300, false, false, null, true ));
-    managing.invoke(() -> WANTestBase.createSender( "pn",
-      12, true, 100, 300, false, false, null, true ));
-
-
-    puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
-    managing.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
-    
-    nyReceiver.invoke(() -> WANTestBase.createCache( nyPort ));
-    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
-    nyReceiver.invoke(() -> WANTestBase.createReceiver());
-
-    WANTestBase.startSenderInVMs("pn", puneSender, managing);
-
-    // make sure all the senders are running before doing any puts
-    puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
-    managing.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
-
-    
- 
-    
-    checkSenderMBean(puneSender, getTestMethodName() + "_PR");
-    checkSenderMBean(managing, getTestMethodName() + "_PR");
-    
-    checkReceiverMBean(nyReceiver);
-    
-    stopGatewaySender(puneSender);
-    startGatewaySender(puneSender);
-    
-    DistributedMember puneMember = (DistributedMember) puneSender.invoke(() -> WANManagementDUnitTest.getMember());
-
-    checkProxySender(managing, puneMember);
-    checkSenderNavigationAPIS(managing, puneMember);
-
-  }
-  
-  @Test
-  public void testReceiverMBean() throws Exception {
-
-    VM nyLocator = getManagedNodeList().get(0);
-    VM nyReceiver = getManagedNodeList().get(1);
-    VM puneSender = getManagedNodeList().get(2);
-    VM managing = getManagingNode();
-    VM puneLocator = Host.getLocator();
-
-    int punePort = (Integer) puneLocator.invoke(() -> WANManagementDUnitTest.getLocatorPort());
-
-    Integer nyPort = (Integer) nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
-
-    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
-
-    nyReceiver.invoke(() -> WANTestBase.createCache( nyPort ));
-    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
-    nyReceiver.invoke(() -> WANTestBase.createReceiver());
-
-    // keep a larger batch to minimize number of exception occurrences in the
-    // log
-    puneSender.invoke(() -> WANTestBase.createSender( "pn",
-        12, true, 100, 300, false, false, null, true ));
-
-    puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
-
-    puneSender.invoke(() -> WANTestBase.startSender( "pn" ));
-
-    // make sure all the senders are running before doing any puts
-    puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
-
-    managing.invoke(() -> WANTestBase.createManagementCache( nyPort ));
-    startManagingNode(managing);
-
-
-    checkSenderMBean(puneSender, getTestMethodName() + "_PR");
-    checkReceiverMBean(nyReceiver);
-
-    DistributedMember nyMember = (DistributedMember) nyReceiver.invoke(() -> WANManagementDUnitTest.getMember());
-
-    checkProxyReceiver(managing, nyMember);
-    checkReceiverNavigationAPIS(managing, nyMember);
-    
-
-  }
-  
-  
-  @Test
-  public void testAsyncEventQueue() throws Exception {
-    
-    VM nyLocator =   getManagedNodeList().get(0);
-    VM nyReceiver =  getManagedNodeList().get(1);
-    VM puneSender =  getManagedNodeList().get(2);
-    VM managing =    getManagingNode();
-    VM puneLocator = Host.getLocator();
-    
-    int punePort = (Integer) puneLocator.invoke(() -> WANManagementDUnitTest.getLocatorPort());
-
-    Integer nyPort = (Integer)nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
-    
- 
-
-    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
-    managing.invoke(() -> WANTestBase.createManagementCache( punePort ));
-    startManagingNode(managing);
-
-
-    puneSender.invoke(() -> WANTestBase.createAsyncEventQueue(
-      "pn", false, 100, 100, false, false, "puneSender", false ));
-    managing.invoke(() -> WANTestBase.createAsyncEventQueue(
-      "pn", false, 100, 100, false, false, "managing", false ));
-
-
-    puneSender.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
-      getTestMethodName() + "_RR", "pn", false ));
-    managing.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
-      getTestMethodName() + "_RR", "pn", false ));
-
-    WANTestBase.createCacheInVMs(nyPort, nyReceiver);
-    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
-    nyReceiver.invoke(() -> WANTestBase.createReceiver());
-
-    checkAsyncQueueMBean(puneSender);
-    checkAsyncQueueMBean(managing);
-    
-    
-    DistributedMember puneMember = (DistributedMember) puneSender.invoke(() -> WANManagementDUnitTest.getMember());
-
-    checkProxyAsyncQueue(managing, puneMember);
-    
-  }
-
-  
-  @SuppressWarnings("serial")
-  protected void checkSenderNavigationAPIS(final VM vm,
-      final DistributedMember senderMember) {
-    SerializableRunnable checkNavigationAPIS = new SerializableRunnable(
-        "Check Sender Navigation APIs") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-        ObjectName expectedName = service.getGatewaySenderMBeanName(
-            senderMember, "pn");
-        try {
-          ObjectName actualName = bean.fetchGatewaySenderObjectName(
-              senderMember.getId(), "pn");
-          assertEquals(expectedName, actualName);
-        } catch (Exception e) {
-          fail("Sender Navigation Failed " + e);
-        }
-
-        assertEquals(2, bean.listGatewaySenderObjectNames().length);
-        try {
-          assertEquals(1, bean.listGatewaySenderObjectNames(senderMember
-              .getId()).length);
-        } catch (Exception e) {
-          fail("Sender Navigation Failed " + e);
-        }
-
-      }
-    };
-    vm.invoke(checkNavigationAPIS);
-  }
-
-  @SuppressWarnings("serial")
-  protected void checkReceiverNavigationAPIS(final VM vm,
-      final DistributedMember receiverMember) {
-    SerializableRunnable checkNavigationAPIS = new SerializableRunnable(
-        "Check Receiver Navigation APIs") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
-        ObjectName expectedName = service
-            .getGatewayReceiverMBeanName(receiverMember);
-        try {
-          ObjectName actualName = bean
-              .fetchGatewayReceiverObjectName(receiverMember.getId());
-          assertEquals(expectedName, actualName);
-        } catch (Exception e) {
-          fail("Receiver Navigation Failed " + e);
-        }
-
-        assertEquals(1, bean.listGatewayReceiverObjectNames().length);
-
-      }
-    };
-    vm.invoke(checkNavigationAPIS);
-  }
-    
-  private static int getLocatorPort(){
-    return Locator.getLocators().get(0).getPort();
-  }
-  private static DistributedMember getMember(){
-    return GemFireCacheImpl.getInstance().getMyId();
-  }
-  
-  /**
-   * Checks Proxy GatewaySender
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkProxySender(final VM vm, final DistributedMember senderMember) {
-    SerializableRunnable checkProxySender = new SerializableRunnable("Check Proxy Sender") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-        .getManagementService(cache);
-        GatewaySenderMXBean bean = null;
-        try {
-          bean = MBeanUtil.getGatewaySenderMbeanProxy(senderMember, "pn");
-        } catch (Exception e) {
-          fail("Could not obtain Sender Proxy in desired time " + e);
-        }
-        assertNotNull(bean);
-        final ObjectName senderMBeanName = service.getGatewaySenderMBeanName(
-            senderMember, "pn");
-        try {
-          MBeanUtil.printBeanDetails(senderMBeanName);
-        } catch (Exception e) {
-          fail("Error while Printing Bean Details " + e);
-        }
-        
-        if(service.isManager()){
-          DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
-          Map<String, Boolean> dsMap = dsBean.viewRemoteClusterStatus();
-          
-          LogWriterUtils.getLogWriter().info(
-              "<ExpectedString> Ds Map is: " + dsMap
-                  + "</ExpectedString> ");
-          
-        }
-
-      }
-    };
-    vm.invoke(checkProxySender);
-  }
-  
-  /**
-   * Checks Proxy GatewayReceiver
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkProxyReceiver(final VM vm,
-      final DistributedMember senderMember) {
-    SerializableRunnable checkProxySender = new SerializableRunnable(
-        "Check Proxy Receiver") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        GatewayReceiverMXBean bean = null;
-        try {
-          bean = MBeanUtil.getGatewayReceiverMbeanProxy(senderMember);
-        } catch (Exception e) {
-          fail("Could not obtain Sender Proxy in desired time " + e);
-        }
-        assertNotNull(bean);
-        final ObjectName receiverMBeanName = service
-            .getGatewayReceiverMBeanName(senderMember);
-        try {
-          MBeanUtil.printBeanDetails(receiverMBeanName);
-        } catch (Exception e) {
-          fail("Error while Printing Bean Details " + e);
-        }
-
-      }
-    };
-    vm.invoke(checkProxySender);
-  }
-  
-  
-  /**
-   * stops a gateway sender
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void stopGatewaySender(final VM vm) {
-    SerializableRunnable stopGatewaySender = new SerializableRunnable("Stop Gateway Sender") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-        .getManagementService(cache);
-        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
-        assertNotNull(bean);
-        bean.stop();
-        assertFalse(bean.isRunning());
-      }
-    };
-    vm.invoke(stopGatewaySender);
-  }
-  
-  /**
-   * start a gateway sender
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void startGatewaySender(final VM vm) {
-    SerializableRunnable stopGatewaySender = new SerializableRunnable("Start Gateway Sender") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-        .getManagementService(cache);
-        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
-        assertNotNull(bean);
-        bean.start();
-        assertTrue(bean.isRunning());
-      }
-    };
-    vm.invoke(stopGatewaySender);
-  }
-
-
- 
-  /**
-   * Checks whether a GatewayReceiverMBean is created or not
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkReceiverMBean(final VM vm) {
-    SerializableRunnable checkMBean = new SerializableRunnable("Check Receiver MBean") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-        .getManagementService(cache);
-        GatewayReceiverMXBean bean = service.getLocalGatewayReceiverMXBean();
-        assertNotNull(bean);
-      }
-    };
-    vm.invoke(checkMBean);
-  }
-
-  /**
-   * Checks whether a GatewayReceiverMBean is created or not
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkSenderMBean(final VM vm, final String regionPath) {
-    SerializableRunnable checkMBean = new SerializableRunnable("Check Sender MBean") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-
-        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
-        assertNotNull(bean);
-        assertTrue(bean.isConnected());
-
-        ObjectName regionBeanName = service.getRegionMBeanName(cache
-            .getDistributedSystem().getDistributedMember(), "/" + regionPath);
-        RegionMXBean rBean = service.getMBeanInstance(regionBeanName,
-            RegionMXBean.class);
-        assertTrue(rBean.isGatewayEnabled());
-        
-       
-      }
-    };
-    vm.invoke(checkMBean);
-  }
-  
-  /**
-   * Checks whether a Async Queue MBean is created or not
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkAsyncQueueMBean(final VM vm) {
-    SerializableRunnable checkAsyncQueueMBean = new SerializableRunnable(
-        "Check Async Queue MBean") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        AsyncEventQueueMXBean bean = service.getLocalAsyncEventQueueMXBean("pn");
-        assertNotNull(bean);
-        // Already in started State
-      }
-    };
-    vm.invoke(checkAsyncQueueMBean);
-  }
-
-  /**
-   * Checks Proxy Async Queue
-   * 
-   * @param vm
-   *          reference to VM
-   */
-  @SuppressWarnings("serial")
-  protected void checkProxyAsyncQueue(final VM vm,
-      final DistributedMember senderMember) {
-    SerializableRunnable checkProxyAsyncQueue = new SerializableRunnable(
-        "Check Proxy Async Queue") {
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        ManagementService service = ManagementService
-            .getManagementService(cache);
-        AsyncEventQueueMXBean bean = null;
-        try {
-          bean = MBeanUtil.getAsyncEventQueueMBeanProxy(senderMember, "pn");
-        } catch (Exception e) {
-          fail("Could not obtain Sender Proxy in desired time " + e);
-        }
-        assertNotNull(bean);
-        final ObjectName queueMBeanName = service.getAsyncEventQueueMBeanName(
-            senderMember, "pn");
-
-        try {
-          MBeanUtil.printBeanDetails(queueMBeanName);
-        } catch (Exception e) {
-          fail("Error while Printing Bean Details " + e);
-        }
-
-      }
-    };
-    vm.invoke(checkProxyAsyncQueue);
-  }
-}


[12/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanValidationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanValidationsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanValidationsDUnitTest.java
new file mode 100644
index 0000000..073056f
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanValidationsDUnitTest.java
@@ -0,0 +1,1507 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
+import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
+import com.gemstone.gemfire.internal.cache.wan.Filter70;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderConfigurationException;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
+import com.gemstone.gemfire.internal.cache.wan.MyGatewayTransportFilter3;
+import com.gemstone.gemfire.internal.cache.wan.MyGatewayTransportFilter4;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class WanValidationsDUnitTest extends WANTestBase {
+
+  public WanValidationsDUnitTest() {
+    super();
+  }
+
+  /**
+   * Test to make sure that serial sender Ids configured in Distributed Region
+   * is same across all DR nodes TODO : Should this validation hold tru now.
+   * Discuss. If I have 2 members on Which DR is defined. But sender is defined
+   * on only one member. How can I add the instance on the sender in Region
+   * which does not have a sender. I can bypass the existing validation for the
+   * DR with SerialGatewaySender. But for PR with SerialGatewaySender, we need
+   * to send the adjunct message. Find out the way to send the adjunct message
+   * to the member on which serialGatewaySender is available.
+   */
+  
+  @Test
+  public void testSameSerialGatewaySenderIdAcrossSameDistributedRegion()
+      throws Exception {
+    IgnoredException.addIgnoredException("another cache has the same region defined");
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
+
+      createCacheInVMs(lnPort, vm4, vm5);
+
+      vm4.invoke(() -> WANTestBase.createSender("ln1", 2, false, 10, 100, false, false, null, true));
+      vm4.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
+      
+      vm5.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
+      vm5.invoke(() -> WANTestBase.createSender("ln3", 2, false, 10, 100, false, false, null, true));
+      
+     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() ));
+      
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln2,ln3", isOffHeap() ));
+      fail("Expected IllegalStateException with incompatible gateway sender ids message");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
+        Assert.fail(
+            "Expected IllegalStateException with incompatible gateway sender ids message",
+            e);
+      }
+    }
+  }
+
+
+  /**
+   * Validate that ParallelGatewaySender can be added to Distributed region
+   * 
+   * @throws Exception
+   * 
+   * 
+   * Below test is disabled intentionally Replicated region with Parallel Async
+   * Event queue is not supported. Test is added for the same
+   * ReplicatedRegion_ParallelWANPropagationDUnitTest#test_DR_PGS_1Nodes_Put_Receiver
+   * 
+   * We are gone support this configuration in upcoming releases
+   */
+
+  @Ignore("Bug51491")
+  @Test
+  public void testParallelGatewaySenderForDistributedRegion() throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(lnPort, vm4, vm5);
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+
+      vm5.invoke(() -> WANTestBase.createSender( "ln2", 2,
+          true, 10, 100, false, false, null, false ));
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+
+      vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+
+    }
+    catch (Exception e) {
+      Assert.fail("Caught Exception", e);
+    }
+  }
+  
+  /**
+   * Test to make sure that serial sender Ids configured in partitioned regions
+   * should be same across all PR members
+   */
+  @Test
+  public void testSameSerialGatewaySenderIdAcrossSamePartitionedRegion()
+      throws Exception {
+    IgnoredException.addIgnoredException("another cache has the same region defined");
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+
+      createCacheInVMs(lnPort, vm4, vm5);
+
+      vm4.invoke(() -> WANTestBase.createSender("ln1", 2, false, 10, 100, false, false, null, true));
+      vm4.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
+      
+      vm5.invoke(() -> WANTestBase.createSender("ln2", 2, false, 10, 100, false, false, null, true));
+      vm5.invoke(() -> WANTestBase.createSender("ln3", 2, false, 10, 100, false, false, null, true));
+      
+      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln1,ln2", 1, 100, isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln2,ln3", 1, 100, isOffHeap()  ));
+      fail("Expected IllegalStateException with incompatible gateway sender ids message");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
+        Assert.fail(
+            "Expected IllegalStateException with incompatible gateway sender ids message",
+            e);
+      }
+    }
+  }
+  
+  
+  @Test
+  public void testReplicatedSerialAsyncEventQueueWithPersistenceEnabled() {
+    IgnoredException.addIgnoredException("another cache has the same region defined");
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+      createCacheInVMs(lnPort, vm4, vm5);
+
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
+              getTestMethodName() + "_RR", "ln1", isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
+              getTestMethodName() + "_RR", "ln2", isOffHeap()  ));
+      fail("Expected IllegalStateException with incompatible gateway sender ids message");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
+        Assert.fail(
+            "Expected IllegalStateException with incompatible gateway sender ids message",
+            e);
+      }
+    }
+  }
+  
+  /**
+   * Test to make sure that parallel sender Ids configured in partitioned
+   * regions should be same across all PR members
+   */
+  @Test
+  public void testSameParallelGatewaySenderIdAcrossSamePartitionedRegion()
+      throws Exception {
+    IgnoredException.addIgnoredException("another cache has the same region defined");
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+
+      createCacheInVMs(lnPort, vm4, vm5);
+
+      vm4.invoke(() -> WANTestBase.createSender("ln1", 2, true, 10, 100, false, false, null, true));
+      vm4.invoke(() -> WANTestBase.createSender("ln2", 2, true, 10, 100, false, false, null, true));
+      
+      vm5.invoke(() -> WANTestBase.createSender("ln2", 2, true, 10, 100, false, false, null, true));
+      vm5.invoke(() -> WANTestBase.createSender("ln3", 2, true, 10, 100, false, false, null, true));
+
+      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln1,ln2", 1, 100, isOffHeap()  ));
+      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_PR", "ln2,ln3", 1, 100, isOffHeap()  ));
+      
+      fail("Expected IllegalStateException with incompatible gateway sender ids message");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("Cannot create Region"))) {
+        Assert.fail(
+            "Expected IllegalStateException with incompatible gateway sender ids message",
+            e);
+      }
+    }
+  }
+
+  /**
+   * Test to make sure that same parallel gateway sender id can be used by 2
+   * different PRs
+   * 
+   * @throws Exception
+   */
+  @Ignore
+  @Test
+  public void testSameParallelGatewaySenderIdAcrossDifferentPartitionedRegion()
+      throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+      createCacheInVMs(lnPort, vm1);
+
+      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
+      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
+      
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR1", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR2", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
+
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("cannot have the same parallel gateway sender id"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+
+  @Test
+  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion()
+      throws Exception {
+    IgnoredException.addIgnoredException("another cache has the same region defined");
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+      createCacheInVMs(lnPort, vm1);
+
+      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
+      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
+      
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR1", null, "ln1_Parallel", null, isOffHeap()  ));
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR2", null, "ln1_Parallel,ln2_Parallel", getTestMethodName() + "_PR1", isOffHeap()  ));
+      //now we support this
+      //fail("Expected IllegalStateException with incompatible gateway sender ids in colocated regions");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("should have same parallel gateway sender ids"))) {
+        Assert.fail(
+            "Expected IllegalStateException with incompatible gateway sender ids in colocated regions",
+            e);
+      }
+    }
+  }
+  
+  /**
+   * Validate that if Colocated partitioned region doesn't want to add a PGS even if its 
+   * parent has one then it is fine
+   * @throws Exception
+   */
+  
+  @Test
+  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion2()
+      throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+      createCacheInVMs(lnPort, vm1);
+
+      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
+      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
+      
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR1", null, "ln1_Parallel", null, isOffHeap()  ));
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR2", null, null, getTestMethodName() + "_PR1", isOffHeap()  ));
+      
+    }
+    catch (Exception e) {
+      Assert.fail("The tests caught Exception.", e);
+    }
+  }
+  
+  /**
+   * Validate that if Colocated partitioned region has a subset of PGS
+   * then it is fine. 
+   * @throws Exception
+   */
+  
+  @Test
+  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion3()
+      throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+      createCacheInVMs(lnPort, vm1);
+
+      vm1.invoke(() -> WANTestBase.createSender(
+          "ln1_Parallel", 2, true, 10, 100, false, false, null, true ));
+      vm1.invoke(() -> WANTestBase.createSender(
+          "ln2_Parallel", 2, true, 10, 100, false, false, null, true ));
+
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR1", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR2", null, "ln1_Parallel", getTestMethodName() + "_PR1", isOffHeap()  ));
+
+    } catch (Exception e) {
+      Assert.fail("The tests caught Exception.", e);
+    }
+  }
+  
+  /**
+   * Validate that if Colocated partitioned region has a superset of PGS
+   * then Exception is thrown. 
+   * @throws Exception
+   */
+  
+  @Test
+  public void testSameParallelGatewaySenderIdAcrossColocatedPartitionedRegion4()
+      throws Exception {
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+      createCacheInVMs(lnPort, vm1);
+
+      vm1.invoke(() -> WANTestBase.createSender("ln1_Parallel", 2, true, 10, 100, false, false, null, true));
+      vm1.invoke(() -> WANTestBase.createSender("ln2_Parallel", 2, true, 10, 100, false, false, null, true));
+      vm1.invoke(() -> WANTestBase.createSender("ln3_Parallel", 2, true, 10, 100, false, false, null, true));
+
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR1", null, "ln1_Parallel,ln2_Parallel", null, isOffHeap()  ));
+      vm1.invoke(() -> WANTestBase.createPartitionedRegionWithSerialParallelSenderIds(
+              getTestMethodName() + "_PR2", null, "ln1_Parallel,ln2_Parallel,ln3_Parallel", getTestMethodName() + "_PR1", isOffHeap()  ));
+      //now we support this
+      //fail("Expected IllegalStateException with incompatible gateway sender ids in colocated regions");
+    } catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("should have same parallel gateway sender ids"))) {
+        Assert.fail(
+            "Expected IllegalStateException with incompatible gateway sender ids in colocated regions",
+            e);
+      }
+    }
+  }
+  
+  /**
+   * SerialGatewaySender and ParallelGatewaySender with same name is allowed
+   */
+  @Test
+  public void testSerialGatewaySenderAndParallelGatewaySenderWithSameName() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null, null, true, false ));
+    try {
+      vm1.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 2, true, 100, false, false, null, null, true, false ));
+      fail("Expected IllegalStateException : Sender names should be different.");
+    } catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("is already defined in this cache"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  //remote ds ids should be same
+  @Test
+  public void testSameRemoteDSAcrossSameSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null, null,
+        true, false  ));
+
+    try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 3, false, 100, false, false, null, null,
+          true, false  ));
+      fail("Expected IllegalStateException : Remote Ds Ids should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same Gateway Sender defined with remote ds id"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  // sender with same name should be either serial or parallel but not both.
+  @Test
+  public void testSerialSenderOnBothCache() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null, null,
+        true, false  ));
+
+    try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 2, true, 100, false, false, null, null, true, false  ));
+      fail("Expected IllegalStateException : is not serial Gateway Sender");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same sender as serial gateway sender"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  // sender with same name should be either serial or parallel but not both.
+  @Test
+  public void testParallelSenderOnBothCache(){
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        true, 100,false, false,
+        null, null, true, false  ));
+    
+    try {
+      vm2
+          .invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+              false, 100, false, false,null, null,
+              true, false  ));
+      fail("Expected IllegalStateException : is not parallel Gateway Sender");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("because another cache has the same sender as parallel gateway sender"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  // isBatchConflation should be same across the same sender
+  @Test
+  public void testBatchConflation() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 100, false, false,
+        null, null, true, false  ));
+
+    // isBatchConflation
+    try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+          false, 100,true, false,
+          null, null, true, false  ));
+      fail("Expected IllegalStateException : isBatchConflation Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("another cache has the same Gateway Sender defined with isBatchConflationEnabled"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  //isPersistentEnabled should be same across the same sender
+  @Test
+  public void testisPersistentEnabled() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 100, false, false,
+        null, null, true, false  ));
+    try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 100,false, true, null, null, true, false  ));
+      fail("Expected IllegalStateException : isPersistentEnabled Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with isPersistentEnabled"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testAlertThreshold() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 100, false, false,
+        null, null, true, false ));
+    try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 50, false, false, null, null, true, false  ));
+      fail("Expected IllegalStateException : alertThreshold Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with alertThreshold"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testManualStart() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 100, false, false,
+        null, null, true, false  ));
+    try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations( "ln", 2,
+        false, 100, false, false, null, null, false, false  ));
+      fail("Expected IllegalStateException : manualStart Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with manual start"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testGatewayEventFilters() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    ArrayList<GatewayEventFilter> eventFilters = new ArrayList<GatewayEventFilter>();
+    eventFilters.add(new MyGatewayEventFilter());
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, eventFilters,
+        null, true, false  ));
+    try {
+      eventFilters.clear();
+      eventFilters.add(new Filter70());
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 2, false, 100, false, false,
+          eventFilters, null, true, false  ));
+      fail("Expected IllegalStateException : GatewayEventFilters Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same Gateway Sender defined with GatewayEventFilters"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testGatewayEventFilters2() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    ArrayList<GatewayEventFilter> eventFilters = new ArrayList<GatewayEventFilter>();
+    eventFilters.add(new MyGatewayEventFilter());
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, eventFilters,
+        null, true, false  ));
+    try {
+      eventFilters.clear();
+      eventFilters.add(new MyGatewayEventFilter());
+      eventFilters.add(new Filter70());
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 2, false, 100, false, false,
+          eventFilters, null, true, false  ));
+      fail("Expected IllegalStateException : GatewayEventFilters Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same Gateway Sender defined with GatewayEventFilters"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testGatewayTransportFilters() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
+    transportFilters.add(new MyGatewayTransportFilter1());
+    transportFilters.add(new MyGatewayTransportFilter2());
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null,
+        transportFilters, true, false  ));
+   try {
+      transportFilters.clear();
+      transportFilters.add(new MyGatewayTransportFilter3());
+      transportFilters.add(new MyGatewayTransportFilter4());
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 2, false, 100, false, false,
+          null, transportFilters, true, false  ));
+      fail("Expected IllegalStateException : GatewayEventFilters Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same Gateway Sender defined with GatewayTransportFilters"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+
+  @Test
+  public void testGatewayTransportFiltersOrder() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
+    transportFilters.add(new MyGatewayTransportFilter1());
+    transportFilters.add(new MyGatewayTransportFilter2());
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null,
+        transportFilters, true, false  ));
+   try {
+      transportFilters.clear();
+      transportFilters.add(new MyGatewayTransportFilter2());
+      transportFilters.add(new MyGatewayTransportFilter1());
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+          "ln", 2, false, 100, false, false,
+          null, transportFilters, true, false ));
+      fail("Expected IllegalStateException : GatewayEventFilters Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same Gateway Sender defined with GatewayTransportFilters"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+
+  
+  @Test
+  public void testIsDiskSynchronous() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null,
+        null, true, false ));
+    
+   try {
+      vm2.invoke(() -> WANTestBase.createSenderForValidations(
+        "ln", 2, false, 100, false, false, null,
+        null, true, true ));
+      fail("Expected IllegalStateException : isDiskSynchronous Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage()
+              .contains("because another cache has the same Gateway Sender defined with isDiskSynchronous"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  /**
+   * This test has been added for the defect # 44372.
+   * A single VM hosts a bridge server as well as a Receiver.
+   * Expected: Cache.getCacheServer should return only the Bridge server and not the Receiver
+   */
+  @Test
+  public void test_GetCacheServersDoesNotReturnReceivers() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4);
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    
+    vm4.invoke(() -> WANTestBase.createCacheServer( ));
+    
+    Map cacheServers = (Map) vm4.invoke(() -> WANTestBase.getCacheServers( ));
+    
+    assertEquals("Cache.getCacheServers returned incorrect BridgeServers: ", 1, cacheServers.get("BridgeServer"));
+    assertEquals("Cache.getCacheServers returned incorrect ReceiverServers: ", 0, cacheServers.get("ReceiverServer"));
+  }
+  
+  /**
+   * Added for the defect # 44372.
+   * Two VMs are part of the DS. 
+   * One VM hosts a Bridge server while the other hosts a Receiver.
+   * Expected: Cache.getCacheServers should only return the bridge server and not the Receiver.
+   */
+  @Test
+  public void test_GetCacheServersDoesNotReturnReceivers_Scenario2() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    createCacheInVMs(lnPort, vm4);
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    createCacheInVMs(lnPort, vm5);
+    
+    vm5.invoke(() -> WANTestBase.createCacheServer( ));
+    
+    Map cacheServers_vm4 = (Map) vm4.invoke(() -> WANTestBase.getCacheServers( ));
+    Map cacheServers_vm5 = (Map) vm5.invoke(() -> WANTestBase.getCacheServers( ));
+    
+    assertEquals("Cache.getCacheServers on vm4 returned incorrect BridgeServers: ", 0, cacheServers_vm4.get("BridgeServer"));
+    assertEquals("Cache.getCacheServers on vm4 returned incorrect ReceiverServers: ", 0, cacheServers_vm4.get("ReceiverServer"));
+    
+    assertEquals("Cache.getCacheServers on vm5 returned incorrect BridgeServers: ", 1, cacheServers_vm5.get("BridgeServer"));
+    assertEquals("Cache.getCacheServers on vm5 returned incorrect ReceiverServers: ", 0, cacheServers_vm5.get("ReceiverServer"));
+
+  }
+  
+  
+  // dispatcher threads are same across all the nodes for ParallelGatewaySender
+  /*
+   * We are allowing number of dispatcher threads for parallel sender to differ
+   * on number of machines
+   */
+  @Ignore
+  @Test
+  public void testDispatcherThreadsForParallelGatewaySender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+
+    // dispatcher threads
+    try {
+      vm2.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+      fail("Expected IllegalStateException : dispatcher threads Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with dispatcherThread"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+  
+  
+  // dispatcher threads are same across all the nodes for ParallelGatewaySender
+  /*
+   * For Parallel sender, thread policy is not supported which is checked at the
+   * time of sender creation. policy KEY and Partition are same for PGS. Hence
+   * disabling the tests
+   */
+  @Ignore
+  @Test
+  public void testOrderPolicyForParallelGatewaySender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm1, vm2);
+
+    vm1.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+
+    // dispatcher threads
+    try {
+      vm2.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+      fail("Expected IllegalStateException : order policy Should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof IllegalStateException)
+          || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with orderPolicy"))) {
+        Assert.fail("Expected IllegalStateException", e);
+      }
+    }
+  }
+
+  @Test
+  public void testBug50434_RR_Serial() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(createReceiverReplicatedRegion());
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm4.invoke(createReceiverReplicatedRegion());
+    vm5.invoke(createReceiverReplicatedRegion());
+    vm6.invoke(createReceiverReplicatedRegion());
+    vm7.invoke(createReceiverReplicatedRegion());
+
+    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_RR", "ln"));
+    
+    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_RR", "ln"));
+
+    try {
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+          10 ));
+      fail("Expected GatewaySenderConfigurationException : Sender Ids should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
+          || !(e.getCause().getMessage()
+              .contains("For region across all members, gateway sender ids should be same."))) {
+        Assert.fail("Expected GatewaySenderConfigurationException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testBug50434_RR_SerialAsyncEventQueue() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+
+    vm4.invoke(createReceiverReplicatedRegion());
+    vm5.invoke(createReceiverReplicatedRegion());
+    vm6.invoke(createReceiverReplicatedRegion());
+    vm7.invoke(createReceiverReplicatedRegion());
+
+    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
+
+    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
+
+    try {
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+      fail("Expected GatewaySenderConfigurationException : AsyncEvent queue IDs should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
+          || !(e.getCause().getMessage()
+              .contains("For region across all members, AsyncEvent queue IDs should be same."))) {
+        Assert.fail("Expected GatewaySenderConfigurationException", e);
+      }
+    }
+  }
+
+  protected SerializableRunnableIF createReceiverReplicatedRegion() {
+    return () -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() );
+  }
+  
+  @Test
+  public void testBug50434_RR_Serial_Pass() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(createReceiverReplicatedRegion());
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    vm4.invoke(createReceiverReplicatedRegion());
+    vm5.invoke(createReceiverReplicatedRegion());
+    vm6.invoke(createReceiverReplicatedRegion());
+    vm7.invoke(createReceiverReplicatedRegion());
+
+    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_RR", "ln"));
+    
+    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_RR", "ln"));
+    
+    vm6.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_RR", "ln"));
+    
+    vm7.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_RR", "ln"));
+    
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10));
+  }
+  
+  @Test
+  public void testBug50434_RR_SerialAsyncEventQueue_Pass() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+
+    vm4.invoke(createReceiverReplicatedRegion());
+    vm5.invoke(createReceiverReplicatedRegion());
+    vm6.invoke(createReceiverReplicatedRegion());
+    vm7.invoke(createReceiverReplicatedRegion());
+
+    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
+    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
+    vm6.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
+    vm7.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_RR", "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm4.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 1000 ));// primary sender
+    vm5.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 0 ));// secondary
+    vm6.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 0 ));// secondary
+    vm7.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 0 ));// secondary
+  }
+  
+  @Test
+  public void testBug50434_PR_Serial() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_RR", null, 1, 100, isOffHeap() ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    
+    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    try {
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10));
+      fail("Expected GatewaySenderConfigurationException : Sender Ids should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
+          || !(e.getCause().getMessage()
+              .contains("For region across all members, gateway sender ids should be same."))) {
+        Assert.fail("Expected GatewaySenderConfigurationException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testBug50434_PR_SerialAsyncEventQueue() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+
+    try {
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+      fail("Expected GatewaySenderConfigurationException : AsyncEvent queue IDs should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
+          || !(e.getCause().getMessage()
+              .contains("For region across all members, AsyncEvent queue IDs should be same."))) {
+        Assert.fail("Expected GatewaySenderConfigurationException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testBug50434_PR_Serial_Pass() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm6.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm7.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10));
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+      0));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10));
+  }
+  
+  @Test
+  public void testBug50434_PR_SerialAsyncEventQueue_Pass() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        false, 100, 100, false, false, null, false ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm6.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm7.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+
+    vm4.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 1000 ));// primary sender
+    vm5.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 0 ));// secondary
+    vm6.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 0 ));// secondary
+    vm7.invoke(() -> WANTestBase.validateAsyncEventListener(
+        "ln", 0 ));// secondary
+  }
+  
+  @Test
+  public void testBug50434_PR_Parallel() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+
+    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    try {
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10));
+      fail("Expected GatewaySenderConfigurationException : Sender Ids should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
+          || !(e.getCause().getMessage()
+              .contains("For region across all members, gateway sender ids should be same."))) {
+        Assert.fail("Expected GatewaySenderConfigurationException", e);
+      }
+    }
+  }
+  
+  @Test
+  public void testBug50434_PR_ParallelAsyncEventQueue() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    
+    try {
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10));
+      fail("Expected GatewaySenderConfigurationException : AsyncEvent queue IDs should match");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderConfigurationException)
+          || !(e.getCause().getMessage()
+              .contains("For region across all members, AsyncEvent queue IDs should be same."))) {
+        Assert.fail("Expected GatewaySenderConfigurationException", e);
+      }
+    }
+  }
+
+  @Category(FlakyTest.class) // GEODE-1019: random ports, time sensitive, waitForCriterion, suspect string: loss of quorum
+  @Test
+  public void testBug50434_PR_Parallel_pass() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 10, isOffHeap()));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm5.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm6.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    vm7.invoke(() -> WANTestBase.addSenderThroughAttributesMutator(
+      getTestMethodName() + "_PR", "ln"));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        10));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10));
+  }
+  
+  @Test
+  public void testBug50434_PR_ParallelAsyncEventQueue_Pass() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue( "ln",
+        true, 100, 100, false, false, null, false ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 10, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm5.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm6.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    vm7.invoke(() -> WANTestBase.addAsyncEventQueueThroughAttributesMutator( getTestMethodName() + "_PR", "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        256 ));
+    
+    vm4.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForAsyncQueueToGetEmpty( "ln" ));
+    
+    int vm4size = (Integer)vm4.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
+    int vm5size = (Integer)vm5.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
+    int vm6size = (Integer)vm6.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
+    int vm7size = (Integer)vm7.invoke(() -> WANTestBase.getAsyncEventListenerMapSize( "ln"));
+    
+    assertEquals(vm4size + vm5size + vm6size + vm7size, 256);
+  }
+  
+  @Test
+  public void testBug51367_WrongBindAddressOnGatewayReceiver() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    vm2.invoke(() -> WANTestBase.createReceiverWithBindAddress( lnPort ));
+  }
+  
+  
+  @Test
+  public void testBug50247_NonPersistentSenderWithPersistentRegion()
+      throws Exception {
+    IgnoredException.addIgnoredException("could not get remote locator information");
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    try {
+      vm4.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+      vm4.invoke(() -> WANTestBase.createPartitionedRegionWithPersistence( getTestMethodName() + "_PR", "ln1", 1, 100 ));
+      fail("Expected GatewaySenderException with incompatible gateway sender ids and region");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderException)
+          || !(e.getCause().getMessage()
+              .contains("can not be attached to persistent region "))) {
+        Assert.fail(
+            "Expected GatewaySenderException with incompatible gateway sender ids and region",
+            e);
+      }
+    }
+
+    try {
+      vm5.invoke(() -> WANTestBase.createPartitionedRegionWithPersistence( getTestMethodName() + "_PR", "ln1", 1, 100 ));
+      vm5.invoke(() -> WANTestBase.createSender( "ln1", 2,
+          true, 10, 100, false, false, null, false ));
+      fail("Expected GatewaySenderException with incompatible gateway sender ids and region");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GatewaySenderException)
+          || !(e.getCause().getMessage()
+              .contains("can not be attached to persistent region "))) {
+        Assert.fail(
+            "Expected GatewaySenderException with incompatible gateway sender ids and region",
+            e);
+      }
+    }
+  }
+  
+  /**
+   * Test configuration::
+   * 
+   * Region: Replicated WAN: Serial Number of WAN sites: 2 Region persistence
+   * enabled: false Async channel persistence enabled: false
+   */
+  @Test
+  public void testReplicatedSerialAsyncEventQueueWith2WANSites() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    // ------------ START - CREATE CACHE, REGION ON LOCAL SITE ------------//
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createAsyncEventQueue(
+        "lnAsync", false, 100, 100, false, false, null, false ));
+    vm5.invoke(() -> WANTestBase.createAsyncEventQueue(
+        "lnAsync", false, 100, 100, false, false, null, false ));
+    vm6.invoke(() -> WANTestBase.createAsyncEventQueue(
+        "lnAsync", false, 100, 100, false, false, null, false ));
+    vm7.invoke(() -> WANTestBase.createAsyncEventQueue(
+        "lnAsync", false, 100, 100, false, false, null, false ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
+            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
+            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
+            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
+            getTestMethodName() + "_RR", "ln", "lnAsync", isOffHeap() ));
+    // ------------- END - CREATE CACHE, REGION ON LOCAL SITE -------------//
+
+    // ------------- START - CREATE CACHE ON REMOTE SITE ---------------//
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createSender( "ny", 1,
+        false, 100, 10, false, false, null, true ));
+    vm3.invoke(() -> WANTestBase.createSender( "ny", 1,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createAsyncEventQueue(
+        "nyAsync", false, 100, 100, false, false, null, false ));
+    vm3.invoke(() -> WANTestBase.createAsyncEventQueue(
+        "nyAsync", false, 100, 100, false, false, null, false ));
+
+    startSenderInVMs("ny", vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
+            getTestMethodName() + "_RR", "ny", "nyAsync", isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegionWithSenderAndAsyncEventQueue(
+            getTestMethodName() + "_RR", "ny", "nyAsync", isOffHeap() ));
+
+    // ------------- END - CREATE CACHE, REGION ON REMOTE SITE -------------//
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    // validate AsyncEventListener on local site
+    vm4.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 1000 ));// primary sender
+    vm5.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 0 ));// secondary
+    vm6.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 0 ));// secondary
+    vm7.invoke(() -> WANTestBase.validateAsyncEventListener( "lnAsync", 0 ));// secondary
+
+    // validate region size on remote site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+    // validate AsyncEventListener on remote site
+    vm2.invoke(() -> WANTestBase.validateAsyncEventListener( "nyAsync", 1000 ));// primary sender
+    vm3.invoke(() -> WANTestBase.validateAsyncEventListener( "nyAsync", 0 ));// secondary
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
new file mode 100644
index 0000000..1b8d2e7
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.concurrent.ConcurrentParallelGatewaySenderOperation_2_DUnitTest;
+
+@Category(DistributedTest.class)
+public class ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest
+    extends ConcurrentParallelGatewaySenderOperation_2_DUnitTest {
+
+  public ConcurrentParallelGatewaySenderOperation_2_OffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
new file mode 100644
index 0000000..37631a8
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperation_2_OffHeapDUnitTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderOperation_2_DUnitTest;
+
+@Category(DistributedTest.class)
+public class ParallelGatewaySenderOperation_2_OffHeapDUnitTest
+    extends ParallelGatewaySenderOperation_2_DUnitTest{
+
+  public ParallelGatewaySenderOperation_2_OffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java
new file mode 100644
index 0000000..b735a18
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderOperationsOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderOperationsDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ParallelGatewaySenderOperationsOffHeapDUnitTest extends
+    ParallelGatewaySenderOperationsDUnitTest {
+
+  public ParallelGatewaySenderOperationsOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java
new file mode 100644
index 0000000..de87b09
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelGatewaySenderQueueOverflowOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQueueOverflowDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ParallelGatewaySenderQueueOverflowOffHeapDUnitTest extends
+    ParallelGatewaySenderQueueOverflowDUnitTest {
+
+  public ParallelGatewaySenderQueueOverflowOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java
new file mode 100644
index 0000000..44ebefd
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANConflationOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANConflationDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ParallelWANConflationOffHeapDUnitTest extends
+    ParallelWANConflationDUnitTest {
+
+  public ParallelWANConflationOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
new file mode 100644
index 0000000..31fe21b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANPersistenceEnabledGatewaySenderDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest extends
+    ParallelWANPersistenceEnabledGatewaySenderDUnitTest {
+
+  public ParallelWANPersistenceEnabledGatewaySenderOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java
new file mode 100644
index 0000000..1dca0c9
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationConcurrentOpsOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANPropagationConcurrentOpsDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ParallelWANPropagationConcurrentOpsOffHeapDUnitTest extends
+    ParallelWANPropagationConcurrentOpsDUnitTest {
+
+  public ParallelWANPropagationConcurrentOpsOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java
new file mode 100644
index 0000000..b08b5c2
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/ParallelWANPropagationOffHeapDUnitTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelWANPropagationDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ParallelWANPropagationOffHeapDUnitTest extends ParallelWANPropagationDUnitTest {
+
+  public ParallelWANPropagationOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java
new file mode 100644
index 0000000..b75faf0
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/offheap/SerialGatewaySenderQueueOffHeapDUnitTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.cache.wan.offheap;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderQueueDUnitTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class SerialGatewaySenderQueueOffHeapDUnitTest extends
+    SerialGatewaySenderQueueDUnitTest {
+
+  public SerialGatewaySenderQueueOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}


[47/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactory.java
new file mode 100755
index 0000000..b6ac867
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+
+public class LuceneIndexFactory {
+  public LuceneIndexFactory() {
+  }
+  
+  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
+    return new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
new file mode 100644
index 0000000..b64e026
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -0,0 +1,176 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+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.RegionShortcut;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.cache.lucene.internal.directory.DumpDirectoryFiles;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemStats;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+
+/* wrapper of IndexWriter */
+public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
+  protected Region<String, File> fileRegion;
+  protected Region<ChunkKey, byte[]> chunkRegion;
+  protected final FileSystemStats fileSystemStats;
+
+  public LuceneIndexForPartitionedRegion(String indexName, String regionPath, Cache cache) {
+    super(indexName, regionPath, cache);
+
+    final String statsName = indexName + "-" + regionPath;
+    this.fileSystemStats = new FileSystemStats(cache.getDistributedSystem(), statsName);
+  }
+
+  protected RepositoryManager createRepositoryManager() {
+    RegionShortcut regionShortCut;
+    final boolean withPersistence = withPersistence(); 
+    RegionAttributes regionAttributes = dataRegion.getAttributes();
+    final boolean withStorage = regionAttributes.getPartitionAttributes().getLocalMaxMemory()>0;
+
+    // TODO: 1) dataRegion should be withStorage
+    //       2) Persistence to Persistence
+    //       3) Replicate to Replicate, Partition To Partition
+    //       4) Offheap to Offheap
+    if (!withStorage) {
+      throw new IllegalStateException("The data region to create lucene index should be with storage");
+    }
+    if (withPersistence) {
+      // TODO: add PartitionedRegionAttributes instead
+      regionShortCut = RegionShortcut.PARTITION_PERSISTENT;
+    } else {
+      regionShortCut = RegionShortcut.PARTITION;
+    }
+    
+    // create PR fileRegion, but not to create its buckets for now
+    final String fileRegionName = createFileRegionName();
+    PartitionAttributes partitionAttributes = dataRegion.getPartitionAttributes();
+    if (!fileRegionExists(fileRegionName)) {
+      fileRegion = createFileRegion(regionShortCut, fileRegionName, partitionAttributes, regionAttributes);
+    }
+
+    // create PR chunkRegion, but not to create its buckets for now
+    final String chunkRegionName = createChunkRegionName();
+    if (!chunkRegionExists(chunkRegionName)) {
+      chunkRegion = createChunkRegion(regionShortCut, fileRegionName, partitionAttributes, chunkRegionName, regionAttributes);
+    }
+    fileSystemStats.setFileSupplier(() -> (int) getFileRegion().getLocalSize());
+    fileSystemStats.setChunkSupplier(() -> (int) getChunkRegion().getLocalSize());
+    fileSystemStats.setBytesSupplier(() -> getChunkRegion().getPrStats().getDataStoreBytesInUse());
+
+    // we will create RegionDirectories on the fly when data comes in
+    HeterogeneousLuceneSerializer mapper = new HeterogeneousLuceneSerializer(getFieldNames());
+    return new PartitionedRepositoryManager(this, mapper);
+  }
+  
+  public PartitionedRegion getFileRegion() {
+    return (PartitionedRegion) fileRegion;
+  }
+
+  public PartitionedRegion getChunkRegion() {
+    return (PartitionedRegion) chunkRegion;
+  }
+
+  public FileSystemStats getFileSystemStats() {
+    return fileSystemStats;
+  }
+  
+  boolean fileRegionExists(String fileRegionName) {
+    return cache.<String, File> getRegion(fileRegionName) != null;
+  }
+
+  Region createFileRegion(final RegionShortcut regionShortCut,
+                                final String fileRegionName,
+                                final PartitionAttributes partitionAttributes,
+                                final RegionAttributes regionAttributes) {
+    return createRegion(fileRegionName, regionShortCut, this.regionPath, partitionAttributes, regionAttributes);
+  }
+
+  public String createFileRegionName() {
+    return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath)+".files";
+  }
+
+  boolean chunkRegionExists(String chunkRegionName) {
+    return cache.<ChunkKey, byte[]> getRegion(chunkRegionName) != null;
+  }
+
+  Region<ChunkKey, byte[]> createChunkRegion(final RegionShortcut regionShortCut,
+                           final String fileRegionName,
+                           final PartitionAttributes partitionAttributes, final String chunkRegionName, final RegionAttributes regionAttributes) {
+    return createRegion(chunkRegionName, regionShortCut, fileRegionName, partitionAttributes, regionAttributes);
+  }
+
+  public String createChunkRegionName() {
+    return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath) + ".chunks";
+  }
+
+  private PartitionAttributesFactory configureLuceneRegionAttributesFactory(PartitionAttributesFactory attributesFactory, PartitionAttributes<?,?> dataRegionAttributes) {
+    attributesFactory.setTotalNumBuckets(dataRegionAttributes.getTotalNumBuckets());
+    attributesFactory.setRedundantCopies(dataRegionAttributes.getRedundantCopies());
+    return attributesFactory;
+  }
+
+  protected <K, V> Region<K, V> createRegion(final String regionName,
+                                             final RegionShortcut regionShortCut,
+                                             final String colocatedWithRegionName,
+                                             final PartitionAttributes partitionAttributes,
+                                             final RegionAttributes regionAttributes)
+  {
+    PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory<String, File>();
+    partitionAttributesFactory.setColocatedWith(colocatedWithRegionName);
+    configureLuceneRegionAttributesFactory(partitionAttributesFactory, partitionAttributes);
+
+    // Create AttributesFactory based on input RegionShortcut
+    RegionAttributes baseAttributes = this.cache.getRegionAttributes(regionShortCut.toString());
+    AttributesFactory factory = new AttributesFactory(baseAttributes);
+    factory.setPartitionAttributes(partitionAttributesFactory.create());
+    factory.setDiskStoreName(regionAttributes.getDiskStoreName());
+    RegionAttributes<K, V> attributes = factory.create();
+
+    return createRegion(regionName, attributes);
+  }
+
+  public void close() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public void dumpFiles(final String directory) {
+    ResultCollector results = FunctionService.onRegion(getDataRegion())
+      .withArgs(new String[] {directory, indexName})
+      .execute(DumpDirectoryFiles.ID);
+    results.getResult();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
new file mode 100644
index 0000000..67461a9
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
@@ -0,0 +1,236 @@
+/*
+ * 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.lucene.internal;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystemStats;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.lucene.internal.xml.LuceneIndexCreation;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+public abstract class LuceneIndexImpl implements InternalLuceneIndex {
+  protected static final Logger logger = LogService.getLogger();
+  
+  protected final String indexName;
+  protected final String regionPath;
+  protected final Cache cache;
+  protected final LuceneIndexStats indexStats;
+
+  protected boolean hasInitialized = false;
+  protected Map<String, Analyzer> fieldAnalyzers;
+  protected String[] searchableFieldNames;
+  protected RepositoryManager repositoryManager;
+  protected Analyzer analyzer;
+  protected LocalRegion dataRegion;
+
+  protected LuceneIndexImpl(String indexName, String regionPath, Cache cache) {
+    this.indexName = indexName;
+    this.regionPath = regionPath;
+    this.cache = cache;
+    
+    final String statsName = indexName + "-" + regionPath;
+    this.indexStats = new LuceneIndexStats(cache.getDistributedSystem(), statsName);
+  }
+
+  @Override
+  public String getName() {
+    return this.indexName;
+  }
+
+  @Override
+  public String getRegionPath() {
+    return this.regionPath;
+  }
+ 
+  protected LocalRegion getDataRegion() {
+    return (LocalRegion)cache.getRegion(regionPath);
+  }
+
+  protected boolean withPersistence() {
+    RegionAttributes ra = dataRegion.getAttributes();
+    DataPolicy dp = ra.getDataPolicy();
+    final boolean withPersistence = dp.withPersistence();
+    return withPersistence;
+  }
+  
+  protected void setSearchableFields(String[] fields) {
+    searchableFieldNames = fields;
+  }
+
+  @Override
+  public boolean waitUntilFlushed(int maxWaitInMillisecond) {
+    String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
+    AsyncEventQueue queue = (AsyncEventQueue)cache.getAsyncEventQueue(aeqId);
+    boolean flushed = false;
+    if (queue != null) {
+      long start = System.nanoTime();
+      while (System.nanoTime() - start < TimeUnit.MILLISECONDS.toNanos(maxWaitInMillisecond)) {
+        if (0 == queue.size()) {
+          flushed = true;
+          break;
+        } else {
+          try {
+            Thread.sleep(200);
+          } catch (InterruptedException e) {
+          }
+        }
+      }
+    } else { 
+      throw new IllegalArgumentException("The AEQ does not exist for the index "+indexName+" region "+regionPath);
+    }
+
+    return flushed;
+  }
+
+  @Override
+  public String[] getFieldNames() {
+    return searchableFieldNames;
+  }
+
+  @Override
+  public Map<String, Analyzer> getFieldAnalyzers() {
+    return this.fieldAnalyzers;
+  }
+
+  public RepositoryManager getRepositoryManager() {
+    return this.repositoryManager;
+  }
+  
+  public void setAnalyzer(Analyzer analyzer) {
+    if (analyzer == null) {
+      this.analyzer = new StandardAnalyzer();
+    } else {
+      this.analyzer = analyzer;
+    }
+  }
+
+  public Analyzer getAnalyzer() {
+    return this.analyzer;
+  }
+
+  public Cache getCache() {
+    return this.cache;
+  }
+  
+  public void setFieldAnalyzers(Map<String, Analyzer> fieldAnalyzers) {
+    this.fieldAnalyzers = fieldAnalyzers == null ? null : Collections.unmodifiableMap(fieldAnalyzers);
+  }
+
+  public LuceneIndexStats getIndexStats() {
+    return indexStats;
+  }
+
+  protected void initialize() {
+    if (!hasInitialized) {
+      /* create index region */
+      dataRegion = getDataRegion();
+      //assert dataRegion != null;
+
+      repositoryManager = createRepositoryManager();
+      
+      // create AEQ, AEQ listener and specify the listener to repositoryManager
+      createAEQ(dataRegion);
+
+      addExtension(dataRegion);
+      hasInitialized = true;
+    }
+  }
+  
+  protected abstract RepositoryManager createRepositoryManager();
+  
+  protected AsyncEventQueue createAEQ(Region dataRegion) {
+    return createAEQ(createAEQFactory(dataRegion));
+  }
+
+  private AsyncEventQueueFactoryImpl createAEQFactory(final Region dataRegion) {
+    AsyncEventQueueFactoryImpl factory = (AsyncEventQueueFactoryImpl) cache.createAsyncEventQueueFactory();
+    if (dataRegion instanceof PartitionedRegion) {
+      factory.setParallel(true); // parallel AEQ for PR
+    } else {
+      factory.setParallel(false); // TODO: not sure if serial AEQ working or not
+    }
+    factory.setMaximumQueueMemory(1000);
+    factory.setDispatcherThreads(10);
+    factory.setIsMetaQueue(true);
+    if (dataRegion.getAttributes().getDataPolicy().withPersistence()) {
+      factory.setPersistent(true);
+    }
+    factory.setDiskStoreName(dataRegion.getAttributes().getDiskStoreName());
+    factory.setDiskSynchronous(dataRegion.getAttributes().isDiskSynchronous());
+    factory.setForwardExpirationDestroy(true);
+    return factory;
+  }
+
+  private AsyncEventQueue createAEQ(AsyncEventQueueFactoryImpl factory) {
+    LuceneEventListener listener = new LuceneEventListener(repositoryManager);
+    String aeqId = LuceneServiceImpl.getUniqueIndexName(getName(), regionPath);
+    AsyncEventQueue indexQueue = factory.create(aeqId, listener);
+    return indexQueue;
+  }
+
+/**
+   * Register an extension with the region
+   * so that xml will be generated for this index.
+   */
+  protected void addExtension(LocalRegion dataRegion) {
+    LuceneIndexCreation creation = new LuceneIndexCreation();
+    creation.setName(this.getName());
+    creation.addFieldNames(this.getFieldNames());
+    creation.setRegion(dataRegion);
+    creation.setFieldAnalyzers(this.getFieldAnalyzers());
+    dataRegion.getExtensionPoint().addExtension(creation);
+  }
+
+  protected <K, V> Region<K, V> createRegion(final String regionName, final RegionAttributes<K, V> attributes) {
+    // Create InternalRegionArguments to set isUsedForMetaRegion true to suppress xml generation (among other things)
+    InternalRegionArguments ira = new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
+        .setSnapshotInputStream(null).setImageTarget(null).setIsUsedForMetaRegion(true);
+
+    // Create the region
+    try {
+      return ((GemFireCacheImpl)this.cache).createVMRegion(regionName, attributes, ira);
+    } catch (Exception e) {
+      InternalGemFireError ige = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
+      ige.initCause(e);
+      throw ige;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexStats.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexStats.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexStats.java
new file mode 100644
index 0000000..220ae0e
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexStats.java
@@ -0,0 +1,202 @@
+/*
+ * 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.lucene.internal;
+
+import static com.gemstone.gemfire.distributed.internal.DistributionStats.getStatTime;
+
+import java.util.function.IntSupplier;
+
+import com.gemstone.gemfire.StatisticDescriptor;
+import com.gemstone.gemfire.Statistics;
+import com.gemstone.gemfire.StatisticsFactory;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.StatisticsTypeFactory;
+import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+
+public class LuceneIndexStats {
+  // statistics type
+  private static final StatisticsType statsType;
+  private static final String statsTypeName = "LuceneIndexStats";
+  private static final String statsTypeDescription = "Statistics about lucene indexes";
+
+  private static final int queryExecutionsId;
+  private static final int queryExecutionTimeId;
+  private static final int queryExecutionsInProgressId;
+  private static final int queryExecutionTotalHitsId;
+  private static final int updatesId;
+  private static final int updateTimeId;
+  private static final int updatesInProgressId;
+  private static final int commitsId;
+  private static final int commitTimeId;
+  private static final int commitsInProgressId;
+  private static final int documentsId;
+
+  private final Statistics stats;
+  private final CopyOnWriteHashSet<IntSupplier> documentsSuppliers = new CopyOnWriteHashSet<>();
+
+  static {
+    final StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    statsType = f.createType(
+      statsTypeName,
+      statsTypeDescription,
+      new StatisticDescriptor[] {
+        f.createIntCounter("queryExecutions", "Number of lucene queries executed on this member", "operations"),
+        f.createLongCounter("queryExecutionTime", "Amount of time spent executing lucene queries", "nanoseconds"),
+        f.createIntGauge("queryExecutionsInProgress", "Number of query executions currently in progress", "operations"),
+        f.createLongCounter("queryExecutionTotalHits", "Total number of documents returned by query executions", "entries"),
+        f.createIntCounter("updates", "Number of lucene index documents added/removed on this member", "operations"),
+        f.createLongCounter("updateTime", "Amount of time spent adding or removing documents from the index", "nanoseconds"),
+        f.createIntGauge("updatesInProgress", "Number of index updates in progress", "operations"),
+        f.createIntCounter("commits", "Number of lucene index commits on this member", "operations"),
+        f.createLongCounter("commitTime", "Amount of time spent in lucene index commits", "nanoseconds"),
+        f.createIntGauge("commitsInProgress", "Number of lucene index commits in progress", "operations"),
+        f.createIntGauge("documents", "Number of documents in the index", "documents"),
+      }
+    );
+
+    queryExecutionsId = statsType.nameToId("queryExecutions");
+    queryExecutionTimeId = statsType.nameToId("queryExecutionTime");
+    queryExecutionsInProgressId = statsType.nameToId("queryExecutionsInProgress");
+    queryExecutionTotalHitsId = statsType.nameToId("queryExecutionTotalHits");
+    updatesId = statsType.nameToId("updates");
+    updateTimeId = statsType.nameToId("updateTime");
+    updatesInProgressId = statsType.nameToId("updatesInProgress");
+    commitsId = statsType.nameToId("commits");
+    commitTimeId = statsType.nameToId("commitTime");
+    commitsInProgressId = statsType.nameToId("commitsInProgress");
+    documentsId = statsType.nameToId("documents");
+  }
+
+  public LuceneIndexStats(StatisticsFactory f, String name) {
+    this.stats = f.createAtomicStatistics(statsType, name);
+    stats.setIntSupplier(documentsId, this::computeDocumentCount);
+  }
+
+  /**
+   * @return the timestamp that marks the start of the operation
+   */
+  public long startQuery() {
+    stats.incInt(queryExecutionsInProgressId, 1);
+    return getStatTime();
+  }
+  /**
+   * @param start the timestamp taken when the operation started
+   */
+  public void endQuery(long start, final int totalHits) {
+    stats.incLong(queryExecutionTimeId, getStatTime()-start);
+    stats.incInt(queryExecutionsInProgressId, -1);
+    stats.incInt(queryExecutionsId, 1);
+    stats.incLong(queryExecutionTotalHitsId, totalHits);
+  }
+
+  /**
+   * @return the timestamp that marks the start of the operation
+   */
+  public long startUpdate() {
+    stats.incInt(updatesInProgressId, 1);
+    return getStatTime();
+  }
+  /**
+   * @param start the timestamp taken when the operation started
+   */
+  public void endUpdate(long start) {
+    stats.incLong(updateTimeId, getStatTime()-start);
+    stats.incInt(updatesInProgressId, -1);
+    stats.incInt(updatesId, 1);
+  }
+
+  /**
+   * @return the timestamp that marks the start of the operation
+   */
+  public long startCommit() {
+    stats.incInt(commitsInProgressId, 1);
+    return getStatTime();
+  }
+  /**
+   * @param start the timestamp taken when the operation started
+   */
+  public void endCommit(long start) {
+    stats.incLong(commitTimeId, getStatTime()-start);
+    stats.incInt(commitsInProgressId, -1);
+    stats.incInt(commitsId, 1);
+  }
+
+  public void addDocumentsSupplier(IntSupplier supplier) {
+    this.documentsSuppliers.add(supplier);
+  }
+
+  public void removeDocumentsSupplier(IntSupplier supplier) {
+    this.documentsSuppliers.remove(supplier);
+  }
+
+  public int getDocuments() {
+    return this.stats.getInt(documentsId);
+  }
+
+  private int computeDocumentCount() {
+    return this.documentsSuppliers.stream()
+      .mapToInt(IntSupplier::getAsInt)
+      .sum();
+  }
+
+  public int getQueryExecutions() {
+    return stats.getInt(queryExecutionsId);
+  }
+
+  public long getQueryExecutionTime() {
+    return stats.getLong(queryExecutionTimeId);
+  }
+
+  public int getQueryExecutionsInProgress() {
+    return stats.getInt(queryExecutionsInProgressId);
+  }
+
+  public long getQueryExecutionTotalHits() {
+    return stats.getLong(queryExecutionTotalHitsId);
+  }
+
+  public int getUpdates() {
+    return stats.getInt(updatesId);
+  }
+
+  public long getUpdateTime() {
+    return stats.getLong(updateTimeId);
+  }
+
+  public int getUpdatesInProgress() {
+    return stats.getInt(updatesInProgressId);
+  }
+
+  public int getCommits() {
+    return stats.getInt(commitsId);
+  }
+
+  public long getCommitTime() {
+    return stats.getLong(commitTimeId);
+  }
+
+  public int getCommitsInProgress() {
+    return stats.getInt(commitsInProgressId);
+  }
+
+  public Statistics getStats() {
+    return this.stats;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
new file mode 100644
index 0000000..21c019b
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
@@ -0,0 +1,71 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.LuceneQuery;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
+
+public class LuceneQueryFactoryImpl implements LuceneQueryFactory {
+  private int limit = DEFAULT_LIMIT;
+  private int pageSize = DEFAULT_PAGESIZE;
+  private String[] projectionFields = null;
+  private Cache cache;
+  
+  LuceneQueryFactoryImpl(Cache cache) {
+    this.cache = cache;
+  }
+  
+  @Override
+  public LuceneQueryFactory setPageSize(int pageSize) {
+    this.pageSize = pageSize;
+    return this;
+  }
+
+  @Override
+  public LuceneQueryFactory setResultLimit(int limit) {
+    this.limit = limit;
+    return this;
+  }
+
+  @Override
+  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, String queryString, String defaultField) {
+    return create(indexName, regionName, new StringQueryProvider(queryString, defaultField));
+  }
+  
+  @Override
+  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, LuceneQueryProvider provider) {
+    Region<K, V> region = cache.getRegion(regionName);
+    if(region == null) {
+      throw new IllegalArgumentException("Region not found: " + regionName);
+    }
+    LuceneQueryImpl<K, V> luceneQuery = new LuceneQueryImpl<K, V>(indexName, region, provider, projectionFields, limit, pageSize);
+    return luceneQuery;
+  }
+  
+  @Override
+  public LuceneQueryFactory setProjectionFields(String... fieldNames) {
+    projectionFields = fieldNames.clone();
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
new file mode 100644
index 0000000..ef2f4ee
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
@@ -0,0 +1,148 @@
+/*
+ * 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.lucene.internal;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.cache.lucene.LuceneQuery;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
+import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
+import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunctionContext;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntries;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollector;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollectorManager;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesFunctionCollector;
+
+public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
+  private int limit = LuceneQueryFactory.DEFAULT_LIMIT;
+  private int pageSize = LuceneQueryFactory.DEFAULT_PAGESIZE;
+  private String indexName;
+  // The projected fields are local to a specific index per Query object. 
+  private String[] projectedFieldNames;
+  /* the lucene Query object to be wrapped here */
+  private LuceneQueryProvider query;
+  private Region<K, V> region;
+  private String defaultField;
+  
+  public LuceneQueryImpl(String indexName, Region<K, V> region, LuceneQueryProvider provider, String[] projectionFields,
+      int limit, int pageSize) {
+    this.indexName = indexName;
+    this.region = region;
+    this.limit = limit;
+    this.pageSize = pageSize;
+    this.projectedFieldNames = projectionFields;
+    this.query = provider;
+  }
+
+  @Override
+  public Collection<K> findKeys() throws LuceneQueryException {
+    TopEntries<K> entries = findTopEntries();
+    final List<EntryScore<K>> hits = entries.getHits();
+
+    return hits.stream()
+      .map(hit -> hit.getKey())
+      .collect(Collectors.toList());
+  }
+
+  @Override
+  public Collection<V> findValues() throws LuceneQueryException {
+    final List<LuceneResultStruct<K, V>> page = findResults();
+
+    return page.stream()
+      .map(entry -> entry.getValue())
+      .collect(Collectors.toList());
+  }
+
+  @Override
+  public List<LuceneResultStruct<K, V>> findResults() throws LuceneQueryException {
+    PageableLuceneQueryResults<K, V> pages = findPages(0);
+    if(!pages.hasNext()) {
+      return Collections.emptyList();
+    }
+
+    return pages.next();
+  }
+
+  @Override
+  public PageableLuceneQueryResults<K, V> findPages() throws LuceneQueryException {
+    return findPages(pageSize);
+  }
+
+  private PageableLuceneQueryResults<K, V> findPages(int pageSize) throws LuceneQueryException {
+    TopEntries<K> entries = findTopEntries();
+    return new PageableLuceneQueryResultsImpl<K, V>(entries.getHits(), region, pageSize);
+  }
+
+  private TopEntries<K> findTopEntries() throws LuceneQueryException {
+    TopEntriesCollectorManager manager = new TopEntriesCollectorManager(null, limit);
+    LuceneFunctionContext<TopEntriesCollector> context = new LuceneFunctionContext<>(query, indexName, manager, limit);
+    TopEntriesFunctionCollector collector = new TopEntriesFunctionCollector(context);
+
+    ResultCollector<TopEntriesCollector, TopEntries<K>> rc = (ResultCollector<TopEntriesCollector, TopEntries<K>>) onRegion()
+        .withArgs(context)
+        .withCollector(collector)
+        .execute(LuceneFunction.ID);
+
+    //TODO provide a timeout to the user?
+    TopEntries<K> entries;
+    try {
+      entries = rc.getResult();
+    } catch(FunctionException e) {
+      if(e.getCause() instanceof LuceneQueryException) {
+        throw new LuceneQueryException(e);
+      } else {
+        throw e;
+      }
+    }
+    return entries;
+  }
+
+  protected Execution onRegion() {
+    return FunctionService.onRegion(region);
+  }
+
+  @Override
+  public int getPageSize() {
+    return this.pageSize;
+  }
+
+  @Override
+  public int getLimit() {
+    return this.limit;
+  }
+
+  @Override
+  public String[] getProjectedFieldNames() {
+    return this.projectedFieldNames;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
new file mode 100755
index 0000000..e708691
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
@@ -0,0 +1,43 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+
+public class LuceneRawIndex extends LuceneIndexImpl {
+  
+  protected LuceneRawIndex(String indexName, String regionPath, Cache cache) {
+    super(indexName, regionPath, cache);
+  }
+
+  @Override
+  protected RepositoryManager createRepositoryManager() {
+    HeterogeneousLuceneSerializer mapper = new HeterogeneousLuceneSerializer(getFieldNames());
+    return new RawLuceneRepositoryManager(this, mapper);
+  }
+  
+  @Override
+  public void dumpFiles(String directory) {
+    return;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
new file mode 100755
index 0000000..6c3bad6
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
@@ -0,0 +1,27 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+
+public class LuceneRawIndexFactory extends LuceneIndexFactory {
+  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
+    return new LuceneRawIndex(indexName, regionPath, cache);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneResultStructImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneResultStructImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneResultStructImpl.java
new file mode 100644
index 0000000..a3794f2
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneResultStructImpl.java
@@ -0,0 +1,94 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
+
+public class LuceneResultStructImpl<K,V> implements LuceneResultStruct<K,V> {
+  K key;
+  V value;
+  float score;
+
+  public LuceneResultStructImpl(K key, V value, float score) {
+    this.key = key;
+    this.value = value;
+    this.score = score;
+  }
+
+  @Override
+  public Object getProjectedField(String fieldName) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public K getKey() {
+    return key;
+  }
+
+  @Override
+  public V getValue() {
+    return value;
+  }
+
+  @Override
+  public float getScore() {
+    return score;
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((key == null) ? 0 : key.hashCode());
+    result = prime * result + Float.floatToIntBits(score);
+    result = prime * result + ((value == null) ? 0 : value.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+      return true;
+    if (obj == null)
+      return false;
+    if (getClass() != obj.getClass())
+      return false;
+    LuceneResultStructImpl other = (LuceneResultStructImpl) obj;
+    if (key == null) {
+      if (other.key != null)
+        return false;
+    } else if (!key.equals(other.key))
+      return false;
+    if (Float.floatToIntBits(score) != Float.floatToIntBits(other.score))
+      return false;
+    if (value == null) {
+      if (other.value != null)
+        return false;
+    } else if (!value.equals(other.value))
+      return false;
+    return true;
+  }
+
+  @Override
+  public String toString() {
+    return "LuceneResultStructImpl [key=" + key + ", value=" + value
+        + ", score=" + score + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
new file mode 100644
index 0000000..81a62b8
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
@@ -0,0 +1,334 @@
+/*
+ * 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.lucene.internal;
+
+import java.util.*;
+
+import com.gemstone.gemfire.cache.lucene.internal.management.LuceneServiceMBean;
+import com.gemstone.gemfire.cache.lucene.internal.management.ManagementIndexListener;
+import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.EvictionAlgorithm;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.cache.lucene.internal.directory.DumpDirectoryFiles;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunctionContext;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntries;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollector;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollectorManager;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
+import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
+import com.gemstone.gemfire.cache.lucene.internal.xml.LuceneServiceXmlGenerator;
+import com.gemstone.gemfire.internal.DSFIDFactory;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.cache.extension.Extensible;
+import com.gemstone.gemfire.internal.cache.CacheService;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.RegionListener;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * Implementation of LuceneService to create lucene index and query.
+ * 
+ * 
+ * @since GemFire 8.5
+ */
+public class LuceneServiceImpl implements InternalLuceneService {
+  public static LuceneIndexFactory luceneIndexFactory = new LuceneIndexFactory();
+  private static final Logger logger = LogService.getLogger();
+
+  private GemFireCacheImpl cache;
+  private final HashMap<String, LuceneIndex> indexMap = new HashMap<String, LuceneIndex>();
+  private final HashMap<String, LuceneIndexCreationProfile> definedIndexMap = new HashMap<>();
+  private IndexListener managementListener;
+
+  public LuceneServiceImpl() {
+    
+  }
+
+  public void init(final Cache cache) {
+    if (cache == null) {
+      throw new IllegalStateException(LocalizedStrings.CqService_CACHE_IS_NULL.toLocalizedString());
+    }
+    GemFireCacheImpl gfc = (GemFireCacheImpl) cache;
+    gfc.getCancelCriterion().checkCancelInProgress(null);
+
+    this.cache = gfc;
+
+    FunctionService.registerFunction(new LuceneFunction());
+    FunctionService.registerFunction(new DumpDirectoryFiles());
+    registerDataSerializables();
+  }
+
+  @Override
+  public CacheServiceMBeanBase getMBean() {
+    LuceneServiceMBean mbean = new LuceneServiceMBean(this);
+    this.managementListener = new ManagementIndexListener(mbean);
+    return mbean;
+  }
+
+  @Override
+  public Class<? extends CacheService> getInterface() {
+    return InternalLuceneService.class;
+  }
+
+  public static String getUniqueIndexName(String indexName, String regionPath) {
+    if (!regionPath.startsWith("/")) {
+      regionPath = "/"+regionPath;
+    }
+    String name = indexName + "#" + regionPath.replace('/', '_');
+    return name;
+  }
+
+  @Override
+  public void createIndex(String indexName, String regionPath, String... fields) {
+    if(fields == null || fields.length == 0) {
+      throw new IllegalArgumentException("At least one field must be indexed");
+    }
+    StandardAnalyzer analyzer = new StandardAnalyzer();
+    
+    createIndex(indexName, regionPath, analyzer, null, fields);
+  }
+  
+  @Override
+  public void createIndex(String indexName, String regionPath, Map<String, Analyzer> fieldAnalyzers) {
+    if(fieldAnalyzers == null || fieldAnalyzers.isEmpty()) {
+      throw new IllegalArgumentException("At least one field must be indexed");
+    }
+    Analyzer analyzer = new PerFieldAnalyzerWrapper(new StandardAnalyzer(), fieldAnalyzers);
+    Set<String> fieldsSet = fieldAnalyzers.keySet();
+    String[] fields = (String[])fieldsSet.toArray(new String[fieldsSet.size()]);
+
+    createIndex(indexName, regionPath, analyzer, fieldAnalyzers, fields);
+  }
+
+  public void createIndex(final String indexName, String regionPath,
+      final Analyzer analyzer, final Map<String, Analyzer> fieldAnalyzers,
+      final String... fields) {
+
+    if(!regionPath.startsWith("/")) {
+      regionPath = "/" + regionPath;
+    }
+
+    registerDefinedIndex(LuceneServiceImpl.getUniqueIndexName(indexName, regionPath),
+                                new LuceneIndexCreationProfile(indexName, regionPath, fields, analyzer, fieldAnalyzers));
+
+    Region region = cache.getRegion(regionPath);
+    if(region != null) {
+      definedIndexMap.remove(LuceneServiceImpl.getUniqueIndexName(indexName, regionPath));
+      throw new IllegalStateException("The lucene index must be created before region");
+    }
+
+    final String dataRegionPath = regionPath;
+    cache.addRegionListener(new RegionListener() {
+      @Override
+      public RegionAttributes beforeCreate(Region parent, String regionName,
+          RegionAttributes attrs, InternalRegionArguments internalRegionArgs) {
+        RegionAttributes updatedRA = attrs;
+        String path = parent == null ? "/" + regionName : parent.getFullPath() + "/" + regionName;
+
+        if(path.equals(dataRegionPath)) {
+
+          if (!attrs.getDataPolicy().withPartitioning()) {
+            // replicated region
+            throw new UnsupportedOperationException("Lucene indexes on replicated regions are not supported");
+          }
+
+          //For now we cannot support eviction with local destroy.
+          //Eviction with overflow to disk still needs to be supported
+          EvictionAttributes evictionAttributes = attrs.getEvictionAttributes();
+          EvictionAlgorithm evictionAlgorithm = evictionAttributes.getAlgorithm();
+          if (evictionAlgorithm != EvictionAlgorithm.NONE && evictionAttributes.getAction().isLocalDestroy()) {
+            throw new UnsupportedOperationException("Lucene indexes on regions with eviction and action local destroy are not supported");
+          }
+
+          String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, dataRegionPath);
+          if (!attrs.getAsyncEventQueueIds().contains(aeqId)) {
+            AttributesFactory af = new AttributesFactory(attrs);
+            af.addAsyncEventQueueId(aeqId);
+            updatedRA = af.create();
+          }
+
+          // Add index creation profile
+          internalRegionArgs.addCacheServiceProfile(new LuceneIndexCreationProfile(indexName, dataRegionPath, fields, analyzer, fieldAnalyzers));
+        }
+        return updatedRA;
+      }
+      
+      @Override
+      public void afterCreate(Region region) {
+        if(region.getFullPath().equals(dataRegionPath)) {
+          afterDataRegionCreated(indexName, analyzer, dataRegionPath, fieldAnalyzers, fields);
+          cache.removeRegionListener(this);
+        }
+      }
+    });
+  }
+
+
+  /**
+   * Finish creating the lucene index after the data region is created .
+   * 
+   * Public because this is called by the Xml parsing code
+   */
+  public void afterDataRegionCreated(final String indexName,
+      final Analyzer analyzer, final String dataRegionPath,
+      final Map<String, Analyzer> fieldAnalyzers, final String... fields) {
+    LuceneIndexImpl index = createIndexRegions(indexName, dataRegionPath);
+    index.setSearchableFields(fields);
+    index.setAnalyzer(analyzer);
+    index.setFieldAnalyzers(fieldAnalyzers);
+    index.initialize();
+    registerIndex(index);
+    if (this.managementListener != null) {
+      this.managementListener.afterIndexCreated(index);
+    }
+  }
+  
+  private LuceneIndexImpl createIndexRegions(String indexName, String regionPath) {
+    Region dataregion = this.cache.getRegion(regionPath);
+    if (dataregion == null) {
+      logger.info("Data region "+regionPath+" not found");
+      return null;
+    }
+    //Convert the region name into a canonical form
+    regionPath = dataregion.getFullPath();
+    return luceneIndexFactory.create(indexName, regionPath, cache);
+  }
+
+  private void registerDefinedIndex(final String regionAndIndex, final LuceneIndexCreationProfile luceneIndexCreationProfile) {
+    if (definedIndexMap.containsKey(regionAndIndex) || indexMap.containsKey(regionAndIndex))
+      throw new IllegalArgumentException("Lucene index already exists in region");
+    definedIndexMap.put(regionAndIndex, luceneIndexCreationProfile);
+  }
+
+  @Override
+  public LuceneIndex getIndex(String indexName, String regionPath) {
+    Region region = cache.getRegion(regionPath);
+    if(region == null) {
+      return null;
+    }
+    return indexMap.get(getUniqueIndexName(indexName, region.getFullPath()));
+  }
+
+  @Override
+  public Collection<LuceneIndex> getAllIndexes() {
+    return indexMap.values();
+  }
+
+  @Override
+  public void destroyIndex(LuceneIndex index) {
+    LuceneIndexImpl indexImpl = (LuceneIndexImpl) index;
+    indexMap.remove(getUniqueIndexName(index.getName(), index.getRegionPath()));
+//    indexImpl.close();
+  }
+
+  @Override
+  public LuceneQueryFactory createLuceneQueryFactory() {
+    return new LuceneQueryFactoryImpl(cache);
+  }
+
+  @Override
+  public XmlGenerator<Cache> getXmlGenerator() {
+    return new LuceneServiceXmlGenerator();
+  }
+
+  @Override
+  public void beforeCreate(Extensible<Cache> source, Cache cache) {
+    // Nothing to do here.
+  }
+
+  @Override
+  public void onCreate(Extensible<Cache> source, Extensible<Cache> target) {
+    //This is called when CacheCreation (source) is turned into a GemfireCacheImpl (target)
+    //nothing to do there.
+  }
+
+  public void registerIndex(LuceneIndex index){
+    String regionAndIndex = getUniqueIndexName(index.getName(), index.getRegionPath()); 
+    if( !indexMap.containsKey( regionAndIndex )) {
+      indexMap.put(regionAndIndex, index);
+    }
+    definedIndexMap.remove(regionAndIndex);
+  }
+
+  public void unregisterIndex(final String region){
+    if( indexMap.containsKey( region )) indexMap.remove( region );
+  }
+
+  /**Public for test purposes */
+  public static void registerDataSerializables() {
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_CHUNK_KEY,
+        ChunkKey.class);
+    
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_FILE,
+        File.class);
+    
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_FUNCTION_CONTEXT,
+        LuceneFunctionContext.class);
+    
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_STRING_QUERY_PROVIDER,
+        StringQueryProvider.class);
+    
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_TOP_ENTRIES_COLLECTOR_MANAGER,
+        TopEntriesCollectorManager.class);
+    
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_ENTRY_SCORE,
+        EntryScore.class);
+    
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_TOP_ENTRIES,
+        TopEntries.class);
+
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.LUCENE_TOP_ENTRIES_COLLECTOR,
+        TopEntriesCollector.class);
+  }
+
+  public Collection<LuceneIndexCreationProfile> getAllDefinedIndexes() {
+    return definedIndexMap.values();
+  }
+
+  public LuceneIndexCreationProfile getDefinedIndex(String indexName, String regionPath) {
+    return definedIndexMap.get(getUniqueIndexName(indexName , regionPath));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PageableLuceneQueryResultsImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
new file mode 100644
index 0000000..1563df0
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
@@ -0,0 +1,147 @@
+/*
+ * 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.lucene.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
+import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore;
+
+/**
+ * Implementation of PageableLuceneQueryResults that fetchs a page at a time
+ * from the server, given a set of EntryScores (key and score).
+ *
+ * @param <K> The type of the key
+ * @param <V> The type of the value
+ */
+public class PageableLuceneQueryResultsImpl<K,V> implements PageableLuceneQueryResults<K,V> {
+
+  /**
+   *  list of docs matching search query
+   */
+  private final List<EntryScore<K>> hits;
+
+  /**
+   * * Current page of results
+   */
+  private List<LuceneResultStruct<K,V>> currentPage;
+  /**
+   * The maximum score. Lazily evaluated
+   */
+  private float maxScore = Float.MIN_VALUE;
+  
+  /**
+   * The user region where values are stored.
+   */
+  private final Region<K, V> userRegion;
+  
+  /**
+   * The start of the next page of results we want to fetch 
+   */
+  private int currentHit = 0;
+  
+  /**
+   * The page size the user wants.
+   */
+  private int pageSize;
+  
+  public PageableLuceneQueryResultsImpl(List<EntryScore<K>> hits, Region<K,V> userRegion, int pageSize) {
+    this.hits = hits;
+    this.userRegion = userRegion;
+    this.pageSize = pageSize == 0 ? Integer.MAX_VALUE : pageSize;
+  }
+
+
+  public List<LuceneResultStruct<K,V>> getHitEntries(int fromIndex, int toIndex) {
+    List<EntryScore<K>> scores = hits.subList(fromIndex, toIndex);
+    ArrayList<K> keys = new ArrayList<K>(scores.size());
+    for(EntryScore<K> score : scores) {
+      keys.add(score.getKey());
+    }
+
+    Map<K,V> values = userRegion.getAll(keys);
+
+    ArrayList<LuceneResultStruct<K,V>> results = new ArrayList<LuceneResultStruct<K,V>>(scores.size());
+    for(EntryScore<K> score : scores) {
+      V value = values.get(score.getKey());
+      if (value!=null)
+        results.add(new LuceneResultStructImpl(score.getKey(), value, score.getScore()));
+    }
+    return results;
+  }
+
+  @Override
+  public List<LuceneResultStruct<K,V>> next() {
+    if(!hasNext()) {
+      throw new NoSuchElementException();
+    }
+    List<LuceneResultStruct<K,V>> result = advancePage();
+    currentPage = null;
+    return result;
+  }
+
+  private List<LuceneResultStruct<K, V>> advancePage() {
+    if(currentPage != null) {
+      return currentPage;
+    }
+
+    int resultSize = (pageSize != Integer.MAX_VALUE) ? pageSize : hits.size();
+    currentPage = new ArrayList<LuceneResultStruct<K,V>>(resultSize);
+    while (currentPage.size()<pageSize && currentHit < hits.size()) {
+      int end = currentHit + pageSize - currentPage.size();
+      end = end > hits.size() ? hits.size() : end;
+      currentPage.addAll(getHitEntries(currentHit, end));
+      currentHit = end;
+    }
+    return currentPage;
+  }
+
+  @Override
+  public boolean hasNext() {
+
+    advancePage();
+    if ( currentPage.isEmpty() ) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public int size() {
+    return hits.size();
+  }
+
+  @Override
+  public float getMaxScore() {
+    if(maxScore == Float.MIN_VALUE) {
+      for(EntryScore<K> score : hits) {
+        maxScore = Math.max(maxScore, score.getScore());
+      }
+    }
+    
+    return maxScore;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
new file mode 100644
index 0000000..d5dd7b1
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/PartitionedRepositoryManager.java
@@ -0,0 +1,50 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.IOException;
+
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+
+/**
+ * Manages index repositories for partitioned regions.
+ * 
+ * This class lazily creates the IndexRepository for each individual
+ * bucket. If a Bucket is rebalanced, this class will create a new
+ * index repository when the bucket returns to this node.
+ */
+public class PartitionedRepositoryManager extends AbstractPartitionedRepositoryManager {
+
+  public static IndexRepositoryFactory indexRepositoryFactory = new IndexRepositoryFactory();
+
+  public PartitionedRepositoryManager(LuceneIndexImpl index,
+      LuceneSerializer serializer) {
+    super(index, serializer);
+  }
+
+  @Override
+  public IndexRepository createOneIndexRepository(Integer bucketId,
+      LuceneSerializer serializer, LuceneIndexImpl index,
+      PartitionedRegion userRegion) throws IOException {
+    return indexRepositoryFactory.createIndexRepository(bucketId, serializer, index, userRegion);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
new file mode 100755
index 0000000..131e297
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawIndexRepositoryFactory.java
@@ -0,0 +1,63 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.NIOFSDirectory;
+import org.apache.lucene.store.RAMDirectory;
+
+import com.gemstone.gemfire.cache.lucene.internal.directory.RegionDirectory;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepositoryImpl;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import com.gemstone.gemfire.internal.cache.BucketRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+
+public class RawIndexRepositoryFactory extends IndexRepositoryFactory {
+  public RawIndexRepositoryFactory() {
+  }
+
+  public IndexRepository createIndexRepository(final Integer bucketId,
+                                        LuceneSerializer serializer,
+                                        LuceneIndexImpl index, PartitionedRegion userRegion)
+    throws IOException
+  {
+    final IndexRepository repo;
+    LuceneRawIndex indexForRaw = (LuceneRawIndex)index;
+    BucketRegion dataBucket = getMatchingBucket(userRegion, bucketId);
+
+    Directory dir = null;
+    if (indexForRaw.withPersistence()) {
+      String bucketLocation = LuceneServiceImpl.getUniqueIndexName(index.getName(), index.getRegionPath()+"_"+bucketId);
+      File location = new File(index.getName(), bucketLocation);
+      if (!location.exists()) {
+        location.mkdirs();
+      }
+      dir = new NIOFSDirectory(location.toPath());
+    } else {
+      dir = new RAMDirectory();
+    }
+    IndexWriterConfig config = new IndexWriterConfig(indexForRaw.getAnalyzer());
+    IndexWriter writer = new IndexWriter(dir, config);
+    return new IndexRepositoryImpl(null, writer, serializer, indexForRaw.getIndexStats(), dataBucket);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
new file mode 100755
index 0000000..234245e
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManager.java
@@ -0,0 +1,46 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.IOException;
+
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+
+public class RawLuceneRepositoryManager extends AbstractPartitionedRepositoryManager {
+  public static IndexRepositoryFactory indexRepositoryFactory = new RawIndexRepositoryFactory();
+  
+  public RawLuceneRepositoryManager(LuceneIndexImpl index,
+      LuceneSerializer serializer) {
+    super(index, serializer);
+  }
+  
+  public void close() {
+    for (IndexRepository repo:indexRepositories.values()) {
+      repo.cleanup();
+    }
+  }
+
+  @Override
+  public IndexRepository createOneIndexRepository(Integer bucketId,
+      LuceneSerializer serializer, LuceneIndexImpl index,
+      PartitionedRegion userRegion) throws IOException {
+    return indexRepositoryFactory.createIndexRepository(bucketId, serializer, index, userRegion);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/StringQueryProvider.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/StringQueryProvider.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/StringQueryProvider.java
new file mode 100644
index 0000000..c5d145e
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/StringQueryProvider.java
@@ -0,0 +1,116 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
+import org.apache.lucene.queryparser.flexible.standard.StandardQueryParser;
+import org.apache.lucene.search.Query;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.GemFireCheckedException;
+import com.gemstone.gemfire.GemFireException;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
+import com.gemstone.gemfire.cache.query.QueryException;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * Constructs a Lucene Query object by parsing a search string. The class uses {@link StandardQueryParser}. It sets
+ * searchable fields in a {@link LuceneIndex} as default fields.
+ */
+public class StringQueryProvider implements LuceneQueryProvider, DataSerializableFixedID {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Logger logger = LogService.getLogger();
+
+  // the following members hold input data and needs to be sent on wire
+  private String query;
+
+  // the following members hold derived objects and need not be serialized
+  private transient Query luceneQuery;
+
+  private String defaultField;
+
+  public StringQueryProvider() {
+    this(null, null);
+  }
+
+  public StringQueryProvider(String query, String defaultField) {
+    this.query = query;
+    this.defaultField = defaultField;
+  }
+
+  @Override
+  public synchronized Query getQuery(LuceneIndex index) throws LuceneQueryException {
+    if (luceneQuery == null) {
+      String[] fields = index.getFieldNames();
+      LuceneIndexImpl indexImpl = (LuceneIndexImpl) index;
+      StandardQueryParser parser = new StandardQueryParser(indexImpl.getAnalyzer());
+      try {
+        luceneQuery = parser.parse(query, defaultField);
+        if (logger.isDebugEnabled()) {
+          logger.debug("User query " + query + " is parsed to be: " + luceneQuery);
+        }
+      } catch (QueryNodeException e) {
+        logger.debug("Query node exception:" + query, e);
+        throw new LuceneQueryException("Malformed lucene query: " + query, e);
+      }
+    }
+    return luceneQuery;
+  }
+
+  /**
+   * @return the query string used to construct this query provider
+   */
+  public String getQueryString() {
+    return query;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_STRING_QUERY_PROVIDER;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeString(query, out);
+    DataSerializer.writeString(defaultField, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    query = DataSerializer.readString(in);
+    defaultField = DataSerializer.readString(in);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneCliStrings.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneCliStrings.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneCliStrings.java
new file mode 100644
index 0000000..b424d8f
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneCliStrings.java
@@ -0,0 +1,79 @@
+/*
+ * 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.lucene.internal.cli;
+
+public class LuceneCliStrings {
+  //Common parameters/options
+  public static final String LUCENE__INDEX_NAME = "name";
+  public static final String LUCENE__REGION_PATH = "region";
+
+  //List lucene index commands
+  public static final String LUCENE_LIST_INDEX = "list lucene indexes";
+  public static final String LUCENE_LIST_INDEX__HELP = "Display the list of lucene indexes created for all members.";
+  public static final String LUCENE_LIST_INDEX__ERROR_MESSAGE = "An error occurred while collecting all lucene index information across the Geode cluster: %1$s";
+  public static final String LUCENE_LIST_INDEX__INDEXES_NOT_FOUND_MESSAGE = "No lucene indexes found";
+  public static final String LUCENE_LIST_INDEX__STATS = "with-stats";
+  public static final String LUCENE_LIST_INDEX__STATS__HELP = "Display lucene index stats";
+
+  //Create lucene index commands 
+  public static final String LUCENE_CREATE_INDEX = "create lucene index";
+  public static final String LUCENE_CREATE_INDEX__HELP = "Create a lucene index that can be used to execute queries.";
+  public static final String LUCENE_CREATE_INDEX__NAME__HELP = "Name of the lucene index to create.";
+  public static final String LUCENE_CREATE_INDEX__REGION_HELP = "Name/Path of the region where the lucene index is created on.";
+  public static final String LUCENE_CREATE_INDEX__FIELD = "field";
+  public static final String LUCENE_CREATE_INDEX__FIELD_HELP = "fields on the region values which are stored in the lucene index.";
+  public static final String LUCENE_CREATE_INDEX__ANALYZER = "analyzer";
+  public static final String LUCENE_CREATE_INDEX__ANALYZER_HELP = "Type of the analyzer for each field.";
+  public static final String LUCENE_CREATE_INDEX__GROUP = "group";
+  public static final String LUCENE_CREATE_INDEX__GROUP__HELP = "Group of members in which the lucene index will be created.";
+  public static final String CREATE_INDEX__SUCCESS__MSG = "Index successfully created with following details";
+  public static final String CREATE_INDEX__FAILURE__MSG = "Failed to create index \"{0}\" due to following reasons";
+  public static final String CREATE_INDEX__NAME__MSG = "Name       : {0}";
+  public static final String CREATE_INDEX__REGIONPATH__MSG = "RegionPath : {0}";
+  public static final String CREATE_INDEX__MEMBER__MSG = "Members which contain the index";
+  public static final String CREATE_INDEX__NUMBER__AND__MEMBER = "{0}. {1}";
+  public static final String CREATE_INDEX__EXCEPTION__OCCURRED__ON = "Occurred on following members";
+  
+  //Describe lucene index commands
+  public static final String LUCENE_DESCRIBE_INDEX = "describe lucene index";
+  public static final String LUCENE_DESCRIBE_INDEX__HELP = "Display the describe of lucene indexes created for all members.";
+  public static final String LUCENE_DESCRIBE_INDEX__ERROR_MESSAGE = "An error occurred while collecting lucene index information across the Geode cluster: %1$s";
+  public static final String LUCENE_DESCRIBE_INDEX__NAME__HELP = "Name of the lucene index to describe.";
+  public static final String LUCENE_DESCRIBE_INDEX__REGION_HELP = "Name/Path of the region where the lucene index to be described exists.";
+
+  
+  //Search lucene index commands
+  public static final String LUCENE_SEARCH_INDEX = "search lucene";
+  public static final String LUCENE_SEARCH_INDEX__HELP = "Search lucene index";
+  public static final String LUCENE_SEARCH_INDEX__ERROR_MESSAGE = "An error occurred while searching lucene index across the Geode cluster: %1$s";
+  public static final String LUCENE_SEARCH_INDEX__NAME__HELP = "Name of the lucene index to search.";
+  public static final String LUCENE_SEARCH_INDEX__REGION_HELP = "Name/Path of the region where the lucene index exists.";
+  public static final String LUCENE_SEARCH_INDEX__QUERY_STRING="queryStrings";
+  public static final String LUCENE_SEARCH_INDEX__LIMIT="limit";
+  public static final String LUCENE_SEARCH_INDEX__LIMIT__HELP="Number of search results needed";
+  public static final String LUCENE_SEARCH_INDEX__QUERY_STRING__HELP="Query string to search the lucene index";
+  public static final String LUCENE_SEARCH_INDEX__DEFAULT_FIELD="defaultField";
+  public static final String LUCENE_SEARCH_INDEX__DEFAULT_FIELD__HELP="Default field to search in";
+  public static final String LUCENE_SEARCH_INDEX__NO_RESULTS_MESSAGE="No results";
+  public static final String LUCENE_SEARCH_INDEX__PAGE_SIZE="pageSize";
+  public static final String LUCENE_SEARCH_INDEX__PAGE_SIZE__HELP="Number of results to be returned in a page";
+  public static final String LUCENE_SEARCH_INDEX__KEYSONLY="keys-only";
+  public static final String LUCENE_SEARCH_INDEX__KEYSONLY__HELP="Return only keys of search results.";
+
+}


[19/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
new file mode 100644
index 0000000..6727f1b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
@@ -0,0 +1,3765 @@
+/*
+ * 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.internal.cache.wan;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.CacheTransactionManager;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.client.internal.LocatorDiscoveryCallbackAdapter;
+import com.gemstone.gemfire.cache.client.internal.locator.wan.LocatorMembershipListener;
+import com.gemstone.gemfire.cache.persistence.PartitionOfflineException;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewayQueueEvent;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
+import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.ServerLocation;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.FileUtil;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+import com.gemstone.gemfire.internal.cache.BucketRegion;
+import com.gemstone.gemfire.internal.cache.CacheConfig;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
+import com.gemstone.gemfire.internal.cache.CustomerIDPartitionResolver;
+import com.gemstone.gemfire.internal.cache.ForceReattemptException;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.execute.data.CustId;
+import com.gemstone.gemfire.internal.cache.execute.data.Customer;
+import com.gemstone.gemfire.internal.cache.execute.data.Order;
+import com.gemstone.gemfire.internal.cache.execute.data.OrderId;
+import com.gemstone.gemfire.internal.cache.execute.data.Shipment;
+import com.gemstone.gemfire.internal.cache.execute.data.ShipmentId;
+import com.gemstone.gemfire.internal.cache.partitioned.PRLocallyDestroyedException;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerStats;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderEventProcessor;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQueue;
+import com.gemstone.gemfire.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor;
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderQueue;
+import com.gemstone.gemfire.pdx.SimpleClass;
+import com.gemstone.gemfire.pdx.SimpleClass1;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+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;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.util.test.TestUtil;
+
+@Category(DistributedTest.class)
+public class WANTestBase extends JUnit4DistributedTestCase {
+
+  protected static Cache cache;
+  protected static Region region;
+
+  protected static PartitionedRegion customerRegion;
+  protected static PartitionedRegion orderRegion;
+  protected static PartitionedRegion shipmentRegion;
+
+  protected static final String customerRegionName = "CUSTOMER";
+  protected static final String orderRegionName = "ORDER";
+  protected static final String shipmentRegionName = "SHIPMENT";
+
+  protected static VM vm0;
+  protected static VM vm1;
+  protected static VM vm2;
+  protected static VM vm3;
+  protected static VM vm4;
+  protected static VM vm5;
+  protected static VM vm6;
+  protected static VM vm7;
+
+  protected static QueueListener listener1;
+  protected static QueueListener listener2;
+
+  protected static AsyncEventListener eventListener1 ;
+  protected static AsyncEventListener eventListener2 ;
+
+  private static final long MAX_WAIT = 10000;
+
+  protected static GatewayEventFilter eventFilter;
+
+  protected static List<Integer> dispatcherThreads =
+	  new ArrayList<Integer>(Arrays.asList(1, 3, 5));
+  //this will be set for each test method run with one of the values from above list
+  protected static int numDispatcherThreadsForTheRun = 1;
+
+  public WANTestBase() {
+    super();
+  }
+
+  /**
+   * @deprecated Use the no arg constructor, or better yet, don't construct this class
+   */
+  @Deprecated
+  public WANTestBase(final String ignored) {
+  }
+
+  @Override
+  public final void preSetUp() throws Exception {
+    final Host host = Host.getHost(0);
+    vm0 = host.getVM(0);
+    vm1 = host.getVM(1);
+    vm2 = host.getVM(2);
+    vm3 = host.getVM(3);
+    vm4 = host.getVM(4);
+    vm5 = host.getVM(5);
+    vm6 = host.getVM(6);
+    vm7 = host.getVM(7);
+    //Need to set the test name after the VMs are created
+  }
+
+  @Override
+  public final void postSetUp() throws Exception {
+    //this is done to vary the number of dispatchers for sender
+    //during every test method run
+    shuffleNumDispatcherThreads();
+    Invoke.invokeInEveryVM(() -> setNumDispatcherThreadsForTheRun(dispatcherThreads.get(0)));
+    IgnoredException.addIgnoredException("Connection refused");
+    IgnoredException.addIgnoredException("Software caused connection abort");
+    IgnoredException.addIgnoredException("Connection reset");
+    postSetUpWANTestBase();
+  }
+
+  protected void postSetUpWANTestBase() throws Exception {
+  }
+
+  public static void shuffleNumDispatcherThreads() {
+	  Collections.shuffle(dispatcherThreads);
+  }
+
+  public static void setNumDispatcherThreadsForTheRun(int numThreads) {
+	  numDispatcherThreadsForTheRun = numThreads;
+  }
+
+  public static void stopOldLocator() {
+    if (Locator.hasLocator()) {
+      Locator.getLocator().stop();
+    }
+  }
+
+  public static void createLocator(int dsId, int port, Set<String> localLocatorsList, Set<String> remoteLocatorsList){
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    StringBuffer localLocatorBuffer = new StringBuffer(localLocatorsList.toString());
+    localLocatorBuffer.deleteCharAt(0);
+    localLocatorBuffer.deleteCharAt(localLocatorBuffer.lastIndexOf("]"));
+    String localLocator = localLocatorBuffer.toString();
+    localLocator = localLocator.replace(" ", "");
+
+    props.setProperty(LOCATORS, localLocator);
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    StringBuffer remoteLocatorBuffer = new StringBuffer(remoteLocatorsList.toString());
+    remoteLocatorBuffer.deleteCharAt(0);
+    remoteLocatorBuffer.deleteCharAt(remoteLocatorBuffer.lastIndexOf("]"));
+    String remoteLocator = remoteLocatorBuffer.toString();
+    remoteLocator = remoteLocator.replace(" ", "");
+    props.setProperty(REMOTE_LOCATORS, remoteLocator);
+    test.getSystem(props);
+  }
+
+  public static Integer createFirstLocatorWithDSId(int dsId) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static Integer createFirstPeerLocator(int dsId) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static Integer createSecondLocator(int dsId, int locatorPort) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static Integer createSecondPeerLocator(int dsId, int locatorPort) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static void bringBackLocatorOnOldPort(int dsId, int remoteLocPort, int oldPort) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.put(LOG_LEVEL, "fine");
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + oldPort + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + oldPort + "],server=true,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    test.getSystem(props);
+  }
+
+
+  public static Integer createFirstRemotePeerLocator(int dsId, int remoteLocPort) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static Integer createSecondRemoteLocator(int dsId, int localPort,
+      int remoteLocPort) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + localPort + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static Integer createSecondRemoteLocatorWithAPI(int dsId, int localPort,
+                                                  int remoteLocPort, String hostnameForClients)
+    throws IOException
+  {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + localPort + "]");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    Locator locator = Locator.startLocatorAndDS(0, null, InetAddress.getByName("localhost"), props, true, true, hostnameForClients);
+    return locator.getPort();
+  }
+
+  public static Integer createSecondRemotePeerLocator(int dsId, int localPort,
+      int remoteLocPort) {
+    stopOldLocator();
+    WANTestBase test = new WANTestBase();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + localPort + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    test.getSystem(props);
+    return port;
+  }
+
+  public static int createReceiverInSecuredCache() {
+    GatewayReceiverFactory fact = WANTestBase.cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start GatewayReceiver on port " + port, e);
+    }
+    return port;
+  }
+
+  public static void createReplicatedRegion(String regionName, String senderIds, Boolean offHeap){
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class
+        .getName());
+    IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class
+        .getName());
+    try {
+      AttributesFactory fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      fact.setDataPolicy(DataPolicy.REPLICATE);
+      fact.setScope(Scope.DISTRIBUTED_ACK);
+      fact.setOffHeap(offHeap);
+      Region r = cache.createRegionFactory(fact.create()).create(regionName);
+      assertNotNull(r);
+    } finally {
+      exp.remove();
+      exp1.remove();
+      exp2.remove();
+    }
+  }
+
+  public static void createNormalRegion(String regionName, String senderIds){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    fact.setDataPolicy(DataPolicy.NORMAL);
+    fact.setScope(Scope.DISTRIBUTED_ACK);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void createPersistentReplicatedRegion(String regionName, String senderIds, Boolean offHeap){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    fact.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
+    fact.setOffHeap(offHeap);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void createReplicatedRegionWithAsyncEventQueue(
+      String regionName, String asyncQueueIds, Boolean offHeap) {
+    IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    try {
+      AttributesFactory fact = new AttributesFactory();
+      if (asyncQueueIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(asyncQueueIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String asyncQueueId = tokenizer.nextToken();
+          fact.addAsyncEventQueueId(asyncQueueId);
+        }
+      }
+      fact.setDataPolicy(DataPolicy.REPLICATE);
+      fact.setOffHeap(offHeap);
+      RegionFactory regionFactory = cache.createRegionFactory(fact.create());
+      Region r = regionFactory.create(regionName);
+      assertNotNull(r);
+    } finally {
+      exp1.remove();
+    }
+  }
+
+  public static void createReplicatedRegionWithSenderAndAsyncEventQueue(
+      String regionName, String senderIds, String asyncChannelId, Boolean offHeap) {
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    try {
+      AttributesFactory fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      fact.setDataPolicy(DataPolicy.REPLICATE);
+      fact.setScope(Scope.DISTRIBUTED_ACK);
+      fact.setOffHeap(offHeap);
+      RegionFactory regionFactory = cache.createRegionFactory(fact.create());
+      regionFactory.addAsyncEventQueueId(asyncChannelId);
+      Region r = regionFactory.create(regionName);
+      assertNotNull(r);
+    } finally {
+      exp.remove();
+    }
+  }
+
+  public static void createReplicatedRegion(String regionName, String senderIds, Scope scope, DataPolicy policy, Boolean offHeap){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    fact.setDataPolicy(policy);
+    fact.setScope(scope);
+    fact.setOffHeap(offHeap);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void createAsyncEventQueue(
+      String asyncChannelId, boolean isParallel,
+      Integer maxMemory, Integer batchSize, boolean isConflation,
+      boolean isPersistent, String diskStoreName, boolean isDiskSynchronous) {
+
+    if (diskStoreName != null) {
+      File directory = new File(asyncChannelId + "_disk_"
+          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+      directory.mkdir();
+      File[] dirs1 = new File[] { directory };
+      DiskStoreFactory dsf = cache.createDiskStoreFactory();
+      dsf.setDiskDirs(dirs1);
+      dsf.create(diskStoreName);
+    }
+
+    AsyncEventListener asyncEventListener = new MyAsyncEventListener();
+
+    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
+    factory.setBatchSize(batchSize);
+    factory.setPersistent(isPersistent);
+    factory.setDiskStoreName(diskStoreName);
+    factory.setDiskSynchronous(isDiskSynchronous);
+    factory.setBatchConflationEnabled(isConflation);
+    factory.setMaximumQueueMemory(maxMemory);
+    factory.setParallel(isParallel);
+    //set dispatcher threads
+    factory.setDispatcherThreads(numDispatcherThreadsForTheRun);
+    factory.create(asyncChannelId, asyncEventListener);
+  }
+
+  public static void createPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
+        .getName());
+    try {
+      AttributesFactory fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+      pfact.setTotalNumBuckets(totalNumBuckets);
+      pfact.setRedundantCopies(redundantCopies);
+      pfact.setRecoveryDelay(0);
+      fact.setPartitionAttributes(pfact.create());
+      fact.setOffHeap(offHeap);
+      Region r = cache.createRegionFactory(fact.create()).create(regionName);
+      assertNotNull(r);
+    } finally {
+      exp.remove();
+      exp1.remove();
+    }
+  }
+
+  // TODO:OFFHEAP: add offheap flavor
+  public static void createPartitionedRegionWithPersistence(String regionName,
+      String senderIds, Integer redundantCopies, Integer totalNumBuckets) {
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
+        .getName());
+    try {
+      AttributesFactory fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+      pfact.setTotalNumBuckets(totalNumBuckets);
+      pfact.setRedundantCopies(redundantCopies);
+      pfact.setRecoveryDelay(0);
+      fact.setPartitionAttributes(pfact.create());
+      fact.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+      Region r = cache.createRegionFactory(fact.create()).create(regionName);
+      assertNotNull(r);
+    } finally {
+      exp.remove();
+      exp1.remove();
+    }
+  }
+  public static void createColocatedPartitionedRegion(String regionName,
+	      String senderIds, Integer redundantCopies, Integer totalNumBuckets, String colocatedWith) {
+	IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+		.getName());
+	IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
+		.getName());
+	try {
+	  AttributesFactory fact = new AttributesFactory();
+	  if (senderIds != null) {
+		  StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+		  while (tokenizer.hasMoreTokens()) {
+			  String senderId = tokenizer.nextToken();
+			  fact.addGatewaySenderId(senderId);
+		  }
+	  }
+	  PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+	  pfact.setTotalNumBuckets(totalNumBuckets);
+	  pfact.setRedundantCopies(redundantCopies);
+	  pfact.setRecoveryDelay(0);
+	  pfact.setColocatedWith(colocatedWith);
+	  fact.setPartitionAttributes(pfact.create());
+	  Region r = cache.createRegionFactory(fact.create()).create(regionName);
+	  assertNotNull(r);
+	} finally {
+		exp.remove();
+		exp1.remove();
+	}
+  }
+
+  public static void addSenderThroughAttributesMutator(String regionName,
+      String senderIds){
+    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
+    assertNotNull(r);
+    AttributesMutator mutator = r.getAttributesMutator();
+    mutator.addGatewaySenderId(senderIds);
+  }
+
+  public static void addAsyncEventQueueThroughAttributesMutator(
+      String regionName, String queueId) {
+    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
+    assertNotNull(r);
+    AttributesMutator mutator = r.getAttributesMutator();
+    mutator.addAsyncEventQueueId(queueId);
+  }
+
+  public static void createPartitionedRegionAsAccessor(
+      String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+    pfact.setTotalNumBuckets(totalNumBuckets);
+    pfact.setRedundantCopies(redundantCopies);
+    pfact.setLocalMaxMemory(0);
+    fact.setPartitionAttributes(pfact.create());
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void createPartitionedRegionWithSerialParallelSenderIds(String regionName, String serialSenderIds, String parallelSenderIds, String colocatedWith, Boolean offHeap){
+    AttributesFactory fact = new AttributesFactory();
+    if (serialSenderIds != null) {
+      StringTokenizer tokenizer = new StringTokenizer(serialSenderIds, ",");
+      while (tokenizer.hasMoreTokens()) {
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    if (parallelSenderIds != null) {
+      StringTokenizer tokenizer = new StringTokenizer(parallelSenderIds, ",");
+      while (tokenizer.hasMoreTokens()) {
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+    pfact.setColocatedWith(colocatedWith);
+    fact.setPartitionAttributes(pfact.create());
+    fact.setOffHeap(offHeap);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+  }
+
+  public static void createPersistentPartitionedRegion(
+      String regionName,
+      String senderIds,
+      Integer redundantCopies,
+      Integer totalNumBuckets,
+      Boolean offHeap){
+
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
+        .getName());
+    try {
+
+      AttributesFactory fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+      pfact.setTotalNumBuckets(totalNumBuckets);
+      pfact.setRedundantCopies(redundantCopies);
+      fact.setPartitionAttributes(pfact.create());
+      fact.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+      fact.setOffHeap(offHeap);
+      Region r = cache.createRegionFactory(fact.create()).create(regionName);
+      assertNotNull(r);
+    } finally {
+      exp.remove();
+      exp1.remove();
+    }
+  }
+
+  public static void createCustomerOrderShipmentPartitionedRegion(
+      String senderIds, Integer redundantCopies,
+      Integer totalNumBuckets, Boolean offHeap) {
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    try {
+      AttributesFactory fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+
+      PartitionAttributesFactory paf = new PartitionAttributesFactory();
+      paf.setRedundantCopies(redundantCopies)
+          .setTotalNumBuckets(totalNumBuckets)
+          .setPartitionResolver(
+              new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
+      fact.setPartitionAttributes(paf.create());
+      fact.setOffHeap(offHeap);
+      customerRegion = (PartitionedRegion)cache.createRegionFactory(
+          fact.create()).create(customerRegionName);
+      assertNotNull(customerRegion);
+      LogWriterUtils.getLogWriter().info(
+          "Partitioned Region CUSTOMER created Successfully :"
+              + customerRegion.toString());
+
+      paf = new PartitionAttributesFactory();
+      paf.setRedundantCopies(redundantCopies)
+          .setTotalNumBuckets(totalNumBuckets)
+          .setColocatedWith(customerRegionName)
+          .setPartitionResolver(
+              new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
+      fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      fact.setPartitionAttributes(paf.create());
+      fact.setOffHeap(offHeap);
+      orderRegion = (PartitionedRegion)cache.createRegionFactory(fact.create())
+          .create(orderRegionName);
+      assertNotNull(orderRegion);
+      LogWriterUtils.getLogWriter().info(
+          "Partitioned Region ORDER created Successfully :"
+              + orderRegion.toString());
+
+      paf = new PartitionAttributesFactory();
+      paf.setRedundantCopies(redundantCopies)
+          .setTotalNumBuckets(totalNumBuckets)
+          .setColocatedWith(orderRegionName)
+          .setPartitionResolver(
+              new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
+      fact = new AttributesFactory();
+      if (senderIds != null) {
+        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+        while (tokenizer.hasMoreTokens()) {
+          String senderId = tokenizer.nextToken();
+          fact.addGatewaySenderId(senderId);
+        }
+      }
+      fact.setPartitionAttributes(paf.create());
+      fact.setOffHeap(offHeap);
+      shipmentRegion = (PartitionedRegion)cache.createRegionFactory(
+          fact.create()).create(shipmentRegionName);
+      assertNotNull(shipmentRegion);
+      LogWriterUtils.getLogWriter().info(
+          "Partitioned Region SHIPMENT created Successfully :"
+              + shipmentRegion.toString());
+    } finally {
+      exp.remove();
+    }
+  }
+
+  public static void createColocatedPartitionedRegions(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+    pfact.setTotalNumBuckets(totalNumBuckets);
+    pfact.setRedundantCopies(redundantCopies);
+    fact.setPartitionAttributes(pfact.create());
+    fact.setOffHeap(offHeap);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+
+    pfact.setColocatedWith(r.getName());
+    fact.setPartitionAttributes(pfact.create());
+    fact.setOffHeap(offHeap);
+    Region r1 = cache.createRegionFactory(fact.create()).create(regionName+"_child1");
+    assertNotNull(r1);
+
+    Region r2 = cache.createRegionFactory(fact.create()).create(regionName+"_child2");
+    assertNotNull(r2);
+  }
+
+  public static void createColocatedPartitionedRegions2 (String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
+    AttributesFactory fact = new AttributesFactory();
+    if(senderIds!= null){
+      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
+      while (tokenizer.hasMoreTokens()){
+        String senderId = tokenizer.nextToken();
+        fact.addGatewaySenderId(senderId);
+      }
+    }
+    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
+    pfact.setTotalNumBuckets(totalNumBuckets);
+    pfact.setRedundantCopies(redundantCopies);
+    fact.setPartitionAttributes(pfact.create());
+    fact.setOffHeap(offHeap);
+    Region r = cache.createRegionFactory(fact.create()).create(regionName);
+    assertNotNull(r);
+
+
+    fact = new AttributesFactory();
+    pfact.setColocatedWith(r.getName());
+    fact.setPartitionAttributes(pfact.create());
+    fact.setOffHeap(offHeap);
+    Region r1 = cache.createRegionFactory(fact.create()).create(regionName+"_child1");
+    assertNotNull(r1);
+
+    Region r2 = cache.createRegionFactory(fact.create()).create(regionName+"_child2");
+    assertNotNull(r2);
+  }
+
+  public static void createCacheInVMs(Integer locatorPort, VM... vms) {
+    for (VM vm : vms) {
+      vm.invoke(() -> createCache(locatorPort));
+    }
+  }
+
+  public static void addListenerToSleepAfterCreateEvent(int milliSeconds, final String regionName) {
+    cache.getRegion(regionName).getAttributesMutator()
+      .addCacheListener(new CacheListenerAdapter<Object, Object>() {
+        @Override
+        public void afterCreate(final EntryEvent<Object, Object> event) {
+          try {
+            Thread.sleep(milliSeconds);
+          }
+          catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+          }
+        }
+      });
+  }
+
+  private static CacheListener myListener;
+  public static void longPauseAfterNumEvents(int numEvents, int milliSeconds) {
+    myListener = new CacheListenerAdapter<Object, Object>() {
+      @Override
+      public void afterCreate(final EntryEvent<Object, Object> event) {
+        try {
+          if (event.getRegion().size() >= numEvents){
+            Thread.sleep(milliSeconds);
+          }
+        }
+        catch (InterruptedException e) {
+          Thread.currentThread().interrupt();
+        }
+      }
+    };
+    cache.getRegion(getTestMethodName() + "_RR_1").getAttributesMutator()
+      .addCacheListener(myListener);
+  }
+
+  public static void removeCacheListener() {
+    cache.getRegion(getTestMethodName() + "_RR_1").getAttributesMutator()
+      .removeCacheListener(myListener);
+
+  }
+
+
+  public static void createCache(Integer locPort){
+    createCache(false, locPort);
+  }
+  public static void createManagementCache(Integer locPort){
+    createCache(true, locPort);
+  }
+
+  public static void createCacheConserveSockets(Boolean conserveSockets,Integer locPort){
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    props.setProperty(CONSERVE_SOCKETS, conserveSockets.toString());
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  protected static void createCache(boolean management, Integer locPort) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    if (management) {
+      props.setProperty(JMX_MANAGER, "true");
+      props.setProperty(JMX_MANAGER_START, "false");
+      props.setProperty(JMX_MANAGER_PORT, "0");
+      props.setProperty(JMX_MANAGER_HTTP_PORT, "0");
+    }
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  protected static void createCacheWithSSL(Integer locPort) {
+    WANTestBase test = new WANTestBase();
+
+    boolean gatewaySslenabled = true;
+    String  gatewaySslprotocols = "any";
+    String  gatewaySslciphers = "any";
+    boolean gatewaySslRequireAuth = true;
+
+    Properties gemFireProps = test.getDistributedSystemProperties();
+    gemFireProps.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+    gemFireProps.put(GATEWAY_SSL_ENABLED, String.valueOf(gatewaySslenabled));
+    gemFireProps.put(GATEWAY_SSL_PROTOCOLS, gatewaySslprotocols);
+    gemFireProps.put(GATEWAY_SSL_CIPHERS, gatewaySslciphers);
+    gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, String.valueOf(gatewaySslRequireAuth));
+
+    gemFireProps.put(GATEWAY_SSL_KEYSTORE_TYPE, "jks");
+    gemFireProps.put(GATEWAY_SSL_KEYSTORE,
+        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/client.keystore"));
+    gemFireProps.put(GATEWAY_SSL_KEYSTORE_PASSWORD, "password");
+    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE,
+        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/client.truststore"));
+    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE_PASSWORD, "password");
+
+    gemFireProps.setProperty(MCAST_PORT, "0");
+    gemFireProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
+
+    LogWriterUtils.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps);
+
+    InternalDistributedSystem ds = test.getSystem(gemFireProps);
+    cache = CacheFactory.create(ds);
+  }
+
+  public static void createCache_PDX(Integer locPort){
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    CacheConfig cacheConfig = new CacheConfig();
+    cacheConfig.setPdxPersistent(true);
+    cacheConfig.setPdxDiskStore("PDX_TEST");
+    cache = GemFireCacheImpl.create(ds, false, cacheConfig);
+
+    File pdxDir = new File(CacheTestCase.getDiskDir(), "pdx");
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File [] dirs1 = new File[] {pdxDir};
+    dsf.setDiskDirs(dirs1).setMaxOplogSize(1).create("PDX_TEST");
+  }
+
+  public static void createCache(Integer locPort1, Integer locPort2){
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort1
+        + "],localhost[" + locPort2 + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  public static void createCacheWithoutLocator(Integer mCastPort){
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "" + mCastPort);
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  /**
+   * Method that creates a bridge server
+   *
+   * @return    Integer   Port on which the server is started.
+   */
+  public static Integer createCacheServer() {
+    CacheServer server1 = cache.addCacheServer();
+    assertNotNull(server1);
+    server1.setPort(0);
+    try {
+      server1.start();
+    }
+    catch (IOException e) {
+      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start the Server", e);
+    }
+    assertTrue(server1.isRunning());
+
+    return new Integer(server1.getPort());
+  }
+
+  /**
+   * Returns a Map that contains the count for number of bridge server and number
+   * of Receivers.
+   *
+   * @return    Map
+   */
+  public static Map getCacheServers() {
+    List cacheServers = cache.getCacheServers();
+
+    Map cacheServersMap = new HashMap();
+    Iterator itr = cacheServers.iterator();
+    int bridgeServerCounter = 0;
+    int receiverServerCounter = 0;
+    while (itr.hasNext()) {
+      CacheServerImpl cacheServer = (CacheServerImpl) itr.next();
+      if (cacheServer.getAcceptor().isGatewayReceiver()) {
+        receiverServerCounter++;
+      } else {
+        bridgeServerCounter++;
+      }
+    }
+    cacheServersMap.put("BridgeServer", bridgeServerCounter);
+    cacheServersMap.put("ReceiverServer", receiverServerCounter);
+    return cacheServersMap;
+  }
+
+  public static void startSenderInVMs(String senderId, VM... vms) {
+    for (VM vm : vms) {
+      vm.invoke(() -> startSender(senderId));
+    }
+  }
+
+  public static void startSenderInVMsAsync(String senderId, VM... vms) {
+    List<AsyncInvocation> tasks = new LinkedList<>();
+    for (VM vm : vms) {
+      tasks.add(vm.invokeAsync(() -> startSender(senderId)));
+    }
+    for (AsyncInvocation invocation : tasks) {
+      try {
+        invocation.join(30000); // TODO: these might be AsyncInvocation orphans
+      }
+      catch (InterruptedException e) {
+        fail("Starting senders was interrupted");
+      }
+    }
+  }
+
+
+  public static void startSender(String senderId) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class
+        .getName());
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      GatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = s;
+          break;
+        }
+      }
+      sender.start();
+    } finally {
+      exp.remove();
+      exp1.remove();
+      exln.remove();
+    }
+
+  }
+
+  public static void enableConflation(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    sender.test_setBatchConflationEnabled(true);
+  }
+
+  public static Map getSenderToReceiverConnectionInfo(String senderId){
+	  Set<GatewaySender> senders = cache.getGatewaySenders();
+	  GatewaySender sender = null;
+	  for(GatewaySender s : senders){
+		  if(s.getId().equals(senderId)){
+			  sender = s;
+			  break;
+	      }
+	  }
+	  Map connectionInfo = null;
+	  if (!sender.isParallel() && ((AbstractGatewaySender) sender).isPrimary()) {
+		  connectionInfo = new HashMap();
+		  GatewaySenderEventDispatcher dispatcher =
+			  ((AbstractGatewaySender)sender).getEventProcessor().getDispatcher();
+		  if (dispatcher instanceof GatewaySenderEventRemoteDispatcher) {
+			  ServerLocation serverLocation =
+				  ((GatewaySenderEventRemoteDispatcher) dispatcher).getConnection(false).getServer();
+			  connectionInfo.put("serverHost", serverLocation.getHostName());
+			  connectionInfo.put("serverPort", serverLocation.getPort());
+
+		  }
+	  }
+	  return connectionInfo;
+  }
+  public static List<Integer> getSenderStats(String senderId, final int expectedQueueSize){
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = sender.getStatistics();
+    if (expectedQueueSize != -1) {
+      final RegionQueue regionQueue;
+      regionQueue = sender.getQueues().toArray(
+          new RegionQueue[1])[0];
+      Awaitility.await().atMost(120,TimeUnit.SECONDS).until(() -> assertEquals("Expected queue entries: " +
+        expectedQueueSize + " but actual entries: " + regionQueue.size(), expectedQueueSize,regionQueue.size()));
+    }
+    ArrayList<Integer> stats = new ArrayList<Integer>();
+    stats.add(statistics.getEventQueueSize());
+    stats.add(statistics.getEventsReceived());
+    stats.add(statistics.getEventsQueued());
+    stats.add(statistics.getEventsDistributed());
+    stats.add(statistics.getBatchesDistributed());
+    stats.add(statistics.getBatchesRedistributed());
+    stats.add(statistics.getEventsFiltered());
+    stats.add(statistics.getEventsNotQueuedConflated());
+    stats.add(statistics.getEventsConflatedFromBatches());
+    return stats;
+  }
+
+  public static void checkQueueStats(String senderId, final int queueSize,
+      final int eventsReceived, final int eventsQueued,
+      final int eventsDistributed) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender).getStatistics();
+    assertEquals(queueSize, statistics.getEventQueueSize());
+    assertEquals(eventsReceived, statistics.getEventsReceived());
+    assertEquals(eventsQueued, statistics.getEventsQueued());
+    assert(statistics.getEventsDistributed() >= eventsDistributed);
+  }
+
+  public static void checkGatewayReceiverStats(int processBatches,
+      int eventsReceived, int creates) {
+    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
+    GatewayReceiver receiver = gatewayReceivers.iterator().next();
+    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
+        .getAcceptor().getStats();
+
+    assertTrue(stats instanceof GatewayReceiverStats);
+    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
+    assertTrue(gatewayReceiverStats.getProcessBatchRequests() >= processBatches);
+    assertEquals(eventsReceived, gatewayReceiverStats.getEventsReceived());
+    assertEquals(creates, gatewayReceiverStats.getCreateRequest());
+  }
+
+  public static void checkMinimumGatewayReceiverStats(int processBatches,
+      int eventsReceived) {
+    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
+    GatewayReceiver receiver = gatewayReceivers.iterator().next();
+    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
+        .getAcceptor().getStats();
+
+    assertTrue(stats instanceof GatewayReceiverStats);
+    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
+    assertTrue(gatewayReceiverStats.getProcessBatchRequests() >= processBatches);
+    assertTrue(gatewayReceiverStats.getEventsReceived()>= eventsReceived);
+  }
+
+  public static void checkExceptionStats(int exceptionsOccurred) {
+    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
+    GatewayReceiver receiver = gatewayReceivers.iterator().next();
+    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
+        .getAcceptor().getStats();
+
+    assertTrue(stats instanceof GatewayReceiverStats);
+    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
+    if (exceptionsOccurred == 0) {
+      assertEquals(exceptionsOccurred, gatewayReceiverStats
+          .getExceptionsOccured());
+    }
+    else {
+      assertTrue(gatewayReceiverStats.getExceptionsOccured() >= exceptionsOccurred);
+    }
+  }
+
+  public static void checkGatewayReceiverStatsHA(int processBatches,
+      int eventsReceived, int creates) {
+    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
+    GatewayReceiver receiver = gatewayReceivers.iterator().next();
+    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
+        .getAcceptor().getStats();
+
+    assertTrue(stats instanceof GatewayReceiverStats);
+    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
+    assertTrue(gatewayReceiverStats.getProcessBatchRequests() >= processBatches);
+    assertTrue(gatewayReceiverStats.getEventsReceived() >= eventsReceived);
+    assertTrue(gatewayReceiverStats.getCreateRequest() >= creates);
+  }
+
+  public static void checkEventFilteredStats(String senderId, final int eventsFiltered) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender).getStatistics();
+    assertEquals(eventsFiltered, statistics.getEventsFiltered());
+  }
+
+  public static void checkConflatedStats(String senderId, final int eventsConflated) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender).getStatistics();
+    assertEquals(eventsConflated, statistics.getEventsNotQueuedConflated());
+  }
+
+  public static void checkStats_Failover(String senderId,
+      final int eventsReceived) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
+        .getStatistics();
+
+    assertEquals(eventsReceived, statistics.getEventsReceived());
+    assertEquals(eventsReceived, (statistics.getEventsQueued()
+        + statistics.getUnprocessedTokensAddedByPrimary() + statistics
+        .getUnprocessedEventsRemovedByPrimary()));
+  }
+
+  public static void checkBatchStats(String senderId, final int batches) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
+        .getStatistics();
+    assert (statistics.getBatchesDistributed() >= batches);
+    assertEquals(0, statistics.getBatchesRedistributed());
+  }
+
+  public static void checkBatchStats(String senderId,
+      final boolean batchesDistributed, final boolean batchesRedistributed) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
+        .getStatistics();
+    assertEquals(batchesDistributed, (statistics.getBatchesDistributed() > 0));
+    assertEquals(batchesRedistributed,
+        (statistics.getBatchesRedistributed() > 0));
+  }
+
+  public static void checkUnProcessedStats(String senderId, int events) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
+        .getStatistics();
+    assertEquals(events,
+        (statistics.getUnprocessedEventsAddedBySecondary() + statistics
+            .getUnprocessedTokensRemovedBySecondary()));
+    assertEquals(events,
+        (statistics.getUnprocessedEventsRemovedByPrimary() + statistics
+            .getUnprocessedTokensAddedByPrimary()));
+  }
+
+  public static void waitForSenderRunningState(String senderId){
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      final GatewaySender sender = getGatewaySenderById(senders, senderId);
+      Awaitility.await().atMost(300,TimeUnit.SECONDS).until(() -> assertEquals("Expected sender isRunning state to "
+        + "be true but is false", true, (sender != null && sender.isRunning())));
+    } finally {
+      exln.remove();
+    }
+  }
+
+  public static void waitForSenderToBecomePrimary(String senderId){
+    Set<GatewaySender> senders = ((GemFireCacheImpl)cache).getAllGatewaySenders();
+    final GatewaySender sender = getGatewaySenderById(senders, senderId);
+    Awaitility.await().atMost(10,TimeUnit.SECONDS).until(() -> assertEquals("Expected sender primary state to "
+      + "be true but is false", true, (sender != null && ((AbstractGatewaySender)sender).isPrimary())));
+  }
+
+  private static GatewaySender getGatewaySenderById(Set<GatewaySender> senders, String senderId) {
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        return s;
+      }
+    }
+    //if none of the senders matches with the supplied senderid, return null
+    return null;
+  }
+
+  public static HashMap checkQueue(){
+    HashMap listenerAttrs = new HashMap();
+    listenerAttrs.put("Create", listener1.createList);
+    listenerAttrs.put("Update", listener1.updateList);
+    listenerAttrs.put("Destroy", listener1.destroyList);
+    return listenerAttrs;
+  }
+
+  public static void checkQueueOnSecondary (final Map primaryUpdatesMap){
+    final HashMap secondaryUpdatesMap = new HashMap();
+    secondaryUpdatesMap.put("Create", listener1.createList);
+    secondaryUpdatesMap.put("Update", listener1.updateList);
+    secondaryUpdatesMap.put("Destroy", listener1.destroyList);
+
+    Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> {
+      secondaryUpdatesMap.put("Create", listener1.createList);
+      secondaryUpdatesMap.put("Update", listener1.updateList);
+      secondaryUpdatesMap.put("Destroy", listener1.destroyList);
+      assertEquals("Expected secondary map to be " + primaryUpdatesMap + " but it is " + secondaryUpdatesMap,
+        true,secondaryUpdatesMap.equals(primaryUpdatesMap));
+    });
+  }
+
+  public static HashMap checkQueue2(){
+    HashMap listenerAttrs = new HashMap();
+    listenerAttrs.put("Create", listener2.createList);
+    listenerAttrs.put("Update", listener2.updateList);
+    listenerAttrs.put("Destroy", listener2.destroyList);
+    return listenerAttrs;
+  }
+
+  public static HashMap checkPR(String regionName){
+    PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
+    QueueListener listener = (QueueListener)region.getCacheListener();
+
+    HashMap listenerAttrs = new HashMap();
+    listenerAttrs.put("Create", listener.createList);
+    listenerAttrs.put("Update", listener.updateList);
+    listenerAttrs.put("Destroy", listener.destroyList);
+    return listenerAttrs;
+  }
+
+  public static HashMap checkBR(String regionName, int numBuckets){
+    PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
+    HashMap listenerAttrs = new HashMap();
+    for (int i = 0; i < numBuckets; i++) {
+      BucketRegion br = region.getBucketRegion(i);
+      QueueListener listener = (QueueListener)br.getCacheListener();
+      listenerAttrs.put("Create"+i, listener.createList);
+      listenerAttrs.put("Update"+i, listener.updateList);
+      listenerAttrs.put("Destroy"+i, listener.destroyList);
+    }
+    return listenerAttrs;
+  }
+
+  public static HashMap checkQueue_BR(String senderId, int numBuckets){
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        sender = s;
+        break;
+      }
+    }
+    RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
+    .getQueues().toArray(new RegionQueue[1])[0];
+
+    PartitionedRegion region = (PartitionedRegion)parallelQueue.getRegion();
+    HashMap listenerAttrs = new HashMap();
+    for (int i = 0; i < numBuckets; i++) {
+      BucketRegion br = region.getBucketRegion(i);
+      if (br != null) {
+        QueueListener listener = (QueueListener)br.getCacheListener();
+        if (listener != null) {
+          listenerAttrs.put("Create"+i, listener.createList);
+          listenerAttrs.put("Update"+i, listener.updateList);
+          listenerAttrs.put("Destroy"+i, listener.destroyList);
+        }
+      }
+    }
+    return listenerAttrs;
+  }
+
+  public static void addListenerOnBucketRegion(String regionName, int numBuckets) {
+    WANTestBase test = new WANTestBase();
+    test.addCacheListenerOnBucketRegion(regionName, numBuckets);
+  }
+
+  private void addCacheListenerOnBucketRegion(String regionName, int numBuckets){
+    PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
+    for (int i = 0; i < numBuckets; i++) {
+      BucketRegion br = region.getBucketRegion(i);
+      AttributesMutator mutator = br.getAttributesMutator();
+      listener1 = new QueueListener();
+      mutator.addCacheListener(listener1);
+    }
+  }
+
+  public static void addListenerOnQueueBucketRegion(String senderId, int numBuckets) {
+    WANTestBase test = new WANTestBase();
+    test.addCacheListenerOnQueueBucketRegion(senderId, numBuckets);
+  }
+
+  private void addCacheListenerOnQueueBucketRegion(String senderId, int numBuckets){
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        sender = s;
+        break;
+      }
+    }
+    RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
+    .getQueues().toArray(new RegionQueue[1])[0];
+
+    PartitionedRegion region = (PartitionedRegion)parallelQueue.getRegion();
+    for (int i = 0; i < numBuckets; i++) {
+      BucketRegion br = region.getBucketRegion(i);
+      if (br != null) {
+        AttributesMutator mutator = br.getAttributesMutator();
+        CacheListener listener = new QueueListener();
+        mutator.addCacheListener(listener);
+      }
+    }
+
+  }
+
+  public static void addQueueListener(String senderId, boolean isParallel){
+    WANTestBase test = new WANTestBase();
+    test.addCacheQueueListener(senderId, isParallel);
+  }
+
+  public static void addSecondQueueListener(String senderId, boolean isParallel){
+    WANTestBase test = new WANTestBase();
+    test.addSecondCacheQueueListener(senderId, isParallel);
+  }
+
+  public static void addListenerOnRegion(String regionName){
+    WANTestBase test = new WANTestBase();
+    test.addCacheListenerOnRegion(regionName);
+  }
+  private void addCacheListenerOnRegion(String regionName){
+    Region region = cache.getRegion(regionName);
+    AttributesMutator mutator = region.getAttributesMutator();
+    listener1 = new QueueListener();
+    mutator.addCacheListener(listener1);
+  }
+
+  private void addCacheQueueListener(String senderId, boolean isParallel) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        sender = s;
+        break;
+      }
+    }
+    listener1 = new QueueListener();
+    if (!isParallel) {
+      Set<RegionQueue> queues = ((AbstractGatewaySender)sender).getQueues();
+      for(RegionQueue q: queues) {
+        q.addCacheListener(listener1);
+      }
+    }
+    else {
+      RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
+      .getQueues().toArray(new RegionQueue[1])[0];
+      parallelQueue.addCacheListener(listener1);
+    }
+  }
+
+  private void addSecondCacheQueueListener(String senderId, boolean isParallel) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    listener2 = new QueueListener();
+    if (!isParallel) {
+      Set<RegionQueue> queues = ((AbstractGatewaySender)sender).getQueues();
+      for(RegionQueue q: queues) {
+        q.addCacheListener(listener2);
+      }
+    }
+    else {
+    	RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
+      .getQueues().toArray(new RegionQueue[1])[0];
+      parallelQueue.addCacheListener(listener2);
+    }
+  }
+
+  public static void pauseSender(String senderId) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      GatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = s;
+          break;
+        }
+      }
+      sender.pause();
+      ((AbstractGatewaySender) sender).getEventProcessor().waitForDispatcherToPause();
+
+    } finally {
+      exp.remove();
+      exln.remove();
+    }
+  }
+
+  public static void resumeSender(String senderId) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      GatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = s;
+          break;
+        }
+      }
+      sender.resume();
+    } finally {
+      exp.remove();
+      exln.remove();
+    }
+  }
+
+  public static void stopSender(String senderId) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
+        .getName());
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      GatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = s;
+          break;
+        }
+      }
+      AbstractGatewaySenderEventProcessor eventProcessor = null;
+      if (sender instanceof AbstractGatewaySender) {
+        eventProcessor = ((AbstractGatewaySender) sender).getEventProcessor();
+      }
+      sender.stop();
+
+      Set<RegionQueue> queues = null;
+      if (eventProcessor instanceof ConcurrentSerialGatewaySenderEventProcessor) {
+        queues = ((ConcurrentSerialGatewaySenderEventProcessor)eventProcessor).getQueues();
+        for (RegionQueue queue: queues) {
+          if (queue instanceof SerialGatewaySenderQueue) {
+            assertFalse(((SerialGatewaySenderQueue) queue).isRemovalThreadAlive());
+          }
+        }
+      }
+    } finally {
+      exp.remove();
+      exln.remove();
+    }
+  }
+
+  public static void stopReceivers() {
+    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+    for (GatewayReceiver receiver : receivers) {
+      receiver.stop();
+    }
+  }
+
+  public static void startReceivers() {
+    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+    for (GatewayReceiver receiver : receivers) {
+      try {
+        receiver.start();
+      } catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    }
+  }
+
+  public static GatewaySenderFactory configureGateway(DiskStoreFactory dsf, File[] dirs1, String dsName,
+      boolean isParallel, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isPersistent,
+      GatewayEventFilter filter, boolean isManualStart, int numDispatchers, OrderPolicy policy) {
+
+    InternalGatewaySenderFactory gateway = (InternalGatewaySenderFactory)cache.createGatewaySenderFactory();
+    gateway.setParallel(isParallel);
+    gateway.setMaximumQueueMemory(maxMemory);
+    gateway.setBatchSize(batchSize);
+    gateway.setBatchConflationEnabled(isConflation);
+    gateway.setManualStart(isManualStart);
+    gateway.setDispatcherThreads(numDispatchers);
+    gateway.setOrderPolicy(policy);
+    gateway.setLocatorDiscoveryCallback(new MyLocatorCallback());
+    if (filter != null) {
+      eventFilter = filter;
+      gateway.addGatewayEventFilter(filter);
+    }
+    if (isPersistent) {
+      gateway.setPersistenceEnabled(true);
+      gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+          .getName());
+    } else {
+      DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+      gateway.setDiskStoreName(store.getName());
+    }
+    return gateway;
+  }
+
+  public static void createSender(String dsName, int remoteDsId,
+      boolean isParallel, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isPersistent,
+      GatewayEventFilter filter, boolean isManualStart) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      File persistentDirectory = new File(dsName + "_disk_"
+          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+      persistentDirectory.mkdir();
+      DiskStoreFactory dsf = cache.createDiskStoreFactory();
+      File[] dirs1 = new File[] { persistentDirectory };
+      GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName, isParallel, maxMemory, batchSize, isConflation, isPersistent, filter, isManualStart, numDispatcherThreadsForTheRun, GatewaySender.DEFAULT_ORDER_POLICY);
+      gateway.create(dsName, remoteDsId);
+
+    } finally {
+      exln.remove();
+    }
+  }
+
+  public static void createSenderWithMultipleDispatchers(String dsName, int remoteDsId,
+	boolean isParallel, Integer maxMemory,
+	Integer batchSize, boolean isConflation, boolean isPersistent,
+	GatewayEventFilter filter, boolean isManualStart, int numDispatchers, OrderPolicy orderPolicy) {
+	  final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+      persistentDirectory.mkdir();
+      DiskStoreFactory dsf = cache.createDiskStoreFactory();
+      File[] dirs1 = new File[] { persistentDirectory };
+      GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName,isParallel, maxMemory, batchSize, isConflation, isPersistent, filter,
+          isManualStart, numDispatchers, orderPolicy);
+      gateway.create(dsName, remoteDsId);
+
+    } finally {
+      exln.remove();
+    }
+  }
+
+  public static void createSenderWithoutDiskStore(String dsName, int remoteDsId, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isManualStart) {
+
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      //set dispatcher threads
+      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsId);
+  }
+
+  public static void createConcurrentSender(String dsName, int remoteDsId,
+      boolean isParallel, Integer maxMemory, Integer batchSize,
+      boolean isConflation, boolean isPersistent, GatewayEventFilter filter,
+      boolean isManualStart, int concurrencyLevel, OrderPolicy policy) {
+
+    File persistentDirectory = new File(dsName + "_disk_"
+        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File[] dirs1 = new File[] { persistentDirectory };
+    GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName, isParallel, maxMemory, batchSize, isConflation, isPersistent, filter, isManualStart, concurrencyLevel, policy);
+    gateway.create(dsName, remoteDsId);
+  }
+
+  public static void createSenderForValidations(String dsName, int remoteDsId,
+      boolean isParallel, Integer alertThreshold,
+      boolean isConflation, boolean isPersistent,
+      List<GatewayEventFilter> eventFilters,
+      List<GatewayTransportFilter> transportFilters, boolean isManualStart,
+      boolean isDiskSync) {
+    IgnoredException exp1 = IgnoredException.addIgnoredException(RegionDestroyedException.class
+        .getName());
+    try {
+      File persistentDirectory = new File(dsName + "_disk_"
+          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+      persistentDirectory.mkdir();
+      DiskStoreFactory dsf = cache.createDiskStoreFactory();
+      File[] dirs1 = new File[] { persistentDirectory };
+
+      if (isParallel) {
+        GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+        gateway.setParallel(true);
+        gateway.setAlertThreshold(alertThreshold);
+        ((InternalGatewaySenderFactory)gateway)
+            .setLocatorDiscoveryCallback(new MyLocatorCallback());
+        if (eventFilters != null) {
+          for (GatewayEventFilter filter : eventFilters) {
+            gateway.addGatewayEventFilter(filter);
+          }
+        }
+        if (transportFilters != null) {
+          for (GatewayTransportFilter filter : transportFilters) {
+            gateway.addGatewayTransportFilter(filter);
+          }
+        }
+        if (isPersistent) {
+          gateway.setPersistenceEnabled(true);
+          gateway.setDiskStoreName(dsf.setDiskDirs(dirs1)
+              .create(dsName + "_Parallel").getName());
+        }
+        else {
+          DiskStore store = dsf.setDiskDirs(dirs1).create(dsName + "_Parallel");
+          gateway.setDiskStoreName(store.getName());
+        }
+        gateway.setDiskSynchronous(isDiskSync);
+        gateway.setBatchConflationEnabled(isConflation);
+        gateway.setManualStart(isManualStart);
+        //set dispatcher threads
+        gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+        gateway.create(dsName, remoteDsId);
+
+      }
+      else {
+        GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+        gateway.setAlertThreshold(alertThreshold);
+        gateway.setManualStart(isManualStart);
+        //set dispatcher threads
+        gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+        ((InternalGatewaySenderFactory)gateway)
+            .setLocatorDiscoveryCallback(new MyLocatorCallback());
+        if (eventFilters != null) {
+          for (GatewayEventFilter filter : eventFilters) {
+            gateway.addGatewayEventFilter(filter);
+          }
+        }
+        if (transportFilters != null) {
+          for (GatewayTransportFilter filter : transportFilters) {
+            gateway.addGatewayTransportFilter(filter);
+          }
+        }
+        gateway.setBatchConflationEnabled(isConflation);
+        if (isPersistent) {
+          gateway.setPersistenceEnabled(true);
+          gateway.setDiskStoreName(dsf.setDiskDirs(dirs1)
+              .create(dsName + "_Serial").getName());
+        }
+        else {
+          DiskStore store = dsf.setDiskDirs(dirs1).create(dsName + "_Serial");
+          gateway.setDiskStoreName(store.getName());
+        }
+        gateway.setDiskSynchronous(isDiskSync);
+        gateway.create(dsName, remoteDsId);
+      }
+    } finally {
+      exp1.remove();
+    }
+  }
+
+  public static String createSenderWithDiskStore(String dsName, int remoteDsId,
+      boolean isParallel, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isPersistent,
+      GatewayEventFilter filter, String dsStore, boolean isManualStart) {
+    File persistentDirectory = null;
+    if (dsStore == null) {
+      persistentDirectory = new File(dsName + "_disk_"
+          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    }
+    else {
+      persistentDirectory = new File(dsStore);
+    }
+    LogWriterUtils.getLogWriter().info("The ds is : " + persistentDirectory.getName());
+
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File [] dirs1 = new File[] {persistentDirectory};
+
+    if(isParallel) {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      //set dispatcher threads
+      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      if(isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        String dsname = dsf.setDiskDirs(dirs1).create(dsName).getName();
+        gateway.setDiskStoreName(dsname);
+        LogWriterUtils.getLogWriter().info("The DiskStoreName is : " + dsname);
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+        LogWriterUtils.getLogWriter().info("The ds is : " + store.getName());
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsId);
+
+    }else {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      //set dispatcher threads
+      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      if(isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.create(dsName, remoteDsId);
+    }
+    return persistentDirectory.getName();
+  }
+
+
+  public static void createSenderWithListener(String dsName, int remoteDsName,
+      boolean isParallel, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isPersistent,
+      GatewayEventFilter filter, boolean attachTwoListeners, boolean isManualStart) {
+    File persistentDirectory = new File(dsName + "_disk_"
+        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File[] dirs1 = new File[] { persistentDirectory };
+
+    if (isParallel) {
+      GatewaySenderFactory gateway = cache
+          .createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      //set dispatcher threads
+      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+      ((InternalGatewaySenderFactory)gateway)
+          .setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      if (isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+            .getName());
+      } else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsName);
+
+    } else {
+      GatewaySenderFactory gateway = cache
+          .createGatewaySenderFactory();
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      //set dispatcher threads
+      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
+      ((InternalGatewaySenderFactory)gateway)
+          .setLocatorDiscoveryCallback(new MyLocatorCallback());
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      if (isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
+            .getName());
+      } else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+
+      eventListener1 = new MyGatewaySenderEventListener();
+      ((InternalGatewaySenderFactory)gateway).addAsyncEventListener(eventListener1);
+      if (attachTwoListeners) {
+        eventListener2 = new MyGatewaySenderEventListener2();
+        ((InternalGatewaySenderFactory)gateway).addAsyncEventListener(eventListener2);
+      }
+      ((InternalGatewaySenderFactory)gateway).create(dsName);
+    }
+  }
+
+  public static void createReceiverInVMs(VM... vms) {
+    for (VM vm : vms) {
+      vm.invoke(() -> createReceiver());
+    }
+  }
+
+  public static int createReceiver() {
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+      Assert.fail("Test " + getTestMethodName()
+          + " failed to start GatewayReceiver on port " + port, e);
+    }
+    return port;
+  }
+
+  public static void createReceiverWithBindAddress(int locPort) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    fact.setBindAddress("200.112.204.10");
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+      fail("Expected GatewayReceiver Exception");
+    }
+    catch (GatewayReceiverException gRE){
+      LogWriterUtils.getLogWriter().fine("Got the GatewayReceiverException", gRE);
+      assertTrue(gRE.getMessage().contains("Failed to create server socket on"));
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + test.getName()
+          + " failed to start GatewayReceiver on port " + port);
+    }
+  }
+  public static int createReceiverWithSSL(int locPort) {
+    WANTestBase test = new WANTestBase();
+
+    Properties gemFireProps = test.getDistributedSystemProperties();
+
+    gemFireProps.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+    gemFireProps.put(GATEWAY_SSL_ENABLED, "true");
+    gemFireProps.put(GATEWAY_SSL_PROTOCOLS, "any");
+    gemFireProps.put(GATEWAY_SSL_CIPHERS, "any");
+    gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, "true");
+
+    gemFireProps.put(GATEWAY_SSL_KEYSTORE_TYPE, "jks");
+    gemFireProps.put(GATEWAY_SSL_KEYSTORE,
+        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/cacheserver.keystore"));
+    gemFireProps.put(GATEWAY_SSL_KEYSTORE_PASSWORD, "password");
+    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE,
+        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/cacheserver.truststore"));
+    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE_PASSWORD, "password");
+
+    gemFireProps.setProperty(MCAST_PORT, "0");
+    gemFireProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
+
+    LogWriterUtils.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps);
+
+    InternalDistributedSystem ds = test.getSystem(gemFireProps);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + test.getName()
+          + " failed to start GatewayReceiver on port " + port);
+    }
+    return port;
+  }
+
+  public static void createReceiverAndServer(int locPort) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int receiverPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(receiverPort);
+    fact.setEndPort(receiverPort);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + test.getName()
+          + " failed to start GatewayReceiver on port " + receiverPort);
+    }
+    CacheServer server = cache.addCacheServer();
+    int serverPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+    server.setPort(serverPort);
+    server.setHostnameForClients("localhost");
+    try {
+      server.start();
+    } catch (IOException e) {
+      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e);
+    }
+  }
+
+  public static int createServer(int locPort) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+
+    CacheServer server = cache.addCacheServer();
+    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+    server.setPort(port);
+    server.setHostnameForClients("localhost");
+    try {
+      server.start();
+    } catch (IOException e) {
+      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e);
+    }
+    return port;
+  }
+
+  public static void createClientWithLocator(int port0,String host,
+      String regionName) {
+    WANTestBase test = new WANTestBase();
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+
+    assertNotNull(cache);
+    CacheServerTestUtil.disableShufflingOfEndpoints();
+    Pool p;
+    try {
+      p = PoolManager.createFactory().addLocator(host, port0)
+          .setPingInterval(250).setSubscriptionEnabled(true)
+          .setSubscriptionRedundancy(-1).setReadTimeout(2000)
+          .setSocketBufferSize(1000).setMinConnections(6).setMaxConnections(10)
+          .setRetryAttempts(3).create(regionName);
+    } finally {
+      CacheServerTestUtil.enableShufflingOfEndpoints();
+    }
+
+    AttributesFactory factory = new AttributesFactory();
+    factory.setPoolName(p.getName());
+    factory.setDataPolicy(DataPolicy.NORMAL);
+    RegionAttributes attrs = factory.create();
+    region = cache.createRegion(regionName, attrs);
+    region.registerInterest("ALL_KEYS");
+    assertNotNull(region);
+    LogWriterUtils.getLogWriter().info(
+     

<TRUNCATED>


[42/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/resources/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/resources/org/apache/geode)

Posted by hi...@apache.org.
GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/resources/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/resources/org/apache/geode)


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/31acb6d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/31acb6d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/31acb6d7

Branch: refs/heads/feature/GEODE-37_2
Commit: 31acb6d7269c75701c1b5e5fb8d2faf0e568c252
Parents: f39e239
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Sep 13 15:43:20 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Tue Sep 13 15:43:20 2016 -0700

----------------------------------------------------------------------
 .../gemfire/codeAnalysis/excludedClasses.txt    |  2 --
 .../gemstone/gemfire/codeAnalysis/openBugs.txt  | 21 ---------------
 .../sanctionedDataSerializables.txt             | 28 --------------------
 .../codeAnalysis/sanctionedSerializables.txt    |  0
 .../geode/codeAnalysis/excludedClasses.txt      |  2 ++
 .../org/apache/geode/codeAnalysis/openBugs.txt  | 21 +++++++++++++++
 .../sanctionedDataSerializables.txt             | 28 ++++++++++++++++++++
 .../codeAnalysis/sanctionedSerializables.txt    |  0
 8 files changed, 51 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/excludedClasses.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/excludedClasses.txt b/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/excludedClasses.txt
deleted file mode 100644
index c55df1d..0000000
--- a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/excludedClasses.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# e.g.,
-#com/gemstone/gemfire/cache/query/CqAttributesFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/openBugs.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/openBugs.txt b/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/openBugs.txt
deleted file mode 100644
index 6c40e24..0000000
--- a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/openBugs.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# This is a list of classes excluded due to open bugs about their having
-# incompatible changes.  There should be no entries in this file at the
-# time of a product release.
-
-# Each entry should be a bug number followed by a comma and the
-# full class name.  The package components can be delimited with a period
-# or a comma.  Don't include ".class" or ".java" at the end of the name.
-
-# example:  50174,com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage
-# example:  50175,com.gemstone.org.jgroups.Message$Header
-
-
-# ~~~~~~~~~~~~~~~~~~~ DataSerializables ~~~~~~~~~~~~~~~~~~~~~~~~~
-# these are failures from testDataSerializables
-
-
-# ~~~~~~~~~~~~~~~~~~~ Serializables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# these are failures from testSerializables
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt b/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
deleted file mode 100644
index 1b62255..0000000
--- a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorJoinMessage,2
-fromData,38,2a2bb700062a2bb80007c00008b500032a2bb900090100b500042a2bb80007c00008b50005b1
-toData,32,2a2bb7000a2ab400032bb8000b2b2ab40004b9000c02002ab400052bb8000bb1
-
-com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinRequest,2
-fromData,22,2a2bb80004c00005b500022a2bb900060100b50003b1
-toData,19,2ab400022bb800072b2ab40003b900080200b1
-
-com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinResponse,2
-fromData,9,2a2bb80010b50004b1
-toData,9,2ab400042bb80011b1
-
-com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingRequest,2
-fromData,1,b1
-toData,1,b1
-
-com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingResponse,2
-fromData,1,b1
-toData,1,b1
-
-com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorRequest,2
-fromData,11,2a2bb900030100b50002b1
-toData,11,2b2ab40002b900040200b1
-
-com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorResponse,2
-fromData,12,2a2bb80003c00004b50002b1
-toData,9,2ab400022bb80005b1
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt b/geode-wan/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
deleted file mode 100755
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
new file mode 100644
index 0000000..c55df1d
--- /dev/null
+++ b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
@@ -0,0 +1,2 @@
+# e.g.,
+#com/gemstone/gemfire/cache/query/CqAttributesFactory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/openBugs.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/openBugs.txt b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/openBugs.txt
new file mode 100644
index 0000000..6c40e24
--- /dev/null
+++ b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/openBugs.txt
@@ -0,0 +1,21 @@
+# This is a list of classes excluded due to open bugs about their having
+# incompatible changes.  There should be no entries in this file at the
+# time of a product release.
+
+# Each entry should be a bug number followed by a comma and the
+# full class name.  The package components can be delimited with a period
+# or a comma.  Don't include ".class" or ".java" at the end of the name.
+
+# example:  50174,com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage
+# example:  50175,com.gemstone.org.jgroups.Message$Header
+
+
+# ~~~~~~~~~~~~~~~~~~~ DataSerializables ~~~~~~~~~~~~~~~~~~~~~~~~~
+# these are failures from testDataSerializables
+
+
+# ~~~~~~~~~~~~~~~~~~~ Serializables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# these are failures from testSerializables
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
new file mode 100644
index 0000000..1b62255
--- /dev/null
+++ b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -0,0 +1,28 @@
+com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorJoinMessage,2
+fromData,38,2a2bb700062a2bb80007c00008b500032a2bb900090100b500042a2bb80007c00008b50005b1
+toData,32,2a2bb7000a2ab400032bb8000b2b2ab40004b9000c02002ab400052bb8000bb1
+
+com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinRequest,2
+fromData,22,2a2bb80004c00005b500022a2bb900060100b50003b1
+toData,19,2ab400022bb800072b2ab40003b900080200b1
+
+com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinResponse,2
+fromData,9,2a2bb80010b50004b1
+toData,9,2ab400042bb80011b1
+
+com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingRequest,2
+fromData,1,b1
+toData,1,b1
+
+com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingResponse,2
+fromData,1,b1
+toData,1,b1
+
+com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorRequest,2
+fromData,11,2a2bb900030100b50002b1
+toData,11,2b2ab40002b900040200b1
+
+com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorResponse,2
+fromData,12,2a2bb80003c00004b50002b1
+toData,9,2ab400022bb80005b1
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31acb6d7/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt b/geode-wan/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
new file mode 100755
index 0000000..e69de29


[05/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java
new file mode 100644
index 0000000..47dee96
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagation_PartitionedRegionDUnitTest.java
@@ -0,0 +1,412 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.CancelException;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.internal.cache.ForceReattemptException;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class SerialWANPropagation_PartitionedRegionDUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  public SerialWANPropagation_PartitionedRegionDUnitTest() {
+    super();
+  }
+
+  @Test
+  public void testPartitionedSerialPropagation() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    //vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testBothReplicatedAndPartitionedSerialPropagation()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testSerialReplicatedAndPartitionedPropagation() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial",
+        2, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "lnSerial" ));
+    vm5.invoke(() -> WANTestBase.startSender( "lnSerial" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testSerialReplicatedAndSerialPartitionedPropagation()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        2, false, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial2", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("lnSerial1", vm4, vm5);
+
+    startSenderInVMs("lnSerial2", vm5, vm6);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  @Test
+  public void testPartitionedSerialPropagationToTwoWanSites() throws Exception {
+
+    Integer lnPort = createFirstLocatorWithDSId(1);
+    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort ));
+    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(3,lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    createCacheInVMs(tkPort, vm3);
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    startSenderInVMs("lnSerial1", vm4, vm5);
+    startSenderInVMs("lnSerial2", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "lnSerial1,lnSerial2", 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testPartitionedSerialPropagationHA() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    //do initial 100 puts to create all the buckets
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+    
+    IgnoredException.addIgnoredException(CancelException.class.getName());
+    IgnoredException.addIgnoredException(CacheClosedException.class.getName());
+    IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
+    //start async puts
+    AsyncInvocation inv = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    //close the cache on vm4 in between the puts
+    vm4.invoke(() -> WANTestBase.killSender());
+
+    inv.join();
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+
+  @Test
+  public void testPartitionedSerialPropagationWithParallelThreads() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    createReceiverInVMs(vm2, vm3);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+
+
+    vm4.invoke(() -> WANTestBase.doMultiThreadedPuts( // TODO: eats exceptions
+        getTestMethodName() + "_PR", 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 1000 ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java
new file mode 100644
index 0000000..f3b6765
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationsFeatureDUnitTest.java
@@ -0,0 +1,338 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+
+
+@Category(DistributedTest.class)
+public class SerialWANPropagationsFeatureDUnitTest extends WANTestBase{
+
+  private static final long serialVersionUID = 1L;
+
+  public SerialWANPropagationsFeatureDUnitTest() {
+    super();
+  }
+
+  @Test
+  public void testSerialReplicatedWanWithOverflow() {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 10, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 10, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+    vm2.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
+    vm3.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doHeavyPuts(
+        getTestMethodName() + "_RR", 15 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 15, 240000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 15, 240000 ));
+  }
+
+  @Test
+  public void testSerialReplicatedWanWithPersistence() {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithConflation() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 1000, true, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 1000, true, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationWithParallelThreads()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doMultiThreadedPuts(
+        getTestMethodName() + "_RR", 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  @Test
+  public void testSerialPropagationWithFilter() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName(), null, 1, 100, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithFilter() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 800 ));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationWithFilter_AfterAck()
+      throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm6, vm7);
+    createReceiverInVMs(vm6, vm7);
+
+    createCacheInVMs(lnPort, vm2, vm3, vm4, vm5);
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 10, false, false,
+            new MyGatewayEventFilter_AfterAck(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 10, false, false,
+            new MyGatewayEventFilter_AfterAck(), true ));
+
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), null, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName(), "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+
+    Integer vm4Acks = (Integer)vm4.invoke(() -> WANTestBase.validateAfterAck( "ln"));
+    Integer vm5Acks = (Integer)vm5.invoke(() -> WANTestBase.validateAfterAck( "ln"));
+
+    assertEquals(2000, (vm4Acks + vm5Acks));
+
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANStatsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
new file mode 100644
index 0000000..2019cac
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
@@ -0,0 +1,588 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.jayway.awaitility.Awaitility;
+
+@Category(DistributedTest.class)
+public class SerialWANStatsDUnitTest extends WANTestBase {
+  
+  private static final long serialVersionUID = 1L;
+
+  private String testName;
+  
+  public SerialWANStatsDUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    this.testName = getTestMethodName();
+    addIgnoredException("java.net.ConnectException");
+    addIgnoredException("java.net.SocketException");
+    addIgnoredException("Unexpected IOException");
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+
+    vm5.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 1000 ));
+    
+    pause(2000);
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 1000, 1000, 1000));
+    vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
+      100));
+    
+    vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 1000, 0, 0));
+    vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
+      0));
+    
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationWithMultipleDispatchers() throws Exception {
+	 Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+	 Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+	vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
+		false, 100, 10, false, false, null, true, 2, OrderPolicy.KEY ));
+	vm5.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
+		false, 100, 10, false, false, null, true, 2, OrderPolicy.KEY ));
+
+	vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+		testName + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+		testName + "_RR", "ln", isOffHeap()  ));
+	vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+		testName + "_RR", "ln", isOffHeap()  ));
+	vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+		testName + "_RR", "ln", isOffHeap()  ));
+	vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+		testName + "_RR", "ln", isOffHeap()  ));
+
+	vm5.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+		1000 ));
+
+	vm2.invoke(() -> WANTestBase.validateRegionSize(
+		testName + "_RR", 1000 ));
+	    
+	pause(2000);
+	vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
+	    
+	vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
+		0, 1000, 1000, 1000));
+	vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
+		100));
+	    
+	vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
+		0, 1000, 0, 0));
+	vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
+		0));
+	    
+	  }
+  
+  @Test
+  public void testWANStatsTwoWanSites() throws Exception {
+
+    Integer lnPort = createFirstLocatorWithDSId(1);
+    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    createCacheInVMs(tkPort, vm3);
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("lnSerial1", vm4, vm5);
+    startSenderInVMs("lnSerial2", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 1000 ));
+    
+    pause(2000);
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
+    vm3.invoke(() -> WANTestBase.checkGatewayReceiverStats(100, 1000, 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.checkQueueStats("lnSerial1",
+      0, 1000, 1000, 1000));
+    vm4.invoke(() -> WANTestBase.checkBatchStats("lnSerial1",
+      100));
+    vm4.invoke(() -> WANTestBase.checkQueueStats("lnSerial2",
+      0, 1000, 1000, 1000));
+    vm4.invoke(() -> WANTestBase.checkBatchStats("lnSerial2",
+      100));
+    vm5.invoke(() -> WANTestBase.checkQueueStats("lnSerial1",
+      0, 1000, 0, 0));
+    vm5.invoke(() -> WANTestBase.checkBatchStats("lnSerial1",
+      0));
+    vm5.invoke(() -> WANTestBase.checkQueueStats("lnSerial2",
+      0, 1000, 0, 0));
+    vm5.invoke(() -> WANTestBase.checkBatchStats("lnSerial2",
+      0));
+    
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationHA() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap()  ));
+    
+    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( testName + "_RR", 10000 ));
+    pause(2000);
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender( "ln" ));
+    Boolean isKilled = Boolean.FALSE;
+    try {
+      isKilled = (Boolean)inv2.getResult();
+    }
+    catch (Throwable e) {
+      fail("Unexpected exception while killing a sender");
+    }
+    AsyncInvocation inv3 = null; 
+    if(!isKilled){
+      inv3 = vm5.invokeAsync(() -> WANTestBase.killSender( "ln" ));
+      inv3.join();
+    }
+    inv1.join();
+    inv2.join();
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 10000 ));
+  
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStatsHA(1000, 10000, 10000 ));
+    
+    vm5.invoke(() -> WANTestBase.checkStats_Failover("ln", 10000));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationUnprocessedEvents() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 20, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 20, false, false, null, true ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", null, isOffHeap()  ));
+
+    //create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_2", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_2", null, isOffHeap()  ));
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+
+    //create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_2", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_2", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_2", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_2", "ln", isOffHeap()  ));
+    
+    //start puts in RR_1 in another thread
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR_1", 1000 ));
+    //do puts in RR_2 in main thread
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR_2", 500 ));
+    //sleep for some time to let all the events propagate to remote site
+    Thread.sleep(20);
+    //vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR_1", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR_2", 500 ));
+    
+    pause(2000);
+    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 1500, 1500, 1500));
+    vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
+      75));
+    vm4.invoke(() -> WANTestBase.checkUnProcessedStats("ln", 0));
+    
+    
+    vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 1500, 0, 0));
+    vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
+      0));
+    vm5.invoke(() -> WANTestBase.checkUnProcessedStats("ln", 1500));
+  }
+  
+  /**
+   * 
+   * Not Disabled - see ticket #52118
+   *
+   * NOTE: The test failure is avoided by having a larger number of puts operation so
+   * that WANTestBase.verifyRegionQueueNotEmpty("ln" )) is successful as there is a
+   * significant delay during the high number of puts.
+   *
+   * In future if this failure reappears, the put operations must be increase or a better fix must be found.
+   * 
+   * 1 region and sender configured on local site and 1 region and a 
+   * receiver configured on remote site. Puts to the local region are in progress.
+   * Remote region is destroyed in the middle.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy() throws Exception {
+  int numEntries = 20000;
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    //these are part of local site
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 100, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 100, false, false, null, true ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", null, isOffHeap()  ));
+    //This is to cause a scenario where we have received at least X events and want to slow the receiver
+    vm2.invoke(() -> WANTestBase.longPauseAfterNumEvents(500, 200));
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR_1", "ln", isOffHeap()  ));
+
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( testName + "_RR_1", numEntries ));
+    //destroy RR_1 in remote site
+    vm2.invoke(() -> WANTestBase.destroyRegion( testName + "_RR_1", 500));
+
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+
+    //assuming some events might have been dispatched before the remote region was destroyed,
+    //sender's region queue will have events less than 1000 but the queue will not be empty.
+    //NOTE: this much verification might be sufficient in DUnit. Hydra will take care of 
+    //more in depth validations.
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty("ln" ));
+
+    //verify that all is well in local site. All the events should be present in local region
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      testName + "_RR_1", numEntries ));
+
+    //like a latch to guarantee at least one exception returned
+    vm4.invoke(() -> Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> WANTestBase.verifyQueueSize("ln", 0)));
+    
+    vm4.invoke(() -> WANTestBase.checkBatchStats("ln", true, true));
+    
+    vm5.invoke(() -> WANTestBase.checkUnProcessedStats("ln", numEntries));
+    
+    vm2.invoke(() -> WANTestBase.checkExceptionStats(1));
+    
+  }
+  
+  @Test
+  public void testSerialPropagationWithFilter() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 1, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 1, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 1, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 1, 100, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, null, 1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, null, 1, 100, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName, 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, 800 ));
+    
+    pause(2000);
+    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 1000, 900, 800));
+    vm4.invoke(() -> WANTestBase.checkEventFilteredStats("ln",
+      200));
+    vm4.invoke(() -> WANTestBase.checkBatchStats("ln",
+      80));
+    vm4.invoke(() -> WANTestBase.checkUnProcessedStats("ln", 0));
+    
+    
+    vm5.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 1000, 0, 0));
+    vm5.invoke(() -> WANTestBase.checkBatchStats("ln",
+      0));
+    vm5.invoke(() -> WANTestBase.checkUnProcessedStats("ln",900));
+  }
+  
+  @Test
+  public void testSerialPropagationConflation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, true, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 0, 100, isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 0, 100, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 0, 100, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", 0, 100, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, null,1, 100, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, null,1, 100, isOffHeap()  ));
+
+    final Map keyValues = new HashMap();
+    final Map updateKeyValues = new HashMap();
+    for(int i=0; i< 1000; i++) {
+      keyValues.put(i, i);
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, keyValues ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() ));
+    for(int i=0;i<500;i++) {
+      updateKeyValues.put(i, i+"_updated");
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size()  + updateKeyValues.size() ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, 0 ));
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size()  + updateKeyValues.size() ));
+
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+
+    keyValues.putAll(updateKeyValues);
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, keyValues.size() ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      testName, keyValues.size() ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionContents(
+        testName, keyValues ));
+    vm3.invoke(() -> WANTestBase.validateRegionContents(
+        testName, keyValues ));
+    
+    pause(2000);
+    vm4.invoke(() -> WANTestBase.checkQueueStats("ln",
+      0, 2000, 2000, 1500));
+    vm4.invoke(() -> WANTestBase.checkConflatedStats("ln",
+      500));
+  }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java
new file mode 100644
index 0000000..f9b46ef
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java
@@ -0,0 +1,490 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.wan.*;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
+import com.gemstone.gemfire.test.dunit.*;
+
+import javax.management.remote.JMXConnectorServer;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.assertEquals;
+import static com.gemstone.gemfire.test.dunit.Assert.fail;
+
+public abstract class WANCommandTestBase extends CliCommandTestBase {
+
+  static Cache cache;
+  private JMXConnectorServer jmxConnectorServer;
+  private ManagementService managementService;
+//  public String jmxHost;
+//  public int jmxPort;
+
+  static VM vm0;
+  static VM vm1;
+  static VM vm2;
+  static VM vm3;
+  static VM vm4;
+  static VM vm5;
+  static VM vm6;
+  static VM vm7;
+
+  @Override
+  public final void postSetUpCliCommandTestBase() throws Exception {
+    final Host host = Host.getHost(0);
+    vm0 = host.getVM(0);
+    vm1 = host.getVM(1);
+    vm2 = host.getVM(2);
+    vm3 = host.getVM(3);
+    vm4 = host.getVM(4);
+    vm5 = host.getVM(5);
+    vm6 = host.getVM(6);
+    vm7 = host.getVM(7);
+    enableManagement();
+  }
+
+  public Integer createFirstLocatorWithDSId(int dsId) {
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+    return port;
+  }
+
+  public Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
+    props.setProperty(LOCATORS, "localhost[" + port + "]");
+    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
+    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
+    getSystem(props);
+    return port;
+  }
+
+  public void createCache(Integer locPort){
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  public void createCacheWithGroups(Integer locPort, String groups){
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    props.setProperty(GROUPS, groups);
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  public void createSender(String dsName, int remoteDsId,
+      boolean isParallel, Integer maxMemory,
+      Integer batchSize, boolean isConflation, boolean isPersistent,
+      GatewayEventFilter filter, boolean isManualStart) {
+    File persistentDirectory = new File(dsName +"_disk_"+System.currentTimeMillis()+"_" + VM.getCurrentVMNum());
+    persistentDirectory.mkdir();
+    DiskStoreFactory dsf = cache.createDiskStoreFactory();
+    File [] dirs1 = new File[] {persistentDirectory};
+    if(isParallel) {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setParallel(true);
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      if(isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      gateway.create(dsName, remoteDsId);
+
+    }else {
+      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
+      gateway.setMaximumQueueMemory(maxMemory);
+      gateway.setBatchSize(batchSize);
+      gateway.setManualStart(isManualStart);
+      if (filter != null) {
+        gateway.addGatewayEventFilter(filter);
+      }
+      gateway.setBatchConflationEnabled(isConflation);
+      if(isPersistent) {
+        gateway.setPersistenceEnabled(true);
+        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
+      }
+      else {
+        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
+        gateway.setDiskStoreName(store.getName());
+      }
+      gateway.create(dsName, remoteDsId);
+    }
+  }
+
+  public void startSender(String senderId){
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      GatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = s;
+          break;
+        }
+      }
+      sender.start();
+    } finally {
+      exln.remove();
+    }
+  }
+
+  public void pauseSender(String senderId){
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      GatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = s;
+          break;
+        }
+      }
+      sender.pause();
+    } finally {
+      exln.remove();
+    }
+  }
+
+  public int createAndStartReceiver(int locPort) {
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+         receiver.start();
+    } catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + getName() + " failed to start GatewayReceiver");
+    }
+    return port;
+  }
+
+  public int createReceiver(int locPort) {
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
+    fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    return receiver.getPort();
+  }
+
+  public int createReceiverWithGroup(int locPort, String groups) {
+    Properties props =  getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+    props.setProperty(GROUPS, groups);
+
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
+    fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    return receiver.getPort();
+
+  }
+
+  public void startReceiver() {
+    try {
+      Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+      for (GatewayReceiver receiver : receivers) {
+        receiver.start();
+      }
+    } catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + getName() + " failed to start GatewayReceiver");
+    }
+  }
+
+  public void stopReceiver() {
+    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+    for (GatewayReceiver receiver : receivers) {
+      receiver.stop();
+    }
+  }
+
+  public int createAndStartReceiverWithGroup(int locPort, String groups) {
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort
+        + "]");
+    props.setProperty(GROUPS, groups);
+
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    } catch (IOException e) {
+      e.printStackTrace();
+      fail("Test " + getName() + " failed to start GatewayReceiver on port " + port);
+    }
+    return port;
+  }
+
+  public DistributedMember getMember(){
+    return cache.getDistributedSystem().getDistributedMember();
+  }
+
+
+  public int getLocatorPort(){
+    return Locator.getLocators().get(0).getPort();
+  }
+
+  /**
+   * Enable system property gemfire.disableManagement false in each VM.
+   */
+  public void enableManagement() {
+    Invoke.invokeInEveryVM(new SerializableRunnable("Enable Management") {
+      public void run() {
+        System.setProperty(InternalDistributedSystem.DISABLE_MANAGEMENT_PROPERTY, "false");
+      }
+    });
+
+  }
+
+  public void verifySenderState(String senderId, boolean isRunning, boolean isPaused) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      Set<GatewaySender> senders = cache.getGatewaySenders();
+      AbstractGatewaySender sender = null;
+      for (GatewaySender s : senders) {
+        if (s.getId().equals(senderId)) {
+          sender = (AbstractGatewaySender) s;
+          break;
+        }
+      }
+
+      assertEquals(isRunning, sender.isRunning());
+      assertEquals(isPaused, sender.isPaused());
+    } finally {
+      exln.remove();
+    }
+  }
+
+  public void verifySenderAttributes(String senderId, int remoteDsID,
+      boolean isParallel, boolean manualStart, int socketBufferSize,
+      int socketReadTimeout, boolean enableBatchConflation, int batchSize,
+      int batchTimeInterval, boolean enablePersistence,
+      boolean diskSynchronous, int maxQueueMemory, int alertThreshold,
+      int dispatcherThreads, OrderPolicy orderPolicy,
+      List<String> expectedGatewayEventFilters,
+      List<String> expectedGatewayTransportFilters) {
+
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertEquals("remoteDistributedSystemId", remoteDsID, sender
+        .getRemoteDSId());
+    assertEquals("isParallel", isParallel, sender.isParallel());
+    assertEquals("manualStart", manualStart, sender.isManualStart());
+    assertEquals("socketBufferSize", socketBufferSize, sender
+        .getSocketBufferSize());
+    assertEquals("socketReadTimeout", socketReadTimeout, sender
+        .getSocketReadTimeout());
+    assertEquals("enableBatchConflation", enableBatchConflation, sender
+        .isBatchConflationEnabled());
+    assertEquals("batchSize", batchSize, sender.getBatchSize());
+    assertEquals("batchTimeInterval", batchTimeInterval, sender
+        .getBatchTimeInterval());
+    assertEquals("enablePersistence", enablePersistence, sender
+        .isPersistenceEnabled());
+    assertEquals("diskSynchronous", diskSynchronous, sender.isDiskSynchronous());
+    assertEquals("maxQueueMemory", maxQueueMemory, sender
+        .getMaximumQueueMemory());
+    assertEquals("alertThreshold", alertThreshold, sender.getAlertThreshold());
+    assertEquals("dispatcherThreads", dispatcherThreads, sender
+        .getDispatcherThreads());
+    assertEquals("orderPolicy", orderPolicy, sender.getOrderPolicy());
+
+    // verify GatewayEventFilters
+    if (expectedGatewayEventFilters != null) {
+      assertEquals("gatewayEventFilters", expectedGatewayEventFilters.size(),
+          sender.getGatewayEventFilters().size());
+
+      List<GatewayEventFilter> actualGatewayEventFilters = sender
+          .getGatewayEventFilters();
+      List<String> actualEventFilterClassNames = new ArrayList<String>(
+          actualGatewayEventFilters.size());
+      for (GatewayEventFilter filter : actualGatewayEventFilters) {
+        actualEventFilterClassNames.add(filter.getClass().getName());
+      }
+
+      for (String expectedGatewayEventFilter : expectedGatewayEventFilters) {
+        if (!actualEventFilterClassNames.contains(expectedGatewayEventFilter)) {
+          fail("GatewayEventFilter " + expectedGatewayEventFilter
+              + " is not added to the GatewaySender");
+        }
+      }
+    }
+
+    // verify GatewayTransportFilters
+    if (expectedGatewayTransportFilters != null) {
+      assertEquals("gatewayTransportFilters", expectedGatewayTransportFilters
+          .size(), sender.getGatewayTransportFilters().size());
+      List<GatewayTransportFilter> actualGatewayTransportFilters = sender
+          .getGatewayTransportFilters();
+      List<String> actualTransportFilterClassNames = new ArrayList<String>(
+          actualGatewayTransportFilters.size());
+      for (GatewayTransportFilter filter : actualGatewayTransportFilters) {
+        actualTransportFilterClassNames.add(filter.getClass().getName());
+      }
+
+      for (String expectedGatewayTransportFilter : expectedGatewayTransportFilters) {
+        if (!actualTransportFilterClassNames
+            .contains(expectedGatewayTransportFilter)) {
+          fail("GatewayTransportFilter " + expectedGatewayTransportFilter
+              + " is not added to the GatewaySender.");
+        }
+      }
+    }
+  }
+
+  public void verifyReceiverState(boolean isRunning) {
+    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+    for (GatewayReceiver receiver : receivers) {
+      assertEquals(isRunning, receiver.isRunning());
+    }
+  }
+
+  public void verifyReceiverCreationWithAttributes(boolean isRunning,
+      int startPort, int endPort, String bindAddress, int maxTimeBetweenPings,
+      int socketBufferSize, List<String> expectedGatewayTransportFilters) {
+
+    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
+    assertEquals("Number of receivers is incorrect", 1, receivers.size());
+    for (GatewayReceiver receiver : receivers) {
+      assertEquals("isRunning", isRunning, receiver.isRunning());
+      assertEquals("startPort", startPort, receiver.getStartPort());
+      assertEquals("endPort", endPort, receiver.getEndPort());
+      assertEquals("bindAddress", bindAddress, receiver.getBindAddress());
+      assertEquals("maximumTimeBetweenPings", maxTimeBetweenPings, receiver
+          .getMaximumTimeBetweenPings());
+      assertEquals("socketBufferSize", socketBufferSize, receiver
+          .getSocketBufferSize());
+
+      // verify GatewayTransportFilters
+      if (expectedGatewayTransportFilters != null) {
+        assertEquals("gatewayTransportFilters", expectedGatewayTransportFilters
+            .size(), receiver.getGatewayTransportFilters().size());
+        List<GatewayTransportFilter> actualGatewayTransportFilters = receiver
+            .getGatewayTransportFilters();
+        List<String> actualTransportFilterClassNames = new ArrayList<String>(
+            actualGatewayTransportFilters.size());
+        for (GatewayTransportFilter filter : actualGatewayTransportFilters) {
+          actualTransportFilterClassNames.add(filter.getClass().getName());
+        }
+
+        for (String expectedGatewayTransportFilter : expectedGatewayTransportFilters) {
+          if (!actualTransportFilterClassNames
+              .contains(expectedGatewayTransportFilter)) {
+            fail("GatewayTransportFilter " + expectedGatewayTransportFilter
+                + " is not added to the GatewayReceiver.");
+          }
+        }
+      }
+    }
+  }
+
+  @Override
+  public final void postTearDownCacheTestCase() throws Exception {
+    closeCacheAndDisconnect();
+    vm0.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm1.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm2.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm3.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm4.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm5.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm6.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+    vm7.invoke(() -> WANCommandTestBase.closeCacheAndDisconnect());
+  }
+
+  public static void closeCacheAndDisconnect() {
+    if (cache != null && !cache.isClosed()) {
+      cache.close();
+      cache.getDistributedSystem().disconnect();
+    }
+  }
+}


[30/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
deleted file mode 100644
index 359a56d..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
+++ /dev/null
@@ -1,1593 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.io.IOException;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.PartitionAttributesFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.internal.cache.ColocationHelper;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
-
-@Category(DistributedTest.class)
-public class ParallelWANPersistenceEnabledGatewaySenderDUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-  
-  public ParallelWANPersistenceEnabledGatewaySenderDUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    //The restart tests log this string
-    IgnoredException.addIgnoredException("failed accepting client connection");
-  }
-  
-  @Test
-  public void testPartitionedRegionWithGatewaySenderPersistenceEnabled() throws IOException {
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-      createCache(lnPort);
-      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-      fact.setPersistenceEnabled(true);
-      fact.setParallel(true);
-      final IgnoredException ex = IgnoredException.addIgnoredException("Could not connect");
-      try {
-        GatewaySender sender1 = fact.create("NYSender", 2);
-
-        AttributesFactory rFact = new AttributesFactory();
-        rFact.addGatewaySenderId(sender1.getId());
-
-        PartitionAttributesFactory pFact = new PartitionAttributesFactory();
-        pFact.setTotalNumBuckets(100);
-        pFact.setRedundantCopies(1);
-        rFact.setPartitionAttributes(pFact.create());
-        Region r = cache.createRegionFactory(rFact.create()).create("MyRegion");
-        sender1.start();
-      } finally {
-        ex.remove();
-      }
-      
-    }
-    catch (Exception e) {
-      fail("Unexpected Exception :" + e);
-    }
-  }
-  
-  /**
-   * Enable persistence for region as well as GatewaySender and see if remote
-   * site receives all the events.
-   */
-  @Test
-  public void testPersistentPartitionedRegionWithGatewaySenderPersistenceEnabled() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-
-  }
-
-  /**
-   * Enable persistence for the GatewaySender but not the region
-   */
-  @Test
-  public void testPartitionedRegionWithPersistentGatewaySender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    
-    LogWriterUtils.getLogWriter().info("Created remote receivers");
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-    
-    LogWriterUtils.getLogWriter().info("Created local site cache");
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-  
-    LogWriterUtils.getLogWriter().info("Created local site senders");
-
-    vm4.invoke(createPartitionedRegionRunnable());
-    vm5.invoke(createPartitionedRegionRunnable());
-    vm6.invoke(createPartitionedRegionRunnable());
-    vm7.invoke(createPartitionedRegionRunnable());
-
-    LogWriterUtils.getLogWriter().info("Created local site persistent PR");
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Started the senders");
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-  }
-
-  protected SerializableRunnableIF createPartitionedRegionRunnable() {
-    return () -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() );
-  }
-
-
-
-  
-  /**
-   * Enable persistence for GatewaySender.
-   * Pause the sender and do some puts in local region.  
-   * Close the local site and rebuild the region and sender from disk store.
-   * Dispatcher should not start dispatching events recovered from persistent sender.
-   * Check if the remote site receives all the events.
-   */
-  @Test
-  public void testPRWithGatewaySenderPersistenceEnabled_Restart() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(createPartitionedRegionRunnable());
-    vm5.invoke(createPartitionedRegionRunnable());
-    vm6.invoke(createPartitionedRegionRunnable());
-    vm7.invoke(createPartitionedRegionRunnable());
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(createPartitionedRegionRunnable());
-    AsyncInvocation inv2 = vm5.invokeAsync(createPartitionedRegionRunnable());
-    AsyncInvocation inv3 = vm6.invokeAsync(createPartitionedRegionRunnable());
-    AsyncInvocation inv4 = vm7.invokeAsync(createPartitionedRegionRunnable());
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-    
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 3000 ));
-  }
-
-  protected SerializableRunnableIF killSenderRunnable() {
-    return () -> WANTestBase.killSender();
-  }
-
-  protected SerializableRunnableIF pauseSenderRunnable() {
-    return () -> WANTestBase.pauseSender( "ln" );
-  }
-
-  protected SerializableRunnableIF waitForSenderRunnable() {
-    return () -> WANTestBase.waitForSenderRunningState( "ln" );
-  }
-  
-  /**
-   * Enable persistence for PR and GatewaySender.
-   * Pause the sender and do some puts in local region.  
-   * Close the local site and rebuild the region and sender from disk store.
-   * Dispatcher should not start dispatching events recovered from persistent sender.
-   * Check if the remote site receives all the events.
-   */
-  @Test
-  public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 3000 ));
-  }
-  
-  /**
-   * Enable persistence for PR and GatewaySender.
-   * Pause the sender and do some puts in local region.  
-   * Close the local site and rebuild the region and sender from disk store.
-   * Dispatcher should not start dispatching events recovered from persistent sender.
-   * Check if the remote site receives all the events.
-   */
-  @Test
-  public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart2() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, false ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 300 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-  //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-    
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-
-
-    LogWriterUtils.getLogWriter().info("Creating the receiver.");
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    //create PR on remote site
-    
-    LogWriterUtils.getLogWriter().info("Creating the partitioned region at receiver. ");
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Doing some extra puts. ");
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPutsAfter300( getTestMethodName(), 1000 ));
-    //----------------------------------------------------------------------------------------------------
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("Validating the region size at the receiver end. ");
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-  }
-  
-  
-  /**
-   * Enable persistence for PR and GatewaySender.
-   * Pause the sender and do some puts in local region.  
-   * Close the local site and rebuild the region and sender from disk store.
-   * Dispatcher should not start dispatching events recovered from persistent sender.
-   * --> At the same time, do some more puts on the local region.  
-   * Check if the remote site receives all the events.
-   */
-  @Test
-  public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart_Scenario2() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-    
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    //Dispatcher should be dispatching now. Do some more puts through async thread
-    AsyncInvocation async1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    try {
-      async1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 3000 ));
-  }
-
-  /**
-   * Test case for bug# 44275.
-   * Enable persistence for PR and GatewaySender. 
-   * Do puts into region with key as a String.
-   * Close the local site and rebuild the region and sender from disk store. 
-   * Check if the remote site receives all the events.
-   */
-  @Test
-  public void testPersistentPRWithPersistentGatewaySender_Restart_Bug44275() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString( getTestMethodName(), 1000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-  //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-    getTestMethodName(), 1000 ));
-  }
-  
-  /**
-   * Test case for bug# 44275.
-   * Enable persistence for PR and GatewaySender. 
-   * Do puts into region with key as a String.
-   * Close the local site and rebuild the region and sender from disk store. 
-   * Check if the remote site receives all the events.
-   */
-  @Test
-  public void testPersistentPRWithPersistentGatewaySender_Restart_DoOps() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString( getTestMethodName(), 1000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-  //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    // create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-    getTestMethodName(), 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    
-   //do some extra puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString( getTestMethodName(), 10000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-    getTestMethodName(), 10000 ));
-  }
-  
-  @Test
-  public void testPersistentPR_Restart() {
-    // create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    // create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    // create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    // start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPutsWithKeyAsString(
-        getTestMethodName(), 1000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-
-    // --------------------close and rebuild local site
-    // -------------------------------------------------
-    // kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-
-    // restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-
-//    // create PR on local site
-//    vm4.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
-//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
-//    vm5.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
-//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
-//    vm6.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
-//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
-//    vm7.invoke(WANTestBase.class, "createPersistentPartitionedRegion",
-//        new Object[] { testName, "ln", 1, 100, isOffHeap() });
-
-    // create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
-            100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
-            100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
-            100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName(), "ln", 1,
-            100, isOffHeap() ));
-
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    }
-    catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-  }
-
-  /**
-   * Enable persistence for PR and GatewaySender. 
-   * Close the local site. 
-   * Create the local cache.
-   * Don't create back the partitioned region but create just the sender.  
-   * Check if the remote site receives all the events.
-   * NOTE: This use case is not supported yet. 
-   * For ParallelGatewaySender to start, it must be associated with a partitioned region. 
-   */
-  @Ignore("NotSupported")
-  @Test
-  public void testPersistentPartitionedRegionWithGatewaySenderPersistenceEnabled_Restart2() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-    
-    //create senders from disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    
-    //start the senders. NOTE that the senders are not associated with partitioned region
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Started the senders.");
-    
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-  }
-  
-  /**
-   * Create a non persistent PR and enable persistence for GatewaySender attached to the PR.
-   * Close the local site and rebuild it. Check if the remote site receives all the events.
-   * NOTE: This use case is not supported for now. For persistent parallel gateway sender,
-   * the PR to which it is attached should also be persistent.
-   */
-  @Ignore("NotSupported")
-  @Test
-  public void testNonPersistentPartitionedRegionWithGatewaySenderPersistenceEnabled_Restart() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create non persistent PR on local site
-    vm4.invoke(createPartitionedRegionRunnable());
-    vm5.invoke(createPartitionedRegionRunnable());
-    vm6.invoke(createPartitionedRegionRunnable());
-    vm7.invoke(createPartitionedRegionRunnable());
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders. The local site has been brought down.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-  //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    vm4.invoke(createPartitionedRegionRunnable());
-    vm5.invoke(createPartitionedRegionRunnable());
-    vm6.invoke(createPartitionedRegionRunnable());
-    vm7.invoke(createPartitionedRegionRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Started the senders.");
-    
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-    getTestMethodName(), 1000 ));
-  }
-
-
-  /**
-   * Create persistent PR and non-persistent GatewaySender.
-   * After doing puts, close the local site. 
-   * Rebuild the PR from persistent disk store and create the sender again. 
-   * Do more puts. Check if the remote site receives newly added events.
-   * 
-   * This test can be used as DUnit test for defect #50247 reported by Indian Railways.
-   * At present, customer is using this configuration and which is not recommended 
-   * since it can lead to event loss of GatewaySender events.
-   */
-  @Ignore("Bug50247")
-  @Test
-  public void testPersistentPartitionedRegionWithGatewaySender_Restart() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    //pause the senders
-    vm4.invoke(pauseSenderRunnable());
-    vm5.invoke(pauseSenderRunnable());
-    vm6.invoke(pauseSenderRunnable());
-    vm7.invoke(pauseSenderRunnable());
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //----------------- Close and rebuild local site -------------------------------------
-    //kill the senders
-    vm4.invoke(killSenderRunnable());
-    vm5.invoke(killSenderRunnable());
-    vm6.invoke(killSenderRunnable());
-    vm7.invoke(killSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create back the senders
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders again");
-    
-    //start the senders
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Started the senders.");
-    
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-
-    //wait for senders running
-    vm4.invoke(waitForSenderRunnable());
-    vm5.invoke(waitForSenderRunnable());
-    vm6.invoke(waitForSenderRunnable());
-    vm7.invoke(waitForSenderRunnable());
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-      getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-
-    //-------------------------------------------------------------------------------------------
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize( getTestMethodName(), 3000 ));
-  }
-  
-  /**
-   * LocalMaxMemory of user PR is 0 (accessor region).
-   * Parallel sender persistence is enabled. 
-   * In this scenario, the PR for Parallel sender should be created with persistence = false.
-   * This is because since the region is accessor region, it won't host any buckets and 
-   * hence Parallel sender PR is not required to be persistent.
-   * This test is added for defect # 45747. 
-   */
-  @Test
-  public void testParallelPropagationWithSenderPersistenceEnabledForAccessor() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, true, null, true ));
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
-      getTestMethodName() + "_PR", "ln", 1, 100 ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
-      getTestMethodName() + "_PR", "ln", 1, 100 ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  /**
-   * Test for bug 50120 see if we can recover after deleting the parallel gateway
-   * sender files and not recoverying the sender when we have a persistent PR.
-   * @throws Throwable 
-   */
-  @Test
-  public void testRemoveGatewayFromPersistentRegionOnRestart() throws Throwable {
-    
-
-    try {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-      createCacheInVMs(nyPort, vm2, vm3);
-      createReceiverInVMs(vm2, vm3);
-
-      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-      vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-      vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-      vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-
-      vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-      vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-      vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-      vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-      startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-      vm2.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-      vm3.invoke(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 113 ));
-
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 113 ));
-      vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 113 ));
-
-      //Bounce vm4, vm5, vm6, vm7 without the parallel queue
-      vm4.invoke(WANTestBase.class, "closeCache", new Object [] {});
-      vm5.invoke(WANTestBase.class, "closeCache", new Object [] {});
-      vm6.invoke(WANTestBase.class, "closeCache", new Object [] {});
-      vm7.invoke(WANTestBase.class, "closeCache", new Object [] {});
-
-      vm4.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
-      vm5.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
-      vm6.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
-      vm7.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { true});
-
-      createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-      AsyncInvocation async4 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-      AsyncInvocation async5 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-      AsyncInvocation async6 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-      AsyncInvocation async7 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-      async7.getResult(30 * 1000);
-      async5.getResult(30 * 1000);
-      async6.getResult(30 * 1000);
-      async4.getResult(30 * 1000);
-
-      //This should succeed, because the region recovered even though
-      //the queue was removed.
-      vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName(), 113 ));
-    } finally {
-      vm4.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
-      vm5.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
-      vm6.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
-      vm7.invoke(ParallelWANPersistenceEnabledGatewaySenderDUnitTest.class, "setIgnoreQueue" , new Object[] { false});
-    }
-  }
-  
-  public static void setIgnoreQueue(boolean shouldIgnore) {
-    ColocationHelper.IGNORE_UNRECOVERED_QUEUE = shouldIgnore;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java
deleted file mode 100644
index 2e84c4e..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPropagationClientServerDUnitTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class ParallelWANPropagationClientServerDUnitTest extends WANTestBase {
-
-  /**
-   * Normal happy scenario test case.
-   */
-  @Category(FlakyTest.class) // GEODE-1775: fails intermittently
-  @Test
-  public void testParallelPropagationWithClientServer() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiverAndServer( nyPort ));
-    vm3.invoke(() -> WANTestBase.createReceiverAndServer( nyPort ));
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createClientWithLocator(
-        nyPort, "localhost", getTestMethodName() + "_PR" ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      100 ));
-
-    vm5.invoke(() -> WANTestBase.createServer( lnPort ));
-    vm6.invoke(() -> WANTestBase.createServer( lnPort ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-         100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-         100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm7.invoke(() -> WANTestBase.createClientWithLocator(
-      lnPort, "localhost", getTestMethodName() + "_PR" ));
-
-    startSenderInVMsAsync("ln", vm5, vm6);
-
-    // before doing any puts, let the senders be running in order to ensure that
-    // not a single event will be lost
-    
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm7.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        10000 ));
-
-    
-    // verify all buckets drained on all sender nodes.
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-
-  }
-}


[37/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java
deleted file mode 100644
index 41f01f3..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.concurrent.TimeUnit;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionDestroyedException;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.jayway.awaitility.Awaitility;
-
-/**
- *
- */
-@Category(DistributedTest.class)
-public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-  
-  public ConcurrentParallelGatewaySenderOperation_2_DUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("RegionDestroyedException");
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-  }
-  
-  // to test that when userPR is locally destroyed, shadow Pr is also locally
-  // destroyed and on recreation userPr , shadow Pr is also recreated.
-  @Test
-  public void testParallelGatewaySender_SingleNode_UserPR_localDestroy_RecreateRegion() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    try {
-      String regionName = getTestMethodName() + "_PR";
-
-      createCacheInVMs(lnPort, vm4);
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
-      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 5, OrderPolicy.KEY));
-      vm4.invoke(() -> startSender("ln"));
-      vm4.invoke(() -> pauseSender("ln"));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-      vm2.invoke(() -> createReceiver());
-
-      vm4.invoke(() -> doPuts(regionName, 10));
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-
-      vm2.invoke(() -> validateRegionSize(regionName, 0));
-
-      vm4.invoke(() -> localDestroyRegion(getTestMethodName() + "_PR"));
-
-      vm2.invoke(() -> validateRegionSize(regionName, 0));
-
-      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
-
-      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 0)));
-
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-    } finally {
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
-    }
-  }
-  
-  @Test
-  public void testParallelGatewaySender_SingleNode_UserPR_Destroy_RecreateRegion() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    try {
-      String regionName = getTestMethodName() + "_PR";
-
-      createCacheInVMs(lnPort, vm4);
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
-      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 4, OrderPolicy.KEY));
-      vm4.invoke(() -> startSender("ln"));
-      vm4.invoke(() -> pauseSender("ln"));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-      vm2.invoke(() -> createReceiver());
-
-      vm4.invoke(() -> doPuts(regionName, 10));
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-
-      vm2.invoke(() -> validateRegionSize(regionName, 0));
-
-      vm4.invoke(() -> resumeSender("ln"));
-      vm4.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln"));
-      vm4.invoke(() -> localDestroyRegion(getTestMethodName() + "_PR"));
-
-      vm2.invoke(() -> validateRegionSize(regionName, 10));
-
-      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
-
-      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 20)));
-
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-
-    } finally {
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
-    }
-  }
-
-  @Test
-  public void testParallelGatewaySender_SingleNode_UserPR_Close_RecreateRegion() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-    try {
-      String regionName = getTestMethodName() + "_PR";
-      createCacheInVMs(lnPort, vm4);
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
-      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 7, OrderPolicy.KEY));
-      vm4.invoke(() -> startSender("ln"));
-      vm4.invoke(() -> pauseSender("ln"));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-      vm2.invoke(() -> createReceiver());
-
-      vm4.invoke(() -> doPuts(regionName, 10));
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-      vm4.invoke(() -> closeRegion(getTestMethodName() + "_PR"));
-      vm4.invoke(() -> resumeSender("ln"));
-
-      Thread.sleep(500);
-
-      vm2.invoke(() -> validateRegionSize(regionName, 0));
-
-      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
-
-      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 10)));
-
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-    }
-    finally {
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
-    }
-  }
-
-  @Test
-  public void testParallelGatewaySender_SingleNode_UserPR_Destroy_SimultaneousPut_RecreateRegion() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    try {
-      createAndStartSender(vm4, lnPort, 6, false, true);
-
-      vm4.invoke(() -> addCacheListenerAndDestroyRegion(getTestMethodName() + "_PR"));
-
-      createReceiverAndDoPutsInPausedSender(nyPort);
-
-      vm4.invoke(() -> resumeSender("ln"));
-
-      AsyncInvocation putAsync = vm4.invokeAsync(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR", 10, 101 ));
-      try {
-        putAsync.join();
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-        fail("Interrupted the async invocation.");
-      }
-
-      if (putAsync.getException() != null
-          && !(putAsync.getException() instanceof RegionDestroyedException)) {
-        Assert.fail("Expected RegionDestroyedException but got",
-            putAsync.getException());
-      }
-
-      // before destroy, there is wait for queue to drain, so data will be
-      // dispatched
-      vm2.invoke(() -> validateRegionSizeWithinRange(getTestMethodName() + "_PR", 10, 101)); // possible size is more than 10
-
-      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
-
-      vm4.invoke(() -> doPutsFrom(getTestMethodName() + "_PR", 10, 20));
-
-      vm4.invoke(() -> validateRegionSize(getTestMethodName() + "_PR", 10));
-
-      vm2.invoke(() -> validateRegionSizeWithinRange(getTestMethodName() + "_PR", 20, 101)); // possible size is more than 20
-    } finally {
-      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-  }
-  
-  @Test
-  public void testParallelGatewaySender_SingleNode_UserPR_Destroy_NodeDown()
-      throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    try {
-      createAndStartSender(vm4, lnPort, 5, false, true);
-      createAndStartSender(vm5, lnPort, 5, false, true);
-      createAndStartSender(vm6, lnPort, 5, false, true);
-
-      createReceiverAndDoPutsInPausedSender(nyPort);
-
-      vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-      vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-      vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-
-      Wait.pause(200);
-      AsyncInvocation localDestroyAsync = vm4.invokeAsync(() -> WANTestBase.destroyRegion( getTestMethodName() + "_PR" ));
-
-      AsyncInvocation closeAsync = vm4.invokeAsync(() -> WANTestBase.closeCache());
-      try {
-        localDestroyAsync.join();
-        closeAsync.join();
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-        fail("Interrupted the async invocation.");
-      }
-
-      vm2.invoke(() -> validateRegionSize(getTestMethodName() + "_PR", 10));
-    } finally {
-      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-      vm6.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-
-  }
-  
-  @Test
-  public void testParallelGatewaySender_SingleNode_UserPR_Close_SimultaneousPut_RecreateRegion() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    try {
-      String regionName = getTestMethodName() + "_PR";
-
-      createCacheInVMs(lnPort, vm4);
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1);
-      vm4.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, false, 5, OrderPolicy.KEY));
-      vm4.invoke(() -> startSender("ln"));
-      vm4.invoke(() -> pauseSender("ln"));
-
-      createCacheInVMs(nyPort, vm2);
-      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-      vm2.invoke(() -> createReceiver());
-
-      vm4.invoke(() -> doPuts(regionName, 10));
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-
-      vm2.invoke(() -> validateRegionSize(regionName, 0));
-
-      AsyncInvocation putAsync = vm4.invokeAsync(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_PR", 10, 2000 ));
-      AsyncInvocation localDestroyAsync = vm4.invokeAsync(() -> ConcurrentParallelGatewaySenderOperation_2_DUnitTest.
-        closeRegion( getTestMethodName() + "_PR" ));
-      try {
-        putAsync.join();
-        localDestroyAsync.join();
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-        fail("Interrupted the async invocation.");
-      }
-      vm2.invoke(() -> validateRegionSize(regionName, 0));
-
-      vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
-      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
-
-      vm2.invoke(() -> Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> validateRegionSize(regionName, 0)));
-
-      vm4.invoke(() -> validateRegionSize(regionName, 10));
-    } finally {
-      vm4.invoke(() -> AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0);
-    }
-  }
-
-  @Test
-  public void testParallelGatewaySenders_SingleNode_UserPR_localDestroy_RecreateRegion() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-    Integer tkPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator(3, lnPort));
-    Integer pnPort = (Integer)vm3.invoke(() -> createFirstRemoteLocator(4, lnPort));
-
-    createCacheInVMs(nyPort, vm4);
-    vm4.invoke(() -> createReceiver());
-    createCacheInVMs(tkPort, vm5);
-    vm5.invoke(() -> createReceiver());
-    createCacheInVMs(pnPort, vm6);
-    vm6.invoke(() -> createReceiver());
-
-    try {
-      vm7.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(lnPort));
-
-      LogWriterUtils.getLogWriter().info("Created cache on local site");
-
-      vm7.invoke(() -> createConcurrentSender("ln1", 2, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY));
-      vm7.invoke(() -> createConcurrentSender("ln2", 3, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY));
-      vm7.invoke(() -> createConcurrentSender("ln3", 4, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY));
-
-      vm7.invoke(() -> startSender("ln1"));
-      vm7.invoke(() -> startSender("ln2"));
-      vm7.invoke(() -> startSender("ln3"));
-
-      String regionName = getTestMethodName() + "_PR";
-      vm7.invoke(() -> createPartitionedRegion(regionName, "ln1,ln2,ln3", 1, 10, isOffHeap()));
-
-      LogWriterUtils.getLogWriter().info("Created PRs on local site");
-
-      vm4.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-      vm5.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-      vm6.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-
-      vm7.invoke(() -> doPuts(regionName, 10));
-
-      vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln1"));
-      vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln2"));
-      vm7.invoke(() -> validateParallelSenderQueueAllBucketsDrained("ln3"));
-
-      vm7.invoke(() -> localDestroyRegion(regionName));
-
-      vm7.invoke(() -> createPartitionedRegion(regionName, "ln1,ln2,ln3", 1, 10, isOffHeap()));
-
-      vm7.invoke(() -> doPutsFrom(regionName, 10, 20));
-
-      vm7.invoke(() -> validateRegionSize(regionName, 10));
-
-      validateRegionSizes(regionName, 20, vm4, vm5, vm6);
-    } finally {
-      vm7.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-  }
-  
-  @Test
-  public void testParallelGatewaySender_MultipleNode_UserPR_localDestroy_Recreate() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> createReceiver());
-
-    try {
-      createAndStartSender(vm4, lnPort, 5, true, false);
-      createAndStartSender(vm5, lnPort, 5, true, false);
-
-      String regionName = getTestMethodName() + "_PR";
-      vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-
-      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( regionName, 10 ));
-      Wait.pause(1000);
-      vm5.invoke(() -> localDestroyRegion(regionName));
-
-      try {
-        inv1.join();
-      } catch (InterruptedException ex) {
-        ex.printStackTrace();
-        fail("Interrupted the async invocation.");
-      }
-
-
-      validateRegionSizes(regionName, 10, vm4, vm2);
-
-      vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 10, isOffHeap()));
-
-      vm4.invoke(() -> doPutsFrom(regionName, 10, 20));
-
-      validateRegionSizes(regionName, 20, vm4, vm2);
-    } finally {
-      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-  }
-  
-  @Test
-  public void testParallelGatewaySenders_MultipleNode_UserPR_localDestroy_Recreate() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-    Integer tkPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator(3, lnPort));
-
-    createCacheInVMs(nyPort, vm6);
-    vm6.invoke(() -> createReceiver());
-    createCacheInVMs(tkPort, vm7);
-    vm7.invoke(() -> createReceiver());
-
-    try {
-      createAndStartTwoSenders(vm4, lnPort, 4);
-      createAndStartTwoSenders(vm5, lnPort, 4);
-
-      String regionName = getTestMethodName() + "_PR";
-      vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-          regionName, null, 1, 100, isOffHeap() ));
-      vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-          regionName, null, 1, 100, isOffHeap() ));
-
-      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( regionName, 10 ));
-
-      Wait.pause(1000);
-      vm5.invoke(() -> WANTestBase.localDestroyRegion( regionName ));
-
-      try {
-        inv1.join();
-      } catch (InterruptedException ex) {
-        ex.printStackTrace();
-        fail("Interrupted the async invocation.");
-      }
-
-      validateRegionSizes(regionName, 10, vm4, vm6, vm7);
-
-      vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-          regionName, "ln1,ln2", 1, 100, isOffHeap() ));
-
-      vm4.invoke(() -> WANTestBase.doPutsFrom(
-          regionName, 10, 20 ));
-
-      validateRegionSizes(regionName, 20, vm4, vm6, vm7);
-    } finally {
-      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-  }
-
-  @Test
-  public void testParallelGatewaySender_ColocatedPartitionedRegions_localDestroy() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> createReceiver());
-
-    try {
-      createAndStartSenderWithCustomerOrderShipmentRegion(vm4, lnPort, 5, true);
-      createAndStartSenderWithCustomerOrderShipmentRegion(vm5, lnPort, 5, true);
-
-      LogWriterUtils.getLogWriter().info("Created PRs on local site");
-
-      vm2.invoke(() -> createCustomerOrderShipmentPartitionedRegion(null, 1, 100, isOffHeap()));
-
-      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.putcolocatedPartitionedRegion( 10 ));
-      Wait.pause(1000);
-
-      try {
-        vm5.invoke(() -> localDestroyRegion(customerRegionName));
-      } catch (Exception ex) {
-        assertTrue(ex.getCause() instanceof UnsupportedOperationException);
-      }
-
-      try {
-        inv1.join();
-      } catch (Exception e) {
-        Assert.fail("Unexpected exception", e);
-      }
-
-      validateRegionSizes(customerRegionName, 10, vm4, vm5, vm2);
-    } finally {
-      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-  }
-
-  @Test
-  public void testParallelGatewaySender_ColocatedPartitionedRegions_destroy() throws Exception {
-    Integer[] locatorPorts = createLNAndNYLocators();
-    Integer lnPort = locatorPorts[0];
-    Integer nyPort = locatorPorts[1];
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    try {
-      createAndStartSenderWithCustomerOrderShipmentRegion(vm4, lnPort, 6, true);
-      createAndStartSenderWithCustomerOrderShipmentRegion(vm5, lnPort, 6, true);
-
-      LogWriterUtils.getLogWriter().info("Created PRs on local site");
-
-      vm2.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion(null, 1, 100, isOffHeap() ));
-
-      AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.putcolocatedPartitionedRegion( 2000 ));
-      Wait.pause(1000);
-
-      try {
-        vm5.invoke(() -> WANTestBase.destroyRegion( customerRegionName ));
-      } catch (Exception ex) {
-        assertTrue(ex.getCause() instanceof IllegalStateException);
-        return;
-      }
-      fail("Expected UnsupportedOperationException");
-    } finally {
-      vm4.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-      vm5.invoke(() -> clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME());
-    }
-  }
-
-  public static void clear_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME() {
-    AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = 0;
-  }
-  
-  public static void closeRegion(String regionName) {
-    Region r = cache.getRegion(Region.SEPARATOR + regionName);
-    assertNotNull(r);
-    r.close();
-  }
-
-  public static void validateRegionSizeWithinRange(String regionName,
-      final int min, final int max) {
-    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
-    assertNotNull(r);
-    WaitCriterion wc = new WaitCriterion() {
-      public boolean done() {
-        if (r.keySet().size() > min && r.keySet().size() <= max) {
-          return true;
-        }
-        return false;
-      }
-
-      public String description() {
-        return "Expected region entries to be within range : " + min + " "
-            + max + " but actual entries: " + r.keySet().size();
-      }
-    };
-    Wait.waitForCriterion(wc, 120000, 500, true);
-  }
-
-  protected static void createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(
-      Integer locPort) {
-    createCache(false, locPort);
-    AbstractGatewaySender.MAXIMUM_SHUTDOWN_WAIT_TIME = -1;
-  }
-
-  protected void createAndStartSender(VM vm, int port, int concurrencyLevel, boolean manualStart, boolean pause) {
-    vm.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(port));
-    vm.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln", 1, 10, isOffHeap()));
-    createSender(vm, concurrencyLevel, manualStart);
-    vm.invoke(() -> startSender("ln"));
-    if (pause) {
-      vm.invoke(() -> pauseSender("ln"));
-    }
-    LogWriterUtils.getLogWriter().info("Created PRs on local site");
-  }
-
-  protected void createReceiverAndDoPutsInPausedSender(int port) {
-    // Note: This is a test-specific method used by several tests to do puts from vm4 to vm2.
-    String regionName = getTestMethodName() + "_PR";
-    createCacheInVMs(port, vm2);
-    vm2.invoke(() -> createReceiver());
-    vm2.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap()));
-    vm4.invoke(() -> doPuts(regionName, 10));
-    vm4.invoke(() -> validateRegionSize(regionName, 10));
-    // since sender is paused, no dispatching
-    vm2.invoke(() -> validateRegionSize(regionName, 0));
-  }
-
-  protected void createAndStartTwoSenders(VM vm, int port, int concurrencyLevel) {
-    // Note: This is a test-specific method used to create and start 2 senders.
-    vm.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(port));
-    vm.invoke(() -> createPartitionedRegion(getTestMethodName() + "_PR", "ln1,ln2", 1, 100, isOffHeap()));
-    createSenders(vm, concurrencyLevel);
-    vm.invoke(() -> startSender("ln1"));
-    vm.invoke(() -> startSender("ln2"));
-  }
-
-  protected void createAndStartSenderWithCustomerOrderShipmentRegion(VM vm, int port, int concurrencyLevel, boolean manualStart) {
-    vm.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(port));
-    vm.invoke(() -> createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap()));
-    createSender(vm, concurrencyLevel, manualStart);
-    vm.invoke(() -> startSender("ln"));
-  }
-
-  protected void createSender(VM vm, int concurrencyLevel, boolean manualStart) {
-    vm.invoke(() -> createConcurrentSender("ln", 2, true, 100, 10, false, false, null, manualStart, concurrencyLevel, OrderPolicy.KEY));
-  }
-
-  protected void createSenders(VM vm, int concurrencyLevel) {
-    vm.invoke(() -> createConcurrentSender("ln1", 2, true, 100, 10, false, false, null, true, concurrencyLevel, OrderPolicy.KEY));
-    vm.invoke(() -> createConcurrentSender("ln2", 3, true, 100, 10, false, false, null, true, concurrencyLevel, OrderPolicy.KEY));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
deleted file mode 100644
index f09e19c..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderOperationsDUnitTest;
-import com.gemstone.gemfire.test.dunit.VM;
-
-/**
- *
- */
-@Category(DistributedTest.class)
-public class ConcurrentSerialGatewaySenderOperationsDUnitTest  extends SerialGatewaySenderOperationsDUnitTest {
-
-  private static final long serialVersionUID = 1L;
-
-  public ConcurrentSerialGatewaySenderOperationsDUnitTest() {
-    super();
-  }
-
-  protected void createSenderVM5() {
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY ));
-  }
-
-  protected void createSenderVM4() {
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY ));
-  }
-
-  protected void validateQueueClosedVM4() {
-    vm4.invoke(() -> WANTestBase.validateQueueClosedForConcurrentSerialGatewaySender( "ln"));
-  }
-  
-  private void validateQueueContents(VM vm, String site, int size) {
-    vm.invoke(() -> WANTestBase.validateQueueContentsForConcurrentSerialGatewaySender( site, size));
-  }
-
-  public static void verifySenderPausedState(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertTrue(sender.isPaused());
-  }
-
-  public static void verifySenderResumedState(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertFalse(sender.isPaused());
-    assertTrue(sender.isRunning());
-  }
-
-  public static void verifySenderStoppedState(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertFalse(sender.isRunning());
-    assertFalse(sender.isPaused());
-  }
-
-  public static void verifyGatewaySenderOperations(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    assertFalse(sender.isPaused());
-    assertFalse(((AbstractGatewaySender)sender).isRunning());
-    sender.pause();
-    sender.resume();
-    sender.stop();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java
deleted file mode 100644
index 3a0caef..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest extends
-    ConcurrentSerialGatewaySenderOperationsDUnitTest {
-
-  public ConcurrentSerialGatewaySenderOperationsOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java
deleted file mode 100644
index ead62e0..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_1_DUnitTest.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.EntryExistsException;
-import com.gemstone.gemfire.cache.client.ServerOperationException;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.cache.wan.BatchException70;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-
-/**
- * All the test cases are similar to SerialWANPropagationDUnitTest except that
- * the we create concurrent serial GatewaySender with concurrency of 4
- *
- */
-@Category(DistributedTest.class)
-public class ConcurrentWANPropagation_1_DUnitTest extends WANTestBase {
-
-  /**
-   * @param name
-   */
-  public ConcurrentWANPropagation_1_DUnitTest() {
-    super();
-  }
-
-  private static final long serialVersionUID = 1L;
-  
-  /**
-   * All the test cases are similar to SerialWANPropagationDUnitTest
-   * @throws Exception
-   */
-  @Test
-  public void testReplicatedSerialPropagation_withoutRemoteSite() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //keep the batch size high enough to reduce the number of exceptions in the log
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 400, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 400, false, false, null, true, 4, OrderPolicy.KEY ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-  
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  
-  @Test
-  public void testReplicatedSerialPropagationWithLocalSiteClosedAndRebuilt() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-    
-    //---------close local site and build again-----------------------------------------
-    vm4.invoke(() -> WANTestBase.killSender( ));
-    vm5.invoke(() -> WANTestBase.killSender( ));
-    vm6.invoke(() -> WANTestBase.killSender( ));
-    vm7.invoke(() -> WANTestBase.killSender( ));
-    
-    Integer regionSize = 
-      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_RR" ));
-    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-    //----------------------------------------------------------------------------------
-
-    //verify remote site receives all the events
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  /**
-   * Two regions configured with the same sender and put is in progress 
-   * on both the regions.
-   * One of the two regions is destroyed in the middle.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithLocalRegionDestroy() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 20, false, false, null, true, 3, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 20, false, false, null, true ,3, OrderPolicy.THREAD));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-
-    //create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap() ));
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-
-    //create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-    //do puts in RR_2 in main thread
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 500 ));
-    //destroy RR_2 after above puts are complete
-    vm4.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
-    
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    //sleep for some time to let all the events propagate to remote site
-    Thread.sleep(20);
-    //vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_2", 500 ));
-  }
-
-  /**
-   * 1 region and sender configured on local site and 1 region and a 
-   * receiver configured on remote site. Puts to the local region are in progress.
-   * Remote region is destroyed in the middle.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 500, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 500, false, false, null, true, 5, OrderPolicy.KEY ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 10000 ));
-    //destroy RR_1 in remote site
-    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_1"));
-    
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-
-    //verify that all is well in local site. All the events should be present in local region
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 10000 ));
-    //assuming some events might have been dispatched before the remote region was destroyed,
-    //sender's region queue will have events less than 1000 but the queue will not be empty.
-    //NOTE: this much verification might be sufficient in DUnit. Hydra will take care of 
-    //more in depth validations.
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmptyForConcurrentSender("ln" ));
-  }
-  
-  /**
-   * Two regions configured in local with the same sender and put is in progress 
-   * on both the regions. Same two regions are configured on remote site as well.
-   * One of the two regions is destroyed in the middle on remote site.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy2() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-
-    //create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap() ));
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap() ));
-
-    //create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap() ));
-    //destroy RR_2 on remote site in the middle
-    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
-    
-    //expected exceptions in the logs
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    //start puts in RR_2 in another thread
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
-    
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-   
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    //though region RR_2 is destroyed, RR_1 should still get all the events put in it 
-    //in local site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 1000 ));
-
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy3()
-      throws Exception {
-    final String senderId = "ln";
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    // these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    // senders are created on local site
-    vm4.invoke(() -> WANTestBase.createConcurrentSender(  senderId, 2,
-        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( senderId, 2,
-        false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap() ));
-
-    // create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap() ));
-
-
-    // start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", senderId, isOffHeap() ));
-
-    // create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", senderId, isOffHeap() ));
-
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-    // start puts in RR_2 in another thread
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
-    // destroy RR_2 on remote site in the middle
-    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName()
-        + "_RR_2" ));
-
-    try {
-      inv1.join();
-      inv2.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    // though region RR_2 is destroyed, RR_1 should still get all the events put
-    // in it
-    // in local site
-    try {
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR_1", 1000 ));
-    } finally {
-      System.setProperty(
-          DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
-      vm4.invoke(new CacheSerializableRunnable("UnSetting system property ") {
-        public void run2() throws CacheException {
-          System.setProperty(
-              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
-        }
-      });
-
-      vm5.invoke(new CacheSerializableRunnable("UnSetting system property ") {
-        public void run2() throws CacheException {
-          System.setProperty(
-              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
-        }
-      });
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java
deleted file mode 100644
index cfe4169..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropagation_2_DUnitTest.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-/**
- * All the test cases are similar to SerialWANPropagationDUnitTest except that
- * the we create concurrent serial GatewaySender with concurrency of 4
- */
-@Category(DistributedTest.class)
-public class ConcurrentWANPropagation_2_DUnitTest extends WANTestBase {
-
-  public ConcurrentWANPropagation_2_DUnitTest() {
-    super();
-  }
-
-  private static final long serialVersionUID = 1L;
-
-  @Test
-  public void testSerialReplicatedWanWithOverflow() {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //keep the maxQueueMemory low enough to trigger eviction
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 10, 5, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 10, 5, false, false, null, true, 5, OrderPolicy.KEY ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-    vm2.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
-    vm3.invoke(() -> addListenerToSleepAfterCreateEvent(1000, getTestMethodName() + "_RR"));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doHeavyPuts(
-        getTestMethodName() + "_RR", 15 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 15, 240000));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 15, 240000 ));
-  }
-
-  @Ignore("Bug46921")
-  @Test
-  public void testSerialReplicatedWanWithPersistence() {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, true, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, true, null, true, 5, OrderPolicy.THREAD ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationToTwoWanSites() throws Exception {
-
-    Integer lnPort = createFirstLocatorWithDSId(1);
-    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createCacheInVMs(tkPort, vm3);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true, 5 , OrderPolicy.THREAD));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("lnSerial1", vm4, vm5);
-
-    startSenderInVMs("lnSerial2", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationHA() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
-    Wait.pause(2000);
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    
-    inv1.join();
-    inv2.join();
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithConflation() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 1000, true, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 1000, true, false, null, true, 5, OrderPolicy.THREAD ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithParallelThreads()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 4, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 4, OrderPolicy.THREAD ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doMultiThreadedPuts(
-        getTestMethodName() + "_RR", 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-
-  @Test
-  public void testSerialPropagationWithFilter() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithFilter() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName(), null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName(), null, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false,
-        new MyGatewayEventFilter(), true, 5, OrderPolicy.THREAD ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName(), "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 800 ));
-  }
-  
-  @Test
-  public void testNormalRegionSerialPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createCache(nyPort));
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    WANTestBase.createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        false, 100, 10, false, false, null, true, 5, OrderPolicy.THREAD ));
-
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createNormalRegion(
-        getTestMethodName() + "_RR", "ln" ));
-    vm5.invoke(() -> WANTestBase.createNormalRegion(
-        getTestMethodName() + "_RR", "ln" ));
-
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
-        0, 0, 0));
-
-    vm5.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
-        1000, 0, 0 ));
-    
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 1000));
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 0));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 0 ));
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 0, 0));
-    
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java
deleted file mode 100644
index 0ac13d4..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.internal.cache.wan.disttx;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Invoke;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class DistTXWANDUnitTest extends WANTestBase {
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    Invoke.invokeInEveryVM(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        System.setProperty(DistributionConfig.GEMFIRE_PREFIX + LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-        return null;
-      }
-    }); 
-  }
-
-  /**
-   * Disabled because it hangs with current implementation of notifying
-   * adjunct receivers by sending DistTXAdjunctCommitMessage from primary at the
-   * time of commit.
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void testPartitionedSerialPropagation_SenderSameAsCoordinator() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doDistTXPuts( getTestMethodName() + "_PR",
-        50 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 50 ));
-  }
-
-  @Test
-  public void testPartitionedSerialPropagation_SenderNotSameAsCoordinator() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm6.invoke(() -> WANTestBase.doDistTXPuts( getTestMethodName() + "_PR",
-        50 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 50 ));
-  }
-
-  @Test
-  public void testPartitionedRegionParallelPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap()  ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doDistTXPuts( getTestMethodName() + "_PR",
-        5 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 5 ));
-  }
-}


[27/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java
deleted file mode 100644
index 411396b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueueDUnitTest.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.cache.RegionQueue;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class SerialGatewaySenderQueueDUnitTest extends WANTestBase {
-
-  @Test
-  public void testPrimarySecondaryQueueDrainInOrder_RR() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createCache(nyPort ));
-    vm3.invoke(() -> WANTestBase.createCache(nyPort ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
-        false, 100, 10, false, false, null, true, 1, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
-        false, 100, 10, false, false, null, true, 1, OrderPolicy.KEY ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.addQueueListener( "ln", false));
-    vm5.invoke(() -> WANTestBase.addQueueListener( "ln", false));
-    
-    vm2.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_RR"));
-    vm3.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_RR"));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
-    
-    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-    Wait.pause(5000);
-    HashMap primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    HashMap secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    assertEquals(primarySenderUpdates, secondarySenderUpdates);
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
-    Wait.pause(2000);
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
-    Wait.pause(2000);
-    // We should wait till primarySenderUpdates and secondarySenderUpdates become same
-    // If in 300000ms they don't then throw error.
-    primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    
-    checkPrimarySenderUpdatesOnVM5(primarySenderUpdates);
-//    assertIndexDetailsEquals(primarySenderUpdates, secondarySenderUpdates);
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
-    Wait.pause(5000);
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 1000 ));
-    primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    HashMap receiverUpdates = (HashMap)vm2.invoke(() -> WANTestBase.checkQueue());
-    
-    List destroyList = (List)primarySenderUpdates.get("Destroy");
-    List createList = (List)receiverUpdates.get("Create");
-    for(int i = 0; i< 1000; i++){
-      assertEquals(destroyList.get(i), createList.get(i));
-    }
-    assertEquals(primarySenderUpdates.get("Destroy"), receiverUpdates.get("Create"));
-    
-    Wait.pause(5000);
-    // We expect that after this much time secondary would have got batch removal message
-    // removing all the keys.
-    secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    assertEquals(secondarySenderUpdates.get("Destroy"), receiverUpdates.get("Create"));
-  }
-
-  protected void checkPrimarySenderUpdatesOnVM5(HashMap primarySenderUpdates) {
-    vm5.invoke(() -> WANTestBase.checkQueueOnSecondary( primarySenderUpdates ));
-  }
-  
-  @Test
-  public void testPrimarySecondaryQueueDrainInOrder_PR() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-  
-    vm2.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_PR"));
-    vm3.invoke(() -> WANTestBase.addListenerOnRegion(getTestMethodName() + "_PR"));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
-        false, 100, 10, false, false, null, true, 1, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
-        false, 100, 10, false, false, null, true,1, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.addQueueListener( "ln", false));
-    vm5.invoke(() -> WANTestBase.addQueueListener( "ln", false));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
-    
-    vm6.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-    Wait.pause(5000);
-    HashMap primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    HashMap secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    checkPrimarySenderUpdatesOnVM5(primarySenderUpdates);
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
-    Wait.pause(4000);
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln"));
-    Wait.pause(15000);
-    primarySenderUpdates = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    secondarySenderUpdates = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    assertEquals(primarySenderUpdates, secondarySenderUpdates);
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln"));
-    Wait.pause(5000);
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  /**
-   * Test to validate that serial gateway sender queue diskSynchronous attribute
-   * when persistence of sender is enabled. 
-   */
-  @Test
-  public void test_ValidateSerialGatewaySenderQueueAttributes_1() {
-    Integer localLocPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer remoteLocPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
-
-    WANTestBase test = new WANTestBase(getTestMethodName());
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost["
-        + localLocPort + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-
-    File directory = new File("TKSender" + "_disk_"
-        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    directory.mkdir();
-    File[] dirs1 = new File[] { directory };
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    dsf.setDiskDirs(dirs1);
-    DiskStore diskStore = dsf.create("FORNY");
-
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setBatchConflationEnabled(true);
-    fact.setBatchSize(200);
-    fact.setBatchTimeInterval(300);
-    fact.setPersistenceEnabled(true);// enable the persistence
-    fact.setDiskSynchronous(true);
-    fact.setDiskStoreName("FORNY");
-    fact.setMaximumQueueMemory(200);
-    fact.setAlertThreshold(1200);
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    fact.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    final IgnoredException exTKSender = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      GatewaySender sender1 = fact.create("TKSender", 2);
-
-      AttributesFactory factory = new AttributesFactory();
-      factory.addGatewaySenderId(sender1.getId());
-      factory.setDataPolicy(DataPolicy.PARTITION);
-      Region region = cache.createRegionFactory(factory.create()).create(
-          "test_ValidateGatewaySenderAttributes");
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      assertEquals(senders.size(), 1);
-      GatewaySender gatewaySender = senders.iterator().next();
-      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
-          .getQueues();
-      assertEquals(regionQueues.size(), GatewaySender.DEFAULT_DISPATCHER_THREADS);
-      RegionQueue regionQueue = regionQueues.iterator().next();
-      assertEquals(true, regionQueue.getRegion().getAttributes()
-          .isDiskSynchronous());
-    } finally {
-      exTKSender.remove();
-    }
-  }
-  
-  /**
-   * Test to validate that serial gateway sender queue diskSynchronous attribute
-   * when persistence of sender is not enabled. 
-   */
-  @Test
-  public void test_ValidateSerialGatewaySenderQueueAttributes_2() {
-    Integer localLocPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    
-    Integer remoteLocPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, localLocPort ));
-    
-    WANTestBase test = new WANTestBase(getTestMethodName());
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + localLocPort + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);  
-
-    GatewaySenderFactory fact = cache.createGatewaySenderFactory();
-    fact.setBatchConflationEnabled(true);
-    fact.setBatchSize(200);
-    fact.setBatchTimeInterval(300);
-    fact.setPersistenceEnabled(false);//set persistence to false
-    fact.setDiskSynchronous(true);
-    fact.setMaximumQueueMemory(200);
-    fact.setAlertThreshold(1200);
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    fact.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    fact.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    fact.addGatewayTransportFilter(myStreamFilter2);
-    final IgnoredException exp = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      GatewaySender sender1 = fact.create("TKSender", 2);
-
-      AttributesFactory factory = new AttributesFactory();
-      factory.addGatewaySenderId(sender1.getId());
-      factory.setDataPolicy(DataPolicy.PARTITION);
-      Region region = cache.createRegionFactory(factory.create()).create(
-          "test_ValidateGatewaySenderAttributes");
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      assertEquals(senders.size(), 1);
-      GatewaySender gatewaySender = senders.iterator().next();
-      Set<RegionQueue> regionQueues = ((AbstractGatewaySender) gatewaySender)
-          .getQueues();
-      assertEquals(regionQueues.size(), GatewaySender.DEFAULT_DISPATCHER_THREADS);
-      RegionQueue regionQueue = regionQueues.iterator().next();
-
-      assertEquals(false, regionQueue.getRegion().getAttributes()
-          .isDiskSynchronous());
-    } finally {
-      exp.remove();
-    }
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java
deleted file mode 100644
index 7664ab4..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPersistenceEnabledGatewaySenderDUnitTest.java
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-/**
- * 
- */
-@Category(DistributedTest.class)
-public class SerialWANPersistenceEnabledGatewaySenderDUnitTest extends
-    WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  public SerialWANPersistenceEnabledGatewaySenderDUnitTest() {
-    super();
-  }
-
-  /**
-   * Just enable the persistence for GatewaySender and see if it remote site
-   * receives all the events.
-   */
-  @Test
-  public void testReplicatedRegionWithGatewaySenderPersistenceEnabled() {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-
-  /**
-   * Enable persistence for the Region and see if the remote site gets all the
-   * events.
-   */
-  @Test
-  public void testPersistentReplicatedRegionWithGatewaySender() {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-
-  /**
-   * Enable persistence for region as well as GatewaySender and see if remote
-   * site receives all the events.
-   * 
-   */
-  @Test
-  public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion( getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-
-  /**
-   * Enable persistence for GatewaySender, kill the sender and restart it. Check
-   * if the remote site receives all the event.
-   */
-  @Test
-  public void testReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    String firstDStore = (String)vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, null, true ));
-    String secondDStore = (String)vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
-    LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-
-    // verify if the queue has all the events
-    // vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
-    // ));
-    // vm5.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
-    // ));
-    //
-    // vm2.invoke(() -> WANTestBase.validateRegionSize(
-    // testName + "_RR", 0 ));
-    // vm3.invoke(() -> WANTestBase.validateRegionSize(
-    // testName + "_RR", 0 ));
-
-    // kill the vm
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-    vm6.invoke(() -> WANTestBase.killSender());
-    vm7.invoke(() -> WANTestBase.killSender());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the sender. ");
-    // restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore(
-        "ln", 2, false, 100, 10, false, true, null,
-        firstDStore, true ));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore(
-        "ln", 2, false, 100, 10, false, true, null,
-        secondDStore, true ));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
-
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      fail("Got interrupted exception while waiting for startSender to finish.");
-    }
-
-    Wait.pause(5000);
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-
-  /**
-   * Enable persistence for Region and persistence for GatewaySender. Kill the
-   * vm with regions and bring that up again. Check if the remote site receives
-   * all the event. again?
-   * 
-   */
-  @Test
-  public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    String firstDStore = (String)vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, null, true ));
-    String secondDStore = (String)vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, null, true  ));
-
-    LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
-    LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-
-    // kill the vm
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-
-    LogWriterUtils.getLogWriter().info("Killed the sender. ");
-    // restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-      100, 10, false, true, null, firstDStore, true  ));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, secondDStore, true  ));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
-    
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-  
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
-
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      fail("Got interrupted exception while waiting for startSender to finish.");
-    }
-
-    Wait.pause(5000);
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-  
-  /**
-   * Enable persistence for Region. No persistence for GatewaySender. Kill the
-   * vm with regions and bring that up again. Check if the remote site receives
-   * all the event. again?
-   * 
-   */
-  @Test
-  public void testPersistentReplicatedRegionWithGatewaySender_Restart() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false,
-            100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2, false,
-            100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-
-    // verify if the queue has all the events
-    // vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
-    // ));
-    // vm5.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
-    // ));
-    //
-    // vm2.invoke(() -> WANTestBase.validateRegionSize(
-    // testName + "_RR", 0 ));
-    // vm3.invoke(() -> WANTestBase.validateRegionSize(
-    // testName + "_RR", 0 ));
-
-    // kill the vm
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-
-    LogWriterUtils.getLogWriter().info("Killed the sender. ");
-    // restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm4.invoke(() -> WANTestBase.createSender(
-        "ln", 2, false, 100, 10, false, false, null, true));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
-    vm5.invoke(() -> WANTestBase.createSender(
-        "ln", 2, false, 100, 10, false, false, null, true));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
-    
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
-
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
-    
-    AsyncInvocation inv1 =  vm4.invokeAsync(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      fail("Got interrupted exception while waiting for startSender to finish.");
-    }
-
-    Wait.pause(5000);
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-  
-  
-  /**
-   * Enable persistence for Region and persistence for GatewaySender. Kill the
-   * vm with regions and bring that up again. Check if the remote site receives
-   * all the event. again?
-   * In this case put is continuously happening while the vm is down.
-   */
-  @Test
-  public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart2() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    String firstDStore = (String)vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, null, true  ));
-    String secondDStore = (String)vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, null, true  ));
-
-    LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
-    LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-
-    // kill the vm
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-
-    LogWriterUtils.getLogWriter().info("Killed the sender. ");
-    // restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-      100, 10, false, true, null, firstDStore, true  ));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, false,
-            100, 10, false, true, null, secondDStore, true  ));
-    LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
-    
-    vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-  
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
-
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      fail("Got interrupted exception while waiting for startSender to finish.");
-    }
-
-    Wait.pause(5000);
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-  }
-}



[60/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverFactoryImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverFactoryImpl.java
deleted file mode 100644
index c5c2a2f..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverFactoryImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.ResourceEvent;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.GatewayReceiverCreation;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-
-/**
- * 
- * @since GemFire 7.0
- */
-public class GatewayReceiverFactoryImpl implements GatewayReceiverFactory {
-
-  private int startPort = GatewayReceiver.DEFAULT_START_PORT;
-  
-  private int endPort = GatewayReceiver.DEFAULT_END_PORT;
-  
-  private int timeBetPings = GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS;
-
-  private int socketBuffSize = GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE;
-
-  private String bindAdd= GatewayReceiver.DEFAULT_BIND_ADDRESS; 
-  
-  private String hostnameForSenders = GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS;  
-  
-  private boolean manualStart = GatewayReceiver.DEFAULT_MANUAL_START;
-
-  private List<GatewayTransportFilter> filters = new ArrayList<GatewayTransportFilter>();
-  
-  private Cache cache;
-
-  public GatewayReceiverFactoryImpl() {
-    
-  }
-  public GatewayReceiverFactoryImpl(Cache cache) {
-   this.cache = cache;
-  }
-  
-  public GatewayReceiverFactory addGatewayTransportFilter(
-      GatewayTransportFilter filter) {
-    this.filters.add(filter);
-    return this;
-  }
-
-  public GatewayReceiverFactory removeGatewayTransportFilter(
-      GatewayTransportFilter filter) {
-    this.filters.remove(filter);
-    return this;
-  }
-
-  public GatewayReceiverFactory setMaximumTimeBetweenPings(int time) {
-    this.timeBetPings = time;
-    return this;
-  }
-
-  public GatewayReceiverFactory setStartPort(int port) {
-    this.startPort = port;
-    return this;
-  }
-  
-  public GatewayReceiverFactory setEndPort(int port) {
-    this.endPort = port;
-    return this;
-  }
-  
-  public GatewayReceiverFactory setSocketBufferSize(int size) {
-    this.socketBuffSize = size;
-    return this;
-  }
-
-  public GatewayReceiverFactory setBindAddress(String address) {
-    this.bindAdd = address;
-    return this;
-  }
-  
-  public GatewayReceiverFactory setHostnameForSenders(String address) {
-    this.hostnameForSenders = address;
-    return this;
-  } 
-
-  public GatewayReceiverFactory setManualStart(boolean start) {
-    this.manualStart = start;
-    return this;
-  }
-  
-  public GatewayReceiver create() {
-    if (this.startPort > this.endPort) {
-      throw new IllegalStateException(
-          "Please specify either start port a value which is less than end port.");
-    }
-    GatewayReceiver recv = null;
-    if (this.cache instanceof GemFireCacheImpl) {
-      recv = new GatewayReceiverImpl(this.cache, this.startPort, this.endPort,
-          this.timeBetPings, this.socketBuffSize, this.bindAdd, this.filters,
-          this.hostnameForSenders, this.manualStart);
-      ((GemFireCacheImpl)cache).addGatewayReceiver(recv);
-      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
-      .getDistributedSystem();
-      system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_CREATE, recv);
-      if (!this.manualStart) {
-        try {
-          recv.start();
-        }
-        catch (IOException ioe) {
-          throw new GatewayReceiverException(
-              LocalizedStrings.GatewayReceiver_EXCEPTION_WHILE_STARTING_GATEWAY_RECEIVER
-                  .toLocalizedString(), ioe);
-        }
-      }
-    } else if (this.cache instanceof CacheCreation) {
-      recv = new GatewayReceiverCreation(this.cache, this.startPort, this.endPort,
-          this.timeBetPings, this.socketBuffSize, this.bindAdd, this.filters,
-          this.hostnameForSenders, this.manualStart);
-      ((CacheCreation)cache).addGatewayReceiver(recv);
-    }
-    return recv;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverImpl.java
deleted file mode 100644
index b8768d4..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewayReceiverImpl.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import java.io.IOException;
-import java.net.BindException;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.ResourceEvent;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.net.SocketCreator;
-import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-
-/**
- * @since GemFire 7.0
- */
-@SuppressWarnings("deprecation")
-public class GatewayReceiverImpl implements GatewayReceiver {
-
-  private static final Logger logger = LogService.getLogger();
-  
-  private String host;
-
-  private int startPort;
-  
-  private int endPort;
-  
-  private int port;
-
-  private int timeBetPings;
-
-  private int socketBufferSize;
-  
-  private boolean manualStart;
-
-  private final List<GatewayTransportFilter> filters;
-
-  private String bindAdd;
-  
-  private CacheServer receiver;
-
-  private final GemFireCacheImpl cache;
-  
-  public GatewayReceiverImpl(Cache cache, int startPort,
-      int endPort, int timeBetPings, int buffSize, String bindAdd,
-      List<GatewayTransportFilter> filters, String hostnameForSenders, boolean manualStart) {
-    this.cache = (GemFireCacheImpl)cache;
-    
-    /*
-     * If user has set hostNameForSenders then it should take precedence over
-     * bindAddress. If user hasn't set either hostNameForSenders or bindAddress
-     * then getLocalHost().getHostName() should be used.
-     */
-    if (hostnameForSenders == null || hostnameForSenders.isEmpty()) {
-      if (bindAdd == null || bindAdd.isEmpty()) {
-        try {
-          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiverImpl_USING_LOCAL_HOST));
-          this.host = SocketCreator.getLocalHost().getHostName();
-        } catch (UnknownHostException e) {
-          throw new IllegalStateException(
-              LocalizedStrings.GatewayReceiverImpl_COULD_NOT_GET_HOST_NAME
-                  .toLocalizedString(),
-              e);
-        }
-      } else {
-        this.host = bindAdd;
-      }
-    } else {
-      this.host = hostnameForSenders;
-    }
-
-    this.startPort = startPort;
-    this.endPort = endPort;
-    this.timeBetPings = timeBetPings;
-    this.socketBufferSize = buffSize;
-    this.bindAdd = bindAdd;
-    this.filters = filters;
-    this.manualStart = manualStart;
-  }
-
-  public List<GatewayTransportFilter> getGatewayTransportFilters() {
-    return this.filters;
-  }
-
-  public int getMaximumTimeBetweenPings() {
-    return this.timeBetPings;
-  }
-
-  public int getPort() {
-    return this.port;
-  }
-
-  public int getStartPort() {
-    return this.startPort;
-  }
-  
-  public int getEndPort() {
-    return this.endPort;
-  }
-  
-  public int getSocketBufferSize() {
-    return this.socketBufferSize;
-  }
-
-  public boolean isManualStart() {
-    return this.manualStart;
-  }
-  
-  public CacheServer getServer() {
-    return receiver;
-  }
-  
-  public void start() throws IOException {
-    if (receiver == null) {
-      receiver = this.cache.addCacheServer(true);
-    }
-    if (receiver.isRunning()) {
-      logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_IS_ALREADY_RUNNING));
-      return;
-    }
-    boolean started = false;
-    this.port = getPortToStart();
-    while (!started && this.port != -1) {
-      receiver.setPort(this.port);
-      receiver.setSocketBufferSize(socketBufferSize);
-      receiver.setMaximumTimeBetweenPings(timeBetPings);
-      receiver.setHostnameForClients(host);
-      receiver.setBindAddress(bindAdd);
-      receiver.setGroups(new String[] { GatewayReceiverImpl.RECEIVER_GROUP });
-      ((CacheServerImpl)receiver).setGatewayTransportFilter(this.filters);
-      try {
-        ((CacheServerImpl)receiver).start();
-        started = true;
-      } catch (BindException be) {
-        if (be.getCause() != null
-            && be.getCause().getMessage()
-                .contains("assign requested address")) {
-          throw new GatewayReceiverException(
-              LocalizedStrings.SocketCreator_FAILED_TO_CREATE_SERVER_SOCKET_ON_0_1
-                  .toLocalizedString(new Object[] { bindAdd,
-                      Integer.valueOf(this.port) }));
-        }
-        // ignore as this port might have been used by other threads.
-        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_Address_Already_In_Use, this.port));
-        this.port = getPortToStart();
-      } catch (SocketException se) {
-        if (se.getMessage().contains("Address already in use")) {
-          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_Address_Already_In_Use, this.port));
-          this.port = getPortToStart();
-
-        } else {
-          throw se;
-        }
-      }
-      
-    }
-    if (!started) {
-      throw new IllegalStateException(
-          "No available free port found in the given range.");
-    }
-    logger.info(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_STARTED_ON_PORT, this.port));
-
-    InternalDistributedSystem system = this.cache.getDistributedSystem();
-    system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_START, this);
-
-  }
-  
-  private int getPortToStart(){
-    // choose a random port from the given port range
-    int rPort;
-    if (this.startPort == this.endPort) {
-      rPort = this.startPort;
-    } else {
-      rPort = AvailablePort.getRandomAvailablePortInRange(this.startPort,
-          this.endPort, AvailablePort.SOCKET);
-    }
-    return rPort;
-  }
-  
-  public void stop() {
-    if(!isRunning()){
-      throw new GatewayReceiverException(LocalizedStrings.GatewayReceiver_IS_NOT_RUNNING.toLocalizedString());
-    }
-    receiver.stop();
-
-//    InternalDistributedSystem system = ((GemFireCacheImpl) this.cache)
-//        .getDistributedSystem();
-//    system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_STOP, this);
-
-  }
-
-  public String getHost() {
-    return this.host;
-  }
-
-  public String getBindAddress() {
-    return this.bindAdd;
-  }
-
-  public boolean isRunning() {
-    if (this.receiver != null) {
-      return this.receiver.isRunning();
-    }
-    return false;
-  }
-  
-  public String toString() {
-    return new StringBuffer()
-      .append("Gateway Receiver")
-      .append("@").append(Integer.toHexString(hashCode()))
-      .append(" [")
-      .append("host='").append(getHost())
-      .append("'; port=").append(getPort())
-      .append("; bindAddress=").append(getBindAddress())
-      .append("; maximumTimeBetweenPings=").append(getMaximumTimeBetweenPings())
-      .append("; socketBufferSize=").append(getSocketBufferSize())
-      .append("; isManualStart=").append(isManualStart())
-      .append("; group=").append(Arrays.toString(new String[]{GatewayReceiverImpl.RECEIVER_GROUP}))
-      .append("]")
-      .toString();
-  }
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
deleted file mode 100644
index d2302c4..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
+++ /dev/null
@@ -1,802 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import com.gemstone.gemfire.GemFireIOException;
-import com.gemstone.gemfire.internal.cache.tier.sockets.MessageTooLargeException;
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.CancelException;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.RegionDestroyedException;
-import com.gemstone.gemfire.cache.client.ServerConnectivityException;
-import com.gemstone.gemfire.cache.client.ServerOperationException;
-import com.gemstone.gemfire.cache.client.internal.Connection;
-import com.gemstone.gemfire.cache.client.internal.pooling.ConnectionDestroyedException;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.pdx.PdxRegistryMismatchException;
-import com.gemstone.gemfire.security.GemFireSecurityException;
-import com.gemstone.gemfire.cache.client.internal.SenderProxy;
-
-/**
- * @since GemFire 7.0
- *
- */
-public class GatewaySenderEventRemoteDispatcher implements
-    GatewaySenderEventDispatcher {
-
-  private static final Logger logger = LogService.getLogger();
-  
-  private final AbstractGatewaySenderEventProcessor processor;
-
-  private volatile Connection connection;
-
-  private final Set<String> notFoundRegions = new HashSet<String>();
-  
-  private final Object notFoundRegionsSync = new Object();
-  
-  private final AbstractGatewaySender sender;
-  
-  private AckReaderThread ackReaderThread;
-  
-  private ReentrantReadWriteLock connectionLifeCycleLock = new ReentrantReadWriteLock();
-  
-  /**
-   * This count is reset to 0 each time a successful connection is made.
-   */
-  private int failedConnectCount = 0;
-  
-  public GatewaySenderEventRemoteDispatcher(AbstractGatewaySenderEventProcessor eventProcessor) {
-    this.processor = eventProcessor;
-    this.sender = eventProcessor.getSender();
-//    this.ackReaderThread = new AckReaderThread(sender);
-    try {
-      initializeConnection();
-    }
-    catch (GatewaySenderException e) {
-      if (e.getCause() instanceof GemFireSecurityException) {
-        throw e;
-      }
-    }
-  }
-  
-  protected GatewayAck readAcknowledgement() {
-    SenderProxy sp = new SenderProxy(this.processor.getSender().getProxy());
-    GatewayAck ack = null;
-    Exception ex;
-    try {
-      connection = getConnection(false);
-      if (logger.isDebugEnabled()) {
-        logger.debug(" Receiving ack on the thread {}", connection);
-      }
-      this.connectionLifeCycleLock.readLock().lock();
-      try {
-        if (connection != null) {
-          ack = (GatewayAck)sp.receiveAckFromReceiver(connection);
-        }
-      } finally {
-        this.connectionLifeCycleLock.readLock().unlock();
-      }
-
-    } catch (Exception e) {
-      Throwable t = e.getCause();
-      if (t instanceof BatchException70) {
-        // A BatchException has occurred.
-        // Do not process the connection as dead since it is not dead.
-        ex = (BatchException70)t;
-      } else if (e instanceof GatewaySenderException) { //This Exception is thrown from getConnection
-        ex = (Exception) e.getCause();
-      }else {
-        ex = e;
-        // keep using the connection if we had a batch exception. Else, destroy
-        // it
-        destroyConnection();
-      }
-      if (this.sender.getProxy() == null || this.sender.getProxy().isDestroyed()) {
-        // if our pool is shutdown then just be silent
-      } else if (ex instanceof IOException
-          || (ex instanceof ServerConnectivityException && !(ex.getCause() instanceof PdxRegistryMismatchException))
-          || ex instanceof ConnectionDestroyedException) {
-        // If the cause is an IOException or a ServerException, sleep and retry.
-        // Sleep for a bit and recheck.
-        try {
-          Thread.sleep(100);
-        } catch (InterruptedException ie) {
-          Thread.currentThread().interrupt();
-        }
-      } else {
-        if (!(ex instanceof CancelException)) {
-          logger.fatal(LocalizedMessage.create(
-                  LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH),
-                  ex);
-        }
-        this.processor.setIsStopped(true);
-      }
-    }
-    return ack;
-  }
-  
-  @Override
-  public boolean dispatchBatch(List events, boolean isRetry) {
-    GatewaySenderStats statistics = this.sender.getStatistics();
-    boolean success = false;
-    try {
-      long start = statistics.startTime();
-      success =_dispatchBatch(events, isRetry);
-      if (success) {
-        statistics.endBatch(start, events.size());
-      }
-    } catch (GatewaySenderException ge) {
-
-      Throwable t = ge.getCause();
-      if (this.sender.getProxy() == null || this.sender.getProxy().isDestroyed()) {
-        // if our pool is shutdown then just be silent
-      } else if (t instanceof IOException
-          || t instanceof ServerConnectivityException
-          || t instanceof ConnectionDestroyedException
-          || t instanceof MessageTooLargeException
-          || t instanceof IllegalStateException) {
-        this.processor.handleException();
-        // If the cause is an IOException or a ServerException, sleep and retry.
-        // Sleep for a bit and recheck.
-        try {
-          Thread.sleep(100);
-        } catch (InterruptedException ie) {
-          Thread.currentThread().interrupt();
-        }
-        if (logger.isDebugEnabled()) {
-          logger.debug("Because of IOException, failed to dispatch a batch with id : {}", this.processor.getBatchId());
-        }
-      }
-      else {
-        logger.fatal(LocalizedMessage.create(
-            LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH), ge);
-        this.processor.setIsStopped(true);
-      }
-    }
-    catch (CancelException e) {
-      if (logger.isDebugEnabled()) {
-        logger.debug("Stopping the processor because cancellation occurred while processing a batch");
-      }
-      this.processor.setIsStopped(true);
-      throw e;
-    } catch (Exception e) {
-      this.processor.setIsStopped(true);
-      logger.fatal(LocalizedMessage.create(
-              LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH),
-              e);
-    }
-    return success;
-  }
-
-  private boolean _dispatchBatch(List events, boolean isRetry) {
-    Exception ex = null;
-    int currentBatchId = this.processor.getBatchId();
-    connection = getConnection(true);
-    int batchIdForThisConnection = this.processor.getBatchId();
-    GatewaySenderStats statistics = this.sender.getStatistics();
-    // This means we are writing to a new connection than the previous batch.
-    // i.e The connection has been reset. It also resets the batchId.
-    if (currentBatchId != batchIdForThisConnection
-        || this.processor.isConnectionReset()) {
-      return false;
-    }
-    try {
-      if (this.processor.isConnectionReset()) {
-        isRetry = true;
-      }
-      SenderProxy sp = new SenderProxy(this.sender.getProxy());
-      this.connectionLifeCycleLock.readLock().lock();
-      try {
-        if (connection != null) {
-          sp.dispatchBatch_NewWAN(connection, events, currentBatchId, isRetry);
-          if (logger.isDebugEnabled()) {
-            logger.debug("{} : Dispatched batch (id={}) of {} events, queue size: {} on connection {}",
-                this.processor.getSender(), currentBatchId,  events.size(), this.processor.getQueue().size(), connection);
-          }
-        } else {
-          throw new ConnectionDestroyedException();
-        }
-      }
-      finally{
-        this.connectionLifeCycleLock.readLock().unlock();
-      }
-      return true;
-    }
-    catch (ServerOperationException e) {
-      Throwable t = e.getCause();
-      if (t instanceof BatchException70) {
-        // A BatchException has occurred.
-        // Do not process the connection as dead since it is not dead.
-        ex = (BatchException70)t;
-      }
-      else {
-        ex = e;
-        // keep using the connection if we had a batch exception. Else, destroy it
-        destroyConnection();
-      }
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
-              new Object[] {this, Integer.valueOf(currentBatchId), connection}), ex);
-    }
-    catch (GemFireIOException e) {
-      Throwable t = e.getCause();
-      if (t instanceof MessageTooLargeException) {
-        // A MessageTooLargeException has occurred.
-        // Do not process the connection as dead since it is not dead.
-        ex = (MessageTooLargeException)t;
-        // Reduce the batch size by half of the configured batch size or number of events in the current batch (whichever is less)
-        int newBatchSize = Math.min(events.size(), this.processor.getBatchSize())/2;
-        logger.warn(LocalizedMessage.create(
-            LocalizedStrings.GatewaySenderEventRemoteDispatcher_MESSAGE_TOO_LARGE_EXCEPTION, new Object[] { events.size(), newBatchSize }), e);
-        this.processor.setBatchSize(newBatchSize);
-        statistics.incBatchesResized();
-      }
-      else {
-        ex = e;
-        // keep using the connection if we had a MessageTooLargeException. Else, destroy it
-        destroyConnection();
-      }
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
-              new Object[] {this, Integer.valueOf(currentBatchId), connection}), ex);
-    }
-    catch (IllegalStateException e) {
-      this.processor.setException(new GatewaySenderException(e));
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
-              new Object[] {this, Integer.valueOf(currentBatchId), connection}), e);
-    }
-    catch (Exception e) {
-      // An Exception has occurred. Get its cause.
-      Throwable t = e.getCause();
-      if (t instanceof IOException) {
-        // An IOException has occurred.
-        ex = (IOException)t;
-      } else {
-        ex = e;
-      }
-      //the cause is not going to be BatchException70. So, destroy the connection
-      destroyConnection();
-      
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewayEventRemoteDispatcher_0_EXCEPTION_DURING_PROCESSING_BATCH_1_ON_CONNECTION_2.toLocalizedString(
-              new Object[] {this, Integer.valueOf(currentBatchId), connection}), ex);
-    }
-  }
-  
-  /**
-   * Acquires or adds a new <code>Connection</code> to the corresponding
-   * <code>Gateway</code>
-   *
-   * @return the <code>Connection</code>
-   *
-   * @throws GatewaySenderException
-   */
-  public Connection getConnection(boolean startAckReaderThread) throws GatewaySenderException{
-    if (this.processor.isStopped()) {
-      return null;
-    }
-    // IF the connection is null 
-    // OR the connection's ServerLocation doesn't match with the one stored in sender
-    // THEN initialize the connection
-    if(!this.sender.isParallel()) {
-      if (this.connection == null || this.connection.isDestroyed()
-          || !this.connection.getServer().equals(this.sender.getServerLocation())) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Initializing new connection as serverLocation of old connection is : {} and the serverLocation to connect is {}",
-              ((this.connection == null) ? "null" : this.connection.getServer()),
-              this.sender.getServerLocation());
-        }
-        // Initialize the connection
-        initializeConnection();
-      }
-    } else {
-      if (this.connection == null || this.connection.isDestroyed()) {
-        initializeConnection();
-      }
-    }
-    
-    // Here we might wait on a connection to another server if I was secondary
-    // so don't start waiting until I am primary
-    Cache cache = this.sender.getCache();
-    if (cache != null && !cache.isClosed()) {
-      if (this.sender.isPrimary() && (this.connection != null)) {
-        if (this.ackReaderThread == null || !this.ackReaderThread.isRunning()) {
-          this.ackReaderThread = new AckReaderThread(this.sender, this.processor);
-          this.ackReaderThread.start();
-          this.ackReaderThread.waitForRunningAckReaderThreadRunningState();
-        }
-      }
-    }
-    return this.connection;
-  }
-  
-  public void destroyConnection() {
-    this.connectionLifeCycleLock.writeLock().lock();
-    try {
-      Connection con = this.connection;
-      if (con != null) {
-        if (!con.isDestroyed()) {
-          con.destroy();
-          this.sender.getProxy().returnConnection(con);
-        }
-        
-        // Reset the connection so the next time through a new one will be
-        // obtained
-        this.connection = null;
-        this.sender.setServerLocation(null);
-      }
-    }
-    finally {
-      this.connectionLifeCycleLock.writeLock().unlock();
-    }
-  }
-
-  /**
-   * Initializes the <code>Connection</code>.
-   *
-   * @throws GatewaySenderException
-   */
-  private void initializeConnection() throws GatewaySenderException,
-      GemFireSecurityException {
-    this.connectionLifeCycleLock.writeLock().lock(); 
-    try {
-      // Attempt to acquire a connection
-      if (this.sender.getProxy() == null
-          || this.sender.getProxy().isDestroyed()) {
-        this.sender.initProxy();
-      } else {
-        this.processor.resetBatchId();
-      }
-      Connection con;
-      try {
-        if (this.sender.isParallel()) {
-          /*
-           * TODO - The use of acquireConnection should be removed
-           * from the gateway code. This method is fine for tests,
-           * but these connections should really be managed inside
-           * the pool code. If the gateway needs to persistent connection
-           * to a single server, which should create have the OpExecutor
-           * that holds a reference to the connection (similar to the way
-           * we do with thread local connections).
-           * Use {@link ExecutablePool#setupServerAffinity(boolean)} for
-           * gateway code
-           */
-          con = this.sender.getProxy().acquireConnection();
-          // For parallel sender, setting server location will not matter.
-          // everytime it will ask for acquire connection whenever it needs it. I
-          // am saving this server location for command purpose
-          sender.setServerLocation(con.getServer());  
-        } else {
-          synchronized (this.sender
-              .getLockForConcurrentDispatcher()) {
-            ServerLocation server = this.sender.getServerLocation();
-            if (server != null) {
-              if (logger.isDebugEnabled()) {
-                logger.debug("ServerLocation is: {}. Connecting to this serverLocation...", server);
-              }
-              con = this.sender.getProxy().acquireConnection(server);
-            } else {
-              if (logger.isDebugEnabled()) {
-                logger.debug("ServerLocation is null. Creating new connection. ");
-              }
-              con = this.sender.getProxy().acquireConnection();
-              // Acquired connection from pool!! Update the server location
-              // information in the sender and
-              // distribute the information to other senders ONLY IF THIS SENDER
-              // IS
-              // PRIMARY
-              if (this.sender.isPrimary()) {
-                if (sender.getServerLocation() == null) {
-                  sender.setServerLocation(con.getServer());
-                }
-                new UpdateAttributesProcessor(this.sender).distribute(false);
-              }
-            }
-          }
-        }
-      } catch (ServerConnectivityException e) {
-        this.failedConnectCount++;
-        Throwable ex = null;
-
-        if (e.getCause() instanceof GemFireSecurityException) {
-          ex = e.getCause();
-          if (logConnectionFailure()) {
-            // only log this message once; another msg is logged once we connect
-            logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_0_COULD_NOT_CONNECT_1,
-                new Object[] { this.processor.getSender().getId(), ex.getMessage() }));
-          }
-          throw new GatewaySenderException(ex);
-        }
-        List<ServerLocation> servers = this.sender.getProxy()
-            .getCurrentServers();
-        String ioMsg = null;
-        if (servers.size() == 0) {
-          ioMsg = LocalizedStrings.GatewayEventRemoteDispatcher_THERE_ARE_NO_ACTIVE_SERVERS
-              .toLocalizedString();
-        } else {
-          final StringBuilder buffer = new StringBuilder();
-          for (ServerLocation server : servers) {
-            String endpointName = String.valueOf(server);
-            if (buffer.length() > 0) {
-              buffer.append(", ");
-            }
-            buffer.append(endpointName);
-          }
-          ioMsg = LocalizedStrings.GatewayEventRemoteDispatcher_NO_AVAILABLE_CONNECTION_WAS_FOUND_BUT_THE_FOLLOWING_ACTIVE_SERVERS_EXIST_0
-              .toLocalizedString(buffer.toString());
-        }
-        ex = new IOException(ioMsg);
-        // Set the serverLocation to null so that a new connection can be
-        // obtained in next attempt
-        this.sender.setServerLocation(null);
-        if (this.failedConnectCount == 1) {
-          // only log this message once; another msg is logged once we connect
-          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT,
-                  this.processor.getSender().getId()));
-
-        }
-        // Wrap the IOException in a GatewayException so it can be processed the
-        // same as the other exceptions that might occur in sendBatch.
-        throw new GatewaySenderException(
-            LocalizedStrings.GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT
-                .toLocalizedString(this.processor.getSender().getId()), ex);
-      }
-      if (this.failedConnectCount > 0) {
-        Object[] logArgs = new Object[] { this.processor.getSender().getId(),
-            con, Integer.valueOf(this.failedConnectCount) };
-        logger.info(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_0_USING_1_AFTER_2_FAILED_CONNECT_ATTEMPTS,
-                logArgs));
-        this.failedConnectCount = 0;
-      } else {
-        Object[] logArgs = new Object[] { this.processor.getSender().getId(),
-            con };
-        logger.info(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_0_USING_1, logArgs));
-      }
-      this.connection = con;
-      this.processor.checkIfPdxNeedsResend(this.connection.getQueueStatus().getPdxSize());
-    }
-    catch (ConnectionDestroyedException e) {
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewayEventRemoteDispatcher__0___COULD_NOT_CONNECT.toLocalizedString(this.processor
-              .getSender().getId()), e);
-    }
-    finally {
-      this.connectionLifeCycleLock.writeLock().unlock();
-    }
-  }
-
-  protected boolean logConnectionFailure() {
-    // always log the first failure
-	if (logger.isDebugEnabled() || this.failedConnectCount == 0) {
-	  return true;
-	}
-	else {
-	  // subsequent failures will be logged on 30th, 300th, 3000th try
-	  // each try is at 100millis from higher layer so this accounts for logging
-	  // after 3s, 30s and then every 5mins
-	  if (this.failedConnectCount >= 3000) {
-	    return (this.failedConnectCount % 3000) == 0;
-	  }
-	  else {
-	    return (this.failedConnectCount == 30 || this.failedConnectCount == 300);
-	  }
-    }
-  }
-  
-  public static class GatewayAck {
-    private int batchId;
-
-    private int numEvents;
-
-    private BatchException70 be;
-
-    public GatewayAck(BatchException70 be, int bId) {
-      this.be = be;
-      this.batchId = bId;
-    }
-
-    public GatewayAck(int batchId, int numEvents) {
-      this.batchId = batchId;
-      this.numEvents = numEvents;
-    }
-
-    /**
-     * @return the numEvents
-     */
-    public int getNumEvents() {
-      return numEvents;
-    }
-
-    /**
-     * @return the batchId
-     */
-    public int getBatchId() {
-      return batchId;
-    }
-
-    public BatchException70 getBatchException() {
-      return this.be;
-    }
-  }
-    
-  class AckReaderThread extends Thread {
-
-    private Object runningStateLock = new Object();
-
-    /**
-     * boolean to make a shutdown request
-     */
-    private volatile boolean shutdown = false;
-
-    private final GemFireCacheImpl cache;
-
-    private volatile boolean ackReaderThreadRunning = false;
-
-    public AckReaderThread(GatewaySender sender, AbstractGatewaySenderEventProcessor processor) {
-      super("AckReaderThread for : " + processor.getName());
-      this.setDaemon(true);
-      this.cache = (GemFireCacheImpl)((AbstractGatewaySender)sender).getCache();
-    }
-
-    public void waitForRunningAckReaderThreadRunningState() {
-      synchronized (runningStateLock) {
-        while (!this.ackReaderThreadRunning) {
-          try {
-            this.runningStateLock.wait();
-          } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            break;
-          }
-        }
-      }
-    }
-
-    private boolean checkCancelled() {
-      if (shutdown) {
-        return true;
-      }
-
-      if (cache.getCancelCriterion().isCancelInProgress()) {
-        return true;
-      }
-      return false;
-    }
-
-    @Override
-    public void run() {
-      if (logger.isDebugEnabled()) {
-        logger.debug("AckReaderThread started.. ");
-      }
-
-      synchronized (runningStateLock) {
-        ackReaderThreadRunning = true;
-        this.runningStateLock.notifyAll();
-      }
-
-      try {
-        for (;;) {
-          if (checkCancelled()) {
-            break;
-          }
-          GatewayAck ack = readAcknowledgement();
-          if (ack != null) {
-            boolean gotBatchException = ack.getBatchException() != null;
-            int batchId = ack.getBatchId();
-            int numEvents = ack.getNumEvents();
-
-            // If the batch is successfully processed, remove it from the
-            // queue.
-            if (gotBatchException) {
-              logger.info(LocalizedMessage.create(
-                  LocalizedStrings.GatewaySenderEventRemoteDispatcher_GATEWAY_SENDER_0_RECEIVED_ACK_FOR_BATCH_ID_1_WITH_EXCEPTION,
-                      new Object[] { processor.getSender(), ack.getBatchId() }, ack.getBatchException()));
-              // If we get PDX related exception in the batch exception then try
-              // to resend all the pdx events as well in the next batch.
-              final GatewaySenderStats statistics = sender.getStatistics();
-              statistics.incBatchesRedistributed();
-              // log batch exceptions and remove all the events if remove from
-              // exception is true
-              // do not remove if it is false
-              logBatchExceptions(ack.getBatchException());
-              processor.handleSuccessBatchAck(batchId);
-
-            } // unsuccessful batch
-            else { // The batch was successful.
-              if (logger.isDebugEnabled()) {
-                logger.debug("Gateway Sender {} : Received ack for batch id {} of {} events",
-                    processor.getSender(), ack.getBatchId(), ack.getNumEvents());
-              }
-              processor.handleSuccessBatchAck(batchId);
-            }
-          } else {
-            // If we have received IOException.
-            if (logger.isDebugEnabled()) {
-              logger.debug("{}: Received null ack from remote site.", processor.getSender());
-            }
-            processor.handleException();
-            try { // This wait is before trying to getting new connection to
-                  // receive ack. Without this there will be continuous call to
-                  // getConnection
-              Thread.sleep(GatewaySender.CONNECTION_RETRY_INTERVAL);
-            } catch (InterruptedException e) {
-              Thread.currentThread().interrupt();
-            }
-          }
-        }
-      } catch (Exception e) {
-        if (!checkCancelled()) {
-          logger.fatal(LocalizedMessage.create(
-              LocalizedStrings.GatewayEventRemoteDispatcher_STOPPING_THE_PROCESSOR_BECAUSE_THE_FOLLOWING_EXCEPTION_OCCURRED_WHILE_PROCESSING_A_BATCH) ,e);
-        }
-        sender.getLifeCycleLock().writeLock().lock();
-        try {
-          processor.stopProcessing();
-          sender.clearTempEventsAfterSenderStopped();
-        } finally {
-          sender.getLifeCycleLock().writeLock().unlock();
-        }
-        // destroyConnection();
-      } finally {
-        if (logger.isDebugEnabled()) {
-          logger.debug("AckReaderThread exiting. ");
-        }
-        ackReaderThreadRunning = false;
-      }
-
-    }
-
-    /**
-     * @param exception 
-     * 
-     */
-    private void logBatchExceptions(BatchException70 exception) {
-      for (BatchException70 be : exception.getExceptions()) {
-        boolean logWarning = true;
-        if (be.getCause() instanceof RegionDestroyedException) {
-          RegionDestroyedException rde = (RegionDestroyedException)be
-              .getCause();
-          synchronized (notFoundRegionsSync) {
-            if (notFoundRegions.contains(rde.getRegionFullPath())) {
-              logWarning = false;
-            } else {
-              notFoundRegions.add(rde.getRegionFullPath());
-            }
-          }
-        } else if (be.getCause() instanceof IllegalStateException
-            && be.getCause().getMessage().contains("Unknown pdx type")) {
-          List<GatewaySenderEventImpl> pdxEvents = processor
-              .getBatchIdToPDXEventsMap().get(be.getBatchId());
-          if (logWarning) {
-            logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_A_BATCHEXCEPTION_OCCURRED_PROCESSING_PDX_EVENT__0,
-                    be.getIndex()), be);
-          }
-          if (pdxEvents != null) {
-            for (GatewaySenderEventImpl senderEvent : pdxEvents) {
-              senderEvent.isAcked = false;
-            }
-            GatewaySenderEventImpl gsEvent = pdxEvents.get(be.getIndex());
-            if (logWarning) {
-              logger.warn(LocalizedMessage.create(
-                  LocalizedStrings.GatewayEventRemoteDispatcher_THE_EVENT_BEING_PROCESSED_WHEN_THE_BATCHEXCEPTION_OCCURRED_WAS__0, gsEvent));
-            }
-          }
-          continue;
-        }
-        if (logWarning) {
-          logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayEventRemoteDispatcher_A_BATCHEXCEPTION_OCCURRED_PROCESSING_EVENT__0,
-              be.getIndex()), be);
-        }
-        List<GatewaySenderEventImpl>[] eventsArr = processor.getBatchIdToEventsMap().get(be.getBatchId()); 
-        if (eventsArr != null) {
-          List<GatewaySenderEventImpl> filteredEvents = eventsArr[1];
-          GatewaySenderEventImpl gsEvent = (GatewaySenderEventImpl)filteredEvents
-              .get(be.getIndex());
-          if (logWarning) {
-            logger.warn(LocalizedMessage.create(
-                LocalizedStrings.GatewayEventRemoteDispatcher_THE_EVENT_BEING_PROCESSED_WHEN_THE_BATCHEXCEPTION_OCCURRED_WAS__0, gsEvent));
-          }
-        }
-      }
-    }
-
-    boolean isRunning() {
-      return this.ackReaderThreadRunning;
-    }
-
-    public void shutdown() {
-      // we need to destroy connection irrespective of we are listening on it or
-      // not. No need to take lock as the reader thread may be blocked and we might not
-      // get chance to destroy unless that returns.
-      if (connection != null) {
-        Connection conn = connection;
-        shutDownAckReaderConnection();
-        if (!conn.isDestroyed()) {
-          conn.destroy();
-          sender.getProxy().returnConnection(conn);
-        }
-      }
-      this.shutdown = true;
-      boolean interrupted = Thread.interrupted();
-      try {
-        this.join(15 * 1000);
-      } catch (InterruptedException e) {
-        interrupted = true;
-      } finally {
-        if (interrupted) {
-          Thread.currentThread().interrupt();
-        }
-      }
-      if (this.isAlive()) {
-        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_ACKREADERTHREAD_IGNORED_CANCELLATION));
-      }
-    }
-
-    private void shutDownAckReaderConnection() {
-      Connection conn = connection;
-      //attempt to unblock the ackReader thread by shutting down the inputStream, if it was stuck on a read
-      try {
-        if (conn != null && conn.getInputStream() != null) {
-          conn.getInputStream().close();
-        }
-      } catch (IOException e) {
-        logger.warn("Unable to shutdown AckReaderThread Connection");
-      } catch (ConnectionDestroyedException e) {
-        logger.info("AckReader shutting down and connection already destroyed");
-      }
-
-    }
-  }
-    
-  public void stopAckReaderThread() {
-    if (this.ackReaderThread != null) {
-      this.ackReaderThread.shutdown();
-    }
-  }
-  
-  @Override
-  public boolean isRemoteDispatcher() {
-    return true;
-  }
-
-  @Override
-  public boolean isConnectedToRemote() {
-      return connection != null;
-  }
-  
-  public void stop() {
-    stopAckReaderThread();
-    if(this.processor.isStopped()) {
-      destroyConnection();
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderFactoryImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderFactoryImpl.java
deleted file mode 100644
index 4974c6f..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderFactoryImpl.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.client.internal.LocatorDiscoveryCallback;
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewayEventSubstitutionFilter;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderImpl;
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderImpl;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.ParallelGatewaySenderCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.SerialGatewaySenderCreation;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-
-/**
- * 
- * @since GemFire 7.0
- * 
- */
-public class GatewaySenderFactoryImpl implements
-    InternalGatewaySenderFactory {
-
-  private static final Logger logger = LogService.getLogger();
-  
-  /**
-   * Used internally to pass the attributes from this factory to the real
-   * GatewaySender it is creating.
-   */
-  private GatewaySenderAttributes attrs = new GatewaySenderAttributes();
-
-  private Cache cache;
-
-  private static final AtomicBoolean GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY_CHECKED = new AtomicBoolean(false);
-
-  public GatewaySenderFactoryImpl(Cache cache) {
-    this.cache = cache;
-  }
-
-  public GatewaySenderFactory setParallel(boolean isParallel){
-    this.attrs.isParallel = isParallel;
-    return this;
-  }
-  
-  public GatewaySenderFactory setForInternalUse(boolean isForInternalUse) {
-    this.attrs.isForInternalUse = isForInternalUse;
-    return this;
-  }
-  
-  public GatewaySenderFactory addGatewayEventFilter(
-      GatewayEventFilter filter) {
-    this.attrs.addGatewayEventFilter(filter);
-    return this;
-  }
-
-  public GatewaySenderFactory addGatewayTransportFilter(
-      GatewayTransportFilter filter) {
-    this.attrs.addGatewayTransportFilter(filter);
-    return this;
-  }
-
-  public GatewaySenderFactory addAsyncEventListener(
-      AsyncEventListener listener) {
-    this.attrs.addAsyncEventListener(listener);
-    return this;
-  }
-  
-  public GatewaySenderFactory setSocketBufferSize(int socketBufferSize) {
-    this.attrs.socketBufferSize = socketBufferSize;
-    return this;
-  }
-
-  public GatewaySenderFactory setSocketReadTimeout(int socketReadTimeout) {
-    this.attrs.socketReadTimeout = socketReadTimeout;
-    return this;
-  }
-
-  public GatewaySenderFactory setDiskStoreName(String diskStoreName) {
-    this.attrs.diskStoreName = diskStoreName;
-    return this;
-  }
-
-  public GatewaySenderFactory setMaximumQueueMemory(int maximumQueueMemory) {
-    this.attrs.maximumQueueMemory = maximumQueueMemory;
-    return this;
-  }
-
-  public GatewaySenderFactory setBatchSize(int batchSize) {
-    this.attrs.batchSize = batchSize;
-    return this;
-  }
-
-  public GatewaySenderFactory setBatchTimeInterval(int batchTimeInterval) {
-    this.attrs.batchTimeInterval = batchTimeInterval;
-    return this;
-  }
-
-  public GatewaySenderFactory setBatchConflationEnabled(
-      boolean enableBatchConflation) {
-    this.attrs.isBatchConflationEnabled = enableBatchConflation;
-    return this;
-  }
-
-  public GatewaySenderFactory setPersistenceEnabled(
-      boolean enablePersistence) {
-    this.attrs.isPersistenceEnabled = enablePersistence;
-    return this;
-  }
-
-  public GatewaySenderFactory setAlertThreshold(int threshold) {
-    this.attrs.alertThreshold = threshold;
-    return this;
-  }
-
-  public GatewaySenderFactory setManualStart(boolean start) {
-    this.attrs.manualStart = start;
-    return this;
-  }
-
-  public GatewaySenderFactory setLocatorDiscoveryCallback(
-      LocatorDiscoveryCallback locCallback) {
-    this.attrs.locatorDiscoveryCallback = locCallback;
-    return this;
-  }
-
-  @Override
-  public GatewaySenderFactory setDiskSynchronous(boolean isSynchronous) {
-    this.attrs.isDiskSynchronous = isSynchronous;
-    return this;
-  }
-  
-  @Override
-  public GatewaySenderFactory setDispatcherThreads(int numThreads) {
-    if ((numThreads > 1) && this.attrs.policy == null) {
-      this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
-    }
-    this.attrs.dispatcherThreads = numThreads;
-    return this;
-  }
-
-  public GatewaySenderFactory setParallelFactorForReplicatedRegion(int parallel) {
-    this.attrs.parallelism = parallel;
-    this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
-    return this;
-  }    
-    
-  @Override
-  public GatewaySenderFactory setOrderPolicy(OrderPolicy policy) {
-    this.attrs.policy = policy;
-    return this;
-  }
-  
-  public GatewaySenderFactory setBucketSorted(boolean isBucketSorted){
-    this.attrs.isBucketSorted = isBucketSorted;
-    return this;
-  }
-  public GatewaySender create(String id, int remoteDSId) {
-    int myDSId = InternalDistributedSystem.getAnyInstance()
-        .getDistributionManager().getDistributedSystemId();
-    if (remoteDSId == myDSId) {
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewaySenderImpl_GATEWAY_0_CANNOT_BE_CREATED_WITH_REMOTE_SITE_ID_EQUAL_TO_THIS_SITE_ID
-              .toLocalizedString(id));
-    }
-    if (remoteDSId < 0) {
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewaySenderImpl_GATEWAY_0_CANNOT_BE_CREATED_WITH_REMOTE_SITE_ID_LESS_THAN_ZERO
-              .toLocalizedString(id));
-    }
-    this.attrs.id = id;
-    this.attrs.remoteDs = remoteDSId;
-    GatewaySender sender = null;
-
-    if(this.attrs.getDispatcherThreads() <= 0){
-      throw new GatewaySenderException(
-          LocalizedStrings.GatewaySenderImpl_GATEWAY_SENDER_0_CANNOT_HAVE_DISPATCHER_THREADS_LESS_THAN_1
-              .toLocalizedString(id));
-    }
-
-    // Verify socket read timeout if a proper logger is available
-    if (this.cache instanceof GemFireCacheImpl) {
-      // If socket read timeout is less than the minimum, log a warning.
-      // Ideally, this should throw a GatewaySenderException, but wan dunit tests
-      // were failing, and we were running out of time to change them.
-      if (this.attrs.getSocketReadTimeout() != 0
-          && this.attrs.getSocketReadTimeout() < GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT) {
-        logger.warn(LocalizedMessage.create(LocalizedStrings.Gateway_CONFIGURED_SOCKET_READ_TIMEOUT_TOO_LOW,
-            new Object[] { "GatewaySender " + id, this.attrs.getSocketReadTimeout(), GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT }));
-        this.attrs.socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT;
-      }
-
-      // Log a warning if the old system property is set.
-      if (GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY_CHECKED.compareAndSet(false, true)) {
-        if (System.getProperty(GatewaySender.GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY) != null) {
-          logger.warn(LocalizedMessage.create(LocalizedStrings.Gateway_OBSOLETE_SYSTEM_POPERTY,
-              new Object[] { GatewaySender.GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY, "GatewaySender socket read timeout" }));
-        }
-      }
-    }
-
-    if (this.attrs.isParallel()) {
-//      if(this.attrs.getDispatcherThreads() != 1){
-//        throw new GatewaySenderException(
-//            LocalizedStrings.GatewaySenderImpl_PARALLEL_GATEWAY_SENDER_0_CANNOT_BE_CREATED_WITH_DISPATCHER_THREADS_OTHER_THAN_1
-//                .toLocalizedString(id));
-//      }
-      if ((this.attrs.getOrderPolicy() != null)
-          && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) {
-        throw new GatewaySenderException(
-            LocalizedStrings.GatewaySenderImpl_PARALLEL_GATEWAY_SENDER_0_CANNOT_BE_CREATED_WITH_ORDER_POLICY_1
-                .toLocalizedString(id, this.attrs.getOrderPolicy()));
-      }
-      if (this.cache instanceof GemFireCacheImpl) {
-        sender = new ParallelGatewaySenderImpl(this.cache, this.attrs);
-        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
-        
-        if (!this.attrs.isManualStart()) {
-          sender.start();
-        }
-      }
-      else if (this.cache instanceof CacheCreation) {
-        sender = new ParallelGatewaySenderCreation(this.cache, this.attrs);
-        ((CacheCreation)this.cache).addGatewaySender(sender);
-      }
-    }
-    else {
-      if (this.attrs.getAsyncEventListeners().size() > 0) {
-        throw new GatewaySenderException(
-            LocalizedStrings.SerialGatewaySenderImpl_GATEWAY_0_CANNOT_DEFINE_A_REMOTE_SITE_BECAUSE_AT_LEAST_ONE_LISTENER_IS_ALREADY_ADDED
-                .toLocalizedString(id));
-      }
-//      if (this.attrs.getOrderPolicy() != null) {
-//        if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
-//          throw new GatewaySenderException(
-//              LocalizedStrings.SerialGatewaySender_INVALID_GATEWAY_SENDER_ORDER_POLICY_CONCURRENCY_0
-//                  .toLocalizedString(id));
-//        }
-//      }
-      if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
-        this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
-      }
-      if (this.cache instanceof GemFireCacheImpl) {
-        sender = new SerialGatewaySenderImpl(this.cache, this.attrs);
-        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
-
-        if (!this.attrs.isManualStart()) {
-          sender.start();
-        }
-      }
-      else if (this.cache instanceof CacheCreation) {
-        sender = new SerialGatewaySenderCreation(this.cache, this.attrs);
-        ((CacheCreation)this.cache).addGatewaySender(sender);
-      }
-    }
-    return sender;
-  }
-
-  public GatewaySender create(String id) {
-    this.attrs.id = id;
-    GatewaySender sender = null;
-
-    if(this.attrs.getDispatcherThreads() <= 0) {
-      throw new AsyncEventQueueConfigurationException(
-          LocalizedStrings.AsyncEventQueue_0_CANNOT_HAVE_DISPATCHER_THREADS_LESS_THAN_1
-              .toLocalizedString(id));
-    }
-    
-    if (this.attrs.isParallel()) {
-      if ((this.attrs.getOrderPolicy() != null)
-          && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) {
-        throw new AsyncEventQueueConfigurationException(
-            LocalizedStrings.AsyncEventQueue_0_CANNOT_BE_CREATED_WITH_ORDER_POLICY_1
-                .toLocalizedString(id, this.attrs.getOrderPolicy()));
-      }
-      
-      if (this.cache instanceof GemFireCacheImpl) {
-        sender = new ParallelGatewaySenderImpl(this.cache, this.attrs);
-        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
-        if (!this.attrs.isManualStart()) {
-          sender.start();
-        }
-      }
-      else if (this.cache instanceof CacheCreation) {
-        sender = new ParallelGatewaySenderCreation(this.cache, this.attrs);
-        ((CacheCreation)this.cache).addGatewaySender(sender);
-      }
-    }
-    else {
-//      if (this.attrs.getOrderPolicy() != null) {
-//        if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
-//          throw new AsyncEventQueueConfigurationException(
-//              LocalizedStrings.AsyncEventQueue_INVALID_ORDER_POLICY_CONCURRENCY_0
-//                  .toLocalizedString(id));
-//        }
-//      }
-      if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
-         this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
-      }
-      if (this.cache instanceof GemFireCacheImpl) {
-        sender = new SerialGatewaySenderImpl(this.cache, this.attrs);
-        ((GemFireCacheImpl)this.cache).addGatewaySender(sender);
-        if (!this.attrs.isManualStart()) {
-          sender.start();
-        }
-      }
-      else if (this.cache instanceof CacheCreation) {
-        sender = new SerialGatewaySenderCreation(this.cache, this.attrs);
-        ((CacheCreation)this.cache).addGatewaySender(sender);
-      }
-    }
-    return sender;
-  }
-  
-  public GatewaySenderFactory removeGatewayEventFilter(
-      GatewayEventFilter filter) {
-    this.attrs.eventFilters.remove(filter);
-    return this;
-  }
-
-  public GatewaySenderFactory removeGatewayTransportFilter(
-      GatewayTransportFilter filter) {
-    this.attrs.transFilters.remove(filter);
-    return this;
-  } 
-  
-  public GatewaySenderFactory setGatewayEventSubstitutionFilter(
-      GatewayEventSubstitutionFilter filter) {
-    this.attrs.eventSubstitutionFilter = filter;
-    return this;
-  }
-
-  public void configureGatewaySender(GatewaySender senderCreation) {
-    this.attrs.isParallel = senderCreation.isParallel();
-    this.attrs.manualStart = senderCreation.isManualStart();
-    this.attrs.socketBufferSize = senderCreation.getSocketBufferSize();
-    this.attrs.socketReadTimeout = senderCreation.getSocketReadTimeout();
-    this.attrs.isBatchConflationEnabled = senderCreation.isBatchConflationEnabled();
-    this.attrs.batchSize = senderCreation.getBatchSize();
-    this.attrs.batchTimeInterval = senderCreation.getBatchTimeInterval();
-    this.attrs.isPersistenceEnabled = senderCreation.isPersistenceEnabled();
-    this.attrs.diskStoreName = senderCreation.getDiskStoreName();
-    this.attrs.isDiskSynchronous = senderCreation.isDiskSynchronous();
-    this.attrs.maximumQueueMemory = senderCreation.getMaximumQueueMemory();
-    this.attrs.alertThreshold = senderCreation.getAlertThreshold();
-    this.attrs.dispatcherThreads = senderCreation.getDispatcherThreads();
-    this.attrs.policy = senderCreation.getOrderPolicy();
-    for(GatewayEventFilter filter : senderCreation.getGatewayEventFilters()){
-      this.attrs.eventFilters.add(filter);
-    }
-    for(GatewayTransportFilter filter : senderCreation.getGatewayTransportFilters()){
-      this.attrs.transFilters.add(filter);
-    }
-    this.attrs.eventSubstitutionFilter = senderCreation.getGatewayEventSubstitutionFilter();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
deleted file mode 100644
index 322b1ba..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.EntryOperation;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueStats;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
-import com.gemstone.gemfire.distributed.internal.DistributionAdvisor;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.ResourceEvent;
-import com.gemstone.gemfire.internal.cache.DistributedRegion;
-import com.gemstone.gemfire.internal.cache.EntryEventImpl;
-import com.gemstone.gemfire.internal.cache.EventID;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
-import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
-import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
-import com.gemstone.gemfire.internal.cache.wan.AbstractRemoteGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySenderEventProcessor;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAdvisor;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderStats;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-
-/**
- * @since GemFire 7.0
- *
- */
-public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
-  
-  private static final Logger logger = LogService.getLogger();
-  
-  final ThreadGroup loggerGroup = LoggingThreadGroup.createThreadGroup(
-      "Remote Site Discovery Logger Group", logger);
-  
-  public ParallelGatewaySenderImpl(){
-    super();
-    this.isParallel = true;
-  }
-  
-  public ParallelGatewaySenderImpl(Cache cache, GatewaySenderAttributes attrs) {
-    super(cache, attrs);
-  }
-  
-  @Override
-  public void start() {
-    this.getLifeCycleLock().writeLock().lock(); 
-    try {
-      if (isRunning()) {
-        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_SENDER_0_IS_ALREADY_RUNNING, this.getId()));
-        return;
-      }
-
-      if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-        String locators = ((GemFireCacheImpl)this.cache).getDistributedSystem()
-            .getConfig().getLocators();
-        if (locators.length() == 0) {
-          throw new IllegalStateException(
-              LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
-                  .toLocalizedString());
-        }
-      }
-      /*
-       * Now onwards all processing will happen through "ConcurrentParallelGatewaySenderEventProcessor"
-       * we have made "ParallelGatewaySenderEventProcessor" and "ParallelGatewaySenderQueue" as a
-       * utility classes of Concurrent version of processor and queue.
-       */
-      eventProcessor = new RemoteConcurrentParallelGatewaySenderEventProcessor(this);
-      /*if (getDispatcherThreads() > 1) {
-        eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this);
-      } else {
-        eventProcessor = new ParallelGatewaySenderEventProcessor(this);
-      }*/
-      
-      eventProcessor.start();
-      waitForRunningStatus();
-      //Only notify the type registry if this is a WAN gateway queue
-      if(!isAsyncEventQueue()) {
-        ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
-      }
-      new UpdateAttributesProcessor(this).distribute(false);
-     
-      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
-          .getDistributedSystem();
-      system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
-      
-      logger.info(LocalizedMessage.create(LocalizedStrings.ParallelGatewaySenderImpl_STARTED__0, this));
-      
-      enqueueTempEvents();
-    }
-    finally {
-      this.getLifeCycleLock().writeLock().unlock();
-    }
-  }
-  
-//  /**
-//   * The sender is not started but only the message queue i.e. shadowPR is created on the node.
-//   * @param targetPr
-//   */
-//  private void createMessageQueueOnAccessorNode(PartitionedRegion targetPr) {
-//    eventProcessor = new ParallelGatewaySenderEventProcessor(this, targetPr);
-//  }
-  
-
-  @Override
-  public void stop() {
-    this.getLifeCycleLock().writeLock().lock(); 
-    try {
-      if (!this.isRunning()) {
-        return;
-      }
-      // Stop the dispatcher
-      AbstractGatewaySenderEventProcessor ev = this.eventProcessor;
-      //try {
-      if (ev != null && !ev.isStopped()) {
-        ev.stopProcessing();
-      }
-
-      // Stop the proxy (after the dispatcher, so the socket is still
-      // alive until after the dispatcher has stopped)
-      stompProxyDead();
-
-      // Close the listeners
-      for (AsyncEventListener listener : this.listeners) {
-        listener.close();
-      }
-      //stop the running threads, open sockets if any
-      ((ConcurrentParallelGatewaySenderQueue)this.eventProcessor.getQueue()).cleanUp();
-
-      logger.info(LocalizedMessage.create(LocalizedStrings.GatewayImpl_STOPPED__0, this));
-      
-      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
-      .getDistributedSystem();
-      system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_STOP, this);
-      
-      clearTempEventsAfterSenderStopped();
-      // Keep the eventProcessor around so we can ask it for the regionQueues later.
-      // Tests expect to be able to do this. 
-//      } finally {
-//        this.eventProcessor = null;
-//      }
-    }
-    finally {
-      this.getLifeCycleLock().writeLock().unlock();
-    }
-  }
-  
-  @Override
-  public String toString() {
-    StringBuffer sb = new StringBuffer();
-    sb.append("ParallelGatewaySender{");
-    sb.append("id=" + getId());
-    sb.append(",remoteDsId="+ getRemoteDSId());
-    sb.append(",isRunning ="+ isRunning());
-    sb.append("}");
-    return sb.toString();
-  }
-
-  public void fillInProfile(Profile profile) {
-    assert profile instanceof GatewaySenderProfile;
-    GatewaySenderProfile pf = (GatewaySenderProfile)profile;
-    pf.Id = getId();
-    pf.remoteDSId = getRemoteDSId();
-    pf.isRunning = isRunning();
-    pf.isPrimary = isPrimary();
-    pf.isParallel = true;
-    pf.isBatchConflationEnabled = isBatchConflationEnabled();
-    pf.isPersistenceEnabled = isPersistenceEnabled();
-    pf.alertThreshold = getAlertThreshold();
-    pf.manualStart = isManualStart();
-    pf.dispatcherThreads = getDispatcherThreads();
-    pf.orderPolicy = getOrderPolicy();
-    for (com.gemstone.gemfire.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
-      pf.eventFiltersClassNames.add(filter.getClass().getName());
-    }
-    for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
-      pf.transFiltersClassNames.add(filter.getClass().getName());
-    }
-    for (AsyncEventListener listener : getAsyncEventListeners()) {
-      pf.senderEventListenerClassNames.add(listener.getClass().getName());
-    }
-    pf.isDiskSynchronous = isDiskSynchronous();
-  }
-
-  /* (non-Javadoc)
-   * @see com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(com.gemstone.gemfire.internal.cache.EntryEventImpl)
-   */
-  @Override
-  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
-    int bucketId = -1;
-    //merged from 42004
-    if (clonedEvent.getRegion() instanceof DistributedRegion) {
-//      if (getOrderPolicy() == OrderPolicy.THREAD) {
-//        bucketId = PartitionedRegionHelper.getHashKey(
-//            ((EntryEventImpl)clonedEvent).getEventId().getThreadID(),
-//            getMaxParallelismForReplicatedRegion());
-//      }
-//      else
-        bucketId = PartitionedRegionHelper.getHashKey(clonedEvent.getKey(),
-            getMaxParallelismForReplicatedRegion());
-    }
-    else {
-      bucketId = PartitionedRegionHelper
-          .getHashKey((EntryOperation)clonedEvent);
-    }
-    EventID originalEventId = clonedEvent.getEventId();
-    long originatingThreadId = ThreadIdentifier.getRealThreadID(originalEventId.getThreadID());
-
-    long newThreadId = ThreadIdentifier
-    .createFakeThreadIDForParallelGSPrimaryBucket(bucketId,
-        originatingThreadId, getEventIdIndex());
-    
-    // In case of parallel as all events go through primary buckets
-    // we don't need to generate different threadId for secondary buckets
-    // as they will be rejected if seen at PR level itself
-    
-//    boolean isPrimary = ((PartitionedRegion)getQueue().getRegion())
-//    .getRegionAdvisor().getBucketAdvisor(bucketId).isPrimary();
-//    if (isPrimary) {
-//      newThreadId = ThreadIdentifier
-//          .createFakeThreadIDForParallelGSPrimaryBucket(bucketId,
-//              originatingThreadId);
-//    } else {
-//      newThreadId = ThreadIdentifier
-//          .createFakeThreadIDForParallelGSSecondaryBucket(bucketId,
-//              originatingThreadId);
-//    }
-
-    EventID newEventId = new EventID(originalEventId.getMembershipID(),
-        newThreadId, originalEventId.getSequenceID(), bucketId);
-    if (logger.isDebugEnabled()) {
-      logger.debug("{}: Generated event id for event with key={}, bucketId={}, original event id={}, threadId={}, new event id={}, newThreadId={}",
-          this, clonedEvent.getKey(), bucketId, originalEventId, originatingThreadId, newEventId, newThreadId);
-    }
-    clonedEvent.setEventId(newEventId);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java
deleted file mode 100644
index 35cdece..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteConcurrentParallelGatewaySenderEventProcessor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderStats;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderEventProcessor;
-/**
- * Remote version of GatewaySenderEvent Processor
- *
- */
-public class RemoteConcurrentParallelGatewaySenderEventProcessor extends ConcurrentParallelGatewaySenderEventProcessor{
-  
-  public RemoteConcurrentParallelGatewaySenderEventProcessor(
-      AbstractGatewaySender sender) {
-    super(sender);
-  }
-
-  @Override
-  protected void createProcessors(int dispatcherThreads, Set<Region> targetRs) {
-    processors = new RemoteParallelGatewaySenderEventProcessor[sender.getDispatcherThreads()];
-    if (logger.isDebugEnabled()) {
-      logger.debug("Creating GatewaySenderEventProcessor");
-    }
-    for (int i = 0; i < sender.getDispatcherThreads(); i++) {
-      processors[i] = new RemoteParallelGatewaySenderEventProcessor(sender,
-          targetRs, i, sender.getDispatcherThreads());
-    }
-  }
-  
-  @Override
-  protected void rebalance() {
-    GatewaySenderStats statistics = this.sender.getStatistics();
-    long startTime = statistics.startLoadBalance();
-    try {
-      for (ParallelGatewaySenderEventProcessor parallelProcessor : this.processors) {
-        GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher)parallelProcessor.getDispatcher();
-        if (remoteDispatcher.isConnectedToRemote()) {
-          remoteDispatcher.stopAckReaderThread();
-          remoteDispatcher.destroyConnection();
-        }
-      }
-    } finally {
-      statistics.endLoadBalance(startTime);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java
deleted file mode 100644
index 815932e..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/RemoteParallelGatewaySenderEventProcessor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import java.io.IOException;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.client.internal.Connection;
-import com.gemstone.gemfire.cache.client.internal.pooling.ConnectionDestroyedException;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderConfigurationException;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventCallbackDispatcher;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventDispatcher;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderStats;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-public class RemoteParallelGatewaySenderEventProcessor extends ParallelGatewaySenderEventProcessor {
-  private static final Logger logger = LogService.getLogger();
-  
-  protected RemoteParallelGatewaySenderEventProcessor(
-      AbstractGatewaySender sender) {
-    super(sender);
-  }
-  
-  /**
-   * use in concurrent scenario where queue is to be shared among all the processors.
-   */
-  protected RemoteParallelGatewaySenderEventProcessor(AbstractGatewaySender sender,  Set<Region> userRegions, int id, int nDispatcher) {
-    super(sender,  userRegions, id, nDispatcher);
-  }
-  
-  @Override
-  protected void rebalance() {
-    GatewaySenderStats statistics = this.sender.getStatistics();
-    long startTime = statistics.startLoadBalance();
-    try {
-      if (this.dispatcher.isRemoteDispatcher()) {
-        GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) this.dispatcher;
-        if (remoteDispatcher.isConnectedToRemote()) {
-          remoteDispatcher.stopAckReaderThread();
-          remoteDispatcher.destroyConnection();
-        }
-      }
-    } finally {
-      statistics.endLoadBalance(startTime);
-    }
-  }
-  
-  public void initializeEventDispatcher() {
-    if (logger.isDebugEnabled()) {
-      logger.debug(" Creating the GatewayEventRemoteDispatcher");
-    }
-    if (this.sender.getRemoteDSId() != GatewaySender.DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-      this.dispatcher = new GatewaySenderEventRemoteDispatcher(this);
-    }
-  }
-  
-  /**
-   * Returns if corresponding receiver WAN site of this GatewaySender has
-   * GemfireVersion > 7.0.1
-   * 
-   * @param disp
-   * @return true if remote site Gemfire Version is >= 7.0.1
-   */
-  private boolean shouldSendVersionEvents(GatewaySenderEventDispatcher disp)
-      throws GatewaySenderException {
-      try {
-        GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) disp;
-        // This will create a new connection if no batch has been sent till
-        // now.
-        Connection conn = remoteDispatcher.getConnection(false);
-        if (conn != null) {
-          short remoteSiteVersion = conn.getWanSiteVersion();
-          if (Version.GFE_701.compareTo(remoteSiteVersion) <= 0) {
-            return true;
-          }
-        }
-      } catch (GatewaySenderException e) {
-        Throwable cause = e.getCause();
-        if (cause instanceof IOException
-            || e instanceof GatewaySenderConfigurationException
-            || cause instanceof ConnectionDestroyedException) {
-          try {
-            int sleepInterval = GatewaySender.CONNECTION_RETRY_INTERVAL;
-            if (logger.isDebugEnabled()) {
-              logger.debug("Sleeping for {} milliseconds", sleepInterval);
-            }
-            Thread.sleep(sleepInterval);
-          } catch (InterruptedException ie) {
-            // log the exception
-            if (logger.isDebugEnabled()){
-              logger.debug(ie.getMessage(), ie);
-            }
-          }
-        }
-        throw e;
-      }
-    return false;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java
deleted file mode 100644
index 8a25ab6..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteConcurrentSerialGatewaySenderEventProcessor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-public class RemoteConcurrentSerialGatewaySenderEventProcessor extends
-    ConcurrentSerialGatewaySenderEventProcessor {
-
-  private static final Logger logger = LogService.getLogger();
-  
-  public RemoteConcurrentSerialGatewaySenderEventProcessor(
-      AbstractGatewaySender sender) {
-    super(sender);
-  }
-
-  @Override
-  protected void initializeMessageQueue(String id) {
-    for (int i = 0; i < sender.getDispatcherThreads(); i++) {
-      processors.add(new RemoteSerialGatewaySenderEventProcessor(this.sender, id
-          + "." + i));
-      if (logger.isDebugEnabled()) {
-        logger.debug("Created the RemoteSerialGatewayEventProcessor_{}->{}", i, processors.get(i));
-      }
-    }
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java
deleted file mode 100644
index 82fa585..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/RemoteSerialGatewaySenderEventProcessor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventCallbackDispatcher;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-public class RemoteSerialGatewaySenderEventProcessor extends
-    SerialGatewaySenderEventProcessor {
-
-  private static final Logger logger = LogService.getLogger();
-  public RemoteSerialGatewaySenderEventProcessor(AbstractGatewaySender sender,
-      String id) {
-    super(sender, id);
-  }
-
-  public void initializeEventDispatcher() {
-    if (logger.isDebugEnabled()) {
-      logger.debug(" Creating the GatewayEventRemoteDispatcher");
-    }
-    // In case of serial there is a way to create gatewaySender and attach
-    // asyncEventListener. Not sure of the use-case but there are dunit tests
-    // To make them pass uncommenting the below condition
-    if (this.sender.getRemoteDSId() != GatewaySender.DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-      this.dispatcher = new GatewaySenderEventRemoteDispatcher(this);
-    }else{
-      this.dispatcher = new GatewaySenderEventCallbackDispatcher(this);
-    }
-  }
-  
-}



[43/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-rebalancer/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-rebalancer/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
GEODE-37 change package name from com.gemstone.gemfire (for ./geode-rebalancer/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-rebalancer/src/main/java/org/apache/geode)


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/401ef76c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/401ef76c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/401ef76c

Branch: refs/heads/feature/GEODE-37_2
Commit: 401ef76cfb6087c12a80d7e89a18384e13d5fd8a
Parents: 90d1187
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Sep 13 15:43:20 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Tue Sep 13 15:43:20 2016 -0700

----------------------------------------------------------------------
 .../gemfire/cache/util/AutoBalancer.java        | 553 -------------------
 .../apache/geode/cache/util/AutoBalancer.java   | 553 +++++++++++++++++++
 2 files changed, 553 insertions(+), 553 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/401ef76c/geode-rebalancer/src/main/java/com/gemstone/gemfire/cache/util/AutoBalancer.java
----------------------------------------------------------------------
diff --git a/geode-rebalancer/src/main/java/com/gemstone/gemfire/cache/util/AutoBalancer.java b/geode-rebalancer/src/main/java/com/gemstone/gemfire/cache/util/AutoBalancer.java
deleted file mode 100644
index a6488f9..0000000
--- a/geode-rebalancer/src/main/java/com/gemstone/gemfire/cache/util/AutoBalancer.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * 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.util;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.logging.log4j.Logger;
-import org.quartz.CronExpression;
-import org.springframework.scheduling.support.CronSequenceGenerator;
-
-import com.gemstone.gemfire.GemFireConfigException;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.Declarable;
-import com.gemstone.gemfire.cache.GemFireCache;
-import com.gemstone.gemfire.cache.control.RebalanceOperation;
-import com.gemstone.gemfire.cache.control.RebalanceResults;
-import com.gemstone.gemfire.cache.partition.PartitionMemberInfo;
-import com.gemstone.gemfire.distributed.DistributedLockService;
-import com.gemstone.gemfire.distributed.internal.locks.DLockService;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.partitioned.InternalPRInfo;
-import com.gemstone.gemfire.internal.cache.partitioned.LoadProbe;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * Re-balancing operation relocates data from heavily loaded members to lightly
- * loaded members. In most cases, the decision to re-balance is based on the
- * size of the member and a few other statistics. {@link AutoBalancer} monitors
- * these statistics and if necessary, triggers a re-balancing request.
- * Auto-Balancing is expected to prevent failures and data loss.
- * 
- * <P>
- * This implementation is based on {@code Initializer} implementation. By
- * default auto-balancing is disabled. A user needs to configure
- * {@link AutoBalancer} during cache initialization
- * {@link GemFireCache#getInitializer()}
- * 
- * <P>
- * In a cluster only one member owns auto-balancing responsibility. This is
- * achieved by grabbing a distributed lock. In case of a failure a new member
- * will grab the lock and manage auto balancing.
- * 
- * <P>
- * {@link AutoBalancer} can be controlled using the following configurations
- * <OL>
- * <LI>{@link AutoBalancer#SCHEDULE}
- * <LI>TBD THRESHOLDS
- * 
- */
-public class AutoBalancer implements Declarable {
-  /**
-   * Use this configuration to manage out-of-balance audit frequency. If the
-   * auditor finds the system to be out-of-balance, it will trigger
-   * re-balancing. Any valid cron string is accepted. The sub-expressions
-   * represent the following:
-   * <OL>
-   * <LI>Seconds
-   * <LI>Minutes
-   * <LI>Hours
-   * <LI>Day-of-Month
-   * <LI>Month
-   * <LI>Day-of-Week
-   * <LI>Year (optional field)
-   * 
-   * <P>
-   * For. e.g. {@code 0 0 * * * ?} for auditing the system every hour
-   */
-  public static final String SCHEDULE = "schedule";
-
-  /**
-   * Use this configuration to manage re-balance invocation. Rebalance operation
-   * will be triggered if the total number of bytes rebalance operation may move
-   * is more than this threshold, in percentage of the total data size.
-   * <P>
-   * Default value {@link #DEFAULT_SIZE_THRESHOLD_PERCENT}
-   */
-  public static final String SIZE_THRESHOLD_PERCENT = "size-threshold-percent";
-
-  /**
-   * Default value of {@link AutoBalancer#SIZE_THRESHOLD_PERCENT}. If 10% of
-   * data is misplaced, its a good time to redistribute buckets
-   */
-  public static final int DEFAULT_SIZE_THRESHOLD_PERCENT = 10;
-
-  /**
-   * In the initial data load phases,
-   * {@link AutoBalancer#SIZE_THRESHOLD_PERCENT} based rebalance invocation may
-   * be unnecessary. Rebalance should not be triggered if the total data size
-   * managed by cluster is too small. Rebalance operation will be triggered if
-   * the total number of bytes rebalance operation may move is more than this
-   * number of bytes.
-   * <P>
-   * Default value {@link #DEFAULT_MINIMUM_SIZE}
-   */
-  public static final String MINIMUM_SIZE = "minimum-size";
-
-  /**
-   * Default value of {@link AutoBalancer#MINIMUM_SIZE}. In the initial data
-   * load phases, {@link AutoBalancer#SIZE_THRESHOLD_PERCENT} based rebalance
-   * invocation may be unnecessary. Do not rebalance if the data to be moved is
-   * less than 100MB
-   */
-  public static final int DEFAULT_MINIMUM_SIZE = 100 * 1024 * 1024;
-
-  /**
-   * Name of the DistributedLockService that {@link AutoBalancer} will use to
-   * guard against concurrent maintenance activity
-   */
-  public static final String AUTO_BALANCER_LOCK_SERVICE_NAME = "__AUTO_B";
-
-  public static final Object AUTO_BALANCER_LOCK = "__AUTO_B_LOCK";
-
-  private final AuditScheduler scheduler;
-  private final OOBAuditor auditor;
-  private final TimeProvider clock;
-  private final CacheOperationFacade cacheFacade;
-
-  private static final Logger logger = LogService.getLogger();
-
-  public AutoBalancer() {
-    this(null, null, null, null);
-  }
-
-  public AutoBalancer(AuditScheduler scheduler, OOBAuditor auditor, TimeProvider clock,
-      CacheOperationFacade cacheFacade) {
-    this.cacheFacade = cacheFacade == null ? new GeodeCacheFacade() : cacheFacade;
-    this.scheduler = scheduler == null ? new CronScheduler() : scheduler;
-    this.auditor = auditor == null ? new SizeBasedOOBAuditor(this.cacheFacade) : auditor;
-    this.clock = clock == null ? new SystemClockTimeProvider() : clock;
-  }
-
-  @Override
-  public void init(Properties props) {
-    if (logger.isDebugEnabled()) {
-      logger.debug("Initializing " + this.getClass().getSimpleName() + " with " + props);
-    }
-
-    auditor.init(props);
-
-    String schedule = null;
-    if (props != null) {
-      schedule = props.getProperty(SCHEDULE);
-    }
-    scheduler.init(schedule);
-  }
-
-  /**
-   * Invokes audit triggers based on a cron schedule.
-   * <OL>
-   * <LI>computes delay = next slot - current time
-   * <LI>schedules a out-of-balance audit task to be started after delay
-   * computed earlier
-   * <LI>once the audit task completes, it repeats delay computation and task
-   * submission
-   */
-  private class CronScheduler implements AuditScheduler {
-    final ScheduledExecutorService trigger;
-    CronSequenceGenerator generator;
-
-    CronScheduler() {
-      trigger = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
-        @Override
-        public Thread newThread(Runnable r) {
-          Thread thread = new Thread(r, "AutoBalancer");
-          thread.setDaemon(true);
-          return thread;
-        }
-      });
-    }
-
-    @Override
-    public void init(String schedule) {
-      if (logger.isDebugEnabled()) {
-        logger.debug("Initializing " + this.getClass().getSimpleName() + " with " + schedule);
-      }
-
-      if (schedule == null || schedule.isEmpty()) {
-        throw new GemFireConfigException("Missing configuration: " + SCHEDULE);
-      }
-      if (!CronExpression.isValidExpression(schedule)) {
-        throw new GemFireConfigException("Invalid schedule: " + schedule);
-      }
-      generator = new CronSequenceGenerator(schedule);
-
-      submitNext();
-    }
-
-    private void submitNext() {
-      long currentTime = clock.currentTimeMillis();
-      Date nextSchedule = generator.next(new Date(currentTime));
-      long delay = nextSchedule.getTime() - currentTime;
-
-      if (logger.isDebugEnabled()) {
-        logger.debug("Now={}, next audit time={}, delay={} ms", new Date(currentTime), nextSchedule, delay);
-      }
-
-      trigger.schedule(new Runnable() {
-        @Override
-        public void run() {
-          try {
-            auditor.execute();
-          } catch (CacheClosedException e) {
-            logger.warn("Cache closed while attempting to rebalance the cluster. Abort future jobs", e);
-            return;
-          } catch (Exception e) {
-            logger.warn("Error while executing out-of-balance audit.", e);
-          }
-          submitNext();
-        }
-      }, delay, TimeUnit.MILLISECONDS);
-    }
-
-    @Override
-    public void destroy() {
-      trigger.shutdownNow();
-    }
-  }
-
-  /**
-   * Queries member statistics and health to determine if a re-balance operation
-   * is needed
-   * <OL>
-   * <LI>acquires distributed lock
-   * <LI>queries member health
-   * <LI>updates auto-balance stat
-   * <LI>release lock
-   */
-  static class SizeBasedOOBAuditor implements OOBAuditor {
-    private int sizeThreshold = DEFAULT_SIZE_THRESHOLD_PERCENT;
-    private int sizeMinimum = DEFAULT_MINIMUM_SIZE;
-
-    final CacheOperationFacade cache;
-
-    public SizeBasedOOBAuditor(CacheOperationFacade cache) {
-      this.cache = cache;
-    }
-
-    @Override
-    public void init(Properties props) {
-      if (logger.isDebugEnabled()) {
-        logger.debug("Initializing " + this.getClass().getSimpleName());
-      }
-
-      if (props != null) {
-        if (props.getProperty(SIZE_THRESHOLD_PERCENT) != null) {
-          sizeThreshold = Integer.valueOf(props.getProperty(SIZE_THRESHOLD_PERCENT));
-          if (sizeThreshold <= 0 || sizeThreshold >= 100) {
-            throw new GemFireConfigException(SIZE_THRESHOLD_PERCENT + " should be integer, 1 to 99");
-          }
-        }
-        if (props.getProperty(MINIMUM_SIZE) != null) {
-          sizeMinimum = Integer.valueOf(props.getProperty(MINIMUM_SIZE));
-          if (sizeMinimum <= 0) {
-            throw new GemFireConfigException(MINIMUM_SIZE + " should be greater than 0");
-          }
-        }
-      }
-    }
-
-    @Override
-    public void execute() {
-      boolean result = cache.acquireAutoBalanceLock();
-      if (!result) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Another member owns auto-balance lock. Skip this attempt to rebalance the cluster");
-        }
-        return;
-      }
-
-      cache.incrementAttemptCounter();
-      result = needsRebalancing();
-      if (!result) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Rebalancing is not needed");
-        }
-        return;
-      }
-
-      cache.rebalance();
-    }
-
-    /**
-     * By default auto-balancer will avoid rebalancing, because a user can
-     * always trigger rebalance manually. So in case of error or inconsistent
-     * data, return false. Return true if
-     * <OL>
-     * <LI>total transfer size is above threshold percent of total data size at
-     * cluster level
-     * <LI>If some smaller capacity nodes are heavily loaded while bigger
-     * capacity nodes are balanced. In such a scenario transfer size based
-     * trigger may not cause rebalance.
-     */
-    boolean needsRebalancing() {
-      // test cluster level status
-      long transferSize = cache.getTotalTransferSize();
-      if (transferSize <= sizeMinimum) {
-        return false;
-      }
-
-      Map<PartitionedRegion, InternalPRInfo> details = cache.getRegionMemberDetails();
-      long totalSize = cache.getTotalDataSize(details);
-
-      if (totalSize > 0) {
-        int transferPercent = (int) ((100.0 * transferSize) / totalSize);
-        if (transferPercent >= sizeThreshold) {
-          return true;
-        }
-      }
-
-      // TODO test member level skew
-
-      return false;
-    }
-
-    int getSizeThreshold() {
-      return sizeThreshold;
-    }
-
-    public long getSizeMinimum() {
-      return sizeMinimum;
-    }
-  }
-
-  /**
-   * Hides cache level details and exposes simple methods relevant for
-   * auto-balancing
-   */
-  static class GeodeCacheFacade implements CacheOperationFacade {
-    private final AtomicBoolean isLockAcquired = new AtomicBoolean(false);
-
-    private GemFireCacheImpl cache;
-
-    public GeodeCacheFacade() {
-      this(null);
-    }
-
-    public GeodeCacheFacade(GemFireCacheImpl cache) {
-      this.cache = cache;
-    }
-
-    @Override
-    public Map<PartitionedRegion, InternalPRInfo> getRegionMemberDetails() {
-      GemFireCacheImpl cache = getCache();
-      Map<PartitionedRegion, InternalPRInfo> detailsMap = new HashMap<>();
-      for (PartitionedRegion region : cache.getPartitionedRegions()) {
-        LoadProbe probe = cache.getResourceManager().getLoadProbe();
-        InternalPRInfo info = region.getRedundancyProvider().buildPartitionedRegionInfo(true, probe);
-        detailsMap.put(region, info);
-      }
-      return detailsMap;
-    }
-
-    @Override
-    public long getTotalDataSize(Map<PartitionedRegion, InternalPRInfo> details) {
-      long totalSize = 0;
-      if (details != null) {
-        for (PartitionedRegion region : details.keySet()) {
-          InternalPRInfo info = details.get(region);
-          Set<PartitionMemberInfo> membersInfo = info.getPartitionMemberInfo();
-          for (PartitionMemberInfo member : membersInfo) {
-            if (logger.isDebugEnabled()) {
-              logger.debug("Region:{}, Member: {}, Size: {}", region.getFullPath(), member, member.getSize());
-            }
-            totalSize += member.getSize();
-          }
-        }
-      }
-      return totalSize;
-    }
-
-    @Override
-    public long getTotalTransferSize() {
-      try {
-        RebalanceOperation operation = getCache().getResourceManager().createRebalanceFactory().simulate();
-        RebalanceResults result = operation.getResults();
-        if (logger.isDebugEnabled()) {
-          logger.debug(
-              "Rebalance estimate: RebalanceResultsImpl [TotalBucketCreateBytes=" + result.getTotalBucketCreateBytes()
-                  + ", TotalBucketCreatesCompleted=" + result.getTotalBucketCreatesCompleted()
-                  + ", TotalBucketTransferBytes=" + result.getTotalBucketTransferBytes()
-                  + ", TotalBucketTransfersCompleted=" + result.getTotalBucketTransfersCompleted()
-                  + ", TotalPrimaryTransfersCompleted=" + result.getTotalPrimaryTransfersCompleted() + "]");
-        }
-        return result.getTotalBucketTransferBytes();
-      } catch (CancellationException e) {
-        logger.info("Error while trying to estimate rebalance cost ", e);
-      } catch (InterruptedException e) {
-        logger.info("Error while trying to estimate rebalance cost ", e);
-      }
-      return 0;
-    }
-
-    @Override
-    public void incrementAttemptCounter() {
-      GemFireCacheImpl cache = getCache();
-      try {
-        cache.getResourceManager().getStats().incAutoRebalanceAttempts();
-      } catch (Exception e) {
-        logger.warn("Failed to increment AutoBalanceAttempts counter");
-      }
-    }
-
-    @Override
-    public void rebalance() {
-      try {
-        RebalanceOperation operation = getCache().getResourceManager().createRebalanceFactory().start();
-        RebalanceResults result = operation.getResults();
-        logger.info("Rebalance result: [TotalBucketCreateBytes=" + result.getTotalBucketCreateBytes()
-            + ", TotalBucketCreateTime=" + result.getTotalBucketCreateTime() + ", TotalBucketCreatesCompleted="
-            + result.getTotalBucketCreatesCompleted() + ", TotalBucketTransferBytes="
-            + result.getTotalBucketTransferBytes() + ", TotalBucketTransferTime=" + result.getTotalBucketTransferTime()
-            + ", TotalBucketTransfersCompleted=" + +result.getTotalBucketTransfersCompleted()
-            + ", TotalPrimaryTransferTime=" + result.getTotalPrimaryTransferTime() + ", TotalPrimaryTransfersCompleted="
-            + result.getTotalPrimaryTransfersCompleted() + ", TotalTime=" + result.getTotalTime() + "]");
-      } catch (CancellationException e) {
-        logger.info("Error rebalancing the cluster", e);
-      } catch (InterruptedException e) {
-        logger.info("Error rebalancing the cluster", e);
-      }
-    }
-
-    GemFireCacheImpl getCache() {
-      if (cache == null) {
-        synchronized (this) {
-          if (cache == null) {
-            cache = GemFireCacheImpl.getInstance();
-            if (cache == null) {
-              throw new IllegalStateException("Missing cache instance.");
-            }
-          }
-        }
-      }
-      if (cache.isClosed()) {
-        throw new CacheClosedException();
-      }
-      return cache;
-    }
-
-    @Override
-    public boolean acquireAutoBalanceLock() {
-      if (!isLockAcquired.get()) {
-        synchronized (isLockAcquired) {
-          if (!isLockAcquired.get()) {
-            DistributedLockService dls = getDLS();
-
-            boolean result = dls.lock(AUTO_BALANCER_LOCK, 0, -1);
-            if (result) {
-              isLockAcquired.set(true);
-              if (logger.isDebugEnabled()) {
-                logger.debug("Grabbed AutoBalancer lock");
-              }
-            } else {
-              if (logger.isDebugEnabled()) {
-                logger.debug("Another member owns auto-balance lock. Skip this attempt to rebalance the cluster");
-              }
-            }
-          }
-        }
-      }
-      return isLockAcquired.get();
-    }
-
-    @Override
-    public DistributedLockService getDLS() {
-      GemFireCacheImpl cache = getCache();
-      DistributedLockService dls = DistributedLockService.getServiceNamed(AUTO_BALANCER_LOCK_SERVICE_NAME);
-      if (dls == null) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Creating DistributeLockService");
-        }
-        dls = DLockService.create(AUTO_BALANCER_LOCK_SERVICE_NAME, cache.getDistributedSystem(), true, true, true);
-      }
-
-      return dls;
-    }
-  }
-
-  private class SystemClockTimeProvider implements TimeProvider {
-    @Override
-    public long currentTimeMillis() {
-      return System.currentTimeMillis();
-    }
-  }
-
-  interface AuditScheduler {
-    void init(String schedule);
-
-    void destroy();
-  }
-
-  interface OOBAuditor {
-    void init(Properties props);
-
-    void execute();
-  }
-
-  interface TimeProvider {
-    long currentTimeMillis();
-  }
-
-  interface CacheOperationFacade {
-    boolean acquireAutoBalanceLock();
-
-    DistributedLockService getDLS();
-
-    void rebalance();
-
-    void incrementAttemptCounter();
-
-    Map<PartitionedRegion, InternalPRInfo> getRegionMemberDetails();
-
-    long getTotalDataSize(Map<PartitionedRegion, InternalPRInfo> details);
-
-    long getTotalTransferSize();
-  }
-
-  OOBAuditor getOOBAuditor() {
-    return auditor;
-  }
-
-  public CacheOperationFacade getCacheOperationFacade() {
-    return this.cacheFacade;
-  }
-
-  public void destroy() {
-    scheduler.destroy();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/401ef76c/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
----------------------------------------------------------------------
diff --git a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
new file mode 100644
index 0000000..a6488f9
--- /dev/null
+++ b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
@@ -0,0 +1,553 @@
+/*
+ * 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.util;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.logging.log4j.Logger;
+import org.quartz.CronExpression;
+import org.springframework.scheduling.support.CronSequenceGenerator;
+
+import com.gemstone.gemfire.GemFireConfigException;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.cache.control.RebalanceOperation;
+import com.gemstone.gemfire.cache.control.RebalanceResults;
+import com.gemstone.gemfire.cache.partition.PartitionMemberInfo;
+import com.gemstone.gemfire.distributed.DistributedLockService;
+import com.gemstone.gemfire.distributed.internal.locks.DLockService;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.partitioned.InternalPRInfo;
+import com.gemstone.gemfire.internal.cache.partitioned.LoadProbe;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * Re-balancing operation relocates data from heavily loaded members to lightly
+ * loaded members. In most cases, the decision to re-balance is based on the
+ * size of the member and a few other statistics. {@link AutoBalancer} monitors
+ * these statistics and if necessary, triggers a re-balancing request.
+ * Auto-Balancing is expected to prevent failures and data loss.
+ * 
+ * <P>
+ * This implementation is based on {@code Initializer} implementation. By
+ * default auto-balancing is disabled. A user needs to configure
+ * {@link AutoBalancer} during cache initialization
+ * {@link GemFireCache#getInitializer()}
+ * 
+ * <P>
+ * In a cluster only one member owns auto-balancing responsibility. This is
+ * achieved by grabbing a distributed lock. In case of a failure a new member
+ * will grab the lock and manage auto balancing.
+ * 
+ * <P>
+ * {@link AutoBalancer} can be controlled using the following configurations
+ * <OL>
+ * <LI>{@link AutoBalancer#SCHEDULE}
+ * <LI>TBD THRESHOLDS
+ * 
+ */
+public class AutoBalancer implements Declarable {
+  /**
+   * Use this configuration to manage out-of-balance audit frequency. If the
+   * auditor finds the system to be out-of-balance, it will trigger
+   * re-balancing. Any valid cron string is accepted. The sub-expressions
+   * represent the following:
+   * <OL>
+   * <LI>Seconds
+   * <LI>Minutes
+   * <LI>Hours
+   * <LI>Day-of-Month
+   * <LI>Month
+   * <LI>Day-of-Week
+   * <LI>Year (optional field)
+   * 
+   * <P>
+   * For. e.g. {@code 0 0 * * * ?} for auditing the system every hour
+   */
+  public static final String SCHEDULE = "schedule";
+
+  /**
+   * Use this configuration to manage re-balance invocation. Rebalance operation
+   * will be triggered if the total number of bytes rebalance operation may move
+   * is more than this threshold, in percentage of the total data size.
+   * <P>
+   * Default value {@link #DEFAULT_SIZE_THRESHOLD_PERCENT}
+   */
+  public static final String SIZE_THRESHOLD_PERCENT = "size-threshold-percent";
+
+  /**
+   * Default value of {@link AutoBalancer#SIZE_THRESHOLD_PERCENT}. If 10% of
+   * data is misplaced, its a good time to redistribute buckets
+   */
+  public static final int DEFAULT_SIZE_THRESHOLD_PERCENT = 10;
+
+  /**
+   * In the initial data load phases,
+   * {@link AutoBalancer#SIZE_THRESHOLD_PERCENT} based rebalance invocation may
+   * be unnecessary. Rebalance should not be triggered if the total data size
+   * managed by cluster is too small. Rebalance operation will be triggered if
+   * the total number of bytes rebalance operation may move is more than this
+   * number of bytes.
+   * <P>
+   * Default value {@link #DEFAULT_MINIMUM_SIZE}
+   */
+  public static final String MINIMUM_SIZE = "minimum-size";
+
+  /**
+   * Default value of {@link AutoBalancer#MINIMUM_SIZE}. In the initial data
+   * load phases, {@link AutoBalancer#SIZE_THRESHOLD_PERCENT} based rebalance
+   * invocation may be unnecessary. Do not rebalance if the data to be moved is
+   * less than 100MB
+   */
+  public static final int DEFAULT_MINIMUM_SIZE = 100 * 1024 * 1024;
+
+  /**
+   * Name of the DistributedLockService that {@link AutoBalancer} will use to
+   * guard against concurrent maintenance activity
+   */
+  public static final String AUTO_BALANCER_LOCK_SERVICE_NAME = "__AUTO_B";
+
+  public static final Object AUTO_BALANCER_LOCK = "__AUTO_B_LOCK";
+
+  private final AuditScheduler scheduler;
+  private final OOBAuditor auditor;
+  private final TimeProvider clock;
+  private final CacheOperationFacade cacheFacade;
+
+  private static final Logger logger = LogService.getLogger();
+
+  public AutoBalancer() {
+    this(null, null, null, null);
+  }
+
+  public AutoBalancer(AuditScheduler scheduler, OOBAuditor auditor, TimeProvider clock,
+      CacheOperationFacade cacheFacade) {
+    this.cacheFacade = cacheFacade == null ? new GeodeCacheFacade() : cacheFacade;
+    this.scheduler = scheduler == null ? new CronScheduler() : scheduler;
+    this.auditor = auditor == null ? new SizeBasedOOBAuditor(this.cacheFacade) : auditor;
+    this.clock = clock == null ? new SystemClockTimeProvider() : clock;
+  }
+
+  @Override
+  public void init(Properties props) {
+    if (logger.isDebugEnabled()) {
+      logger.debug("Initializing " + this.getClass().getSimpleName() + " with " + props);
+    }
+
+    auditor.init(props);
+
+    String schedule = null;
+    if (props != null) {
+      schedule = props.getProperty(SCHEDULE);
+    }
+    scheduler.init(schedule);
+  }
+
+  /**
+   * Invokes audit triggers based on a cron schedule.
+   * <OL>
+   * <LI>computes delay = next slot - current time
+   * <LI>schedules a out-of-balance audit task to be started after delay
+   * computed earlier
+   * <LI>once the audit task completes, it repeats delay computation and task
+   * submission
+   */
+  private class CronScheduler implements AuditScheduler {
+    final ScheduledExecutorService trigger;
+    CronSequenceGenerator generator;
+
+    CronScheduler() {
+      trigger = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
+        @Override
+        public Thread newThread(Runnable r) {
+          Thread thread = new Thread(r, "AutoBalancer");
+          thread.setDaemon(true);
+          return thread;
+        }
+      });
+    }
+
+    @Override
+    public void init(String schedule) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Initializing " + this.getClass().getSimpleName() + " with " + schedule);
+      }
+
+      if (schedule == null || schedule.isEmpty()) {
+        throw new GemFireConfigException("Missing configuration: " + SCHEDULE);
+      }
+      if (!CronExpression.isValidExpression(schedule)) {
+        throw new GemFireConfigException("Invalid schedule: " + schedule);
+      }
+      generator = new CronSequenceGenerator(schedule);
+
+      submitNext();
+    }
+
+    private void submitNext() {
+      long currentTime = clock.currentTimeMillis();
+      Date nextSchedule = generator.next(new Date(currentTime));
+      long delay = nextSchedule.getTime() - currentTime;
+
+      if (logger.isDebugEnabled()) {
+        logger.debug("Now={}, next audit time={}, delay={} ms", new Date(currentTime), nextSchedule, delay);
+      }
+
+      trigger.schedule(new Runnable() {
+        @Override
+        public void run() {
+          try {
+            auditor.execute();
+          } catch (CacheClosedException e) {
+            logger.warn("Cache closed while attempting to rebalance the cluster. Abort future jobs", e);
+            return;
+          } catch (Exception e) {
+            logger.warn("Error while executing out-of-balance audit.", e);
+          }
+          submitNext();
+        }
+      }, delay, TimeUnit.MILLISECONDS);
+    }
+
+    @Override
+    public void destroy() {
+      trigger.shutdownNow();
+    }
+  }
+
+  /**
+   * Queries member statistics and health to determine if a re-balance operation
+   * is needed
+   * <OL>
+   * <LI>acquires distributed lock
+   * <LI>queries member health
+   * <LI>updates auto-balance stat
+   * <LI>release lock
+   */
+  static class SizeBasedOOBAuditor implements OOBAuditor {
+    private int sizeThreshold = DEFAULT_SIZE_THRESHOLD_PERCENT;
+    private int sizeMinimum = DEFAULT_MINIMUM_SIZE;
+
+    final CacheOperationFacade cache;
+
+    public SizeBasedOOBAuditor(CacheOperationFacade cache) {
+      this.cache = cache;
+    }
+
+    @Override
+    public void init(Properties props) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Initializing " + this.getClass().getSimpleName());
+      }
+
+      if (props != null) {
+        if (props.getProperty(SIZE_THRESHOLD_PERCENT) != null) {
+          sizeThreshold = Integer.valueOf(props.getProperty(SIZE_THRESHOLD_PERCENT));
+          if (sizeThreshold <= 0 || sizeThreshold >= 100) {
+            throw new GemFireConfigException(SIZE_THRESHOLD_PERCENT + " should be integer, 1 to 99");
+          }
+        }
+        if (props.getProperty(MINIMUM_SIZE) != null) {
+          sizeMinimum = Integer.valueOf(props.getProperty(MINIMUM_SIZE));
+          if (sizeMinimum <= 0) {
+            throw new GemFireConfigException(MINIMUM_SIZE + " should be greater than 0");
+          }
+        }
+      }
+    }
+
+    @Override
+    public void execute() {
+      boolean result = cache.acquireAutoBalanceLock();
+      if (!result) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Another member owns auto-balance lock. Skip this attempt to rebalance the cluster");
+        }
+        return;
+      }
+
+      cache.incrementAttemptCounter();
+      result = needsRebalancing();
+      if (!result) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Rebalancing is not needed");
+        }
+        return;
+      }
+
+      cache.rebalance();
+    }
+
+    /**
+     * By default auto-balancer will avoid rebalancing, because a user can
+     * always trigger rebalance manually. So in case of error or inconsistent
+     * data, return false. Return true if
+     * <OL>
+     * <LI>total transfer size is above threshold percent of total data size at
+     * cluster level
+     * <LI>If some smaller capacity nodes are heavily loaded while bigger
+     * capacity nodes are balanced. In such a scenario transfer size based
+     * trigger may not cause rebalance.
+     */
+    boolean needsRebalancing() {
+      // test cluster level status
+      long transferSize = cache.getTotalTransferSize();
+      if (transferSize <= sizeMinimum) {
+        return false;
+      }
+
+      Map<PartitionedRegion, InternalPRInfo> details = cache.getRegionMemberDetails();
+      long totalSize = cache.getTotalDataSize(details);
+
+      if (totalSize > 0) {
+        int transferPercent = (int) ((100.0 * transferSize) / totalSize);
+        if (transferPercent >= sizeThreshold) {
+          return true;
+        }
+      }
+
+      // TODO test member level skew
+
+      return false;
+    }
+
+    int getSizeThreshold() {
+      return sizeThreshold;
+    }
+
+    public long getSizeMinimum() {
+      return sizeMinimum;
+    }
+  }
+
+  /**
+   * Hides cache level details and exposes simple methods relevant for
+   * auto-balancing
+   */
+  static class GeodeCacheFacade implements CacheOperationFacade {
+    private final AtomicBoolean isLockAcquired = new AtomicBoolean(false);
+
+    private GemFireCacheImpl cache;
+
+    public GeodeCacheFacade() {
+      this(null);
+    }
+
+    public GeodeCacheFacade(GemFireCacheImpl cache) {
+      this.cache = cache;
+    }
+
+    @Override
+    public Map<PartitionedRegion, InternalPRInfo> getRegionMemberDetails() {
+      GemFireCacheImpl cache = getCache();
+      Map<PartitionedRegion, InternalPRInfo> detailsMap = new HashMap<>();
+      for (PartitionedRegion region : cache.getPartitionedRegions()) {
+        LoadProbe probe = cache.getResourceManager().getLoadProbe();
+        InternalPRInfo info = region.getRedundancyProvider().buildPartitionedRegionInfo(true, probe);
+        detailsMap.put(region, info);
+      }
+      return detailsMap;
+    }
+
+    @Override
+    public long getTotalDataSize(Map<PartitionedRegion, InternalPRInfo> details) {
+      long totalSize = 0;
+      if (details != null) {
+        for (PartitionedRegion region : details.keySet()) {
+          InternalPRInfo info = details.get(region);
+          Set<PartitionMemberInfo> membersInfo = info.getPartitionMemberInfo();
+          for (PartitionMemberInfo member : membersInfo) {
+            if (logger.isDebugEnabled()) {
+              logger.debug("Region:{}, Member: {}, Size: {}", region.getFullPath(), member, member.getSize());
+            }
+            totalSize += member.getSize();
+          }
+        }
+      }
+      return totalSize;
+    }
+
+    @Override
+    public long getTotalTransferSize() {
+      try {
+        RebalanceOperation operation = getCache().getResourceManager().createRebalanceFactory().simulate();
+        RebalanceResults result = operation.getResults();
+        if (logger.isDebugEnabled()) {
+          logger.debug(
+              "Rebalance estimate: RebalanceResultsImpl [TotalBucketCreateBytes=" + result.getTotalBucketCreateBytes()
+                  + ", TotalBucketCreatesCompleted=" + result.getTotalBucketCreatesCompleted()
+                  + ", TotalBucketTransferBytes=" + result.getTotalBucketTransferBytes()
+                  + ", TotalBucketTransfersCompleted=" + result.getTotalBucketTransfersCompleted()
+                  + ", TotalPrimaryTransfersCompleted=" + result.getTotalPrimaryTransfersCompleted() + "]");
+        }
+        return result.getTotalBucketTransferBytes();
+      } catch (CancellationException e) {
+        logger.info("Error while trying to estimate rebalance cost ", e);
+      } catch (InterruptedException e) {
+        logger.info("Error while trying to estimate rebalance cost ", e);
+      }
+      return 0;
+    }
+
+    @Override
+    public void incrementAttemptCounter() {
+      GemFireCacheImpl cache = getCache();
+      try {
+        cache.getResourceManager().getStats().incAutoRebalanceAttempts();
+      } catch (Exception e) {
+        logger.warn("Failed to increment AutoBalanceAttempts counter");
+      }
+    }
+
+    @Override
+    public void rebalance() {
+      try {
+        RebalanceOperation operation = getCache().getResourceManager().createRebalanceFactory().start();
+        RebalanceResults result = operation.getResults();
+        logger.info("Rebalance result: [TotalBucketCreateBytes=" + result.getTotalBucketCreateBytes()
+            + ", TotalBucketCreateTime=" + result.getTotalBucketCreateTime() + ", TotalBucketCreatesCompleted="
+            + result.getTotalBucketCreatesCompleted() + ", TotalBucketTransferBytes="
+            + result.getTotalBucketTransferBytes() + ", TotalBucketTransferTime=" + result.getTotalBucketTransferTime()
+            + ", TotalBucketTransfersCompleted=" + +result.getTotalBucketTransfersCompleted()
+            + ", TotalPrimaryTransferTime=" + result.getTotalPrimaryTransferTime() + ", TotalPrimaryTransfersCompleted="
+            + result.getTotalPrimaryTransfersCompleted() + ", TotalTime=" + result.getTotalTime() + "]");
+      } catch (CancellationException e) {
+        logger.info("Error rebalancing the cluster", e);
+      } catch (InterruptedException e) {
+        logger.info("Error rebalancing the cluster", e);
+      }
+    }
+
+    GemFireCacheImpl getCache() {
+      if (cache == null) {
+        synchronized (this) {
+          if (cache == null) {
+            cache = GemFireCacheImpl.getInstance();
+            if (cache == null) {
+              throw new IllegalStateException("Missing cache instance.");
+            }
+          }
+        }
+      }
+      if (cache.isClosed()) {
+        throw new CacheClosedException();
+      }
+      return cache;
+    }
+
+    @Override
+    public boolean acquireAutoBalanceLock() {
+      if (!isLockAcquired.get()) {
+        synchronized (isLockAcquired) {
+          if (!isLockAcquired.get()) {
+            DistributedLockService dls = getDLS();
+
+            boolean result = dls.lock(AUTO_BALANCER_LOCK, 0, -1);
+            if (result) {
+              isLockAcquired.set(true);
+              if (logger.isDebugEnabled()) {
+                logger.debug("Grabbed AutoBalancer lock");
+              }
+            } else {
+              if (logger.isDebugEnabled()) {
+                logger.debug("Another member owns auto-balance lock. Skip this attempt to rebalance the cluster");
+              }
+            }
+          }
+        }
+      }
+      return isLockAcquired.get();
+    }
+
+    @Override
+    public DistributedLockService getDLS() {
+      GemFireCacheImpl cache = getCache();
+      DistributedLockService dls = DistributedLockService.getServiceNamed(AUTO_BALANCER_LOCK_SERVICE_NAME);
+      if (dls == null) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Creating DistributeLockService");
+        }
+        dls = DLockService.create(AUTO_BALANCER_LOCK_SERVICE_NAME, cache.getDistributedSystem(), true, true, true);
+      }
+
+      return dls;
+    }
+  }
+
+  private class SystemClockTimeProvider implements TimeProvider {
+    @Override
+    public long currentTimeMillis() {
+      return System.currentTimeMillis();
+    }
+  }
+
+  interface AuditScheduler {
+    void init(String schedule);
+
+    void destroy();
+  }
+
+  interface OOBAuditor {
+    void init(Properties props);
+
+    void execute();
+  }
+
+  interface TimeProvider {
+    long currentTimeMillis();
+  }
+
+  interface CacheOperationFacade {
+    boolean acquireAutoBalanceLock();
+
+    DistributedLockService getDLS();
+
+    void rebalance();
+
+    void incrementAttemptCounter();
+
+    Map<PartitionedRegion, InternalPRInfo> getRegionMemberDetails();
+
+    long getTotalDataSize(Map<PartitionedRegion, InternalPRInfo> details);
+
+    long getTotalTransferSize();
+  }
+
+  OOBAuditor getOOBAuditor() {
+    return auditor;
+  }
+
+  public CacheOperationFacade getCacheOperationFacade() {
+    return this.cacheFacade;
+  }
+
+  public void destroy() {
+    scheduler.destroy();
+  }
+}



[18/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
new file mode 100644
index 0000000..19edd7d
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
@@ -0,0 +1,737 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.cache.EntryExistsException;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.BatchException70;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+import java.net.SocketException;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Test the functionality of ParallelGatewaySender with multiple dispatchers.
+ *
+ */
+@Category(DistributedTest.class)
+public class ConcurrentParallelGatewaySenderDUnitTest extends WANTestBase {
+  
+  public ConcurrentParallelGatewaySenderDUnitTest() {
+    super();
+  }
+  
+  /**
+   * Normal happy scenario test case.
+   * checks that all the dispatchers have successfully 
+   * dispatched something individually.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationConcurrentArtifacts() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    try {
+      // set the test hook to find out dispatched events by each of the
+      // concurrent dispatcher
+      vm4.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
+      vm5.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
+      vm6.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
+      vm7.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+          1000 ));
+
+      // verify all buckets drained on all sender nodes.
+      vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+      vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+      vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+      vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
+
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_PR", 1000 ));
+
+      int dispatched1 = (Integer)vm4.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
+      int dispatched2 = (Integer)vm5.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
+      int dispatched3 = (Integer)vm6.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
+      int dispatched4 = (Integer)vm7.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
+
+      assertEquals(1000, dispatched1 + dispatched2 + dispatched3 + dispatched4);
+    }
+    finally {
+      vm4.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
+      vm5.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
+      vm6.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
+      vm7.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
+    }
+  }
+  
+  /**
+   * Normal happy scenario test case.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  
+  /**
+   * Normal happy scenario test case when bucket division tests boundary cases.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithUnEqualBucketDivision() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+        1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  
+  /**
+   * Initially the GatewayReceiver is not up but later it comes up.
+   * We verify that 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagation_withoutRemoteSite() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //keep a larger batch to minimize number of exception occurrences in the log
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    createReceiverInVMs(vm2, vm3);
+
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    // Just making sure that though the remote site is started later,
+    // remote site is still able to get the data. Since the receivers are
+    // started before creating partition region it is quite possible that the
+    // region may loose some of the events. This needs to be handled by the code
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 1000 ));
+  }
+  
+  /**
+   * Testing for colocated region with orderPolicy Partition
+   */
+  @Test
+  public void testParallelPropagationColocatedPartitionedRegions() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
+
+
+    vm4.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
+
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.putcolocatedPartitionedRegion( 1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      customerRegionName, 1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      orderRegionName, 1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      shipmentRegionName, 1000 ));
+  }
+  
+  /**
+   * Local and remote sites are up and running.
+   * Local site cache is closed and the site is built again.
+   * Puts are done to local site.
+   * Expected: Remote site should receive all the events put after the local
+   * site was built back.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithLocalCacheClosedAndRebuilt() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    //before doing any puts, let the senders be running in order to ensure that
+    //not a single event will be lost
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
+      1000 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+              getTestMethodName() + "_PR", 1000 ));
+    //-------------------Close and rebuild local site ---------------------------------
+
+    vm4.invoke(() -> WANTestBase.killSender());
+    vm5.invoke(() -> WANTestBase.killSender());
+    vm6.invoke(() -> WANTestBase.killSender());
+    vm7.invoke(() -> WANTestBase.killSender());
+    
+    Integer regionSize = 
+      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_PR" ));
+    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
+    
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    //------------------------------------------------------------------------------------
+    
+    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_PR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+  }
+  
+  /**
+   * Colocated regions using ConcurrentParallelGatewaySender.
+   * Normal scenario 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelColocatedPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+  }
+  
+  
+  /**
+   * Colocated regions using ConcurrentParallelGatewaySender.
+   * Normal scenario 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelColocatedPropagationOrderPolicyPartition() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
+
+    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName(), 1000 ));
+  }
+  
+  @Test
+  public void testPartitionedParallelPropagationHA() throws Exception {
+    IgnoredException.addIgnoredException(SocketException.class.getName()); // for Connection reset
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    AsyncInvocation inv1 = vm7.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
+    vm2.invoke(() -> Awaitility.await().atMost(30000, TimeUnit.MILLISECONDS).until(() ->
+      assertEquals("Failure in waiting for at least 10 events to be received by the receiver",
+        true, (getRegionSize(getTestMethodName() + "_PR") > 10 ))));
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));
+    vm2.invoke(() -> Awaitility.await().atMost(30000, TimeUnit.MILLISECONDS).until(() ->
+      assertEquals("Failure in waiting for additional 2000 events to be received by the receiver ",
+        true,getRegionSize(getTestMethodName() + "_PR") > 7000 )));
+    AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
+    inv1.join();
+    inv2.join();
+    inv3.join();
+    inv4.join();
+
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 10000 ));
+    
+    //verify all buckets drained on the sender nodes that up and running.
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+  }
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_ConcurrentParallelSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap()));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
+
+    startSenderInVMs("ln", vm3, vm4);
+
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 10 ));
+  }
+  
+  @Test
+  public void testWANPDX_PR_MultipleVM_ConcurrentParallelSender_StartedLater() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+    vm4.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 0, 2, isOffHeap()));
+
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
+    
+    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+        10 ));
+
+    startSenderInVMsAsync("ln", vm3, vm4);
+
+    vm4.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
+      40 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
+        getTestMethodName() + "_PR", 40 ));
+  }
+
+  public static void setTestHook(String senderId, boolean hook) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    ConcurrentParallelGatewaySenderEventProcessor cProc = (ConcurrentParallelGatewaySenderEventProcessor)((AbstractGatewaySender)sender)
+        .getEventProcessor();
+    if (cProc == null) return;
+    cProc.TEST_HOOK = hook;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java
new file mode 100644
index 0000000..da8a631
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@SuppressWarnings("serial")
+@Category(DistributedTest.class)
+public class ConcurrentParallelGatewaySenderOffHeapDUnitTest extends
+    ConcurrentParallelGatewaySenderDUnitTest {
+
+  public ConcurrentParallelGatewaySenderOffHeapDUnitTest() {
+    super();
+  }
+
+  @Override
+  public boolean isOffHeap() {
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java
new file mode 100644
index 0000000..ab1c06b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java
@@ -0,0 +1,796 @@
+/*
+ * 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.internal.cache.wan.concurrent;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTestBase {
+  private static final long serialVersionUID = 1L;
+  
+  public ConcurrentParallelGatewaySenderOperation_1_DUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+  }
+  
+  @Test
+  public void testParallelGatewaySenderWithoutStarting() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    vm5.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    vm6.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    vm7.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 0 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 0 ));
+  }
+  
+  /**
+   * Defect 44323 (ParallelGatewaySender should not be started on Accessor node)
+   */
+  @Test
+  public void testParallelGatewaySenderStartOnAccessorNode() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
+        getTestMethodName() + "_PR", "ln", 1, 100 ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
+        getTestMethodName() + "_PR", "ln", 1, 100 ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    
+    //start the senders
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+  }
+
+  
+  /**
+   * Normal scenario in which the sender is paused in between.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationSenderPause() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //FIRST RUN: now, the senders are started. So, start the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+    
+    //now, pause all of the senders
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    Wait.pause(2000);
+    //SECOND RUN: keep one thread doing puts to the region
+    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //verify region size remains on remote vm and is restricted below a specified limit (i.e. number of puts in the first run)
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
+  }
+
+  /**
+   * Normal scenario in which a paused sender is resumed.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationSenderResume() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //now, the senders are started. So, start the puts
+    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //now, pause all of the senders
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    
+    //sleep for a second or two
+    Wait.pause(2000);
+    
+    //resume the senders
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    Wait.pause(2000);
+    
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    //find the region size on remote vm
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+ 
+  }
+  
+  /**
+   * Negative scenario in which a sender that is stopped (and not paused) is resumed.
+   * Expected: resume is only valid for pause. If a sender which is stopped is resumed,
+   * it will not be started again.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationSenderResumeNegativeScenario() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(nyPort, vm4, vm5);
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    //wait till the senders are running
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+    //start the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+
+    //let the queue drain completely
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
+    
+    //stop the senders
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    //now, try to resume a stopped sender
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    
+    //do more puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //validate region size on remote vm to contain only the events put in local site 
+    //before the senders are stopped.
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 100 ));
+  }
+
+  /**
+   * Normal scenario in which a sender is stopped.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationSenderStop() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
+    
+    //now, stop all of the senders
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    //SECOND RUN: keep one thread doing puts
+    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //verify region size remains on remote vm and is restricted below a specified limit (number of puts in the first run)
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
+  }
+
+  /**
+   * Normal scenario in which a sender is stopped and then started again.
+   */
+  @Test
+  public void testParallelPropagationSenderStartAfterStop() throws Throwable {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
+    
+    //now, stop all of the senders
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    Wait.pause(2000);
+
+    //SECOND RUN: do some of the puts after the senders are stopped
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+    
+    //start the senders again
+    AsyncInvocation vm4start = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm5start = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm6start = vm6.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm7start = vm7.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    int START_TIMEOUT = 30000;
+    vm4start.getResult(START_TIMEOUT);
+    vm5start.getResult(START_TIMEOUT);
+    vm6start.getResult(START_TIMEOUT);
+    vm7start.getResult(START_TIMEOUT);
+
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+
+    //SECOND RUN: do some more puts
+    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    async.join();
+    
+    //verify all the buckets on all the sender nodes are drained
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    //verify the events propagate to remote site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm6.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm7.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+  }
+
+  /**
+   * Normal scenario in which a sender is stopped and then started again.
+   * Differs from above test case in the way that when the sender is starting from
+   * stopped state, puts are simultaneously happening on the region by another thread.
+   * @throws Exception
+   */
+  @Ignore("Bug47553")
+  @Test
+  public void testParallelPropagationSenderStartAfterStop_Scenario2() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //make sure all the senders are running before doing any puts
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("All the senders are now started");
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
+    
+    LogWriterUtils.getLogWriter().info("Done few puts");
+    
+    //now, stop all of the senders
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("All the senders are stopped");
+    Wait.pause(2000);
+    
+    //SECOND RUN: do some of the puts after the senders are stopped
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Done some more puts in second run");
+    
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+    
+    //SECOND RUN: start async puts on region
+    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
+    LogWriterUtils.getLogWriter().info("Started high number of puts by async thread");
+
+    LogWriterUtils.getLogWriter().info("Starting the senders at the same time");
+    //when puts are happening by another thread, start the senders
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("All the senders are started");
+    
+    async.join();
+        
+    Wait.pause(2000);
+    
+    //verify all the buckets on all the sender nodes are drained
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    //verify that the queue size ultimately becomes zero. That means all the events propagate to remote site.
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
+  }
+  
+  /**
+   * Normal scenario in which a sender is stopped and then started again on accessor node.
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationSenderStartAfterStopOnAccessorNode() throws Throwable {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
+        getTestMethodName() + "_PR", "ln", 1, 100));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
+        getTestMethodName() + "_PR", "ln", 1, 100));
+
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+
+
+    createReceiverInVMs(vm2, vm3);
+
+    //make sure all the senders are not running on accessor nodes and running on non-accessor nodes
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    //FIRST RUN: now, the senders are started. So, do some of the puts
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
+
+    //now, stop all of the senders
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    //SECOND RUN: do some of the puts after the senders are stopped
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+    
+    //start the senders again
+    AsyncInvocation vm4start = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm5start = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm6start = vm6.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm7start = vm7.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    vm4start.join();
+    vm5start.join();
+    vm6start.join();
+    vm7start.join();
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+
+
+    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
+    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
+
+    //SECOND RUN: do some more puts
+    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    async.join();
+
+    //verify all buckets drained only on non-accessor nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    
+    //verify the events propagate to remote site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
+  }
+
+  
+  /**
+   * Normal scenario in which a combinations of start, pause, resume operations
+   * is tested
+   */
+  @Test
+  public void testStartPauseResumeParallelGatewaySender() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Created cache on local site");
+    
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
+    
+    LogWriterUtils.getLogWriter().info("Created senders on local site");
+    
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
+
+    LogWriterUtils.getLogWriter().info("Created PRs on local site");
+    
+    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
+    LogWriterUtils.getLogWriter().info("Created PRs on remote site");
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Done 1000 puts on local site");
+    
+    //Since puts are already done on userPR, it will have the buckets created. 
+    //During sender start, it will wait until those buckets are created for shadowPR as well.
+    //Start the senders in async threads, so colocation of shadowPR will be complete and 
+    //missing buckets will be created in PRHARedundancyProvider.createMissingBuckets().
+    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    LogWriterUtils.getLogWriter().info("Started senders on local site");
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
+    LogWriterUtils.getLogWriter().info("Done 5000 puts on local site");
+    
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Paused senders on local site");
+    
+    vm4.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    vm5.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    vm6.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    vm7.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
+    
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
+    LogWriterUtils.getLogWriter().info("Started 1000 async puts on local site");
+
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    LogWriterUtils.getLogWriter().info("Resumed senders on local site");
+
+    vm4.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+    vm5.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+    vm6.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+    vm7.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
+
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail("Interrupted the async invocation.");
+    }
+    
+    //verify all buckets drained on all sender nodes.
+    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 5000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_PR", 5000 ));
+  }
+}


[44/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
new file mode 100644
index 0000000..8c7754a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
@@ -0,0 +1,182 @@
+/*
+ * 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.lucene.internal.repository;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.SerializerUtil;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.*;
+import org.apache.lucene.store.AlreadyClosedException;
+
+import java.io.IOException;
+import java.util.function.IntSupplier;
+
+/**
+ * A repository that writes to a single lucene index writer
+ */
+public class IndexRepositoryImpl implements IndexRepository {
+  
+  private static final boolean APPLY_ALL_DELETES = System
+      .getProperty(DistributionConfig.GEMFIRE_PREFIX + "IndexRepository.APPLY_ALL_DELETES", "true")
+      .equalsIgnoreCase("true");
+  
+  private final IndexWriter writer;
+  private final LuceneSerializer serializer;
+  private final SearcherManager searcherManager;
+  private Region<?,?> region;
+  private Region<?,?> userRegion;
+  private LuceneIndexStats stats;
+  private DocumentCountSupplier documentCountSupplier;
+
+  private static final Logger logger = LogService.getLogger();
+  
+  public IndexRepositoryImpl(Region<?,?> region, IndexWriter writer, LuceneSerializer serializer, LuceneIndexStats stats, Region<?, ?> userRegion) throws IOException {
+    this.region = region;
+    this.userRegion = userRegion;
+    this.writer = writer;
+    searcherManager = new SearcherManager(writer, APPLY_ALL_DELETES, true, null);
+    this.serializer = serializer;
+    this.stats = stats;
+    documentCountSupplier = new DocumentCountSupplier();
+    stats.addDocumentsSupplier(documentCountSupplier);
+  }
+
+  @Override
+  public void create(Object key, Object value) throws IOException {
+    long start = stats.startUpdate();
+    try {
+      Document doc = new Document();
+      SerializerUtil.addKey(key, doc);
+      serializer.toDocument(value, doc);
+      writer.addDocument(doc);
+    } finally {
+      stats.endUpdate(start);
+    }
+  }
+
+  @Override
+  public void update(Object key, Object value) throws IOException {
+    long start = stats.startUpdate();
+    try {
+      Document doc = new Document();
+      SerializerUtil.addKey(key, doc);
+      serializer.toDocument(value, doc);
+      writer.updateDocument(SerializerUtil.getKeyTerm(doc), doc);
+    } finally {
+      stats.endUpdate(start);
+    }
+  }
+
+  @Override
+  public void delete(Object key) throws IOException {
+    long start = stats.startUpdate();
+    try {
+      Term keyTerm = SerializerUtil.toKeyTerm(key);
+      writer.deleteDocuments(keyTerm);
+    } finally {
+      stats.endUpdate(start);
+    }
+  }
+
+  @Override
+  public void query(Query query, int limit, IndexResultCollector collector) throws IOException {
+    long start = stats.startQuery();
+    int totalHits = 0;
+    IndexSearcher searcher = searcherManager.acquire();
+    try {
+      TopDocs docs = searcher.search(query, limit);
+      totalHits = docs.totalHits;
+      for(ScoreDoc scoreDoc : docs.scoreDocs) {
+        Document doc = searcher.doc(scoreDoc.doc);
+        Object key = SerializerUtil.getKey(doc);
+        if (logger.isDebugEnabled()) {
+          logger.debug("query found doc:"+doc+":"+scoreDoc);
+        }
+        collector.collect(key, scoreDoc.score);
+      }
+    } finally {
+      searcherManager.release(searcher);
+      stats.endQuery(start, totalHits);
+    }
+  }
+
+  @Override
+  public synchronized void commit() throws IOException {
+    long start = stats.startCommit();
+    try {
+      writer.commit();
+      searcherManager.maybeRefresh();
+    } finally {
+      stats.endCommit(start);
+    }
+  }
+
+  public IndexWriter getWriter() {
+    return writer;
+  }
+
+  @Override
+  public Region<?, ?> getRegion() {
+    return region;
+  }
+
+  public LuceneSerializer getSerializer() {
+    return serializer;
+  }
+
+  @Override
+  public boolean isClosed() {
+    return userRegion.isDestroyed();
+  }
+
+  @Override
+  public void cleanup() {
+    stats.removeDocumentsSupplier(documentCountSupplier);
+    try {
+      writer.close();
+    }
+    catch (IOException e) {
+      logger.warn("Unable to clean up index repository", e);
+    }
+  }
+
+  private class DocumentCountSupplier implements IntSupplier {
+    @Override
+    public int getAsInt() {
+      if(isClosed()) {
+        stats.removeDocumentsSupplier(this);
+        return 0;
+      }
+      try {
+        return writer.numDocs();
+      } catch(AlreadyClosedException e) {
+        //ignore
+        return 0;
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexResultCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexResultCollector.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexResultCollector.java
new file mode 100644
index 0000000..7fd9e2a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexResultCollector.java
@@ -0,0 +1,47 @@
+/*
+ * 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.lucene.internal.repository;
+
+import com.gemstone.gemfire.annotations.Experimental;
+
+/**
+ * Interface for collection results of a query on
+ * an IndexRepository. See {@link IndexRepository#query(org.apache.lucene.search.Query, int, IndexResultCollector)}
+ */
+@Experimental
+public interface IndexResultCollector {
+  /**
+   * @return Name/identifier of this collector
+   */
+  public String getName();
+
+  /**
+   * @return Number of results collected by this collector
+   */
+  public int size();
+
+  /**
+   * Collect a single document
+   * 
+   * @param key the gemfire key of the object
+   * @param score the lucene score of this object
+   */
+  void collect(Object key, float score);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/RepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/RepositoryManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/RepositoryManager.java
new file mode 100644
index 0000000..8f8d202
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/RepositoryManager.java
@@ -0,0 +1,44 @@
+/*
+ * 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.lucene.internal.repository;
+
+import java.util.Collection;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+
+/**
+ * {@link RepositoryManager} instances will be used to get {@link IndexRepository} instances hosting index data for
+ * {@link Region}s
+ */
+public interface RepositoryManager {
+
+  IndexRepository getRepository(Region region, Object key, Object callbackArg) throws BucketNotFoundException;
+
+  /**
+   * Returns a collection of {@link IndexRepository} instances hosting index data of the input list of bucket ids. The
+   * bucket needs to be present on this member.
+   * 
+   * @return a collection of {@link IndexRepository} instances
+   * @throws BucketNotFoundException if any of the requested buckets is not found on this member
+   */
+  Collection<IndexRepository> getRepositories(RegionFunctionContext context) throws BucketNotFoundException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/package-info.java
new file mode 100644
index 0000000..894b464
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+/**
+ * The repository package contains classes for managing a Lucene index in geode.
+ *
+ * All lucene index access should be through the {@link com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository}
+ * class.
+ */
+package com.gemstone.gemfire.cache.lucene.internal.repository;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
new file mode 100644
index 0000000..271f0fd
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
@@ -0,0 +1,107 @@
+/*
+ * 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.lucene.internal.repository.serializer;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.document.Document;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.util.concurrent.CopyOnWriteWeakHashMap;
+import com.gemstone.gemfire.pdx.PdxInstance;
+
+/**
+ * An implementation of LuceneSerializer that reads the fields
+ * of a given object using reflection or from a PDX instance and
+ * writes them to a lucene document.
+ */
+public class HeterogeneousLuceneSerializer implements LuceneSerializer {
+  /**
+   * The set of indexed fields for this mapper
+   */
+  private String[] indexedFields;
+  
+  /**
+   * A mapper for converting a PDX object into a document
+   */
+  private LuceneSerializer pdxMapper;
+
+  /**
+   * Mappers for each individual class type that this class has seen.
+   * 
+   * Weak so that entry will be removed if a class is garbage collected.
+   */
+  private Map<Class<?>, LuceneSerializer> mappers = new CopyOnWriteWeakHashMap<Class<?>, LuceneSerializer>();
+  
+  private static final Logger logger = LogService.getLogger();
+  
+  public HeterogeneousLuceneSerializer(String[] indexedFields) {
+    this.indexedFields = indexedFields;
+    pdxMapper = new PdxLuceneSerializer(indexedFields);
+
+
+    addSerializersForPrimitiveValues();
+  }
+
+  /**
+   * Add serializers for the primitive value types (String, Number, etc.)
+   * if the user has requested that the whole value be serialized
+   */
+  private void addSerializersForPrimitiveValues() {
+    if(Arrays.asList(indexedFields).contains(LuceneService.REGION_VALUE_FIELD)) {
+      final PrimitiveSerializer primitiveSerializer = new PrimitiveSerializer();
+      SerializerUtil.supportedPrimitiveTypes().stream()
+        .forEach(type -> mappers.put(type, primitiveSerializer));
+    }
+  }
+
+  @Override
+  public void toDocument(Object value, Document doc) {
+    
+    LuceneSerializer mapper = getFieldMapper(value);
+    
+    mapper.toDocument(value, doc);
+    if (logger.isDebugEnabled()) {
+      logger.debug("HeterogeneousLuceneSerializer.toDocument:"+doc);
+    }
+  }
+
+  /**
+   * Get the field mapper based on the type of the given object.
+   */
+  private LuceneSerializer getFieldMapper(Object value) {
+    if(value instanceof PdxInstance) {
+      return pdxMapper;
+    } else {
+      Class<?> clazz = value.getClass();
+      LuceneSerializer mapper = mappers.get(clazz);
+      if(mapper == null) {
+        mapper = new ReflectionLuceneSerializer(clazz, indexedFields);
+        mappers.put(clazz, mapper);
+      }
+      return mapper;
+    }
+  }
+  
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
new file mode 100644
index 0000000..421dc0b
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.lucene.internal.repository.serializer;
+
+import org.apache.lucene.document.Document;
+
+/**
+ * An interface for writing the fields of an
+ * object into a lucene document
+ */
+public interface LuceneSerializer {
+
+  /**
+   * Add the fields of the given value to the document
+   */
+  void toDocument(Object value, Document doc);
+  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
new file mode 100644
index 0000000..13465d7
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.lucene.internal.repository.serializer;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.document.Document;
+
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.pdx.PdxInstance;
+
+/**
+ * LuceneSerializer which can handle any PdxInstance
+ */
+class PdxLuceneSerializer implements LuceneSerializer {
+
+  private String[] indexedFields;
+
+  private static final Logger logger = LogService.getLogger();
+
+  public PdxLuceneSerializer(String[] indexedFields) {
+    this.indexedFields = indexedFields;
+  }
+
+  @Override
+  public void toDocument(Object value, Document doc) {
+    PdxInstance pdx = (PdxInstance) value;
+    for(String field : indexedFields) {
+      if(pdx.hasField(field)) {
+        Object fieldValue = pdx.getField(field);
+        if (fieldValue == null) {
+          continue;
+        }
+        SerializerUtil.addField(doc, field, fieldValue);
+      }
+    }
+    if (logger.isDebugEnabled()) {
+      logger.debug("PdxLuceneSerializer.toDocument:"+doc);
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
new file mode 100644
index 0000000..d096637
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.lucene.internal.repository.serializer;
+
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+
+import org.apache.lucene.document.Document;
+
+/**
+ * A LuceneSerializer that can serialize a primitive value (String, int, long, double)
+ * by creating a document with a special field containing the value
+ */
+public class PrimitiveSerializer implements LuceneSerializer {
+
+  @Override
+  public void toDocument(final Object value, final Document doc) {
+    SerializerUtil.addField(doc, LuceneService.REGION_VALUE_FIELD, value);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
new file mode 100644
index 0000000..e06f99e
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
@@ -0,0 +1,85 @@
+/*
+ * 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.lucene.internal.repository.serializer;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.lucene.document.Document;
+
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * A lucene serializer that handles a single class and can
+ * map an instance of that class to a document using reflection.
+ */
+class ReflectionLuceneSerializer implements LuceneSerializer {
+
+  private Field[] fields;
+
+  private static final Logger logger = LogService.getLogger();
+  
+  public ReflectionLuceneSerializer(Class<? extends Object> clazz,
+      String[] indexedFields) {
+    Set<String> fieldSet = new HashSet<String>();
+    fieldSet.addAll(Arrays.asList(indexedFields));
+
+    //Iterate through all declared fields and save them
+    //in a list if they are an indexed field and have the correct
+    //type.
+    ArrayList<Field> foundFields = new ArrayList<Field>();
+    while(clazz != Object.class) {
+      for(Field field : clazz.getDeclaredFields()) {
+        Class<?> type = field.getType();
+        if(fieldSet.contains(field.getName()) 
+            && SerializerUtil.isSupported(type)) {
+          field.setAccessible(true);
+          foundFields.add(field);
+        }
+      }
+      
+      clazz = clazz.getSuperclass();
+    }
+    
+    this.fields = foundFields.toArray(new Field[foundFields.size()]);
+  }
+
+  @Override
+  public void toDocument(Object value, Document doc) {
+    for(Field field: fields) {
+      try {
+        Object fieldValue = field.get(value);
+        if (fieldValue == null) {
+          continue;
+        }
+        SerializerUtil.addField(doc, field.getName(), fieldValue);
+      } catch (IllegalArgumentException | IllegalAccessException e) {
+        //TODO - what to do if we can't read a field?
+      }
+    }
+    if (logger.isDebugEnabled()) {
+      logger.debug("ReflectionLuceneSerializer.toDocument:"+doc);
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/SerializerUtil.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/SerializerUtil.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/SerializerUtil.java
new file mode 100644
index 0000000..4d563c1
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/SerializerUtil.java
@@ -0,0 +1,190 @@
+/*
+ * 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.lucene.internal.repository.serializer;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.DoublePoint;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.document.FloatPoint;
+import org.apache.lucene.document.IntPoint;
+import org.apache.lucene.document.LongPoint;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.util.BytesRef;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.internal.util.BlobHelper;
+
+/**
+ * Static utility functions for mapping objects to lucene documents
+ */
+public class SerializerUtil {
+  private static final String KEY_FIELD = "_KEY";
+
+  private static final Set<Class> SUPPORTED_PRIMITIVE_TYPES;
+
+  static {
+    HashSet<Class> primitiveTypes = new HashSet<>();
+    primitiveTypes.add(String.class);
+    primitiveTypes.add(long.class);
+    primitiveTypes.add(int.class);
+    primitiveTypes.add(float.class);
+    primitiveTypes.add(double.class);
+    primitiveTypes.add(Long.class);
+    primitiveTypes.add(Integer.class);
+    primitiveTypes.add(Float.class);
+    primitiveTypes.add(Double.class);
+
+    SUPPORTED_PRIMITIVE_TYPES = Collections.unmodifiableSet(primitiveTypes);
+  }
+  
+  /**
+   * A small buffer for converting keys to byte[] arrays.
+   */
+  private static ThreadLocal<ByteArrayOutputStream> LOCAL_BUFFER = new ThreadLocal<ByteArrayOutputStream>() {
+    @Override
+    protected ByteArrayOutputStream initialValue() {
+      return new ByteArrayOutputStream();
+    }
+  };
+
+  private SerializerUtil() {
+  }
+  
+  /**
+   * Add a gemfire key to a document
+   */
+  public static void addKey(Object key, Document doc) {
+    if(key instanceof String) {
+      doc.add(new StringField(KEY_FIELD, (String) key, Store.YES));
+    } else {
+      doc.add(new StringField(KEY_FIELD, keyToBytes(key), Store.YES));
+    }
+  }
+
+  /**
+   * Add a field to the document.
+   * 
+   * @return true if the field was successfully added
+   */
+  public static boolean addField(Document doc, String field, Object fieldValue) {
+    Class<?> clazz = fieldValue.getClass();
+    if(clazz == String.class) {
+      doc.add(new TextField(field, (String)fieldValue, Store.NO));
+    } else if (clazz == Long.class) {
+      doc.add(new LongPoint(field, (Long) fieldValue));
+    } else if (clazz == Integer.class) {
+      doc.add(new IntPoint(field, (Integer) fieldValue));
+    } else if (clazz == Float.class) {
+      doc.add(new FloatPoint(field, (Float) fieldValue));
+    }  else if (clazz == Double.class) {
+        doc.add(new DoublePoint(field, (Double) fieldValue));
+    } else {
+      return false;
+    }
+    
+    return true;
+  }
+
+  /**
+   * Return true if a field type can be written to a lucene document.
+   */
+  public static boolean isSupported(Class<?> type) {
+    return SUPPORTED_PRIMITIVE_TYPES.contains(type);
+  }
+
+  public static Collection<Class> supportedPrimitiveTypes() {
+    return SUPPORTED_PRIMITIVE_TYPES;
+  }
+  
+  /**
+   * Extract the gemfire key from a lucene document
+   */
+  public static Object getKey(Document doc) {
+    IndexableField field = doc.getField(KEY_FIELD);
+    if(field.stringValue() != null) {
+      return field.stringValue();
+    } else {
+      return  keyFromBytes(field.binaryValue());
+    }
+  }
+ 
+  /**
+   * Extract the gemfire key term from a lucene document
+   */
+  public static Term getKeyTerm(Document doc) {
+    IndexableField field = doc.getField(KEY_FIELD);
+    if(field.stringValue() != null) {
+      return new Term(KEY_FIELD, field.stringValue());
+    } else {
+      return new Term(KEY_FIELD, field.binaryValue());
+    }
+  }
+  
+  /**
+   * Convert a gemfire key into a key search term that can be used to
+   * update or delete the document associated with this key.
+   */
+  public static Term toKeyTerm(Object key) {
+    if(key instanceof String) {
+      return new Term(KEY_FIELD, (String) key);
+    } else {
+      return new Term(KEY_FIELD, keyToBytes(key));
+    }
+  }
+  
+  private static Object keyFromBytes(BytesRef bytes) {
+    try {
+      return BlobHelper.deserializeBlob(bytes.bytes);
+    } catch (ClassNotFoundException | IOException e) {
+      throw new InternalGemFireError(e);
+    }
+  }
+  
+  /**
+   * Convert a key to a byte array.
+   */
+  private static BytesRef keyToBytes(Object key)  {
+    ByteArrayOutputStream buffer = LOCAL_BUFFER.get();
+    
+    try {
+      DataOutputStream out = new DataOutputStream(buffer);
+      DataSerializer.writeObject(key, out);
+      out.flush();
+      BytesRef result = new BytesRef(buffer.toByteArray());
+      buffer.reset();
+      return result;
+    } catch (IOException e) {
+      throw new InternalGemFireError("Unable to serialize key", e);
+    }
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/package-info.java
new file mode 100644
index 0000000..dca7737
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * Classes for converting gemfire objects into lucene documents.
+ */
+
+package com.gemstone.gemfire.cache.lucene.internal.repository.serializer;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexCreation.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexCreation.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexCreation.java
new file mode 100644
index 0000000..98233b0
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexCreation.java
@@ -0,0 +1,113 @@
+/*
+ * 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.lucene.internal.xml;
+
+import java.util.*;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.internal.cache.extension.Extensible;
+import com.gemstone.gemfire.internal.cache.extension.Extension;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
+
+public class LuceneIndexCreation implements LuceneIndex, Extension<Region<?, ?>> {
+  private Region region;
+  private String name;
+  private Set<String> fieldNames = new LinkedHashSet<String>();
+  private Map<String, Analyzer> fieldAnalyzers;
+
+  
+  public void setRegion(Region region) {
+    this.region = region;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public void setFieldAnalyzers(
+      Map<String, Analyzer> fieldAnalyzers) {
+    this.fieldAnalyzers = fieldAnalyzers;
+  }
+  
+  @Override
+  public Map<String, Analyzer> getFieldAnalyzers() {
+    if (this.fieldAnalyzers == null) {
+      this.fieldAnalyzers = new HashMap<>();
+    }
+    return this.fieldAnalyzers;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public String[] getFieldNames() {
+    return fieldNames.toArray(new String[fieldNames.size()]);
+  }
+
+  @Override
+  public String getRegionPath() {
+    return region.getFullPath();
+  }
+
+  @Override
+  public XmlGenerator<Region<?, ?>> getXmlGenerator() {
+    return new LuceneIndexXmlGenerator(this);
+  }
+
+  @Override
+  public void beforeCreate(Extensible<Region<?, ?>> source, Cache cache) {
+    LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
+    Analyzer analyzer = this.fieldAnalyzers == null
+        ? new StandardAnalyzer()
+        : new PerFieldAnalyzerWrapper(new StandardAnalyzer(), this.fieldAnalyzers);
+    service.createIndex(getName(), getRegionPath(), analyzer, this.fieldAnalyzers, getFieldNames());
+  }
+
+  @Override
+  public void onCreate(Extensible<Region<?, ?>> source, Extensible<Region<?, ?>> target) {}
+
+  protected void addField(String name) {
+    this.fieldNames.add(name);
+  }
+
+  protected void addFieldAndAnalyzer(String name, Analyzer analyzer) {
+    this.fieldNames.add(name);
+    getFieldAnalyzers().put(name, analyzer);
+  }
+
+  public void addFieldNames(String[] fieldNames) {
+    this.fieldNames.addAll(Arrays.asList(fieldNames));
+  }
+
+  @Override
+  public boolean waitUntilFlushed(int maxWaitInMillisecond) {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java
new file mode 100644
index 0000000..37c9ca2
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java
@@ -0,0 +1,70 @@
+/*
+ * 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.lucene.internal.xml;
+
+import static com.gemstone.gemfire.cache.lucene.internal.xml.LuceneXmlConstants.*;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlGeneratorUtils;
+
+public class LuceneIndexXmlGenerator implements XmlGenerator<Region<?, ?>> {
+  private final LuceneIndex index;
+
+  public LuceneIndexXmlGenerator(LuceneIndex index) {
+    this.index = index;
+  }
+
+  @Override
+  public String getNamspaceUri() {
+    return NAMESPACE;
+  }
+
+  @Override
+  public void generate(CacheXmlGenerator cacheXmlGenerator)
+      throws SAXException {
+    final ContentHandler handler = cacheXmlGenerator.getContentHandler();
+
+    handler.startPrefixMapping(PREFIX, NAMESPACE);
+
+    AttributesImpl attr = new AttributesImpl();
+    //TODO - should the type be xs:string ?
+    XmlGeneratorUtils.addAttribute(attr, NAME, index.getName());
+    XmlGeneratorUtils.startElement(handler, PREFIX, INDEX, attr);
+    for(String field : index.getFieldNames()) {
+      AttributesImpl fieldAttr = new AttributesImpl();
+      XmlGeneratorUtils.addAttribute(fieldAttr, NAME, field);
+      Analyzer analyzer = index.getFieldAnalyzers().get(field);
+      if (analyzer != null) {
+        XmlGeneratorUtils.addAttribute(fieldAttr, ANALYZER, analyzer.getClass().getName());
+      }
+      XmlGeneratorUtils.emptyElement(handler, PREFIX, FIELD, fieldAttr);
+    }
+    XmlGeneratorUtils.endElement(handler, PREFIX, INDEX);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java
new file mode 100644
index 0000000..c449f47
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java
@@ -0,0 +1,39 @@
+/*
+ * 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.lucene.internal.xml;
+
+import org.xml.sax.SAXException;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
+
+public final class LuceneServiceXmlGenerator implements XmlGenerator<Cache> {
+  @Override
+  public String getNamspaceUri() {
+    return LuceneXmlConstants.NAMESPACE;
+  }
+
+  @Override
+  public void generate(CacheXmlGenerator cacheXmlGenerator)
+      throws SAXException {
+    //Nothing to to the xml at the service level at the moment.
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlConstants.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlConstants.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlConstants.java
new file mode 100644
index 0000000..91d1643
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlConstants.java
@@ -0,0 +1,32 @@
+/*
+ * 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.lucene.internal.xml;
+
+public class LuceneXmlConstants {
+  public static final String NAMESPACE= "http://geode.apache.org/schema/lucene";
+  public static final String PREFIX = "lucene";
+  public static final String SERVICE = "service";
+  public static final String NAME = "name";
+  public static final String REGION = "index";
+  public static final String INDEX = "index";
+  public static final String FIELD = "field";
+  public static final String ANALYZER = "analyzer";
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlParser.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlParser.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlParser.java
new file mode 100644
index 0000000..5bdbe04
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/LuceneXmlParser.java
@@ -0,0 +1,119 @@
+/*
+ * 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.lucene.internal.xml;
+
+import static com.gemstone.gemfire.cache.lucene.internal.xml.LuceneXmlConstants.*;
+
+import com.gemstone.gemfire.cache.CacheXmlException;
+import com.gemstone.gemfire.internal.InternalDataSerializer;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import org.apache.lucene.analysis.Analyzer;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.internal.cache.xmlcache.AbstractXmlParser;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
+
+public class LuceneXmlParser extends AbstractXmlParser {
+
+  @Override
+  public String getNamspaceUri() {
+    return NAMESPACE;
+  }
+
+  @Override
+  public void startElement(String uri, String localName, String qName,
+      Attributes atts) throws SAXException {
+    
+    if(!NAMESPACE.equals(uri)) {
+      return;
+    }
+    if(INDEX.equals(localName)) {
+      startIndex(atts);
+    }
+    if(FIELD.equals(localName)) {
+      startField(atts);
+    }
+  }
+
+  private void startField(Attributes atts) {
+    //Ignore any whitespace noise between fields
+    if(stack.peek() instanceof StringBuffer) {
+      stack.pop();
+    }
+    LuceneIndexCreation creation = (LuceneIndexCreation) stack.peek();
+    String name = atts.getValue(NAME);
+    String className = atts.getValue(ANALYZER);
+    if (className == null) {
+      creation.addField(name);
+    } else {
+      Analyzer analyzer = createAnalyzer(className);
+      creation.addFieldAndAnalyzer(name, analyzer);
+    }
+  }
+
+  private void startIndex(Attributes atts) {
+    final RegionCreation region = (RegionCreation) stack.peek();
+    String name = atts.getValue(NAME);
+    LuceneIndexCreation indexCreation = new LuceneIndexCreation();
+    indexCreation.setName(name);
+    indexCreation.setRegion(region);
+    region.getExtensionPoint().addExtension(indexCreation);
+    stack.push(indexCreation);
+  }
+
+  @Override
+  public void endElement(String uri, String localName, String qName)
+      throws SAXException {
+    if(!NAMESPACE.equals(uri)) {
+      return;
+    }
+    if(INDEX.equals(localName)) {
+      endIndex();
+    }
+  }
+
+  private void endIndex() {
+    //Ignore any whitespace noise between fields
+    if(stack.peek() instanceof StringBuffer) {
+      stack.pop();
+    }
+    
+    //Remove the index creation from the stack
+    stack.pop();
+  }
+
+  private Analyzer createAnalyzer(String className) {
+    Object obj;
+    try {
+      Class c = InternalDataSerializer.getCachedClass(className);
+      obj = c.newInstance();
+    }
+    catch (Exception ex) {
+      throw new CacheXmlException(LocalizedStrings.CacheXmlParser_WHILE_INSTANTIATING_A_0.toLocalizedString(className), ex);
+    }
+    if (!(obj instanceof Analyzer)) {
+      throw new CacheXmlException(LocalizedStrings.LuceneXmlParser_CLASS_0_IS_NOT_AN_INSTANCE_OF_ANALYZER.toLocalizedString(className));
+    }
+    return (Analyzer) obj;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/package-info.java
new file mode 100644
index 0000000..4eb1ca3
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/xml/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+/**
+ * Classes for parsing lucene index elements a cache.xml file. See the lucene-1.0.xsd file for
+ * the schema.
+ */
+
+package com.gemstone.gemfire.cache.lucene.internal.xml;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/package-info.java
new file mode 100644
index 0000000..0e0c89b
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+/**
+ * This package provides an integration with Apache Lucene that allows Geode regions to be indexed in a distributed
+ * Lucene index and queries using Lucene queries.
+ * <p>
+ * All indexing and query operations are performed through the {@link com.gemstone.gemfire.cache.lucene.LuceneService} class.
+ * See {@link com.gemstone.gemfire.cache.lucene.LuceneService} for an example of how to add a lucene index to a geode region.
+ * <p>
+ *
+ * The Lucene indexes created using this API are stored in geode and colocated with the indexed region, which means they
+ * have the same availability guarantees as the underlying region. The indexes are maintained asynchronously, so changes
+ * to the region may not be immediately visible in the lucene index.
+ */
+
+package com.gemstone.gemfire.cache.lucene;
\ No newline at end of file


[39/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
deleted file mode 100644
index 6727f1b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
+++ /dev/null
@@ -1,3765 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentSkipListSet;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-
-import com.jayway.awaitility.Awaitility;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.AttributesMutator;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.CacheListener;
-import com.gemstone.gemfire.cache.CacheTransactionManager;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.EntryEvent;
-import com.gemstone.gemfire.cache.PartitionAttributesFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.RegionDestroyedException;
-import com.gemstone.gemfire.cache.RegionFactory;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import com.gemstone.gemfire.cache.client.Pool;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.client.internal.LocatorDiscoveryCallbackAdapter;
-import com.gemstone.gemfire.cache.client.internal.locator.wan.LocatorMembershipListener;
-import com.gemstone.gemfire.cache.persistence.PartitionOfflineException;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewayQueueEvent;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.FileUtil;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-import com.gemstone.gemfire.internal.cache.BucketRegion;
-import com.gemstone.gemfire.internal.cache.CacheConfig;
-import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.internal.cache.CustomerIDPartitionResolver;
-import com.gemstone.gemfire.internal.cache.ForceReattemptException;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.RegionQueue;
-import com.gemstone.gemfire.internal.cache.execute.data.CustId;
-import com.gemstone.gemfire.internal.cache.execute.data.Customer;
-import com.gemstone.gemfire.internal.cache.execute.data.Order;
-import com.gemstone.gemfire.internal.cache.execute.data.OrderId;
-import com.gemstone.gemfire.internal.cache.execute.data.Shipment;
-import com.gemstone.gemfire.internal.cache.execute.data.ShipmentId;
-import com.gemstone.gemfire.internal.cache.partitioned.PRLocallyDestroyedException;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerStats;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderEventProcessor;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQueue;
-import com.gemstone.gemfire.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor;
-import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderQueue;
-import com.gemstone.gemfire.pdx.SimpleClass;
-import com.gemstone.gemfire.pdx.SimpleClass1;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.Invoke;
-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;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-
-@Category(DistributedTest.class)
-public class WANTestBase extends JUnit4DistributedTestCase {
-
-  protected static Cache cache;
-  protected static Region region;
-
-  protected static PartitionedRegion customerRegion;
-  protected static PartitionedRegion orderRegion;
-  protected static PartitionedRegion shipmentRegion;
-
-  protected static final String customerRegionName = "CUSTOMER";
-  protected static final String orderRegionName = "ORDER";
-  protected static final String shipmentRegionName = "SHIPMENT";
-
-  protected static VM vm0;
-  protected static VM vm1;
-  protected static VM vm2;
-  protected static VM vm3;
-  protected static VM vm4;
-  protected static VM vm5;
-  protected static VM vm6;
-  protected static VM vm7;
-
-  protected static QueueListener listener1;
-  protected static QueueListener listener2;
-
-  protected static AsyncEventListener eventListener1 ;
-  protected static AsyncEventListener eventListener2 ;
-
-  private static final long MAX_WAIT = 10000;
-
-  protected static GatewayEventFilter eventFilter;
-
-  protected static List<Integer> dispatcherThreads =
-	  new ArrayList<Integer>(Arrays.asList(1, 3, 5));
-  //this will be set for each test method run with one of the values from above list
-  protected static int numDispatcherThreadsForTheRun = 1;
-
-  public WANTestBase() {
-    super();
-  }
-
-  /**
-   * @deprecated Use the no arg constructor, or better yet, don't construct this class
-   */
-  @Deprecated
-  public WANTestBase(final String ignored) {
-  }
-
-  @Override
-  public final void preSetUp() throws Exception {
-    final Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    vm2 = host.getVM(2);
-    vm3 = host.getVM(3);
-    vm4 = host.getVM(4);
-    vm5 = host.getVM(5);
-    vm6 = host.getVM(6);
-    vm7 = host.getVM(7);
-    //Need to set the test name after the VMs are created
-  }
-
-  @Override
-  public final void postSetUp() throws Exception {
-    //this is done to vary the number of dispatchers for sender
-    //during every test method run
-    shuffleNumDispatcherThreads();
-    Invoke.invokeInEveryVM(() -> setNumDispatcherThreadsForTheRun(dispatcherThreads.get(0)));
-    IgnoredException.addIgnoredException("Connection refused");
-    IgnoredException.addIgnoredException("Software caused connection abort");
-    IgnoredException.addIgnoredException("Connection reset");
-    postSetUpWANTestBase();
-  }
-
-  protected void postSetUpWANTestBase() throws Exception {
-  }
-
-  public static void shuffleNumDispatcherThreads() {
-	  Collections.shuffle(dispatcherThreads);
-  }
-
-  public static void setNumDispatcherThreadsForTheRun(int numThreads) {
-	  numDispatcherThreadsForTheRun = numThreads;
-  }
-
-  public static void stopOldLocator() {
-    if (Locator.hasLocator()) {
-      Locator.getLocator().stop();
-    }
-  }
-
-  public static void createLocator(int dsId, int port, Set<String> localLocatorsList, Set<String> remoteLocatorsList){
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    StringBuffer localLocatorBuffer = new StringBuffer(localLocatorsList.toString());
-    localLocatorBuffer.deleteCharAt(0);
-    localLocatorBuffer.deleteCharAt(localLocatorBuffer.lastIndexOf("]"));
-    String localLocator = localLocatorBuffer.toString();
-    localLocator = localLocator.replace(" ", "");
-
-    props.setProperty(LOCATORS, localLocator);
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    StringBuffer remoteLocatorBuffer = new StringBuffer(remoteLocatorsList.toString());
-    remoteLocatorBuffer.deleteCharAt(0);
-    remoteLocatorBuffer.deleteCharAt(remoteLocatorBuffer.lastIndexOf("]"));
-    String remoteLocator = remoteLocatorBuffer.toString();
-    remoteLocator = remoteLocator.replace(" ", "");
-    props.setProperty(REMOTE_LOCATORS, remoteLocator);
-    test.getSystem(props);
-  }
-
-  public static Integer createFirstLocatorWithDSId(int dsId) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static Integer createFirstPeerLocator(int dsId) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static Integer createSecondLocator(int dsId, int locatorPort) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static Integer createSecondPeerLocator(int dsId, int locatorPort) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static void bringBackLocatorOnOldPort(int dsId, int remoteLocPort, int oldPort) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.put(LOG_LEVEL, "fine");
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + oldPort + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + oldPort + "],server=true,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    test.getSystem(props);
-  }
-
-
-  public static Integer createFirstRemotePeerLocator(int dsId, int remoteLocPort) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static Integer createSecondRemoteLocator(int dsId, int localPort,
-      int remoteLocPort) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + localPort + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static Integer createSecondRemoteLocatorWithAPI(int dsId, int localPort,
-                                                  int remoteLocPort, String hostnameForClients)
-    throws IOException
-  {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + localPort + "]");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    Locator locator = Locator.startLocatorAndDS(0, null, InetAddress.getByName("localhost"), props, true, true, hostnameForClients);
-    return locator.getPort();
-  }
-
-  public static Integer createSecondRemotePeerLocator(int dsId, int localPort,
-      int remoteLocPort) {
-    stopOldLocator();
-    WANTestBase test = new WANTestBase();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + localPort + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=false,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static int createReceiverInSecuredCache() {
-    GatewayReceiverFactory fact = WANTestBase.cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start GatewayReceiver on port " + port, e);
-    }
-    return port;
-  }
-
-  public static void createReplicatedRegion(String regionName, String senderIds, Boolean offHeap){
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class
-        .getName());
-    IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class
-        .getName());
-    try {
-      AttributesFactory fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      fact.setDataPolicy(DataPolicy.REPLICATE);
-      fact.setScope(Scope.DISTRIBUTED_ACK);
-      fact.setOffHeap(offHeap);
-      Region r = cache.createRegionFactory(fact.create()).create(regionName);
-      assertNotNull(r);
-    } finally {
-      exp.remove();
-      exp1.remove();
-      exp2.remove();
-    }
-  }
-
-  public static void createNormalRegion(String regionName, String senderIds){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    fact.setDataPolicy(DataPolicy.NORMAL);
-    fact.setScope(Scope.DISTRIBUTED_ACK);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void createPersistentReplicatedRegion(String regionName, String senderIds, Boolean offHeap){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    fact.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
-    fact.setOffHeap(offHeap);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void createReplicatedRegionWithAsyncEventQueue(
-      String regionName, String asyncQueueIds, Boolean offHeap) {
-    IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    try {
-      AttributesFactory fact = new AttributesFactory();
-      if (asyncQueueIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(asyncQueueIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String asyncQueueId = tokenizer.nextToken();
-          fact.addAsyncEventQueueId(asyncQueueId);
-        }
-      }
-      fact.setDataPolicy(DataPolicy.REPLICATE);
-      fact.setOffHeap(offHeap);
-      RegionFactory regionFactory = cache.createRegionFactory(fact.create());
-      Region r = regionFactory.create(regionName);
-      assertNotNull(r);
-    } finally {
-      exp1.remove();
-    }
-  }
-
-  public static void createReplicatedRegionWithSenderAndAsyncEventQueue(
-      String regionName, String senderIds, String asyncChannelId, Boolean offHeap) {
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    try {
-      AttributesFactory fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      fact.setDataPolicy(DataPolicy.REPLICATE);
-      fact.setScope(Scope.DISTRIBUTED_ACK);
-      fact.setOffHeap(offHeap);
-      RegionFactory regionFactory = cache.createRegionFactory(fact.create());
-      regionFactory.addAsyncEventQueueId(asyncChannelId);
-      Region r = regionFactory.create(regionName);
-      assertNotNull(r);
-    } finally {
-      exp.remove();
-    }
-  }
-
-  public static void createReplicatedRegion(String regionName, String senderIds, Scope scope, DataPolicy policy, Boolean offHeap){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    fact.setDataPolicy(policy);
-    fact.setScope(scope);
-    fact.setOffHeap(offHeap);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void createAsyncEventQueue(
-      String asyncChannelId, boolean isParallel,
-      Integer maxMemory, Integer batchSize, boolean isConflation,
-      boolean isPersistent, String diskStoreName, boolean isDiskSynchronous) {
-
-    if (diskStoreName != null) {
-      File directory = new File(asyncChannelId + "_disk_"
-          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-      directory.mkdir();
-      File[] dirs1 = new File[] { directory };
-      DiskStoreFactory dsf = cache.createDiskStoreFactory();
-      dsf.setDiskDirs(dirs1);
-      dsf.create(diskStoreName);
-    }
-
-    AsyncEventListener asyncEventListener = new MyAsyncEventListener();
-
-    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
-    factory.setBatchSize(batchSize);
-    factory.setPersistent(isPersistent);
-    factory.setDiskStoreName(diskStoreName);
-    factory.setDiskSynchronous(isDiskSynchronous);
-    factory.setBatchConflationEnabled(isConflation);
-    factory.setMaximumQueueMemory(maxMemory);
-    factory.setParallel(isParallel);
-    //set dispatcher threads
-    factory.setDispatcherThreads(numDispatcherThreadsForTheRun);
-    factory.create(asyncChannelId, asyncEventListener);
-  }
-
-  public static void createPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
-        .getName());
-    try {
-      AttributesFactory fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-      pfact.setTotalNumBuckets(totalNumBuckets);
-      pfact.setRedundantCopies(redundantCopies);
-      pfact.setRecoveryDelay(0);
-      fact.setPartitionAttributes(pfact.create());
-      fact.setOffHeap(offHeap);
-      Region r = cache.createRegionFactory(fact.create()).create(regionName);
-      assertNotNull(r);
-    } finally {
-      exp.remove();
-      exp1.remove();
-    }
-  }
-
-  // TODO:OFFHEAP: add offheap flavor
-  public static void createPartitionedRegionWithPersistence(String regionName,
-      String senderIds, Integer redundantCopies, Integer totalNumBuckets) {
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
-        .getName());
-    try {
-      AttributesFactory fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-      pfact.setTotalNumBuckets(totalNumBuckets);
-      pfact.setRedundantCopies(redundantCopies);
-      pfact.setRecoveryDelay(0);
-      fact.setPartitionAttributes(pfact.create());
-      fact.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-      Region r = cache.createRegionFactory(fact.create()).create(regionName);
-      assertNotNull(r);
-    } finally {
-      exp.remove();
-      exp1.remove();
-    }
-  }
-  public static void createColocatedPartitionedRegion(String regionName,
-	      String senderIds, Integer redundantCopies, Integer totalNumBuckets, String colocatedWith) {
-	IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-		.getName());
-	IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
-		.getName());
-	try {
-	  AttributesFactory fact = new AttributesFactory();
-	  if (senderIds != null) {
-		  StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-		  while (tokenizer.hasMoreTokens()) {
-			  String senderId = tokenizer.nextToken();
-			  fact.addGatewaySenderId(senderId);
-		  }
-	  }
-	  PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-	  pfact.setTotalNumBuckets(totalNumBuckets);
-	  pfact.setRedundantCopies(redundantCopies);
-	  pfact.setRecoveryDelay(0);
-	  pfact.setColocatedWith(colocatedWith);
-	  fact.setPartitionAttributes(pfact.create());
-	  Region r = cache.createRegionFactory(fact.create()).create(regionName);
-	  assertNotNull(r);
-	} finally {
-		exp.remove();
-		exp1.remove();
-	}
-  }
-
-  public static void addSenderThroughAttributesMutator(String regionName,
-      String senderIds){
-    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
-    assertNotNull(r);
-    AttributesMutator mutator = r.getAttributesMutator();
-    mutator.addGatewaySenderId(senderIds);
-  }
-
-  public static void addAsyncEventQueueThroughAttributesMutator(
-      String regionName, String queueId) {
-    final Region r = cache.getRegion(Region.SEPARATOR + regionName);
-    assertNotNull(r);
-    AttributesMutator mutator = r.getAttributesMutator();
-    mutator.addAsyncEventQueueId(queueId);
-  }
-
-  public static void createPartitionedRegionAsAccessor(
-      String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-    pfact.setTotalNumBuckets(totalNumBuckets);
-    pfact.setRedundantCopies(redundantCopies);
-    pfact.setLocalMaxMemory(0);
-    fact.setPartitionAttributes(pfact.create());
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void createPartitionedRegionWithSerialParallelSenderIds(String regionName, String serialSenderIds, String parallelSenderIds, String colocatedWith, Boolean offHeap){
-    AttributesFactory fact = new AttributesFactory();
-    if (serialSenderIds != null) {
-      StringTokenizer tokenizer = new StringTokenizer(serialSenderIds, ",");
-      while (tokenizer.hasMoreTokens()) {
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    if (parallelSenderIds != null) {
-      StringTokenizer tokenizer = new StringTokenizer(parallelSenderIds, ",");
-      while (tokenizer.hasMoreTokens()) {
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-    pfact.setColocatedWith(colocatedWith);
-    fact.setPartitionAttributes(pfact.create());
-    fact.setOffHeap(offHeap);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void createPersistentPartitionedRegion(
-      String regionName,
-      String senderIds,
-      Integer redundantCopies,
-      Integer totalNumBuckets,
-      Boolean offHeap){
-
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class
-        .getName());
-    try {
-
-      AttributesFactory fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-      pfact.setTotalNumBuckets(totalNumBuckets);
-      pfact.setRedundantCopies(redundantCopies);
-      fact.setPartitionAttributes(pfact.create());
-      fact.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-      fact.setOffHeap(offHeap);
-      Region r = cache.createRegionFactory(fact.create()).create(regionName);
-      assertNotNull(r);
-    } finally {
-      exp.remove();
-      exp1.remove();
-    }
-  }
-
-  public static void createCustomerOrderShipmentPartitionedRegion(
-      String senderIds, Integer redundantCopies,
-      Integer totalNumBuckets, Boolean offHeap) {
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    try {
-      AttributesFactory fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-
-      PartitionAttributesFactory paf = new PartitionAttributesFactory();
-      paf.setRedundantCopies(redundantCopies)
-          .setTotalNumBuckets(totalNumBuckets)
-          .setPartitionResolver(
-              new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
-      fact.setPartitionAttributes(paf.create());
-      fact.setOffHeap(offHeap);
-      customerRegion = (PartitionedRegion)cache.createRegionFactory(
-          fact.create()).create(customerRegionName);
-      assertNotNull(customerRegion);
-      LogWriterUtils.getLogWriter().info(
-          "Partitioned Region CUSTOMER created Successfully :"
-              + customerRegion.toString());
-
-      paf = new PartitionAttributesFactory();
-      paf.setRedundantCopies(redundantCopies)
-          .setTotalNumBuckets(totalNumBuckets)
-          .setColocatedWith(customerRegionName)
-          .setPartitionResolver(
-              new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
-      fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      fact.setPartitionAttributes(paf.create());
-      fact.setOffHeap(offHeap);
-      orderRegion = (PartitionedRegion)cache.createRegionFactory(fact.create())
-          .create(orderRegionName);
-      assertNotNull(orderRegion);
-      LogWriterUtils.getLogWriter().info(
-          "Partitioned Region ORDER created Successfully :"
-              + orderRegion.toString());
-
-      paf = new PartitionAttributesFactory();
-      paf.setRedundantCopies(redundantCopies)
-          .setTotalNumBuckets(totalNumBuckets)
-          .setColocatedWith(orderRegionName)
-          .setPartitionResolver(
-              new CustomerIDPartitionResolver("CustomerIDPartitionResolver"));
-      fact = new AttributesFactory();
-      if (senderIds != null) {
-        StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-        while (tokenizer.hasMoreTokens()) {
-          String senderId = tokenizer.nextToken();
-          fact.addGatewaySenderId(senderId);
-        }
-      }
-      fact.setPartitionAttributes(paf.create());
-      fact.setOffHeap(offHeap);
-      shipmentRegion = (PartitionedRegion)cache.createRegionFactory(
-          fact.create()).create(shipmentRegionName);
-      assertNotNull(shipmentRegion);
-      LogWriterUtils.getLogWriter().info(
-          "Partitioned Region SHIPMENT created Successfully :"
-              + shipmentRegion.toString());
-    } finally {
-      exp.remove();
-    }
-  }
-
-  public static void createColocatedPartitionedRegions(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-    pfact.setTotalNumBuckets(totalNumBuckets);
-    pfact.setRedundantCopies(redundantCopies);
-    fact.setPartitionAttributes(pfact.create());
-    fact.setOffHeap(offHeap);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-
-    pfact.setColocatedWith(r.getName());
-    fact.setPartitionAttributes(pfact.create());
-    fact.setOffHeap(offHeap);
-    Region r1 = cache.createRegionFactory(fact.create()).create(regionName+"_child1");
-    assertNotNull(r1);
-
-    Region r2 = cache.createRegionFactory(fact.create()).create(regionName+"_child2");
-    assertNotNull(r2);
-  }
-
-  public static void createColocatedPartitionedRegions2 (String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    PartitionAttributesFactory pfact = new PartitionAttributesFactory();
-    pfact.setTotalNumBuckets(totalNumBuckets);
-    pfact.setRedundantCopies(redundantCopies);
-    fact.setPartitionAttributes(pfact.create());
-    fact.setOffHeap(offHeap);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-
-
-    fact = new AttributesFactory();
-    pfact.setColocatedWith(r.getName());
-    fact.setPartitionAttributes(pfact.create());
-    fact.setOffHeap(offHeap);
-    Region r1 = cache.createRegionFactory(fact.create()).create(regionName+"_child1");
-    assertNotNull(r1);
-
-    Region r2 = cache.createRegionFactory(fact.create()).create(regionName+"_child2");
-    assertNotNull(r2);
-  }
-
-  public static void createCacheInVMs(Integer locatorPort, VM... vms) {
-    for (VM vm : vms) {
-      vm.invoke(() -> createCache(locatorPort));
-    }
-  }
-
-  public static void addListenerToSleepAfterCreateEvent(int milliSeconds, final String regionName) {
-    cache.getRegion(regionName).getAttributesMutator()
-      .addCacheListener(new CacheListenerAdapter<Object, Object>() {
-        @Override
-        public void afterCreate(final EntryEvent<Object, Object> event) {
-          try {
-            Thread.sleep(milliSeconds);
-          }
-          catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-          }
-        }
-      });
-  }
-
-  private static CacheListener myListener;
-  public static void longPauseAfterNumEvents(int numEvents, int milliSeconds) {
-    myListener = new CacheListenerAdapter<Object, Object>() {
-      @Override
-      public void afterCreate(final EntryEvent<Object, Object> event) {
-        try {
-          if (event.getRegion().size() >= numEvents){
-            Thread.sleep(milliSeconds);
-          }
-        }
-        catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-        }
-      }
-    };
-    cache.getRegion(getTestMethodName() + "_RR_1").getAttributesMutator()
-      .addCacheListener(myListener);
-  }
-
-  public static void removeCacheListener() {
-    cache.getRegion(getTestMethodName() + "_RR_1").getAttributesMutator()
-      .removeCacheListener(myListener);
-
-  }
-
-
-  public static void createCache(Integer locPort){
-    createCache(false, locPort);
-  }
-  public static void createManagementCache(Integer locPort){
-    createCache(true, locPort);
-  }
-
-  public static void createCacheConserveSockets(Boolean conserveSockets,Integer locPort){
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
-    props.setProperty(CONSERVE_SOCKETS, conserveSockets.toString());
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-  }
-
-  protected static void createCache(boolean management, Integer locPort) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    if (management) {
-      props.setProperty(JMX_MANAGER, "true");
-      props.setProperty(JMX_MANAGER_START, "false");
-      props.setProperty(JMX_MANAGER_PORT, "0");
-      props.setProperty(JMX_MANAGER_HTTP_PORT, "0");
-    }
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-  }
-
-  protected static void createCacheWithSSL(Integer locPort) {
-    WANTestBase test = new WANTestBase();
-
-    boolean gatewaySslenabled = true;
-    String  gatewaySslprotocols = "any";
-    String  gatewaySslciphers = "any";
-    boolean gatewaySslRequireAuth = true;
-
-    Properties gemFireProps = test.getDistributedSystemProperties();
-    gemFireProps.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-    gemFireProps.put(GATEWAY_SSL_ENABLED, String.valueOf(gatewaySslenabled));
-    gemFireProps.put(GATEWAY_SSL_PROTOCOLS, gatewaySslprotocols);
-    gemFireProps.put(GATEWAY_SSL_CIPHERS, gatewaySslciphers);
-    gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, String.valueOf(gatewaySslRequireAuth));
-
-    gemFireProps.put(GATEWAY_SSL_KEYSTORE_TYPE, "jks");
-    gemFireProps.put(GATEWAY_SSL_KEYSTORE,
-        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/client.keystore"));
-    gemFireProps.put(GATEWAY_SSL_KEYSTORE_PASSWORD, "password");
-    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE,
-        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/client.truststore"));
-    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE_PASSWORD, "password");
-
-    gemFireProps.setProperty(MCAST_PORT, "0");
-    gemFireProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
-
-    LogWriterUtils.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps);
-
-    InternalDistributedSystem ds = test.getSystem(gemFireProps);
-    cache = CacheFactory.create(ds);
-  }
-
-  public static void createCache_PDX(Integer locPort){
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    CacheConfig cacheConfig = new CacheConfig();
-    cacheConfig.setPdxPersistent(true);
-    cacheConfig.setPdxDiskStore("PDX_TEST");
-    cache = GemFireCacheImpl.create(ds, false, cacheConfig);
-
-    File pdxDir = new File(CacheTestCase.getDiskDir(), "pdx");
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File [] dirs1 = new File[] {pdxDir};
-    dsf.setDiskDirs(dirs1).setMaxOplogSize(1).create("PDX_TEST");
-  }
-
-  public static void createCache(Integer locPort1, Integer locPort2){
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort1
-        + "],localhost[" + locPort2 + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-  }
-
-  public static void createCacheWithoutLocator(Integer mCastPort){
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "" + mCastPort);
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-  }
-
-  /**
-   * Method that creates a bridge server
-   *
-   * @return    Integer   Port on which the server is started.
-   */
-  public static Integer createCacheServer() {
-    CacheServer server1 = cache.addCacheServer();
-    assertNotNull(server1);
-    server1.setPort(0);
-    try {
-      server1.start();
-    }
-    catch (IOException e) {
-      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start the Server", e);
-    }
-    assertTrue(server1.isRunning());
-
-    return new Integer(server1.getPort());
-  }
-
-  /**
-   * Returns a Map that contains the count for number of bridge server and number
-   * of Receivers.
-   *
-   * @return    Map
-   */
-  public static Map getCacheServers() {
-    List cacheServers = cache.getCacheServers();
-
-    Map cacheServersMap = new HashMap();
-    Iterator itr = cacheServers.iterator();
-    int bridgeServerCounter = 0;
-    int receiverServerCounter = 0;
-    while (itr.hasNext()) {
-      CacheServerImpl cacheServer = (CacheServerImpl) itr.next();
-      if (cacheServer.getAcceptor().isGatewayReceiver()) {
-        receiverServerCounter++;
-      } else {
-        bridgeServerCounter++;
-      }
-    }
-    cacheServersMap.put("BridgeServer", bridgeServerCounter);
-    cacheServersMap.put("ReceiverServer", receiverServerCounter);
-    return cacheServersMap;
-  }
-
-  public static void startSenderInVMs(String senderId, VM... vms) {
-    for (VM vm : vms) {
-      vm.invoke(() -> startSender(senderId));
-    }
-  }
-
-  public static void startSenderInVMsAsync(String senderId, VM... vms) {
-    List<AsyncInvocation> tasks = new LinkedList<>();
-    for (VM vm : vms) {
-      tasks.add(vm.invokeAsync(() -> startSender(senderId)));
-    }
-    for (AsyncInvocation invocation : tasks) {
-      try {
-        invocation.join(30000); // TODO: these might be AsyncInvocation orphans
-      }
-      catch (InterruptedException e) {
-        fail("Starting senders was interrupted");
-      }
-    }
-  }
-
-
-  public static void startSender(String senderId) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class
-        .getName());
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      GatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = s;
-          break;
-        }
-      }
-      sender.start();
-    } finally {
-      exp.remove();
-      exp1.remove();
-      exln.remove();
-    }
-
-  }
-
-  public static void enableConflation(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    sender.test_setBatchConflationEnabled(true);
-  }
-
-  public static Map getSenderToReceiverConnectionInfo(String senderId){
-	  Set<GatewaySender> senders = cache.getGatewaySenders();
-	  GatewaySender sender = null;
-	  for(GatewaySender s : senders){
-		  if(s.getId().equals(senderId)){
-			  sender = s;
-			  break;
-	      }
-	  }
-	  Map connectionInfo = null;
-	  if (!sender.isParallel() && ((AbstractGatewaySender) sender).isPrimary()) {
-		  connectionInfo = new HashMap();
-		  GatewaySenderEventDispatcher dispatcher =
-			  ((AbstractGatewaySender)sender).getEventProcessor().getDispatcher();
-		  if (dispatcher instanceof GatewaySenderEventRemoteDispatcher) {
-			  ServerLocation serverLocation =
-				  ((GatewaySenderEventRemoteDispatcher) dispatcher).getConnection(false).getServer();
-			  connectionInfo.put("serverHost", serverLocation.getHostName());
-			  connectionInfo.put("serverPort", serverLocation.getPort());
-
-		  }
-	  }
-	  return connectionInfo;
-  }
-  public static List<Integer> getSenderStats(String senderId, final int expectedQueueSize){
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = sender.getStatistics();
-    if (expectedQueueSize != -1) {
-      final RegionQueue regionQueue;
-      regionQueue = sender.getQueues().toArray(
-          new RegionQueue[1])[0];
-      Awaitility.await().atMost(120,TimeUnit.SECONDS).until(() -> assertEquals("Expected queue entries: " +
-        expectedQueueSize + " but actual entries: " + regionQueue.size(), expectedQueueSize,regionQueue.size()));
-    }
-    ArrayList<Integer> stats = new ArrayList<Integer>();
-    stats.add(statistics.getEventQueueSize());
-    stats.add(statistics.getEventsReceived());
-    stats.add(statistics.getEventsQueued());
-    stats.add(statistics.getEventsDistributed());
-    stats.add(statistics.getBatchesDistributed());
-    stats.add(statistics.getBatchesRedistributed());
-    stats.add(statistics.getEventsFiltered());
-    stats.add(statistics.getEventsNotQueuedConflated());
-    stats.add(statistics.getEventsConflatedFromBatches());
-    return stats;
-  }
-
-  public static void checkQueueStats(String senderId, final int queueSize,
-      final int eventsReceived, final int eventsQueued,
-      final int eventsDistributed) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender).getStatistics();
-    assertEquals(queueSize, statistics.getEventQueueSize());
-    assertEquals(eventsReceived, statistics.getEventsReceived());
-    assertEquals(eventsQueued, statistics.getEventsQueued());
-    assert(statistics.getEventsDistributed() >= eventsDistributed);
-  }
-
-  public static void checkGatewayReceiverStats(int processBatches,
-      int eventsReceived, int creates) {
-    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
-    GatewayReceiver receiver = gatewayReceivers.iterator().next();
-    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
-        .getAcceptor().getStats();
-
-    assertTrue(stats instanceof GatewayReceiverStats);
-    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
-    assertTrue(gatewayReceiverStats.getProcessBatchRequests() >= processBatches);
-    assertEquals(eventsReceived, gatewayReceiverStats.getEventsReceived());
-    assertEquals(creates, gatewayReceiverStats.getCreateRequest());
-  }
-
-  public static void checkMinimumGatewayReceiverStats(int processBatches,
-      int eventsReceived) {
-    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
-    GatewayReceiver receiver = gatewayReceivers.iterator().next();
-    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
-        .getAcceptor().getStats();
-
-    assertTrue(stats instanceof GatewayReceiverStats);
-    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
-    assertTrue(gatewayReceiverStats.getProcessBatchRequests() >= processBatches);
-    assertTrue(gatewayReceiverStats.getEventsReceived()>= eventsReceived);
-  }
-
-  public static void checkExceptionStats(int exceptionsOccurred) {
-    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
-    GatewayReceiver receiver = gatewayReceivers.iterator().next();
-    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
-        .getAcceptor().getStats();
-
-    assertTrue(stats instanceof GatewayReceiverStats);
-    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
-    if (exceptionsOccurred == 0) {
-      assertEquals(exceptionsOccurred, gatewayReceiverStats
-          .getExceptionsOccured());
-    }
-    else {
-      assertTrue(gatewayReceiverStats.getExceptionsOccured() >= exceptionsOccurred);
-    }
-  }
-
-  public static void checkGatewayReceiverStatsHA(int processBatches,
-      int eventsReceived, int creates) {
-    Set<GatewayReceiver> gatewayReceivers = cache.getGatewayReceivers();
-    GatewayReceiver receiver = gatewayReceivers.iterator().next();
-    CacheServerStats stats = ((CacheServerImpl)receiver.getServer())
-        .getAcceptor().getStats();
-
-    assertTrue(stats instanceof GatewayReceiverStats);
-    GatewayReceiverStats gatewayReceiverStats = (GatewayReceiverStats)stats;
-    assertTrue(gatewayReceiverStats.getProcessBatchRequests() >= processBatches);
-    assertTrue(gatewayReceiverStats.getEventsReceived() >= eventsReceived);
-    assertTrue(gatewayReceiverStats.getCreateRequest() >= creates);
-  }
-
-  public static void checkEventFilteredStats(String senderId, final int eventsFiltered) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender).getStatistics();
-    assertEquals(eventsFiltered, statistics.getEventsFiltered());
-  }
-
-  public static void checkConflatedStats(String senderId, final int eventsConflated) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender).getStatistics();
-    assertEquals(eventsConflated, statistics.getEventsNotQueuedConflated());
-  }
-
-  public static void checkStats_Failover(String senderId,
-      final int eventsReceived) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
-        .getStatistics();
-
-    assertEquals(eventsReceived, statistics.getEventsReceived());
-    assertEquals(eventsReceived, (statistics.getEventsQueued()
-        + statistics.getUnprocessedTokensAddedByPrimary() + statistics
-        .getUnprocessedEventsRemovedByPrimary()));
-  }
-
-  public static void checkBatchStats(String senderId, final int batches) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
-        .getStatistics();
-    assert (statistics.getBatchesDistributed() >= batches);
-    assertEquals(0, statistics.getBatchesRedistributed());
-  }
-
-  public static void checkBatchStats(String senderId,
-      final boolean batchesDistributed, final boolean batchesRedistributed) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
-        .getStatistics();
-    assertEquals(batchesDistributed, (statistics.getBatchesDistributed() > 0));
-    assertEquals(batchesRedistributed,
-        (statistics.getBatchesRedistributed() > 0));
-  }
-
-  public static void checkUnProcessedStats(String senderId, int events) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    final GatewaySenderStats statistics = ((AbstractGatewaySender)sender)
-        .getStatistics();
-    assertEquals(events,
-        (statistics.getUnprocessedEventsAddedBySecondary() + statistics
-            .getUnprocessedTokensRemovedBySecondary()));
-    assertEquals(events,
-        (statistics.getUnprocessedEventsRemovedByPrimary() + statistics
-            .getUnprocessedTokensAddedByPrimary()));
-  }
-
-  public static void waitForSenderRunningState(String senderId){
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      final GatewaySender sender = getGatewaySenderById(senders, senderId);
-      Awaitility.await().atMost(300,TimeUnit.SECONDS).until(() -> assertEquals("Expected sender isRunning state to "
-        + "be true but is false", true, (sender != null && sender.isRunning())));
-    } finally {
-      exln.remove();
-    }
-  }
-
-  public static void waitForSenderToBecomePrimary(String senderId){
-    Set<GatewaySender> senders = ((GemFireCacheImpl)cache).getAllGatewaySenders();
-    final GatewaySender sender = getGatewaySenderById(senders, senderId);
-    Awaitility.await().atMost(10,TimeUnit.SECONDS).until(() -> assertEquals("Expected sender primary state to "
-      + "be true but is false", true, (sender != null && ((AbstractGatewaySender)sender).isPrimary())));
-  }
-
-  private static GatewaySender getGatewaySenderById(Set<GatewaySender> senders, String senderId) {
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        return s;
-      }
-    }
-    //if none of the senders matches with the supplied senderid, return null
-    return null;
-  }
-
-  public static HashMap checkQueue(){
-    HashMap listenerAttrs = new HashMap();
-    listenerAttrs.put("Create", listener1.createList);
-    listenerAttrs.put("Update", listener1.updateList);
-    listenerAttrs.put("Destroy", listener1.destroyList);
-    return listenerAttrs;
-  }
-
-  public static void checkQueueOnSecondary (final Map primaryUpdatesMap){
-    final HashMap secondaryUpdatesMap = new HashMap();
-    secondaryUpdatesMap.put("Create", listener1.createList);
-    secondaryUpdatesMap.put("Update", listener1.updateList);
-    secondaryUpdatesMap.put("Destroy", listener1.destroyList);
-
-    Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> {
-      secondaryUpdatesMap.put("Create", listener1.createList);
-      secondaryUpdatesMap.put("Update", listener1.updateList);
-      secondaryUpdatesMap.put("Destroy", listener1.destroyList);
-      assertEquals("Expected secondary map to be " + primaryUpdatesMap + " but it is " + secondaryUpdatesMap,
-        true,secondaryUpdatesMap.equals(primaryUpdatesMap));
-    });
-  }
-
-  public static HashMap checkQueue2(){
-    HashMap listenerAttrs = new HashMap();
-    listenerAttrs.put("Create", listener2.createList);
-    listenerAttrs.put("Update", listener2.updateList);
-    listenerAttrs.put("Destroy", listener2.destroyList);
-    return listenerAttrs;
-  }
-
-  public static HashMap checkPR(String regionName){
-    PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
-    QueueListener listener = (QueueListener)region.getCacheListener();
-
-    HashMap listenerAttrs = new HashMap();
-    listenerAttrs.put("Create", listener.createList);
-    listenerAttrs.put("Update", listener.updateList);
-    listenerAttrs.put("Destroy", listener.destroyList);
-    return listenerAttrs;
-  }
-
-  public static HashMap checkBR(String regionName, int numBuckets){
-    PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
-    HashMap listenerAttrs = new HashMap();
-    for (int i = 0; i < numBuckets; i++) {
-      BucketRegion br = region.getBucketRegion(i);
-      QueueListener listener = (QueueListener)br.getCacheListener();
-      listenerAttrs.put("Create"+i, listener.createList);
-      listenerAttrs.put("Update"+i, listener.updateList);
-      listenerAttrs.put("Destroy"+i, listener.destroyList);
-    }
-    return listenerAttrs;
-  }
-
-  public static HashMap checkQueue_BR(String senderId, int numBuckets){
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        sender = s;
-        break;
-      }
-    }
-    RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
-    .getQueues().toArray(new RegionQueue[1])[0];
-
-    PartitionedRegion region = (PartitionedRegion)parallelQueue.getRegion();
-    HashMap listenerAttrs = new HashMap();
-    for (int i = 0; i < numBuckets; i++) {
-      BucketRegion br = region.getBucketRegion(i);
-      if (br != null) {
-        QueueListener listener = (QueueListener)br.getCacheListener();
-        if (listener != null) {
-          listenerAttrs.put("Create"+i, listener.createList);
-          listenerAttrs.put("Update"+i, listener.updateList);
-          listenerAttrs.put("Destroy"+i, listener.destroyList);
-        }
-      }
-    }
-    return listenerAttrs;
-  }
-
-  public static void addListenerOnBucketRegion(String regionName, int numBuckets) {
-    WANTestBase test = new WANTestBase();
-    test.addCacheListenerOnBucketRegion(regionName, numBuckets);
-  }
-
-  private void addCacheListenerOnBucketRegion(String regionName, int numBuckets){
-    PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
-    for (int i = 0; i < numBuckets; i++) {
-      BucketRegion br = region.getBucketRegion(i);
-      AttributesMutator mutator = br.getAttributesMutator();
-      listener1 = new QueueListener();
-      mutator.addCacheListener(listener1);
-    }
-  }
-
-  public static void addListenerOnQueueBucketRegion(String senderId, int numBuckets) {
-    WANTestBase test = new WANTestBase();
-    test.addCacheListenerOnQueueBucketRegion(senderId, numBuckets);
-  }
-
-  private void addCacheListenerOnQueueBucketRegion(String senderId, int numBuckets){
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        sender = s;
-        break;
-      }
-    }
-    RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
-    .getQueues().toArray(new RegionQueue[1])[0];
-
-    PartitionedRegion region = (PartitionedRegion)parallelQueue.getRegion();
-    for (int i = 0; i < numBuckets; i++) {
-      BucketRegion br = region.getBucketRegion(i);
-      if (br != null) {
-        AttributesMutator mutator = br.getAttributesMutator();
-        CacheListener listener = new QueueListener();
-        mutator.addCacheListener(listener);
-      }
-    }
-
-  }
-
-  public static void addQueueListener(String senderId, boolean isParallel){
-    WANTestBase test = new WANTestBase();
-    test.addCacheQueueListener(senderId, isParallel);
-  }
-
-  public static void addSecondQueueListener(String senderId, boolean isParallel){
-    WANTestBase test = new WANTestBase();
-    test.addSecondCacheQueueListener(senderId, isParallel);
-  }
-
-  public static void addListenerOnRegion(String regionName){
-    WANTestBase test = new WANTestBase();
-    test.addCacheListenerOnRegion(regionName);
-  }
-  private void addCacheListenerOnRegion(String regionName){
-    Region region = cache.getRegion(regionName);
-    AttributesMutator mutator = region.getAttributesMutator();
-    listener1 = new QueueListener();
-    mutator.addCacheListener(listener1);
-  }
-
-  private void addCacheQueueListener(String senderId, boolean isParallel) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        sender = s;
-        break;
-      }
-    }
-    listener1 = new QueueListener();
-    if (!isParallel) {
-      Set<RegionQueue> queues = ((AbstractGatewaySender)sender).getQueues();
-      for(RegionQueue q: queues) {
-        q.addCacheListener(listener1);
-      }
-    }
-    else {
-      RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
-      .getQueues().toArray(new RegionQueue[1])[0];
-      parallelQueue.addCacheListener(listener1);
-    }
-  }
-
-  private void addSecondCacheQueueListener(String senderId, boolean isParallel) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    listener2 = new QueueListener();
-    if (!isParallel) {
-      Set<RegionQueue> queues = ((AbstractGatewaySender)sender).getQueues();
-      for(RegionQueue q: queues) {
-        q.addCacheListener(listener2);
-      }
-    }
-    else {
-    	RegionQueue parallelQueue = ((AbstractGatewaySender)sender)
-      .getQueues().toArray(new RegionQueue[1])[0];
-      parallelQueue.addCacheListener(listener2);
-    }
-  }
-
-  public static void pauseSender(String senderId) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      GatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = s;
-          break;
-        }
-      }
-      sender.pause();
-      ((AbstractGatewaySender) sender).getEventProcessor().waitForDispatcherToPause();
-
-    } finally {
-      exp.remove();
-      exln.remove();
-    }
-  }
-
-  public static void resumeSender(String senderId) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      GatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = s;
-          break;
-        }
-      }
-      sender.resume();
-    } finally {
-      exp.remove();
-      exln.remove();
-    }
-  }
-
-  public static void stopSender(String senderId) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class
-        .getName());
-    try {
-      Set<GatewaySender> senders = cache.getGatewaySenders();
-      GatewaySender sender = null;
-      for (GatewaySender s : senders) {
-        if (s.getId().equals(senderId)) {
-          sender = s;
-          break;
-        }
-      }
-      AbstractGatewaySenderEventProcessor eventProcessor = null;
-      if (sender instanceof AbstractGatewaySender) {
-        eventProcessor = ((AbstractGatewaySender) sender).getEventProcessor();
-      }
-      sender.stop();
-
-      Set<RegionQueue> queues = null;
-      if (eventProcessor instanceof ConcurrentSerialGatewaySenderEventProcessor) {
-        queues = ((ConcurrentSerialGatewaySenderEventProcessor)eventProcessor).getQueues();
-        for (RegionQueue queue: queues) {
-          if (queue instanceof SerialGatewaySenderQueue) {
-            assertFalse(((SerialGatewaySenderQueue) queue).isRemovalThreadAlive());
-          }
-        }
-      }
-    } finally {
-      exp.remove();
-      exln.remove();
-    }
-  }
-
-  public static void stopReceivers() {
-    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-    for (GatewayReceiver receiver : receivers) {
-      receiver.stop();
-    }
-  }
-
-  public static void startReceivers() {
-    Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
-    for (GatewayReceiver receiver : receivers) {
-      try {
-        receiver.start();
-      } catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  public static GatewaySenderFactory configureGateway(DiskStoreFactory dsf, File[] dirs1, String dsName,
-      boolean isParallel, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isPersistent,
-      GatewayEventFilter filter, boolean isManualStart, int numDispatchers, OrderPolicy policy) {
-
-    InternalGatewaySenderFactory gateway = (InternalGatewaySenderFactory)cache.createGatewaySenderFactory();
-    gateway.setParallel(isParallel);
-    gateway.setMaximumQueueMemory(maxMemory);
-    gateway.setBatchSize(batchSize);
-    gateway.setBatchConflationEnabled(isConflation);
-    gateway.setManualStart(isManualStart);
-    gateway.setDispatcherThreads(numDispatchers);
-    gateway.setOrderPolicy(policy);
-    gateway.setLocatorDiscoveryCallback(new MyLocatorCallback());
-    if (filter != null) {
-      eventFilter = filter;
-      gateway.addGatewayEventFilter(filter);
-    }
-    if (isPersistent) {
-      gateway.setPersistenceEnabled(true);
-      gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-          .getName());
-    } else {
-      DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-      gateway.setDiskStoreName(store.getName());
-    }
-    return gateway;
-  }
-
-  public static void createSender(String dsName, int remoteDsId,
-      boolean isParallel, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isPersistent,
-      GatewayEventFilter filter, boolean isManualStart) {
-    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      File persistentDirectory = new File(dsName + "_disk_"
-          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-      persistentDirectory.mkdir();
-      DiskStoreFactory dsf = cache.createDiskStoreFactory();
-      File[] dirs1 = new File[] { persistentDirectory };
-      GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName, isParallel, maxMemory, batchSize, isConflation, isPersistent, filter, isManualStart, numDispatcherThreadsForTheRun, GatewaySender.DEFAULT_ORDER_POLICY);
-      gateway.create(dsName, remoteDsId);
-
-    } finally {
-      exln.remove();
-    }
-  }
-
-  public static void createSenderWithMultipleDispatchers(String dsName, int remoteDsId,
-	boolean isParallel, Integer maxMemory,
-	Integer batchSize, boolean isConflation, boolean isPersistent,
-	GatewayEventFilter filter, boolean isManualStart, int numDispatchers, OrderPolicy orderPolicy) {
-	  final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-      persistentDirectory.mkdir();
-      DiskStoreFactory dsf = cache.createDiskStoreFactory();
-      File[] dirs1 = new File[] { persistentDirectory };
-      GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName,isParallel, maxMemory, batchSize, isConflation, isPersistent, filter,
-          isManualStart, numDispatchers, orderPolicy);
-      gateway.create(dsName, remoteDsId);
-
-    } finally {
-      exln.remove();
-    }
-  }
-
-  public static void createSenderWithoutDiskStore(String dsName, int remoteDsId, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isManualStart) {
-
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      //set dispatcher threads
-      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsId);
-  }
-
-  public static void createConcurrentSender(String dsName, int remoteDsId,
-      boolean isParallel, Integer maxMemory, Integer batchSize,
-      boolean isConflation, boolean isPersistent, GatewayEventFilter filter,
-      boolean isManualStart, int concurrencyLevel, OrderPolicy policy) {
-
-    File persistentDirectory = new File(dsName + "_disk_"
-        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File[] dirs1 = new File[] { persistentDirectory };
-    GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName, isParallel, maxMemory, batchSize, isConflation, isPersistent, filter, isManualStart, concurrencyLevel, policy);
-    gateway.create(dsName, remoteDsId);
-  }
-
-  public static void createSenderForValidations(String dsName, int remoteDsId,
-      boolean isParallel, Integer alertThreshold,
-      boolean isConflation, boolean isPersistent,
-      List<GatewayEventFilter> eventFilters,
-      List<GatewayTransportFilter> transportFilters, boolean isManualStart,
-      boolean isDiskSync) {
-    IgnoredException exp1 = IgnoredException.addIgnoredException(RegionDestroyedException.class
-        .getName());
-    try {
-      File persistentDirectory = new File(dsName + "_disk_"
-          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-      persistentDirectory.mkdir();
-      DiskStoreFactory dsf = cache.createDiskStoreFactory();
-      File[] dirs1 = new File[] { persistentDirectory };
-
-      if (isParallel) {
-        GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-        gateway.setParallel(true);
-        gateway.setAlertThreshold(alertThreshold);
-        ((InternalGatewaySenderFactory)gateway)
-            .setLocatorDiscoveryCallback(new MyLocatorCallback());
-        if (eventFilters != null) {
-          for (GatewayEventFilter filter : eventFilters) {
-            gateway.addGatewayEventFilter(filter);
-          }
-        }
-        if (transportFilters != null) {
-          for (GatewayTransportFilter filter : transportFilters) {
-            gateway.addGatewayTransportFilter(filter);
-          }
-        }
-        if (isPersistent) {
-          gateway.setPersistenceEnabled(true);
-          gateway.setDiskStoreName(dsf.setDiskDirs(dirs1)
-              .create(dsName + "_Parallel").getName());
-        }
-        else {
-          DiskStore store = dsf.setDiskDirs(dirs1).create(dsName + "_Parallel");
-          gateway.setDiskStoreName(store.getName());
-        }
-        gateway.setDiskSynchronous(isDiskSync);
-        gateway.setBatchConflationEnabled(isConflation);
-        gateway.setManualStart(isManualStart);
-        //set dispatcher threads
-        gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-        gateway.create(dsName, remoteDsId);
-
-      }
-      else {
-        GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-        gateway.setAlertThreshold(alertThreshold);
-        gateway.setManualStart(isManualStart);
-        //set dispatcher threads
-        gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-        ((InternalGatewaySenderFactory)gateway)
-            .setLocatorDiscoveryCallback(new MyLocatorCallback());
-        if (eventFilters != null) {
-          for (GatewayEventFilter filter : eventFilters) {
-            gateway.addGatewayEventFilter(filter);
-          }
-        }
-        if (transportFilters != null) {
-          for (GatewayTransportFilter filter : transportFilters) {
-            gateway.addGatewayTransportFilter(filter);
-          }
-        }
-        gateway.setBatchConflationEnabled(isConflation);
-        if (isPersistent) {
-          gateway.setPersistenceEnabled(true);
-          gateway.setDiskStoreName(dsf.setDiskDirs(dirs1)
-              .create(dsName + "_Serial").getName());
-        }
-        else {
-          DiskStore store = dsf.setDiskDirs(dirs1).create(dsName + "_Serial");
-          gateway.setDiskStoreName(store.getName());
-        }
-        gateway.setDiskSynchronous(isDiskSync);
-        gateway.create(dsName, remoteDsId);
-      }
-    } finally {
-      exp1.remove();
-    }
-  }
-
-  public static String createSenderWithDiskStore(String dsName, int remoteDsId,
-      boolean isParallel, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isPersistent,
-      GatewayEventFilter filter, String dsStore, boolean isManualStart) {
-    File persistentDirectory = null;
-    if (dsStore == null) {
-      persistentDirectory = new File(dsName + "_disk_"
-          + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    }
-    else {
-      persistentDirectory = new File(dsStore);
-    }
-    LogWriterUtils.getLogWriter().info("The ds is : " + persistentDirectory.getName());
-
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File [] dirs1 = new File[] {persistentDirectory};
-
-    if(isParallel) {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      //set dispatcher threads
-      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      if(isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        String dsname = dsf.setDiskDirs(dirs1).create(dsName).getName();
-        gateway.setDiskStoreName(dsname);
-        LogWriterUtils.getLogWriter().info("The DiskStoreName is : " + dsname);
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-        LogWriterUtils.getLogWriter().info("The ds is : " + store.getName());
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsId);
-
-    }else {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      //set dispatcher threads
-      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      if(isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.create(dsName, remoteDsId);
-    }
-    return persistentDirectory.getName();
-  }
-
-
-  public static void createSenderWithListener(String dsName, int remoteDsName,
-      boolean isParallel, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isPersistent,
-      GatewayEventFilter filter, boolean attachTwoListeners, boolean isManualStart) {
-    File persistentDirectory = new File(dsName + "_disk_"
-        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File[] dirs1 = new File[] { persistentDirectory };
-
-    if (isParallel) {
-      GatewaySenderFactory gateway = cache
-          .createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      //set dispatcher threads
-      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-      ((InternalGatewaySenderFactory)gateway)
-          .setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      if (isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-            .getName());
-      } else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsName);
-
-    } else {
-      GatewaySenderFactory gateway = cache
-          .createGatewaySenderFactory();
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      //set dispatcher threads
-      gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
-      ((InternalGatewaySenderFactory)gateway)
-          .setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      if (isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-            .getName());
-      } else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-
-      eventListener1 = new MyGatewaySenderEventListener();
-      ((InternalGatewaySenderFactory)gateway).addAsyncEventListener(eventListener1);
-      if (attachTwoListeners) {
-        eventListener2 = new MyGatewaySenderEventListener2();
-        ((InternalGatewaySenderFactory)gateway).addAsyncEventListener(eventListener2);
-      }
-      ((InternalGatewaySenderFactory)gateway).create(dsName);
-    }
-  }
-
-  public static void createReceiverInVMs(VM... vms) {
-    for (VM vm : vms) {
-      vm.invoke(() -> createReceiver());
-    }
-  }
-
-  public static int createReceiver() {
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-      Assert.fail("Test " + getTestMethodName()
-          + " failed to start GatewayReceiver on port " + port, e);
-    }
-    return port;
-  }
-
-  public static void createReceiverWithBindAddress(int locPort) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    fact.setBindAddress("200.112.204.10");
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-      fail("Expected GatewayReceiver Exception");
-    }
-    catch (GatewayReceiverException gRE){
-      LogWriterUtils.getLogWriter().fine("Got the GatewayReceiverException", gRE);
-      assertTrue(gRE.getMessage().contains("Failed to create server socket on"));
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + test.getName()
-          + " failed to start GatewayReceiver on port " + port);
-    }
-  }
-  public static int createReceiverWithSSL(int locPort) {
-    WANTestBase test = new WANTestBase();
-
-    Properties gemFireProps = test.getDistributedSystemProperties();
-
-    gemFireProps.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-    gemFireProps.put(GATEWAY_SSL_ENABLED, "true");
-    gemFireProps.put(GATEWAY_SSL_PROTOCOLS, "any");
-    gemFireProps.put(GATEWAY_SSL_CIPHERS, "any");
-    gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, "true");
-
-    gemFireProps.put(GATEWAY_SSL_KEYSTORE_TYPE, "jks");
-    gemFireProps.put(GATEWAY_SSL_KEYSTORE,
-        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/cacheserver.keystore"));
-    gemFireProps.put(GATEWAY_SSL_KEYSTORE_PASSWORD, "password");
-    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE,
-        TestUtil.getResourcePath(WANTestBase.class, "/com/gemstone/gemfire/cache/client/internal/cacheserver.truststore"));
-    gemFireProps.put(GATEWAY_SSL_TRUSTSTORE_PASSWORD, "password");
-
-    gemFireProps.setProperty(MCAST_PORT, "0");
-    gemFireProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
-
-    LogWriterUtils.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps);
-
-    InternalDistributedSystem ds = test.getSystem(gemFireProps);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + test.getName()
-          + " failed to start GatewayReceiver on port " + port);
-    }
-    return port;
-  }
-
-  public static void createReceiverAndServer(int locPort) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int receiverPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(receiverPort);
-    fact.setEndPort(receiverPort);
-    fact.setManualStart(true);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + test.getName()
-          + " failed to start GatewayReceiver on port " + receiverPort);
-    }
-    CacheServer server = cache.addCacheServer();
-    int serverPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    server.setPort(serverPort);
-    server.setHostnameForClients("localhost");
-    try {
-      server.start();
-    } catch (IOException e) {
-      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e);
-    }
-  }
-
-  public static int createServer(int locPort) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-
-    CacheServer server = cache.addCacheServer();
-    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    server.setPort(port);
-    server.setHostnameForClients("localhost");
-    try {
-      server.start();
-    } catch (IOException e) {
-      com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e);
-    }
-    return port;
-  }
-
-  public static void createClientWithLocator(int port0,String host,
-      String regionName) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-
-    assertNotNull(cache);
-    CacheServerTestUtil.disableShufflingOfEndpoints();
-    Pool p;
-    try {
-      p = PoolManager.createFactory().addLocator(host, port0)
-          .setPingInterval(250).setSubscriptionEnabled(true)
-          .setSubscriptionRedundancy(-1).setReadTimeout(2000)
-          .setSocketBufferSize(1000).setMinConnections(6).setMaxConnections(10)
-          .setRetryAttempts(3).create(regionName);
-    } finally {
-      CacheServerTestUtil.enableShufflingOfEndpoints();
-    }
-
-    AttributesFactory factory = new AttributesFactory();
-    factory.setPoolName(p.getName());
-    factory.setDataPolicy(DataPolicy.NORMAL);
-    RegionAttributes attrs = factory.create();
-    region = cache.createRegion(regionName, attrs);
-    region.registerInterest("ALL_KEYS");
-    assertNotNull(region);
-    LogWriterUtils.getLogW

<TRUNCATED>


[36/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java
deleted file mode 100644
index 9c6cbdd..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.internal.cache.BucketRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.RegionQueue;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-
-import java.util.Set;
-
-/**
- *
- */
-@Category(DistributedTest.class)
-public class CommonParallelGatewaySenderDUnitTest extends WANTestBase {
-
-  @Test
-  public void testSameSenderWithNonColocatedRegions() throws Exception {
-    IgnoredException.addIgnoredException("cannot have the same parallel");
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    try {
-      vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-      fail("Expected IllegalStateException : cannot have the same parallel gateway sender");
-    }
-    catch (Exception e) {
-      if (!(e.getCause() instanceof IllegalStateException)
-          || !(e.getCause().getMessage()
-              .contains("cannot have the same parallel gateway sender id"))) {
-        Assert.fail("Expected IllegalStateException", e);
-      }
-    }
-  }
-  
-  /**
-   * Simple scenario. Two regions attach the same PGS
-   * @throws Exception
-   * Below test is disabled intentionally
-    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-    3> We have to enabled it in next release
-    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0
-   */
-  @Test
-  @Ignore("TODO")
-  public void testParallelPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR1",
-        1000 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR2",
-      1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR1", 1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR2", 1000 ));
-  }
-  
-  /**
-   * The PGS is persistence enabled but not the Regions
-   * Below test is disabled intentionally
-    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-    3> We have to enabled it in next release
-    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0
-   */
-  @Test
-  @Ignore("TODO")
-  public void testParallelPropagationPersistenceEnabled() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, true, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", "ln", 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR1", null, 1, 100, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR2", null, 1, 100, isOffHeap() ));
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR1",
-        1000 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR2",
-      1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> CommonParallelGatewaySenderDUnitTest.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR1", 1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR2", 1000 ));
-  }
-  
-  
-  /**
-   * Enable persistence for GatewaySender.
-   * Pause the sender and do some puts in local region.  
-   * Close the local site and rebuild the region and sender from disk store.
-   * Dispatcher should not start dispatching events recovered from persistent sender.
-   * Check if the remote site receives all the events.
-   * Below test is disabled intentionally
-    1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-    2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-    3> We have to enabled it in next release
-    4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0
-   */
-  @Test
-  @Ignore("TODO")
-  public void testPRWithGatewaySenderPersistenceEnabled_Restart() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", null, 1, 100, isOffHeap() ));
-    
-    //create PR on remote site
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", null, 1, 100, isOffHeap() ));
-    
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-
-    //create PR on local site
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //wait for senders to become running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //pause the senders
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"PR1", 3000 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName()+"PR2", 5000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-    vm6.invoke(() -> WANTestBase.killSender());
-    vm7.invoke(() -> WANTestBase.killSender());
-    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR1", "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-
-    inv1 = vm4.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    inv2 = vm5.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    inv3 = vm6.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    inv4 = vm7.invokeAsync(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName()+"PR2", "ln", 1, 100, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    LogWriterUtils.getLogWriter().info("Created back the partitioned regions");
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName()+"PR1", 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName()+"PR1", 3000 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName()+"PR2", 5000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName()+"PR2", 5000 ));
-  }
-  
-  public static void validateParallelSenderQueueAllBucketsDrained(final String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    ConcurrentParallelGatewaySenderQueue regionQueue = (ConcurrentParallelGatewaySenderQueue)((AbstractGatewaySender)sender).getQueues().toArray(new RegionQueue[1])[0];
-    
-    Set<PartitionedRegion> shadowPRs = (Set<PartitionedRegion>)regionQueue.getRegions();
-    
-    for(PartitionedRegion shadowPR: shadowPRs) {
-      Set<BucketRegion> buckets = shadowPR.getDataStore().getAllLocalBucketRegions();
-      
-      for (final BucketRegion bucket : buckets) {
-        WaitCriterion wc = new WaitCriterion() {
-          public boolean done() {
-            if (bucket.keySet().size() == 0) {
-              LogWriterUtils.getLogWriter().info("Bucket " + bucket.getId() + " is empty");
-              return true;
-            }
-            return false;
-          }
-     
-          public String description() {
-            return "Expected bucket entries for bucket: " + bucket.getId() + " is: 0 but actual entries: " 
-              + bucket.keySet().size() + " This bucket isPrimary: " + bucket.getBucketAdvisor().isPrimary() + " KEYSET: " + bucket.keySet();
-          }
-        };
-        Wait.waitForCriterion(wc, 180000, 50, true);
-      
-      }//for loop ends
-    }
-    
-
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java
deleted file mode 100644
index 2fb77ff..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderOffHeapDUnitTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class CommonParallelGatewaySenderOffHeapDUnitTest extends
-    CommonParallelGatewaySenderDUnitTest {
-
-  public CommonParallelGatewaySenderOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java
deleted file mode 100644
index 8b8c624..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.internal.cache.DistributedCacheOperation;
-import com.gemstone.gemfire.internal.cache.EntrySnapshot;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.LocalRegion.NonTXEntry;
-import com.gemstone.gemfire.internal.cache.RegionEntry;
-import com.gemstone.gemfire.internal.cache.Token.Tombstone;
-import com.gemstone.gemfire.internal.cache.versions.VersionTag;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-/**
- *
- * Test verifies that version tag for destroyed entry is propagated back to
- * origin distributed system if the version tag is applied and replaces old
- * version information in destination distributed system.
- *
- * Version tag information which is relevant between multiple distributed
- * systems consistency check is basically dsid and timestamp.
- */
-@Category(DistributedTest.class)
-public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase {
-
-  public NewWANConcurrencyCheckForDestroyDUnitTest() {
-    super();
-  }
-
-  @Test
-  public void testVersionTagTimestampForDestroy() {
-    
-    
-    // create three distributed systems with each having a cache containing
-    // a Replicated Region with one entry and concurrency checks enabled.
-
-    // Site 2 and Site 3 only know about Site 1 but Site 1 knows about both
-    // Site 2 and Site 3.
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    createCacheInVMs(lnPort, vm1);
-    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
-    
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    createCacheInVMs(nyPort, vm3);
-    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
-
-    //Site 3
-    Integer tkPort = (Integer)vm4.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-    createCacheInVMs(tkPort, vm5);
-    Integer tkRecPort = (Integer) vm5.invoke(() -> WANTestBase.createReceiver());
-
-    LogWriterUtils.getLogWriter().info("Created locators and receivers in 3 distributed systems");
-     
-    //Site 1
-    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      true, 10, 1, false, false, null, true ));
-    vm1.invoke(() -> WANTestBase.createSender( "ln2", 3,
-      true, 10, 1, false, false, null, true ));
-    
-    vm1.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ln1,ln2", 0, 1, isOffHeap() ));
-    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm1.invoke(() -> WANTestBase.startSender( "ln2" ));
-    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
-    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln2" ));
-    
-    //Site 2
-    vm3.invoke(() -> WANTestBase.createSender( "ny1", 1,
-      true, 10, 1, false, false, null, true ));
-    
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ny1", 0, 1, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm3.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
-    
-    //Site 3 which only knows about Site 1.
-    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
-      true, 10, 1, false, false, null, true ));
-    
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "tk1", 0, 1, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "tk1" ));
-    
-    Wait.pause(2000);
-    
-    // Perform a put in vm1
-    vm1.invoke(new CacheSerializableRunnable("Putting an entry in ds1") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        
-        Region region = cache.getRegion("/repRegion");
-        region.put("testKey", "testValue");
-        
-        assertEquals(1, region.size());
-      }
-    });
-
-    //wait for vm1 to propagate put to vm3 and vm5
-    Wait.pause(2000); 
-
-    long destroyTimeStamp = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterOp());
-    
-    //wait for vm1 to propagate destroyed entry's new version tag to vm5
-    Wait.pause(2000); 
-
-    vm5.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.verifyTimestampAfterOp(destroyTimeStamp, 1 /* ds 3 receives gateway event only from ds 1*/));
-  }
-
-  /**
-   * Test creates two sites and one Replicated Region on each with Serial
-   * GatewaySender on each. Test checks for sequence of events being sent from
-   * site1 to site2 for PUTALL and PUT and finally checks for final timestamp in
-   * version for RegionEntry with key "testKey". If timestamp on both site is
-   * same that means events were transferred in correct sequence.
-   */
-  @Test
-  public void testPutAllEventSequenceOnSerialGatewaySenderWithRR() {
-    
-    // create two distributed systems with each having a cache containing
-    // a Replicated Region with one entry and concurrency checks enabled.
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    vm1.invoke(() -> WANTestBase.createCache(lnPort));
-    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
-    
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    vm3.invoke(() -> WANTestBase.createCache(nyPort));
-    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
-
-    LogWriterUtils.getLogWriter().info("Created locators and receivers in 2 distributed systems");
-     
-    //Site 1
-    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      false, 10, 1, false, false, null, true ));
-    
-    vm1.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ln1", isOffHeap() ));
-    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
-    
-    //Site 2
-    vm3.invoke(() -> WANTestBase.createSender( "ny1", 1,
-      false, 10, 1, false, false, null, true ));
-    
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ny1", isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm3.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
-    
-    Wait.pause(2000);
-    
-    // Perform a put in vm1
-    AsyncInvocation asynch1 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
-        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 2000; 
-        
-        Region region = cache.getRegion("/repRegion");
-        Map testMap = new HashMap();
-        testMap.put("testKey", "testValue1");
-        region.putAll(testMap);
-        
-        assertEquals(1, region.size());
-        assertEquals("testValue2", region.get("testKey"));
-      }
-    });
-
-    //wait for vm1 to propagate put to vm3
-    Wait.pause(1000); 
-
-    AsyncInvocation asynch2 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        Region region = cache.getRegion("/repRegion");
-        
-        while (!region.containsKey("testKey")) {
-          Wait.pause(10);
-        }
-        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
-        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0; 
-        
-        region.put("testKey", "testValue2");
-        
-        assertEquals(1, region.size());
-        assertEquals("testValue2", region.get("testKey"));
-      }
-    });
-
-    try {
-      asynch1.join(5000);
-      asynch2.join(5000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    } finally {
-      vm1.invoke(new CacheSerializableRunnable("Reset Test Hook") {
-        
-        @Override
-        public void run2() throws CacheException {
-          DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0;
-        }
-      });
-    }
-
-    //Wait for all Gateway events be received by vm3.
-    Wait.pause(1000);
-
-    long putAllTimeStampVm1 = (Long) vm1.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
-    
-    long putAllTimeStampVm3 = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
-    
-    assertEquals(putAllTimeStampVm1, putAllTimeStampVm3);
-  }
-
-/**
- * This is similar to above test but for PartitionedRegion.
- */
-  @Test
-  public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() {
-    
-    // create two distributed systems with each having a cache containing
-    // a Replicated Region with one entry and concurrency checks enabled.
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    createCacheInVMs(lnPort, vm1);
-    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
-    
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    createCacheInVMs(nyPort, vm3);
-    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
-
-    LogWriterUtils.getLogWriter().info("Created locators and receivers in 2 distributed systems");
-     
-    //Site 1
-    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      false, 10, 1, false, false, null, true ));
-    
-    vm1.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ln1", 0, 1, isOffHeap() ));
-    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
-    
-    //Site 2
-    vm3.invoke(() -> WANTestBase.createSender( "ny1", 1,
-      false, 10, 1, false, false, null, true ));
-    
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion("repRegion", "ny1", 0, 1, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm3.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
-    
-    Wait.pause(2000);
-    
-    // Perform a put in vm1
-    AsyncInvocation asynch1 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
-        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 2000; 
-        
-        Region region = cache.getRegion("/repRegion");
-        Map testMap = new HashMap();
-        testMap.put("testKey", "testValue1");
-        region.putAll(testMap);
-        
-        assertEquals(1, region.size());
-        assertEquals("testValue2", region.get("testKey"));
-      }
-    });
-
-    //wait for vm1 to propagate put to vm3
-    Wait.pause(1000); 
-
-    AsyncInvocation asynch2 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        Region region = cache.getRegion("/repRegion");
-        
-        while (!region.containsKey("testKey")) {
-          Wait.pause(10);
-        }
-        // Test hook to make put wait after RE lock is released but before Gateway events are sent.
-        DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0; 
-        
-        region.put("testKey", "testValue2");
-        
-        assertEquals(1, region.size());
-        assertEquals("testValue2", region.get("testKey"));
-      }
-    });
-
-    try {
-      asynch1.join(5000);
-      asynch2.join(5000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    } finally {
-      vm1.invoke(new CacheSerializableRunnable("Reset Test Hook") {
-        
-        @Override
-        public void run2() throws CacheException {
-          DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0;
-        }
-      });
-    }
-
-    //Wait for all Gateway events be received by vm3.
-    Wait.pause(1000);
-
-    long putAllTimeStampVm1 = (Long) vm1.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
-    
-    long putAllTimeStampVm3 = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
-    
-    assertEquals(putAllTimeStampVm1, putAllTimeStampVm3);
-  }
-
-  /**
-   * Tests if conflict checks are happening based on DSID and timestamp even if
-   * version tag is generated in local distributed system.
-   */
-  @Test
-  public void testConflictChecksBasedOnDsidAndTimeStamp() {
-
-    
-    // create two distributed systems with each having a cache containing
-    // a Replicated Region with one entry and concurrency checks enabled.
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    createCacheInVMs(lnPort, vm1);
-    Integer lnRecPort = (Integer) vm1.invoke(() -> WANTestBase.createReceiver());
-
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    createCacheInVMs(nyPort, vm3);
-    Integer nyRecPort = (Integer) vm3.invoke(() -> WANTestBase.createReceiver());
-    
-    LogWriterUtils.getLogWriter().info("Created locators and receivers in 2 distributed systems");
-
-    //Site 1
-    vm1.invoke(() -> WANTestBase.createSender( "ln1", 2,
-      false, 10, 1, false, false, null, true ));
-    
-    vm1.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ln1", isOffHeap() ));
-    vm1.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm1.invoke(() -> WANTestBase.waitForSenderRunningState( "ln1" ));
-    
-    //Site 2
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ny1", isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm4.invoke(() -> WANTestBase.createSender( "ny1", 1,
-      false, 10, 1, false, false, null, true ));
-    
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion("repRegion", "ny1", isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ny1" ));
-    
-    Wait.pause(2000);
-    
-    // Perform a put in vm1
-    vm1.invoke(new CacheSerializableRunnable("Putting an entry in ds1") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        
-        Region region = cache.getRegion("/repRegion");
-        region.put("testKey", "testValue1");
-        
-        assertEquals(1, region.size());
-      }
-    });
-
-    //wait for vm4 to have later timestamp before sending operation to vm1
-    Wait.pause(300); 
-
-    AsyncInvocation asynch = vm4.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds2 in vm4") {
-      
-      @Override
-      public void run2() throws CacheException {
-        assertNotNull(cache);
-        Region region = cache.getRegion("/repRegion");
-        
-        region.put("testKey", "testValue2");
-        
-        assertEquals(1, region.size());
-        assertEquals("testValue2", region.get("testKey"));
-      }
-    });
-
-    try {
-      asynch.join(2000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-
-    //Wait for all local ds events be received by vm3.
-    Wait.pause(1000);
-
-    vm3.invoke(new CacheSerializableRunnable("Check dsid") {
-      
-      @Override
-      public void run2() throws CacheException {
-        Region region = cache.getRegion("repRegion");
-        
-        Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/
-            true); //commented while merging revision 43582
-        RegionEntry re = null;
-        if (entry instanceof EntrySnapshot) {
-          re = ((EntrySnapshot)entry).getRegionEntry();
-        } else if (entry instanceof NonTXEntry) {
-          re = ((NonTXEntry)entry).getRegionEntry();
-        }
-        VersionTag tag = re.getVersionStamp().asVersionTag();
-        assertEquals(2, tag.getDistributedSystemId());
-      }
-    });
-
-    // Check vm3 has latest timestamp from vm4.
-    long putAllTimeStampVm1 = (Long) vm4.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
-    
-    long putAllTimeStampVm3 = (Long) vm3.invoke(() -> NewWANConcurrencyCheckForDestroyDUnitTest.getVersionTimestampAfterPutAllOp());
-    
-    assertEquals(putAllTimeStampVm1, putAllTimeStampVm3);
-  }
-  
-  /*
-   * For VM1 in ds 1. Used in testPutAllEventSequenceOnSerialGatewaySender.
-   */
-  public static long getVersionTimestampAfterPutAllOp() {
-    Region region = cache.getRegion("repRegion");
-    
-    while (!(region.containsKey("testKey") /*&& region.get("testKey").equals("testValue2") */)) {
-      Wait.pause(10);
-    }
-    assertEquals(1, region.size());
-
-    Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true);
-    RegionEntry re = null;
-    if (entry instanceof EntrySnapshot) {
-      re = ((EntrySnapshot)entry).getRegionEntry();
-    } else if (entry instanceof NonTXEntry) {
-      re = ((NonTXEntry)entry).getRegionEntry();
-    }
-    if (re != null) {
-      LogWriterUtils.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region));
-      
-      VersionTag tag = re.getVersionStamp().asVersionTag();
-      return tag.getVersionTimeStamp();
-    } else {
-      return -1;
-    }
-  }
-
-  /*
-   * For VM3 in ds 2.
-   */
-  public static long getVersionTimestampAfterOp() {
-    Region region = cache.getRegion("repRegion");
-    assertEquals(1, region.size());
-    
-    region.destroy("testKey");
-
-    Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true);
-    RegionEntry re = ((EntrySnapshot)entry).getRegionEntry();
-    LogWriterUtils.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region));
-    assertTrue(re.getValueInVM((LocalRegion) region) instanceof Tombstone);
-    
-    VersionTag tag = re.getVersionStamp().asVersionTag();
-    return tag.getVersionTimeStamp();
-  }
-
-  /*
-   * For VM 5 in ds 3.
-   */
-  public static void verifyTimestampAfterOp(long timestamp, int memberid) {
-    Region region = cache.getRegion("repRegion");
-    assertEquals(0, region.size());
-
-    Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true);
-    RegionEntry re = ((EntrySnapshot)entry).getRegionEntry();
-    assertTrue(re.getValueInVM((LocalRegion) region) instanceof Tombstone);
-    
-    VersionTag tag = re.getVersionStamp().asVersionTag();
-    assertEquals(timestamp, tag.getVersionTimeStamp());
-    assertEquals(memberid, tag.getDistributedSystemId());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java
deleted file mode 100644
index 76940ea..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWanAuthenticationDUnitTest.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import com.jayway.awaitility.Awaitility;
-import org.apache.geode.security.templates.SampleSecurityManager;
-import org.apache.logging.log4j.Logger;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.Assert;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.security.AuthInitialize;
-import com.gemstone.gemfire.security.AuthenticationFailedException;
-import com.gemstone.gemfire.security.SecurityTestUtils;
-import com.gemstone.gemfire.security.generator.CredentialGenerator;
-import com.gemstone.gemfire.security.generator.DummyCredentialGenerator;
-import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class NewWanAuthenticationDUnitTest extends WANTestBase {
-
-  public static final Logger logger = LogService.getLogger();
-
-  public static boolean isDifferentServerInGetCredentialCall = false;
-
-  /**
-   * Authentication test for new WAN with valid credentials. Although, nothing
-   * related to authentication has been changed in new WAN, this test case is
-   * added on request from QA for defect 44650.
-   */
-  @Test
-  public void testWanAuthValidCredentials() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    logger.info("Created locator on local site");
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    logger.info("Created locator on remote site");
-
-
-    CredentialGenerator gen = new DummyCredentialGenerator();
-    Properties extraProps = gen.getSystemProperties();
-
-    String clientauthenticator = gen.getAuthenticator();
-    String clientauthInit = gen.getAuthInit();
-
-    Properties credentials1 = gen.getValidCredentials(1);
-    if (extraProps != null) {
-      credentials1.putAll(extraProps);
-    }
-    Properties javaProps1 = gen.getJavaProperties();
-
-    // vm3's invalid credentials
-    Properties credentials2 = gen.getInvalidCredentials(1);
-    if (extraProps != null) {
-      credentials2.putAll(extraProps);
-    }
-    Properties javaProps2 = gen.getJavaProperties();
-
-    Properties props1 = buildProperties(clientauthenticator, clientauthInit,
-      null, credentials1, null);
-
-    // have vm 3 start a cache with invalid credentails
-    Properties props2 = buildProperties(clientauthenticator, clientauthInit,
-      null, credentials2, null);
-
-    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props1, javaProps1, lnPort ));
-    logger.info("Created secured cache in vm2");
-
-    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props2, javaProps2, nyPort ));
-    logger.info("Created secured cache in vm3");
-
-    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    logger.info("Created sender in vm2");
-
-    vm3.invoke(() -> createReceiverInSecuredCache());
-    logger.info("Created receiver in vm3");
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    logger.info("Created RR in vm2");
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-    logger.info("Created RR in vm3");
-
-    // this tests verifies that even though vm3 has invalid credentials, vm2 can still send data to vm3 because
-    // vm2 has valid credentials
-    vm2.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    vm2.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1));
-    vm3.invoke(() -> {
-      Region r = cache.getRegion(Region.SEPARATOR + getTestMethodName() + "_RR");
-      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> assertTrue(r.size() > 0));
-    });
-    logger.info("Done successfully.");
-  }
-
-  @Test
-  public void testWanIntegratedSecurityWithValidCredentials() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    logger.info("Created locator on local site");
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    logger.info("Created locator on remote site");
-
-
-    Properties props1 = buildSecurityProperties("admin", "secret");
-    Properties props2 = buildSecurityProperties("guest", "guest");
-
-    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props1, null, lnPort ));
-    logger.info("Created secured cache in vm2");
-
-    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props2, null, nyPort ));
-    logger.info("Created secured cache in vm3");
-
-    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    logger.info("Created sender in vm2");
-
-    vm3.invoke(() -> createReceiverInSecuredCache());
-    logger.info("Created receiver in vm3");
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    logger.info("Created RR in vm2");
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-    logger.info("Created RR in vm3");
-
-    vm2.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm2.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1));
-    vm3.invoke(() -> {
-      Region r = cache.getRegion(Region.SEPARATOR + getTestMethodName() + "_RR");
-      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> assertTrue(r.size() > 0));
-
-    });
-    logger.info("Done successfully.");
-  }
-
-  /**
-   * Test authentication with new WAN with invalid credentials. Although,
-   * nothing related to authentication has been changed in new WAN, this test
-   * case is added on request from QA for defect 44650.
-   */
-  @Test
-  public void testWanAuthInvalidCredentials() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    logger.info("Created locator on local site");
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    logger.info("Created locator on remote site");
-
-
-    CredentialGenerator gen = new DummyCredentialGenerator();
-    logger.info("Picked up credential: " + gen);
-
-    Properties extraProps = gen.getSystemProperties();
-
-    String clientauthenticator = gen.getAuthenticator();
-    String clientauthInit = gen.getAuthInit();
-
-    Properties credentials1 = gen.getInvalidCredentials(1);
-    if (extraProps != null) {
-      credentials1.putAll(extraProps);
-    }
-    Properties javaProps1 = gen.getJavaProperties();
-    Properties credentials2 = gen.getInvalidCredentials(2);
-    if (extraProps != null) {
-      credentials2.putAll(extraProps);
-    }
-    Properties javaProps2 = gen.getJavaProperties();
-
-    Properties props1 = buildProperties(clientauthenticator, clientauthInit,
-      null, credentials1, null);
-    Properties props2 = buildProperties(clientauthenticator, clientauthInit,
-      null, credentials2, null);
-
-    logger.info("Done building auth properties");
-
-    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props1, javaProps1, lnPort ));
-    logger.info("Created secured cache in vm2");
-
-    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props2, javaProps2, nyPort ));
-    logger.info("Created secured cache in vm3");
-
-    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    logger.info("Created sender in vm2");
-
-    vm3.invoke(() -> createReceiverInSecuredCache());
-    logger.info("Created receiver in vm3");
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    logger.info("Created RR in vm2");
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-    logger.info("Created RR in vm3");
-
-    try {
-      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
-      fail("Authentication Failed: While starting the sender, an exception should have been thrown");
-    } catch (Exception e) {
-      if (!(e.getCause().getCause() instanceof AuthenticationFailedException)) {
-        fail("Authentication is not working as expected", e);
-      }
-    }
-  }
-
-  /**
-   * Test authentication with new WAN with invalid credentials. Although,
-   * nothing related to authentication has been changed in new WAN, this test
-   * case is added on request from QA for defect 44650.
-   */
-  @Test
-  public void testWanSecurityManagerWithInvalidCredentials() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    logger.info("Created locator on local site");
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    logger.info("Created locator on remote site");
-
-    Properties props1 = buildSecurityProperties("admin", "wrongPswd");
-    Properties props2 = buildSecurityProperties("guest", "wrongPswd");
-
-    logger.info("Done building auth properties");
-
-    vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props1, null, lnPort ));
-    logger.info("Created secured cache in vm2");
-
-    vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-      props2, null, nyPort ));
-    logger.info("Created secured cache in vm3");
-
-    vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    logger.info("Created sender in vm2");
-
-    vm3.invoke(() -> createReceiverInSecuredCache());
-    logger.info("Created receiver in vm3");
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap()  ));
-    logger.info("Created RR in vm2");
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-    logger.info("Created RR in vm3");
-
-    try {
-      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
-      fail("Authentication Failed: While starting the sender, an exception should have been thrown");
-    } catch (Exception e) {
-      if (!(e.getCause().getCause() instanceof AuthenticationFailedException)) {
-        fail("Authentication is not working as expected", e);
-      }
-    }
-  }
-
-  private static Properties buildProperties(String clientauthenticator,
-                                            String clientAuthInit, String accessor, Properties extraAuthProps,
-                                            Properties extraAuthzProps) {
-    Properties authProps = new Properties();
-    if (clientauthenticator != null) {
-      authProps.setProperty(
-        SECURITY_CLIENT_AUTHENTICATOR,
-        clientauthenticator);
-    }
-    if (accessor != null) {
-      authProps.setProperty(SECURITY_CLIENT_ACCESSOR,
-        accessor);
-    }
-    if (clientAuthInit != null) {
-      authProps.setProperty(SECURITY_CLIENT_AUTH_INIT, clientAuthInit);
-    }
-    if (extraAuthProps != null) {
-      authProps.putAll(extraAuthProps);
-    }
-    if (extraAuthzProps != null) {
-      authProps.putAll(extraAuthzProps);
-    }
-    return authProps;
-  }
-
-  private static Properties buildSecurityProperties(String username, String password){
-    Properties props = new Properties();
-    props.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
-    props.put("security-json", "org/apache/geode/security/templates/security.json");
-    props.put(SECURITY_CLIENT_AUTH_INIT, UserPasswdAI.class.getName());
-    props.put("security-username", username);
-    props.put("security-password", password);
-    return props;
-  }
-
-  public static void createSecuredCache(Properties authProps, Object javaProps, Integer locPort) {
-    authProps.setProperty(MCAST_PORT, "0");
-    authProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
-
-    logger.info("Set the server properties to: " + authProps);
-    logger.info("Set the java properties to: " + javaProps);
-
-    SecurityTestUtils tmpInstance = new SecurityTestUtils("temp");
-    DistributedSystem ds = tmpInstance.createSystem(authProps, (Properties)javaProps);
-    assertNotNull(ds);
-    assertTrue(ds.isConnected());
-    cache = CacheFactory.create(ds);
-    assertNotNull(cache);
-  }
-
-  public static class UserPasswdAI extends UserPasswordAuthInit {
-
-    public static AuthInitialize createAI() {
-      return new UserPasswdAI();
-    }
-
-    @Override
-    public Properties getCredentials(Properties props,
-                                     DistributedMember server, boolean isPeer)
-      throws AuthenticationFailedException {
-      boolean val = ( CacheFactory.getAnyInstance().getDistributedSystem().getDistributedMember().getProcessId() != server.getProcessId());
-      Assert.assertTrue(val, "getCredentials: Server should be different");
-      Properties p = super.getCredentials(props, server, isPeer);
-      if(val) {
-        isDifferentServerInGetCredentialCall = true;
-        CacheFactory.getAnyInstance().getLoggerI18n().convertToLogWriter().config("setting  isDifferentServerInGetCredentialCall " + isDifferentServerInGetCredentialCall);
-      } else {
-        CacheFactory.getAnyInstance().getLoggerI18n().convertToLogWriter().config("setting22  isDifferentServerInGetCredentialCall " + isDifferentServerInGetCredentialCall);
-      }
-      return p;
-    }
-  }
-
-  public static void verifyDifferentServerInGetCredentialCall(){
-    Assert.assertTrue(isDifferentServerInGetCredentialCall, "verifyDifferentServerInGetCredentialCall: Server should be different");
-    isDifferentServerInGetCredentialCall = false;
-  }
-
-  @Test
-  public void testWanAuthValidCredentialsWithServer() {
-    disconnectAllFromDS();
-    {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      logger.info("Created locator on local site");
-
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-      logger.info("Created locator on remote site");
-
-      DummyCredentialGenerator gen = new DummyCredentialGenerator();
-      gen.init();
-      Properties extraProps = gen.getSystemProperties();
-
-      String clientauthenticator = gen.getAuthenticator();
-      String clientauthInit = UserPasswdAI.class.getName() + ".createAI";
-
-      Properties credentials1 = gen.getValidCredentials(1);
-      if (extraProps != null) {
-        credentials1.putAll(extraProps);
-      }
-      Properties javaProps1 = gen.getJavaProperties();
-
-      Properties credentials2 = gen.getInvalidCredentials(2);
-      if (extraProps != null) {
-        credentials2.putAll(extraProps);
-      }
-      Properties javaProps2 = gen.getJavaProperties();
-
-      Properties props1 = buildProperties(clientauthenticator, clientauthInit,
-        null, credentials1, null);
-      Properties props2 = buildProperties(clientauthenticator, clientauthInit,
-        null, credentials2, null);
-
-      vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-        props1, javaProps1, lnPort ));
-      logger.info("Created secured cache in vm2");
-
-      vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-        props2, javaProps2, nyPort ));
-      logger.info("Created secured cache in vm3");
-
-      vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-      logger.info("Created sender in vm2");
-
-      vm3.invoke(() -> createReceiverInSecuredCache());
-      logger.info("Created receiver in vm3");
-
-      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
-      vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-      vm2.invoke(() -> verifyDifferentServerInGetCredentialCall());
-      vm3.invoke(() -> verifyDifferentServerInGetCredentialCall());
-    }
-  }
-
-  @Test
-  public void testWanSecurityManagerAuthValidCredentialsWithServer() {
-    disconnectAllFromDS();
-    {
-      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-      logger.info("Created locator on local site");
-
-      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-      logger.info("Created locator on remote site");
-
-      Properties props1 = buildSecurityProperties("admin", "secret");
-      Properties props2 = buildSecurityProperties("guest", "guest");
-
-      vm2.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-        props1, null, lnPort ));
-      logger.info("Created secured cache in vm2");
-
-      vm3.invoke(() -> NewWanAuthenticationDUnitTest.createSecuredCache(
-        props2, null, nyPort ));
-      logger.info("Created secured cache in vm3");
-
-      vm2.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-      logger.info("Created sender in vm2");
-
-      vm3.invoke(() -> createReceiverInSecuredCache());
-      logger.info("Created receiver in vm3");
-
-      vm2.invoke(() -> WANTestBase.startSender( "ln" ));
-      vm2.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-      vm2.invoke(() -> verifyDifferentServerInGetCredentialCall());
-
-      // this would fail for now because for integrated security, we are not sending the receiver's credentials back
-      // to the sender. Because in the old security implementation, even though the receiver's credentials are sent back to the sender
-      // the sender is not checking it.
-      //vm3.invoke(() -> verifyDifferentServerInGetCredentialCall());
-    }
-  }
-}


[59/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderImpl.java
deleted file mode 100644
index 85e1bc0..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderImpl.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.distributed.DistributedLockService;
-import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.ResourceEvent;
-import com.gemstone.gemfire.internal.cache.EntryEventImpl;
-import com.gemstone.gemfire.internal.cache.EventID;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.RegionQueue;
-import com.gemstone.gemfire.internal.cache.UpdateAttributesProcessor;
-import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySenderEventProcessor;
-import com.gemstone.gemfire.internal.cache.wan.AbstractRemoteGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderConfigurationException;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-
-/**
- * @since GemFire 7.0
- *
- */
-public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
-
-  private static final Logger logger = LogService.getLogger();
-  
-  final ThreadGroup loggerGroup = LoggingThreadGroup.createThreadGroup(
-      "Remote Site Discovery Logger Group", logger);
-
-  public SerialGatewaySenderImpl(){
-    super();
-    this.isParallel = false;
-  }
-  public SerialGatewaySenderImpl(Cache cache,
-      GatewaySenderAttributes attrs) {
-    super(cache, attrs);
-  }
-  
-  @Override
-  public void start() {
-    if (logger.isDebugEnabled()) {
-      logger.debug("Starting gatewaySender : {}", this);
-    }
-    
-    this.getLifeCycleLock().writeLock().lock();
-    try {
-      if (isRunning()) {
-        logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_SENDER_0_IS_ALREADY_RUNNING, this.getId()));
-        return;
-      }
-      if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-        String locators = ((GemFireCacheImpl)this.cache).getDistributedSystem()
-            .getConfig().getLocators();
-        if (locators.length() == 0) {
-          throw new GatewaySenderConfigurationException(
-              LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
-                  .toLocalizedString());
-        }
-      }
-      getSenderAdvisor().initDLockService();
-      if (!isPrimary()) {
-        if (getSenderAdvisor().volunteerForPrimary()) {
-          getSenderAdvisor().makePrimary();
-        } else {
-          getSenderAdvisor().makeSecondary();
-        }
-      }
-      if (getDispatcherThreads() > 1) {
-        eventProcessor = new RemoteConcurrentSerialGatewaySenderEventProcessor(
-            SerialGatewaySenderImpl.this);
-      } else {
-        eventProcessor = new RemoteSerialGatewaySenderEventProcessor(
-            SerialGatewaySenderImpl.this, getId());
-      }
-      eventProcessor.start();
-      waitForRunningStatus();
-      this.startTime = System.currentTimeMillis();
-      
-      //Only notify the type registry if this is a WAN gateway queue
-      if(!isAsyncEventQueue()) {
-        ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
-      }
-      new UpdateAttributesProcessor(this).distribute(false);
-
-      
-      InternalDistributedSystem system = (InternalDistributedSystem) this.cache
-          .getDistributedSystem();
-      system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
-      
-      logger.info(LocalizedMessage.create(LocalizedStrings.SerialGatewaySenderImpl_STARTED__0, this));
-  
-      enqueueTempEvents();
-    } finally {
-      this.getLifeCycleLock().writeLock().unlock();
-    }
-  }
-  
-  @Override
-  public void stop() {
-    if (logger.isDebugEnabled()) {
-      logger.debug("Stopping Gateway Sender : {}", this);
-    }
-    this.getLifeCycleLock().writeLock().lock();
-    try {
-      // Stop the dispatcher
-      AbstractGatewaySenderEventProcessor ev = this.eventProcessor;
-      if (ev != null && !ev.isStopped()) {
-        ev.stopProcessing();
-      }
-      
-      // Stop the proxy (after the dispatcher, so the socket is still
-      // alive until after the dispatcher has stopped)
-      stompProxyDead();
-
-      // Close the listeners
-      for (AsyncEventListener listener : this.listeners) {
-        listener.close();
-      }
-      logger.info(LocalizedMessage.create(LocalizedStrings.GatewayImpl_STOPPED__0, this));
-
-      clearTempEventsAfterSenderStopped();
-    } finally {
-      this.getLifeCycleLock().writeLock().unlock();
-    }
-   
-    if (this.isPrimary()) {
-      try {
-        DistributedLockService
-            .destroy(getSenderAdvisor().getDLockServiceName());
-      } catch (IllegalArgumentException e) {
-        // service not found... ignore
-      }
-    }
-    Set<RegionQueue> queues = getQueues();
-    if (queues != null && !queues.isEmpty()) {
-      for (RegionQueue q : queues) {
-        ((SerialGatewaySenderQueue)q).cleanUp();
-      }
-    }
-   
-    this.setIsPrimary(false);
-    new UpdateAttributesProcessor(this).distribute(false);
-    Thread lockObtainingThread = getSenderAdvisor().getLockObtainingThread();
-    if (lockObtainingThread != null && lockObtainingThread.isAlive()) {
-      // wait a while for thread to terminate
-      try {
-        lockObtainingThread.join(3000);
-      } catch (InterruptedException ex) {
-        // we allowed our join to be canceled
-        // reset interrupt bit so this thread knows it has been interrupted
-        Thread.currentThread().interrupt();
-      }
-      if (lockObtainingThread.isAlive()) {
-        logger.info(LocalizedMessage.create(LocalizedStrings.GatewaySender_COULD_NOT_STOP_LOCK_OBTAINING_THREAD_DURING_GATEWAY_SENDER_STOP));
-      }
-    }
-    
-    InternalDistributedSystem system = (InternalDistributedSystem) this.cache
-        .getDistributedSystem();
-    system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_STOP, this);
-    
-    this.eventProcessor = null;
-  }
-  
-  @Override
-  public String toString() {
-    StringBuffer sb = new StringBuffer();
-    sb.append("SerialGatewaySender{");
-    sb.append("id=" + getId());
-    sb.append(",remoteDsId="+ getRemoteDSId());
-    sb.append(",isRunning ="+ isRunning());
-    sb.append(",isPrimary ="+ isPrimary());
-    sb.append("}");
-    return sb.toString();
-  }
- 
-  @Override
-  public void fillInProfile(Profile profile) {
-    assert profile instanceof GatewaySenderProfile;
-    GatewaySenderProfile pf = (GatewaySenderProfile)profile;
-    pf.Id = getId();
-    pf.startTime = getStartTime();
-    pf.remoteDSId = getRemoteDSId();
-    pf.isRunning = isRunning();
-    pf.isPrimary = isPrimary();
-    pf.isParallel = false;
-    pf.isBatchConflationEnabled = isBatchConflationEnabled();
-    pf.isPersistenceEnabled = isPersistenceEnabled();
-    pf.alertThreshold = getAlertThreshold();
-    pf.manualStart = isManualStart();
-    for (com.gemstone.gemfire.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
-      pf.eventFiltersClassNames.add(filter.getClass().getName());
-    }
-    for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
-      pf.transFiltersClassNames.add(filter.getClass().getName());
-    }
-    for (AsyncEventListener listener : getAsyncEventListeners()) {
-      pf.senderEventListenerClassNames.add(listener.getClass().getName());
-    }
-    pf.isDiskSynchronous = isDiskSynchronous();
-    pf.dispatcherThreads = getDispatcherThreads();
-    pf.orderPolicy = getOrderPolicy();
-    pf.serverLocation = this.getServerLocation(); 
-  }
-
-  /* (non-Javadoc)
-   * @see com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(com.gemstone.gemfire.internal.cache.EntryEventImpl)
-   */
-  @Override
-  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
-    EventID originalEventId = clonedEvent.getEventId();
-    long originalThreadId = originalEventId.getThreadID();
-    long newThreadId = originalThreadId;
-    if (ThreadIdentifier.isWanTypeThreadID(newThreadId)) {
-      // This thread id has already been converted. Do nothing.
-    } else {
-      newThreadId = ThreadIdentifier
-        .createFakeThreadIDForParallelGSPrimaryBucket(0, originalThreadId,
-            getEventIdIndex());
-    }
-    EventID newEventId = new EventID(originalEventId.getMembershipID(),
-        newThreadId, originalEventId.getSequenceID());
-    if (logger.isDebugEnabled()) {
-      logger.debug("{}: Generated event id for event with key={}, original event id={}, originalThreadId={}, new event id={}, newThreadId={}",
-          this, clonedEvent.getKey(), originalEventId, originalThreadId, newEventId, newThreadId);
-    }
-    clonedEvent.setEventId(newEventId);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/GatewaySenderBatchOp.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/GatewaySenderBatchOp.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/GatewaySenderBatchOp.java
new file mode 100755
index 0000000..b042da0
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/GatewaySenderBatchOp.java
@@ -0,0 +1,312 @@
+/*
+ * 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.client.internal;
+
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.cache.EventID;
+import com.gemstone.gemfire.internal.cache.tier.MessageType;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage;
+import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
+import com.gemstone.gemfire.internal.cache.tier.sockets.Part;
+import com.gemstone.gemfire.internal.cache.wan.BatchException70;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventImpl;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher.GatewayAck;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+import java.net.SocketTimeoutException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.logging.log4j.Logger;
+
+@SuppressWarnings("unchecked")
+public class GatewaySenderBatchOp {
+  
+  private static final Logger logger = LogService.getLogger();
+  
+  /**
+   * Send a list of gateway events to a server to execute
+   * using connections from the given pool
+   * to communicate with the server.
+   * @param con the connection to send the message on.
+   * @param pool the pool to use to communicate with the server.
+   * @param events list of gateway events
+   * @param batchId the ID of this batch
+   */
+  public static void executeOn(Connection con, ExecutablePool pool, List events, int batchId, boolean isRetry)
+  {
+    AbstractOp op = null;
+    //System.out.println("Version: "+con.getWanSiteVersion());
+    //Is this check even needed anymore?  It looks like we just create the same exact op impl with the same parameters...
+    if (Version.GFE_651.compareTo(con.getWanSiteVersion()) >= 0) {
+      op = new GatewaySenderGFEBatchOpImpl(events, batchId, con.getDistributedSystemId(), isRetry);
+    } else {
+      // Default should create a batch of server version (ACCEPTOR.VERSION)
+      op = new GatewaySenderGFEBatchOpImpl(events, batchId, con.getDistributedSystemId(), isRetry);
+    }
+    pool.executeOn(con, op, true/*timeoutFatal*/);
+  }
+  
+  
+  public static Object executeOn(Connection con, ExecutablePool pool)
+  {
+    AbstractOp op = new GatewaySenderGFEBatchOpImpl();
+    return pool.executeOn(con, op, true/*timeoutFatal*/);
+  }
+                                                               
+  private GatewaySenderBatchOp() {
+    // no instances allowed
+  }
+  
+  static class GatewaySenderGFEBatchOpImpl extends AbstractOp {
+    
+    /**
+     * @throws com.gemstone.gemfire.SerializationException if serialization fails
+     */
+    public GatewaySenderGFEBatchOpImpl(List events, int batchId, int dsId, boolean isRetry)  {
+      super(MessageType.GATEWAY_RECEIVER_COMMAND, calcPartCount(events));
+      boolean removeFromQueueOnException = true;
+      if (isRetry) {
+        getMessage().setIsRetry();
+      }
+      getMessage().addIntPart(events.size());
+      getMessage().addIntPart(batchId);
+      getMessage().addIntPart(dsId);
+      getMessage().addBytesPart(
+          new byte[] { removeFromQueueOnException ? (byte)1 : (byte)0 });
+      // Add each event
+      for (Iterator i = events.iterator(); i.hasNext();) {
+        GatewaySenderEventImpl event = (GatewaySenderEventImpl)i.next();
+        // Add action
+        int action = event.getAction();
+        getMessage().addIntPart(action);
+        { // Add posDup flag
+          byte posDupByte = (byte)(event.getPossibleDuplicate()?0x01:0x00);
+          getMessage().addBytesPart(new byte[] {posDupByte});
+        }
+        if (action >= 0 && action <= 3) {
+          // 0 = create
+          // 1 = update
+          // 2 = destroy
+          String regionName = event.getRegionPath();
+          EventID eventId = event.getEventId();
+          Object key = event.getKey();
+          Object callbackArg = event.getSenderCallbackArgument();
+
+          // Add region name
+          getMessage().addStringPart(regionName);
+          // Add event id
+          getMessage().addObjPart(eventId);
+          // Add key
+          getMessage().addStringOrObjPart(key);
+          if (action < 2 /* it is 0 or 1 */) {
+            byte[] value = event.getSerializedValue();
+            byte valueIsObject = event.getValueIsObject();;
+            // Add value (which is already a serialized byte[])
+            getMessage().addRawPart(value, (valueIsObject == 0x01));
+          }
+          // Add callback arg if necessary
+          if (callbackArg == null) {
+            getMessage().addBytesPart(new byte[] {0x00});
+          } else {
+            getMessage().addBytesPart(new byte[] {0x01});
+            getMessage().addObjPart(callbackArg);
+          }
+          getMessage().addLongPart(event.getVersionTimeStamp());
+        }
+      }
+    }
+
+    public GatewaySenderGFEBatchOpImpl() {
+      super(MessageType.GATEWAY_RECEIVER_COMMAND, 0);
+    }
+
+    @Override
+    public Object attempt(Connection cnx) throws Exception {
+      if (getMessage().getNumberOfParts() == 0) {
+        return attemptRead(cnx);
+      }
+      this.failed = true;
+      this.timedOut = false;
+      long start = startAttempt(cnx.getStats());
+      try {
+        try {
+          attemptSend(cnx);
+          this.failed = false;
+        } finally {
+          endSendAttempt(cnx.getStats(), start);
+        }
+      } finally {
+        endAttempt(cnx.getStats(), start);
+      }
+      return this.failed;
+    }
+    
+    private Object attemptRead(Connection cnx) throws Exception {
+      this.failed = true;
+      try {
+        Object result = attemptReadResponse(cnx);
+        this.failed = false;
+        return result;
+      } catch (SocketTimeoutException ste) {
+        this.failed = false;
+        this.timedOut = true;
+        throw ste;
+      } catch (Exception e) {
+        throw e;
+      }
+    }
+    
+    
+    /**
+     * Attempts to read a response to this operation by reading it from the
+     * given connection, and returning it.
+     * @param cnx the connection to read the response from
+     * @return the result of the operation
+     *         or <code>null</code> if the operation has no result.
+     * @throws Exception if the execute failed
+     */
+    protected Object attemptReadResponse(Connection cnx) throws Exception {
+      Message msg = createResponseMessage();
+      if (msg != null) {
+        msg.setComms(cnx.getSocket(), cnx.getInputStream(),
+            cnx.getOutputStream(),
+            ((ConnectionImpl)cnx).getCommBufferForAsyncRead(), cnx.getStats());
+        if (msg instanceof ChunkedMessage) {
+          try {
+            return processResponse(msg, cnx);
+          } finally {
+            msg.unsetComms();
+            // TODO (ashetkar) Handle the case when we fail to read the
+            // connection id.
+            processSecureBytes(cnx, msg);
+          }
+        }
+
+        try {
+          msg.recv();
+        } finally {
+          msg.unsetComms();
+          processSecureBytes(cnx, msg);
+        }
+        return processResponse(msg, cnx);
+      }
+      
+      return null;
+    }
+    
+    
+    private static int calcPartCount(List events) {
+      int numberOfParts = 4; // for the number of events and the batchId
+      for (Iterator i = events.iterator(); i.hasNext();) {
+        GatewaySenderEventImpl event = (GatewaySenderEventImpl)i.next();
+        numberOfParts += event.getNumberOfParts();
+      }
+      return numberOfParts;
+    }
+
+    @Override
+    protected void processSecureBytes(Connection cnx, Message message)
+        throws Exception {
+    }
+
+    @Override
+    protected boolean needsUserId() {
+      return false;
+    }
+
+    @Override
+    protected void sendMessage(Connection cnx) throws Exception {
+      getMessage().clearMessageHasSecurePartFlag();
+      getMessage().send(false);
+    }
+
+    @Override
+    protected Object processResponse(Message msg) throws Exception {
+      GatewayAck ack = null;
+      try {
+        // Read the header which describes the type of message following
+        switch (msg.getMessageType()) {
+        case MessageType.REPLY:
+          // Read the chunk
+          Part part0 = msg.getPart(0);
+          if (part0.isBytes() && part0.getLength() == 1 && part0.getSerializedForm()[0] == 0) {
+            // REPLY_OKAY from a CloseConnection
+            break;
+          }
+          int batchId = part0.getInt();
+          int numEvents = msg.getPart(1).getInt();
+          ack = new GatewayAck(batchId, numEvents);
+          break;
+        case MessageType.EXCEPTION:
+          part0 = msg.getPart(0);
+
+          Object obj = part0.getObject();
+          if (obj instanceof List) {
+            List<BatchException70> l = (List<BatchException70>)part0.getObject();
+
+           // if (logger.isDebugEnabled()) {
+              logger.info("We got an exception from the GatewayReceiver. MessageType : {} obj :{}", msg.getMessageType(), obj);
+            //}
+            // don't throw Exception but set it in the Ack
+            BatchException70 be = new BatchException70(l);
+            ack = new GatewayAck(be, l.get(0).getBatchId());
+
+          } else if (obj instanceof Throwable) {
+            String s = ": While reading Ack from receiver "
+                + ((Throwable)obj).getMessage();
+            throw new ServerOperationException(s, (Throwable)obj);
+          }
+          break;
+        default:
+          throw new InternalGemFireError(
+              LocalizedStrings.Op_UNKNOWN_MESSAGE_TYPE_0
+                  .toLocalizedString(Integer.valueOf(msg.getMessageType())));
+        }
+      } finally {
+        msg.clear();
+      }
+      return ack;
+    }
+    
+    @Override
+    protected boolean isErrorResponse(int msgType) {
+      return false;
+    }
+    @Override
+    protected long startAttempt(ConnectionStats stats) {
+      return stats.startGatewayBatch();
+    }
+    @Override
+    protected void endSendAttempt(ConnectionStats stats, long start) {
+      stats.endGatewayBatchSend(start, hasFailed());
+    }
+    @Override
+    protected void endAttempt(ConnectionStats stats, long start) {
+      stats.endGatewayBatch(start, hasTimedOut(), hasFailed());
+    }
+    
+    @Override
+    public boolean isGatewaySenderOp() {
+      return true;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/SenderProxy.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/SenderProxy.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/SenderProxy.java
new file mode 100644
index 0000000..8647d12
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/SenderProxy.java
@@ -0,0 +1,42 @@
+/*
+ * 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.client.internal;
+
+import java.util.List;
+
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.distributed.internal.ServerLocation;
+
+/**
+ * Used to send operations from a sender to a receiver.
+ * @since GemFire 8.1
+ */
+public class SenderProxy extends ServerProxy{
+  public SenderProxy(InternalPool pool) {
+    super(pool);
+  }
+
+  public void dispatchBatch_NewWAN(Connection con, List events, int batchId, boolean isRetry)
+  {
+    GatewaySenderBatchOp.executeOn(con, this.pool, events, batchId, isRetry);
+  }
+  
+  public Object receiveAckFromReceiver(Connection con)
+  {
+    return GatewaySenderBatchOp.executeOn(con, this.pool);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorDiscovery.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorDiscovery.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorDiscovery.java
new file mode 100644
index 0000000..60973ed
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorDiscovery.java
@@ -0,0 +1,234 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import com.gemstone.gemfire.internal.net.*;
+import com.gemstone.gemfire.internal.tcp.ConnectionException;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * This class represent a runnable task which exchange the locator information
+ * with local locators(within the site) as well as remote locators (across the
+ * site)
+ * 
+ * @since GemFire 7.0
+ */
+public class LocatorDiscovery{
+
+  private static final Logger logger = LogService.getLogger();
+
+  private WanLocatorDiscoverer discoverer;
+
+  private DistributionLocatorId locatorId;
+  
+  private LocatorMembershipListener locatorListener;
+  
+  RemoteLocatorJoinRequest request;
+  
+  TcpClient locatorClient;
+
+  public static final int WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT = Integer
+      .getInteger("WANLocator.CONNECTION_RETRY_ATTEMPT", 50000).intValue();
+
+  public static final int WAN_LOCATOR_CONNECTION_INTERVAL = Integer.getInteger(
+      "WANLocator.CONNECTION_INTERVAL", 10000).intValue();
+
+  public static final int WAN_LOCATOR_PING_INTERVAL = Integer.getInteger(
+      "WANLocator.PING_INTERVAL", 10000).intValue();
+
+  public LocatorDiscovery(WanLocatorDiscoverer discoverer, DistributionLocatorId locator,RemoteLocatorJoinRequest request,
+      LocatorMembershipListener locatorListener) {
+    this.discoverer = discoverer;
+    this.locatorId = locator;
+    this.request = request; 
+    this.locatorListener = locatorListener;
+    this.locatorClient = new TcpClient();
+  }
+  
+  /**
+   * When a batch fails, then this keeps the last time when a failure was logged
+   * . We don't want to swamp the logs in retries due to same batch failures.
+   */
+  private final ConcurrentHashMap<DistributionLocatorId, long[]> failureLogInterval = new ConcurrentHashMap<DistributionLocatorId, long[]>();
+
+  /**
+   * The maximum size of {@link #failureLogInterval} beyond which it will start
+   * logging all failure instances. Hopefully this should never happen in
+   * practice.
+   */
+  private static final int FAILURE_MAP_MAXSIZE = Integer.getInteger(
+      DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.FAILURE_MAP_MAXSIZE", 1000000);
+
+  /**
+   * The maximum interval for logging failures of the same event in millis.
+   */
+  private static final int FAILURE_LOG_MAX_INTERVAL = Integer.getInteger(
+      DistributionConfig.GEMFIRE_PREFIX + "LocatorDiscovery.FAILURE_LOG_MAX_INTERVAL", 300000);
+
+  public final boolean skipFailureLogging(DistributionLocatorId locatorId) {
+    boolean skipLogging = false;
+    if (this.failureLogInterval.size() < FAILURE_MAP_MAXSIZE) {
+      long[] logInterval = this.failureLogInterval.get(locatorId);
+      if (logInterval == null) {
+        logInterval = this.failureLogInterval.putIfAbsent(locatorId,
+            new long[] { System.currentTimeMillis(), 1000 });
+      }
+      if (logInterval != null) {
+        long currentTime = System.currentTimeMillis();
+        if ((currentTime - logInterval[0]) < logInterval[1]) {
+          skipLogging = true;
+        } else {
+          logInterval[0] = currentTime;
+          if (logInterval[1] <= (FAILURE_LOG_MAX_INTERVAL / 2)) {
+            logInterval[1] *= 2;
+          }
+        }
+      }
+    }
+    return skipLogging;
+  }
+
+
+  public class LocalLocatorDiscovery implements Runnable {
+    public void run() {
+      exchangeLocalLocators();
+    }
+  }
+
+  public class RemoteLocatorDiscovery implements Runnable {
+    public void run() {
+      exchangeRemoteLocators();
+    }
+  }
+
+  private WanLocatorDiscoverer getDiscoverer() {
+    return this.discoverer;
+  }
+  
+  private void exchangeLocalLocators() {
+    int retryAttempt = 1;
+    while (!getDiscoverer().isStopped()) {
+      try {
+        RemoteLocatorJoinResponse response = (RemoteLocatorJoinResponse)locatorClient
+            .requestToServer(locatorId.getHost(), locatorId.getPort(), request,
+                WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
+        if (response != null) {
+          LocatorHelper.addExchangedLocators(response.getLocators(),
+              this.locatorListener);
+          logger.info(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_EXCHANGED_LOCATOR_INFORMATION_0_WITH_1,
+              new Object[] { request.getLocator(), locatorId, response.getLocators() }));
+          break;
+        }
+      }
+      catch (IOException ioe) {
+        if (retryAttempt == WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT) {
+          ConnectionException coe = new ConnectionException(
+              "Not able to connect to local locator after "
+              + WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT + " retry attempts",
+          ioe);
+          logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2,
+              new Object[] { request.getLocator(),locatorId, retryAttempt }), coe);
+          break;
+        }
+        if (skipFailureLogging(locatorId)) {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2_RETRYING_IN_3_MS,
+              new Object[] { request.getLocator(), locatorId, retryAttempt, WAN_LOCATOR_CONNECTION_INTERVAL }));
+        }
+        try {
+          Thread.sleep(WAN_LOCATOR_CONNECTION_INTERVAL);
+        }
+        catch (InterruptedException e) {
+          Thread.currentThread().interrupt();
+        }
+        retryAttempt++;
+        continue;
+      }
+      catch (ClassNotFoundException classNotFoundException) {
+        logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_ENCOUNTERED_UNEXPECTED_EXCEPTION), classNotFoundException);
+        break;
+      }
+    }
+  }
+  
+  public void exchangeRemoteLocators() {
+    int retryAttempt = 1;
+    DistributionLocatorId remoteLocator = this.locatorId;
+    while (!getDiscoverer().isStopped()) {
+      RemoteLocatorJoinResponse response;
+      try {
+        response = (RemoteLocatorJoinResponse)locatorClient
+            .requestToServer(remoteLocator.getHost(), remoteLocator.getPort(),
+                request, WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
+        if (response != null) {
+          LocatorHelper.addExchangedLocators(response.getLocators(), this.locatorListener);
+          logger.info(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_EXCHANGED_LOCATOR_INFORMATION_0_WITH_1,
+              new Object[] { request.getLocator(), locatorId, response.getLocators() }));
+          RemoteLocatorPingRequest pingRequest = new RemoteLocatorPingRequest(
+              "");
+          while (true) {
+            Thread.sleep(WAN_LOCATOR_PING_INTERVAL);
+            RemoteLocatorPingResponse pingResponse = (RemoteLocatorPingResponse)locatorClient
+                .requestToServer(remoteLocator.getHost(),
+                    remoteLocator.getPort(), pingRequest,
+                    WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
+            if (pingResponse != null) {
+              continue;
+            }
+            break;
+          }
+        }
+      }
+      catch (IOException ioe) {
+        if (retryAttempt == WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT) {
+          logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2,
+              new Object[] { request.getLocator(), remoteLocator, retryAttempt}), ioe);
+          break;
+        }
+        if (skipFailureLogging(remoteLocator)) {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2_RETRYING_IN_3_MS,
+              new Object[] { request.getLocator(), remoteLocator, retryAttempt, WAN_LOCATOR_CONNECTION_INTERVAL }));
+        }
+        try {
+          Thread.sleep(WAN_LOCATOR_CONNECTION_INTERVAL);
+        }
+        catch (InterruptedException e) {
+          Thread.currentThread().interrupt();
+        }
+        retryAttempt++;
+        continue;
+      }
+      catch (ClassNotFoundException classNotFoundException) {
+        logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_ENCOUNTERED_UNEXPECTED_EXCEPTION), classNotFoundException);
+        break;
+      }
+      catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorHelper.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorHelper.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorHelper.java
new file mode 100644
index 0000000..83b6db3
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorHelper.java
@@ -0,0 +1,142 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.cache.client.internal.locator.wan.LocatorMembershipListener;
+import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
+import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+/**
+ * This is a helper class which helps to add the locator information to the allLocatorInfoMap.
+ * 
+ *
+ */
+public class LocatorHelper {
+  
+  public final static Object locatorObject = new Object();
+  /**
+   * 
+   * This methods add the given locator to allLocatorInfoMap.
+   * It also invokes a locatorlistener to inform other locators in allLocatorInfoMap about this newly added locator.
+   * @param distributedSystemId
+   * @param locator
+   * @param locatorListener
+   * @param sourceLocator
+   */
+  public static boolean addLocator(int distributedSystemId,
+      DistributionLocatorId locator, LocatorMembershipListener locatorListener,
+      DistributionLocatorId sourceLocator) {
+      ConcurrentHashMap<Integer, Set<DistributionLocatorId>> allLocatorsInfo = (ConcurrentHashMap<Integer, Set<DistributionLocatorId>>)locatorListener
+          .getAllLocatorsInfo();
+      Set<DistributionLocatorId> locatorsSet = new CopyOnWriteHashSet<DistributionLocatorId>();
+      locatorsSet.add(locator);
+      Set<DistributionLocatorId> existingValue = allLocatorsInfo.putIfAbsent(distributedSystemId, locatorsSet);
+      if(existingValue != null){
+        if (!existingValue.contains(locator)) {
+          existingValue.add(locator);
+          addServerLocator(distributedSystemId, locatorListener, locator);
+          locatorListener.locatorJoined(distributedSystemId, locator,
+              sourceLocator);
+        }
+        else {
+          return false;
+        }
+      }else{
+        addServerLocator(distributedSystemId, locatorListener, locator);
+        locatorListener.locatorJoined(distributedSystemId, locator,
+          sourceLocator);
+      }
+    return true;
+  }
+
+  /**
+   * This methods decides whether the given locator is server locator, if so
+   * then add this locator in allServerLocatorsInfo map.
+   * 
+   * @param distributedSystemId
+   * @param locatorListener
+   * @param locator
+   */
+  private static void addServerLocator(Integer distributedSystemId,
+      LocatorMembershipListener locatorListener, DistributionLocatorId locator) {
+    if (!locator.isServerLocator()) {
+      return;
+    }
+    ConcurrentHashMap<Integer, Set<String>> allServerLocatorsInfo = (ConcurrentHashMap<Integer, Set<String>>)locatorListener
+        .getAllServerLocatorsInfo();
+    
+    Set<String> locatorsSet = new CopyOnWriteHashSet<String>();
+    locatorsSet.add(locator.toString());
+    Set<String> existingValue = allServerLocatorsInfo.putIfAbsent(distributedSystemId, locatorsSet);
+    if(existingValue != null){
+      if (!existingValue.contains(locator.toString())) {
+        existingValue.add(locator.toString());
+      }
+    }
+  }
+
+  /**
+   * This method adds the map of locatorsinfo sent by other locator to this locator's allLocatorInfo
+   * 
+   * @param locators
+   * @param locatorListener
+   */
+  public static boolean addExchangedLocators(Map<Integer, Set<DistributionLocatorId>> locators,
+                                             LocatorMembershipListener locatorListener) {
+
+    ConcurrentHashMap<Integer, Set<DistributionLocatorId>> allLocators = (ConcurrentHashMap<Integer, Set<DistributionLocatorId>>)locatorListener
+        .getAllLocatorsInfo();
+    if (!allLocators.equals(locators)) {
+      for (Map.Entry<Integer, Set<DistributionLocatorId>> entry : locators
+          .entrySet()) {
+        Set<DistributionLocatorId> existingValue = allLocators.putIfAbsent(
+            entry.getKey(), new CopyOnWriteHashSet<DistributionLocatorId>(entry
+                .getValue()));
+
+        if (existingValue != null) {
+          Set<DistributionLocatorId> localLocators = allLocators.get(entry
+              .getKey());
+          if (!localLocators.equals(entry.getValue())) {
+            entry.getValue().removeAll(localLocators);
+            for (DistributionLocatorId locator : entry.getValue()) {
+              localLocators.add(locator);
+              addServerLocator(entry.getKey(), locatorListener, locator);
+              locatorListener.locatorJoined(entry.getKey(), locator, null);
+            }
+          }
+
+        }
+        else {
+          for (DistributionLocatorId locator : entry.getValue()) {
+            addServerLocator(entry.getKey(), locatorListener, locator);
+            locatorListener.locatorJoined(entry.getKey(), locator, null);
+          }
+        }
+      }
+      return true;
+    }
+    return false;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorJoinMessage.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorJoinMessage.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorJoinMessage.java
new file mode 100644
index 0000000..86ae0d6
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorJoinMessage.java
@@ -0,0 +1,105 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.cache.client.internal.locator.ServerLocationRequest;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+
+public class LocatorJoinMessage extends ServerLocationRequest {
+
+  private DistributionLocatorId locator;
+  
+  private int distributedSystemId;
+  
+  private DistributionLocatorId sourceLocator;
+
+  public LocatorJoinMessage() {
+    super();
+  }
+
+  public LocatorJoinMessage(int distributedSystemId, DistributionLocatorId locator,
+      DistributionLocatorId sourceLocator, String serverGroup) {
+    super(serverGroup);
+    this.locator = locator;
+    this.distributedSystemId = distributedSystemId;
+    this.sourceLocator = sourceLocator;
+  }
+
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    super.fromData(in);
+    this.locator = DataSerializer.readObject(in);
+    this.distributedSystemId = in.readInt();
+    this.sourceLocator = DataSerializer.readObject(in);
+  }
+
+  public void toData(DataOutput out) throws IOException {
+    super.toData(out);
+    DataSerializer.writeObject(locator, out);
+    out.writeInt(this.distributedSystemId);
+    DataSerializer.writeObject(sourceLocator, out);
+  }
+
+  public DistributionLocatorId getLocator() {
+    return this.locator;
+  }
+
+  public int getDistributedSystemId() {
+    return distributedSystemId;
+  }
+  
+  public DistributionLocatorId getSourceLocator() {
+    return sourceLocator;
+  }
+  
+  public int getDSFID() {
+    return DataSerializableFixedID.LOCATOR_JOIN_MESSAGE;
+  }
+
+  @Override
+  public String toString() {
+    return "LocatorJoinMessage{distributedSystemId="+ distributedSystemId +" locators=" + locator + " Source Locator : " + sourceLocator +"}";
+  }
+
+  @Override
+  public boolean equals(Object obj){
+    if ( this == obj ) return true;
+    if ( !(obj instanceof LocatorJoinMessage) ) return false;
+    LocatorJoinMessage myObject = (LocatorJoinMessage)obj;
+    if((this.distributedSystemId == myObject.getDistributedSystemId()) && this.locator.equals(myObject.getLocator())){
+      return true;
+    }
+    return false;
+  }
+  
+  @Override
+  public int hashCode() {
+    // it is sufficient for all messages having the same locator to hash to the same bucket
+    if (this.locator == null) {
+      return 0;
+    } else {
+      return this.locator.hashCode();
+    }
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java
new file mode 100644
index 0000000..01e01e7
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java
@@ -0,0 +1,213 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
+import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import org.apache.logging.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * An implementation of
+ * {@link com.gemstone.gemfire.cache.client.internal.locator.wan.LocatorMembershipListener}
+ * 
+ * 
+ */
+public class LocatorMembershipListenerImpl implements LocatorMembershipListener {
+
+  private ConcurrentMap<Integer, Set<DistributionLocatorId>> allLocatorsInfo = new ConcurrentHashMap<Integer, Set<DistributionLocatorId>>();
+  
+  private ConcurrentMap<Integer, Set<String>> allServerLocatorsInfo = new ConcurrentHashMap<Integer, Set<String>>();
+  
+  private static final Logger logger = LogService.getLogger();
+  
+  private DistributionConfig config;
+  
+  private TcpClient tcpClient;
+  
+  private int port;
+  
+  public LocatorMembershipListenerImpl() {
+    this.tcpClient = new TcpClient();
+  }
+  
+  public void setPort(int port){
+    this.port = port;
+  }
+
+  public void setConfig(DistributionConfig config) {
+    this.config = config;
+  }
+  
+  /**
+   * When the new locator is added to remote locator metadata, inform all other
+   * locators in remote locator metadata about the new locator so that they can
+   * update their remote locator metadata.
+   * 
+   * @param locator
+   */
+  
+  public void locatorJoined(final int distributedSystemId,
+      final DistributionLocatorId locator,
+      final DistributionLocatorId sourceLocator) {
+    Thread distributeLocator = new Thread(new Runnable() {
+      public void run() {
+        ConcurrentMap<Integer, Set<DistributionLocatorId>> remoteLocators = getAllLocatorsInfo();
+        ArrayList<DistributionLocatorId> locatorsToRemove = new ArrayList<DistributionLocatorId>();
+        
+        String localLocator = config.getStartLocator();
+        DistributionLocatorId localLocatorId = null;
+        if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) {
+          localLocatorId = new DistributionLocatorId(port, config
+              .getBindAddress());
+        }
+        else {
+          localLocatorId = new DistributionLocatorId(localLocator);
+        }
+        locatorsToRemove.add(localLocatorId);
+        locatorsToRemove.add(locator);
+        locatorsToRemove.add(sourceLocator);
+        
+        Map<Integer, Set<DistributionLocatorId>> localCopy = new HashMap<Integer, Set<DistributionLocatorId>>();
+        for(Map.Entry<Integer, Set<DistributionLocatorId>> entry : remoteLocators.entrySet()){
+          Set<DistributionLocatorId> value = new CopyOnWriteHashSet<DistributionLocatorId>(entry.getValue());
+          localCopy.put(entry.getKey(), value);
+        }  
+        for(Map.Entry<Integer, Set<DistributionLocatorId>> entry : localCopy.entrySet()){
+          for(DistributionLocatorId removeLocId : locatorsToRemove){
+            if(entry.getValue().contains(removeLocId)){
+              entry.getValue().remove(removeLocId);
+            }
+          }
+          for (DistributionLocatorId value : entry.getValue()) {
+            try {
+              tcpClient.requestToServer(value.getHost(), value.getPort(),
+                  new LocatorJoinMessage(distributedSystemId, locator, localLocatorId, ""), 1000, false);
+            }
+            catch (Exception e) {
+              if (logger.isDebugEnabled()) {
+                logger.debug(LocalizedMessage.create(LocalizedStrings.LOCATOR_MEMBERSHIP_LISTENER_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_1_WIHT_2_3, 
+                    new Object[] { locator.getHost(), locator.getPort(), value.getHost(), value.getPort() }));
+              }
+            }
+            try {
+              tcpClient.requestToServer(locator.getHost(), locator.getPort(),
+                  new LocatorJoinMessage(entry.getKey(), value, localLocatorId, ""), 1000, false);
+            }
+            catch (Exception e) {
+              if (logger.isDebugEnabled()) {
+                logger.debug(LocalizedMessage.create(LocalizedStrings.LOCATOR_MEMBERSHIP_LISTENER_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_1_WIHT_2_3,
+                    new Object[] { value.getHost(), value.getPort(), locator.getHost(), locator.getPort() }));
+              }
+            }
+          }
+        }
+      }
+    });
+    distributeLocator.setDaemon(true);
+    distributeLocator.start();
+  }
+
+  public Object handleRequest(Object request) {
+    Object response = null;
+    if (request instanceof RemoteLocatorJoinRequest) {
+      response = updateAllLocatorInfo((RemoteLocatorJoinRequest)request);
+    }
+    else if (request instanceof LocatorJoinMessage) {
+      response = informAboutRemoteLocators((LocatorJoinMessage)request);
+    }
+    else if (request instanceof RemoteLocatorPingRequest) {
+      response = getPingResponse((RemoteLocatorPingRequest)request);
+    }
+    else if (request instanceof RemoteLocatorRequest) {
+      response = getRemoteLocators((RemoteLocatorRequest)request);
+    }
+    return response;
+  }
+  
+  /**
+   * A locator from the request is checked against the existing remote locator
+   * metadata. If it is not available then added to existing remote locator
+   * metadata and LocatorMembershipListener is invoked to inform about the
+   * this newly added locator to all other locators available in remote locator
+   * metadata. As a response, remote locator metadata is sent.
+   * 
+   * @param request
+   */
+  private synchronized Object updateAllLocatorInfo(RemoteLocatorJoinRequest request) {
+    int distributedSystemId = request.getDistributedSystemId();
+    DistributionLocatorId locator = request.getLocator();
+
+    LocatorHelper.addLocator(distributedSystemId, locator, this, null);
+    return new RemoteLocatorJoinResponse(this.getAllLocatorsInfo());
+  }
+  
+  private Object getPingResponse(RemoteLocatorPingRequest request) {
+   return new RemoteLocatorPingResponse();
+  }
+  
+  private Object informAboutRemoteLocators(LocatorJoinMessage request){
+    // TODO: FInd out the importance of list locatorJoinMessages. During
+    // refactoring I could not understand its significance
+//    synchronized (locatorJoinObject) {
+//      if (locatorJoinMessages.contains(request)) {
+//        return null;
+//      }
+//      locatorJoinMessages.add(request);  
+//    }
+    int distributedSystemId = request.getDistributedSystemId();
+    DistributionLocatorId locator = request.getLocator();
+    DistributionLocatorId sourceLocatorId = request.getSourceLocator();
+
+    LocatorHelper.addLocator(distributedSystemId, locator, this, sourceLocatorId);
+    return null;
+  }
+  
+  private Object getRemoteLocators(RemoteLocatorRequest request) {
+    int dsId = request.getDsId();
+    Set<String> locators = this.getRemoteLocatorInfo(dsId);
+    return new RemoteLocatorResponse(locators);
+  }
+  
+  public Set<String> getRemoteLocatorInfo(int dsId) {
+    return this.allServerLocatorsInfo.get(dsId);
+  }
+
+  public ConcurrentMap<Integer,Set<DistributionLocatorId>> getAllLocatorsInfo() {
+    return this.allLocatorsInfo;
+  }
+  
+  public ConcurrentMap<Integer,Set<String>> getAllServerLocatorsInfo() {
+    return this.allServerLocatorsInfo;
+  }
+  
+  public void clearLocatorInfo(){
+    allLocatorsInfo.clear();
+    allServerLocatorsInfo.clear();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java
new file mode 100644
index 0000000..c058333
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.cache.client.internal.locator.ServerLocationRequest;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+
+/**
+ * Requests remote locators of a remote WAN site
+ * 
+ * 
+ * @since GemFire 6.6
+ * 
+ */
+public class RemoteLocatorJoinRequest implements DataSerializableFixedID {
+
+  private DistributionLocatorId locator = null;
+ 
+  private int distributedSystemId = -1;
+
+  public RemoteLocatorJoinRequest() {
+    super();
+  }
+
+  public RemoteLocatorJoinRequest(int distributedSystemId, DistributionLocatorId locator,
+      String serverGroup) {
+    this.distributedSystemId = distributedSystemId;
+    this.locator = locator;
+  }
+
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.locator = DataSerializer.readObject(in);
+    this.distributedSystemId = in.readInt();
+  }
+
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeObject(locator, out);
+    out.writeInt(this.distributedSystemId);
+  }
+
+  public DistributionLocatorId getLocator() {
+    return this.locator;
+  }
+  
+  public int getDistributedSystemId() {
+    return distributedSystemId;
+  }
+  
+  public int getDSFID() {
+    return DataSerializableFixedID.REMOTE_LOCATOR_JOIN_REQUEST;
+  }
+
+  @Override
+  public String toString() {
+    return "RemoteLocatorJoinRequest{locator=" + locator + "}";
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java
new file mode 100644
index 0000000..42c3bb0
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java
@@ -0,0 +1,86 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+
+/**
+ * List of remote locators as a response
+ * 
+ * 
+ * 
+ */
+public class RemoteLocatorJoinResponse implements DataSerializableFixedID{
+
+  private HashMap<Integer, Set<DistributionLocatorId>> locators = new HashMap<Integer, Set<DistributionLocatorId>>();
+  
+  /** Used by DataSerializer */
+  public RemoteLocatorJoinResponse() {
+    super();
+  }
+
+  public RemoteLocatorJoinResponse(
+      Map<Integer, Set<DistributionLocatorId>> locators) {
+    super();
+    this.locators = new HashMap<Integer, Set<DistributionLocatorId>>();
+    for (Map.Entry<Integer, Set<DistributionLocatorId>> entry : locators
+        .entrySet()) {
+      this.locators.put(entry.getKey(), new CopyOnWriteHashSet<DistributionLocatorId>(
+          entry.getValue()));
+    }
+  }
+  
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.locators = DataSerializer.readHashMap(in);
+    
+  }
+
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeHashMap(locators, out);
+  }
+
+  public Map<Integer, Set<DistributionLocatorId>> getLocators() {
+    return this.locators;
+  }
+
+  @Override
+  public String toString() {
+    return "RemoteLocatorJoinResponse{locators=" + locators + "}";
+  }
+
+  public int getDSFID() {
+    return DataSerializableFixedID.REMOTE_LOCATOR_JOIN_RESPONSE;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java
new file mode 100644
index 0000000..a1cb951
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * 
+ *
+ */
+
+public class RemoteLocatorPingRequest implements DataSerializableFixedID{
+
+  public RemoteLocatorPingRequest() {
+    super();
+  }
+
+  public RemoteLocatorPingRequest(String serverGroup) {
+  }
+
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+  }
+
+  public void toData(DataOutput out) throws IOException {
+  }
+
+  public int getDSFID() {
+    return DataSerializableFixedID.REMOTE_LOCATOR_PING_REQUEST;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java
new file mode 100644
index 0000000..54fdc04
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java
@@ -0,0 +1,54 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * 
+ */
+public class RemoteLocatorPingResponse implements DataSerializableFixedID {
+
+
+  /** Used by DataSerializer */
+  public RemoteLocatorPingResponse() {
+    super();
+  }
+
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+  }
+
+  public void toData(DataOutput out) throws IOException {
+  }
+
+
+
+  public int getDSFID() {
+    return DataSerializableFixedID.REMOTE_LOCATOR_PING_RESPONSE;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorRequest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorRequest.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorRequest.java
new file mode 100644
index 0000000..d23ca93
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorRequest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+/**
+ * 
+ *
+ */
+public class RemoteLocatorRequest implements DataSerializableFixedID{
+  private int distributedSystemId ;
+
+  public RemoteLocatorRequest() {
+    super();
+  }
+  public RemoteLocatorRequest(int dsId, String serverGroup) {
+    this.distributedSystemId = dsId;
+  }
+  
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.distributedSystemId = in.readInt();
+  }
+
+  public void toData(DataOutput out) throws IOException {
+    out.writeInt(this.distributedSystemId);
+  }
+
+  public int getDsId() {
+    return this.distributedSystemId;
+  }
+  
+  public int getDSFID() {
+    return DataSerializableFixedID.REMOTE_LOCATOR_REQUEST;
+  }
+
+  @Override
+  public String toString() {
+    return "RemoteLocatorRequest{dsName=" + distributedSystemId + "}";
+  }
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorResponse.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorResponse.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorResponse.java
new file mode 100644
index 0000000..a7ff6fd
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/RemoteLocatorResponse.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Set;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * 
+ *
+ */
+public class RemoteLocatorResponse implements DataSerializableFixedID{
+
+  private Set<String> locators ;
+
+  /** Used by DataSerializer */
+  public RemoteLocatorResponse() {
+    super();
+  }
+  
+  public RemoteLocatorResponse(Set<String> locators) {
+    this.locators = locators;
+  }
+  
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.locators = DataSerializer.readObject(in);
+  }
+
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeObject(this.locators, out);
+  }
+
+  public Set<String> getLocators() {
+    return this.locators;
+  }
+  
+  @Override
+  public String toString() {
+    return "RemoteLocatorResponse{locators=" + locators +"}";
+  }
+
+  public int getDSFID() {
+    return DataSerializableFixedID.REMOTE_LOCATOR_RESPONSE;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+     return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
new file mode 100644
index 0000000..2844594
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
@@ -0,0 +1,74 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
+import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
+import com.gemstone.gemfire.internal.DSFIDFactory;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.cache.wan.GatewayReceiverFactoryImpl;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderFactoryImpl;
+import com.gemstone.gemfire.internal.cache.wan.spi.WANFactory;
+
+public class WANFactoryImpl implements WANFactory {
+  
+  @Override
+  public void initialize() {
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.REMOTE_LOCATOR_JOIN_REQUEST,
+        RemoteLocatorJoinRequest.class);
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.REMOTE_LOCATOR_JOIN_RESPONSE,
+        RemoteLocatorJoinResponse.class);
+    DSFIDFactory.registerDSFID(DataSerializableFixedID.REMOTE_LOCATOR_REQUEST,
+        RemoteLocatorRequest.class);
+    DSFIDFactory.registerDSFID(DataSerializableFixedID.LOCATOR_JOIN_MESSAGE,
+        LocatorJoinMessage.class);
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.REMOTE_LOCATOR_PING_REQUEST,
+        RemoteLocatorPingRequest.class);
+    DSFIDFactory.registerDSFID(
+        DataSerializableFixedID.REMOTE_LOCATOR_PING_RESPONSE,
+        RemoteLocatorPingResponse.class);
+    DSFIDFactory.registerDSFID(DataSerializableFixedID.REMOTE_LOCATOR_RESPONSE,
+        RemoteLocatorResponse.class);
+  }
+
+  @Override
+  public GatewaySenderFactory createGatewaySenderFactory(Cache cache) {
+    return new GatewaySenderFactoryImpl(cache);
+  }
+
+  @Override
+  public GatewayReceiverFactory createGatewayReceiverFactory(Cache cache) {
+    return new GatewayReceiverFactoryImpl(cache);
+  }
+
+  @Override
+  public WanLocatorDiscoverer createLocatorDiscoverer() {
+    return new WanLocatorDiscovererImpl();
+  }
+
+  @Override
+  public LocatorMembershipListener createLocatorMembershipListener() {
+    return new LocatorMembershipListenerImpl();
+  }
+  
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java
new file mode 100644
index 0000000..1d44e65
--- /dev/null
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java
@@ -0,0 +1,154 @@
+/*
+ * 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.client.internal.locator.wan;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
+import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
+import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
+import org.apache.logging.log4j.Logger;
+
+import java.util.StringTokenizer;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+public class WanLocatorDiscovererImpl implements WanLocatorDiscoverer{
+
+  private static final Logger logger = LogService.getLogger();
+
+  private volatile boolean stopped = false;
+  
+  private ExecutorService _executor;
+  
+  public WanLocatorDiscovererImpl() {
+    
+  }
+  
+  @Override
+  public void discover(int port,
+                       DistributionConfigImpl config,
+                       LocatorMembershipListener locatorListener,
+                       final String hostnameForClients) {
+    final LoggingThreadGroup loggingThreadGroup = LoggingThreadGroup
+        .createThreadGroup("WAN Locator Discovery Logger Group", logger);
+
+    final ThreadFactory threadFactory = new ThreadFactory() {
+      public Thread newThread(final Runnable task) {
+        final Thread thread = new Thread(loggingThreadGroup, task,
+            "WAN Locator Discovery Thread");
+        thread.setDaemon(true);
+        return thread;
+      }
+    };
+
+    this._executor = Executors.newCachedThreadPool(threadFactory);
+    exchangeLocalLocators(port, config, locatorListener, hostnameForClients);
+    exchangeRemoteLocators(port, config, locatorListener, hostnameForClients);
+    this._executor.shutdown();
+  }
+
+  @Override
+  public void stop() {
+    this.stopped = true;
+  }
+
+  @Override
+  public boolean isStopped() {
+    return this.stopped;
+  }
+
+  /**
+   * For WAN 70 Exchange the locator information within the distributed system
+   *
+   * @param config
+   * @param hostnameForClients
+   */
+  private void exchangeLocalLocators(int port,
+                                     DistributionConfigImpl config,
+                                     LocatorMembershipListener locatorListener,
+                                     final String hostnameForClients) {
+    String localLocator = config.getStartLocator();
+    DistributionLocatorId locatorId = null;
+    if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) {
+      locatorId = new DistributionLocatorId(port, config.getBindAddress(), hostnameForClients);
+    }
+    else {
+      locatorId = new DistributionLocatorId(localLocator);
+    }
+    LocatorHelper.addLocator(config.getDistributedSystemId(), locatorId, locatorListener, null);
+
+    RemoteLocatorJoinRequest request = buildRemoteDSJoinRequest(port, config, hostnameForClients);
+    StringTokenizer locatorsOnThisVM = new StringTokenizer(
+        config.getLocators(), ",");
+    while (locatorsOnThisVM.hasMoreTokens()) {
+      DistributionLocatorId localLocatorId = new DistributionLocatorId(
+          locatorsOnThisVM.nextToken());
+      if (!locatorId.equals(localLocatorId)) {
+        LocatorDiscovery localDiscovery = new LocatorDiscovery(this, localLocatorId, request, locatorListener);
+        LocatorDiscovery.LocalLocatorDiscovery localLocatorDiscovery = localDiscovery.new LocalLocatorDiscovery();
+        this._executor.execute(localLocatorDiscovery);
+      }
+    }
+  }
+  
+  /**
+   * For WAN 70 Exchange the locator information across the distributed systems
+   * (sites)
+   *
+   * @param config
+   * @param hostnameForClients
+   */
+  private void exchangeRemoteLocators(int port,
+                                      DistributionConfigImpl config,
+                                      LocatorMembershipListener locatorListener,
+                                      final String hostnameForClients) {
+    RemoteLocatorJoinRequest request = buildRemoteDSJoinRequest(port, config, hostnameForClients);
+    String remoteDistributedSystems = config.getRemoteLocators();
+    if (remoteDistributedSystems.length() > 0) {
+      StringTokenizer remoteLocators = new StringTokenizer(
+          remoteDistributedSystems, ",");
+      while (remoteLocators.hasMoreTokens()) {
+        DistributionLocatorId remoteLocatorId = new DistributionLocatorId(
+            remoteLocators.nextToken());
+        LocatorDiscovery localDiscovery = new LocatorDiscovery(this, remoteLocatorId,
+            request, locatorListener);
+        LocatorDiscovery.RemoteLocatorDiscovery remoteLocatorDiscovery = localDiscovery.new RemoteLocatorDiscovery();
+        this._executor.execute(remoteLocatorDiscovery);
+      }
+    }
+  }
+  
+  private RemoteLocatorJoinRequest buildRemoteDSJoinRequest(int port,
+                                                            DistributionConfigImpl config,
+                                                            final String hostnameForClients) {
+    String localLocator = config.getStartLocator();
+    DistributionLocatorId locatorId = null;
+    if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) {
+      locatorId = new DistributionLocatorId(port, config.getBindAddress(), hostnameForClients);
+    }
+    else {
+      locatorId = new DistributionLocatorId(localLocator);
+    }
+    RemoteLocatorJoinRequest request = new RemoteLocatorJoinRequest(
+        config.getDistributedSystemId(), locatorId, "");
+    return request;
+  }
+  
+}


[06/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java
new file mode 100644
index 0000000..0cb60be
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java
@@ -0,0 +1,1336 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.EntryExistsException;
+import com.gemstone.gemfire.cache.client.ServerOperationException;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.cache.wan.BatchException70;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class SerialWANPropagationDUnitTest extends WANTestBase {
+
+  @Override
+  public final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection refused");
+    IgnoredException.addIgnoredException("could not get remote locator information");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+  }
+
+  /**
+   * this test is disabled due to a high rate of failure in unit test runs
+   * see ticket #52190
+   */
+  @Ignore("TODO: test is disabled because of #52190")
+  @Test
+  public void testReplicatedSerialPropagation_withoutRemoteLocator() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //keep the batch size high enough to reduce the number of exceptions in the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 400, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+
+  protected SerializableRunnableIF createReplicatedRegionRunnable() {
+    return () -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()   );
+  }
+
+  @Test
+  public void testReplicatedSerialPropagation_withoutRemoteSite() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //keep the batch size high enough to reduce the number of exceptions in the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 400, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+    
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  /**
+   * Added to reproduce the bug #46595
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithoutRemoteSite_defect46595()
+      throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    // reduce the batch-size so maximum number of batches will be sent
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 5, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 5, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    IgnoredException.addIgnoredException(IOException.class.getName());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10000 ));
+
+    // pause for some time before starting up the remote site
+    Wait.pause(10000);
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap()  ));
+  
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationWithLocalSiteClosedAndRebuilt() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+    
+    //---------close local site and build again-----------------------------------------
+    vm4.invoke(() -> WANTestBase.killSender( ));
+    vm5.invoke(() -> WANTestBase.killSender( ));
+    vm6.invoke(() -> WANTestBase.killSender( ));
+    vm7.invoke(() -> WANTestBase.killSender( ));
+    
+    Integer regionSize = 
+      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_RR" ));
+    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+      false, 100, 10, false, false, null, true ));
+    
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
+    
+    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      1000 ));
+    //----------------------------------------------------------------------------------
+
+    //verify remote site receives all the events
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+
+  /**
+   * Two regions configured with the same sender and put is in progress 
+   * on both the regions.
+   * One of the two regions is destroyed in the middle.
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithLocalRegionDestroy() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 20, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 20, false, false, null, true ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    //create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    //create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+    //do puts in RR_2 in main thread
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 500 ));
+    //destroy RR_2 after above puts are complete
+    vm4.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
+    
+    inv1.join();
+
+    //vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_2", 500 ));
+  }
+
+  /**
+   * 1 region and sender configured on local site and 1 region and a 
+   * receiver configured on remote site. Puts to the local region are in progress.
+   * Remote region is destroyed in the middle.
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 500, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 500, false, false, null, true ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+    //destroy RR_1 in remote site
+    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_1"));
+
+    inv1.join();
+
+    //verify that all is well in local site. All the events should be present in local region
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 1000 ));
+    //assuming some events might have been dispatched before the remote region was destroyed,
+    //sender's region queue will have events less than 1000 but the queue will not be empty.
+    //NOTE: this much verification might be sufficient in DUnit. Hydra will take care of 
+    //more in depth validations.
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty("ln" ));
+  }
+  
+  /**
+   * Two regions configured in local with the same sender and put is in progress 
+   * on both the regions. Same two regions are configured on remote site as well.
+   * One of the two regions is destroyed in the middle on remote site.
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy2() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 200, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 200, false, false, null, true ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    //create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
+    
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    //create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    //destroy RR_2 on remote site in the middle
+    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
+    
+    //expected exceptions in the logs
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    //start puts in RR_2 in another thread
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
+    
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+
+    inv1.join();
+
+    //though region RR_2 is destroyed, RR_1 should still get all the events put in it 
+    //in local site
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 1000 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteRegionDestroy3()
+      throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    // these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    // senders are created on local site
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 200, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 200, false, false, null, true ));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    // create another RR (RR_2) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
+    
+    // start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    // create another RR (RR_2) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
+
+    IgnoredException.addIgnoredException(BatchException70.class.getName());
+    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
+    
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+    // start puts in RR_2 in another thread
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
+    // destroy RR_2 on remote site in the middle
+    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName()
+        + "_RR_2" ));
+
+    inv1.join();
+    inv2.join();
+
+    // though region RR_2 is destroyed, RR_1 should still get all the events put
+    // in it
+    // in local site
+    try {
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR_1", 1000 ));
+    } finally {
+      System.setProperty(
+          DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
+      vm4.invoke(new CacheSerializableRunnable("UnSetting system property ") {
+        public void run2() throws CacheException {
+          System.setProperty(
+              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
+        }
+      });
+
+      vm5.invoke(new CacheSerializableRunnable("UnSetting system property ") {
+        public void run2() throws CacheException {
+          System.setProperty(
+              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
+        }
+      });
+    }
+  }
+  
+  /**
+   * one region and sender configured on local site and the same region and a 
+   * receiver configured on remote site. Puts to the local region are in progress.
+   * Receiver on remote site is stopped in the middle by closing remote site cache.
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteReceiverStopped() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    //these are part of remote site
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    //these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    //senders are created on local site. Batch size is kept to a high (170) so 
+    //there will be less number of exceptions (occur during dispatchBatch) in the log 
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 350, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 350, false, false, null, true ));
+
+    //create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    //start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    //create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    //start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 500 ));
+    //close cache in remote site. This will automatically kill the remote receivers.
+    vm2.invoke(() -> WANTestBase.closeCache());
+
+    inv1.join();
+
+    //verify that all is well in local site
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 500 ));
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty("ln" ));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteReceiverRestarted()
+      throws Exception {
+    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    // these are part of remote site
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    // senders are created on local site. Batch size is kept to a high (170) so
+    // there will be less number of exceptions (occur during dispatchBatch) in
+    // the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 350, false, false, null, true ));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    // start the senders on local site
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
+    // close cache in remote site. This will automatically kill the remote
+    // receivers.
+    Wait.pause(2000);
+    vm2.invoke(() -> WANTestBase.closeCache());
+
+    inv1.join();
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+
+    // verify that all is well in local site
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 8000 ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+
+    vm2.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteReceiverRestarted_SenderReceiverPersistent()
+      throws Exception {
+    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    // these are part of remote site
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    // senders are created on local site. Batch size is kept to a high (170) so
+    // there will be less number of exceptions (occur during dispatchBatch) in
+    // the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 350, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 350, false, true, null, true));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
+    vm2.invoke(() -> WANTestBase.addListenerToSleepAfterCreateEvent(2000, getTestMethodName() + "_RR_1"));
+    // start the senders on local site
+    startSenderInVMs("ln", vm4, vm5);
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
+
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
+    // close cache in remote site. This will automatically kill the remote
+    // receivers.
+    vm2.invoke(() -> WANTestBase.closeCache());
+
+    inv1.join();
+
+    // verify that all is well in local site
+    vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
+
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents("ln", 0));
+
+    vm2.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats(1, 1));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteSiteBouncedBack_ReceiverPersistent()
+      throws Exception {
+    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    // these are part of remote site
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    // senders are created on local site. Batch size is kept to a high (170) so
+    // there will be less number of exceptions (occur during dispatchBatch) in
+    // the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 350, false, false, null, true ));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    // start the senders on local site
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
+    // close cache in remote site. This will automatically kill the remote
+    // receivers.
+    Wait.pause(2000);
+    vm1.invoke(() -> WANTestBase.shutdownLocator());
+    vm2.invoke(() -> WANTestBase.closeCache());
+
+    inv1.join();
+
+    // Do some extra puts after cache close so that some events are in the queue.
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+
+    // verify that all is well in local site
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 8000 ));
+
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
+
+    vm1.invoke(() -> WANTestBase.bringBackLocatorOnOldPort(
+        2, lnPort, nyPort ));
+
+    createCacheInVMs(nyPort, vm2);
+
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
+      getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR_1", 8000 ));
+    
+    vm2.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteSiteBouncedBackWithMultipleRemoteLocators()
+      throws Exception {
+    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort1 = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer nyPort2 = (Integer) vm3.invoke(() -> WANTestBase.createSecondRemoteLocator( 2, nyPort1, lnPort ));
+
+    // these are part of remote site
+    createCacheInVMs(nyPort1, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    // senders are created on local site. Batch size is kept to a high (170) so
+    // there will be less number of exceptions (occur during dispatchBatch) in
+    // the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 350, false, false, null, true ));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+
+    // start the senders on local site
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
+
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
+    // close cache in remote site. This will automatically kill the remote
+    // receivers.
+    Wait.pause(2000);
+    vm1.invoke(() -> WANTestBase.shutdownLocator());
+    vm2.invoke(() -> WANTestBase.closeCache());
+
+    inv1.join();
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
+    // verify that all is well in local site
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR_1", 8000 ));
+
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
+
+    createCacheInVMs(nyPort2, vm6);
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR_1", null, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
+        0 ));
+
+    vm6.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteReceiverRestartedOnOtherNode() throws Exception {
+    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    // these are part of remote site
+    createCacheInVMs(nyPort, vm2, vm3);
+
+    // these are part of local site
+    createCacheInVMs(lnPort, vm4);
+
+    // senders are created on local site. Batch size is kept to a high (170) so
+    // there will be less number of exceptions (occur during dispatchBatch) in
+    // the log
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 350, false, false, null, true ));
+
+    // create one RR (RR_1) on remote site
+    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
+
+    vm2.invoke(() -> addListenerToSleepAfterCreateEvent(2000, getTestMethodName() + "_RR_1"));
+    vm3.invoke(() -> addListenerToSleepAfterCreateEvent(2000, getTestMethodName() + "_RR_1"));
+
+    // create one RR (RR_1) on local site
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
+    // start the senders on local site
+    vm4.invoke(() -> WANTestBase.startSender("ln"));
+
+    // start puts in RR_1 in another thread
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
+    // close cache in remote site. This will automatically kill the remote
+    // receivers.
+    vm2.invoke(() -> WANTestBase.closeCache());
+    vm3.invoke(() -> WANTestBase.closeCache());
+
+    inv1.join();
+
+    // verify that all is well in local site
+    vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
+
+    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
+
+    createCacheInVMs(nyPort, vm3);
+    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.validateQueueContents("ln", 0));
+
+    vm3.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationToTwoWanSites() throws Exception {
+    Integer lnPort = createFirstLocatorWithDSId(1);
+    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    createCacheInVMs(tkPort, vm3);
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
+        2, false, 100, 10, false, false, null, true ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
+        3, false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("lnSerial1", vm4, vm5);
+    startSenderInVMs("lnSerial2", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationHA() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+
+    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
+    Wait.pause(2000);
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    
+    inv1.join();
+    inv2.join();
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+  }
+  
+  /**
+   * Local site:: vm4: Primary vm5: Secondary
+   * 
+   * Remote site:: vm2, vm3, vm6, vm7: All hosting receivers
+   * 
+   * vm4 is killed, so vm5 takes primary charge
+   *
+   * SUR: disabling due to connection information not available in open source
+   * enable this once in closed source
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void testReplicatedSerialPropagationHA_ReceiverAffinity()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3, vm6, vm7);
+    createReceiverInVMs(vm2, vm3, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Started receivers on remote site");
+
+    WANTestBase.createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    LogWriterUtils.getLogWriter().info("Started senders on local site");
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+
+    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
+    LogWriterUtils.getLogWriter().info("Started async puts on local site");
+    Wait.pause(1000);
+
+    Map oldConnectionInfo = (Map)vm4.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
+    assertNotNull(oldConnectionInfo);
+    String oldServerHost = (String)oldConnectionInfo.get("serverHost");
+    int oldServerPort = (Integer)oldConnectionInfo.get("serverPort");
+    LogWriterUtils.getLogWriter().info("Got sender to receiver connection information");
+
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    inv2.join();
+    LogWriterUtils.getLogWriter().info("Killed primary sender on local site");
+    Wait.pause(5000);// give some time for vm5 to take primary charge
+
+    Map newConnectionInfo = (Map)vm5.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
+    assertNotNull(newConnectionInfo);
+    String newServerHost = (String)newConnectionInfo.get("serverHost");
+    int newServerPort = (Integer)newConnectionInfo.get("serverPort");
+    LogWriterUtils.getLogWriter().info("Got new sender to receiver connection information");
+    assertEquals(oldServerHost, newServerHost);
+    assertEquals(oldServerPort, newServerPort);
+
+    LogWriterUtils.getLogWriter()
+        .info(
+            "Matched the new connection info with old connection info. Receiver affinity verified.");
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+  }
+
+  /**
+   * Local site:: vm4: Primary vm5: Secondary
+   * 
+   * Remote site:: vm2, vm3, vm6, vm7: All hosting receivers
+   * 
+   * vm4 is killed, so vm5 takes primary charge. vm4 brought up. vm5 is killed,
+   * so vm4 takes primary charge again.
+   *
+   * SUR: commenting due to connection information not available in open source
+   * enable this once in closed source
+   */
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void testReplicatedSerialPropagationHA_ReceiverAffinityScenario2()
+      throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3, vm6, vm7);
+    createReceiverInVMs(vm2, vm3, vm6, vm7);
+
+    LogWriterUtils.getLogWriter().info("Started receivers on remote site");
+
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    LogWriterUtils.getLogWriter().info("Started senders on local site");
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+
+    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
+    LogWriterUtils.getLogWriter().info("Started async puts on local site");
+    Wait.pause(1000);
+
+    Map oldConnectionInfo = (Map)vm4.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
+    assertNotNull(oldConnectionInfo);
+    String oldServerHost = (String)oldConnectionInfo.get("serverHost");
+    int oldServerPort = (Integer)oldConnectionInfo.get("serverPort");
+    LogWriterUtils.getLogWriter().info("Got sender to receiver connection information");
+
+    // ---------------------------- KILL vm4
+    // --------------------------------------
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    inv2.join();
+    LogWriterUtils.getLogWriter().info("Killed vm4 (primary sender) on local site");
+    // -----------------------------------------------------------------------------
+
+    vm5.invoke(() -> WANTestBase.waitForSenderToBecomePrimary( "ln" ));
+    LogWriterUtils.getLogWriter().info("vm5 sender has now acquired primary status");
+    Wait.pause(5000);// give time to process unprocessedEventsMap
+
+    // ---------------------------REBUILD vm4
+    // --------------------------------------
+    LogWriterUtils.getLogWriter().info("Rebuilding vm4....");
+    createCacheInVMs(lnPort, vm4);
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm4.invoke(createReplicatedRegionRunnable());
+    LogWriterUtils.getLogWriter().info("Rebuilt vm4");
+    // -----------------------------------------------------------------------------
+
+    // --------------------------- KILL vm5
+    // ----------------------------------------
+    inv1.join();// once the puts are done, kill vm5
+    LogWriterUtils.getLogWriter().info("puts in vm5 are done");
+
+    inv2 = vm5.invokeAsync(() -> WANTestBase.killSender());
+    inv2.join();
+    vm4.invoke(() -> WANTestBase.waitForSenderToBecomePrimary( "ln" ));
+    // -----------------------------------------------------------------------------
+
+    Map newConnectionInfo = (Map)vm4.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
+    assertNotNull(newConnectionInfo);
+    String newServerHost = (String)newConnectionInfo.get("serverHost");
+    int newServerPort = (Integer)newConnectionInfo.get("serverPort");
+    LogWriterUtils.getLogWriter().info("Got new sender to receiver connection information");
+    assertEquals(oldServerHost, newServerHost);
+    assertEquals(oldServerPort, newServerPort);
+    LogWriterUtils.getLogWriter()
+        .info(
+            "Matched the new connection info with old connection info. Receiver affinity verified.");
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10000 ));
+  }
+
+  @Test
+  public void testNormalRegionSerialPropagation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap()  ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.createNormalRegion(
+        getTestMethodName() + "_RR", "ln" ));
+    vm5.invoke(() -> WANTestBase.createNormalRegion(
+        getTestMethodName() + "_RR", "ln" ));
+
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
+        0, 0, 0));
+
+    vm5.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
+        1000, 0, 0 ));
+    
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 1000));
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 0));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 0 ));
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 0, 0));
+  }
+  
+  /**
+   * Added for defect #48582 NPE when WAN sender configured but not started.
+   * All to all topology with 2 WAN sites:
+   * Site 1 (LN site): vm4, vm5, vm6, vm7
+   * Site 2 (NY site): vm2, vm3
+   */
+  @Test
+  public void testReplicatedSerialPropagationWithRemoteSenderConfiguredButNotStarted() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+    createReceiverInVMs(vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(createReplicatedRegionRunnable());
+    vm5.invoke(createReplicatedRegionRunnable());
+    vm6.invoke(createReplicatedRegionRunnable());
+    vm7.invoke(createReplicatedRegionRunnable());
+    
+    vm2.invoke(() -> WANTestBase.createSender( "ny", 1,
+        false, 100, 10, false, false, null, true ));
+    vm3.invoke(() -> WANTestBase.createSender( "ny", 1,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny", isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny", isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    startSenderInVMs("ny", vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java
new file mode 100644
index 0000000..6859249
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java
@@ -0,0 +1,513 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class SerialWANPropagationLoopBackDUnitTest extends WANTestBase {
+  
+  private static final long serialVersionUID = 1L;
+  
+  public SerialWANPropagationLoopBackDUnitTest() {
+    super();
+  }
+  
+  @Test
+  public void testReplicatedSerialPropagationLoopBack() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+    vm3.invoke(() -> WANTestBase.createReceiver());
+
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm7.invoke(() -> WANTestBase.createCache( nyPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ny", 1,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.startSender( "ny" ));
+    
+    vm4.invoke(() -> WANTestBase.addQueueListener( "ln",
+        false ));
+    vm6.invoke(() -> WANTestBase.addQueueListener( "ny",
+        false ));
+    
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap()));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny", isOffHeap()));
+
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 1; i++) {
+      keyValues.put(i, i);
+    }
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    keyValues.clear();
+    for(int i=1; i< 2; i++) {
+      keyValues.put(i, i);
+    }
+    vm6.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 2 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 2 ));
+    
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 2 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 2 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 2 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 2 ));
+  
+  
+    Wait.pause(5000);
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
+    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ny", 0 ));
+    
+    Map queueMap1 = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap2 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue());
+
+    List createList1 = (List)queueMap1.get("Create");
+    List updateList1 = (List)queueMap1.get("Update");
+    List createList2 = (List)queueMap2.get("Create");
+    List updateList2 = (List)queueMap2.get("Update");
+    
+    assertEquals(0, updateList1.size());
+    assertEquals(0, updateList2.size());
+    
+    assertEquals(1, createList1.size());
+    assertEquals(1, createList2.size());
+  }
+
+  @Test
+  public void testReplicatedSerialPropagationLoopBack3SitesLoop() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(lnPort, vm3, vm6);
+    createCacheInVMs(nyPort, vm4, vm7);
+    createCacheInVMs(tkPort, vm5);
+
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap()));
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ny", isOffHeap()));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "tk", isOffHeap()));
+
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ny", isOffHeap() ));
+
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    vm5.invoke(() -> WANTestBase.createReceiver());
+
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny", 3,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "tk", 1,
+      false, 100, 10, false, false, null, true ));
+
+    vm6.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.startSender( "ny" ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk" ));
+
+    // using vm5 for sender in ds 3. cache is already created.
+    vm6.invoke(() -> WANTestBase.addQueueListener( "ln",
+      false ));
+    vm7.invoke(() -> WANTestBase.addQueueListener( "ny",
+      false ));
+    vm5.invoke(() -> WANTestBase.addQueueListener( "tk",
+      false ));
+
+    int totalSize = 3;
+    int increment = 1;
+
+    final Map keyValues = new HashMap();
+    for(int i=0; i< increment; i++) {
+      keyValues.put(i, i);
+    }
+    vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    keyValues.clear();
+    for(int i = increment; i< 2*increment; i++) {
+      keyValues.put(i, i);
+    }
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    keyValues.clear();
+    for(int i=2*increment; i< totalSize; i++) {
+      keyValues.put(i, i);
+    }
+    vm5.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+        
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", totalSize ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", totalSize ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", totalSize ));
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", totalSize ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", totalSize ));
+    
+    
+    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
+    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 0 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 0 ));
+    
+    
+    
+    Map queueMap1 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap2 = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap3 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    
+    List createList1 = (List)queueMap1.get("Create");
+    List updateList1 = (List)queueMap1.get("Update");
+    List createList2 = (List)queueMap2.get("Create");
+    List updateList2 = (List)queueMap2.get("Update");
+    List createList3 = (List)queueMap3.get("Create");
+    List updateList3 = (List)queueMap3.get("Update");
+    
+    assertEquals(0, updateList1.size());
+    assertEquals(0, updateList2.size());
+    assertEquals(0, updateList3.size());
+    
+    assertEquals(2, createList1.size());
+    assertEquals(2, createList2.size());
+    assertEquals(2, createList3.size());
+  }
+  
+  
+  @Test
+  public void testReplicatedSerialPropagationLoopBack3SitesNtoNPutInAllDS() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(lnPort, vm3, vm6);
+    createCacheInVMs(nyPort, vm4, vm7);
+    createCacheInVMs(tkPort, vm5);
+
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    vm5.invoke(() -> WANTestBase.createReceiver());
+    
+    // using vm5 for sender in ds 3. cache is already created.
+    
+    vm6.invoke(() -> WANTestBase.createSender( "ln1", 2,
+        false, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny1", 3,
+        false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
+      false, 100, 10, false, false, null, true ));
+
+    vm6.invoke(() -> WANTestBase.createSender( "ln2", 3,
+      false, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ny2", 1,
+      false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "tk2", 2,
+    false, 100, 10, false, false, null, true ));
+
+    
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap()));
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny1,ny2", isOffHeap()));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "tk1,tk2", isOffHeap() ));
+
+    vm6.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm7.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
+    
+    vm6.invoke(() -> WANTestBase.startSender( "ln2" ));
+    vm7.invoke(() -> WANTestBase.startSender( "ny2" ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk2" ));
+    
+    
+    vm6.invoke(() -> WANTestBase.addQueueListener( "ln1",
+      false ));
+    vm7.invoke(() -> WANTestBase.addQueueListener( "ny1",
+      false ));
+    vm5.invoke(() -> WANTestBase.addQueueListener( "tk1",
+      false ));
+    vm6.invoke(() -> WANTestBase.addSecondQueueListener( "ln2",
+      false ));
+    vm7.invoke(() -> WANTestBase.addSecondQueueListener( "ny2",
+      false ));
+    vm5.invoke(() -> WANTestBase.addSecondQueueListener( "tk2",
+      false ));
+  
+    
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny1,ny2", isOffHeap() ));
+    
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 1; i++) {
+      keyValues.put(i, i);
+    }
+    vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    keyValues.clear();
+    for(int i=1; i< 2; i++) {
+      keyValues.put(i, i);
+    }
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    keyValues.clear();
+    for(int i=2; i< 3; i++) {
+      
+      keyValues.put(i, i);
+    }
+    vm5.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    Wait.pause(2000);
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 3 ));
+    vm6.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 3 ));
+    vm7.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 3 ));
+    
+    Wait.pause(5000);
+    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln1", 0 ));
+    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk1", 0 ));
+    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln2", 0 ));
+    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk2", 0 ));
+    
+    
+    Map queueMap1 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap2 = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap3 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap4 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue2());
+    Map queueMap5 = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue2());
+    Map queueMap6 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue2());
+    
+    List createList1 = (List)queueMap1.get("Create");
+    List updateList1 = (List)queueMap1.get("Update");
+    List createList2 = (List)queueMap2.get("Create");
+    List updateList2 = (List)queueMap2.get("Update");
+    List createList3 = (List)queueMap3.get("Create");
+    List updateList3 = (List)queueMap3.get("Update");
+    
+    List createList4 = (List)queueMap4.get("Create");
+    List updateList4 = (List)queueMap4.get("Update");
+    
+    List createList5 = (List)queueMap5.get("Create");
+    List updateList5 = (List)queueMap5.get("Update");
+    
+    List createList6 = (List)queueMap6.get("Create");
+    List updateList6 = (List)queueMap6.get("Update");
+    
+    
+    assertEquals(0, updateList1.size());
+    assertEquals(0, updateList2.size());
+    assertEquals(0, updateList3.size());
+    assertEquals(0, updateList4.size());
+    assertEquals(0, updateList5.size());
+    assertEquals(0, updateList6.size());
+    
+    assertEquals(1, createList1.size());
+    assertEquals(1, createList2.size());
+    assertEquals(1, createList3.size());
+    assertEquals(1, createList4.size());
+    assertEquals(1, createList5.size());
+    assertEquals(1, createList6.size());
+  }
+
+  
+  @Test
+  public void testReplicatedSerialPropagationLoopBack3SitesNtoNPutFromOneDS() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm4.invoke(() -> WANTestBase.createCache( nyPort ));
+    vm5.invoke(() -> WANTestBase.createCache( tkPort ));
+    vm3.invoke(() -> WANTestBase.createReceiver());
+    vm4.invoke(() -> WANTestBase.createReceiver());
+    vm5.invoke(() -> WANTestBase.createReceiver());
+    
+    
+    vm3.invoke(() -> WANTestBase.createSender( "ln1", 2,
+        false, 100, 10, false, false, null, true ));
+    vm3.invoke(() -> WANTestBase.createSender( "ln2", 3,
+      false, 100, 10, false, false, null, true ));
+    
+    vm4.invoke(() -> WANTestBase.createSender( "ny1", 3,
+        false, 100, 10, false, false, null, true ));
+    vm4.invoke(() -> WANTestBase.createSender( "ny2", 1,
+      false, 100, 10, false, false, null, true ));
+    
+    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
+      false, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "tk2", 2,
+    false, 100, 10, false, false, null, true ));
+
+    
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ny1,ny2", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "tk1,tk2", isOffHeap() ));
+
+    
+    vm3.invoke(() -> WANTestBase.startSender( "ln1" ));
+    vm4.invoke(() -> WANTestBase.startSender( "ny1" ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
+    
+    vm3.invoke(() -> WANTestBase.startSender( "ln2" ));
+    vm4.invoke(() -> WANTestBase.startSender( "ny2" ));
+    vm5.invoke(() -> WANTestBase.startSender( "tk2" ));
+    
+    
+    vm3.invoke(() -> WANTestBase.addQueueListener( "ln1",
+      false ));
+    vm4.invoke(() -> WANTestBase.addQueueListener( "ny1",
+      false ));
+    vm5.invoke(() -> WANTestBase.addQueueListener( "tk1",
+      false ));
+    vm3.invoke(() -> WANTestBase.addSecondQueueListener( "ln2",
+      false ));
+    vm4.invoke(() -> WANTestBase.addSecondQueueListener( "ny2",
+      false ));
+    vm5.invoke(() -> WANTestBase.addSecondQueueListener( "tk2",
+      false ));
+  
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 1; i++) {
+      keyValues.put(i, i);
+    }
+    vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1 ));
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1 ));
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1 ));
+    
+    Wait.pause(5000);
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln1", 0 ));
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk1", 0 ));
+    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln2", 0 ));
+    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
+    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk2", 0 ));
+    
+    
+    Map queueMap1 = (HashMap)vm3.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap2 = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap3 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
+    Map queueMap4 = (HashMap)vm3.invoke(() -> WANTestBase.checkQueue2());
+    Map queueMap5 = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue2());
+    Map queueMap6 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue2());
+    
+    List createList1 = (List)queueMap1.get("Create");
+    List updateList1 = (List)queueMap1.get("Update");
+    List createList2 = (List)queueMap2.get("Create");
+    List updateList2 = (List)queueMap2.get("Update");
+    List createList3 = (List)queueMap3.get("Create");
+    List updateList3 = (List)queueMap3.get("Update");
+    
+    List createList4 = (List)queueMap4.get("Create");
+    List updateList4 = (List)queueMap4.get("Update");
+    
+    List createList5 = (List)queueMap5.get("Create");
+    List updateList5 = (List)queueMap5.get("Update");
+    
+    List createList6 = (List)queueMap6.get("Create");
+    List updateList6 = (List)queueMap6.get("Update");
+    
+    
+    assertEquals(0, updateList1.size());
+    assertEquals(0, updateList2.size());
+    assertEquals(0, updateList3.size());
+    assertEquals(0, updateList4.size());
+    assertEquals(0, updateList5.size());
+    assertEquals(0, updateList6.size());
+    
+    assertEquals(1, createList1.size());
+    assertEquals(0, createList2.size());
+    assertEquals(0, createList3.size());
+    assertEquals(1, createList4.size());
+    assertEquals(0, createList5.size());
+    assertEquals(0, createList6.size());
+  }
+
+}


[08/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
new file mode 100644
index 0000000..b754254
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
@@ -0,0 +1,499 @@
+/*
+ * 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.internal.cache.wan.parallel;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class ParallelWANStatsDUnitTest extends WANTestBase{
+  
+  private static final int NUM_PUTS = 100;
+  private static final long serialVersionUID = 1L;
+  
+  private String testName;
+  
+  public ParallelWANStatsDUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    this.testName = getTestMethodName();
+  }
+  
+  @Test
+  public void testPartitionedRegionParallelPropagation_BeforeDispatch() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSendersWithConflation(lnPort);
+
+    createSenderPRs(0);
+
+    startPausedSenders();
+    
+    createReceiverPR(vm2, 1);
+    createReceiverPR(vm3, 1);
+
+    putKeyValues();
+
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
+    
+    assertEquals(NUM_PUTS, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
+    assertEquals(NUM_PUTS, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
+    assertEquals(NUM_PUTS, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
+    assertEquals(0, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
+    assertEquals(0, v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4)); //batches distributed
+    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
+    
+  }
+
+  @Test
+  public void testPartitionedRegionParallelPropagation_AfterDispatch_NoRedundancy() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+
+    createSenders(lnPort);
+
+    createReceiverPR(vm2, 0);
+   
+    createSenderPRs(0);
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName,
+        NUM_PUTS ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, NUM_PUTS ));
+    
+    
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    
+    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
+    assertEquals(NUM_PUTS, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
+    assertEquals(NUM_PUTS, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
+    assertEquals(NUM_PUTS, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
+    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 10); //batches distributed
+    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
+  }
+  
+  @Test
+  public void testPartitionedRegionParallelPropagation_AfterDispatch_Redundancy_3() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+
+    createSenders(lnPort);
+
+    createReceiverPR(vm2, 0);
+
+    createSenderPRs(3);
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName,
+        NUM_PUTS ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, NUM_PUTS ));
+    
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    
+    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
+    assertEquals(400, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
+    assertEquals(400, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
+    assertEquals(NUM_PUTS, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
+    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 10); //batches distributed
+    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
+  }
+  
+  @Test
+  public void testWANStatsTwoWanSites_Bug44331() throws Exception {
+    Integer lnPort = createFirstLocatorWithDSId(1);
+    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createCacheInVMs(tkPort, vm3);
+    createReceiverInVMs(vm2);
+    createReceiverInVMs(vm3);
+
+    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln1",
+        2, true, 100, 10, false, false, null, true ));
+  
+    vm4.invoke(() -> WANTestBase.createSender( "ln2",
+        3, true, 100, 10, false, false, null, true ));
+  
+    createReceiverPR(vm2, 0);
+    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
+      testName, null, 0, 10, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+      testName, "ln1,ln2", 0, 10, isOffHeap() ));
+    
+    vm4.invoke(() -> WANTestBase.startSender( "ln1" ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln2" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName,
+        NUM_PUTS ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, NUM_PUTS ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName, NUM_PUTS ));
+    
+    ArrayList<Integer> v4Sender1List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln1", 0 ));
+    ArrayList<Integer> v4Sender2List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln2", 0 ));
+    
+    assertEquals(0, v4Sender1List.get(0).intValue()); //queue size
+    assertEquals(NUM_PUTS, v4Sender1List.get(1).intValue()); //eventsReceived
+    assertEquals(NUM_PUTS, v4Sender1List.get(2).intValue()); //events queued
+    assertEquals(NUM_PUTS, v4Sender1List.get(3).intValue()); //events distributed
+    assertTrue(v4Sender1List.get(4).intValue()>=10); //batches distributed
+    assertEquals(0, v4Sender1List.get(5).intValue()); //batches redistributed
+    
+    assertEquals(0, v4Sender2List.get(0).intValue()); //queue size
+    assertEquals(NUM_PUTS, v4Sender2List.get(1).intValue()); //eventsReceived
+    assertEquals(NUM_PUTS, v4Sender2List.get(2).intValue()); //events queued
+    assertEquals(NUM_PUTS, v4Sender2List.get(3).intValue()); //events distributed
+    assertTrue(v4Sender2List.get(4).intValue()>=10); //batches distributed
+    assertEquals(0, v4Sender2List.get(5).intValue()); //batches redistributed
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
+    vm3.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
+  }
+  
+  @Test
+  public void testParallelPropagationHA() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+
+    createSenders(lnPort);
+    
+    createReceiverPR(vm2, 0);
+    
+    createSenderPRs(3);
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( testName, 1000 ));
+    pause(200);
+    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
+    inv1.join();
+    inv2.join();
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, 1000 ));
+    
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0));
+    
+    assertEquals(0, v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
+    int receivedEvents = v5List.get(1) + v6List.get(1) + v7List.get(1);
+    //We may see a single retried event on all members due to the kill
+    assertTrue("Received " + receivedEvents, 3000 <= receivedEvents && 3003 >= receivedEvents); //eventsReceived
+    int queuedEvents = v5List.get(2) + v6List.get(2) + v7List.get(2);
+    assertTrue("Queued " + queuedEvents, 3000 <= queuedEvents && 3003 >= queuedEvents); //eventsQueued
+    //assertTrue(10000 <= v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed : its quite possible that vm4 has distributed some of the events
+    //assertTrue(v5List.get(4) + v6List.get(4) + v7List.get(4) > 1000); //batches distributed : its quite possible that vm4 has distributed some of the batches.
+    assertEquals(0, v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
+  
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStatsHA(NUM_PUTS, 1000, 1000 ));
+  }
+
+  /**
+   * 1 region and sender configured on local site and 1 region and a 
+   * receiver configured on remote site. Puts to the local region are in progress.
+   * Remote region is destroyed in the middle.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testParallelPropagationWithRemoteRegionDestroy() throws Exception {
+    addIgnoredException("RegionDestroyedException");
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverPR(vm2, 0);
+    createReceiverInVMs(vm2);
+
+    createSenders(lnPort);
+
+    vm2.invoke(() -> WANTestBase.addCacheListenerAndDestroyRegion(
+        testName));
+
+    createSenderPRs(0);
+
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+    //start puts in RR_1 in another thread
+    vm4.invoke(() -> WANTestBase.doPuts( testName, 2000 ));
+    
+    //verify that all is well in local site. All the events should be present in local region
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+        testName, 2000 ));
+    
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
+    
+    
+    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 1); //batches distributed : its quite possible that vm4 has distributed some of the batches.
+    assertTrue(v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5) >= 1); //batches redistributed
+  }
+
+  @Test
+  public void testParallelPropagationWithFilter() throws Exception {
+
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+
+    createReceiverPR(vm2, 1);
+
+    createReceiverInVMs(vm2);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    createSenderPRs(0);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false,
+        new MyGatewayEventFilter(), true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false,
+      new MyGatewayEventFilter(), true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false,
+      new MyGatewayEventFilter(), true ));
+  
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+
+    
+    vm4.invoke(() -> WANTestBase.doPuts( testName, 1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, 800 ));
+    
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+
+    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
+    assertEquals(1000, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
+    assertEquals(900, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
+    assertEquals(800, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
+    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 80); //batches distributed
+    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
+    assertEquals(200, v4List.get(6) + v5List.get(6) + v6List.get(6) + v7List.get(6)); //events filtered
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(80, 800, 800));
+  }
+  
+  @Test
+  public void testParallelPropagationConflation() throws Exception {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    createReceiverInVMs(vm2);
+
+    createSendersWithConflation(lnPort);
+
+    createSenderPRs(0);
+
+    startPausedSenders();
+
+    createReceiverPR(vm2, 1);
+
+    Map keyValues = putKeyValues();
+    final Map updateKeyValues = new HashMap();
+    for(int i=0;i<50;i++) {
+      updateKeyValues.put(i, i+"_updated");
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() /*creates aren't conflated*/ ));
+    
+    // Do the puts again. Since these are updates, the previous updates will be conflated.
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() /*creates aren't conflated*/ ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, 0 ));
+
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 0, 0));
+    
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
+
+    keyValues.putAll(updateKeyValues);
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName, keyValues.size() ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionContents(
+        testName, keyValues ));
+    
+    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 150, NUM_PUTS));
+    
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 0 ));
+    
+    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
+    
+    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
+    assertEquals(200, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
+    assertEquals(200, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
+    assertEquals(150, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
+    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 10); //batches distributed
+    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
+    assertEquals(50, v4List.get(7) + v5List.get(7) + v6List.get(7) + v7List.get(7)); //events conflated 
+    
+  }
+  
+  protected Map putKeyValues() {
+    final Map keyValues = new HashMap();
+    for(int i=0; i< NUM_PUTS; i++) {
+      keyValues.put(i, i);
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, keyValues ));
+
+    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() ));
+    
+    return keyValues;
+  }
+
+  protected void createReceiverPR(VM vm, int redundancy) {
+    vm.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, null, redundancy, 10, isOffHeap() ));
+  }
+  
+  protected void createSenderPRs(int redundancy) {
+    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", redundancy, 10, isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", redundancy, 10, isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", redundancy, 10, isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
+        testName, "ln", redundancy, 10, isOffHeap() ));
+  }
+
+  protected void startPausedSenders() {
+    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+    
+    vm4.invoke(() ->pauseSender( "ln" ));
+    vm5.invoke(() ->pauseSender( "ln" ));
+    vm6.invoke(() ->pauseSender( "ln" ));
+    vm7.invoke(() ->pauseSender( "ln" ));
+  }
+
+  protected void createSendersWithConflation(Integer lnPort) {
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, true, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, true, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, true, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, true, false, null, true ));
+  }
+
+  protected void createSenders(Integer lnPort) {
+    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        true, 100, 10, false, false, null, true ));
+    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
+      true, 100, 10, false, false, null, true ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
new file mode 100644
index 0000000..b38d35b
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
@@ -0,0 +1,405 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheTransactionManager;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.execute.*;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Wait;
+
+//The tests here are to validate changes introduced because a distributed deadlock
+//was found that caused issues for a production customer. 
+//
+//There are 4 tests which use sender gateways with primaries on different 
+//JVM's. Two tests use replicated and two use partition regions and the
+//the tests vary the conserve-sockets.  
+//
+//currently the 4th test using PR, conserve-sockets=true hangs/fails and is commented
+//out to prevent issues
+@Category(DistributedTest.class)
+public class SerialGatewaySenderDistributedDeadlockDUnitTest extends WANTestBase {
+
+    public SerialGatewaySenderDistributedDeadlockDUnitTest() {
+        super();
+    }
+
+    //Uses replicated regions and conserve-sockets=false
+  @Test
+  public void testPrimarySendersOnDifferentVMsReplicated() throws Exception {
+
+        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
+
+        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
+
+        createCachesWith(Boolean.FALSE, nyPort, lnPort);
+
+        createSerialSenders();
+
+        createReplicatedRegions(nyPort);
+
+        //get one primary sender on vm4 and another primary on vm5
+        //the startup order matters here
+        startSerialSenders();
+
+        //exercise region and gateway operations with different messaging
+        exerciseWANOperations();
+        AsyncInvocation invVM4transaction = vm4.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
+        AsyncInvocation invVM5transaction = vm5.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
+        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+
+        exerciseFunctions();
+
+        try {
+            invVM4transaction.join();
+            invVM5transaction.join();
+            invVM4.join();
+            invVM5.join();
+
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    //Uses partitioned regions and conserve-sockets=false
+  @Test
+  public void testPrimarySendersOnDifferentVMsPR() throws Exception {
+        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
+
+        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
+
+        createCachesWith(Boolean.FALSE, nyPort, lnPort);
+
+        createSerialSenders();
+
+        createPartitionedRegions(nyPort);
+
+        startSerialSenders();
+
+        exerciseWANOperations();
+        AsyncInvocation invVM4transaction
+                = vm4.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
+        AsyncInvocation invVM5transaction
+                = vm5.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
+
+        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+
+        exerciseFunctions();
+
+        try {
+            invVM4transaction.join();
+            invVM5transaction.join();
+            invVM4.join();
+            invVM5.join();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    //Uses replicated regions and conserve-sockets=true
+  @Test
+  public void testPrimarySendersOnDifferentVMsReplicatedSocketPolicy() throws Exception {
+
+        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
+
+        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
+
+        createCachesWith(Boolean.TRUE, nyPort, lnPort);
+
+        createSerialSenders();
+
+        createReplicatedRegions(nyPort);
+
+        //get one primary sender on vm4 and another primary on vm5
+        //the startup order matters here
+        startSerialSenders();
+
+        //exercise region and gateway operations with messaging
+        exerciseWANOperations();
+        AsyncInvocation invVM4transaction = vm4.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
+        AsyncInvocation invVM5transaction = vm5.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
+
+        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+
+        exerciseFunctions();
+
+        try {
+            invVM4transaction.join();
+            invVM5transaction.join();
+            invVM4.join();
+            invVM5.join();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    //Uses partitioned regions and conserve-sockets=true
+    //this always causes a distributed deadlock
+  @Test
+  public void testPrimarySendersOnDifferentVMsPRSocketPolicy() throws Exception {
+        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
+
+        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
+
+        createCachesWith(Boolean.TRUE, nyPort, lnPort);
+
+        createSerialSenders();
+
+        createPartitionedRegions(nyPort);
+
+        startSerialSenders();
+
+        exerciseWANOperations();
+        AsyncInvocation invVM4transaction
+                = vm4.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
+        AsyncInvocation invVM5transaction
+                = vm5.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
+
+        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
+
+        exerciseFunctions();
+
+        try {
+            invVM4transaction.join();
+            invVM5transaction.join();
+            invVM4.join();
+            invVM5.join();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    //**************************************************************************
+    //Utility methods used by tests
+    //**************************************************************************
+    private void createReplicatedRegions(Integer nyPort) throws Exception {
+        //create receiver
+        vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", null, false));
+        vm2.invoke(() -> WANTestBase.createReceiver());
+
+        //create senders
+        vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1,ln2", false));
+
+        vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln1,ln2", false));
+    }
+
+    private void createCachesWith(Boolean socketPolicy, Integer nyPort, Integer lnPort) {
+        vm2.invoke(() -> WANTestBase.createCacheConserveSockets(socketPolicy, nyPort));
+
+        vm4.invoke(() -> WANTestBase.createCacheConserveSockets(socketPolicy, lnPort));
+
+        vm5.invoke(() -> WANTestBase.createCacheConserveSockets(socketPolicy, lnPort));
+    }
+
+    private void exerciseFunctions() throws Exception {
+        //do function calls that use a shared connection
+        for (int x = 0; x < 1000; x++) {
+            //setting it to Boolean.TRUE it should pass the test
+            vm4.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.TRUE));
+            vm5.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.TRUE));
+        }
+        for (int x = 0; x < 1000; x++) {
+            //setting the Boolean.FALSE below will cause a deadlock in some GFE versions
+            //setting it to Boolean.TRUE as above it should pass the test
+            //this is similar to the customer found distributed deadlock
+            vm4.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.FALSE));
+            vm5.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.FALSE));
+        }
+    }
+
+    private void createPartitionedRegions(Integer nyPort) throws Exception {
+        //create remote receiver
+        vm2.invoke(() -> WANTestBase.createPartitionedRegion(getTestMethodName() + "_RR",
+                                                                                "", 0, 113, false));
+
+        vm2.invoke(() -> WANTestBase.createReceiver());
+
+        //create sender vms
+        vm4.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_RR", "ln1,ln2", 1, 113, false));
+
+        vm5.invoke(() -> WANTestBase.createPartitionedRegion(
+          getTestMethodName() + "_RR", "ln1,ln2", 1, 113, false));
+    }
+
+    private void exerciseWANOperations() throws Exception {
+        //note - some of these should be made async to truly exercise the 
+        //messaging between the WAN gateways and members
+
+        //exercise region and gateway operations
+        vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
+        vm5.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
+        Wait.pause(2000); //wait for events to propagate
+        vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
+        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
+        vm5.invoke(() -> WANTestBase.doDestroys(getTestMethodName() + "_RR", 100));
+        Wait.pause(2000);//wait for events to propagate
+        vm5.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
+        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
+        vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
+        vm5.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
+        Wait.pause(2000); //wait for events to propagate
+        vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
+        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
+        vm4.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doInvalidates(getTestMethodName() + "_RR", 100, 100));
+        vm4.invoke(() -> WANTestBase.doPutAll(getTestMethodName() + "_RR", 100, 10));
+        vm5.invoke(() -> WANTestBase.doPutAll(getTestMethodName() + "_RR", 100, 10));
+        Wait.pause(2000);//wait for events to propagate
+        vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
+        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
+        vm4.invoke(() -> WANTestBase.doDestroys(getTestMethodName() + "_RR", 1000));
+        Wait.pause(2000);//wait for events to propagate
+        vm5.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
+        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
+        vm4.invoke(() -> WANTestBase.doPutsPDXSerializable(getTestMethodName() + "_RR", 100));
+        Wait.pause(2000);
+        vm5.invoke(() -> WANTestBase.validateRegionSize_PDX(getTestMethodName() + "_RR", 100));
+        vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(getTestMethodName() + "_RR", 100));
+    }
+
+    private void startSerialSenders() throws Exception {
+        //get one primary sender on vm4 and another primary on vm5
+        //the startup order matters here so that primaries are
+        //on different JVM's
+        vm4.invoke(() -> WANTestBase.startSender("ln1"));
+
+        vm5.invoke(() -> WANTestBase.startSender("ln2"));
+
+        //start secondaries
+        vm5.invoke(() -> WANTestBase.startSender("ln1"));
+
+        vm4.invoke(() -> WANTestBase.startSender("ln2"));
+    }
+
+    private void createSerialSenders() throws Exception {
+
+        vm4.invoke(() -> WANTestBase.createSender("ln1", 2,
+            false, 100, 10, false, false, null, true));
+
+        vm5.invoke(() -> WANTestBase.createSender("ln1", 2,
+            false, 100, 10, false, false, null, true));
+
+        vm4.invoke(() -> WANTestBase.createSender("ln2", 2,
+            false, 100, 10, false, false, null, true));
+
+        vm5.invoke(() -> WANTestBase.createSender("ln2", 2,
+            false, 100, 10, false, false, null, true));
+    }
+
+    public static void doFunctionPuts(String name, int num, Boolean useThreadOwnedSocket) throws Exception {
+        Region region = CacheFactory.getAnyInstance().getRegion(name);
+        FunctionService.registerFunction(new TestFunction());
+        Execution exe = FunctionService.onRegion(region);
+        for (int x = 0; x < num; x++) {
+            exe.withArgs(useThreadOwnedSocket).execute("com.gemstone.gemfire.internal.cache.wan.serial.TestFunction");
+        }
+    }
+
+    public static void doTxPutsPR(String regionName, int numPuts, int size) throws Exception {
+        Region r = cache.getRegion(Region.SEPARATOR + regionName);
+        CacheTransactionManager mgr = cache.getCacheTransactionManager();
+        for (int x = 0; x < numPuts; x++) {
+            int temp = (int) (Math.floor(Math.random() * size));
+            try {
+                mgr.begin();
+                r.put(temp, temp);
+                mgr.commit();
+            } catch (com.gemstone.gemfire.cache.TransactionDataNotColocatedException txe) {
+                //ignore colocation issues or primary bucket issues 
+            } catch (com.gemstone.gemfire.cache.CommitConflictException cce) {
+                //ignore - conflicts are ok and expected
+            }
+        }
+    }
+
+    public static void doInvalidates(String regionName, int numInvalidates, int size) throws Exception {
+        Region r = cache.getRegion(Region.SEPARATOR + regionName);
+        for (int x = 0; x < numInvalidates; x++) {
+            int temp = (int) (Math.floor(Math.random() * size));
+            try {
+                if (r.containsValueForKey(temp)) {
+                    r.invalidate(temp);
+                }
+            } catch (com.gemstone.gemfire.cache.EntryNotFoundException entryNotFoundException) {
+                //ignore as an entry may not exist
+            }
+        }
+    }
+
+}
+
+class TestFunction implements Function {
+
+    @Override
+    public boolean hasResult() {
+        return false;
+    }
+
+    @Override
+    public void execute(FunctionContext fc) {
+        boolean option = (Boolean) fc.getArguments();
+        if (option) {
+            DistributedSystem.setThreadsSocketPolicy(false);
+        }
+        RegionFunctionContext context = (RegionFunctionContext) fc;
+        Region local = context.getDataSet();
+        local.put(randKeyValue(10), randKeyValue(10000));
+    }
+
+    @Override
+    public String getId() {
+        return this.getClass().getName();
+    }
+
+    @Override
+    public boolean optimizeForWrite() {
+        return false;
+    }
+
+    @Override
+    public boolean isHA() {
+        return false;
+    }
+
+    private int randKeyValue(int size) {
+        double temp = Math.floor(Math.random() * size);
+        return (int) temp;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java
new file mode 100644
index 0000000..8c255c1
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java
@@ -0,0 +1,383 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.MyGatewaySenderEventListener;
+import com.gemstone.gemfire.internal.cache.wan.MyGatewaySenderEventListener2;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class SerialGatewaySenderEventListenerDUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  public SerialGatewaySenderEventListenerDUnitTest() {
+    super();
+  }
+
+  /**
+   * Test validates whether the listener attached receives all the events.
+   * this test hangs after the Darrel's checkin 36685. Need to work with Darrel.Commenting it out so that test suit will not hang 
+   */
+  @Ignore
+  @Test
+  public void testGatewaySenderEventListenerInvocationWithoutLocator() {
+    int mPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    vm4.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+    vm5.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+    vm6.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+    vm7.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+
+    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, false, true));
+    vm5.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, false, true));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 1000; i++) {
+      keyValues.put(i, i);
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", keyValues.size() ));
+    
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", keyValues.size() ));
+    
+    vm4.invoke(() -> WANTestBase.printEventListenerMap());
+    vm5.invoke(() -> WANTestBase.printEventListenerMap());
+
+    fail("tried to invoke missing method");
+//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", keyValues ));
+  }
+  
+  /**
+   * Test validates whether the listener attached receives all the events.
+   */
+  @Test
+  public void testGatewaySenderEventListenerInvocation() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, false, true));
+    vm5.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, false, true));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 1000; i++) {
+      keyValues.put(i, i);
+    }
+
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+
+    vm4.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", keyValues.size() ));
+    
+    vm5.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", keyValues.size() ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 0 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 0 ));
+
+    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", keyValues ));
+  }
+
+  /**
+   * Test validates whether the listener attached receives all the events. 
+   * When there are 2 listeners attached to the GatewaySender.
+   */
+  @Test
+  public void testGatewaySender2EventListenerInvocation() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
+
+    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, true, true));
+    vm5.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, true, true));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    final Map keyValues = new HashMap();
+    for(int i=0; i< 1000; i++) {
+      keyValues.put(i, i);
+    }
+
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 0 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 0 ));
+
+    // TODO: move validateReceivedEventsMapSizeListener2 to a shared util class
+    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener2("ln", keyValues ));
+  }
+  
+  /**
+   * Test validates whether the PoolImpl is created. Ideally when a listener is attached
+   * pool should not be created.
+   */
+  @Test
+  public void testGatewaySenderEventListenerPoolImpl() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4);
+
+    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, false, false ));
+    
+    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateNoPoolCreation("ln" ));
+  }
+  
+  // Test start/stop/resume on listener invocation
+  //this test hangs after the Darrel's checkin 36685. Need to work with Darrel.Commenting it out so that test suit will not hang
+  @Ignore
+  @Test
+  public void testGatewaySenderEventListener_GatewayOperations() {
+
+    int mPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    vm4.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+    vm5.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+    vm6.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+    vm7.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
+
+    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
+        false, 100, 10, false, false, null, false, true));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    final Map initialKeyValues = new HashMap();
+    for(int i=0; i< 1000; i++) {
+      initialKeyValues.put(i, i);
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      initialKeyValues ));
+
+    fail("tried to invoke missing method");
+//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", initialKeyValues ));
+    
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    final Map keyValues = new HashMap();
+    for(int i=1000; i< 2000; i++) {
+      keyValues.put(i, i);
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      keyValues ));
+    
+    fail("tried to invoke missing method");
+//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", initialKeyValues ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    final Map finalKeyValues = new HashMap();
+    for(int i=2000; i< 3000; i++) {
+      finalKeyValues.put(i, i);
+    }
+    
+    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
+      finalKeyValues ));
+    
+    finalKeyValues.putAll(initialKeyValues);
+    fail("tried to invoke missing method");
+//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", finalKeyValues ));
+    
+  }
+    
+  public static void validateNoPoolCreation(final String siteId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    for(GatewaySender sender: senders) {
+      if (sender.getId().equals(siteId)) {
+        AbstractGatewaySender sImpl = (AbstractGatewaySender)sender;
+        assertNull(sImpl.getProxy());
+      }
+    }
+  }
+  
+  public static void validateReceivedEventsMapSizeListener1(final String senderId, final Map map) {
+
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        sender = s;
+        break;
+      }
+    }
+    
+    final List<AsyncEventListener> listeners = ((AbstractGatewaySender)sender).getAsyncEventListeners();
+    if(listeners.size() == 1) {
+      final AsyncEventListener l = listeners.get(0);
+
+      WaitCriterion wc = new WaitCriterion() {
+        Map listenerMap;
+        public boolean done() {
+          listenerMap = ((MyGatewaySenderEventListener)l)
+              .getEventsMap();
+          boolean sizeCorrect = map.size() == listenerMap.size();
+          boolean keySetCorrect = listenerMap.keySet().containsAll(map.keySet());
+          boolean valuesCorrect = listenerMap.values().containsAll(map.values());
+          return sizeCorrect && keySetCorrect && valuesCorrect;
+        }
+
+        public String description() {
+          return "Waiting for all sites to get updated, the sizes are " + listenerMap.size() + " and " + map.size();
+        }
+      };
+      Wait.waitForCriterion(wc, 60000, 500, true); 
+    }
+  }
+  
+  public static void validateReceivedEventsMapSizeListener2(final String senderId, final Map map) {
+
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for(GatewaySender s : senders){
+      if(s.getId().equals(senderId)){
+        sender = s;
+        break;
+      }
+    }
+    
+    final List<AsyncEventListener> listeners = ((AbstractGatewaySender)sender).getAsyncEventListeners();
+    if(listeners.size() == 2) {
+      final AsyncEventListener l1 = listeners.get(0);
+      final AsyncEventListener l2 = listeners.get(1);
+      Awaitility.await().atMost(60000, TimeUnit.MILLISECONDS).until(()->{
+        Map listenerMap1 = ((MyGatewaySenderEventListener)l1)
+          .getEventsMap();
+
+        Map listenerMap2 = ((MyGatewaySenderEventListener2)l2)
+          .getEventsMap();
+        int listener1MapSize = listenerMap1.size();
+        int listener2MapSize = listenerMap1.size();
+        int expectedMapSize = map.size();
+        boolean sizeCorrect = expectedMapSize == listener1MapSize;
+        boolean keySetCorrect = listenerMap1.keySet().containsAll(map.keySet());
+        boolean valuesCorrect = listenerMap1.values().containsAll(map.values());
+
+        boolean sizeCorrect2 = expectedMapSize== listener2MapSize;
+        boolean keySetCorrect2 = listenerMap2.keySet().containsAll(map.keySet());
+        boolean valuesCorrect2 = listenerMap2.values().containsAll(map.values());
+
+        assertEquals("Failed while waiting for all sites to get updated with the correct events. \nThe " +
+                     "size of listener 1's map = "+ listener1MapSize + "\n The size of listener 2's map = " +
+                     ""+ listener2MapSize + "\n The expected map size =" + expectedMapSize ,
+          true, sizeCorrect && keySetCorrect && valuesCorrect && sizeCorrect2 && keySetCorrect2 && valuesCorrect2);
+      });
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
new file mode 100644
index 0000000..200e5b6
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
@@ -0,0 +1,665 @@
+/*
+ * 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.internal.cache.wan.serial;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionRequest;
+import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionResponse;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.ServerLocator;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
+import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.RMIException;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+
+/**
+ * 
+ */
+@Category(DistributedTest.class)
+public class SerialGatewaySenderOperationsDUnitTest extends WANTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  public SerialGatewaySenderOperationsDUnitTest() {
+    super();
+  }
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    IgnoredException.addIgnoredException("Broken pipe");
+    IgnoredException.addIgnoredException("Connection reset");
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    IgnoredException.addIgnoredException("Connection refused");
+    IgnoredException.addIgnoredException("could not get remote locator information");
+    
+    //Stopping the gateway closed the region,
+    //which causes this exception to get logged
+    IgnoredException.addIgnoredException(RegionDestroyedException.class.getSimpleName());
+  }
+
+  @Test
+  public void testSerialGatewaySenderOperationsWithoutStarting() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        100 ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifyGatewaySenderOperations( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifyGatewaySenderOperations( "ln" ));
+
+  }
+
+  protected void createSenderRegions() {
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+  }
+
+  protected void createReceiverRegions() {
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+  }
+
+  protected void createSenderCaches(Integer lnPort) {
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+  }
+
+  protected void createSenderVM5() {
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+  }
+
+  protected void createSenderVM4() {
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+  }
+
+  
+  @Test
+  public void testStartPauseResumeSerialGatewaySender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        100 ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderPausedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderPausedState( "ln" ));
+
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10 ));
+
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
+
+    try {
+      inv1.join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail("Interrupted the async invocation.");
+    }
+
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    validateQueueContents(vm4, "ln", 0);
+    validateQueueContents(vm5, "ln", 0);
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+
+  }
+
+  @Test
+  public void testStopSerialGatewaySender() throws Throwable {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        20 ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        20 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 20 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 20 ));
+    
+    vm2.invoke(() -> WANTestBase.stopReceivers());
+    vm3.invoke(() -> WANTestBase.stopReceivers());
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        20 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
+    
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    /**
+     * Should have no effect on GatewaySenderState
+     */
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    AsyncInvocation vm4async = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm5async = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    int START_WAIT_TIME = 30000;
+    vm4async.getResult(START_WAIT_TIME);
+    vm5async.getResult(START_WAIT_TIME);
+
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
+
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+      110 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 130 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 130 ));
+    
+    vm2.invoke(() -> WANTestBase.startReceivers());
+    vm3.invoke(() -> WANTestBase.startReceivers());
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 110 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      getTestMethodName() + "_RR", 110 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+  }
+
+  @Test
+  public void testStopOneSerialGatewaySenderBothPrimary() throws Throwable {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        100 ));
+
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        200 ));
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 200 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 200 ));
+    
+    //Do some puts while restarting a sender
+    AsyncInvocation asyncPuts = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        300 ));
+    
+    Thread.sleep(10);
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    
+    asyncPuts.getResult();
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 300 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 300 ));
+    
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    
+    
+  }
+
+  @Test
+  public void testStopOneSerialGatewaySender_PrimarySecondary() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        100 ));
+    
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+  }
+  
+  @Test
+  public void testStopOneSender_StartAnotherSender() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    createCacheInVMs(lnPort, vm4);
+    createSenderVM4();
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM5();
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        100 ));
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+  }
+
+  @Test
+  public void test_Bug44153_StopOneSender_StartAnotherSender_CheckQueueSize() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM4();
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+    validateQueueContents(vm4, "ln", 10);
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM5();
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_RR", 10, 110 ));
+
+    validateQueueContents(vm5, "ln", 100);
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    validateQueueContents(vm4, "ln", 10);
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", null, isOffHeap() ));
+    vm2.invoke(() -> WANTestBase.createReceiver());
+
+    LogWriterUtils.getLogWriter().info("Completed puts in the region");
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 100 ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 110 ));
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+  }
+
+  private void validateQueueContents(VM vm, String site, int size) {
+    vm.invoke(() -> WANTestBase.validateQueueContents( site,
+        size ));
+  }
+
+  /**
+   * Destroy SerialGatewaySender on all the nodes.
+   */
+  @Test
+  public void testDestroySerialGatewaySenderOnAllNodes() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+    
+    //before destroying, stop the sender
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", getTestMethodName() + "_RR" ));
+    vm5.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", getTestMethodName() + "_RR" ));
+
+    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
+    vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
+    vm5.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
+  }
+
+  /**
+   * Destroy SerialGatewaySender on a single node.
+   */
+  @Test
+  public void testDestroySerialGatewaySenderOnSingleNode() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+    
+    //before destroying, stop the sender
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+        
+    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", getTestMethodName() + "_RR" ));
+    
+    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
+    
+    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
+    vm5.invoke(() -> WANTestBase.verifySenderRunningState( "ln" ));
+  }
+  
+  /**
+   * Since the sender is attached to a region and in use, it can not be destroyed.
+   * Hence, exception is thrown by the sender API.
+   */
+  @Test
+  public void testDestroySerialGatewaySenderExceptionScenario() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        10 ));
+    
+    try {
+      vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
+    } catch (RMIException e) {
+      assertTrue("Cause of the exception should be GatewaySenderException", e.getCause() instanceof GatewaySenderException);
+    }
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 10 ));
+  }
+
+  
+  @Test
+  public void testGatewaySenderNotRegisteredAsCacheServer() {
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(vm2, vm3);
+
+    createCacheInVMs(lnPort, vm4, vm5);
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+
+    startSenderInVMs("ln", vm4, vm5);
+
+    SerializableRunnable check = new SerializableRunnable("assert no cache servers") {
+      public void run() {
+        InternalLocator inl = (InternalLocator)Locator.getLocator();
+        ServerLocator server = inl.getServerLocatorAdvisee();
+        LogWriterUtils.getLogWriter().info("Server load map is " + server.getLoadMap());
+        assertTrue("expected an empty map but found " + server.getLoadMap(),
+            server.getLoadMap().isEmpty());
+        QueueConnectionRequest request = new QueueConnectionRequest(
+            ClientProxyMembershipID.getNewProxyMembership(InternalDistributedSystem.getConnectedInstance()),
+            1, new HashSet<>(), "", false);
+        QueueConnectionResponse response = (QueueConnectionResponse)server.processRequest(request);
+        assertTrue("expected no servers but found " + response.getServers(),
+            response.getServers().isEmpty());
+      }
+    };
+    vm0.invoke(check);
+    vm1.invoke(check);
+    
+  }
+  
+
+  
+  public static void verifySenderPausedState(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertTrue(sender.isPaused());
+  }
+
+  public static void verifySenderResumedState(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertFalse(sender.isPaused());
+    assertTrue(sender.isRunning());
+  }
+
+  public static void verifySenderStoppedState(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    AbstractGatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = (AbstractGatewaySender)s;
+        break;
+      }
+    }
+    assertFalse(sender.isRunning());
+    assertFalse(sender.isPaused());
+  }
+
+  public static void verifyGatewaySenderOperations(String senderId) {
+    Set<GatewaySender> senders = cache.getGatewaySenders();
+    GatewaySender sender = null;
+    for (GatewaySender s : senders) {
+      if (s.getId().equals(senderId)) {
+        sender = s;
+        break;
+      }
+    }
+    assertFalse(sender.isPaused());
+    assertFalse(((AbstractGatewaySender)sender).isRunning());
+    sender.pause();
+    sender.resume();
+    sender.stop();
+  }
+}


[48/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
deleted file mode 100644
index e06f99e..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.lucene.internal.repository.serializer;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.document.Document;
-
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * A lucene serializer that handles a single class and can
- * map an instance of that class to a document using reflection.
- */
-class ReflectionLuceneSerializer implements LuceneSerializer {
-
-  private Field[] fields;
-
-  private static final Logger logger = LogService.getLogger();
-  
-  public ReflectionLuceneSerializer(Class<? extends Object> clazz,
-      String[] indexedFields) {
-    Set<String> fieldSet = new HashSet<String>();
-    fieldSet.addAll(Arrays.asList(indexedFields));
-
-    //Iterate through all declared fields and save them
-    //in a list if they are an indexed field and have the correct
-    //type.
-    ArrayList<Field> foundFields = new ArrayList<Field>();
-    while(clazz != Object.class) {
-      for(Field field : clazz.getDeclaredFields()) {
-        Class<?> type = field.getType();
-        if(fieldSet.contains(field.getName()) 
-            && SerializerUtil.isSupported(type)) {
-          field.setAccessible(true);
-          foundFields.add(field);
-        }
-      }
-      
-      clazz = clazz.getSuperclass();
-    }
-    
-    this.fields = foundFields.toArray(new Field[foundFields.size()]);
-  }
-
-  @Override
-  public void toDocument(Object value, Document doc) {
-    for(Field field: fields) {
-      try {
-        Object fieldValue = field.get(value);
-        if (fieldValue == null) {
-          continue;
-        }
-        SerializerUtil.addField(doc, field.getName(), fieldValue);
-      } catch (IllegalArgumentException | IllegalAccessException e) {
-        //TODO - what to do if we can't read a field?
-      }
-    }
-    if (logger.isDebugEnabled()) {
-      logger.debug("ReflectionLuceneSerializer.toDocument:"+doc);
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/SerializerUtil.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/SerializerUtil.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/SerializerUtil.java
deleted file mode 100644
index 4d563c1..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/SerializerUtil.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.lucene.internal.repository.serializer;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.DoublePoint;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.document.FloatPoint;
-import org.apache.lucene.document.IntPoint;
-import org.apache.lucene.document.LongPoint;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.util.BytesRef;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.internal.util.BlobHelper;
-
-/**
- * Static utility functions for mapping objects to lucene documents
- */
-public class SerializerUtil {
-  private static final String KEY_FIELD = "_KEY";
-
-  private static final Set<Class> SUPPORTED_PRIMITIVE_TYPES;
-
-  static {
-    HashSet<Class> primitiveTypes = new HashSet<>();
-    primitiveTypes.add(String.class);
-    primitiveTypes.add(long.class);
-    primitiveTypes.add(int.class);
-    primitiveTypes.add(float.class);
-    primitiveTypes.add(double.class);
-    primitiveTypes.add(Long.class);
-    primitiveTypes.add(Integer.class);
-    primitiveTypes.add(Float.class);
-    primitiveTypes.add(Double.class);
-
-    SUPPORTED_PRIMITIVE_TYPES = Collections.unmodifiableSet(primitiveTypes);
-  }
-  
-  /**
-   * A small buffer for converting keys to byte[] arrays.
-   */
-  private static ThreadLocal<ByteArrayOutputStream> LOCAL_BUFFER = new ThreadLocal<ByteArrayOutputStream>() {
-    @Override
-    protected ByteArrayOutputStream initialValue() {
-      return new ByteArrayOutputStream();
-    }
-  };
-
-  private SerializerUtil() {
-  }
-  
-  /**
-   * Add a gemfire key to a document
-   */
-  public static void addKey(Object key, Document doc) {
-    if(key instanceof String) {
-      doc.add(new StringField(KEY_FIELD, (String) key, Store.YES));
-    } else {
-      doc.add(new StringField(KEY_FIELD, keyToBytes(key), Store.YES));
-    }
-  }
-
-  /**
-   * Add a field to the document.
-   * 
-   * @return true if the field was successfully added
-   */
-  public static boolean addField(Document doc, String field, Object fieldValue) {
-    Class<?> clazz = fieldValue.getClass();
-    if(clazz == String.class) {
-      doc.add(new TextField(field, (String)fieldValue, Store.NO));
-    } else if (clazz == Long.class) {
-      doc.add(new LongPoint(field, (Long) fieldValue));
-    } else if (clazz == Integer.class) {
-      doc.add(new IntPoint(field, (Integer) fieldValue));
-    } else if (clazz == Float.class) {
-      doc.add(new FloatPoint(field, (Float) fieldValue));
-    }  else if (clazz == Double.class) {
-        doc.add(new DoublePoint(field, (Double) fieldValue));
-    } else {
-      return false;
-    }
-    
-    return true;
-  }
-
-  /**
-   * Return true if a field type can be written to a lucene document.
-   */
-  public static boolean isSupported(Class<?> type) {
-    return SUPPORTED_PRIMITIVE_TYPES.contains(type);
-  }
-
-  public static Collection<Class> supportedPrimitiveTypes() {
-    return SUPPORTED_PRIMITIVE_TYPES;
-  }
-  
-  /**
-   * Extract the gemfire key from a lucene document
-   */
-  public static Object getKey(Document doc) {
-    IndexableField field = doc.getField(KEY_FIELD);
-    if(field.stringValue() != null) {
-      return field.stringValue();
-    } else {
-      return  keyFromBytes(field.binaryValue());
-    }
-  }
- 
-  /**
-   * Extract the gemfire key term from a lucene document
-   */
-  public static Term getKeyTerm(Document doc) {
-    IndexableField field = doc.getField(KEY_FIELD);
-    if(field.stringValue() != null) {
-      return new Term(KEY_FIELD, field.stringValue());
-    } else {
-      return new Term(KEY_FIELD, field.binaryValue());
-    }
-  }
-  
-  /**
-   * Convert a gemfire key into a key search term that can be used to
-   * update or delete the document associated with this key.
-   */
-  public static Term toKeyTerm(Object key) {
-    if(key instanceof String) {
-      return new Term(KEY_FIELD, (String) key);
-    } else {
-      return new Term(KEY_FIELD, keyToBytes(key));
-    }
-  }
-  
-  private static Object keyFromBytes(BytesRef bytes) {
-    try {
-      return BlobHelper.deserializeBlob(bytes.bytes);
-    } catch (ClassNotFoundException | IOException e) {
-      throw new InternalGemFireError(e);
-    }
-  }
-  
-  /**
-   * Convert a key to a byte array.
-   */
-  private static BytesRef keyToBytes(Object key)  {
-    ByteArrayOutputStream buffer = LOCAL_BUFFER.get();
-    
-    try {
-      DataOutputStream out = new DataOutputStream(buffer);
-      DataSerializer.writeObject(key, out);
-      out.flush();
-      BytesRef result = new BytesRef(buffer.toByteArray());
-      buffer.reset();
-      return result;
-    } catch (IOException e) {
-      throw new InternalGemFireError("Unable to serialize key", e);
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/package-info.java
deleted file mode 100644
index dca7737..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * Classes for converting gemfire objects into lucene documents.
- */
-
-package com.gemstone.gemfire.cache.lucene.internal.repository.serializer;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
deleted file mode 100644
index 98233b0..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.lucene.internal.xml;
-
-import java.util.*;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
-import com.gemstone.gemfire.internal.cache.extension.Extensible;
-import com.gemstone.gemfire.internal.cache.extension.Extension;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
-
-public class LuceneIndexCreation implements LuceneIndex, Extension<Region<?, ?>> {
-  private Region region;
-  private String name;
-  private Set<String> fieldNames = new LinkedHashSet<String>();
-  private Map<String, Analyzer> fieldAnalyzers;
-
-  
-  public void setRegion(Region region) {
-    this.region = region;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public void setFieldAnalyzers(
-      Map<String, Analyzer> fieldAnalyzers) {
-    this.fieldAnalyzers = fieldAnalyzers;
-  }
-  
-  @Override
-  public Map<String, Analyzer> getFieldAnalyzers() {
-    if (this.fieldAnalyzers == null) {
-      this.fieldAnalyzers = new HashMap<>();
-    }
-    return this.fieldAnalyzers;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public String[] getFieldNames() {
-    return fieldNames.toArray(new String[fieldNames.size()]);
-  }
-
-  @Override
-  public String getRegionPath() {
-    return region.getFullPath();
-  }
-
-  @Override
-  public XmlGenerator<Region<?, ?>> getXmlGenerator() {
-    return new LuceneIndexXmlGenerator(this);
-  }
-
-  @Override
-  public void beforeCreate(Extensible<Region<?, ?>> source, Cache cache) {
-    LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
-    Analyzer analyzer = this.fieldAnalyzers == null
-        ? new StandardAnalyzer()
-        : new PerFieldAnalyzerWrapper(new StandardAnalyzer(), this.fieldAnalyzers);
-    service.createIndex(getName(), getRegionPath(), analyzer, this.fieldAnalyzers, getFieldNames());
-  }
-
-  @Override
-  public void onCreate(Extensible<Region<?, ?>> source, Extensible<Region<?, ?>> target) {}
-
-  protected void addField(String name) {
-    this.fieldNames.add(name);
-  }
-
-  protected void addFieldAndAnalyzer(String name, Analyzer analyzer) {
-    this.fieldNames.add(name);
-    getFieldAnalyzers().put(name, analyzer);
-  }
-
-  public void addFieldNames(String[] fieldNames) {
-    this.fieldNames.addAll(Arrays.asList(fieldNames));
-  }
-
-  @Override
-  public boolean waitUntilFlushed(int maxWaitInMillisecond) {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java
deleted file mode 100644
index 37c9ca2..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexXmlGenerator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.lucene.internal.xml;
-
-import static com.gemstone.gemfire.cache.lucene.internal.xml.LuceneXmlConstants.*;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlGeneratorUtils;
-
-public class LuceneIndexXmlGenerator implements XmlGenerator<Region<?, ?>> {
-  private final LuceneIndex index;
-
-  public LuceneIndexXmlGenerator(LuceneIndex index) {
-    this.index = index;
-  }
-
-  @Override
-  public String getNamspaceUri() {
-    return NAMESPACE;
-  }
-
-  @Override
-  public void generate(CacheXmlGenerator cacheXmlGenerator)
-      throws SAXException {
-    final ContentHandler handler = cacheXmlGenerator.getContentHandler();
-
-    handler.startPrefixMapping(PREFIX, NAMESPACE);
-
-    AttributesImpl attr = new AttributesImpl();
-    //TODO - should the type be xs:string ?
-    XmlGeneratorUtils.addAttribute(attr, NAME, index.getName());
-    XmlGeneratorUtils.startElement(handler, PREFIX, INDEX, attr);
-    for(String field : index.getFieldNames()) {
-      AttributesImpl fieldAttr = new AttributesImpl();
-      XmlGeneratorUtils.addAttribute(fieldAttr, NAME, field);
-      Analyzer analyzer = index.getFieldAnalyzers().get(field);
-      if (analyzer != null) {
-        XmlGeneratorUtils.addAttribute(fieldAttr, ANALYZER, analyzer.getClass().getName());
-      }
-      XmlGeneratorUtils.emptyElement(handler, PREFIX, FIELD, fieldAttr);
-    }
-    XmlGeneratorUtils.endElement(handler, PREFIX, INDEX);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java
deleted file mode 100644
index c449f47..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneServiceXmlGenerator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.lucene.internal.xml;
-
-import org.xml.sax.SAXException;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
-
-public final class LuceneServiceXmlGenerator implements XmlGenerator<Cache> {
-  @Override
-  public String getNamspaceUri() {
-    return LuceneXmlConstants.NAMESPACE;
-  }
-
-  @Override
-  public void generate(CacheXmlGenerator cacheXmlGenerator)
-      throws SAXException {
-    //Nothing to to the xml at the service level at the moment.
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlConstants.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlConstants.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlConstants.java
deleted file mode 100644
index 91d1643..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.lucene.internal.xml;
-
-public class LuceneXmlConstants {
-  public static final String NAMESPACE= "http://geode.apache.org/schema/lucene";
-  public static final String PREFIX = "lucene";
-  public static final String SERVICE = "service";
-  public static final String NAME = "name";
-  public static final String REGION = "index";
-  public static final String INDEX = "index";
-  public static final String FIELD = "field";
-  public static final String ANALYZER = "analyzer";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlParser.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlParser.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlParser.java
deleted file mode 100644
index 5bdbe04..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneXmlParser.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.lucene.internal.xml;
-
-import static com.gemstone.gemfire.cache.lucene.internal.xml.LuceneXmlConstants.*;
-
-import com.gemstone.gemfire.cache.CacheXmlException;
-import com.gemstone.gemfire.internal.InternalDataSerializer;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import org.apache.lucene.analysis.Analyzer;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
-import com.gemstone.gemfire.internal.cache.xmlcache.AbstractXmlParser;
-import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
-
-public class LuceneXmlParser extends AbstractXmlParser {
-
-  @Override
-  public String getNamspaceUri() {
-    return NAMESPACE;
-  }
-
-  @Override
-  public void startElement(String uri, String localName, String qName,
-      Attributes atts) throws SAXException {
-    
-    if(!NAMESPACE.equals(uri)) {
-      return;
-    }
-    if(INDEX.equals(localName)) {
-      startIndex(atts);
-    }
-    if(FIELD.equals(localName)) {
-      startField(atts);
-    }
-  }
-
-  private void startField(Attributes atts) {
-    //Ignore any whitespace noise between fields
-    if(stack.peek() instanceof StringBuffer) {
-      stack.pop();
-    }
-    LuceneIndexCreation creation = (LuceneIndexCreation) stack.peek();
-    String name = atts.getValue(NAME);
-    String className = atts.getValue(ANALYZER);
-    if (className == null) {
-      creation.addField(name);
-    } else {
-      Analyzer analyzer = createAnalyzer(className);
-      creation.addFieldAndAnalyzer(name, analyzer);
-    }
-  }
-
-  private void startIndex(Attributes atts) {
-    final RegionCreation region = (RegionCreation) stack.peek();
-    String name = atts.getValue(NAME);
-    LuceneIndexCreation indexCreation = new LuceneIndexCreation();
-    indexCreation.setName(name);
-    indexCreation.setRegion(region);
-    region.getExtensionPoint().addExtension(indexCreation);
-    stack.push(indexCreation);
-  }
-
-  @Override
-  public void endElement(String uri, String localName, String qName)
-      throws SAXException {
-    if(!NAMESPACE.equals(uri)) {
-      return;
-    }
-    if(INDEX.equals(localName)) {
-      endIndex();
-    }
-  }
-
-  private void endIndex() {
-    //Ignore any whitespace noise between fields
-    if(stack.peek() instanceof StringBuffer) {
-      stack.pop();
-    }
-    
-    //Remove the index creation from the stack
-    stack.pop();
-  }
-
-  private Analyzer createAnalyzer(String className) {
-    Object obj;
-    try {
-      Class c = InternalDataSerializer.getCachedClass(className);
-      obj = c.newInstance();
-    }
-    catch (Exception ex) {
-      throw new CacheXmlException(LocalizedStrings.CacheXmlParser_WHILE_INSTANTIATING_A_0.toLocalizedString(className), ex);
-    }
-    if (!(obj instanceof Analyzer)) {
-      throw new CacheXmlException(LocalizedStrings.LuceneXmlParser_CLASS_0_IS_NOT_AN_INSTANCE_OF_ANALYZER.toLocalizedString(className));
-    }
-    return (Analyzer) obj;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/package-info.java
deleted file mode 100644
index 4eb1ca3..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-/**
- * Classes for parsing lucene index elements a cache.xml file. See the lucene-1.0.xsd file for
- * the schema.
- */
-
-package com.gemstone.gemfire.cache.lucene.internal.xml;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/package-info.java
deleted file mode 100644
index 0e0c89b..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/package-info.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-/**
- * This package provides an integration with Apache Lucene that allows Geode regions to be indexed in a distributed
- * Lucene index and queries using Lucene queries.
- * <p>
- * All indexing and query operations are performed through the {@link com.gemstone.gemfire.cache.lucene.LuceneService} class.
- * See {@link com.gemstone.gemfire.cache.lucene.LuceneService} for an example of how to add a lucene index to a geode region.
- * <p>
- *
- * The Lucene indexes created using this API are stored in geode and colocated with the indexed region, which means they
- * have the same availability guarantees as the underlying region. The indexes are maintained asynchronously, so changes
- * to the region may not be immediately visible in the lucene index.
- */
-
-package com.gemstone.gemfire.cache.lucene;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java
new file mode 100644
index 0000000..6b1a4b4
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndex.java
@@ -0,0 +1,66 @@
+/*
+ * 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.lucene;
+
+import java.util.Map;
+
+import org.apache.lucene.analysis.Analyzer;
+
+import com.gemstone.gemfire.annotations.Experimental;
+
+
+/**
+ * An lucene index is built over the data stored in a GemFire Region.
+ * <p>
+ * An index is specified using a index name, field names, region name.
+ * <p>
+ * The index name and region name together uniquely identifies the lucene index.
+ * <p>
+ * 
+ */
+@Experimental
+public interface LuceneIndex {
+
+  /**
+   * @return the index name of this index
+   */
+  public String getName();
+
+  /**
+   * @return the region name for this index
+   */
+  public String getRegionPath();
+      
+  /**
+   * @return the indexed field names in a Set
+   */
+  public String[] getFieldNames();
+  
+  /**
+   * @return the field to analyzer map
+   */
+  public Map<String, Analyzer> getFieldAnalyzers();
+  
+  /* 
+   * wait until the current entries in cache are indexed
+   * @param maxWaitInMilliseconds max wait time in millisecond
+   * @return if entries are flushed within maxWait
+   */
+  public boolean waitUntilFlushed(int maxWaitInMillisecond);
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQuery.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQuery.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQuery.java
new file mode 100644
index 0000000..7cc0977
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQuery.java
@@ -0,0 +1,66 @@
+/*
+ * 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.lucene;
+
+import java.util.Collection;
+import java.util.List;
+
+import com.gemstone.gemfire.annotations.Experimental;
+
+/**
+ * Provides wrapper object of Lucene's Query object and execute the search. 
+ * <p>Instances of this interface are created using
+ * {@link LuceneQueryFactory#create}.
+ * 
+ */
+@Experimental
+public interface LuceneQuery<K, V> {
+  /**
+   * Execute search and return keys.
+   */
+  public Collection<K> findKeys() throws LuceneQueryException;
+
+  /**
+   * Execute search and return values.
+   */
+  public Collection<V> findValues() throws LuceneQueryException;
+
+  /**
+   * Execute search and return list of LuceneResultStruct.
+   */
+  public List<LuceneResultStruct<K, V>> findResults() throws LuceneQueryException;
+  /**
+   * Execute the search and get results. 
+   */
+  public PageableLuceneQueryResults<K, V> findPages() throws LuceneQueryException;
+  
+  /**
+   * Get page size setting of current query. 
+   */
+  public int getPageSize();
+  
+  /**
+   * Get limit size setting of current query. 
+   */
+  public int getLimit();
+
+  /**
+   * Get projected fields setting of current query. 
+   */
+  public String[] getProjectedFieldNames();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryException.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryException.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryException.java
new file mode 100644
index 0000000..fb03b4a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryException.java
@@ -0,0 +1,40 @@
+/*
+ * 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.lucene;
+
+import com.gemstone.gemfire.GemFireCheckedException;
+
+/**
+ * Thrown when a lucene query fails.
+ */
+public class LuceneQueryException extends GemFireCheckedException {
+
+  public LuceneQueryException(final String message) {
+    super(message);
+  }
+
+  public LuceneQueryException(final String message, final Throwable cause) {
+    super(message, cause);
+  }
+
+  public LuceneQueryException(final Throwable cause) {
+    super(cause);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
new file mode 100644
index 0000000..8e36bbb
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
@@ -0,0 +1,98 @@
+/*
+ * 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.lucene;
+
+import org.apache.lucene.queryparser.classic.ParseException;
+
+import com.gemstone.gemfire.annotations.Experimental;
+
+/**
+ * Factory for creating instances of {@link LuceneQuery}.
+ * To get an instance of this factory call {@link LuceneService#createLuceneQueryFactory}.
+ * <P>
+ * To use this factory configure it with the <code>set</code> methods and then
+ * call {@link #create} to produce a {@link LuceneQuery} instance.
+ * 
+ */
+@Experimental
+public interface LuceneQueryFactory {
+  
+  /**
+   * Default query result limit is 100
+   */
+  public static final int DEFAULT_LIMIT = 100;
+  
+  /**
+   *  Default page size of result is 0, which means no pagination
+   */
+  public static final int DEFAULT_PAGESIZE = 0;
+  
+  /**
+   * Set page size for a query result. The default page size is 0 which means no pagination.
+   * If specified negative value, throw IllegalArgumentException
+   * @param pageSize
+   * @return itself
+   */
+  LuceneQueryFactory setPageSize(int pageSize);
+  
+  /**
+   * Set max limit of result for a query
+   * If specified limit is less or equal to zero, throw IllegalArgumentException
+   * @param limit
+   * @return itself
+   */
+  LuceneQueryFactory setResultLimit(int limit);
+  
+  /**
+   * Set a list of fields for result projection.
+   * 
+   * @param fieldNames
+   * @return itself
+   * 
+   * @deprecated TODO This feature is not yet implemented
+   */
+  @Deprecated
+  LuceneQueryFactory setProjectionFields(String... fieldNames);
+  
+  /**
+   * Create wrapper object for lucene's QueryParser object using default standard analyzer.
+   * The queryString is using lucene QueryParser's syntax. QueryParser is for easy-to-use 
+   * with human understandable syntax. 
+   *  
+   * @param regionName region name
+   * @param indexName index name
+   * @param queryString query string in lucene QueryParser's syntax
+   * @param defaultField default field used by the Lucene Query Parser
+   * @param <K> the key type in the query results
+   * @param <V> the value type in the query results
+   * @return LuceneQuery object
+   */
+  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, String queryString, String defaultField);
+
+  /**
+   * Creates a wrapper object for Lucene's Query object. This {@link LuceneQuery} builder method could be used in
+   * advanced cases, such as cases where Lucene's Query object construction needs Lucene's API over query string.
+   * 
+   * @param indexName index name
+   * @param regionName region name
+   * @param provider constructs and provides a Lucene Query object
+   * @param <K> the key type in the query results
+   * @param <V> the value type in the query results
+   * @return LuceneQuery object
+   */
+  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, LuceneQueryProvider provider);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryProvider.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryProvider.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryProvider.java
new file mode 100644
index 0000000..7f1c269
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryProvider.java
@@ -0,0 +1,47 @@
+/*
+ * 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.lucene;
+
+import java.io.Serializable;
+
+import org.apache.lucene.search.Query;
+
+import com.gemstone.gemfire.annotations.Experimental;
+import com.gemstone.gemfire.cache.query.QueryException;
+
+/**
+ * The instances of this class will be used for distributing Lucene Query objects and re-constructing the Query object.
+ * If necessary the implementation needs to take care of serializing and de-serializing Lucene Query object. Geode
+ * respects the DataSerializable contract to provide optimal object serialization. For instance,
+ * {@link LuceneQueryProvider}'s toData method will be used to serialize it when it is sent to another member of the
+ * distributed system. Implementation of DataSerializable can provide a zero-argument constructor that will be invoked
+ * when they are read with DataSerializer.readObject.
+ */
+@Experimental
+public interface LuceneQueryProvider extends Serializable {
+  /**
+   * @return A Lucene Query object which could be used for executing Lucene Search on indexed data
+   * @param index local lucene index the query is being constructed against.
+   * @throws LuceneQueryException if the provider fails to construct the query object
+   */
+
+  public Query getQuery(LuceneIndex index) throws LuceneQueryException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneResultStruct.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneResultStruct.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneResultStruct.java
new file mode 100644
index 0000000..bc587f5
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneResultStruct.java
@@ -0,0 +1,61 @@
+/*
+ * 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.lucene;
+
+import com.gemstone.gemfire.annotations.Experimental;
+
+/**
+ * <p>
+ * Abstract data structure for one item in query result.
+ * 
+ */
+@Experimental
+public interface LuceneResultStruct<K, V> {
+  /**
+   * Return the value associated with the given field name
+   *
+   * @param fieldName the String name of the field
+   * @return the value associated with the specified field
+   * @throws IllegalArgumentException If this struct does not have a field named fieldName
+   */
+  public Object getProjectedField(String fieldName);
+  
+  /**
+   * Return key of the entry
+   *
+   * @return key
+   * @throws IllegalArgumentException If this struct does not contain key
+   */
+  public K getKey();
+  
+  /**
+   * Return value of the entry
+   *
+   * @return value the whole domain object
+   * @throws IllegalArgumentException If this struct does not contain value
+   */
+  public V getValue();
+  
+  /**
+   * Return score of the query 
+   *
+   * @return score
+   * @throws IllegalArgumentException If this struct does not contain score
+   */
+  public float getScore();
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java
new file mode 100644
index 0000000..cf1f735
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneService.java
@@ -0,0 +1,129 @@
+/*
+ * 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.lucene;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.lucene.analysis.Analyzer;
+
+import com.gemstone.gemfire.annotations.Experimental;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
+
+/**
+ * LuceneService instance is a singleton for each cache.
+ * 
+ * It provides handle for managing the {@link LuceneIndex} and create the {@link LuceneQuery}
+ * via {@link LuceneQueryFactory}
+ * 
+ * </p>
+ * Example: <br>
+ * 
+ * <pre>
+ * At client and server JVM, initializing cache will create the LuceneServiceImpl object, 
+ * which is a singleton at each JVM. 
+ * 
+ * At each server JVM, for data region to create index, create the index on fields with default analyzer:
+ * LuceneIndex index = luceneService.createIndex(indexName, regionName, "field1", "field2", "field3"); 
+ * or create index on fields with specified analyzer:
+ * LuceneIndex index = luceneService.createIndex(indexName, regionName, analyzerPerField);
+ * 
+ * We can also create index via cache.xml or gfsh.
+ * 
+ * At client side, create query and run the search:
+ * 
+ * LuceneQuery query = luceneService.createLuceneQueryFactory().setLimit(200).setPageSize(20)
+ * .setResultTypes(SCORE, VALUE, KEY).setFieldProjection("field1", "field2")
+ * .create(indexName, regionName, querystring, analyzer);
+ * 
+ * The querystring is using lucene's queryparser syntax, such as "field1:zhou* AND field2:gzhou@pivotal.io"
+ *  
+ * PageableLuceneQueryResults results = query.search();
+ * 
+ * If pagination is not specified:
+ * List list = results.getNextPage(); // return all results in one getNextPage() call
+ * or if paging is specified:
+ * if (results.hasNextPage()) {
+ *   List page = results.nextPage(); // return resules page by page
+ * }
+ * 
+ * The item of the list is either the domain object or instance of {@link LuceneResultStruct}
+ * </pre>
+ * 
+ *
+ */
+@Experimental
+public interface LuceneService {
+
+  /**
+   * A special field name that indicates that the entire region value should
+   * be indexed. This will only work if the region value is a String or Number, in
+   * which case a lucene document will be created with a single field with this name.
+   */
+  String REGION_VALUE_FIELD = "__REGION_VALUE_FIELD";
+
+  /**
+   * Create a lucene index using default analyzer.
+   * @param fields The fields of the object to index. Only fields listed here will be stored
+   * in the index. Fields should map to PDX fieldNames if the object is serialized with PDX, or
+   * to java fields on the object otherwise. The special field name {{@link #REGION_VALUE_FIELD}}
+   * indicates that the entire value should be stored as a single field in the index.
+   */
+  public void createIndex(String indexName, String regionPath, String... fields);
+  
+  /**
+   * Create a lucene index using specified analyzer per field
+   * 
+   * @param indexName index name
+   * @param regionPath region name
+   * @param analyzerPerField A map of fields to analyzers. See {{@link #createIndex(String, String, String...)}}
+   * for details on valid values for fields. Each field will be tokenized using the provided Analyzer.
+   */
+  public void createIndex(String indexName, String regionPath,
+      Map<String, Analyzer> analyzerPerField);
+
+  /**
+   * Destroy the lucene index
+   * 
+   * @param index index object
+   * @deprecated TODO This feature is not yet implemented
+   */
+  @Deprecated
+  public void destroyIndex(LuceneIndex index);
+  
+  /**
+   * Get the lucene index object specified by region name and index name
+   * @param indexName index name
+   * @param regionPath region name
+   * @return LuceneIndex object
+   */
+  public LuceneIndex getIndex(String indexName, String regionPath);
+  
+  /**
+   * get all the lucene indexes.
+   * @return all index objects in a Collection
+   */
+  public Collection<LuceneIndex> getAllIndexes();
+
+  /**
+   * create LuceneQueryFactory
+   * @return LuceneQueryFactory object
+   */
+  public LuceneQueryFactory createLuceneQueryFactory();
+
+ }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneServiceProvider.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneServiceProvider.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneServiceProvider.java
new file mode 100644
index 0000000..f83dffa
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneServiceProvider.java
@@ -0,0 +1,45 @@
+/*
+ * 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.lucene;
+
+import com.gemstone.gemfire.annotations.Experimental;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneService;
+import com.gemstone.gemfire.internal.cache.InternalCache;
+
+/**
+ * Class for retrieving or creating the currently running
+ * instance of the LuceneService.
+ *
+ */
+@Experimental
+public class LuceneServiceProvider {
+  /**
+   * Retrieve or create the lucene service for this cache
+   */
+  public static LuceneService get(GemFireCache cache) {
+    InternalCache internalCache = (InternalCache) cache;
+    return internalCache.getService(InternalLuceneService.class);
+  }
+
+  private LuceneServiceProvider() {
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/PageableLuceneQueryResults.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/PageableLuceneQueryResults.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/PageableLuceneQueryResults.java
new file mode 100644
index 0000000..c2def44
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/PageableLuceneQueryResults.java
@@ -0,0 +1,58 @@
+/*
+ * 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.lucene;
+
+import java.util.Iterator;
+import java.util.List;
+
+import com.gemstone.gemfire.annotations.Experimental;
+
+/**
+ * <p>
+ * Defines the interface for a container of lucene query result collected from function execution.<br>
+ * 
+ * 
+ * @param <K> The type of the key
+ * @param <V> The type of the value
+ */
+@Experimental
+public interface PageableLuceneQueryResults<K, V> extends Iterator<List<LuceneResultStruct<K,V>>> {
+  /**
+   * @return total number of hits for this query
+   */
+  public int size();
+
+  /**
+   * Returns the maximum score value encountered. Note that in case scores are not tracked, this returns {@link Float#NaN}.
+   */
+  public float getMaxScore();
+
+  /**
+   * Get the next page of results.
+   * 
+   * @return a page of results, or null if there are no more pages
+   */
+  public List<LuceneResultStruct<K, V>> next();
+
+  /**
+   *  True if there another page of results. 
+   */
+  public boolean hasNext();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
new file mode 100755
index 0000000..1dc716c
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/AbstractPartitionedRepositoryManager.java
@@ -0,0 +1,124 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.BucketRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.execute.InternalRegionFunctionContext;
+
+public abstract class AbstractPartitionedRepositoryManager implements RepositoryManager {
+
+  /** map of the parent bucket region to the index repository
+   * 
+   * This is based on the BucketRegion in case a bucket is rebalanced, we don't want to 
+   * return a stale index repository. If a bucket moves off of this node and
+   * comes back, it will have a new BucketRegion object.
+   * 
+   * It is weak so that the old BucketRegion will be garbage collected. 
+   */
+  protected final ConcurrentHashMap<Integer, IndexRepository> indexRepositories = new ConcurrentHashMap<Integer, IndexRepository>();
+  
+  /** The user region for this index */
+  protected final PartitionedRegion userRegion;
+  protected final LuceneSerializer serializer;
+  protected final LuceneIndexImpl index; 
+
+  public AbstractPartitionedRepositoryManager(
+      LuceneIndexImpl index,
+      LuceneSerializer serializer) {
+    this.index = index;
+    this.userRegion = (PartitionedRegion)index.getCache().getRegion(index.getRegionPath());
+    this.serializer = serializer;
+  }
+
+  @Override
+  public IndexRepository getRepository(Region region, Object key,
+      Object callbackArg) throws BucketNotFoundException {
+    BucketRegion userBucket = userRegion.getBucketRegion(key, callbackArg);
+    if(userBucket == null) {
+      throw new BucketNotFoundException("User bucket was not found for region " + region + "key " +  key + " callbackarg " + callbackArg);
+    }
+    
+    return getRepository(userBucket.getId());
+  }
+
+  @Override
+  public Collection<IndexRepository> getRepositories(RegionFunctionContext ctx) throws BucketNotFoundException {
+    Region<Object, Object> region = ctx.getDataSet();
+    Set<Integer> buckets = ((InternalRegionFunctionContext) ctx).getLocalBucketSet(region);
+    ArrayList<IndexRepository> repos = new ArrayList<IndexRepository>(buckets.size());
+    for(Integer bucketId : buckets) {
+      BucketRegion userBucket = userRegion.getDataStore().getLocalBucketById(bucketId);
+      if(userBucket == null) {
+        throw new BucketNotFoundException("User bucket was not found for region " + region + "bucket id " + bucketId);
+      } else {
+        repos.add(getRepository(userBucket.getId()));
+      }
+    }
+
+    return repos;
+  }
+
+  public abstract IndexRepository createOneIndexRepository(final Integer bucketId,
+      LuceneSerializer serializer,
+      LuceneIndexImpl index, PartitionedRegion userRegion) throws IOException;
+  
+  /**
+   * Return the repository for a given user bucket
+   */
+  protected IndexRepository getRepository(Integer bucketId) throws BucketNotFoundException {
+    IndexRepository repo = indexRepositories.get(bucketId);
+    if(repo != null && !repo.isClosed()) {
+      return repo;
+    }
+
+    repo = indexRepositories.compute(bucketId, (key, oldRepository) -> {
+      if(oldRepository != null && !oldRepository.isClosed()) {
+        return oldRepository;
+      }
+      if(oldRepository != null) {
+        oldRepository.cleanup();
+      }
+
+      try {
+        return createOneIndexRepository(bucketId, serializer, index, userRegion);
+      } catch(IOException e) {
+        throw new InternalGemFireError("Unable to create index repository", e);
+      }
+
+    });
+
+    if(repo == null) {
+      throw new BucketNotFoundException("Colocated index buckets not found for bucket id " + bucketId);
+    }
+
+    return repo;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListener.java
new file mode 100644
index 0000000..c9c03a5
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListener.java
@@ -0,0 +1,35 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import org.apache.lucene.analysis.Analyzer;
+
+import java.util.Map;
+
+public interface IndexListener {
+
+  public void beforeIndexCreated(final String indexName, String regionPath,
+      final Analyzer analyzer, final Map<String, Analyzer> fieldAnalyzers,
+      final String... fields);
+
+  public void afterIndexCreated(LuceneIndex index);
+
+  public void beforeIndexDestroyed(LuceneIndex index);
+
+  public void afterIndexDestroyed(LuceneIndex index);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListenerAdapter.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListenerAdapter.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListenerAdapter.java
new file mode 100644
index 0000000..dd916ac
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexListenerAdapter.java
@@ -0,0 +1,41 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import org.apache.lucene.analysis.Analyzer;
+
+import java.util.Map;
+
+public class IndexListenerAdapter implements IndexListener {
+  @Override
+  public void beforeIndexCreated(String indexName, String regionPath, Analyzer analyzer,
+      Map<String, Analyzer> fieldAnalyzers, String... fields) {
+  }
+
+  @Override
+  public void afterIndexCreated(LuceneIndex index) {
+  }
+
+  @Override
+  public void beforeIndexDestroyed(LuceneIndex index) {
+  }
+
+  @Override
+  public void afterIndexDestroyed(LuceneIndex index) {
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
new file mode 100644
index 0000000..e6f01b0
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java
@@ -0,0 +1,66 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.IOException;
+
+import com.gemstone.gemfire.cache.lucene.internal.directory.RegionDirectory;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepositoryImpl;
+import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.BucketRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+
+public class IndexRepositoryFactory {
+
+  public IndexRepositoryFactory() {
+  }
+
+  public IndexRepository createIndexRepository(final Integer bucketId,
+                                        LuceneSerializer serializer,
+                                        LuceneIndexImpl index, PartitionedRegion userRegion)
+    throws IOException
+  {
+    final IndexRepository repo;
+    LuceneIndexForPartitionedRegion indexForPR = (LuceneIndexForPartitionedRegion)index; 
+    BucketRegion fileBucket = getMatchingBucket(indexForPR.getFileRegion(), bucketId);
+    BucketRegion chunkBucket = getMatchingBucket(indexForPR.getChunkRegion(), bucketId);
+    BucketRegion dataBucket = getMatchingBucket(userRegion, bucketId);
+    if(fileBucket == null || chunkBucket == null) {
+      return null;
+    }
+    RegionDirectory dir = new RegionDirectory(fileBucket, chunkBucket, indexForPR.getFileSystemStats());
+    IndexWriterConfig config = new IndexWriterConfig(indexForPR.getAnalyzer());
+    IndexWriter writer = new IndexWriter(dir, config);
+    repo = new IndexRepositoryImpl(fileBucket, writer, serializer, indexForPR.getIndexStats(), dataBucket);
+    return repo;
+  }
+
+  /**
+   * Find the bucket in region2 that matches the bucket id from region1.
+   */
+  protected BucketRegion getMatchingBucket(PartitionedRegion region, Integer bucketId) {
+    //Force the bucket to be created if it is not already
+    region.getOrCreateNodeForBucketWrite(bucketId, null);
+
+    return region.getDataStore().getLocalBucketById(bucketId);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneIndex.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneIndex.java
new file mode 100644
index 0000000..27b4820
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneIndex.java
@@ -0,0 +1,34 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+
+public interface InternalLuceneIndex extends LuceneIndex {
+  
+  public RepositoryManager getRepositoryManager();
+
+  /**
+   * Dump the files for this index to the given directory.
+   */
+  public void dumpFiles(String directory);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneService.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneService.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneService.java
new file mode 100644
index 0000000..403853e
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/InternalLuceneService.java
@@ -0,0 +1,29 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.internal.cache.CacheService;
+import com.gemstone.gemfire.internal.cache.extension.Extension;
+
+public interface InternalLuceneService extends LuceneService, Extension<Cache>, CacheService {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
new file mode 100644
index 0000000..29fb159
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneEventListener.java
@@ -0,0 +1,107 @@
+/*
+ * 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.lucene.internal;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
+import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
+import com.gemstone.gemfire.internal.cache.PrimaryBucketException;
+import com.gemstone.gemfire.internal.cache.partitioned.Bucket;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy.TestHook;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * An Async event queue listener that writes all of the
+ * events in batches to Lucene
+ */
+public class LuceneEventListener implements AsyncEventListener {
+  Logger logger = LogService.getLogger();
+
+  private final RepositoryManager repositoryManager;
+  
+  public LuceneEventListener(RepositoryManager repositoryManager) {
+    this.repositoryManager = repositoryManager;
+  }
+
+  @Override
+  public void close() {
+  }
+
+  @Override
+  public boolean processEvents(List<AsyncEvent> events) {
+    // Try to get a PDX instance if possible, rather than a deserialized object
+    DefaultQuery.setPdxReadSerialized(true);
+
+    Set<IndexRepository> affectedRepos = new HashSet<IndexRepository>();
+
+    try {
+      for (AsyncEvent event : events) {
+        Region region = event.getRegion();
+        Object key = event.getKey();
+        Object callbackArgument = event.getCallbackArgument();
+
+        IndexRepository repository = repositoryManager.getRepository(region, key, callbackArgument);
+
+        Operation op = event.getOperation();
+
+        if (op.isCreate()) {
+          repository.update(key, event.getDeserializedValue());
+        } else if (op.isUpdate()) {
+          repository.update(key, event.getDeserializedValue());
+        } else if (op.isDestroy()) {
+          repository.delete(key);
+        } else if (op.isInvalidate()) {
+          repository.delete(key);
+        } else {
+          throw new InternalGemFireError("Unhandled operation " + op + " on " + event.getRegion());
+        }
+        affectedRepos.add(repository);
+      }
+
+      for(IndexRepository repo : affectedRepos) {
+        repo.commit();
+      }
+      return true;
+    } catch(BucketNotFoundException | RegionDestroyedException | PrimaryBucketException e) {
+      logger.debug("Bucket not found while saving to lucene index: " + e.getMessage());
+      return false;
+    } catch(IOException e) {
+      logger.error("Unable to save to lucene index", e);
+      return false;
+    } finally {
+      DefaultQuery.setPdxReadSerialized(false);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
new file mode 100644
index 0000000..de331ea
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
@@ -0,0 +1,172 @@
+/*
+ * 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.lucene.internal;
+
+import com.gemstone.gemfire.DataSerializable;
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.cache.CacheServiceProfile;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.*;
+
+public class LuceneIndexCreationProfile implements CacheServiceProfile, DataSerializable {
+
+  private String indexName;
+
+  private String[] fieldNames;
+
+  private String analyzerClass;
+
+  private Map<String, String> fieldAnalyzers;
+
+  private String regionPath;
+
+  /* Used by DataSerializer */
+  public LuceneIndexCreationProfile() {}
+
+  public LuceneIndexCreationProfile(String indexName, String regionPath, String[] fieldNames, Analyzer analyzer,
+                                    Map<String, Analyzer> fieldAnalyzers) {
+    this.indexName = indexName;
+    this.regionPath = regionPath;
+    this.fieldNames = fieldNames;
+    this.analyzerClass = analyzer.getClass().getSimpleName();
+    initializeFieldAnalyzers(fieldAnalyzers);
+  }
+
+  public String getIndexName() {
+    return this.indexName;
+  }
+
+  public String[] getFieldNames() {
+    return this.fieldNames;
+  }
+
+  public String getAnalyzerClass() {
+    return this.analyzerClass;
+  }
+
+  public Map<String, String> getFieldAnalyzers() {
+    return this.fieldAnalyzers;
+  }
+
+  protected void initializeFieldAnalyzers(Map<String, Analyzer> fieldAnalyzers) {
+    this.fieldAnalyzers = new HashMap<>();
+    for (String field : fieldNames) {
+     if(fieldAnalyzers != null && !fieldAnalyzers.isEmpty())  {
+        this.fieldAnalyzers.put(field, fieldAnalyzers.get(field) == null ? StandardAnalyzer.class.getSimpleName() : fieldAnalyzers.get(field).getClass().getSimpleName());
+      } else {
+        this.fieldAnalyzers.put(field, StandardAnalyzer.class.getSimpleName());
+      }
+    }
+  }
+
+  @Override
+  public String getId() {
+    return "lucene_"+LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
+  }
+
+  @Override
+  public String checkCompatibility(String regionPath, CacheServiceProfile profile) {
+    String result = null;
+    LuceneIndexCreationProfile remoteProfile = (LuceneIndexCreationProfile) profile;
+    if (remoteProfile == null) {
+      // TODO This can occur if one member defines no indexes but another one does. Currently this is caught by the async event id checks.
+    } else {
+      // Verify fields are the same
+      if (!Arrays.equals(remoteProfile.getFieldNames(), getFieldNames())) {
+        return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
+            .toString(getIndexName(), regionPath, Arrays.toString(getFieldNames()), Arrays.toString(remoteProfile.getFieldNames()));
+      }
+
+      // Verify the analyzer class is the same
+      // Note: This test will currently only fail if per-field analyzers are used in one member but not another,
+      // This condition will be caught in the tests below so this test is commented out. If we ever allow the user
+      // to configure a single analyzer for all fields, then this test will be useful again.
+      /*
+      if (!remoteLuceneIndexProfile.getAnalyzerClass().isInstance(getAnalyzer())) {
+        result = LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_3
+            .toString(indexName, regionPath, remoteLuceneIndexProfile.getAnalyzerClass().getName(), analyzer.getClass().getName());
+      }
+      */
+
+      // Iterate the existing analyzers and compare them to the input analyzers
+      // Note: This is currently destructive to the input field analyzers map which should be ok since its a transient object.
+      if (!getFieldAnalyzers().equals(remoteProfile.getFieldAnalyzers())) {
+        if (getFieldAnalyzers().size() != remoteProfile.getFieldAnalyzers().size()) {
+          return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
+              .toString(getIndexName(), regionPath, 
+                  Arrays.toString(getFieldAnalyzers().keySet().toArray()),
+                  Arrays.toString(remoteProfile.getFieldAnalyzers().keySet().toArray()));
+        }
+        // now the 2 maps should have the same size
+        for (String field:getFieldAnalyzers().keySet()) {
+          if (!remoteProfile.getFieldAnalyzers().get(field).equals(getFieldAnalyzers().get(field))) {
+            return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_ON_FIELD_3_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_4_ON_THAT_FIELD
+              .toString(getIndexName(), regionPath,
+                    getFieldAnalyzers().get(field), field,
+                    remoteProfile.getFieldAnalyzers().get(field)); 
+          }
+        }
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeString(this.indexName, out);
+    DataSerializer.writeString(this.regionPath, out);
+    DataSerializer.writeStringArray(this.fieldNames, out);
+    DataSerializer.writeString(this.analyzerClass, out);
+    DataSerializer.writeHashMap(this.fieldAnalyzers, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.indexName = DataSerializer.readString(in);
+    this.regionPath = DataSerializer.readString(in);
+    this.fieldNames = DataSerializer.readStringArray(in);
+    this.analyzerClass = DataSerializer.readString(in);
+    this.fieldAnalyzers = DataSerializer.readHashMap(in);
+  }
+
+  public String toString() {
+    return new StringBuilder()
+        .append(getClass().getSimpleName())
+        .append("[")
+        .append("indexName=")
+        .append(this.indexName)
+        .append("; fieldNames=")
+        .append(Arrays.toString(this.fieldNames))
+        .append("; analyzerClass=")
+        .append(this.analyzerClass)
+        .append("; fieldAnalyzers=")
+        .append(this.fieldAnalyzers)
+        .append("]")
+        .toString();
+  }
+
+  public String getRegionPath() {
+    return this.regionPath;
+  }
+}



[28/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
deleted file mode 100644
index b754254..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * 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.internal.cache.wan.parallel;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import static com.gemstone.gemfire.test.dunit.Wait.*;
-import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class ParallelWANStatsDUnitTest extends WANTestBase{
-  
-  private static final int NUM_PUTS = 100;
-  private static final long serialVersionUID = 1L;
-  
-  private String testName;
-  
-  public ParallelWANStatsDUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    this.testName = getTestMethodName();
-  }
-  
-  @Test
-  public void testPartitionedRegionParallelPropagation_BeforeDispatch() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSendersWithConflation(lnPort);
-
-    createSenderPRs(0);
-
-    startPausedSenders();
-    
-    createReceiverPR(vm2, 1);
-    createReceiverPR(vm3, 1);
-
-    putKeyValues();
-
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", NUM_PUTS ));
-    
-    assertEquals(NUM_PUTS, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
-    assertEquals(NUM_PUTS, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
-    assertEquals(NUM_PUTS, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
-    assertEquals(0, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
-    assertEquals(0, v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4)); //batches distributed
-    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
-    
-  }
-
-  @Test
-  public void testPartitionedRegionParallelPropagation_AfterDispatch_NoRedundancy() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-
-    createSenders(lnPort);
-
-    createReceiverPR(vm2, 0);
-   
-    createSenderPRs(0);
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.doPuts( testName,
-        NUM_PUTS ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, NUM_PUTS ));
-    
-    
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    
-    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
-    assertEquals(NUM_PUTS, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
-    assertEquals(NUM_PUTS, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
-    assertEquals(NUM_PUTS, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
-    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 10); //batches distributed
-    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
-  }
-  
-  @Test
-  public void testPartitionedRegionParallelPropagation_AfterDispatch_Redundancy_3() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-
-    createSenders(lnPort);
-
-    createReceiverPR(vm2, 0);
-
-    createSenderPRs(3);
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.doPuts( testName,
-        NUM_PUTS ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, NUM_PUTS ));
-    
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    
-    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
-    assertEquals(400, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
-    assertEquals(400, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
-    assertEquals(NUM_PUTS, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
-    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 10); //batches distributed
-    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
-  }
-  
-  @Test
-  public void testWANStatsTwoWanSites_Bug44331() throws Exception {
-    Integer lnPort = createFirstLocatorWithDSId(1);
-    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createCacheInVMs(tkPort, vm3);
-    createReceiverInVMs(vm2);
-    createReceiverInVMs(vm3);
-
-    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln1",
-        2, true, 100, 10, false, false, null, true ));
-  
-    vm4.invoke(() -> WANTestBase.createSender( "ln2",
-        3, true, 100, 10, false, false, null, true ));
-  
-    createReceiverPR(vm2, 0);
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      testName, null, 0, 10, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      testName, "ln1,ln2", 0, 10, isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.startSender( "ln1" ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln2" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( testName,
-        NUM_PUTS ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, NUM_PUTS ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        testName, NUM_PUTS ));
-    
-    ArrayList<Integer> v4Sender1List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln1", 0 ));
-    ArrayList<Integer> v4Sender2List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln2", 0 ));
-    
-    assertEquals(0, v4Sender1List.get(0).intValue()); //queue size
-    assertEquals(NUM_PUTS, v4Sender1List.get(1).intValue()); //eventsReceived
-    assertEquals(NUM_PUTS, v4Sender1List.get(2).intValue()); //events queued
-    assertEquals(NUM_PUTS, v4Sender1List.get(3).intValue()); //events distributed
-    assertTrue(v4Sender1List.get(4).intValue()>=10); //batches distributed
-    assertEquals(0, v4Sender1List.get(5).intValue()); //batches redistributed
-    
-    assertEquals(0, v4Sender2List.get(0).intValue()); //queue size
-    assertEquals(NUM_PUTS, v4Sender2List.get(1).intValue()); //eventsReceived
-    assertEquals(NUM_PUTS, v4Sender2List.get(2).intValue()); //events queued
-    assertEquals(NUM_PUTS, v4Sender2List.get(3).intValue()); //events distributed
-    assertTrue(v4Sender2List.get(4).intValue()>=10); //batches distributed
-    assertEquals(0, v4Sender2List.get(5).intValue()); //batches redistributed
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
-    vm3.invoke(() -> WANTestBase.checkGatewayReceiverStats(10, NUM_PUTS, NUM_PUTS ));
-  }
-  
-  @Test
-  public void testParallelPropagationHA() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-
-    createSenders(lnPort);
-    
-    createReceiverPR(vm2, 0);
-    
-    createSenderPRs(3);
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( testName, 1000 ));
-    pause(200);
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    inv1.join();
-    inv2.join();
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, 1000 ));
-    
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0));
-    
-    assertEquals(0, v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
-    int receivedEvents = v5List.get(1) + v6List.get(1) + v7List.get(1);
-    //We may see a single retried event on all members due to the kill
-    assertTrue("Received " + receivedEvents, 3000 <= receivedEvents && 3003 >= receivedEvents); //eventsReceived
-    int queuedEvents = v5List.get(2) + v6List.get(2) + v7List.get(2);
-    assertTrue("Queued " + queuedEvents, 3000 <= queuedEvents && 3003 >= queuedEvents); //eventsQueued
-    //assertTrue(10000 <= v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed : its quite possible that vm4 has distributed some of the events
-    //assertTrue(v5List.get(4) + v6List.get(4) + v7List.get(4) > 1000); //batches distributed : its quite possible that vm4 has distributed some of the batches.
-    assertEquals(0, v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
-  
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStatsHA(NUM_PUTS, 1000, 1000 ));
-  }
-
-  /**
-   * 1 region and sender configured on local site and 1 region and a 
-   * receiver configured on remote site. Puts to the local region are in progress.
-   * Remote region is destroyed in the middle.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithRemoteRegionDestroy() throws Exception {
-    addIgnoredException("RegionDestroyedException");
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createReceiverPR(vm2, 0);
-    createReceiverInVMs(vm2);
-
-    createSenders(lnPort);
-
-    vm2.invoke(() -> WANTestBase.addCacheListenerAndDestroyRegion(
-        testName));
-
-    createSenderPRs(0);
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //start puts in RR_1 in another thread
-    vm4.invoke(() -> WANTestBase.doPuts( testName, 2000 ));
-    
-    //verify that all is well in local site. All the events should be present in local region
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        testName, 2000 ));
-    
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", -1));
-    
-    
-    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 1); //batches distributed : its quite possible that vm4 has distributed some of the batches.
-    assertTrue(v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5) >= 1); //batches redistributed
-  }
-
-  @Test
-  public void testParallelPropagationWithFilter() throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-
-    createReceiverPR(vm2, 1);
-
-    createReceiverInVMs(vm2);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    createSenderPRs(0);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false,
-        new MyGatewayEventFilter(), true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false,
-      new MyGatewayEventFilter(), true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false,
-      new MyGatewayEventFilter(), true ));
-  
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-
-    
-    vm4.invoke(() -> WANTestBase.doPuts( testName, 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, 800 ));
-    
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-
-    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
-    assertEquals(1000, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
-    assertEquals(900, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
-    assertEquals(800, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
-    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 80); //batches distributed
-    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
-    assertEquals(200, v4List.get(6) + v5List.get(6) + v6List.get(6) + v7List.get(6)); //events filtered
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(80, 800, 800));
-  }
-  
-  @Test
-  public void testParallelPropagationConflation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    createReceiverInVMs(vm2);
-
-    createSendersWithConflation(lnPort);
-
-    createSenderPRs(0);
-
-    startPausedSenders();
-
-    createReceiverPR(vm2, 1);
-
-    Map keyValues = putKeyValues();
-    final Map updateKeyValues = new HashMap();
-    for(int i=0;i<50;i++) {
-      updateKeyValues.put(i, i+"_updated");
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() /*creates aren't conflated*/ ));
-    
-    // Do the puts again. Since these are updates, the previous updates will be conflated.
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, updateKeyValues ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() + updateKeyValues.size() /*creates aren't conflated*/ ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, 0 ));
-
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 0, 0));
-    
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-
-    keyValues.putAll(updateKeyValues);
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        testName, keyValues.size() ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionContents(
-        testName, keyValues ));
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 150, NUM_PUTS));
-    
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 0 ));
-    
-    ArrayList<Integer> v4List = (ArrayList<Integer>)vm4.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v5List = (ArrayList<Integer>)vm5.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v6List = (ArrayList<Integer>)vm6.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    ArrayList<Integer> v7List = (ArrayList<Integer>)vm7.invoke(() -> WANTestBase.getSenderStats( "ln", 0 ));
-    
-    assertEquals(0, v4List.get(0) + v5List.get(0) + v6List.get(0) + v7List.get(0) ); //queue size
-    assertEquals(200, v4List.get(1) + v5List.get(1) + v6List.get(1) + v7List.get(1)); //eventsReceived
-    assertEquals(200, v4List.get(2) + v5List.get(2) + v6List.get(2) + v7List.get(2)); //events queued
-    assertEquals(150, v4List.get(3) + v5List.get(3) + v6List.get(3) + v7List.get(3)); //events distributed
-    assertTrue(v4List.get(4) + v5List.get(4) + v6List.get(4) + v7List.get(4) >= 10); //batches distributed
-    assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) + v7List.get(5)); //batches redistributed
-    assertEquals(50, v4List.get(7) + v5List.get(7) + v6List.get(7) + v7List.get(7)); //events conflated 
-    
-  }
-  
-  protected Map putKeyValues() {
-    final Map keyValues = new HashMap();
-    for(int i=0; i< NUM_PUTS; i++) {
-      keyValues.put(i, i);
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( testName, keyValues ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", keyValues.size() ));
-    
-    return keyValues;
-  }
-
-  protected void createReceiverPR(VM vm, int redundancy) {
-    vm.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, null, redundancy, 10, isOffHeap() ));
-  }
-  
-  protected void createSenderPRs(int redundancy) {
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", redundancy, 10, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", redundancy, 10, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", redundancy, 10, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        testName, "ln", redundancy, 10, isOffHeap() ));
-  }
-
-  protected void startPausedSenders() {
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-    
-    vm4.invoke(() ->pauseSender( "ln" ));
-    vm5.invoke(() ->pauseSender( "ln" ));
-    vm6.invoke(() ->pauseSender( "ln" ));
-    vm7.invoke(() ->pauseSender( "ln" ));
-  }
-
-  protected void createSendersWithConflation(Integer lnPort) {
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, true, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, true, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, true, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, true, false, null, true ));
-  }
-
-  protected void createSenders(Integer lnPort) {
-    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
deleted file mode 100644
index b38d35b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.CacheTransactionManager;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.*;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-//The tests here are to validate changes introduced because a distributed deadlock
-//was found that caused issues for a production customer. 
-//
-//There are 4 tests which use sender gateways with primaries on different 
-//JVM's. Two tests use replicated and two use partition regions and the
-//the tests vary the conserve-sockets.  
-//
-//currently the 4th test using PR, conserve-sockets=true hangs/fails and is commented
-//out to prevent issues
-@Category(DistributedTest.class)
-public class SerialGatewaySenderDistributedDeadlockDUnitTest extends WANTestBase {
-
-    public SerialGatewaySenderDistributedDeadlockDUnitTest() {
-        super();
-    }
-
-    //Uses replicated regions and conserve-sockets=false
-  @Test
-  public void testPrimarySendersOnDifferentVMsReplicated() throws Exception {
-
-        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
-
-        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
-
-        createCachesWith(Boolean.FALSE, nyPort, lnPort);
-
-        createSerialSenders();
-
-        createReplicatedRegions(nyPort);
-
-        //get one primary sender on vm4 and another primary on vm5
-        //the startup order matters here
-        startSerialSenders();
-
-        //exercise region and gateway operations with different messaging
-        exerciseWANOperations();
-        AsyncInvocation invVM4transaction = vm4.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
-        AsyncInvocation invVM5transaction = vm5.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
-        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-
-        exerciseFunctions();
-
-        try {
-            invVM4transaction.join();
-            invVM5transaction.join();
-            invVM4.join();
-            invVM5.join();
-
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    //Uses partitioned regions and conserve-sockets=false
-  @Test
-  public void testPrimarySendersOnDifferentVMsPR() throws Exception {
-        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
-
-        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
-
-        createCachesWith(Boolean.FALSE, nyPort, lnPort);
-
-        createSerialSenders();
-
-        createPartitionedRegions(nyPort);
-
-        startSerialSenders();
-
-        exerciseWANOperations();
-        AsyncInvocation invVM4transaction
-                = vm4.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
-        AsyncInvocation invVM5transaction
-                = vm5.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
-
-        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-
-        exerciseFunctions();
-
-        try {
-            invVM4transaction.join();
-            invVM5transaction.join();
-            invVM4.join();
-            invVM5.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    //Uses replicated regions and conserve-sockets=true
-  @Test
-  public void testPrimarySendersOnDifferentVMsReplicatedSocketPolicy() throws Exception {
-
-        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
-
-        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
-
-        createCachesWith(Boolean.TRUE, nyPort, lnPort);
-
-        createSerialSenders();
-
-        createReplicatedRegions(nyPort);
-
-        //get one primary sender on vm4 and another primary on vm5
-        //the startup order matters here
-        startSerialSenders();
-
-        //exercise region and gateway operations with messaging
-        exerciseWANOperations();
-        AsyncInvocation invVM4transaction = vm4.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
-        AsyncInvocation invVM5transaction = vm5.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
-
-        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-
-        exerciseFunctions();
-
-        try {
-            invVM4transaction.join();
-            invVM5transaction.join();
-            invVM4.join();
-            invVM5.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    //Uses partitioned regions and conserve-sockets=true
-    //this always causes a distributed deadlock
-  @Test
-  public void testPrimarySendersOnDifferentVMsPRSocketPolicy() throws Exception {
-        Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
-
-        Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
-
-        createCachesWith(Boolean.TRUE, nyPort, lnPort);
-
-        createSerialSenders();
-
-        createPartitionedRegions(nyPort);
-
-        startSerialSenders();
-
-        exerciseWANOperations();
-        AsyncInvocation invVM4transaction
-                = vm4.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
-        AsyncInvocation invVM5transaction
-                = vm5.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
-
-        AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-        AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
-
-        exerciseFunctions();
-
-        try {
-            invVM4transaction.join();
-            invVM5transaction.join();
-            invVM4.join();
-            invVM5.join();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    //**************************************************************************
-    //Utility methods used by tests
-    //**************************************************************************
-    private void createReplicatedRegions(Integer nyPort) throws Exception {
-        //create receiver
-        vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", null, false));
-        vm2.invoke(() -> WANTestBase.createReceiver());
-
-        //create senders
-        vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1,ln2", false));
-
-        vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-          getTestMethodName() + "_RR", "ln1,ln2", false));
-    }
-
-    private void createCachesWith(Boolean socketPolicy, Integer nyPort, Integer lnPort) {
-        vm2.invoke(() -> WANTestBase.createCacheConserveSockets(socketPolicy, nyPort));
-
-        vm4.invoke(() -> WANTestBase.createCacheConserveSockets(socketPolicy, lnPort));
-
-        vm5.invoke(() -> WANTestBase.createCacheConserveSockets(socketPolicy, lnPort));
-    }
-
-    private void exerciseFunctions() throws Exception {
-        //do function calls that use a shared connection
-        for (int x = 0; x < 1000; x++) {
-            //setting it to Boolean.TRUE it should pass the test
-            vm4.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.TRUE));
-            vm5.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.TRUE));
-        }
-        for (int x = 0; x < 1000; x++) {
-            //setting the Boolean.FALSE below will cause a deadlock in some GFE versions
-            //setting it to Boolean.TRUE as above it should pass the test
-            //this is similar to the customer found distributed deadlock
-            vm4.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.FALSE));
-            vm5.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doFunctionPuts(getTestMethodName() + "_RR", 1, Boolean.FALSE));
-        }
-    }
-
-    private void createPartitionedRegions(Integer nyPort) throws Exception {
-        //create remote receiver
-        vm2.invoke(() -> WANTestBase.createPartitionedRegion(getTestMethodName() + "_RR",
-                                                                                "", 0, 113, false));
-
-        vm2.invoke(() -> WANTestBase.createReceiver());
-
-        //create sender vms
-        vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_RR", "ln1,ln2", 1, 113, false));
-
-        vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-          getTestMethodName() + "_RR", "ln1,ln2", 1, 113, false));
-    }
-
-    private void exerciseWANOperations() throws Exception {
-        //note - some of these should be made async to truly exercise the 
-        //messaging between the WAN gateways and members
-
-        //exercise region and gateway operations
-        vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
-        vm5.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
-        Wait.pause(2000); //wait for events to propagate
-        vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
-        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
-        vm5.invoke(() -> WANTestBase.doDestroys(getTestMethodName() + "_RR", 100));
-        Wait.pause(2000);//wait for events to propagate
-        vm5.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
-        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
-        vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
-        vm5.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 100));
-        Wait.pause(2000); //wait for events to propagate
-        vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
-        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 100));
-        vm4.invoke(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doInvalidates(getTestMethodName() + "_RR", 100, 100));
-        vm4.invoke(() -> WANTestBase.doPutAll(getTestMethodName() + "_RR", 100, 10));
-        vm5.invoke(() -> WANTestBase.doPutAll(getTestMethodName() + "_RR", 100, 10));
-        Wait.pause(2000);//wait for events to propagate
-        vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
-        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
-        vm4.invoke(() -> WANTestBase.doDestroys(getTestMethodName() + "_RR", 1000));
-        Wait.pause(2000);//wait for events to propagate
-        vm5.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
-        vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 0));
-        vm4.invoke(() -> WANTestBase.doPutsPDXSerializable(getTestMethodName() + "_RR", 100));
-        Wait.pause(2000);
-        vm5.invoke(() -> WANTestBase.validateRegionSize_PDX(getTestMethodName() + "_RR", 100));
-        vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(getTestMethodName() + "_RR", 100));
-    }
-
-    private void startSerialSenders() throws Exception {
-        //get one primary sender on vm4 and another primary on vm5
-        //the startup order matters here so that primaries are
-        //on different JVM's
-        vm4.invoke(() -> WANTestBase.startSender("ln1"));
-
-        vm5.invoke(() -> WANTestBase.startSender("ln2"));
-
-        //start secondaries
-        vm5.invoke(() -> WANTestBase.startSender("ln1"));
-
-        vm4.invoke(() -> WANTestBase.startSender("ln2"));
-    }
-
-    private void createSerialSenders() throws Exception {
-
-        vm4.invoke(() -> WANTestBase.createSender("ln1", 2,
-            false, 100, 10, false, false, null, true));
-
-        vm5.invoke(() -> WANTestBase.createSender("ln1", 2,
-            false, 100, 10, false, false, null, true));
-
-        vm4.invoke(() -> WANTestBase.createSender("ln2", 2,
-            false, 100, 10, false, false, null, true));
-
-        vm5.invoke(() -> WANTestBase.createSender("ln2", 2,
-            false, 100, 10, false, false, null, true));
-    }
-
-    public static void doFunctionPuts(String name, int num, Boolean useThreadOwnedSocket) throws Exception {
-        Region region = CacheFactory.getAnyInstance().getRegion(name);
-        FunctionService.registerFunction(new TestFunction());
-        Execution exe = FunctionService.onRegion(region);
-        for (int x = 0; x < num; x++) {
-            exe.withArgs(useThreadOwnedSocket).execute("com.gemstone.gemfire.internal.cache.wan.serial.TestFunction");
-        }
-    }
-
-    public static void doTxPutsPR(String regionName, int numPuts, int size) throws Exception {
-        Region r = cache.getRegion(Region.SEPARATOR + regionName);
-        CacheTransactionManager mgr = cache.getCacheTransactionManager();
-        for (int x = 0; x < numPuts; x++) {
-            int temp = (int) (Math.floor(Math.random() * size));
-            try {
-                mgr.begin();
-                r.put(temp, temp);
-                mgr.commit();
-            } catch (com.gemstone.gemfire.cache.TransactionDataNotColocatedException txe) {
-                //ignore colocation issues or primary bucket issues 
-            } catch (com.gemstone.gemfire.cache.CommitConflictException cce) {
-                //ignore - conflicts are ok and expected
-            }
-        }
-    }
-
-    public static void doInvalidates(String regionName, int numInvalidates, int size) throws Exception {
-        Region r = cache.getRegion(Region.SEPARATOR + regionName);
-        for (int x = 0; x < numInvalidates; x++) {
-            int temp = (int) (Math.floor(Math.random() * size));
-            try {
-                if (r.containsValueForKey(temp)) {
-                    r.invalidate(temp);
-                }
-            } catch (com.gemstone.gemfire.cache.EntryNotFoundException entryNotFoundException) {
-                //ignore as an entry may not exist
-            }
-        }
-    }
-
-}
-
-class TestFunction implements Function {
-
-    @Override
-    public boolean hasResult() {
-        return false;
-    }
-
-    @Override
-    public void execute(FunctionContext fc) {
-        boolean option = (Boolean) fc.getArguments();
-        if (option) {
-            DistributedSystem.setThreadsSocketPolicy(false);
-        }
-        RegionFunctionContext context = (RegionFunctionContext) fc;
-        Region local = context.getDataSet();
-        local.put(randKeyValue(10), randKeyValue(10000));
-    }
-
-    @Override
-    public String getId() {
-        return this.getClass().getName();
-    }
-
-    @Override
-    public boolean optimizeForWrite() {
-        return false;
-    }
-
-    @Override
-    public boolean isHA() {
-        return false;
-    }
-
-    private int randKeyValue(int size) {
-        double temp = Math.floor(Math.random() * size);
-        return (int) temp;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java
deleted file mode 100644
index 8c255c1..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import com.jayway.awaitility.Awaitility;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.MyGatewaySenderEventListener;
-import com.gemstone.gemfire.internal.cache.wan.MyGatewaySenderEventListener2;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class SerialGatewaySenderEventListenerDUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  public SerialGatewaySenderEventListenerDUnitTest() {
-    super();
-  }
-
-  /**
-   * Test validates whether the listener attached receives all the events.
-   * this test hangs after the Darrel's checkin 36685. Need to work with Darrel.Commenting it out so that test suit will not hang 
-   */
-  @Ignore
-  @Test
-  public void testGatewaySenderEventListenerInvocationWithoutLocator() {
-    int mPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    vm4.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-    vm5.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-    vm6.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-    vm7.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-
-    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, false, true));
-    vm5.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, false, true));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 1000; i++) {
-      keyValues.put(i, i);
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", keyValues.size() ));
-    
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", keyValues.size() ));
-    
-    vm4.invoke(() -> WANTestBase.printEventListenerMap());
-    vm5.invoke(() -> WANTestBase.printEventListenerMap());
-
-    fail("tried to invoke missing method");
-//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", keyValues ));
-  }
-  
-  /**
-   * Test validates whether the listener attached receives all the events.
-   */
-  @Test
-  public void testGatewaySenderEventListenerInvocation() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, false, true));
-    vm5.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, false, true));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 1000; i++) {
-      keyValues.put(i, i);
-    }
-
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", keyValues.size() ));
-    
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", keyValues.size() ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 0 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 0 ));
-
-    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", keyValues ));
-  }
-
-  /**
-   * Test validates whether the listener attached receives all the events. 
-   * When there are 2 listeners attached to the GatewaySender.
-   */
-  @Test
-  public void testGatewaySender2EventListenerInvocation() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, true, true));
-    vm5.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, true, true));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 1000; i++) {
-      keyValues.put(i, i);
-    }
-
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 0 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 0 ));
-
-    // TODO: move validateReceivedEventsMapSizeListener2 to a shared util class
-    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener2("ln", keyValues ));
-  }
-  
-  /**
-   * Test validates whether the PoolImpl is created. Ideally when a listener is attached
-   * pool should not be created.
-   */
-  @Test
-  public void testGatewaySenderEventListenerPoolImpl() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4);
-
-    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, false, false ));
-    
-    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateNoPoolCreation("ln" ));
-  }
-  
-  // Test start/stop/resume on listener invocation
-  //this test hangs after the Darrel's checkin 36685. Need to work with Darrel.Commenting it out so that test suit will not hang
-  @Ignore
-  @Test
-  public void testGatewaySenderEventListener_GatewayOperations() {
-
-    int mPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    vm4.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-    vm5.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-    vm6.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-    vm7.invoke(() -> WANTestBase.createCacheWithoutLocator(mPort ));
-
-    vm4.invoke(() -> WANTestBase.createSenderWithListener( "ln", 2,
-        false, 100, 10, false, false, null, false, true));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    final Map initialKeyValues = new HashMap();
-    for(int i=0; i< 1000; i++) {
-      initialKeyValues.put(i, i);
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      initialKeyValues ));
-
-    fail("tried to invoke missing method");
-//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", initialKeyValues ));
-    
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    final Map keyValues = new HashMap();
-    for(int i=1000; i< 2000; i++) {
-      keyValues.put(i, i);
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    fail("tried to invoke missing method");
-//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", initialKeyValues ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    final Map finalKeyValues = new HashMap();
-    for(int i=2000; i< 3000; i++) {
-      finalKeyValues.put(i, i);
-    }
-    
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      finalKeyValues ));
-    
-    finalKeyValues.putAll(initialKeyValues);
-    fail("tried to invoke missing method");
-//    vm4.invoke(() -> SerialGatewaySenderEventListenerDUnitTest.validateReceivedEventsMapSizeListener1("ln", finalKeyValues ));
-    
-  }
-    
-  public static void validateNoPoolCreation(final String siteId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    for(GatewaySender sender: senders) {
-      if (sender.getId().equals(siteId)) {
-        AbstractGatewaySender sImpl = (AbstractGatewaySender)sender;
-        assertNull(sImpl.getProxy());
-      }
-    }
-  }
-  
-  public static void validateReceivedEventsMapSizeListener1(final String senderId, final Map map) {
-
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        sender = s;
-        break;
-      }
-    }
-    
-    final List<AsyncEventListener> listeners = ((AbstractGatewaySender)sender).getAsyncEventListeners();
-    if(listeners.size() == 1) {
-      final AsyncEventListener l = listeners.get(0);
-
-      WaitCriterion wc = new WaitCriterion() {
-        Map listenerMap;
-        public boolean done() {
-          listenerMap = ((MyGatewaySenderEventListener)l)
-              .getEventsMap();
-          boolean sizeCorrect = map.size() == listenerMap.size();
-          boolean keySetCorrect = listenerMap.keySet().containsAll(map.keySet());
-          boolean valuesCorrect = listenerMap.values().containsAll(map.values());
-          return sizeCorrect && keySetCorrect && valuesCorrect;
-        }
-
-        public String description() {
-          return "Waiting for all sites to get updated, the sizes are " + listenerMap.size() + " and " + map.size();
-        }
-      };
-      Wait.waitForCriterion(wc, 60000, 500, true); 
-    }
-  }
-  
-  public static void validateReceivedEventsMapSizeListener2(final String senderId, final Map map) {
-
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        sender = s;
-        break;
-      }
-    }
-    
-    final List<AsyncEventListener> listeners = ((AbstractGatewaySender)sender).getAsyncEventListeners();
-    if(listeners.size() == 2) {
-      final AsyncEventListener l1 = listeners.get(0);
-      final AsyncEventListener l2 = listeners.get(1);
-      Awaitility.await().atMost(60000, TimeUnit.MILLISECONDS).until(()->{
-        Map listenerMap1 = ((MyGatewaySenderEventListener)l1)
-          .getEventsMap();
-
-        Map listenerMap2 = ((MyGatewaySenderEventListener2)l2)
-          .getEventsMap();
-        int listener1MapSize = listenerMap1.size();
-        int listener2MapSize = listenerMap1.size();
-        int expectedMapSize = map.size();
-        boolean sizeCorrect = expectedMapSize == listener1MapSize;
-        boolean keySetCorrect = listenerMap1.keySet().containsAll(map.keySet());
-        boolean valuesCorrect = listenerMap1.values().containsAll(map.values());
-
-        boolean sizeCorrect2 = expectedMapSize== listener2MapSize;
-        boolean keySetCorrect2 = listenerMap2.keySet().containsAll(map.keySet());
-        boolean valuesCorrect2 = listenerMap2.values().containsAll(map.values());
-
-        assertEquals("Failed while waiting for all sites to get updated with the correct events. \nThe " +
-                     "size of listener 1's map = "+ listener1MapSize + "\n The size of listener 2's map = " +
-                     ""+ listener2MapSize + "\n The expected map size =" + expectedMapSize ,
-          true, sizeCorrect && keySetCorrect && valuesCorrect && sizeCorrect2 && keySetCorrect2 && valuesCorrect2);
-      });
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
deleted file mode 100644
index 200e5b6..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.RegionDestroyedException;
-import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionRequest;
-import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionResponse;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.distributed.internal.ServerLocator;
-import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.RMIException;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-
-/**
- * 
- */
-@Category(DistributedTest.class)
-public class SerialGatewaySenderOperationsDUnitTest extends WANTestBase {
-
-  private static final long serialVersionUID = 1L;
-
-  public SerialGatewaySenderOperationsDUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-    IgnoredException.addIgnoredException("Connection refused");
-    IgnoredException.addIgnoredException("could not get remote locator information");
-    
-    //Stopping the gateway closed the region,
-    //which causes this exception to get logged
-    IgnoredException.addIgnoredException(RegionDestroyedException.class.getSimpleName());
-  }
-
-  @Test
-  public void testSerialGatewaySenderOperationsWithoutStarting() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        100 ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifyGatewaySenderOperations( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifyGatewaySenderOperations( "ln" ));
-
-  }
-
-  protected void createSenderRegions() {
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-  }
-
-  protected void createReceiverRegions() {
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-  }
-
-  protected void createSenderCaches(Integer lnPort) {
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-  }
-
-  protected void createSenderVM5() {
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-  }
-
-  protected void createSenderVM4() {
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-  }
-
-  
-  @Test
-  public void testStartPauseResumeSerialGatewaySender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        100 ));
-
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderPausedState( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderPausedState( "ln" ));
-
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10 ));
-
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
-
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail("Interrupted the async invocation.");
-    }
-
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    validateQueueContents(vm4, "ln", 0);
-    validateQueueContents(vm5, "ln", 0);
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-
-  }
-
-  @Test
-  public void testStopSerialGatewaySender() throws Throwable {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        20 ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        20 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 20 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 20 ));
-    
-    vm2.invoke(() -> WANTestBase.stopReceivers());
-    vm3.invoke(() -> WANTestBase.stopReceivers());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        20 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
-    
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    /**
-     * Should have no effect on GatewaySenderState
-     */
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-
-    AsyncInvocation vm4async = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm5async = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    int START_WAIT_TIME = 30000;
-    vm4async.getResult(START_WAIT_TIME);
-    vm5async.getResult(START_WAIT_TIME);
-
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
-
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      110 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 130 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 130 ));
-    
-    vm2.invoke(() -> WANTestBase.startReceivers());
-    vm3.invoke(() -> WANTestBase.startReceivers());
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 110 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 110 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-  }
-
-  @Test
-  public void testStopOneSerialGatewaySenderBothPrimary() throws Throwable {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        100 ));
-
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        200 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 200 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 200 ));
-    
-    //Do some puts while restarting a sender
-    AsyncInvocation asyncPuts = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        300 ));
-    
-    Thread.sleep(10);
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    asyncPuts.getResult();
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 300 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 300 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    
-    
-  }
-
-  @Test
-  public void testStopOneSerialGatewaySender_PrimarySecondary() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        100 ));
-    
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-  }
-  
-  @Test
-  public void testStopOneSender_StartAnotherSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4);
-    createSenderVM4();
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    createSenderVM5();
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        100 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-  }
-
-  @Test
-  public void test_Bug44153_StopOneSender_StartAnotherSender_CheckQueueSize() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    createSenderVM4();
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-    validateQueueContents(vm4, "ln", 10);
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    createSenderVM5();
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm5.invoke(() -> WANTestBase.doPutsFrom( getTestMethodName() + "_RR", 10, 110 ));
-
-    validateQueueContents(vm5, "ln", 100);
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    validateQueueContents(vm4, "ln", 10);
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 100 ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 110 ));
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-  }
-
-  private void validateQueueContents(VM vm, String site, int size) {
-    vm.invoke(() -> WANTestBase.validateQueueContents( site,
-        size ));
-  }
-
-  /**
-   * Destroy SerialGatewaySender on all the nodes.
-   */
-  @Test
-  public void testDestroySerialGatewaySenderOnAllNodes() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-    
-    //before destroying, stop the sender
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", getTestMethodName() + "_RR" ));
-    vm5.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", getTestMethodName() + "_RR" ));
-
-    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
-    vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
-    vm5.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
-  }
-
-  /**
-   * Destroy SerialGatewaySender on a single node.
-   */
-  @Test
-  public void testDestroySerialGatewaySenderOnSingleNode() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-    
-    //before destroying, stop the sender
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-        
-    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", getTestMethodName() + "_RR" ));
-    
-    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
-    vm5.invoke(() -> WANTestBase.verifySenderRunningState( "ln" ));
-  }
-  
-  /**
-   * Since the sender is attached to a region and in use, it can not be destroyed.
-   * Hence, exception is thrown by the sender API.
-   */
-  @Test
-  public void testDestroySerialGatewaySenderExceptionScenario() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createSenderCaches(lnPort);
-
-    createSenderVM4();
-    createSenderVM5();
-
-    createReceiverRegions();
-
-    createSenderRegions();
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10 ));
-    
-    try {
-      vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
-    } catch (RMIException e) {
-      assertTrue("Cause of the exception should be GatewaySenderException", e.getCause() instanceof GatewaySenderException);
-    }
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10 ));
-  }
-
-  
-  @Test
-  public void testGatewaySenderNotRegisteredAsCacheServer() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, true, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    SerializableRunnable check = new SerializableRunnable("assert no cache servers") {
-      public void run() {
-        InternalLocator inl = (InternalLocator)Locator.getLocator();
-        ServerLocator server = inl.getServerLocatorAdvisee();
-        LogWriterUtils.getLogWriter().info("Server load map is " + server.getLoadMap());
-        assertTrue("expected an empty map but found " + server.getLoadMap(),
-            server.getLoadMap().isEmpty());
-        QueueConnectionRequest request = new QueueConnectionRequest(
-            ClientProxyMembershipID.getNewProxyMembership(InternalDistributedSystem.getConnectedInstance()),
-            1, new HashSet<>(), "", false);
-        QueueConnectionResponse response = (QueueConnectionResponse)server.processRequest(request);
-        assertTrue("expected no servers but found " + response.getServers(),
-            response.getServers().isEmpty());
-      }
-    };
-    vm0.invoke(check);
-    vm1.invoke(check);
-    
-  }
-  
-
-  
-  public static void verifySenderPausedState(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertTrue(sender.isPaused());
-  }
-
-  public static void verifySenderResumedState(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertFalse(sender.isPaused());
-    assertTrue(sender.isRunning());
-  }
-
-  public static void verifySenderStoppedState(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    AbstractGatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = (AbstractGatewaySender)s;
-        break;
-      }
-    }
-    assertFalse(sender.isRunning());
-    assertFalse(sender.isPaused());
-  }
-
-  public static void verifyGatewaySenderOperations(String senderId) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    assertFalse(sender.isPaused());
-    assertFalse(((AbstractGatewaySender)sender).isRunning());
-    sender.pause();
-    sender.resume();
-    sender.stop();
-  }
-}


[41/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f39e2394
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f39e2394
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f39e2394

Branch: refs/heads/feature/GEODE-37_2
Commit: f39e2394ba9af9b5ceb0268281dcc339ecb0b1ef
Parents: 701c686
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Sep 13 15:43:20 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Tue Sep 13 15:43:20 2016 -0700

----------------------------------------------------------------------
 .../cache/CacheXml70GatewayDUnitTest.java       |  255 --
 .../cache/CacheXml80GatewayDUnitTest.java       |  150 -
 .../AnalyzeWANSerializablesJUnitTest.java       |   90 -
 .../internal/cache/UpdateVersionDUnitTest.java  |  962 -----
 .../cache/wan/CacheClientNotifierDUnitTest.java |  276 --
 .../cache/wan/Simple2CacheServerDUnitTest.java  |  185 -
 .../gemfire/internal/cache/wan/WANTestBase.java | 3765 ------------------
 ...oncurrentParallelGatewaySenderDUnitTest.java |  737 ----
 ...ntParallelGatewaySenderOffHeapDUnitTest.java |   42 -
 ...allelGatewaySenderOperation_1_DUnitTest.java |  796 ----
 ...allelGatewaySenderOperation_2_DUnitTest.java |  625 ---
 ...tSerialGatewaySenderOperationsDUnitTest.java |  120 -
 ...GatewaySenderOperationsOffHeapDUnitTest.java |   42 -
 .../ConcurrentWANPropagation_1_DUnitTest.java   |  568 ---
 .../ConcurrentWANPropagation_2_DUnitTest.java   |  448 ---
 .../cache/wan/disttx/DistTXWANDUnitTest.java    |  182 -
 .../CommonParallelGatewaySenderDUnitTest.java   |  460 ---
 ...onParallelGatewaySenderOffHeapDUnitTest.java |   42 -
 ...wWANConcurrencyCheckForDestroyDUnitTest.java |  532 ---
 .../wan/misc/NewWanAuthenticationDUnitTest.java |  469 ---
 .../cache/wan/misc/PDXNewWanDUnitTest.java      |  767 ----
 ...dRegion_ParallelWANPersistenceDUnitTest.java |  670 ----
 ...dRegion_ParallelWANPropagationDUnitTest.java | 1063 -----
 .../SenderWithTransportFilterDUnitTest.java     |  228 --
 ...downAllPersistentGatewaySenderDUnitTest.java |  206 -
 .../wan/misc/WANConfigurationJUnitTest.java     |  601 ---
 .../wan/misc/WANLocatorServerDUnitTest.java     |  192 -
 .../cache/wan/misc/WANSSLDUnitTest.java         |  160 -
 .../wan/misc/WanAutoDiscoveryDUnitTest.java     |  561 ---
 .../cache/wan/misc/WanValidationsDUnitTest.java | 1507 -------
 ...tewaySenderOperation_2_OffHeapDUnitTest.java |   42 -
 ...tewaySenderOperation_2_OffHeapDUnitTest.java |   42 -
 ...GatewaySenderOperationsOffHeapDUnitTest.java |   44 -
 ...ewaySenderQueueOverflowOffHeapDUnitTest.java |   44 -
 .../ParallelWANConflationOffHeapDUnitTest.java  |   44 -
 ...nceEnabledGatewaySenderOffHeapDUnitTest.java |   44 -
 ...ropagationConcurrentOpsOffHeapDUnitTest.java |   44 -
 .../ParallelWANPropagationOffHeapDUnitTest.java |   43 -
 ...erialGatewaySenderQueueOffHeapDUnitTest.java |   44 -
 ...nceEnabledGatewaySenderOffHeapDUnitTest.java |   44 -
 .../SerialWANPropagationOffHeapDUnitTest.java   |   38 -
 ...ation_PartitionedRegionOffHeapDUnitTest.java |   39 -
 ...allelGatewaySenderOperation_2_DUnitTest.java |   48 -
 ...arallelGatewaySenderOperationsDUnitTest.java |  692 ----
 ...llelGatewaySenderQueueOverflowDUnitTest.java |  500 ---
 .../ParallelWANConflationDUnitTest.java         |  497 ---
 ...ersistenceEnabledGatewaySenderDUnitTest.java | 1593 --------
 ...llelWANPropagationClientServerDUnitTest.java |   97 -
 ...lelWANPropagationConcurrentOpsDUnitTest.java |  285 --
 .../ParallelWANPropagationDUnitTest.java        | 1234 ------
 ...ParallelWANPropagationLoopBackDUnitTest.java |  415 --
 .../wan/parallel/ParallelWANStatsDUnitTest.java |  499 ---
 ...tewaySenderDistributedDeadlockDUnitTest.java |  405 --
 ...rialGatewaySenderEventListenerDUnitTest.java |  383 --
 .../SerialGatewaySenderOperationsDUnitTest.java |  665 ----
 .../SerialGatewaySenderQueueDUnitTest.java      |  327 --
 ...ersistenceEnabledGatewaySenderDUnitTest.java |  547 ---
 .../serial/SerialWANPropagationDUnitTest.java   | 1336 -------
 .../SerialWANPropagationLoopBackDUnitTest.java  |  513 ---
 ...NPropagation_PartitionedRegionDUnitTest.java |  412 --
 .../SerialWANPropagationsFeatureDUnitTest.java  |  338 --
 .../wan/serial/SerialWANStatsDUnitTest.java     |  588 ---
 .../wan/wancommand/WANCommandTestBase.java      |  490 ---
 ...anCommandCreateGatewayReceiverDUnitTest.java |  630 ---
 .../WanCommandCreateGatewaySenderDUnitTest.java |  706 ----
 ...WanCommandGatewayReceiverStartDUnitTest.java |  276 --
 .../WanCommandGatewayReceiverStopDUnitTest.java |  281 --
 .../WanCommandGatewaySenderStartDUnitTest.java  |  400 --
 .../WanCommandGatewaySenderStopDUnitTest.java   |  352 --
 .../wan/wancommand/WanCommandListDUnitTest.java |  381 --
 .../WanCommandPauseResumeDUnitTest.java         |  688 ----
 .../wancommand/WanCommandStatusDUnitTest.java   |  546 ---
 .../management/WANManagementDUnitTest.java      |  513 ---
 .../ClusterConfigurationDUnitTest.java          | 1013 -----
 .../pulse/TestRemoteClusterDUnitTest.java       |  272 --
 .../geode/cache/CacheXml70GatewayDUnitTest.java |  255 ++
 .../geode/cache/CacheXml80GatewayDUnitTest.java |  150 +
 .../AnalyzeWANSerializablesJUnitTest.java       |   90 +
 .../internal/cache/UpdateVersionDUnitTest.java  |  962 +++++
 .../cache/wan/CacheClientNotifierDUnitTest.java |  276 ++
 .../cache/wan/Simple2CacheServerDUnitTest.java  |  185 +
 .../geode/internal/cache/wan/WANTestBase.java   | 3765 ++++++++++++++++++
 ...oncurrentParallelGatewaySenderDUnitTest.java |  737 ++++
 ...ntParallelGatewaySenderOffHeapDUnitTest.java |   42 +
 ...allelGatewaySenderOperation_1_DUnitTest.java |  796 ++++
 ...allelGatewaySenderOperation_2_DUnitTest.java |  625 +++
 ...tSerialGatewaySenderOperationsDUnitTest.java |  120 +
 ...GatewaySenderOperationsOffHeapDUnitTest.java |   42 +
 .../ConcurrentWANPropagation_1_DUnitTest.java   |  568 +++
 .../ConcurrentWANPropagation_2_DUnitTest.java   |  448 +++
 .../cache/wan/disttx/DistTXWANDUnitTest.java    |  182 +
 .../CommonParallelGatewaySenderDUnitTest.java   |  460 +++
 ...onParallelGatewaySenderOffHeapDUnitTest.java |   42 +
 ...wWANConcurrencyCheckForDestroyDUnitTest.java |  532 +++
 .../wan/misc/NewWanAuthenticationDUnitTest.java |  469 +++
 .../cache/wan/misc/PDXNewWanDUnitTest.java      |  767 ++++
 ...dRegion_ParallelWANPersistenceDUnitTest.java |  670 ++++
 ...dRegion_ParallelWANPropagationDUnitTest.java | 1063 +++++
 .../SenderWithTransportFilterDUnitTest.java     |  228 ++
 ...downAllPersistentGatewaySenderDUnitTest.java |  206 +
 .../wan/misc/WANConfigurationJUnitTest.java     |  601 +++
 .../wan/misc/WANLocatorServerDUnitTest.java     |  192 +
 .../cache/wan/misc/WANSSLDUnitTest.java         |  160 +
 .../wan/misc/WanAutoDiscoveryDUnitTest.java     |  561 +++
 .../cache/wan/misc/WanValidationsDUnitTest.java | 1507 +++++++
 ...tewaySenderOperation_2_OffHeapDUnitTest.java |   42 +
 ...tewaySenderOperation_2_OffHeapDUnitTest.java |   42 +
 ...GatewaySenderOperationsOffHeapDUnitTest.java |   44 +
 ...ewaySenderQueueOverflowOffHeapDUnitTest.java |   44 +
 .../ParallelWANConflationOffHeapDUnitTest.java  |   44 +
 ...nceEnabledGatewaySenderOffHeapDUnitTest.java |   44 +
 ...ropagationConcurrentOpsOffHeapDUnitTest.java |   44 +
 .../ParallelWANPropagationOffHeapDUnitTest.java |   43 +
 ...erialGatewaySenderQueueOffHeapDUnitTest.java |   44 +
 ...nceEnabledGatewaySenderOffHeapDUnitTest.java |   44 +
 .../SerialWANPropagationOffHeapDUnitTest.java   |   38 +
 ...ation_PartitionedRegionOffHeapDUnitTest.java |   39 +
 ...allelGatewaySenderOperation_2_DUnitTest.java |   48 +
 ...arallelGatewaySenderOperationsDUnitTest.java |  692 ++++
 ...llelGatewaySenderQueueOverflowDUnitTest.java |  500 +++
 .../ParallelWANConflationDUnitTest.java         |  497 +++
 ...ersistenceEnabledGatewaySenderDUnitTest.java | 1593 ++++++++
 ...llelWANPropagationClientServerDUnitTest.java |   97 +
 ...lelWANPropagationConcurrentOpsDUnitTest.java |  285 ++
 .../ParallelWANPropagationDUnitTest.java        | 1234 ++++++
 ...ParallelWANPropagationLoopBackDUnitTest.java |  415 ++
 .../wan/parallel/ParallelWANStatsDUnitTest.java |  499 +++
 ...tewaySenderDistributedDeadlockDUnitTest.java |  405 ++
 ...rialGatewaySenderEventListenerDUnitTest.java |  383 ++
 .../SerialGatewaySenderOperationsDUnitTest.java |  665 ++++
 .../SerialGatewaySenderQueueDUnitTest.java      |  327 ++
 ...ersistenceEnabledGatewaySenderDUnitTest.java |  547 +++
 .../serial/SerialWANPropagationDUnitTest.java   | 1336 +++++++
 .../SerialWANPropagationLoopBackDUnitTest.java  |  513 +++
 ...NPropagation_PartitionedRegionDUnitTest.java |  412 ++
 .../SerialWANPropagationsFeatureDUnitTest.java  |  338 ++
 .../wan/serial/SerialWANStatsDUnitTest.java     |  588 +++
 .../wan/wancommand/WANCommandTestBase.java      |  490 +++
 ...anCommandCreateGatewayReceiverDUnitTest.java |  630 +++
 .../WanCommandCreateGatewaySenderDUnitTest.java |  706 ++++
 ...WanCommandGatewayReceiverStartDUnitTest.java |  276 ++
 .../WanCommandGatewayReceiverStopDUnitTest.java |  281 ++
 .../WanCommandGatewaySenderStartDUnitTest.java  |  400 ++
 .../WanCommandGatewaySenderStopDUnitTest.java   |  352 ++
 .../wan/wancommand/WanCommandListDUnitTest.java |  381 ++
 .../WanCommandPauseResumeDUnitTest.java         |  688 ++++
 .../wancommand/WanCommandStatusDUnitTest.java   |  546 +++
 .../management/WANManagementDUnitTest.java      |  513 +++
 .../ClusterConfigurationDUnitTest.java          | 1013 +++++
 .../pulse/TestRemoteClusterDUnitTest.java       |  272 ++
 150 files changed, 35135 insertions(+), 35135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
deleted file mode 100644
index 3014b1b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.Properties;
-import java.util.Set;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewayQueueEvent;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.gemstone.gemfire.cache30.CacheXml70DUnitTest;
-import com.gemstone.gemfire.cache30.CacheXmlTestCase;
-import com.gemstone.gemfire.cache30.MyGatewayEventFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter1;
-import com.gemstone.gemfire.cache30.MyGatewayTransportFilter2;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
-import com.gemstone.gemfire.internal.cache.xmlcache.ParallelGatewaySenderCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.SerialGatewaySenderCreation;
-
-@Category(DistributedTest.class)
-public class CacheXml70GatewayDUnitTest extends CacheXmlTestCase {
-
-  public CacheXml70GatewayDUnitTest() {
-    super();
-  }
-
-  protected String getGemFireVersion() {
-    return CacheXml.VERSION_7_0;
-  }
-  
-  /**
-   * Added to test the scenario of defect #50600.
-   */
-  @Test
-  public void testAsyncEventQueueWithGatewayEventFilter() {
-    getSystem();
-    CacheCreation cache = new CacheCreation();
-            
-    String id = "WBCLChannel";
-    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
-    factory.setBatchSize(100);
-    factory.setBatchTimeInterval(500);
-    factory.setBatchConflationEnabled(true);
-    factory.setMaximumQueueMemory(200);
-    factory.setDiskSynchronous(true);
-    factory.setParallel(false);
-    factory.setDispatcherThreads(33);
-    factory.addGatewayEventFilter(new MyGatewayEventFilter());
-            
-    AsyncEventListener eventListener = new CacheXml70DUnitTest.MyAsyncEventListener();
-    AsyncEventQueue asyncEventQueue = factory.create(id, eventListener);
-            
-    RegionAttributesCreation attrs = new RegionAttributesCreation();
-    attrs.addAsyncEventQueueId(asyncEventQueue.getId());
-    cache.createRegion("UserRegion", attrs);
-            
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-    
-    Set<AsyncEventQueue> asyncEventQueuesOnCache = c.getAsyncEventQueues();
-    assertTrue("Size of asyncEventQueues should be greater than 0", asyncEventQueuesOnCache.size() > 0);
-            
-    for (AsyncEventQueue asyncEventQueueOnCache : asyncEventQueuesOnCache) {
-      CacheXml70DUnitTest.validateAsyncEventQueue(asyncEventQueue, asyncEventQueueOnCache);
-    }
-  }
-
-  @Test
-  public void testGatewayReceiver() throws Exception{
-    getSystem();
-    CacheCreation cache = new CacheCreation();
-    
-    GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
-    gatewayReceiverFactory.setBindAddress("");
-    gatewayReceiverFactory.setStartPort(20000);
-    gatewayReceiverFactory.setEndPort(29999);
-    gatewayReceiverFactory.setMaximumTimeBetweenPings(2000);
-    gatewayReceiverFactory.setSocketBufferSize(1500);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter2);
-    GatewayReceiver receiver1 = gatewayReceiverFactory.create();
-
-    receiver1.start();
-
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-    Set<GatewayReceiver> receivers = c.getGatewayReceivers();
-    for(GatewayReceiver receiver : receivers){
-      validateGatewayReceiver(receiver1, receiver);
-    }
-  }
-  
-  @Test
-  public void testParallelGatewaySender() throws CacheException{
-    getSystem();
-    CacheCreation cache = new CacheCreation();
-    
-    GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
-    gatewaySenderFactory.setParallel(true);
-    gatewaySenderFactory.setDispatcherThreads(13);
-    gatewaySenderFactory.setManualStart(true);
-    gatewaySenderFactory.setSocketBufferSize(1234);
-    gatewaySenderFactory.setSocketReadTimeout(1050);          
-    gatewaySenderFactory.setBatchConflationEnabled(false);
-    gatewaySenderFactory.setBatchSize(88);
-    gatewaySenderFactory.setBatchTimeInterval(9);           
-    gatewaySenderFactory.setPersistenceEnabled(true);          
-    gatewaySenderFactory.setDiskStoreName("LNSender");  
-    gatewaySenderFactory.setDiskSynchronous(true);
-    gatewaySenderFactory.setMaximumQueueMemory(211);           
-    gatewaySenderFactory.setAlertThreshold(35);
-    
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
-    GatewaySender parallelGatewaySender = gatewaySenderFactory.create("LN", 2);
-    
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-    Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
-    for(GatewaySender sender : sendersOnCache){
-      assertEquals(true, sender.isParallel());
-      validateGatewaySender(parallelGatewaySender, sender);
-    }
-  }
-  
-  @Test
-  public void testSerialGatewaySender() throws CacheException{
-    getSystem();
-    CacheCreation cache = new CacheCreation();
-    GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
-    gatewaySenderFactory.setParallel(false);
-    gatewaySenderFactory.setManualStart(true);
-    gatewaySenderFactory.setSocketBufferSize(124);
-    gatewaySenderFactory.setSocketReadTimeout(1000);          
-    gatewaySenderFactory.setBatchConflationEnabled(false);
-    gatewaySenderFactory.setBatchSize(100);
-    gatewaySenderFactory.setBatchTimeInterval(10);           
-    gatewaySenderFactory.setPersistenceEnabled(true);          
-    gatewaySenderFactory.setDiskStoreName("LNSender"); 
-    gatewaySenderFactory.setDiskSynchronous(true);
-    gatewaySenderFactory.setMaximumQueueMemory(200);           
-    gatewaySenderFactory.setAlertThreshold(30);
-    
-    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
-    gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
-    GatewaySender serialGatewaySender = gatewaySenderFactory.create("LN", 2);
-    
-    RegionAttributesCreation attrs = new RegionAttributesCreation();
-    attrs.addGatewaySenderId(serialGatewaySender.getId());
-    cache.createRegion("UserRegion", attrs);
-    
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-    Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
-    for(GatewaySender sender : sendersOnCache){
-      assertEquals(false, sender.isParallel());
-      validateGatewaySender(serialGatewaySender, sender);
-    }
-  }
-  
-  public static class MyGatewayEventFilter implements GatewayEventFilter, Declarable {
-    public void afterAcknowledgement(GatewayQueueEvent event) {
-    }
-    public boolean beforeEnqueue(GatewayQueueEvent event) {
-      return true;
-    }
-    public boolean beforeTransmit(GatewayQueueEvent event) {
-      return true;
-    }
-    public void close() {
-    }
-    public void init(Properties properties) {
-    }
-  }
-
-  static void validateGatewayReceiver(GatewayReceiver receiver1, GatewayReceiver gatewayReceiver) {
-    assertEquals(receiver1.getHost(), gatewayReceiver.getHost());
-    assertEquals(receiver1.getStartPort(), gatewayReceiver.getStartPort());
-    assertEquals(receiver1.getEndPort(), gatewayReceiver.getEndPort());
-    assertEquals(receiver1.getMaximumTimeBetweenPings(), gatewayReceiver.getMaximumTimeBetweenPings());
-    assertEquals(receiver1.getSocketBufferSize(), gatewayReceiver.getSocketBufferSize());
-    assertEquals(receiver1.getGatewayTransportFilters().size(), gatewayReceiver.getGatewayTransportFilters().size());
-  } 
-
-  static void validateGatewaySender(GatewaySender sender1, GatewaySender gatewaySender) {
-    assertEquals(sender1.getId(), gatewaySender.getId());
-    assertEquals(sender1.getRemoteDSId(), gatewaySender.getRemoteDSId());
-    assertEquals(sender1.isParallel(), gatewaySender.isParallel());
-    assertEquals(sender1.isBatchConflationEnabled(), gatewaySender.isBatchConflationEnabled());
-    assertEquals(sender1.getBatchSize(), gatewaySender.getBatchSize());
-    assertEquals(sender1.getBatchTimeInterval(), gatewaySender.getBatchTimeInterval());
-    assertEquals(sender1.isPersistenceEnabled(), gatewaySender.isPersistenceEnabled());
-    assertEquals(sender1.getDiskStoreName(),gatewaySender.getDiskStoreName());
-    assertEquals(sender1.isDiskSynchronous(),gatewaySender.isDiskSynchronous());
-    assertEquals(sender1.getMaximumQueueMemory(), gatewaySender.getMaximumQueueMemory());
-    assertEquals(sender1.getAlertThreshold(), gatewaySender.getAlertThreshold());
-    assertEquals(sender1.getGatewayEventFilters().size(), gatewaySender.getGatewayEventFilters().size());
-    assertEquals(sender1.getGatewayTransportFilters().size(), gatewaySender.getGatewayTransportFilters().size());
-    
-    boolean isParallel = sender1.isParallel();
-    if (isParallel) {
-      assertTrue("sender should be instanceof Creation", sender1 instanceof ParallelGatewaySenderCreation);
-    } else {
-      assertTrue("sender should be instanceof Creation", sender1 instanceof SerialGatewaySenderCreation);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml80GatewayDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml80GatewayDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml80GatewayDUnitTest.java
deleted file mode 100644
index c140ebc..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml80GatewayDUnitTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.io.IOException;
-import java.util.Properties;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
-import com.gemstone.gemfire.cache.wan.*;
-import com.gemstone.gemfire.cache30.*;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
-
-@Category(DistributedTest.class)
-public class CacheXml80GatewayDUnitTest extends CacheXmlTestCase {
-
-  public CacheXml80GatewayDUnitTest() {
-    super();
-  }
-
-  protected String getGemFireVersion() {
-    return CacheXml.VERSION_8_0;
-  }
-  
-  @Test
-  public void testGatewayReceiverWithManualStartTRUE() throws CacheException{
-    //getSystem();
-    CacheCreation cache = new CacheCreation();
-    
-    GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
-    gatewayReceiverFactory.setBindAddress("");
-    gatewayReceiverFactory.setStartPort(20000);
-    gatewayReceiverFactory.setEndPort(29999);
-    gatewayReceiverFactory.setMaximumTimeBetweenPings(2000);
-    gatewayReceiverFactory.setSocketBufferSize(1500);
-    gatewayReceiverFactory.setManualStart(true);
-    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
-    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter1);
-    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
-    gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter2);
-    GatewayReceiver receiver1 = gatewayReceiverFactory.create();
-    try {
-      receiver1.start();
-    }
-    catch (IOException e) {
-      fail("Could not start GatewayReceiver");
-    }
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-    Set<GatewayReceiver> receivers = c.getGatewayReceivers();
-    for(GatewayReceiver receiver : receivers){
-      validateGatewayReceiver(receiver1, receiver);
-    }
-  }
-
-  @Test
-  public void testAsyncEventQueueWithSubstitutionFilter() {
-    getSystem();
-    CacheCreation cache = new CacheCreation();
-
-    // Create an AsyncEventQueue with GatewayEventSubstitutionFilter.
-    String id = getName();
-    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
-    factory.setGatewayEventSubstitutionListener(new MyGatewayEventSubstitutionFilter());
-    AsyncEventQueue queue = factory.create(id, new CacheXml70DUnitTest.MyAsyncEventListener());
-
-    // Verify the GatewayEventSubstitutionFilter is set on the AsyncEventQueue.
-    assertNotNull(queue.getGatewayEventSubstitutionFilter());
-
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-
-    // Get the AsyncEventQueue. Verify the GatewayEventSubstitutionFilter is not null.
-    AsyncEventQueue queueOnCache = c.getAsyncEventQueue(id);
-    assertNotNull(queueOnCache);
-    assertNotNull(queueOnCache.getGatewayEventSubstitutionFilter());
-  }
-
-  @Test
-  public void testGatewaySenderWithSubstitutionFilter() {
-    getSystem();
-    CacheCreation cache = new CacheCreation();
-
-    // Create a GatewaySender with GatewayEventSubstitutionFilter.
-    // Don't start the sender to avoid 'Locators must be configured before starting gateway-sender' exception.
-    String id = getName();
-    GatewaySenderFactory factory = cache.createGatewaySenderFactory();
-    factory.setManualStart(true);
-    factory.setGatewayEventSubstitutionFilter(new MyGatewayEventSubstitutionFilter());
-    GatewaySender sender = factory.create(id, 2);
-
-    // Verify the GatewayEventSubstitutionFilter is set on the GatewaySender.
-    assertNotNull(sender.getGatewayEventSubstitutionFilter());
-
-    testXml(cache);
-    Cache c = getCache();
-    assertNotNull(c);
-
-    // Get the GatewaySender. Verify the GatewayEventSubstitutionFilter is not null.
-    GatewaySender senderOnCache = c.getGatewaySender(id);
-    assertNotNull(senderOnCache);
-    assertNotNull(senderOnCache.getGatewayEventSubstitutionFilter());
-  }
-
-  protected void validateGatewayReceiver(GatewayReceiver receiver1,
-      GatewayReceiver gatewayReceiver){
-    CacheXml70GatewayDUnitTest.validateGatewayReceiver(receiver1, gatewayReceiver);
-    assertEquals(receiver1.isManualStart(), gatewayReceiver.isManualStart());
-  }
-
-  public static class MyGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter, Declarable {
-
-    public Object getSubstituteValue(EntryEvent event) {
-      return event.getKey();
-    }
-
-    public void close() {
-    }
-
-    public void init(Properties properties) {
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
deleted file mode 100755
index d94920b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/codeAnalysis/AnalyzeWANSerializablesJUnitTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.codeAnalysis;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.AfterClass;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.codeAnalysis.decode.CompiledClass;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-
-/**
- * 
- */
-@Category(IntegrationTest.class)
-public class AnalyzeWANSerializablesJUnitTest extends AnalyzeSerializablesJUnitTest {
-  
-  @Before
-  public void loadClasses() throws Exception {
-    if (classes.size() > 0) {
-      return;
-    }
-    System.out.println("loadClasses starting");
-    List<String> excludedClasses = loadExcludedClasses(new File(TestUtil.getResourcePath(AnalyzeWANSerializablesJUnitTest.class, "excludedClasses.txt")));
-    List<String> openBugs = loadOpenBugs(new File(TestUtil.getResourcePath(AnalyzeWANSerializablesJUnitTest.class, "openBugs.txt")));
-    excludedClasses.addAll(openBugs);
-    
-    String cp = System.getProperty("java.class.path");
-    System.out.println("java classpath is " + cp);
-    System.out.flush();
-    String[] entries = cp.split(File.pathSeparator);
-    String buildDirName =
-         "geode-wan"+File.separatorChar
-        +"build"+File.separatorChar
-        +"classes"+File.separatorChar
-        +"main";
-    String buildDir = null;
-    
-    for (int i=0; i<entries.length  &&  buildDir==null; i++) {
-      System.out.println("examining '" + entries[i] + "'");
-      System.out.flush();
-      if (entries[i].endsWith(buildDirName)) {
-        buildDir = entries[i];
-      }
-    }
-    if (buildDir != null) {
-      System.out.println("loading class files from " + buildDir);
-      System.out.flush();
-      long start = System.currentTimeMillis();
-      loadClassesFromBuild(new File(buildDir), excludedClasses);
-      long finish = System.currentTimeMillis();
-      System.out.println("done loading " + classes.size() + " classes.  elapsed time = "
-          + (finish-start)/1000 + " seconds");
-    }
-    else {
-      fail("unable to find WAN classes");
-    }
-  }
-  
-  @AfterClass
-  public static void cleanup() {
-    if (classes != null) {
-      classes.clear();
-    }
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java
deleted file mode 100644
index a1aec80..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java
+++ /dev/null
@@ -1,962 +0,0 @@
-/*
- * 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.internal.cache;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.DiskStoreFactory;
-import com.gemstone.gemfire.cache.EntryNotFoundException;
-import com.gemstone.gemfire.cache.Operation;
-import com.gemstone.gemfire.cache.PartitionAttributesFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.Region.Entry;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.cache.client.internal.LocatorDiscoveryCallbackAdapter;
-import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.LocalRegion.NonTXEntry;
-import com.gemstone.gemfire.internal.cache.partitioned.PRLocallyDestroyedException;
-import com.gemstone.gemfire.internal.cache.versions.VersionSource;
-import com.gemstone.gemfire.internal.cache.versions.VersionStamp;
-import com.gemstone.gemfire.internal.cache.versions.VersionTag;
-import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.Invoke;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-/**
- * @since GemFire 7.0.1
- */
-@Category(DistributedTest.class)
-public class UpdateVersionDUnitTest extends JUnit4DistributedTestCase {
-
-  protected static final String regionName = "testRegion";
-  protected static Cache cache;
-  private static Set<IgnoredException>expectedExceptions = new HashSet<IgnoredException>();
-
-  @Override
-  public final void preTearDown() throws Exception {
-    closeCache();
-    Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() {
-      closeCache();
-     } });
-  }
-  
-  @Test
-  public void testUpdateVersionAfterCreateWithSerialSender() {
-    Host host = Host.getHost(0);
-    VM vm0 = host.getVM(0); // server1 site1
-    VM vm1 = host.getVM(1); // server2 site1
-
-    VM vm2 = host.getVM(2); // server1 site2
-    VM vm3 = host.getVM(3); // server2 site2
-
-    final String key = "key-1";
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
-
-    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort));
-    vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, false, 10, 1, false, false, null, true ));
-    
-    vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1));
-    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
-    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
-
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
-    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
-
-    vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
-    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort));
-    vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));    
-    
-    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Update a single entry and get its version") {
-      
-      @Override
-      public Object call() throws CacheException {
-        Cache cache = CacheFactory.getAnyInstance();
-        Region region = cache.getRegion(regionName);
-        assertTrue(region instanceof PartitionedRegion);
-
-        region.put(key, "value-1");
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        // Create a duplicate entry version tag from stamp with newer
-        // time-stamp.
-        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
-        VersionTag tag = VersionTag.create(memberId);
-
-        int entryVersion = stamp.getEntryVersion()-1;
-        int dsid = stamp.getDistributedSystemId();
-        long time = System.currentTimeMillis();
-
-        tag.setEntryVersion(entryVersion);
-        tag.setDistributedSystemId(dsid);
-        tag.setVersionTimeStamp(time);
-        tag.setIsRemoteForTesting();
-
-        EntryEventImpl event = createNewEvent((PartitionedRegion) region, tag,
-            entry.getKey(), "value-2");
-
-        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
-
-        // Verify the new stamp
-        entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        stamp = regionEntry.getVersionStamp();
-        assertEquals(
-            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
-            time, stamp.getVersionTimeStamp());
-        assertEquals(++entryVersion, stamp.getEntryVersion());
-        assertEquals(dsid, stamp.getDistributedSystemId());
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
-      
-      @Override
-      public Object call() throws Exception {
-        
-        Cache cache = CacheFactory.getAnyInstance();
-        final PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
-
-        // wait for entry to be received
-        WaitCriterion wc = new WaitCriterion() {
-          public boolean done() {
-            Entry<?,?> entry = null;
-            try {
-              entry = region.getDataStore().getEntryLocally(0, key, false, false);
-            } catch (EntryNotFoundException e) {
-              // expected
-            } catch (ForceReattemptException e) {
-              // expected
-            } catch (PRLocallyDestroyedException e) {
-              throw new RuntimeException("unexpected exception", e);
-            }
-            if (entry != null) {
-              LogWriterUtils.getLogWriter().info("found entry " + entry);
-            }
-            return (entry != null);
-          }
-
-          public String description() {
-            return "Expected "+key+" to be received on remote WAN site";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        wc = new WaitCriterion() {
-          public boolean done() {
-            Entry entry = region.getEntry(key);
-            assertTrue(entry instanceof EntrySnapshot);
-            RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
-          }
-          public String description() {
-            return "waiting for timestamp to be updated";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        Entry entry = region.getEntry(key);
-        assertTrue("entry class is wrong: " + entry, entry instanceof EntrySnapshot);
-        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
-  }
-
-  @Test
-  public void testUpdateVersionAfterCreateWithSerialSenderOnDR() {
-    Host host = Host.getHost(0);
-    VM vm0 = host.getVM(0); // server1 site1
-    VM vm1 = host.getVM(1); // server2 site1
-
-    VM vm2 = host.getVM(2); // server1 site2
-    VM vm3 = host.getVM(3); // server2 site2
-
-    final String key = "key-1";
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
-
-    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort));
-    vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, false, 10, 1, false, false, null, true ));
-    
-    vm0.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, "ln1"));
-    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
-    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
-
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
-    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
-
-    vm2.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, ""));
-    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort ));
-    vm3.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, ""));    
-    
-    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Update a single entry and get its version") {
-      
-      @Override
-      public Object call() throws CacheException {
-        Cache cache = CacheFactory.getAnyInstance();
-        Region region = cache.getRegion(regionName);
-        assertTrue(region instanceof DistributedRegion);
-
-        region.put(key, "value-1");
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof NonTXEntry);
-        RegionEntry regionEntry = ((NonTXEntry) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        // Create a duplicate entry version tag from stamp with newer
-        // time-stamp.
-        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
-        VersionTag tag = VersionTag.create(memberId);
-
-        int entryVersion = stamp.getEntryVersion()-1;
-        int dsid = stamp.getDistributedSystemId();
-        long time = System.currentTimeMillis();
-
-        tag.setEntryVersion(entryVersion);
-        tag.setDistributedSystemId(dsid);
-        tag.setVersionTimeStamp(time);
-        tag.setIsRemoteForTesting();
-
-        EntryEventImpl event = createNewEvent((DistributedRegion) region, tag,
-            entry.getKey(), "value-2");
-
-        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
-
-        // Verify the new stamp
-        entry = region.getEntry(key);
-        assertTrue(entry instanceof NonTXEntry);
-        regionEntry = ((NonTXEntry) entry).getRegionEntry();
-
-        stamp = regionEntry.getVersionStamp();
-        assertEquals(
-            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
-            time, stamp.getVersionTimeStamp());
-        assertEquals(entryVersion+1, stamp.getEntryVersion());
-        assertEquals(dsid, stamp.getDistributedSystemId());
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
-      
-      @Override
-      public Object call() throws Exception {
-        
-        Cache cache = CacheFactory.getAnyInstance();
-        final Region region = cache.getRegion(regionName);
-
-        // wait for entry to be received
-        WaitCriterion wc = new WaitCriterion() {
-          public boolean done() {
-            return (region.getEntry(key) != null);
-          }
-
-          public String description() {
-            return "Expected key-1 to be received on remote WAN site";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        wc = new WaitCriterion() {
-          public boolean done() {
-            Entry entry = region.getEntry(key);
-            assertTrue(entry instanceof NonTXEntry);
-            RegionEntry regionEntry = ((NonTXEntry) entry).getRegionEntry();
-            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
-          }
-          public String description() {
-            return "waiting for timestamp to be updated";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof NonTXEntry);
-        RegionEntry regionEntry = ((NonTXEntry) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
-  }
-
-  @Test
-  public void testUpdateVersionAfterCreateWithParallelSender() {
-    Host host = Host.getHost(0);
-    VM vm0 = host.getVM(0); // server1 site1
-    VM vm1 = host.getVM(1); // server2 site1
-
-    VM vm2 = host.getVM(2); // server1 site2
-    VM vm3 = host.getVM(3); // server2 site2
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
-
-    final String key = "key-1";
-
-    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort));
-    vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, true, 10, 1, false, false, null, true ));
-    
-    vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1));
-    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
-    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
-    
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
-    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
-
-    vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
-
-    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort));
-    vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
-    
-    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Put a single entry and get its version") {
-      
-      @Override
-      public Object call() throws CacheException {
-        Cache cache = CacheFactory.getAnyInstance();
-        Region region = cache.getRegion(regionName);
-        assertTrue(region instanceof PartitionedRegion);
-
-        region.put(key, "value-1");
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        // Create a duplicate entry version tag from stamp with newer
-        // time-stamp.
-        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
-        VersionTag tag = VersionTag.create(memberId);
-
-        int entryVersion = stamp.getEntryVersion()-1;
-        int dsid = stamp.getDistributedSystemId();
-        long time = System.currentTimeMillis();
-
-        tag.setEntryVersion(entryVersion);
-        tag.setDistributedSystemId(dsid);
-        tag.setVersionTimeStamp(time);
-        tag.setIsRemoteForTesting();
-
-        EntryEventImpl event = createNewEvent((PartitionedRegion) region, tag,
-            entry.getKey(), "value-2");
-
-        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
-
-        // Verify the new stamp
-        entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        stamp = regionEntry.getVersionStamp();
-        assertEquals(
-            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
-            time, stamp.getVersionTimeStamp());
-        assertEquals(++entryVersion, stamp.getEntryVersion());
-        assertEquals(dsid, stamp.getDistributedSystemId());
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
-      
-      @Override
-      public Object call() throws Exception {
-        
-        Cache cache = CacheFactory.getAnyInstance();
-        final PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
-
-        // wait for entry to be received
-        WaitCriterion wc = new WaitCriterion() {
-          public boolean done() {
-            Entry<?,?> entry = null;
-            try {
-              entry = region.getDataStore().getEntryLocally(0, key, false, false);
-            } catch (EntryNotFoundException e) {
-              // expected
-            } catch (ForceReattemptException e) {
-              // expected
-            } catch (PRLocallyDestroyedException e) {
-              throw new RuntimeException("unexpected exception", e);
-            }
-            if (entry != null) {
-              LogWriterUtils.getLogWriter().info("found entry " + entry);
-            }
-            return (entry != null);
-          }
-
-          public String description() {
-            return "Expected key-1 to be received on remote WAN site";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        wc = new WaitCriterion() {
-          public boolean done() {
-            Entry entry = region.getEntry(key);
-            assertTrue(entry instanceof EntrySnapshot);
-            RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
-          }
-          public String description() {
-            return "waiting for timestamp to be updated";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
-  }
-
-  @Test
-  public void testUpdateVersionAfterCreateWithConcurrentSerialSender() {
-    Host host = Host.getHost(0);
-    VM vm0 = host.getVM(0); // server1 site1
-    VM vm1 = host.getVM(1); // server2 site1
-
-    VM vm2 = host.getVM(2); // server1 site2
-    VM vm3 = host.getVM(3); // server2 site2
-
-    // Site 1
-    Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 ));
-
-    final String key = "key-1";
-
-    vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort ));
-    vm0.invoke(() -> UpdateVersionDUnitTest.createConcurrentSender( "ln1", 2, false, 10, 2, false, false, null, true, 2 ));
-    
-    vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1));
-    vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" ));
-    vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" ));
-    
-    //Site 2
-    Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort ));
-    Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort ));
-
-    vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));
-
-    vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort ));
-    vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1));    
-    
-    final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Put a single entry and get its version") {
-      
-      @Override
-      public Object call() throws CacheException {
-        Cache cache = CacheFactory.getAnyInstance();
-        Region region = cache.getRegion(regionName);
-        assertTrue(region instanceof PartitionedRegion);
-
-        region.put(key, "value-1");
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        // Create a duplicate entry version tag from stamp with newer
-        // time-stamp.
-        VersionSource memberId = (VersionSource) cache.getDistributedSystem().getDistributedMember();
-        VersionTag tag = VersionTag.create(memberId);
-
-        int entryVersion = stamp.getEntryVersion()-1;
-        int dsid = stamp.getDistributedSystemId();
-        long time = System.currentTimeMillis();
-
-        tag.setEntryVersion(entryVersion);
-        tag.setDistributedSystemId(dsid);
-        tag.setVersionTimeStamp(time);
-        tag.setIsRemoteForTesting();
-
-        EntryEventImpl event = createNewEvent((PartitionedRegion) region, tag,
-            entry.getKey(), "value-2");
-
-        ((LocalRegion) region).basicUpdate(event, false, true, 0L, false);
-
-        // Verify the new stamp
-        entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        stamp = regionEntry.getVersionStamp();
-        assertEquals(
-            "Time stamp did NOT get updated by UPDATE_VERSION operation on LocalRegion",
-            time, stamp.getVersionTimeStamp());
-        assertEquals(++entryVersion, stamp.getEntryVersion());
-        assertEquals(dsid, stamp.getDistributedSystemId());
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    VersionTag remoteTag = (VersionTag) vm3.invoke(new SerializableCallable("Get timestamp from remote site") {
-      
-      @Override
-      public Object call() throws Exception {
-        
-        Cache cache = CacheFactory.getAnyInstance();
-        final PartitionedRegion region = (PartitionedRegion)cache.getRegion(regionName);
-
-        // wait for entry to be received
-        WaitCriterion wc = new WaitCriterion() {
-          public boolean done() {
-            Entry<?,?> entry = null;
-            try {
-              entry = region.getDataStore().getEntryLocally(0, key, false, false);
-            } catch (EntryNotFoundException e) {
-              // expected
-            } catch (ForceReattemptException e) {
-              // expected
-            } catch (PRLocallyDestroyedException e) {
-              throw new RuntimeException("unexpected exception", e);
-            }
-            if (entry != null) {
-              LogWriterUtils.getLogWriter().info("found entry " + entry);
-            }
-            return (entry != null);
-          }
-
-          public String description() {
-            return "Expected key-1 to be received on remote WAN site";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        wc = new WaitCriterion() {
-          public boolean done() {
-            Entry entry = region.getEntry(key);
-            assertTrue(entry instanceof EntrySnapshot);
-            RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-            return regionEntry.getVersionStamp().getVersionTimeStamp() == tag.getVersionTimeStamp();
-          }
-          public String description() {
-            return "waiting for timestamp to be updated";
-          }
-        };
-        Wait.waitForCriterion(wc, 30000, 500, true);
-
-        Entry entry = region.getEntry(key);
-        assertTrue(entry instanceof EntrySnapshot);
-        RegionEntry regionEntry = ((EntrySnapshot) entry).getRegionEntry();
-
-        VersionStamp stamp = regionEntry.getVersionStamp();
-
-        return stamp.asVersionTag();
-      }
-    });
-
-    assertEquals("Local and remote site have different timestamps", tag.getVersionTimeStamp(), remoteTag.getVersionTimeStamp());
-  }
-
-  private VersionTagHolder createNewEvent(LocalRegion region, VersionTag tag, Object key, Object value) {
-    VersionTagHolder updateEvent = new VersionTagHolder(tag);
-    updateEvent.setOperation(Operation.UPDATE);
-    updateEvent.setRegion(region);
-    if (region instanceof PartitionedRegion) {
-      updateEvent.setKeyInfo(((PartitionedRegion)region).getKeyInfo(key));
-    } else {
-      updateEvent.setKeyInfo(new KeyInfo(key, value, null));
-    }
-    updateEvent.setNewValue(value);
-    updateEvent.setGenerateCallbacks(true);
-    updateEvent.distributedMember = region.getSystem().getDistributedMember();
-    updateEvent.setNewEventId(region.getSystem());
-    return updateEvent;
-  }
-
-  /*
-   * Helper Methods
-   */
-
-  private static void createCache(Integer locPort) {
-    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
-    props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-    props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
-    props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds); 
-    IgnoredException ex = new IgnoredException("could not get remote locator information for remote site");
-    cache.getLogger().info(ex.getAddMessage());
-    expectedExceptions.add(ex);
-    ex = new IgnoredException("Pool ln1 is not available");
-    cache.getLogger().info(ex.getAddMessage());
-    expectedExceptions.add(ex);
-  }
-  
-  private static void closeCache() {
-    if (cache != null && !cache.isClosed()) {
-      for (IgnoredException expectedException: expectedExceptions) {
-        cache.getLogger().info(expectedException.getRemoveMessage());
-      }
-      expectedExceptions.clear();
-      cache.getDistributedSystem().disconnect();
-      cache.close();
-    }
-    cache = null;
-  }
-
-  public static void createSender(String dsName, int remoteDsId,
-      boolean isParallel, Integer maxMemory, Integer batchSize,
-      boolean isConflation, boolean isPersistent, GatewayEventFilter filter,
-      boolean isManualStart) {
-    File persistentDirectory = new File(dsName + "_disk_"
-        + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File[] dirs1 = new File[] { persistentDirectory };
-    if (isParallel) {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      ((InternalGatewaySenderFactory) gateway)
-          .setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      if (isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-            .getName());
-      } else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsId);
-
-    } else {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      ((InternalGatewaySenderFactory) gateway)
-          .setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      if (isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName)
-            .getName());
-      } else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.create(dsName, remoteDsId);
-    }
-  }
-
-  public static void createPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    PartitionAttributesFactory pFact = new PartitionAttributesFactory();
-    pFact.setTotalNumBuckets(totalNumBuckets);
-    pFact.setRedundantCopies(redundantCopies);
-    pFact.setRecoveryDelay(0);
-    fact.setPartitionAttributes(pFact.create());
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void createReplicatedRegion(String regionName, String senderIds){
-    AttributesFactory fact = new AttributesFactory();
-    if(senderIds!= null){
-      StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
-      while (tokenizer.hasMoreTokens()){
-        String senderId = tokenizer.nextToken();
-        fact.addGatewaySenderId(senderId);
-      }
-    }
-    fact.setDataPolicy(DataPolicy.REPLICATE);
-    fact.setScope(Scope.DISTRIBUTED_ACK);
-    Region r = cache.createRegionFactory(fact.create()).create(regionName);
-    assertNotNull(r);
-  }
-
-  public static void waitForSenderRunningState(String senderId){
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    final GatewaySender sender = getGatewaySenderById(senders, senderId);
-    
-    WaitCriterion wc = new WaitCriterion() {
-      public boolean done() {
-        if (sender != null && sender.isRunning()) {
-          return true;
-        }
-        return false;
-      }
-
-      public String description() {
-        return "Expected sender isRunning state to be true but is false";
-      }
-    };
-    Wait.waitForCriterion(wc, 300000, 500, true);
-  }
-
-  public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
-    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + remoteLocPort + "]");
-    props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
-    props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
-    test.getSystem(props);
-    return port;
-  }
-
-  public static void createConcurrentSender(String dsName, int remoteDsId,
-      boolean isParallel, Integer maxMemory,
-      Integer batchSize, boolean isConflation, boolean isPersistent,
-      GatewayEventFilter filter, boolean isManualStart, int concurrencyLevel) {
-    File persistentDirectory = new File(dsName +"_disk_"+System.currentTimeMillis()+"_" + VM.getCurrentVMNum());
-    persistentDirectory.mkdir();
-    DiskStoreFactory dsf = cache.createDiskStoreFactory();
-    File [] dirs1 = new File[] {persistentDirectory};
-    
-    if(isParallel) {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setParallel(true);
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      if(isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      gateway.create(dsName, remoteDsId);
-      
-    }else {
-      GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
-      gateway.setMaximumQueueMemory(maxMemory);
-      gateway.setBatchSize(batchSize);
-      gateway.setManualStart(isManualStart);
-      ((InternalGatewaySenderFactory)gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
-      if (filter != null) {
-        gateway.addGatewayEventFilter(filter);
-      }
-      gateway.setBatchConflationEnabled(isConflation);
-      if(isPersistent) {
-        gateway.setPersistenceEnabled(true);
-        gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
-      }
-      else {
-        DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
-        gateway.setDiskStoreName(store.getName());
-      }
-      gateway.setDispatcherThreads(concurrencyLevel);
-      gateway.create(dsName, remoteDsId);
-    }
-  }
-
-  public static int createReceiver(int locPort) {
-    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "localhost[" + locPort
-        + "]");
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);    
-    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
-    GatewayReceiver receiver = fact.create();
-    try {
-      receiver.start();
-    } catch (IOException e) {
-      e.printStackTrace();
-      fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port);
-    }
-    return port;
-  }
-
-  public static void startSender(String senderId){
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        sender = s;
-        break;
-      }
-    }
-    sender.start();
-  }
-
-  protected static class MyLocatorCallback extends LocatorDiscoveryCallbackAdapter {
-
-    private final Set discoveredLocators = new HashSet();
-
-    private final Set removedLocators = new HashSet();
-
-    @Override
-    public synchronized void locatorsDiscovered(List locators) {
-      discoveredLocators.addAll(locators);
-      notifyAll();
-    }
-
-    @Override
-    public synchronized void locatorsRemoved(List locators) {
-      removedLocators.addAll(locators);
-      notifyAll();
-    }
-
-    public boolean waitForDiscovery(InetSocketAddress locator, long time)
-        throws InterruptedException {
-      return waitFor(discoveredLocators, locator, time);
-    }
-
-    public boolean waitForRemove(InetSocketAddress locator, long time)
-        throws InterruptedException {
-      return waitFor(removedLocators, locator, time);
-    }
-
-    private synchronized boolean waitFor(Set set, InetSocketAddress locator,
-        long time) throws InterruptedException {
-      long remaining = time;
-      long endTime = System.currentTimeMillis() + time;
-      while (!set.contains(locator) && remaining >= 0) {
-        wait(remaining);
-        remaining = endTime - System.currentTimeMillis();
-      }
-      return set.contains(locator);
-    }
-
-    public synchronized Set getDiscovered() {
-      return new HashSet(discoveredLocators);
-    }
-
-    public synchronized Set getRemoved() {
-      return new HashSet(removedLocators);
-    }
-  }
-
-  private static GatewaySender getGatewaySenderById(Set<GatewaySender> senders, String senderId) {
-    for(GatewaySender s : senders){
-      if(s.getId().equals(senderId)){
-        return s;
-      }
-    }
-    //if none of the senders matches with the supplied senderId, return null
-    return null;
-  }
-
-  public static Integer createFirstLocatorWithDSId(int dsId) {
-    UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, ""+dsId);
-    props.setProperty(LOCATORS, "localhost[" + port + "]");
-    props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
-    props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
-    props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
-    test.getSystem(props);
-    return port;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
deleted file mode 100755
index 96d441c..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.cache.EvictionAction;
-import com.gemstone.gemfire.cache.EvictionAttributes;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.client.Pool;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.ha.HAContainerRegion;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class CacheClientNotifierDUnitTest extends WANTestBase {
-
-  private static final int NUM_KEYS = 10;
-  
-  private int createCacheServerWithCSC(VM vm, final boolean withCSC, final int capacity,
-      final String policy, final String diskStoreName) {
-    final int serverPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-
-    SerializableRunnable createCacheServer = new SerializableRunnable() {
-      @Override
-      public void run() throws Exception {
-        CacheServerImpl server = (CacheServerImpl)cache.addCacheServer();
-        server.setPort(serverPort);
-        if (withCSC) {
-          if (diskStoreName != null) {
-            DiskStore ds = cache.findDiskStore(diskStoreName);
-            if(ds == null) {
-              ds = cache.createDiskStoreFactory().create(diskStoreName);
-            }
-          }
-          ClientSubscriptionConfig csc = server.getClientSubscriptionConfig();
-          csc.setCapacity(capacity);
-          csc.setEvictionPolicy(policy);
-          csc.setDiskStoreName(diskStoreName);
-          server.setHostnameForClients("localhost");
-          //server.setGroups(new String[]{"serv"});
-        }
-        try {
-          server.start();
-        } catch (IOException e) {
-          com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e);
-        }
-      }
-    };
-    vm.invoke(createCacheServer);
-    return serverPort;
-  }
-
-  private void checkCacheServer(VM vm, final int serverPort, final boolean withCSC, final int capacity) {
-    SerializableRunnable checkCacheServer = new SerializableRunnable() {
-
-      @Override
-      public void run() throws Exception {
-        List<CacheServer> cacheServers = ((GemFireCacheImpl)cache).getCacheServersAndGatewayReceiver();
-        CacheServerImpl server = null;
-        for (CacheServer cs:cacheServers) {
-          if (cs.getPort() == serverPort) {
-            server = (CacheServerImpl)cs;
-            break;
-          }
-        }
-        assertNotNull(server);
-        CacheClientNotifier ccn = server.getAcceptor().getCacheClientNotifier();
-        HAContainerRegion haContainer = (HAContainerRegion)ccn.getHaContainer();
-        if (server.getAcceptor().isGatewayReceiver()) {
-          assertNull(haContainer);
-          return;
-        }
-        Region internalRegion = haContainer.getMapForTest();
-        RegionAttributes ra = internalRegion.getAttributes();
-        EvictionAttributes ea = ra.getEvictionAttributes();
-        if (withCSC) {
-          assertNotNull(ea);
-          assertEquals(capacity, ea.getMaximum());
-          assertEquals(EvictionAction.OVERFLOW_TO_DISK, ea.getAction());
-        } else {
-          assertNull(ea);
-        }
-      }
-    };
-    vm.invoke(checkCacheServer);
-  }
-
-  public static void closeACacheServer(final int serverPort) {
-    List<CacheServer> cacheServers = cache.getCacheServers();
-    CacheServerImpl server = null;
-    for (CacheServer cs:cacheServers) {
-      if (cs.getPort() == serverPort) {
-        server = (CacheServerImpl)cs;
-        break;
-      }
-    }
-    assertNotNull(server);
-    server.stop();
-  }
-
-  private void verifyRegionSize(VM vm, final int expect) {
-    SerializableRunnable verifyRegionSize = new SerializableRunnable() {
-      @Override
-      public void run() throws Exception {
-        final Region region = cache.getRegion(getTestMethodName() + "_PR");
-
-        Wait.waitForCriterion(new WaitCriterion() {
-          public boolean done() {
-            return region.size() == expect; 
-          }
-          public String description() {
-            return null;
-          }
-        }, 60000, 100, false);
-        assertEquals(expect, region.size());
-      }
-    };
-    vm.invoke(verifyRegionSize);
-  }
-  
-  /**
-   * The test will start several cache servers, including gateway receivers.
-   * Shutdown them and verify the CacheClientNotifier for each server is correct
-   */
-  @Test
-  public void testNormalClient2MultipleCacheServer() throws Exception {
-    doMultipleCacheServer(false);
-  }
-
-  public void doMultipleCacheServer(boolean durable) throws Exception {
-    /* test scenario: */
-    /* create 1 GatewaySender on vm0 */
-    /* create 1 GatewayReceiver on vm1 */
-    /* create 2 cache servers on vm1, one with overflow. */
-    /* verify if the cache server2 still has the overflow attributes */
-    /* create 1 cache client1 on vm2 to register interest on cache server1 */
-    /* create 1 cache client2 on vm3 to register interest on cache server1 */
-    /* do some puts to GatewaySender on vm0 */
-    
-    // create sender at ln
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    
-    // create receiver and cache servers will be at ny
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    vm1.invoke(() -> WANTestBase.createCache( nyPort ));
-    int receiverPort = vm1.invoke(() -> WANTestBase.createReceiver());
-    checkCacheServer(vm1, receiverPort, false, 0);
-    
-    // create PR for receiver
-    vm1.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    
-    // create cache server1 with overflow
-    int serverPort = createCacheServerWithCSC(vm1, true, 3, "entry", "DEFAULT");
-    checkCacheServer(vm1, serverPort, true, 3);
-    
-    // create cache server 2
-    final int serverPort2 = createCacheServerWithCSC(vm1, false, 0, null, null);
-    // Currently, only the first cache server's overflow attributes will take effect
-    // It will be enhanced in GEODE-1102
-    checkCacheServer(vm1, serverPort2, true, 3);
-    LogService.getLogger().info("receiverPort="+receiverPort+",serverPort="+serverPort+",serverPort2="+serverPort2);
-    
-    vm2.invoke(() -> createClientWithLocator(nyPort, "localhost", getTestMethodName() + "_PR", "123", durable));
-    vm3.invoke(() -> createClientWithLocator(nyPort, "localhost", getTestMethodName() + "_PR", "124", durable));
-
-    vm0.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm0.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 400, false, false, null, true ));
-    vm0.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm0.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm0.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", NUM_KEYS ));
-    
-    /* verify */
-    verifyRegionSize(vm0, NUM_KEYS);
-    verifyRegionSize(vm1, NUM_KEYS);
-    verifyRegionSize(vm3, NUM_KEYS);
-    verifyRegionSize(vm2, NUM_KEYS);
-
-    // close a cache server, then re-test
-    vm1.invoke(() -> closeACacheServer(serverPort2));
-
-    vm0.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", NUM_KEYS*2 ));
-
-    /* verify */
-    verifyRegionSize(vm0, NUM_KEYS*2);
-    verifyRegionSize(vm1, NUM_KEYS*2);
-    verifyRegionSize(vm3, NUM_KEYS*2);
-    verifyRegionSize(vm2, NUM_KEYS*2);
-    
-    disconnectAllFromDS();
-  }
-
-  public static void createClientWithLocator(int port0,String host,
-      String regionName, String clientId, boolean isDurable) {
-    WANTestBase test = new WANTestBase();
-    Properties props = test.getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
-    if (isDurable) {
-      props.setProperty(DURABLE_CLIENT_ID, clientId);
-      props.setProperty(DURABLE_CLIENT_TIMEOUT, "" + 200);
-    }
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-
-    assertNotNull(cache);
-    CacheServerTestUtil.disableShufflingOfEndpoints();
-    Pool p;
-    try {
-      p = PoolManager.createFactory().addLocator(host, port0)
-          .setPingInterval(250).setSubscriptionEnabled(true)
-          .setSubscriptionRedundancy(-1).setReadTimeout(2000)
-          .setSocketBufferSize(1000).setMinConnections(6).setMaxConnections(10)
-          .setRetryAttempts(3).create(regionName);
-    } finally {
-      CacheServerTestUtil.enableShufflingOfEndpoints();
-    }
-
-    AttributesFactory factory = new AttributesFactory();
-    factory.setPoolName(p.getName());
-    factory.setDataPolicy(DataPolicy.NORMAL);
-    RegionAttributes attrs = factory.create();
-    region = cache.createRegion(regionName, attrs);
-    region.registerInterest("ALL_KEYS");
-    assertNotNull(region);
-    if (isDurable) {
-      cache.readyForEvents();
-    }
-    LogWriterUtils.getLogWriter().info(
-        "Distributed Region " + regionName + " created Successfully :"
-            + region.toString() + " in a "+(isDurable?"durable":"")+" client");
-  }
-}


[45/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntries.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntries.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntries.java
new file mode 100644
index 0000000..48a2ca9
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntries.java
@@ -0,0 +1,135 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * Holds a ordered collection of entries matching a search query.
+ *
+ * @param <K> the type of key
+ */
+public class TopEntries<K> implements DataSerializableFixedID {
+  // ordered collection of entries
+  private List<EntryScore<K>> hits = new ArrayList<>();
+
+  // the maximum number of entries stored in this
+  private int limit;
+
+  // comparator to order entryScore instances
+  final Comparator<EntryScore<K>> comparator = new EntryScoreComparator();
+
+  public TopEntries() {
+    this(LuceneQueryFactory.DEFAULT_LIMIT);
+  }
+
+  public TopEntries(int limit) {
+    if (limit < 0) {
+      throw new IllegalArgumentException();
+    }
+    this.limit = limit;
+  }
+
+  /**
+   * Adds an entry to the collection. The new entry must have a lower score than all previous entries added to the
+   * collection. The new entry will be ignored if the limit is already reached.
+   * 
+   * @param entry
+   */
+  public void addHit(EntryScore<K> entry) {
+    if (hits.size() > 0) {
+      EntryScore lastEntry = hits.get(hits.size() - 1);
+      if (comparator.compare(lastEntry, entry) < 0) {
+        throw new IllegalArgumentException();
+      }
+    }
+
+    if (hits.size() >= limit) {
+      return;
+    }
+
+    hits.add(entry);
+  }
+
+  /**
+   * @return count of entries in the collection
+   */
+  public int size() {
+    return hits.size();
+  }
+
+  /**
+   * @return The entries collection managed by this instance
+   */
+  public List<EntryScore<K>> getHits() {
+    return hits;
+  }
+
+  /**
+   * @return The maximum capacity of this collection
+   */
+  public int getLimit() {
+    return limit;
+  }
+
+  /**
+   * Compares scores of two entries using natural ordering. I.e. it returns -1 if the first entry's score is less than
+   * the second one.
+   */
+  class EntryScoreComparator implements Comparator<EntryScore<K>> {
+    @Override
+    public int compare(EntryScore<K> o1, EntryScore<K> o2) {
+      return Float.compare(o1.getScore(), o2.getScore());
+    }
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_TOP_ENTRIES;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    out.writeInt(limit);
+    DataSerializer.writeObject(hits, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    limit = in.readInt();
+    hits = DataSerializer.readObject(in);
+  };
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollector.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollector.java
new file mode 100644
index 0000000..94b8a3a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollector.java
@@ -0,0 +1,102 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * An implementation of {@link IndexResultCollector} to collect {@link EntryScore}. It is expected that the results will
+ * be ordered by score of the entry.
+ */
+public class TopEntriesCollector implements IndexResultCollector, DataSerializableFixedID {
+  private String name;
+
+  private TopEntries entries;
+
+  public TopEntriesCollector() {
+    this(null);
+  }
+
+  public TopEntriesCollector(String name) {
+    this(name, LuceneQueryFactory.DEFAULT_LIMIT);
+  }
+
+  public TopEntriesCollector(String name, int limit) {
+    this.name = name;
+    this.entries = new TopEntries(limit);
+  }
+
+  @Override
+  public void collect(Object key, float score) {
+    collect(new EntryScore(key, score));
+  }
+
+  public void collect(EntryScore entry) {
+    entries.addHit(entry);
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public int size() {
+    TopEntries entries = getEntries();
+    return entries == null ? 0 : entries.size();
+  }
+
+  /**
+   * @return The entries collected by this collector
+   */
+  public TopEntries getEntries() {
+    return entries;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_TOP_ENTRIES_COLLECTOR;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeString(name, out);
+    DataSerializer.writeObject(entries, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    name = DataSerializer.readString(in);
+    entries = DataSerializer.readObject(in);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorManager.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorManager.java
new file mode 100644
index 0000000..cf6e420
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorManager.java
@@ -0,0 +1,178 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.PriorityQueue;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
+import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntries.EntryScoreComparator;
+import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * An implementation of {@link CollectorManager} for managing {@link TopEntriesCollector}. This is used by a member to
+ * collect top matching entries from local buckets
+ */
+public class TopEntriesCollectorManager implements CollectorManager<TopEntriesCollector>, DataSerializableFixedID {
+  private static final Logger logger = LogService.getLogger();
+
+  private int limit;
+  private String id;
+
+  public TopEntriesCollectorManager() {
+    this(null, 0);
+  }
+
+  public TopEntriesCollectorManager(String id) {
+    this(id, 0);
+  }
+
+  public TopEntriesCollectorManager(String id, int resultLimit) {
+    this.limit = resultLimit <= 0 ? LuceneQueryFactory.DEFAULT_LIMIT : resultLimit;
+    this.id = id == null ? String.valueOf(this.hashCode()) : id;
+    logger.debug("Max count of entries to be produced by {} is {}", id, limit);
+  }
+
+  @Override
+  public TopEntriesCollector newCollector(String name) {
+    return new TopEntriesCollector(name, limit);
+  }
+
+  @Override
+  public TopEntriesCollector reduce(Collection<TopEntriesCollector> collectors) {
+    TopEntriesCollector mergedResult = new TopEntriesCollector(id, limit);
+    if (collectors.isEmpty()) {
+      return mergedResult;
+    }
+
+    final EntryScoreComparator scoreComparator = new TopEntries().new EntryScoreComparator();
+
+    // orders a entry with higher score above a doc with lower score
+    Comparator<ListScanner> entryListComparator = new Comparator<ListScanner>() {
+      @Override
+      public int compare(ListScanner l1, ListScanner l2) {
+        EntryScore o1 = l1.peek();
+        EntryScore o2 = l2.peek();
+        return scoreComparator.compare(o1, o2);
+      }
+    };
+
+    // The queue contains iterators for all bucket results. The queue puts the entry with the highest score at the head
+    // using score comparator.
+    PriorityQueue<ListScanner> entryListsPriorityQueue;
+    entryListsPriorityQueue = new PriorityQueue<ListScanner>(collectors.size(),
+        Collections.reverseOrder(entryListComparator));
+
+    for (IndexResultCollector collector : collectors) {
+      logger.debug("Number of entries found in collector {} is {}", collector.getName(), collector.size());
+
+      if (collector.size() > 0) {
+        entryListsPriorityQueue.add(new ListScanner(((TopEntriesCollector) collector).getEntries().getHits()));
+      }
+    }
+
+    logger.debug("Only {} count of entries will be reduced. Other entries will be ignored", limit);
+    while (entryListsPriorityQueue.size() > 0 && limit > mergedResult.size()) {
+
+      ListScanner scanner = entryListsPriorityQueue.remove();
+      EntryScore entry = scanner.next();
+      mergedResult.collect(entry);
+
+      if (scanner.hasNext()) {
+        entryListsPriorityQueue.add(scanner);
+      }
+    }
+
+    logger.debug("Reduced size of {} is {}", mergedResult.getName(), mergedResult.size());
+    return mergedResult;
+  }
+
+  /*
+   * Utility class to iterate on hits without modifying it
+   */
+  static class ListScanner {
+    private List<EntryScore> hits;
+    private int index = 0;
+
+    ListScanner(List<EntryScore> hits) {
+      this.hits = hits;
+    }
+
+    boolean hasNext() {
+      return index < hits.size();
+    }
+
+    EntryScore peek() {
+      return hits.get(index);
+    }
+
+    EntryScore next() {
+      return hits.get(index++);
+    }
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_TOP_ENTRIES_COLLECTOR_MANAGER;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeString(id, out);
+    out.writeInt(limit);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    id = DataSerializer.readString(in);
+    limit = in.readInt();
+  }
+
+  /**
+   * @return Id of this collector, if any
+   */
+  public String getId() {
+    return id;
+  }
+
+  /**
+   * @return Result limit enforced by the collectors created by this manager
+   */
+  public int getLimit() {
+    return limit;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
new file mode 100644
index 0000000..4a99bf8
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
@@ -0,0 +1,158 @@
+/*
+ * 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.lucene.internal.distributed;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.cache.lucene.LuceneQuery;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * A {@link ResultCollector} implementation for collecting and ordering {@link TopEntries}. The {@link TopEntries}
+ * objects will be created by members when a {@link LuceneQuery} is executed on the local data hosted by the member. The
+ * member executing this logic must have sufficient space to hold all the {@link EntryScore} documents returned from the
+ * members.
+ * 
+ * <p>
+ * This class will perform a lazy merge operation. Merge will take place if the merge {@link ResultCollector#getResult}
+ * is invoked or if the combined result size is more than the limit set. In the later case, merge will be performed
+ * whenever {@link ResultCollector#addResult} is invoked.
+ */
+public class TopEntriesFunctionCollector implements ResultCollector<TopEntriesCollector, TopEntries> {
+  // Use this instance to perform reduce operation
+  final CollectorManager<TopEntriesCollector> manager;
+
+  // latch to wait till all results are collected
+  private final CountDownLatch waitForResults = new CountDownLatch(1);
+
+  final String id;
+
+  // Instance of gemfire cache to check status and other utility methods
+  final private GemFireCacheImpl cache;
+  private static final Logger logger = LogService.getLogger();
+
+  private final Collection<TopEntriesCollector> subResults = new ArrayList<>();
+  private TopEntriesCollector mergedResults;
+
+  public TopEntriesFunctionCollector() {
+    this(null);
+  }
+
+  public TopEntriesFunctionCollector(LuceneFunctionContext<TopEntriesCollector> context) {
+    this(context, null);
+  }
+
+  public TopEntriesFunctionCollector(LuceneFunctionContext<TopEntriesCollector> context, GemFireCacheImpl cache) {
+    this.cache = cache;
+    id = cache == null ? String.valueOf(this.hashCode()) : cache.getName();
+
+    int limit = context == null ? 0 : context.getLimit();
+    
+    if (context != null && context.getCollectorManager() != null) {
+      this.manager = context.getCollectorManager();
+    } else {
+      this.manager = new TopEntriesCollectorManager(id, limit);
+    }
+  }
+
+  @Override
+  public TopEntries getResult() throws FunctionException {
+    try {
+      waitForResults.await();
+    } catch (InterruptedException e) {
+      logger.debug("Interrupted while waiting for result collection", e);
+      Thread.currentThread().interrupt();
+      if (cache != null) {
+        cache.getCancelCriterion().checkCancelInProgress(e);
+      }
+      throw new FunctionException(e);
+    }
+
+    return aggregateResults();
+  }
+
+  @Override
+  public TopEntries getResult(long timeout, TimeUnit unit) throws FunctionException {
+    try {
+      boolean result = waitForResults.await(timeout, unit);
+      if (!result) {
+        throw new FunctionException("Did not receive results from all members within wait time");
+      }
+    } catch (InterruptedException e) {
+      logger.debug("Interrupted while waiting for result collection", e);
+      Thread.currentThread().interrupt();
+      if (cache != null) {
+        cache.getCancelCriterion().checkCancelInProgress(e);
+      }
+      throw new FunctionException(e);
+    }
+
+    return aggregateResults();
+  }
+
+  private TopEntries aggregateResults() {
+    synchronized (subResults) {
+      if (mergedResults != null) {
+        return mergedResults.getEntries();
+      }
+      
+      mergedResults = manager.reduce(subResults);
+      return mergedResults.getEntries();
+    }
+  }
+
+  @Override
+  public void endResults() {
+    synchronized (subResults) {
+      waitForResults.countDown();
+    }
+  }
+
+  @Override
+  public void clearResults() {
+    synchronized (subResults) {
+      if (waitForResults.getCount() == 0) {
+        throw new IllegalStateException("This collector is closed and cannot accept anymore results");
+      }
+
+      subResults.clear();
+    }
+  }
+
+  @Override
+  public void addResult(DistributedMember memberID, TopEntriesCollector resultOfSingleExecution) {
+    synchronized (subResults) {
+      if (waitForResults.getCount() == 0) {
+        throw new IllegalStateException("This collector is closed and cannot accept anymore results");
+      }
+      subResults.add(resultOfSingleExecution);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/package-info.java
new file mode 100644
index 0000000..4079ad4
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+/**
+ * Classes used for distributing lucene queries to geode nodes. Contains the lucene related functions
+ * like {@link com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction} as well as objects that are
+ * passed between nodes like {@link com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore}
+ */
+
+package com.gemstone.gemfire.cache.lucene.internal.distributed;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/ChunkKey.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/ChunkKey.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/ChunkKey.java
new file mode 100644
index 0000000..8fbe356
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/ChunkKey.java
@@ -0,0 +1,123 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.UUID;
+
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * The key for a single chunk on a file stored within a region.
+ */
+public class ChunkKey implements DataSerializableFixedID {
+  UUID fileId;
+  int chunkId;
+  
+  /**
+   * Constructor used for serialization only.
+   */
+  public ChunkKey() {
+  }
+
+  ChunkKey(UUID fileName, int chunkId) {
+    this.fileId = fileName;
+    this.chunkId = chunkId;
+  }
+
+  /**
+   * @return the fileName
+   */
+  public UUID getFileId() {
+    return fileId;
+  }
+
+  /**
+   * @return the chunkId
+   */
+  public int getChunkId() {
+    return chunkId;
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + fileId.hashCode();
+    result = prime * result + chunkId;
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (!(obj instanceof ChunkKey)) {
+      return false;
+    }
+    ChunkKey other = (ChunkKey) obj;
+    if (chunkId != other.chunkId) {
+      return false;
+    }
+    if (fileId == null) {
+      if (other.fileId != null) {
+        return false;
+      }
+    } else if (!fileId.equals(other.fileId)) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_CHUNK_KEY;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    out.writeInt(chunkId);
+    out.writeLong(fileId.getMostSignificantBits());
+    out.writeLong(fileId.getLeastSignificantBits());
+  }
+
+  @Override
+  public void fromData(DataInput in)
+      throws IOException, ClassNotFoundException {
+    chunkId = in.readInt();
+    long high = in.readLong();
+    long low = in.readLong();
+    fileId = new UUID(high, low);
+  }
+
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/File.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/File.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/File.java
new file mode 100644
index 0000000..d27717e
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/File.java
@@ -0,0 +1,170 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.nio.file.Files;
+import java.util.UUID;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.Version;
+
+/**
+ * A file that is stored in a gemfire region.
+ */
+public class File implements DataSerializableFixedID {
+  
+  private transient FileSystem fileSystem;
+  private transient int chunkSize;
+
+  private String name;
+  long length = 0;
+  int chunks = 0;
+  long created = System.currentTimeMillis();
+  long modified = created;
+  UUID id = UUID.randomUUID();
+  
+  /**
+   * Constructor for serialization only
+   */
+  public File() {
+  }
+
+  File(final FileSystem fileSystem, final String name) {
+    setFileSystem(fileSystem);
+    
+    this.name = name;
+  }
+
+  /**
+   * @return the name
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @return the length
+   */
+  public long getLength() {
+    return length;
+  }
+
+  /**
+   * @return the created
+   */
+  public long getCreated() {
+    return created;
+  }
+
+  /**
+   * @return the modified
+   */
+  public long getModified() {
+    return modified;
+  }
+
+  /**
+   * Get an input stream that reads from the beginning the file
+   * 
+   * The input stream is not threadsafe
+   */
+  public SeekableInputStream getInputStream() {
+    // TODO get read lock?
+    return new FileInputStream(this);
+  }
+
+  /**
+   * Get an output stream that appends to the end
+   * of the file.
+   */
+  public OutputStream getOutputStream() {
+    return new FileOutputStream(this);
+  }
+
+  void setFileSystem(final FileSystem fileSystem) {
+    this.fileSystem = fileSystem;
+    this.chunkSize = FileSystem.CHUNK_SIZE;
+  }
+
+  int getChunkSize() {
+    return chunkSize;
+  }
+
+  public FileSystem getFileSystem() {
+    return fileSystem;
+  }
+
+  @Override
+  public Version[] getSerializationVersions() {
+    return null;
+  }
+
+  @Override
+  public int getDSFID() {
+    return LUCENE_FILE;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeString(name, out);
+    out.writeLong(length);
+    out.writeInt(chunks);
+    out.writeLong(created);
+    out.writeLong(modified);
+    out.writeLong(id.getMostSignificantBits());
+    out.writeLong(id.getLeastSignificantBits());
+  }
+
+  @Override
+  public void fromData(DataInput in)
+      throws IOException, ClassNotFoundException {
+    name = DataSerializer.readString(in);
+    length = in.readLong();
+    chunks = in.readInt();
+    created = in.readLong();
+    modified = in.readLong();
+    long high = in.readLong();
+    long low = in.readLong();
+    id = new UUID(high, low);
+  }
+
+
+  /**
+   * Export this to a {@link java.io.File}
+   */
+  public void export(final java.io.File exportLocation)
+  {
+    java.io.File targetFile = new java.io.File(exportLocation, getName());
+    try {
+      Files.copy(getInputStream(), targetFile.toPath());
+    }
+    catch (IOException e) {
+      throw new InternalGemFireError("Could not export file " + getName(), e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileInputStream.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileInputStream.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileInputStream.java
new file mode 100644
index 0000000..18194aa
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileInputStream.java
@@ -0,0 +1,166 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.io.EOFException;
+import java.io.IOException;
+
+/**
+ * An input stream that reads chunks from
+ * a File saved in the region. This input stream
+ * will keep going back to the region to look for
+ * chunks until nothing is found.
+ */
+final class FileInputStream extends SeekableInputStream {
+
+  private final File file;
+  private byte[] chunk = null;
+  private int chunkPosition = 0;
+  private int chunkId = 0;
+  private boolean open = true;
+
+  public FileInputStream(File file) {
+    this.file = file;
+    nextChunk();
+  }
+
+  public FileInputStream(FileInputStream other) {
+    this.file = other.file;
+    this.chunk = other.chunk;
+    this.chunkId = other.chunkId;
+    this.chunkPosition = other.chunkPosition;
+    this.open = other.open;
+  }
+
+  @Override
+  public int read() throws IOException {
+    assertOpen();
+
+    checkAndFetchNextChunk();
+
+    if (null == chunk) {
+      return -1;
+    }
+
+    return chunk[chunkPosition++] & 0xff;
+  }
+  
+  @Override
+  public void seek(long position) throws IOException {
+    if(position > file.length) {
+      throw new EOFException();
+    }
+    int targetChunk = (int) (position / file.getChunkSize());
+    int targetPosition = (int) (position % file.getChunkSize());
+    
+    if(targetChunk != (this.chunkId - 1)) {
+      chunk = file.getFileSystem().getChunk(this.file, targetChunk);
+      chunkId = targetChunk + 1;
+      chunkPosition = targetPosition;
+    } else {
+      chunkPosition = targetPosition;
+    }
+  }
+  
+  
+
+  @Override
+  public long skip(long n) throws IOException {
+    int currentPosition = (chunkId - 1) * file.getChunkSize() + chunkPosition;
+    seek(currentPosition + n);
+    return n;
+  }
+  
+  @Override
+  public void reset() throws IOException {
+    seek(0);
+  }
+
+  @Override
+  public int read(byte[] b, int off, int len) throws IOException {
+    assertOpen();
+
+    checkAndFetchNextChunk();
+
+    if (null == chunk) {
+      return -1;
+    }
+
+    int read = 0;
+    while (len > 0) {
+      final int min = Math.min(remaining(), len);
+      System.arraycopy(chunk, chunkPosition, b, off, min);
+      off += min;
+      len -= min;
+      chunkPosition += min;
+      read += min;
+
+      if (len > 0) {
+        // we read to the end of the chunk, fetch another.
+        nextChunk();
+        if (null == chunk) {
+          break;
+        }
+      }
+    }
+
+    return read;
+  }
+
+  @Override
+  public int available() throws IOException {
+    assertOpen();
+
+    return remaining();
+  }
+
+  @Override
+  public void close() throws IOException {
+    if (open) {
+      open = false;
+    }
+  }
+
+  private int remaining() {
+    return chunk.length - chunkPosition;
+  }
+
+  private void checkAndFetchNextChunk() {
+    if (null != chunk && remaining() <= 0) {
+      nextChunk();
+    }
+  }
+
+  private void nextChunk() {
+    chunk = file.getFileSystem().getChunk(this.file, chunkId++);
+    chunkPosition = 0;
+  }
+
+  private void assertOpen() throws IOException {
+    if (!open) {
+      throw new IOException("Closed");
+    }
+  }
+  
+  @Override
+  public FileInputStream clone() {
+    return new FileInputStream(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileOutputStream.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileOutputStream.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileOutputStream.java
new file mode 100644
index 0000000..3f9f614
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileOutputStream.java
@@ -0,0 +1,103 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+final class FileOutputStream extends OutputStream {
+
+  private final File file;
+  private ByteBuffer buffer;
+  private boolean open = true;
+  private long length;
+  private int chunks;
+
+  public FileOutputStream(final File file) {
+    this.file = file;
+    buffer = ByteBuffer.allocate(file.getChunkSize());
+    this.length = file.length;
+    this.chunks = file.chunks;
+    if(chunks > 0 && file.length % file.getChunkSize() != 0) {
+      //If the last chunk was incomplete, we're going to update it
+      //rather than add a new chunk. This guarantees that all chunks
+      //are full except for the last chunk.
+      chunks--;
+      byte[] previousChunkData = file.getFileSystem().getChunk(file, chunks);
+      buffer.put(previousChunkData);
+    }
+  }
+
+  @Override
+  public void write(final int b) throws IOException {
+    assertOpen();
+    
+    if (buffer.remaining() == 0) {
+      flushBuffer();
+    }
+
+    buffer.put((byte) b);
+    length++;
+  }
+  
+  @Override
+  public void write(final byte[] b, int off, int len) throws IOException {
+    assertOpen();
+    
+    while (len > 0) {
+      if (buffer.remaining() == 0) {
+        flushBuffer();
+      }
+
+      final int min = Math.min(buffer.remaining(), len);
+      buffer.put(b, off, min);
+      off += min;
+      len -= min;
+      length += min;
+    }
+  }
+
+  @Override
+  public void close() throws IOException {
+    if (open) {
+      flushBuffer();
+      file.modified = System.currentTimeMillis();
+      file.length = length;
+      file.chunks = chunks;
+      file.getFileSystem().updateFile(file);
+      open = false;
+      buffer = null;
+    }
+  }
+
+  private void flushBuffer() {
+    byte[] chunk = Arrays.copyOfRange(buffer.array(), buffer.arrayOffset(), buffer.position());
+    file.getFileSystem().putChunk(file, chunks++, chunk);
+    buffer.rewind();
+  }
+
+  private void assertOpen() throws IOException {
+    if (!open) {
+      throw new IOException("Closed");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystem.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystem.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystem.java
new file mode 100644
index 0000000..5f4fb77
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystem.java
@@ -0,0 +1,196 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * A Filesystem like interface that stores file data in geode regions.
+ * 
+ * This filesystem is safe for use with multiple threads if the threads are not
+ * modifying the same files. A single file is not safe to modify by multiple
+ * threads, even between different members of the distributed system.
+ * 
+ * Changes to a file may not be visible to other members of the system until the
+ * FileOutputStream is closed.
+ *
+ */
+public class FileSystem {
+  // private final Cache cache;
+  private final ConcurrentMap<String, File> fileRegion;
+  private final ConcurrentMap<ChunkKey, byte[]> chunkRegion;
+  
+  static final int CHUNK_SIZE = 1024 * 1024; //1 MB
+  private final FileSystemStats stats;
+
+  /**
+   * Create filesystem that will store data in the two provided regions. The fileRegion contains
+   * metadata about the files, and the chunkRegion contains the actual data. If data from either region is missing
+   * or inconsistent, no guarantees are made about what this class will do, so it's best if these regions are colocated
+   * and in the same disk store to ensure the data remains together.
+   * @param fileRegion the region to store metadata about the files
+   * @param chunkRegion the region to store actual file data.
+   */
+  public FileSystem(ConcurrentMap<String, File> fileRegion, ConcurrentMap<ChunkKey, byte[]> chunkRegion, FileSystemStats stats) {
+    this.fileRegion = fileRegion;
+    this.chunkRegion = chunkRegion;
+    this.stats = stats;
+  }
+
+  public Collection<String> listFileNames() {
+    return fileRegion.keySet();
+  }
+
+  public File createFile(final String name) throws IOException {
+    // TODO lock region ?
+    final File file = new File(this, name);
+    if (null != fileRegion.putIfAbsent(name, file)) {
+      throw new IOException("File exists.");
+    }
+    stats.incFileCreates(1);
+    // TODO unlock region ?
+    return file;
+  }
+
+  public File createTemporaryFile(final String name) throws IOException {
+    final File file = new File(this, name);
+    stats.incTemporaryFileCreates(1);
+    return file;
+  }
+  
+  public File getFile(final String name) throws FileNotFoundException {
+    final File file = fileRegion.get(name);
+    
+    if (null == file) {
+      throw new FileNotFoundException(name);
+    }
+    
+    file.setFileSystem(this);
+    return file;
+  }
+
+  public void deleteFile(final String name) throws FileNotFoundException {
+    // TODO locks?
+
+    // TODO - What is the state of the system if 
+    // things crash in the middle of removing this file?
+    // Seems like a file will be left with some 
+    // dangling chunks at the end of the file
+    File file = fileRegion.remove(name);
+    if(file == null) {
+      throw new FileNotFoundException(name);
+    }
+
+    // TODO consider removeAll with all ChunkKeys listed.
+    final ChunkKey key = new ChunkKey(file.id, 0);
+    while (true) {
+      // TODO consider mutable ChunkKey
+      if (null == chunkRegion.remove(key)) {
+        // no more chunks
+        break;
+      }
+      key.chunkId++;
+    }
+
+    stats.incFileDeletes(1);
+  }
+  
+  public void renameFile(String source, String dest) throws IOException {
+    final File sourceFile = fileRegion.get(source);
+    if (null == sourceFile) {
+      throw new FileNotFoundException(source);
+    }
+    
+    final File destFile = createFile(dest);
+    
+    destFile.chunks = sourceFile.chunks;
+    destFile.created = sourceFile.created;
+    destFile.length = sourceFile.length;
+    destFile.modified = sourceFile.modified;
+    destFile.id = sourceFile.id;
+    updateFile(destFile);
+    
+    // TODO - What is the state of the system if 
+    // things crash in the middle of moving this file?
+    // Seems like we will have two files pointing
+    // at the same data
+
+    fileRegion.remove(source);
+
+    stats.incFileRenames(1);
+  }
+  
+  byte[] getChunk(final File file, final int id) {
+    final ChunkKey key = new ChunkKey(file.id, id);
+    
+    //The file's metadata indicates that this chunk shouldn't
+    //exist. Purge all of the chunks that are larger than the file metadata
+    if(id >= file.chunks) {
+      while(chunkRegion.containsKey(key)) {
+        chunkRegion.remove(key);
+        key.chunkId++;
+      }
+      
+      return null;
+    }
+    
+    final byte[] chunk = chunkRegion.get(key);
+    stats.incReadBytes(chunk.length);
+    return chunk;
+  }
+
+  public void putChunk(final File file, final int id, final byte[] chunk) {
+    final ChunkKey key = new ChunkKey(file.id, id);
+    chunkRegion.put(key, chunk);
+    stats.incWrittenBytes(chunk.length);
+  }
+
+  void updateFile(File file) {
+    fileRegion.put(file.getName(), file);
+  }
+
+  public ConcurrentMap<String, File> getFileRegion() {
+    return fileRegion;
+  }
+
+  public ConcurrentMap<ChunkKey, byte[]> getChunkRegion() {
+    return chunkRegion;
+  }
+
+  /**
+   * Export all of the files in the filesystem to the provided directory
+   */
+  public void export(final java.io.File exportLocation) {
+
+    listFileNames().stream().forEach(fileName-> {
+      try {
+        getFile(fileName).export(exportLocation);
+      }
+      catch (FileNotFoundException e) {
+        //ignore this, it was concurrently removed
+      }
+
+    });
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
new file mode 100644
index 0000000..e6bbf0d
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
@@ -0,0 +1,128 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.util.function.IntSupplier;
+import java.util.function.LongSupplier;
+
+import com.gemstone.gemfire.StatisticDescriptor;
+import com.gemstone.gemfire.Statistics;
+import com.gemstone.gemfire.StatisticsFactory;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.StatisticsTypeFactory;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+
+public class FileSystemStats {
+  private static final StatisticsType statsType;
+  private static final String statsTypeName = "FileSystemStats";
+  private static final String statsTypeDescription = "Statistics about in memory file system implementation";
+
+  private final Statistics stats;
+
+  private static final int readBytesId;
+  private static final int writtenBytesId;
+  private static final int fileCreatesId;
+  private static final int temporaryFileCreatesId;
+  private static final int fileDeletesId;
+  private static final int fileRenamesId;
+  private static final int filesId;
+  private static final int chunksId;
+  private static final int bytesId;
+
+  static {
+    final StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    statsType = f.createType(
+      statsTypeName,
+      statsTypeDescription,
+      new StatisticDescriptor[] {
+        f.createLongCounter("readBytes", "Number of bytes written", "bytes"),
+        f.createLongCounter("writtenBytes", "Number of bytes read", "bytes"),
+        f.createIntCounter("fileCreates", "Number of files created", "files"),
+        f.createIntCounter("temporaryFileCreates", "Number of temporary files created", "files"),
+        f.createIntCounter("fileDeletes", "Number of files deleted", "files"),
+        f.createIntCounter("fileRenames", "Number of files renamed", "files"),
+        f.createIntGauge("files", "Number of files on this member", "files"),
+        f.createIntGauge("chunks", "Number of file chunks on this member", "chunks"),
+        f.createLongGauge("bytes", "Number of bytes on this member", "bytes"),
+      }
+    );
+
+    readBytesId = statsType.nameToId("readBytes");
+    writtenBytesId = statsType.nameToId("writtenBytes");
+    fileCreatesId = statsType.nameToId("fileCreates");
+    temporaryFileCreatesId = statsType.nameToId("temporaryFileCreates");
+    fileDeletesId = statsType.nameToId("fileDeletes");
+    fileRenamesId = statsType.nameToId("fileRenames");
+    filesId = statsType.nameToId("files");
+    chunksId = statsType.nameToId("chunks");
+    bytesId = statsType.nameToId("bytes");
+  }
+
+  public FileSystemStats(StatisticsFactory f, String name) {
+    this.stats = f.createAtomicStatistics(statsType, name);
+  }
+
+  public void incReadBytes(int delta) {
+    stats.incLong(readBytesId, delta);
+  }
+
+  public void incWrittenBytes(int delta) {
+    stats.incLong(writtenBytesId, delta);
+  }
+
+  public void incFileCreates(final int delta) {
+    stats.incInt(fileCreatesId,delta);
+  }
+
+  public void incTemporaryFileCreates(final int delta) {
+    stats.incInt(temporaryFileCreatesId, delta);
+  }
+
+  public void incFileDeletes(final int delta) {
+    stats.incInt(fileDeletesId,delta);
+  }
+
+  public void incFileRenames(final int delta) {
+    stats.incInt(fileRenamesId,delta);
+  }
+
+  public void setFileSupplier(IntSupplier supplier) {
+    stats.setIntSupplier(filesId, supplier);
+  }
+
+  public int getFiles() {
+    return stats.getInt(filesId);
+  }
+
+  public void setChunkSupplier(IntSupplier supplier) {
+    stats.setIntSupplier(chunksId, supplier);
+  }
+
+  public int getChunks() {
+    return stats.getInt(chunksId);
+  }
+
+  public void setBytesSupplier(LongSupplier supplier) {
+    stats.setLongSupplier(bytesId, supplier);
+  }
+
+  public long getBytes() {
+    return stats.getLong(bytesId);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/SeekableInputStream.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/SeekableInputStream.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/SeekableInputStream.java
new file mode 100644
index 0000000..e10e0c4
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/SeekableInputStream.java
@@ -0,0 +1,43 @@
+/*
+ * 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.lucene.internal.filesystem;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * An input stream that supports seeking to a particular position.
+ */
+public abstract class SeekableInputStream extends InputStream {
+  
+  /**
+   * Seek to a position in the stream. The position is relative to the beginning
+   * of the stream (in other words, just before the first byte that was ever
+   * read).
+   * 
+   * @param position
+   * @throws IOException if the seek goes past the end of the stream
+   */
+  public abstract void seek(long position) throws IOException;
+  
+  public abstract SeekableInputStream clone();
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/package-info.java
new file mode 100644
index 0000000..f8b612c
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+/**
+ * A distributed filesystem implementation that uses a geode region as the underlying storage mechanism.
+ *
+ * Users of this filesystem should interact with the {@link com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem} class.
+ *
+ */
+
+package com.gemstone.gemfire.cache.lucene.internal.filesystem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java
new file mode 100644
index 0000000..ba9f73b
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexMetrics.java
@@ -0,0 +1,218 @@
+/*
+ * 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.lucene.internal.management;
+
+import java.beans.ConstructorProperties;
+
+public class LuceneIndexMetrics {
+
+  private final String regionPath;
+
+  private final String indexName;
+
+  private final int queryExecutions;
+
+  private final long queryExecutionTime;
+
+  private final float queryRate;
+
+  private final long queryRateAverageLatency;
+
+  private final int queryExecutionsInProgress;
+
+  private final long queryExecutionTotalHits;
+
+  private final int updates;
+
+  private final long updateTime;
+
+  private final float updateRate;
+
+  private final long updateRateAverageLatency;
+
+  private final int updatesInProgress;
+
+  private final int commits;
+
+  private final long commitTime;
+
+  private final float commitRate;
+
+  private final long commitRateAverageLatency;
+
+  private final int commitsInProgress;
+
+  private final int documents;
+
+  /**
+   * This constructor is to be used by internal JMX framework only. A user should
+   * not try to create an instance of this class.
+   */
+  @ConstructorProperties( { "regionPath", "indexName", "queryExecutions", "queryExecutionTime", "queryRate",
+      "queryRateAverageLatency", "queryExecutionsInProgress", "queryExecutionTotalHits", "updates",
+      "updateTime", "updateRate", "updateRateAverageLatency", "updatesInProgress", "commits",
+      "commitTime", "commitRate", "commitRateAverageLatency", "commitsInProgress", "documents"
+  })
+  public LuceneIndexMetrics(String regionPath, String indexName, int queryExecutions, long queryExecutionTime,
+      float queryRate, long queryRateAverageLatency, int queryExecutionsInProgress, long queryExecutionTotalHits,
+      int updates, long updateTime, float updateRate, long updateRateAverageLatency, int updatesInProgress,
+      int commits, long commitTime, float commitRate, long commitRateAverageLatency, int commitsInProgress,
+      int documents) {
+    this.regionPath = regionPath;
+    this.indexName = indexName;
+    this.queryExecutions = queryExecutions;
+    this.queryExecutionTime = queryExecutionTime;
+    this.queryRate = queryRate;
+    this.queryRateAverageLatency = queryRateAverageLatency;
+    this.queryExecutionsInProgress = queryExecutionsInProgress;
+    this.queryExecutionTotalHits = queryExecutionTotalHits;
+    this.updates = updates;
+    this.updateTime = updateTime;
+    this.updateRate = updateRate;
+    this.updateRateAverageLatency = updateRateAverageLatency;
+    this.updatesInProgress = updatesInProgress;
+    this.commits = commits;
+    this.commitTime = commitTime;
+    this.commitRate = commitRate;
+    this.commitRateAverageLatency = commitRateAverageLatency;
+    this.commitsInProgress = commitsInProgress;
+    this.documents = documents;
+  }
+
+  public String getRegionPath() {
+    return this.regionPath;
+  }
+
+  public String getIndexName() {
+    return this.indexName;
+  }
+
+  public int getQueryExecutions() {
+    return this.queryExecutions;
+  }
+
+  public long getQueryExecutionTime() {
+    return this.queryExecutionTime;
+  }
+
+  public float getQueryRate() {
+    return this.queryRate;
+  }
+
+  public long getQueryRateAverageLatency() {
+    return this.queryRateAverageLatency;
+  }
+
+  public int getQueryExecutionsInProgress() {
+    return this.queryExecutionsInProgress;
+  }
+
+  public long getQueryExecutionTotalHits() {
+    return this.queryExecutionTotalHits;
+  }
+
+  public int getUpdates() {
+    return this.updates;
+  }
+
+  public long getUpdateTime() {
+    return this.updateTime;
+  }
+
+  public float getUpdateRate() {
+    return this.updateRate;
+  }
+
+  public long getUpdateRateAverageLatency() {
+    return this.updateRateAverageLatency;
+  }
+
+  public int getUpdatesInProgress() {
+    return this.updatesInProgress;
+  }
+
+  public int getCommits() {
+    return this.commits;
+  }
+
+  public long getCommitTime() {
+    return this.commitTime;
+  }
+
+  public float getCommitRate() {
+    return this.commitRate;
+  }
+
+  public long getCommitRateAverageLatency() {
+    return this.commitRateAverageLatency;
+  }
+
+  public int getCommitsInProgress() {
+    return this.commitsInProgress;
+  }
+
+  public int getDocuments() {
+    return documents;
+  }
+
+  @Override
+  public String toString() {
+    return new StringBuilder()
+        .append(getClass().getSimpleName())
+        .append("[")
+        .append("regionPath=")
+        .append(this.regionPath)
+        .append("; indexName=")
+        .append(this.indexName)
+        .append("; queryExecutions=")
+        .append(this.queryExecutions)
+        .append("; queryExecutionTime=")
+        .append(this.queryExecutionTime)
+        .append("; queryRate=")
+        .append(this.queryRate)
+        .append("; queryRateAverageLatency=")
+        .append(this.queryRateAverageLatency)
+        .append("; queryExecutionsInProgress=")
+        .append(this.queryExecutionsInProgress)
+        .append("; queryExecutionTotalHits=")
+        .append(this.queryExecutionTotalHits)
+        .append("; updates=")
+        .append(this.updates)
+        .append("; updateTime=")
+        .append(this.updateTime)
+        .append("; updateRate=")
+        .append(this.updateRate)
+        .append("; updateRateAverageLatency=")
+        .append(this.updateRateAverageLatency)
+        .append("; updatesInProgress=")
+        .append(this.updatesInProgress)
+        .append("; commits=")
+        .append(this.commits)
+        .append("; commitTime=")
+        .append(this.commitTime)
+        .append("; commitRate=")
+        .append(this.commitRate)
+        .append("; commitRateAverageLatency=")
+        .append(this.commitRateAverageLatency)
+        .append("; commitsInProgress=")
+        .append(this.commitsInProgress)
+        .append("; documents=")
+        .append(this.documents)
+        .append("]")
+        .toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java
new file mode 100644
index 0000000..30a2659
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneIndexStatsMonitor.java
@@ -0,0 +1,93 @@
+/*
+ * 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.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.management.internal.ManagementStrings;
+import com.gemstone.gemfire.management.internal.beans.stats.MBeanStatsMonitor;
+import com.gemstone.gemfire.management.internal.beans.stats.StatType;
+import com.gemstone.gemfire.management.internal.beans.stats.StatsAverageLatency;
+import com.gemstone.gemfire.management.internal.beans.stats.StatsRate;
+
+public class LuceneIndexStatsMonitor extends MBeanStatsMonitor {
+
+  private StatsRate updateRate;
+
+  private StatsAverageLatency updateRateAverageLatency;
+
+  private StatsRate commitRate;
+
+  private StatsAverageLatency commitRateAverageLatency;
+
+  private StatsRate queryRate;
+
+  private StatsAverageLatency queryRateAverageLatency;
+
+  public static final String LUCENE_SERVICE_MXBEAN_MONITOR_PREFIX = "LuceneServiceMXBeanMonitor_";
+
+  public LuceneIndexStatsMonitor(LuceneIndex index) {
+    super(LUCENE_SERVICE_MXBEAN_MONITOR_PREFIX + index.getRegionPath() + "_" + index.getName());
+    addStatisticsToMonitor(((LuceneIndexImpl) index).getIndexStats().getStats());
+    configureMetrics();
+  }
+
+  private void configureMetrics() {
+    this.queryRate = new StatsRate(StatsKey.QUERIES, StatType.INT_TYPE, this);
+
+    this.updateRate = new StatsRate(StatsKey.UPDATES, StatType.INT_TYPE, this);
+
+    this.commitRate = new StatsRate(StatsKey.COMMITS, StatType.INT_TYPE, this);
+
+    this.queryRateAverageLatency = new StatsAverageLatency(
+        StatsKey.QUERIES, StatType.INT_TYPE, StatsKey.QUERY_TIME, this);
+
+    this.updateRateAverageLatency = new StatsAverageLatency(
+        StatsKey.UPDATES, StatType.INT_TYPE, StatsKey.UPDATE_TIME, this);
+
+    this.commitRateAverageLatency = new StatsAverageLatency(
+        StatsKey.COMMITS, StatType.INT_TYPE, StatsKey.COMMIT_TIME, this);
+  }
+
+  protected LuceneIndexMetrics getIndexMetrics(LuceneIndex index) {
+    int queryExecutions = getStatistic(StatsKey.QUERIES).intValue();
+    long queryExecutionTime = getStatistic(StatsKey.QUERY_TIME).longValue();
+    float queryRateValue = this.queryRate.getRate();
+    long queryRateAverageLatencyValue = this.queryRateAverageLatency.getAverageLatency();
+    int queryExecutionsInProgress = getStatistic(StatsKey.QUERIES_IN_PROGRESS).intValue();
+    long queryExecutionTotalHits = getStatistic(StatsKey.QUERIES_TOTAL_HITS).longValue();
+
+    int updates = getStatistic(StatsKey.UPDATES).intValue();
+    long updateTime = getStatistic(StatsKey.UPDATE_TIME).longValue();
+    float updateRateValue = this.updateRate.getRate();
+    long updateRateAverageLatencyValue = this.updateRateAverageLatency.getAverageLatency();
+    int updatesInProgress = getStatistic(StatsKey.UPDATES_IN_PROGRESS).intValue();
+
+    int commits = getStatistic(StatsKey.COMMITS).intValue();
+    long commitTime = getStatistic(StatsKey.COMMIT_TIME).longValue();
+    float commitRateValue = this.commitRate.getRate();
+    long commitRateAverageLatencyValue = this.commitRateAverageLatency.getAverageLatency();
+    int commitsInProgress = getStatistic(StatsKey.COMMITS_IN_PROGRESS).intValue();
+
+    int documents = getStatistic(StatsKey.DOCUMENTS).intValue();
+
+    return new LuceneIndexMetrics(index.getRegionPath(), index.getName(), queryExecutions, queryExecutionTime,
+        queryRateValue, queryRateAverageLatencyValue, queryExecutionsInProgress, queryExecutionTotalHits,
+        updates, updateTime, updateRateValue, updateRateAverageLatencyValue, updatesInProgress, commits,
+        commitTime, commitRateValue, commitRateAverageLatencyValue, commitsInProgress, documents);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceBridge.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceBridge.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceBridge.java
new file mode 100644
index 0000000..edbfadc
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceBridge.java
@@ -0,0 +1,86 @@
+/*
+ * 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.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class LuceneServiceBridge {
+
+  private LuceneService service;
+
+  private Map<String,LuceneIndexStatsMonitor> monitors;
+
+  public LuceneServiceBridge(LuceneService service) {
+    this.service = service;
+    this.monitors = new ConcurrentHashMap<>();
+  }
+
+  public void addIndex(LuceneIndex index) {
+    // Create monitor on the index
+    LuceneIndexStatsMonitor monitor = new LuceneIndexStatsMonitor(index);
+
+    // Register the monitor
+    this.monitors.put(getMonitorKey(index), monitor);
+  }
+
+  public LuceneIndexMetrics[] listIndexMetrics() {
+    Collection<LuceneIndex> indexes = this.service.getAllIndexes();
+    LuceneIndexMetrics[] indexMetrics = new LuceneIndexMetrics[indexes.size()];
+    int i=0;
+    for (LuceneIndex index : this.service.getAllIndexes()) {
+      indexMetrics[i++] = getIndexMetrics((LuceneIndexImpl)index);
+    }
+    return indexMetrics;
+  }
+
+  public LuceneIndexMetrics[] listIndexMetrics(String regionPath) {
+    if(!regionPath.startsWith(Region.SEPARATOR)) {
+      regionPath = Region.SEPARATOR + regionPath;
+    }
+    List<LuceneIndexMetrics> indexMetrics = new ArrayList();
+    for (LuceneIndex index : this.service.getAllIndexes()) {
+      if (index.getRegionPath().equals(regionPath)) {
+        indexMetrics.add(getIndexMetrics((LuceneIndexImpl) index));
+      }
+    }
+    return indexMetrics.toArray(new LuceneIndexMetrics[indexMetrics.size()]);
+  }
+
+  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName) {
+    LuceneIndexImpl index = (LuceneIndexImpl) this.service.getIndex(indexName, regionPath);
+    return index == null ? null : getIndexMetrics(index);
+  }
+
+  private String getMonitorKey(LuceneIndex index) {
+    return index.getRegionPath() + "_" + index.getName();
+  }
+
+  private LuceneIndexMetrics getIndexMetrics(LuceneIndexImpl index) {
+    LuceneIndexStatsMonitor monitor = this.monitors.get(getMonitorKey(index));
+    return monitor.getIndexMetrics(index);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMBean.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMBean.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMBean.java
new file mode 100644
index 0000000..4320a9a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMBean.java
@@ -0,0 +1,62 @@
+/*
+ * 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.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
+
+import javax.management.NotificationBroadcasterSupport;
+
+public class LuceneServiceMBean extends NotificationBroadcasterSupport
+    implements LuceneServiceMXBean, CacheServiceMBeanBase {
+
+  private LuceneServiceBridge bridge;
+
+  public LuceneServiceMBean(LuceneService service) {
+    this.bridge = new LuceneServiceBridge(service);
+  }
+
+  @Override
+  public LuceneIndexMetrics[] listIndexMetrics() {
+    return this.bridge.listIndexMetrics();
+  }
+
+  @Override
+  public LuceneIndexMetrics[] listIndexMetrics(String regionPath) {
+    return this.bridge.listIndexMetrics(regionPath);
+  }
+
+  @Override
+  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName) {
+    return this.bridge.listIndexMetrics(regionPath, indexName);
+  }
+
+  @Override
+  public String getId() {
+    return "LuceneService";
+  }
+
+  @Override
+  public Class getInterfaceClass() {
+    return LuceneServiceMXBean.class;
+  }
+
+  public void addIndex(LuceneIndex index) {
+    this.bridge.addIndex(index);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMXBean.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMXBean.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMXBean.java
new file mode 100644
index 0000000..e19bc83
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/LuceneServiceMXBean.java
@@ -0,0 +1,59 @@
+/*
+ * 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.lucene.internal.management;
+
+import com.gemstone.gemfire.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission.Operation;
+import org.apache.geode.security.ResourcePermission.Resource;
+
+/**
+ * MBean that provides access to the {@link com.gemstone.gemfire.cache.lucene.LuceneService}.
+ */
+@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
+public interface LuceneServiceMXBean {
+
+  /**
+   * Returns an array of {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
+   * instances defined in this member
+   *
+   * @return an array of LuceneIndexMetrics for the LuceneIndexes defined in this member
+   */
+  public LuceneIndexMetrics[] listIndexMetrics();
+
+  /**
+   * Returns an array of {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
+   * instances defined on the input region in this member
+   *
+   * @param regionPath The full path of the region to retrieve
+   *
+   * @return an array of LuceneIndexMetrics for the LuceneIndex instances defined on the input region
+   * in this member
+   */
+  public LuceneIndexMetrics[] listIndexMetrics(String regionPath);
+
+  /**
+   * Returns a {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
+   * with the input index name defined on the input region in this member.
+   *
+   * @param regionPath The full path of the region to retrieve
+   * @param indexName The name of the index to retrieve
+   *
+   * @return a LuceneIndexMetrics for the LuceneIndex with the input index name defined on the input region
+   * in this member.
+   */
+  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/ManagementIndexListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/ManagementIndexListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/ManagementIndexListener.java
new file mode 100644
index 0000000..f88058a
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/ManagementIndexListener.java
@@ -0,0 +1,38 @@
+/*
+ * 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.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.internal.IndexListenerAdapter;
+
+public class ManagementIndexListener extends IndexListenerAdapter {
+
+  private LuceneServiceMBean mbean;
+
+  public ManagementIndexListener(LuceneServiceMBean mbean) {
+    this.mbean = mbean;
+  }
+
+  @Override
+  public void afterIndexCreated(LuceneIndex index) {
+    mbean.addIndex(index);
+  }
+
+  @Override
+  public void beforeIndexDestroyed(LuceneIndex index) {
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/StatsKey.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/StatsKey.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/StatsKey.java
new file mode 100644
index 0000000..3438937
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/management/StatsKey.java
@@ -0,0 +1,35 @@
+/*
+ * 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.lucene.internal.management;
+
+public class StatsKey {
+
+  public static final String UPDATES = "updates";
+  public static final String UPDATE_TIME = "updateTime";
+  public static final String UPDATES_IN_PROGRESS = "updatesInProgress";
+
+  public static final String COMMITS = "commits";
+  public static final String COMMIT_TIME = "commitTime";
+  public static final String COMMITS_IN_PROGRESS = "commitsInProgress";
+
+  public static final String QUERIES = "queryExecutions";
+  public static final String QUERY_TIME = "queryExecutionTime";
+  public static final String QUERIES_IN_PROGRESS = "queryExecutionsInProgress";
+  public static final String QUERIES_TOTAL_HITS = "queryExecutionTotalHits";
+
+  public static final String DOCUMENTS = "documents";
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/package-info.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/package-info.java
new file mode 100644
index 0000000..22670f3
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * Internal lucene classes, not intended to be used directly.
+ */
+
+package com.gemstone.gemfire.cache.lucene.internal;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepository.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepository.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepository.java
new file mode 100644
index 0000000..e487884
--- /dev/null
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepository.java
@@ -0,0 +1,89 @@
+/*
+ * 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.lucene.internal.repository;
+
+import java.io.IOException;
+
+import com.gemstone.gemfire.cache.Region;
+
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.search.Query;
+
+/**
+ * An Repository interface for the writing data to lucene.
+ */
+public interface IndexRepository {
+
+  /**
+   * Create a new entry in the lucene index
+   * @throws IOException 
+   */
+  void create(Object key, Object value) throws IOException;
+
+  /**
+   * Update the entries in the lucene index
+   * @throws IOException 
+   */
+  void update(Object key, Object value) throws IOException;
+  
+  /**
+   * Delete the entries in the lucene index
+   * @throws IOException 
+   */
+  void delete(Object key) throws IOException;
+  
+  /**
+   * Query the index index repository, passing the results to the collector
+   * Only the documents with the top scores, up to the limit, will be passed
+   * to the collector, in order of score.
+   * 
+   * @param query
+   * @param limit the maximum number of hits to return
+   * @param collector the class to aggregate the hits
+   * 
+   * @throws IOException
+   */
+  public void query(Query query, int limit, IndexResultCollector collector) throws IOException;
+
+  /**
+   * Commit the changes to all lucene index
+   * @throws IOException 
+   */
+  void commit() throws IOException;
+
+  Region<?, ?> getRegion();
+
+  /**
+   * Check to see if this repository is closed due to
+   * underlying resources being closed or destroyed
+   * @return true if this repository is closed.
+   */
+  public boolean isClosed();
+
+  /**
+   * For debugging purposes, return the underlying IndexWriter
+   */
+  IndexWriter getWriter();
+
+  /**
+   * Clean up any resources associated with this index repository.
+   */
+  void cleanup();
+}


[53/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-web/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-web/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
new file mode 100644
index 0000000..b11125c
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
@@ -0,0 +1,453 @@
+/*
+ * 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.management.internal.web.shell;
+
+import static org.junit.Assert.*;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.core.io.Resource;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.ResourceAccessException;
+
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.management.internal.cli.CommandRequest;
+import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
+import com.gemstone.gemfire.management.internal.web.domain.Link;
+import com.gemstone.gemfire.management.internal.web.domain.LinkIndex;
+import com.gemstone.gemfire.management.internal.web.http.ClientHttpRequest;
+import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The RestHttpOperationInvokerJUnitTest class is a test suite of test cases testing the contract and functionality of the
+ * RestHttpOperationInvoker class.
+ * <p/>
+ * @see java.net.URI
+ * @see com.gemstone.gemfire.management.internal.cli.CommandRequest
+ * @see com.gemstone.gemfire.management.internal.web.http.HttpMethod
+ * @see com.gemstone.gemfire.management.internal.web.domain.Link
+ * @see com.gemstone.gemfire.management.internal.web.domain.LinkIndex
+ * @see com.gemstone.gemfire.management.internal.web.shell.RestHttpOperationInvoker
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@SuppressWarnings("unused")
+@Category(UnitTest.class)
+public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
+
+  private LinkIndex linkIndex;
+
+  private RestHttpOperationInvoker operationInvoker;
+
+  @Before
+  public void setUp() throws Exception {
+    final Link listLibraries = new Link("list-libraries", toUri("http://host.domain.com/service/v1/libraries"));
+    final Link getLibrary = new Link("get-library", toUri("http://host.domain.com/service/v1/libraries/{name}"));
+    final Link listBooks = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books"));
+    final Link listBooksByAuthor = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}"));
+    final Link listBooksByAuthorAndCategory = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{category}"));
+    final Link listBooksByAuthorAndYear = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{year}"));
+    final Link listBooksByAuthorCategoryAndYear = new Link("list-books", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{category}/{year}"));
+    final Link addBook = new Link("add-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books"), HttpMethod.POST);
+    final Link getBookByIsbn = new Link("get-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{isbn}"));
+    final Link getBookByTitle = new Link("get-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{title}"));
+    final Link removeBook = new Link("remove-book", toUri("http://host.domain.com/service/v1/libraries/{name}/books/{isbn}"), HttpMethod.DELETE);
+
+    linkIndex = new LinkIndex();
+
+    linkIndex.addAll(
+      listLibraries,
+      getLibrary,
+      listBooks,
+      listBooksByAuthor,
+      listBooksByAuthorAndCategory,
+      listBooksByAuthorAndYear,
+      listBooksByAuthorCategoryAndYear,
+      addBook,
+      getBookByIsbn,
+      getBookByTitle,
+      removeBook
+    );
+
+    assertEquals(11, linkIndex.size());
+
+    operationInvoker = new RestHttpOperationInvoker(linkIndex);
+
+    assertSame(linkIndex, operationInvoker.getLinkIndex());
+  }
+
+  @After
+  public void tearDown() {
+    operationInvoker.stop();
+    operationInvoker = null;
+  }
+
+  private CommandRequest createCommandRequest(final String command, final Map<String, String> options) {
+    return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(), null);
+  }
+
+  private CommandRequest createCommandRequest(final String command, final Map<String, String> options, final Map<String, String> environment) {
+    return new TestCommandRequest(command, options, environment, null);
+  }
+
+  private CommandRequest createCommandRequest(final String command, final Map<String, String> options, final byte[][] fileData) {
+    return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(), fileData);
+  }
+
+  private CommandRequest createCommandRequest(final String command, final Map<String, String> options, final Map<String, String> environment, final byte[][] fileData) {
+    return new TestCommandRequest(command, options, environment, fileData);
+  }
+
+  private LinkIndex getLinkIndex() {
+    assertTrue("The LinkIndex was not property initialized!", linkIndex != null);
+    return linkIndex;
+  }
+
+  private RestHttpOperationInvoker getOperationInvoker() {
+    assertTrue("The RestHttpOperationInvoker was not properly initialized!", operationInvoker != null);
+    return operationInvoker;
+  }
+
+  @Test
+  public void testCreateHttpRequest() {
+    final Map<String, String> commandOptions = new HashMap<String, String>();
+
+    commandOptions.put("author", "Adams");
+    commandOptions.put("blankOption", "  ");
+    commandOptions.put("category", "sci-fi");
+    commandOptions.put("emptyOption", StringUtils.EMPTY_STRING);
+    commandOptions.put("isbn", "0-123456789");
+    commandOptions.put("nullOption", null);
+    commandOptions.put("title", "Hitch Hiker's Guide to the Galaxy");
+    commandOptions.put("year", "1983");
+
+    final CommandRequest command = createCommandRequest("add-book", commandOptions);
+
+    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
+
+    assertNotNull(request);
+    assertEquals("POST http://host.domain.com/service/v1/libraries/{name}/books", request.getLink().toHttpRequestLine());
+    assertEquals("Adams", request.getParameterValue("author"));
+    assertEquals("sci-fi", request.getParameterValue("category"));
+    assertEquals("0-123456789", request.getParameterValue("isbn"));
+    assertEquals("Hitch Hiker's Guide to the Galaxy", request.getParameterValue("title"));
+    assertEquals("1983", request.getParameterValue("year"));
+    assertTrue(request.getParameters().containsKey("blankOption"));
+    assertTrue(request.getParameters().containsKey("emptyOption"));
+    assertFalse(request.getParameters().containsKey("nullOption"));
+
+    for (String requestParameter : request.getParameters().keySet()) {
+      assertFalse(requestParameter.startsWith(RestHttpOperationInvoker.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX));
+    }
+
+    assertNull(request.getParameterValue(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER));
+  }
+
+  @Test
+  public void testCreateHttpRequestWithEnvironmentVariables() {
+    final Map<String, String> commandOptions = new HashMap<String, String>(2);
+
+    commandOptions.put("name", "ElLibreDeCongress");
+    commandOptions.put("isbn", "${ISBN}");
+
+    final Map<String, String> environment = new HashMap<String, String>(2);
+
+    environment.put("ISBN", "0-987654321");
+    environment.put("VAR", "test");
+
+    final CommandRequest command = createCommandRequest("get-book", commandOptions, environment);
+
+    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
+
+    assertNotNull(request);
+    assertEquals("GET http://host.domain.com/service/v1/libraries/{name}/books/{isbn}", request.getLink()
+      .toHttpRequestLine());
+    assertEquals("${ISBN}", request.getParameterValue("isbn"));
+    assertFalse(request.getParameters().containsKey("ISBN"));
+    assertEquals("0-987654321", request.getParameterValue(
+      RestHttpOperationInvoker.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "ISBN"));
+    assertFalse(request.getParameters().containsKey("VAR"));
+    assertEquals("test", request.getParameterValue(
+      RestHttpOperationInvoker.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "VAR"));
+  }
+
+  @Test
+  public void testCreatHttpRequestWithFileData() {
+    final Map<String, String> commandOptions = Collections.singletonMap("isbn", "0-123456789");
+
+    final byte[][] fileData = {
+      "/path/to/book/content.txt".getBytes(),
+      "Once upon a time in a galaxy far, far away...".getBytes()
+    };
+
+    final CommandRequest command = createCommandRequest("add-book", commandOptions, fileData);
+
+    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
+
+    assertNotNull(request);
+    assertEquals("POST http://host.domain.com/service/v1/libraries/{name}/books", request.getLink().toHttpRequestLine());
+    assertEquals("0-123456789", request.getParameterValue("isbn"));
+    assertTrue(request.getParameters().containsKey(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER));
+    assertTrue(request.getParameterValue(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER) instanceof Resource);
+
+    final List<Object> resources = request.getParameterValues(RestHttpOperationInvoker.RESOURCES_REQUEST_PARAMETER);
+
+    assertNotNull(resources);
+    assertFalse(resources.isEmpty());
+    assertEquals(1, resources.size());
+  }
+
+  @Test
+  public void testFindAndResolveLink() throws Exception {
+    final Map<String, String> commandOptions = new HashMap<String, String>();
+
+    commandOptions.put("name", "BarnesN'Noble");
+
+    Link link = getOperationInvoker().findLink(createCommandRequest("list-libraries", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries", toString(link.getHref()));
+
+    link = getOperationInvoker().findLink(createCommandRequest("get-library", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}", toString(link.getHref()));
+
+    commandOptions.put("author", "J.K.Rowlings");
+
+    link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{author}", toString(link.getHref()));
+
+    commandOptions.put("category", "sci-fi");
+    commandOptions.put("year", "1998");
+    commandOptions.put("bogus", "data");
+
+    link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{category}/{year}",
+      toString(link.getHref()));
+
+    commandOptions.remove("category");
+
+    link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{author}/{year}",
+      toString(link.getHref()));
+
+    commandOptions.put("category", "fantasy");
+    commandOptions.put("isbn", "0-123456789");
+    commandOptions.put("title", "Harry Potter");
+
+    link = getOperationInvoker().findLink(createCommandRequest("add-book", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books", toString(link.getHref()));
+
+    commandOptions.remove("isbn");
+
+    link = getOperationInvoker().findLink(createCommandRequest("get-book", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{title}", toString(link.getHref()));
+
+    link = getOperationInvoker().findLink(createCommandRequest("remove-book", commandOptions));
+
+    assertNotNull(link);
+    assertEquals("http://host.domain.com/service/v1/libraries/{name}/books/{isbn}", toString(link.getHref()));
+  }
+
+  @Test
+  public void testProcessCommand() {
+    final String expectedResult = "{\"libraries\":[{\"library-of\":\"Congress\"}]"; // JSON
+
+    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
+      @Override
+      public boolean isConnected() {
+        return true;
+      }
+
+      @Override
+      @SuppressWarnings("unchecked")
+      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType, final Map<String, ?> uriVariables) {
+        return new ResponseEntity(expectedResult, HttpStatus.OK);
+      }
+    };
+
+    final String actualResult = operationInvoker.processCommand(createCommandRequest("list-libraries",
+      Collections.<String, String>emptyMap()));
+
+    assertEquals(expectedResult, actualResult);
+  }
+
+  @Test
+  public void testProcessCommandDelegatesToSimpleProcessCommand() {
+    final String expectedResult = "<resources>test</resources>";
+
+    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
+      @Override
+      public boolean isConnected() {
+        return true;
+      }
+
+      @Override
+      protected HttpOperationInvoker getHttpOperationInvoker() {
+        return new AbstractHttpOperationInvoker(AbstractHttpOperationInvoker.REST_API_URL) {
+          @Override public Object processCommand(final CommandRequest command) {
+            return expectedResult;
+          }
+        };
+      }
+
+      @Override
+      protected void printWarning(final String message, final Object... args) {
+      }
+    };
+
+    final String actualResult = operationInvoker.processCommand(createCommandRequest("get resource",
+      Collections.<String, String>emptyMap()));
+
+    assertEquals(expectedResult, actualResult);
+  }
+
+  @Test
+  public void testProcessCommandHandlesResourceAccessException() {
+    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
+      private boolean connected = true;
+
+      @Override
+      public boolean isConnected() {
+        return connected;
+      }
+
+      @Override
+      protected void printWarning(final String message, final Object... args) {
+      }
+
+      @Override
+      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType, final Map<String, ?> uriVariables) {
+        throw new ResourceAccessException("test");
+      }
+
+      @Override
+      public void stop() {
+        this.connected = false;
+      }
+    };
+
+    assertTrue(operationInvoker.isConnected());
+
+    final String expectedResult = String.format(
+      "The connection to the GemFire Manager's HTTP service @ %1$s failed with: %2$s. "
+        + "Please try reconnecting or see the GemFire Manager's log file for further details.",
+      operationInvoker.getBaseUrl(), "test");
+
+    final String actualResult = operationInvoker.processCommand(createCommandRequest("list-libraries",
+      Collections.<String, String>emptyMap()));
+
+    assertFalse(operationInvoker.isConnected());
+    assertEquals(expectedResult, actualResult);
+  }
+
+  @Test(expected = RestApiCallForCommandNotFoundException.class)
+  public void testProcessCommandThrowsRestApiCallForCommandNotFoundException() {
+    final RestHttpOperationInvoker operationInvoker = new RestHttpOperationInvoker(getLinkIndex()) {
+      @Override
+      public boolean isConnected() {
+        return true;
+      }
+
+      @Override
+      protected HttpOperationInvoker getHttpOperationInvoker() {
+        return null;
+      }
+    };
+
+    try {
+      operationInvoker.processCommand(createCommandRequest("get resource", Collections.<String, String>emptyMap()));
+    }
+    catch (RestApiCallForCommandNotFoundException e) {
+      assertEquals("No REST API call for command (get resource) was found!", e.getMessage());
+      throw e;
+    }
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void testProcessCommandWhenNotConnected() {
+    try {
+      getOperationInvoker().processCommand(createCommandRequest("get-book", Collections.<String, String>emptyMap()));
+    }
+    catch (IllegalStateException e) {
+      assertEquals("Gfsh must be connected to the GemFire Manager in order to process commands remotely!",
+        e.getMessage());
+      throw e;
+    }
+  }
+
+  private static final class TestCommandRequest extends CommandRequest {
+
+    private final Map<String, String> commandParameters = new TreeMap<String, String>();
+
+    private final String command;
+
+    protected TestCommandRequest(final String command,
+                                 final Map<String, String> commandParameters,
+                                 final Map<String, String> environment,
+                                 final byte[][] fileData)
+    {
+      super(environment, fileData);
+
+      assert command != null : "The command cannot be null!";
+
+      this.command = command;
+
+      if (commandParameters != null) {
+        this.commandParameters.putAll(commandParameters);
+      }
+    }
+
+    @Override
+    public String getInput() {
+      return command;
+    }
+
+    @Override
+    public String getName() {
+      return command;
+    }
+
+    @Override
+    public Map<String, String> getParameters() {
+      return Collections.unmodifiableMap(commandParameters);
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java
new file mode 100644
index 0000000..557cc20
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/SimpleHttpOperationInvokerJUnitTest.java
@@ -0,0 +1,198 @@
+/*
+ * 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.management.internal.web.shell;
+
+import static org.junit.Assert.*;
+
+import java.util.Collections;
+
+import com.gemstone.gemfire.management.internal.cli.CommandRequest;
+import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
+import com.gemstone.gemfire.management.internal.web.domain.Link;
+import com.gemstone.gemfire.management.internal.web.http.ClientHttpRequest;
+import com.gemstone.gemfire.management.internal.web.http.HttpHeader;
+import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.ResourceAccessException;
+
+/**
+ * The SimpleHttpOperationInvokerJUnitTest class is a test suite of test cases testing the contract and functionality of the
+ * SimpleHttpOperationInvoker class.
+ * <p/>
+ * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
+ * @see com.gemstone.gemfire.management.internal.web.shell.SimpleHttpOperationInvoker
+ * @see org.junit.Assert
+ * @see org.junit.After
+ * @see org.junit.Before
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class SimpleHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
+
+  private SimpleHttpOperationInvoker operationInvoker;
+
+  @Before
+  public void setUp() {
+    operationInvoker = new SimpleHttpOperationInvoker();
+  }
+
+  @After
+  public void tearDown() {
+    operationInvoker.stop();
+    operationInvoker = null;
+  }
+
+  private CommandRequest createCommandRequest(final String command) {
+    return new TestCommandRequest(command);
+  }
+
+  private String getExpectedHttpRequestUrl(final CommandRequest command) {
+    return SimpleHttpOperationInvoker.REST_API_URL.concat(SimpleHttpOperationInvoker.REST_API_MANAGEMENT_COMMANDS_URI)
+      .concat("?").concat(SimpleHttpOperationInvoker.CMD_QUERY_PARAMETER).concat("=").concat(command.getInput());
+  }
+
+  private SimpleHttpOperationInvoker getOperationInvoker() {
+    return operationInvoker;
+  }
+
+  @Test
+  public void testCreateHttpRequest() throws Exception {
+    final CommandRequest command = createCommandRequest("save resource --path=/path/to/file --size=1024KB");
+
+    final ClientHttpRequest request = getOperationInvoker().createHttpRequest(command);
+
+    assertNotNull(request);
+    assertEquals(SimpleHttpOperationInvoker.USER_AGENT_HTTP_REQUEST_HEADER_VALUE,
+      request.getHeaderValue(HttpHeader.USER_AGENT.getName()));
+
+    final Link requestLink = request.getLink();
+
+    assertNotNull(requestLink);
+    assertTrue(toString(requestLink).startsWith("POST"));
+    assertTrue(toString(requestLink).endsWith(command.getInput()));
+  }
+
+  @Test
+  public void testCreateLink() throws Exception {
+    final CommandRequest command = createCommandRequest("delete resource --id=1");
+
+    final Link actualLink = getOperationInvoker().createLink(command);
+
+    assertNotNull(actualLink);
+    assertEquals(SimpleHttpOperationInvoker.LINK_RELATION, actualLink.getRelation());
+    assertEquals(HttpMethod.POST, actualLink.getMethod());
+    assertTrue(toString(actualLink.getHref()).endsWith(command.getInput()));
+  }
+
+  @Test
+  public void testGetHttpRequestUrl() throws Exception {
+    final CommandRequest command = createCommandRequest("get resource --option=value");
+
+    assertEquals(getExpectedHttpRequestUrl(command), toString(getOperationInvoker().getHttpRequestUrl(command)));
+  }
+
+  @Test
+  public void testProcessCommand() {
+    final String expectedResult = "<resource>test</resource>"; // XML
+
+    final SimpleHttpOperationInvoker operationInvoker = new SimpleHttpOperationInvoker() {
+      @Override
+      public boolean isConnected() {
+        return true;
+      }
+
+      @Override
+      @SuppressWarnings("unchecked")
+      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType) {
+        return new ResponseEntity(expectedResult, HttpStatus.OK);
+      }
+    };
+
+    final String actualResult = operationInvoker.processCommand(createCommandRequest("get resource --id=1"));
+
+    assertEquals(expectedResult, actualResult);
+  }
+
+  @Test
+  public void testProcessCommandHandlesResourceAccessException() {
+    final SimpleHttpOperationInvoker operationInvoker = new SimpleHttpOperationInvoker() {
+      private boolean connected = true;
+      @Override
+      public boolean isConnected() {
+        return connected;
+      }
+
+      @Override
+      protected <T> ResponseEntity<T> send(final ClientHttpRequest request, final Class<T> responseType) {
+        throw new ResourceAccessException("test");
+      }
+
+      @Override public void stop() {
+        this.connected = false;
+      }
+    };
+
+    assertTrue(operationInvoker.isConnected());
+
+    final String expectedResult = String.format(
+      "The connection to the GemFire Manager's HTTP service @ %1$s failed with: %2$s. "
+        + "Please try reconnecting or see the GemFire Manager's log file for further details.",
+          operationInvoker.getBaseUrl(), "test");
+
+    final String actualResult = operationInvoker.processCommand(createCommandRequest("get resource --id=1"));
+
+    assertFalse(operationInvoker.isConnected());
+    assertEquals(expectedResult, actualResult);
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void testProcessCommandWhenNotConnected() {
+    try {
+      getOperationInvoker().processCommand(createCommandRequest("get resource"));
+    }
+    catch (IllegalStateException e) {
+      assertEquals("Gfsh must be connected to the GemFire Manager in order to process commands remotely!",
+        e.getMessage());
+      throw e;
+    }
+  }
+
+  private static final class TestCommandRequest extends CommandRequest {
+
+    private final String command;
+
+    protected TestCommandRequest(final String command) {
+      super(Collections.<String, String>emptyMap());
+      assert command != null : "The command cannot be null!";
+      this.command = command;
+    }
+
+    @Override
+    public String getInput() {
+      return command;
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/util/ConvertUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/util/ConvertUtilsJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/util/ConvertUtilsJUnitTest.java
new file mode 100644
index 0000000..d9eb8e5
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/util/ConvertUtilsJUnitTest.java
@@ -0,0 +1,170 @@
+/*
+ * 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.management.internal.web.util;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.management.internal.web.io.MultipartFileAdapter;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.core.io.Resource;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * The ConvertUtilsJUnitTest class is a test suite testing the contract and functionality of the ConvertUtilsJUnitTest class.
+ * <p/>
+ * @see com.gemstone.gemfire.management.internal.web.util.ConvertUtils
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class ConvertUtilsJUnitTest {
+
+  private MultipartFile createMultipartFile(final String filename, final byte[] content) {
+    return new MultipartFileAdapter() {
+      @Override public byte[] getBytes() throws IOException {
+        return content;
+      }
+      @Override public InputStream getInputStream() throws IOException {
+        return new ByteArrayInputStream(getBytes());
+      }
+      @Override public String getName() {
+        return filename;
+      }
+      @Override public String getOriginalFilename() {
+        return filename;
+      }
+      @Override public long getSize() {
+        return content.length;
+      }
+    };
+  }
+
+  private Resource createResource(final String filename, final byte[] content) {
+    return new ByteArrayResource(content, String.format("Content of file (%1$s).", filename)) {
+      @Override public String getFilename() {
+        return filename;
+      }
+    };
+  }
+
+  @Test
+  public void testConvertFileData() throws IOException {
+    final String[] filenames = { "/path/to/file1.ext", "/path/to/another/file2.ext" };
+    final String[] fileContent = { "This is the contents of file 1.", "This is the contents of file 2." };
+
+    final List<byte[]> fileData = new ArrayList<byte[]>(2);
+
+    for (int index = 0; index < filenames.length; index++) {
+      fileData.add(filenames[index].getBytes());
+      fileData.add(fileContent[index].getBytes());
+    }
+
+    final Resource[] resources = ConvertUtils.convert(fileData.toArray(new byte[fileData.size()][]));
+
+    assertNotNull(resources);
+    assertEquals(filenames.length, resources.length);
+
+    for (int index = 0; index < resources.length; index++) {
+      assertEquals(filenames[index], resources[index].getFilename());
+      assertEquals(fileContent[index], new String(IOUtils.toByteArray(resources[index].getInputStream())));
+    }
+  }
+
+  @Test
+  public void testConvertFileDataWithNull() {
+    final Resource[] resources = ConvertUtils.convert((byte[][]) null);
+
+    assertNotNull(resources);
+    assertEquals(0, resources.length);
+  }
+
+  @Test
+  public void testConvertMultipartFile() throws IOException {
+    final MultipartFile[] files = {
+      createMultipartFile("/path/to/multi-part/file1.txt", "The contents of multi-part file1.".getBytes()),
+      createMultipartFile("/path/to/multi-part/file2.txt", "The contents of multi-part file2.".getBytes())
+    };
+
+    final byte[][] fileData = ConvertUtils.convert(files);
+
+    assertNotNull(fileData);
+    assertEquals(files.length * 2, fileData.length);
+
+    for (int index = 0; index < fileData.length; index += 2) {
+      assertEquals(files[index / 2].getOriginalFilename(), new String(fileData[index]));
+      assertEquals(new String(files[index / 2].getBytes()), new String(fileData[index + 1]));
+    }
+  }
+
+  @Test
+  public void testConvertResource() throws IOException {
+    final Resource[] resources = {
+      createResource("/path/to/file1.txt", "Contents of file1.".getBytes()),
+      createResource("/path/to/file2.txt", "Contents of file2.".getBytes())
+    };
+
+    final byte[][] fileData = ConvertUtils.convert(resources);
+
+    assertNotNull(fileData);
+    assertEquals(resources.length * 2, fileData.length);
+
+    for (int index = 0; index < fileData.length; index += 2) {
+      assertEquals(resources[index / 2].getFilename(), new String(fileData[index]));
+      assertEquals(new String(IOUtils.toByteArray(resources[index / 2].getInputStream())), new String(fileData[index + 1]));
+    }
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void testConvertResourceWithResourceHavingNoFilename() throws IOException {
+    try {
+      ConvertUtils.convert(createResource(null, "test".getBytes()));
+    }
+    catch (IllegalArgumentException expected) {
+      assertEquals("The filename of Resource (Byte array resource [Content of file (null).]) must be specified!", expected.getMessage());
+      throw expected;
+    }
+  }
+
+  @Test
+  public void testConvertResourceWithEmpty() throws IOException {
+    final byte[][] fileData = ConvertUtils.convert(new Resource[0]);
+
+    assertNotNull(fileData);
+    assertEquals(0, fileData.length);
+  }
+
+  @Test
+  public void testConvertResourceWithNull() throws IOException {
+    final byte[][] fileData = ConvertUtils.convert((Resource[]) null);
+
+    assertNotNull(fileData);
+    assertEquals(0, fileData.length);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/util/UriUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/util/UriUtilsJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/util/UriUtilsJUnitTest.java
new file mode 100644
index 0000000..645133a
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/util/UriUtilsJUnitTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.management.internal.web.util;
+
+import static org.junit.Assert.*;
+
+import java.util.Map;
+
+import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * The UriUtilsJUnitTest class is a test suite of test cases testing the contract and functionality of the UriUtils class.
+ * <p/>
+ * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
+ * @see com.gemstone.gemfire.management.internal.web.util.UriUtils
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class UriUtilsJUnitTest extends AbstractWebTestCase {
+
+  @Test
+  public void testDecodeNull() {
+    assertNull(UriUtils.decode((String) null));
+  }
+
+  @Test
+  public void testDecodeStringArray() throws Exception {
+    final String[] encodedValues = {
+      null,
+      "123",
+      "test",
+      encode("Path/Subpath"),
+      encode(encode(encode("/Customers/Accounts/Orders/Items")))
+    };
+
+    final String[] decodedValues = UriUtils.decode(encodedValues);
+
+    assertSame(encodedValues, decodedValues);
+    assertEquals(5, decodedValues.length);
+    assertNull(decodedValues[0]);
+    assertEquals("123", decodedValues[1]);
+    assertEquals("test", decodedValues[2]);
+    assertEquals("Path/Subpath", decodedValues[3]);
+    assertEquals("/Customers/Accounts/Orders/Items", decodedValues[4]);
+  }
+
+  @Test
+  public void testDecodeMap() throws Exception {
+    final Map<String, Object> encodedForm = createMap(createArray("0", "1", "2", "3", "4"),
+      (Object[]) createArray(null, "123", "test", encode("Path/Subpath"), encode(encode(encode("/Customers/Accounts/Orders/Items")))));
+
+    final Map<String, Object> decodedForm = UriUtils.decode(encodedForm);
+
+    assertSame(encodedForm, decodedForm);
+    assertEquals(5, decodedForm.size());
+    assertNull(decodedForm.get("0"));
+    assertEquals("123", decodedForm.get("1"));
+    assertEquals("test", decodedForm.get("2"));
+    assertEquals("Path/Subpath", decodedForm.get("3"));
+    assertEquals("/Customers/Accounts/Orders/Items", decodedForm.get("4"));
+  }
+
+  @Test
+  public void testEncodeNull() {
+    assertNull(UriUtils.encode((String) null));
+  }
+
+  @Test
+  public void testEncodeStringArray() throws Exception {
+    final String[] values = { null, "123", "test", "Path/Subpath", "/Customers/Accounts/Orders/Items" };
+    final String[] encodedValues = UriUtils.encode(values);
+
+    assertSame(values, encodedValues);
+    assertEquals(5, encodedValues.length);
+    assertNull(encodedValues[0]);
+    assertEquals("123", encodedValues[1]);
+    assertEquals("test", encodedValues[2]);
+    assertEquals(encode("Path/Subpath"), encodedValues[3]);
+    assertEquals(encode("/Customers/Accounts/Orders/Items"), encodedValues[4]);
+  }
+
+  @Test
+  public void testEncodeMap() throws Exception {
+    final Map<String, Object> form = createMap(createArray("0", "1", "2", "3", "4"),
+      (Object[]) createArray(null, "123", "test", "Path/Subpath", "/Customers/Accounts/Orders/Items"));
+
+    final Map<String, Object> encodedForm = UriUtils.encode(form);
+
+    assertSame(form, encodedForm);
+    assertEquals(5, encodedForm.size());
+    assertNull(encodedForm.get("0"));
+    assertEquals("123", encodedForm.get("1"));
+    assertEquals("test", encodedForm.get("2"));
+    assertEquals(encode("Path/Subpath"), encodedForm.get("3"));
+    assertEquals(encode("/Customers/Accounts/Orders/Items"), encodedForm.get("4"));
+  }
+
+}



[54/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-web/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-web/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java
new file mode 100644
index 0000000..11b8ab1
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DataCommandsOverHttpDistributedTest.java
@@ -0,0 +1,151 @@
+/*
+ * 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.management.internal.cli.commands;
+
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.management.DistributedRegionMXBean;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.ProvideSystemProperty;
+import org.junit.experimental.categories.Category;
+
+@Category(DistributedTest.class)
+@SuppressWarnings("deprecated")
+public class DataCommandsOverHttpDistributedTest extends CliCommandTestBase {
+
+  private static final String REBALANCE_REGION_NAME = DataCommandsOverHttpDistributedTest.class.getSimpleName() + "Region";
+
+  @ClassRule
+  public static ProvideSystemProperty provideSystemProperty = new ProvideSystemProperty(CliCommandTestBase.USE_HTTP_SYSTEM_PROPERTY, "true");
+
+  @Test
+  public void testSimulateForEntireDSWithTimeout() {
+    setupTestRebalanceForEntireDS();
+    //check if DistributedRegionMXBean is available so that command will not fail
+    final VM manager = Host.getHost(0).getVM(0);
+    manager.invoke(checkRegionMBeans);
+
+    getLogWriter().info("testSimulateForEntireDS verified MBean and executing command");
+
+    String command = "rebalance --simulate=true --time-out=-1";
+
+    CommandResult cmdResult = executeCommand(command);
+
+    getLogWriter().info("testSimulateForEntireDS just after executing " + cmdResult);
+
+    if (cmdResult != null) {
+      String stringResult = commandResultToString(cmdResult);
+      getLogWriter().info("testSimulateForEntireDS stringResult : " + stringResult);
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
+    }
+  }
+
+  SerializableRunnable checkRegionMBeans = new SerializableRunnable() {
+    @Override
+    public void run() {
+      final WaitCriterion waitForMaangerMBean = new WaitCriterion() {
+        @Override
+        public boolean done() {
+          final ManagementService service = ManagementService.getManagementService(getCache());
+          final DistributedRegionMXBean bean = service.getDistributedRegionMXBean(
+            Region.SEPARATOR + REBALANCE_REGION_NAME);
+          if (bean == null) {
+            getLogWriter().info("Still probing for checkRegionMBeans ManagerMBean");
+            return false;
+          } else {
+            // verify that bean is proper before executing tests
+            if (bean.getMembers() != null && bean.getMembers().length > 1 && bean.getMemberCount() > 0 && service.getDistributedSystemMXBean().listRegions().length >= 2) {
+              return true;
+            } else {
+              return false;
+            }
+          }
+        }
+
+        @Override
+        public String description() {
+          return "Probing for testRebalanceCommandForSimulateWithNoMember ManagerMBean";
+        }
+      };
+      waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
+      DistributedRegionMXBean bean = ManagementService.getManagementService(getCache()).getDistributedRegionMXBean(
+        "/" + REBALANCE_REGION_NAME);
+      assertNotNull(bean);
+    }
+  };
+
+  void setupTestRebalanceForEntireDS() {
+    final VM vm1 = Host.getHost(0).getVM(1);
+    final VM vm2 = Host.getHost(0).getVM(2);
+    setUpJmxManagerOnVm0ThenConnect(null);
+
+    vm1.invoke(new SerializableRunnable() {
+      public void run() {
+
+        // no need to close cache as it will be closed as part of teardown2
+        Cache cache = getCache();
+
+        RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
+        Region region = dataRegionFactory.create(REBALANCE_REGION_NAME);
+        for (int i = 0; i < 10; i++) {
+          region.put("key" + (i + 200), "value" + (i + 200));
+        }
+        region = dataRegionFactory.create(REBALANCE_REGION_NAME + "Another1");
+        for (int i = 0; i < 100; i++) {
+          region.put("key" + (i + 200), "value" + (i + 200));
+        }
+      }
+    });
+
+    vm2.invoke(new SerializableRunnable() {
+      public void run() {
+
+        // no need to close cache as it will be closed as part of teardown2
+        Cache cache = getCache();
+
+        RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
+        Region region = dataRegionFactory.create(REBALANCE_REGION_NAME);
+        for (int i = 0; i < 100; i++) {
+          region.put("key" + (i + 400), "value" + (i + 400));
+        }
+        region = dataRegionFactory.create(REBALANCE_REGION_NAME + "Another2");
+        for (int i = 0; i < 10; i++) {
+          region.put("key" + (i + 200), "value" + (i + 200));
+        }
+      }
+    });
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
new file mode 100644
index 0000000..313f31a
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.management.internal.security;
+
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import org.junit.experimental.categories.Category;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
+public class GfshCommandsOverHttpSecurityTest extends GfshCommandsSecurityTest {
+  public GfshCommandsOverHttpSecurityTest(){
+    gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, true);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
new file mode 100644
index 0000000..ae5c749
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
@@ -0,0 +1,96 @@
+/*
+ * 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.management.internal.web;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.management.internal.web.domain.Link;
+
+/**
+ * The AbstractWebDomainTests class is abstract base class containing functionality common to a test suite classes
+ * in the com.gemstone.gemfire.management.internal.web.domain package.
+ * <p/>
+ * @see java.net.URI
+ * @see java.net.URLDecoder
+ * @see java.net.URLEncoder
+ * @see com.gemstone.gemfire.management.internal.web.domain.Link
+ * @since GemFire 8.0
+ */
+@SuppressWarnings("unused")
+public abstract class AbstractWebTestCase {
+
+  protected <E> E[] createArray(final E... array) {
+    return array;
+  }
+
+  protected <K, V> Map<K, V> createMap(final K[] keys, final V[] values) {
+    assert keys != null : "The Keys for the Map cannot be null!";
+    assert values != null : "The Values for the Map cannot be null!";
+    assert keys.length == values.length;
+
+    final Map<K, V> map = new HashMap<K, V>(keys.length);
+    int index = 0;
+
+    for (final K key : keys) {
+      map.put(key, values[index++]);
+    }
+
+    return map;
+  }
+
+  protected String decode(final String encodedValue) throws UnsupportedEncodingException {
+    return URLDecoder.decode(encodedValue, StringUtils.UTF_8);
+  }
+
+  protected String encode(final String value) throws UnsupportedEncodingException {
+    return URLEncoder.encode(value, StringUtils.UTF_8);
+  }
+
+  protected String toString(final Link... links) throws UnsupportedEncodingException {
+    final StringBuilder buffer = new StringBuilder("[");
+    int count = 0;
+
+    for (final Link link : links) {
+      buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(toString(link));
+
+    }
+
+    buffer.append("]");
+
+    return buffer.toString();
+  }
+
+  protected String toString(final Link link) throws UnsupportedEncodingException {
+    return link.toHttpRequestLine();
+  }
+
+  protected String toString(final URI uri) throws UnsupportedEncodingException {
+    return decode(uri.toString());
+  }
+
+  protected URI toUri(final String uriString) throws UnsupportedEncodingException, URISyntaxException {
+    return new URI(encode(uriString));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
new file mode 100644
index 0000000..8fd3127
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
@@ -0,0 +1,238 @@
+/*
+ * 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.management.internal.web.controllers;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.shell.core.CommandMarker;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import com.gemstone.gemfire.management.cli.CliMetaData;
+import com.gemstone.gemfire.management.internal.cli.util.ClasspathScanLoadHelper;
+import com.gemstone.gemfire.management.internal.web.domain.Link;
+import com.gemstone.gemfire.management.internal.web.domain.LinkIndex;
+import com.gemstone.gemfire.management.internal.web.util.UriUtils;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The ShellCommandsControllerJUnitTest class is a test suite of test cases testing the contract and functionality of the
+ * ShellCommandsController class, and specifically ensuring that all GemFire Gfsh commands have a corresponding
+ * Management REST API call and web service endpoint in the GemFire Management REST Interface.
+ * <p/>
+ * @see org.junit.Test
+ * @see com.gemstone.gemfire.management.internal.web.controllers.ShellCommandsController
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class ShellCommandsControllerJUnitTest {
+
+  private static ShellCommandsController controller;
+
+  @BeforeClass
+  public static void setupBeforeClass() {
+    controller = new ShellCommandsController();
+    MockHttpServletRequest request = new MockHttpServletRequest();
+    request.setContextPath("gemfire");
+    RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
+  }
+
+  @AfterClass
+  public static void tearDownAfterClass() {
+    controller = null;
+  }
+
+  private List<String> getCliCommands() {
+    try {
+      Set<Class<?>> commandClasses = ClasspathScanLoadHelper.loadAndGet(
+        "com.gemstone.gemfire.management.internal.cli.commands", CommandMarker.class, true);
+
+      List<String> commands = new ArrayList<>(commandClasses.size());
+
+      for (Class<?> commandClass : commandClasses) {
+        for (Method method : commandClass.getMethods()) {
+          if (method.isAnnotationPresent(CliCommand.class)) {
+            if (!(method.isAnnotationPresent(CliMetaData.class)
+              && method.getAnnotation(CliMetaData.class).shellOnly()))
+            {
+              CliCommand commandAnnotation = method.getAnnotation(CliCommand.class);
+              commands.addAll(Arrays.asList(commandAnnotation.value()));
+            }
+          }
+        }
+      }
+
+      return commands;
+    }
+    catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private List<String> getControllerWebServiceEndpoints() {
+    RequestAttributes requestAttrs = RequestContextHolder.getRequestAttributes();
+    HttpServletRequest servletRequest = ((ServletRequestAttributes) requestAttrs).getRequest();
+    String scheme = servletRequest.getScheme();
+
+    try {
+      Set<Class<?>> controllerClasses = ClasspathScanLoadHelper.loadAndGet(
+        "com.gemstone.gemfire.management.internal.web.controllers", AbstractCommandsController.class, true);
+
+      List<String> controllerWebServiceEndpoints = new ArrayList<>(controllerClasses.size());
+
+      for (Class<?> controllerClass : controllerClasses) {
+        if (!AbstractCommandsController.class.equals(controllerClass)) {
+          for (Method method : controllerClass.getMethods()) {
+            if (method.isAnnotationPresent(RequestMapping.class)) {
+              RequestMapping requestMappingAnnotation = method.getAnnotation(RequestMapping.class);
+
+              String webServiceEndpoint = String.format("%1$s %2$s", requestMappingAnnotation.method()[0],
+                UriUtils.decode(controller.toUri(requestMappingAnnotation.value()[0], scheme).toString()));
+
+              String[] requestParameters = requestMappingAnnotation.params();
+
+              if (requestParameters.length > 0) {
+                webServiceEndpoint += "?".concat(
+                  com.gemstone.gemfire.internal.lang.StringUtils.concat(requestParameters, "&amp;"));
+              }
+
+              controllerWebServiceEndpoints.add(webServiceEndpoint);
+            }
+          }
+        }
+      }
+
+      return controllerWebServiceEndpoints;
+    }
+    catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Test
+  public void testUniqueIndex() {
+    LinkIndex linkIndex = controller.index("https");
+
+    List<String> conflicts = new ArrayList<>();
+    Map<String, String> uriRelationMapping = new HashMap<>(linkIndex.size());
+
+    for (Link link : linkIndex) {
+      if (uriRelationMapping.containsKey(link.toHttpRequestLine())) {
+        conflicts.add(String.format("REST API endpoint (%1$s) for (%2$s) conflicts with the REST API endpoint for (%3$s)",
+          link.toHttpRequestLine(), link.getRelation(), uriRelationMapping.get(link.toHttpRequestLine())));
+      }
+      else {
+        uriRelationMapping.put(link.toHttpRequestLine(), link.getRelation());
+      }
+    }
+
+    assertTrue(String.format("Conflicts: %1$s!", conflicts), conflicts.isEmpty());
+  }
+
+  @Test
+  public void testIndex() {
+    List<String> commands = getCliCommands();
+
+    assertNotNull(commands);
+    assertFalse(commands.isEmpty());
+
+    LinkIndex linkIndex = controller.index("https");
+
+    assertNotNull(linkIndex);
+    assertFalse(linkIndex.isEmpty());
+
+    List<String> linkCommands = new ArrayList<>(linkIndex.size());
+
+    for (Link link : linkIndex) {
+      linkCommands.add(link.getRelation());
+    }
+
+    assertEquals(linkIndex.size(), linkCommands.size());
+
+    List<String> missingLinkCommands = new ArrayList<>(commands);
+
+    missingLinkCommands.removeAll(linkCommands);
+
+    assertTrue(String.format(
+      "The GemFire Management REST API Link Index is missing Link(s) for the following command(s): %1$s",
+        missingLinkCommands), missingLinkCommands.isEmpty());
+  }
+
+  @Test
+  public void testCommandHasRestApiControllerWebServiceEndpoint() {
+    List<String> controllerWebServiceEndpoints = getControllerWebServiceEndpoints();
+
+    assertNotNull(controllerWebServiceEndpoints);
+    assertFalse(controllerWebServiceEndpoints.isEmpty());
+
+    LinkIndex linkIndex = controller.index("http");
+
+    assertNotNull(linkIndex);
+    assertFalse(linkIndex.isEmpty());
+
+    List<String> linkWebServiceEndpoints = new ArrayList<>(linkIndex.size());
+
+    for (Link link : linkIndex) {
+      linkWebServiceEndpoints.add(link.toHttpRequestLine());
+    }
+
+    assertEquals(linkIndex.size(), linkWebServiceEndpoints.size());
+
+    List<String> missingControllerWebServiceEndpoints = new ArrayList<>(linkWebServiceEndpoints);
+
+    missingControllerWebServiceEndpoints.removeAll(controllerWebServiceEndpoints);
+
+    assertTrue(String.format(
+        "The Management REST API Web Service Controllers in (%1$s) are missing the following REST API Web Service Endpoint(s): %2$s!",
+        getClass().getPackage().getName(), missingControllerWebServiceEndpoints), missingControllerWebServiceEndpoints.isEmpty());
+  }
+
+  @Test
+  public void testIndexUrisHaveCorrectScheme() {
+    String versionCmd = "version";
+    List<String> controllerWebServiceEndpoints = getControllerWebServiceEndpoints();
+
+    assertNotNull(controllerWebServiceEndpoints);
+    assertFalse(controllerWebServiceEndpoints.isEmpty());
+
+    String testScheme = "xyz";
+    LinkIndex linkIndex = controller.index(testScheme);
+
+    assertNotNull(linkIndex);
+    assertFalse(linkIndex.isEmpty());
+
+    assertTrue(String.format("Link does not have correct scheme %1$s", linkIndex.find(versionCmd)),
+        testScheme.equals(linkIndex.find(versionCmd).getHref().getScheme()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java
new file mode 100644
index 0000000..0037a48
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorJUnitTest.java
@@ -0,0 +1,273 @@
+/*
+ * 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.management.internal.web.controllers.support;
+
+import static org.junit.Assert.*;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+
+import edu.umd.cs.mtc.MultithreadedTestCase;
+import edu.umd.cs.mtc.TestFramework;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.concurrent.Synchroniser;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The LoginHandlerInterceptorJUnitTest class is a test suite of test cases to test the contract
+ * and functionality of the Spring HandlerInterceptor, LoginHandlerInterceptor class.
+ * 
+ * @see org.jmock.Mockery
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class LoginHandlerInterceptorJUnitTest {
+
+  private Mockery mockContext;
+
+  @Before
+  public void setUp() {
+    mockContext = new Mockery();
+    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
+    mockContext.setThreadingPolicy(new Synchroniser());
+  }
+
+  @After
+  public void tearDown() {
+    mockContext.assertIsSatisfied();
+    mockContext = null;
+  }
+
+  private String createEnvironmentVariable(final String name) {
+    return (LoginHandlerInterceptor.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + name);
+  }
+
+  private <T> Enumeration<T> enumeration(final Iterator<T> iterator) {
+    return new Enumeration<T>() {
+      public boolean hasMoreElements() {
+        return iterator.hasNext();
+      }
+      public T nextElement() {
+        return iterator.next();
+      }
+    };
+  }
+
+  @Test
+  public void testPreHandleAfterCompletion() throws Exception {
+    final Map<String, String> requestParameters = new HashMap<>(2);
+    final Map<String, String> requestHeaders = new HashMap<>();
+
+    requestParameters.put("parameter", "one");
+    requestParameters.put(createEnvironmentVariable("variable"), "two");
+
+    final HttpServletRequest mockHttpRequest = mockContext.mock(HttpServletRequest.class, "testPreHandleAfterCompletion.HttpServletRequest");
+
+    mockContext.checking(new Expectations() {{
+      oneOf(mockHttpRequest).getParameterNames();
+      will(returnValue(enumeration(requestParameters.keySet().iterator())));
+      oneOf(mockHttpRequest).getHeaderNames();
+      will(returnValue(enumeration(requestHeaders.keySet().iterator())));
+      oneOf(mockHttpRequest).getParameter(with(equal(createEnvironmentVariable("variable"))));
+      will(returnValue(requestParameters.get(createEnvironmentVariable("variable"))));
+    }});
+
+    LoginHandlerInterceptor handlerInterceptor = new LoginHandlerInterceptor();
+
+    Map<String, String> envBefore = LoginHandlerInterceptor.getEnvironment();
+
+    assertNotNull(envBefore);
+    assertTrue(envBefore.isEmpty());
+    assertTrue(handlerInterceptor.preHandle(mockHttpRequest, null, null));
+
+    Map<String, String> envSet = LoginHandlerInterceptor.getEnvironment();
+
+    assertNotNull(envSet);
+    assertNotSame(envBefore, envSet);
+    assertEquals(1, envSet.size());
+    assertTrue(envSet.containsKey("variable"));
+    assertEquals("two", envSet.get("variable"));
+
+    handlerInterceptor.afterCompletion(mockHttpRequest, null, null, null);
+
+    Map<String, String> envAfter = LoginHandlerInterceptor.getEnvironment();
+
+    assertNotNull(envAfter);
+    assertTrue(envAfter.isEmpty());
+  }
+
+  @Test
+  public void testHandlerInterceptorThreadSafety() throws Throwable {
+    TestFramework.runOnce(new HandlerInterceptorThreadSafetyMultiThreadedTestCase());
+  }
+
+  private final class HandlerInterceptorThreadSafetyMultiThreadedTestCase extends MultithreadedTestCase {
+
+    private LoginHandlerInterceptor handlerInterceptor;
+
+    private HttpServletRequest mockHttpRequestOne;
+    private HttpServletRequest mockHttpRequestTwo;
+
+    @Override
+    public void initialize() {
+      super.initialize();
+
+      final Map<String, String> requestParametersOne = new HashMap<>(3);
+      final Map<String, String> requestHeaders = new HashMap<>();
+
+      requestParametersOne.put("param", "one");
+      requestParametersOne.put(createEnvironmentVariable("STAGE"), "test");
+      requestParametersOne.put(createEnvironmentVariable("GEMFIRE"), "/path/to/gemfire/700");
+
+      mockHttpRequestOne = mockContext.mock(HttpServletRequest.class, "testHandlerInterceptorThreadSafety.HttpServletRequest.1");
+
+      mockContext.checking(new Expectations() {{
+        oneOf(mockHttpRequestOne).getParameterNames();
+        will(returnValue(enumeration(requestParametersOne.keySet().iterator())));
+        oneOf(mockHttpRequestOne).getHeaderNames();
+        will(returnValue(enumeration(requestHeaders.keySet().iterator())));
+        oneOf(mockHttpRequestOne).getParameter(with(equal(createEnvironmentVariable("STAGE"))));
+        will(returnValue(requestParametersOne.get(createEnvironmentVariable("STAGE"))));
+        oneOf(mockHttpRequestOne).getParameter(with(equal(createEnvironmentVariable("GEMFIRE"))));
+        will(returnValue(requestParametersOne.get(createEnvironmentVariable("GEMFIRE"))));
+      }});
+
+      mockHttpRequestTwo = mockContext.mock(HttpServletRequest.class, "testHandlerInterceptorThreadSafety.HttpServletRequest.2");
+
+      final Map<String, String> requestParametersTwo = new HashMap<>(3);
+
+      requestParametersTwo.put("parameter", "two");
+      requestParametersTwo.put(createEnvironmentVariable("HOST"), "localhost");
+      requestParametersTwo.put(createEnvironmentVariable("GEMFIRE"), "/path/to/gemfire/75");
+
+      mockContext.checking(new Expectations() {{
+        oneOf(mockHttpRequestTwo).getParameterNames();
+        will(returnValue(enumeration(requestParametersTwo.keySet().iterator())));
+        oneOf(mockHttpRequestTwo).getHeaderNames();
+        will(returnValue(enumeration(requestHeaders.keySet().iterator())));
+        oneOf(mockHttpRequestTwo).getParameter(with(equal(createEnvironmentVariable("HOST"))));
+        will(returnValue(requestParametersTwo.get(createEnvironmentVariable("HOST"))));
+        oneOf(mockHttpRequestTwo).getParameter(with(equal(createEnvironmentVariable("GEMFIRE"))));
+        will(returnValue(requestParametersTwo.get(createEnvironmentVariable("GEMFIRE"))));
+      }});
+
+      handlerInterceptor =  new LoginHandlerInterceptor();
+    }
+
+    public void thread1() throws Exception {
+      assertTick(0);
+      Thread.currentThread().setName("HTTP Request Processing Thread 1");
+
+      Map<String, String> env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertTrue(env.isEmpty());
+      assertTrue(handlerInterceptor.preHandle(mockHttpRequestOne, null, null));
+
+      env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertEquals(2, env.size());
+      assertFalse(env.containsKey("param"));
+      assertFalse(env.containsKey("parameter"));
+      assertFalse(env.containsKey("HOST"));
+      assertEquals("test", env.get("STAGE"));
+      assertEquals("/path/to/gemfire/700", env.get("GEMFIRE"));
+
+      waitForTick(2);
+
+      env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertEquals(2, env.size());
+      assertFalse(env.containsKey("param"));
+      assertFalse(env.containsKey("parameter"));
+      assertFalse(env.containsKey("HOST"));
+      assertEquals("test", env.get("STAGE"));
+      assertEquals("/path/to/gemfire/700", env.get("GEMFIRE"));
+
+      waitForTick(4);
+
+      env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertEquals(2, env.size());
+      assertFalse(env.containsKey("param"));
+      assertFalse(env.containsKey("parameter"));
+      assertFalse(env.containsKey("HOST"));
+      assertEquals("test", env.get("STAGE"));
+      assertEquals("/path/to/gemfire/700", env.get("GEMFIRE"));
+
+      handlerInterceptor.afterCompletion(mockHttpRequestOne, null, null, null);
+
+      env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertTrue(env.isEmpty());
+    }
+
+    public void thread2() throws Exception {
+      assertTick(0);
+      Thread.currentThread().setName("HTTP Request Processing Thread 2");
+      waitForTick(1);
+
+      Map<String, String> env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertTrue(env.isEmpty());
+      assertTrue(handlerInterceptor.preHandle(mockHttpRequestTwo, null, null));
+
+      env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertEquals(2, env.size());
+      assertFalse(env.containsKey("parameter"));
+      assertFalse(env.containsKey("param"));
+      assertFalse(env.containsKey("STAGE"));
+      assertEquals("localhost", env.get("HOST"));
+      assertEquals("/path/to/gemfire/75", env.get("GEMFIRE"));
+
+      waitForTick(3);
+
+      handlerInterceptor.afterCompletion(mockHttpRequestTwo, null, null, null);
+
+      env = LoginHandlerInterceptor.getEnvironment();
+
+      assertNotNull(env);
+      assertTrue(env.isEmpty());
+    }
+
+    @Override
+    public void finish() {
+      super.finish();
+      handlerInterceptor = null;
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkIndexJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkIndexJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkIndexJUnitTest.java
new file mode 100644
index 0000000..61a9736
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkIndexJUnitTest.java
@@ -0,0 +1,236 @@
+/*
+ * 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.management.internal.web.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.gemstone.gemfire.internal.util.CollectionUtils;
+import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
+import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * The LinkIndexJUnitTest class is a test suite of test cases testing the contract and functionality of the LinkIndex class.
+ * <p/>
+ * @see java.net.URI
+ * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
+ * @see com.gemstone.gemfire.management.internal.web.domain.LinkIndex
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class LinkIndexJUnitTest extends AbstractWebTestCase {
+
+  @Test
+  public void testAdd() throws Exception {
+    final Link link = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(0, linkIndex.size());
+    assertEquals(linkIndex, linkIndex.add(link));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(1, linkIndex.size());
+    assertEquals(linkIndex, linkIndex.add(link)); // test duplicate addition
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(1, linkIndex.size());
+  }
+
+  @Test(expected = AssertionError.class)
+  public void testAddNullLink() {
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+
+    try {
+      linkIndex.add(null);
+    }
+    finally {
+      assertTrue(linkIndex.isEmpty());
+    }
+  }
+
+  @Test
+  public void testAddAll() throws Exception {
+    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
+    final Link retrieve = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
+    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(linkIndex, linkIndex.addAll(create, retrieve, update, delete));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(4, linkIndex.size());
+  }
+
+  @Test(expected = AssertionError.class)
+  public void testAddAllWithNullLinks() {
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+
+    try {
+      linkIndex.addAll((Iterable<Link>) null);
+    }
+    finally {
+      assertTrue(linkIndex.isEmpty());
+    }
+  }
+
+  @Test
+  public void testFind() throws Exception {
+    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
+    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
+    final Link retrieve = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
+    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieve, update, delete));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(5, linkIndex.size());
+    assertEquals(list, linkIndex.find("get-resources"));
+    assertEquals(retrieve, linkIndex.find("get-resource"));
+    assertEquals(update, linkIndex.find("UPDATE-RESOURCE"));
+    assertEquals(delete, linkIndex.find("Delete-Resource"));
+    assertNull(linkIndex.find("destroy-resource"));
+    assertNull(linkIndex.find("save-resource"));
+  }
+
+  @Test
+  public void testFindAll() throws Exception {
+    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
+    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
+    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
+    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
+    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(6, linkIndex.size());
+
+    final Link[] retrieveLinks = linkIndex.findAll("get-resource");
+
+    assertNotNull(retrieveLinks);
+    assertEquals(2, retrieveLinks.length);
+    assertTrue(Arrays.asList(retrieveLinks).containsAll(Arrays.asList(retrieveById, retrieveByName)));
+
+    final Link[] saveLinks = linkIndex.findAll("save-resource");
+
+    assertNotNull(saveLinks);
+    assertEquals(0, saveLinks.length);
+  }
+
+  @Test
+  public void testIterator() throws Exception {
+    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
+    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
+    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
+    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
+    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(6, linkIndex.size());
+
+    final Collection<Link> expectedLinks = Arrays.asList(list, create, retrieveById, retrieveByName, update, delete);
+
+    final Collection<Link> actualLinks = new ArrayList<Link>(linkIndex.size());
+
+    for (final Link link : linkIndex) {
+      actualLinks.add(link);
+    }
+
+    assertTrue(actualLinks.containsAll(expectedLinks));
+  }
+
+  @Test
+  public void testToList() throws Exception {
+    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
+    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
+    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
+    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
+    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(6, linkIndex.size());
+
+    final List<Link> expectedList = CollectionUtils.asList(list, create, retrieveById, retrieveByName, update, delete);
+
+    Collections.sort(expectedList);
+
+    assertEquals(expectedList, linkIndex.toList());
+  }
+
+  @Test
+  public void testToMap() throws Exception {
+    final Link list = new Link("get-resources", toUri("http://host.domain.com:port/service/v1/resources"));
+    final Link create = new Link("create-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.POST);
+    final Link retrieveById = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+    final Link retrieveByName = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{name}"));
+    final Link update = new Link("update-resource", toUri("http://host.domain.com:port/service/v1/resources"), HttpMethod.PUT);
+    final Link delete = new Link("delete-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final LinkIndex linkIndex = new LinkIndex();
+
+    assertTrue(linkIndex.isEmpty());
+    assertEquals(linkIndex, linkIndex.addAll(list, create, retrieveById, retrieveByName, update, delete));
+    assertFalse(linkIndex.isEmpty());
+    assertEquals(6, linkIndex.size());
+
+    final Map<String, List<Link>> expectedMap = new HashMap<String, List<Link>>(5);
+
+    expectedMap.put("get-resources", Arrays.asList(list));
+    expectedMap.put("create-resource", Arrays.asList(create));
+    expectedMap.put("get-resource", Arrays.asList(retrieveById, retrieveByName));
+    expectedMap.put("update-resource", Arrays.asList(update));
+    expectedMap.put("delete-resource", Arrays.asList(delete));
+
+    assertEquals(expectedMap, linkIndex.toMap());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkJUnitTest.java
new file mode 100644
index 0000000..c0b1620
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/LinkJUnitTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.management.internal.web.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import com.gemstone.gemfire.internal.util.CollectionUtils;
+import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
+import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * The LinkJUnitTest class is a test suite of test cases testing the contract and functionality of the Link class.
+ * <p/>
+ * @see java.net.URI
+ * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
+ * @see com.gemstone.gemfire.management.internal.web.domain.Link
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class LinkJUnitTest extends AbstractWebTestCase {
+
+  @Test
+  public void testConstructDefaultLink() {
+    final Link link = new Link();
+
+    assertNotNull(link);
+    assertNull(link.getHref());
+    assertNull(link.getMethod());
+    assertNull(link.getRelation());
+  }
+
+  @Test
+  public void testConstructLinkWithRelationAndHref() throws Exception {
+    final Link link = new Link("get-resource", toUri("http://host:port/service/v1/resources/{id}"));
+
+    assertNotNull(link);
+    assertEquals("http://host:port/service/v1/resources/{id}", toString(link.getHref()));
+    assertEquals(HttpMethod.GET, link.getMethod());
+    assertEquals("get-resource", link.getRelation());
+  }
+
+  @Test
+  public void testConstructLinkWithRelationHrefAndMethod() throws Exception {
+    final Link link = new Link("create-resource", toUri("http://host:port/service/v1/resources"), HttpMethod.POST);
+
+    assertNotNull(link);
+    assertEquals("http://host:port/service/v1/resources", toString(link.getHref()));
+    assertEquals(HttpMethod.POST, link.getMethod());
+    assertEquals("create-resource", link.getRelation());
+  }
+
+  @Test
+  public void testSetAndGetMethod() {
+    final Link link = new Link();
+
+    assertNotNull(link);
+    assertNull(link.getMethod());
+
+    link.setMethod(HttpMethod.POST);
+
+    assertEquals(HttpMethod.POST, link.getMethod());
+
+    link.setMethod(null);
+
+    assertEquals(HttpMethod.GET, link.getMethod());
+  }
+
+  @Test
+  public void testCompareTo() throws Exception {
+    final Link link0 = new Link("resources", toUri("http://host:port/service/v1/resources"));
+    final Link link1 = new Link("resource", toUri("http://host:port/service/v1/resources"), HttpMethod.POST);
+    final Link link2 = new Link("resource", toUri("http://host:port/service/v1/resources/{id}"));
+    final Link link3 = new Link("resource", toUri("http://host:port/service/v1/resources/{name}"));
+    final Link link4 = new Link("resource", toUri("http://host:port/service/v1/resources/{id}"), HttpMethod.DELETE);
+
+    final List<Link> expectedList = new ArrayList<Link>(Arrays.asList(link1, link4, link2, link3, link0));
+
+    final List<Link> actualList = CollectionUtils.asList(link0, link1, link2, link3, link4);
+
+    Collections.sort(actualList);
+
+    System.out.println(toString(expectedList.toArray(new Link[expectedList.size()])));
+    System.out.println(toString(actualList.toArray(new Link[actualList.size()])));
+
+    assertEquals(expectedList, actualList);
+  }
+
+  @Test
+  public void testToHttpRequestLine() throws Exception {
+    final Link link = new Link("get-resource", toUri("http://host.domain.com:port/service/v1/resources/{id}"));
+
+    assertNotNull(link);
+    assertEquals(HttpMethod.GET, link.getMethod());
+    assertEquals("http://host.domain.com:port/service/v1/resources/{id}", toString(link.getHref()));
+    assertEquals("GET ".concat("http://host.domain.com:port/service/v1/resources/{id}"), link.toHttpRequestLine());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/QueryParameterSourceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/QueryParameterSourceJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/QueryParameterSourceJUnitTest.java
new file mode 100644
index 0000000..ae2f87b
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/domain/QueryParameterSourceJUnitTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.management.internal.web.domain;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * The QueryParameterSourceJUnitTest class is a test suite of test cases testing the contract and functionality of the
+ * QueryParameterSource class.
+ * <p/>
+ * @see com.gemstone.gemfire.management.internal.web.domain.QueryParameterSource
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class QueryParameterSourceJUnitTest {
+
+  @Test
+  public void testCreateQueryParameterSource() throws MalformedObjectNameException {
+    final ObjectName expectedObjectName = ObjectName.getInstance("GemFire:type=Member,*");
+    
+    final QueryExp expectedQueryExpression = Query.eq(Query.attr("id"), Query.value("12345"));
+
+    final QueryParameterSource query = new QueryParameterSource(expectedObjectName, expectedQueryExpression);
+
+    assertNotNull(query);
+    assertSame(expectedObjectName, query.getObjectName());
+    assertSame(expectedQueryExpression, query.getQueryExpression());
+  }
+
+  @Test
+  public void testSerialization() throws ClassNotFoundException, IOException, MalformedObjectNameException {
+    final ObjectName expectedObjectName = ObjectName.getInstance("GemFire:type=Member,*");
+    
+    final QueryExp expectedQueryExpression = Query.or(
+      Query.eq(Query.attr("name"), Query.value("myName")),
+      Query.eq(Query.attr("id"), Query.value("myId"))
+    );
+
+    final QueryParameterSource expectedQuery = new QueryParameterSource(expectedObjectName, expectedQueryExpression);
+
+    assertNotNull(expectedQuery);
+    assertSame(expectedObjectName, expectedQuery.getObjectName());
+    assertSame(expectedQueryExpression, expectedQuery.getQueryExpression());
+
+    final byte[] queryBytes = IOUtils.serializeObject(expectedQuery);
+
+    assertNotNull(queryBytes);
+    assertTrue(queryBytes.length != 0);
+
+    final Object queryObj = IOUtils.deserializeObject(queryBytes);
+
+    assertTrue(queryObj instanceof QueryParameterSource);
+
+    final QueryParameterSource actualQuery = (QueryParameterSource) queryObj;
+
+    assertNotSame(expectedQuery, actualQuery);
+    assertNotNull(actualQuery.getObjectName());
+    assertEquals(expectedQuery.getObjectName().toString(), actualQuery.getObjectName().toString());
+    assertNotNull(actualQuery.getQueryExpression());
+    assertEquals(expectedQuery.getQueryExpression().toString(), actualQuery.getQueryExpression().toString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestJUnitTest.java
new file mode 100644
index 0000000..bbe961b
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestJUnitTest.java
@@ -0,0 +1,509 @@
+/*
+ * 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.management.internal.web.http;
+
+import static org.junit.Assert.*;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.MediaType;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import com.gemstone.gemfire.management.internal.web.AbstractWebTestCase;
+import com.gemstone.gemfire.management.internal.web.domain.Link;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The ClientHttpRequestJUnitTest class is a test suite of test cases testing the contract and functionality of the
+ * ClientHttpRequest class.
+ * <p/>
+ * @see com.gemstone.gemfire.management.internal.web.AbstractWebTestCase
+ * @see com.gemstone.gemfire.management.internal.web.http.ClientHttpRequest
+ * @see org.jmock.Mockery
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class ClientHttpRequestJUnitTest extends AbstractWebTestCase {
+
+  private Mockery mockContext;
+
+  @Before
+  public void setUp() {
+    mockContext = new Mockery();
+    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
+  }
+
+  @After
+  public void tearDown() {
+    mockContext.assertIsSatisfied();
+    mockContext = null;
+  }
+
+  @Test
+  public void testCreateClientHttpRequest() throws Exception {
+    final Link expectedLink = new Link("test", toUri("http://host.domain.com:8080/app/service"));
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertNotNull(request);
+    assertEquals(expectedLink, request.getLink());
+  }
+
+  @Test(expected = AssertionError.class)
+  public void testCreateClientHttpRequestWithNullLink() {
+    new ClientHttpRequest(null);
+  }
+
+  @Test
+  public void testGetMethod() throws Exception {
+    Link link = new Link("get-resource", toUri("http://host.domain.com:8080/app/resources/{id}"));
+    ClientHttpRequest request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.GET, request.getMethod());
+
+    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.DELETE);
+    request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.DELETE, request.getMethod());
+
+    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/service"), HttpMethod.HEAD);
+    request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.HEAD, request.getMethod());
+
+    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/service"), HttpMethod.OPTIONS);
+    request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.OPTIONS, request.getMethod());
+
+    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/resources"), HttpMethod.POST);
+    request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.POST, request.getMethod());
+
+    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app/resources"), HttpMethod.PUT);
+    request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.PUT, request.getMethod());
+
+    link = new Link("delete-resource", toUri("http://host.domain.com:8080/app"), HttpMethod.TRACE);
+    request = new ClientHttpRequest(link);
+
+    assertEquals(link, request.getLink());
+    assertEquals(org.springframework.http.HttpMethod.TRACE, request.getMethod());
+  }
+
+  @Test
+  public void testIsDelete() throws Exception {
+    final Link expectedLink = new Link("delete", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.DELETE);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertTrue(request.isDelete());
+    assertFalse(request.isGet());
+    assertFalse(request.isPost());
+    assertFalse(request.isPut());
+  }
+
+  @Test
+  public void testIsGet() throws Exception {
+    final Link expectedLink = new Link("get", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.GET);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertFalse(request.isDelete());
+    assertTrue(request.isGet());
+    assertFalse(request.isPost());
+    assertFalse(request.isPut());
+  }
+
+  @Test
+  public void testIsPost() throws Exception {
+    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/resources"), HttpMethod.POST);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertFalse(request.isDelete());
+    assertFalse(request.isGet());
+    assertTrue(request.isPost());
+    assertFalse(request.isPut());
+  }
+
+  @Test
+  public void testIsPut() throws Exception {
+    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/resources/{id}"), HttpMethod.PUT);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertFalse(request.isDelete());
+    assertFalse(request.isGet());
+    assertFalse(request.isPost());
+    assertTrue(request.isPut());
+  }
+
+  @Test
+  public void testGetPathVariables() throws Exception {
+    final Link expectedLink = new Link("test", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{author}/{title}"));
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals(Arrays.asList("name", "author", "title"), request.getPathVariables());
+  }
+
+  @Test
+  public void testGetPathVariablesWithUriHavingNoPathVariables() throws Exception {
+    final Link expectedLink = new Link("test", toUri("http://host.domain.com:8080/app/service"));
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+
+    final List<String> actualPathVariables = request.getPathVariables();
+
+    assertNotNull(actualPathVariables);
+    assertTrue(actualPathVariables.isEmpty());
+  }
+
+  @Test
+  public void testGetURI() throws Exception {
+    final URI expectedURI = toUri("http://host.domain.com:8080/app/service");
+    final Link expectedLink = new Link("test", expectedURI);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals(expectedURI, request.getURI());
+  }
+
+  @Test
+  public void testGetURLForGet() throws Exception {
+    final Link expectedLink = new Link("find", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.GET);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    request.addParameterValues("author", "Rowling");
+    request.addParameterValues("category", "science-fiction");
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals("http://host.domain.com:8080/app/libraries/amazon/books?author=Rowling&category=science-fiction",
+      toString(request.getURL(Collections.singletonMap("name", "amazon"))));
+  }
+
+  @Test
+  public void testGetURLForGetEncoded() throws Exception {
+    final Link expectedLink = new Link("readValue4Key", toUri("http://host.domain.com:8080/app/regions/{region}/keys/{key}"), HttpMethod.GET);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    final Map<String, Object> uriVariables = new HashMap<String, Object>(4);
+
+    uriVariables.put("region", "Customers/Accounts/Orders");
+    uriVariables.put("key", "123");
+    uriVariables.put("item", "456");
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals("http://host.domain.com:8080/app/regions/Customers%2FAccounts%2FOrders/keys/123",
+      toString(request.getURL(uriVariables)));
+  }
+
+  @Test
+  public void testGetURLForGetWithQueryParametersNoBody() throws Exception {
+    final Link expectedLink = new Link("find", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{author}"), HttpMethod.GET);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    request.addParameterValues("author", "Rowling");
+    request.addParameterValues("category", "science-fiction");
+    request.addParameterValues("name", "Boston");
+    request.addParameterValues("year", "2007");
+
+    final Map<String, Object> uriVariables = new HashMap<String, Object>(4);
+
+    uriVariables.put("author", "Rowling");
+    uriVariables.put("category", "mystery");
+    uriVariables.put("isbn", "0-123456789");
+    uriVariables.put("name", "Amazon");
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals("http://host.domain.com:8080/app/libraries/Amazon/books/Rowling?category=science-fiction&year=2007",
+      toString(request.getURL(uriVariables)));
+  }
+
+  @Test
+  public void testGetURLForDelete() throws Exception {
+    final Link expectedLink = new Link("delete-all", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.DELETE);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    request.addParameterValues("category", "romance");
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals("http://host.domain.com:8080/app/libraries/congress/books?category=romance",
+      toString(request.getURL(Collections.singletonMap("name", "congress"))));
+  }
+
+  @Test
+  public void testGetURLForPost() throws Exception {
+    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.POST);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    request.addParameterValues("author", "Douglas Adams");
+    request.addParameterValues("title", "The Hitchhiker's Guide to the Galaxy");
+    request.addParameterValues("year", "1979");
+    request.addParameterValues("isbn", "0345453743");
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals("http://host.domain.com:8080/app/libraries/royal/books",
+      toString(request.getURL(Collections.singletonMap("name", "royal"))));
+  }
+
+  @Test
+  public void testGetURLForPut() throws Exception {
+    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{isbn}"), HttpMethod.PUT);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    request.addParameterValues("year", "1983");
+
+    final Map<String, String> uriVariables = new HashMap<String, String>(2);
+
+    uriVariables.put("name", "royal");
+    uriVariables.put("isbn", "0345453743");
+
+    assertEquals(expectedLink, request.getLink());
+    assertEquals("http://host.domain.com:8080/app/libraries/royal/books/0345453743",
+      toString(request.getURL(uriVariables)));
+  }
+
+  @Test
+  public void testCreateRequestEntityForGet() throws Exception {
+    final Link expectedLink = new Link("find", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.GET);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+
+    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.TEXT_PLAIN_VALUE);
+    request.addParameterValues("author", "Rowling");
+    request.addParameterValues("category", "science-fiction");
+
+    final HttpEntity<?> requestEntity = request.createRequestEntity();
+
+    assertNotNull(requestEntity);
+    assertNotNull(requestEntity.getHeaders());
+    assertEquals(MediaType.TEXT_PLAIN, requestEntity.getHeaders().getContentType());
+    assertNull(requestEntity.getBody());
+  }
+
+  @Test
+  public void testCreateRequestEntityForDelete() throws Exception {
+    final Link expectedLink = new Link("delete-all", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.DELETE);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+
+    request.addHeaderValues(HttpHeader.ACCEPT.getName(), MediaType.APPLICATION_JSON_VALUE);
+    request.addParameterValues("category", "romance");
+
+    final HttpEntity<?> requestEntity = request.createRequestEntity();
+
+    assertNotNull(requestEntity);
+    assertNotNull(requestEntity.getHeaders());
+    assertEquals(Collections.singletonList(MediaType.APPLICATION_JSON), requestEntity.getHeaders().getAccept());
+    assertNull(requestEntity.getBody());
+  }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testCreateRequestEntityForPost() throws Exception {
+    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/libraries/{name}/books"), HttpMethod.POST);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+
+    final MultiValueMap<String, Object> expectedRequestParameters = new LinkedMultiValueMap<String, Object>(4);
+
+    expectedRequestParameters.add("author", "Douglas Adams");
+    expectedRequestParameters.add("title", "The Hitchhiker's Guide to the Galaxy");
+    expectedRequestParameters.add("year", "1979");
+    expectedRequestParameters.add("isbn", "0345453743");
+
+    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.APPLICATION_FORM_URLENCODED_VALUE);
+    request.addParameterValues("author", expectedRequestParameters.getFirst("author"));
+    request.addParameterValues("title", expectedRequestParameters.getFirst("title"));
+    request.addParameterValues("year", expectedRequestParameters.getFirst("year"));
+    request.addParameterValues("isbn", expectedRequestParameters.getFirst("isbn"));
+
+    final HttpEntity<MultiValueMap<String, Object>> requestEntity = (HttpEntity<MultiValueMap<String, Object>>)
+      request.createRequestEntity();
+
+    assertNotNull(requestEntity);
+    assertNotNull(requestEntity.getHeaders());
+    assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
+    assertEquals(expectedRequestParameters, requestEntity.getBody());
+  }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testCreateRequestEntityForPut() throws Exception {
+    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{isbn}"), HttpMethod.PUT);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+
+    final MultiValueMap<String, Object> expectedRequestParameters = new LinkedMultiValueMap<String, Object>(4);
+
+    expectedRequestParameters.add("year", "1979");
+
+    request.addHeaderValues(HttpHeader.ACCEPT.getName(), MediaType.TEXT_XML_VALUE);
+    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.APPLICATION_FORM_URLENCODED_VALUE);
+    request.addParameterValues("year", expectedRequestParameters.getFirst("year"));
+
+    final HttpEntity<MultiValueMap<String, Object>> requestEntity = (HttpEntity<MultiValueMap<String, Object>>)
+      request.createRequestEntity();
+
+    assertNotNull(requestEntity);
+    assertNotNull(requestEntity.getHeaders());
+    assertEquals(Collections.singletonList(MediaType.TEXT_XML), requestEntity.getHeaders().getAccept());
+    assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
+    assertEquals(expectedRequestParameters, requestEntity.getBody());
+  }
+
+  @Test
+  public void testCreateRequestEntityOnPost() throws Exception {
+    final Library mockLibrary = mockContext.mock(Library.class, "testCreateRequestEntityOnPost.Library");
+    final Link expectedLink = new Link("post", toUri("http://host.domain.com:8080/app/libraries"), HttpMethod.POST);
+
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertTrue(request.isPost());
+    assertNull(request.getContent());
+
+    request.setContent(mockLibrary);
+
+    assertSame(mockLibrary, request.getContent());
+
+    final HttpEntity<?> requestEntity = request.createRequestEntity();
+
+    assertNotNull(requestEntity);
+    assertTrue(requestEntity.getBody() instanceof Library);
+  }
+
+  @Test
+  public void testCreateRequestEntityOnPut() throws Exception {
+    final Book mockBook = mockContext.mock(Book.class, "testCreateRequestEntityOnPut.Book");
+    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{id}"), HttpMethod.PUT);
+
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertTrue(request.isPut());
+    assertNull(request.getContent());
+
+    request.setContent(mockBook);
+    request.addParameterValues("isbn", "0-123456789");
+    request.addParameterValues("category", "science-fiction", "sci-fi", "fiction");
+
+    assertSame(mockBook, request.getContent());
+    assertEquals("0-123456789", request.getParameterValue("isbn"));
+    assertTrue(request.getParameterValues("category").containsAll(Arrays.asList("science-fiction", "sci-fi", "fiction")));
+
+    final HttpEntity<?> requestEntity = request.createRequestEntity();
+
+    assertNotNull(requestEntity);
+    assertTrue(requestEntity.getBody() instanceof MultiValueMap);
+    assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
+  }
+
+  @Test
+  public void testSetAndGetHeaderValues() throws Exception {
+    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries"), HttpMethod.PUT);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertTrue(request.getHeaders().isEmpty());
+
+    request.addHeaderValues(HttpHeader.CONTENT_TYPE.getName(), MediaType.APPLICATION_JSON_VALUE);
+    request.addHeaderValues(HttpHeader.ACCEPT.getName(), MediaType.APPLICATION_JSON_VALUE,
+      MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_PLAIN_VALUE);
+
+    assertEquals(MediaType.APPLICATION_JSON_VALUE, request.getHeaderValue(HttpHeader.CONTENT_TYPE.getName()));
+    assertEquals(1, request.getHeaderValues(HttpHeader.CONTENT_TYPE.getName()).size());
+    assertEquals(MediaType.APPLICATION_JSON_VALUE, request.getHeaderValue(HttpHeader.ACCEPT.getName()));
+    assertEquals(3, request.getHeaderValues(HttpHeader.ACCEPT.getName()).size());
+    assertTrue(request.getHeaderValues(HttpHeader.ACCEPT.getName()).containsAll(Arrays.asList(
+      MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_PLAIN_VALUE)));
+
+    request.setHeader(HttpHeader.ACCEPT.getName(), MediaType.APPLICATION_OCTET_STREAM_VALUE);
+
+    assertEquals(MediaType.APPLICATION_OCTET_STREAM_VALUE, request.getHeaderValue(HttpHeader.ACCEPT.getName()));
+    assertEquals(1, request.getHeaderValues(HttpHeader.ACCEPT.getName()).size());
+    assertTrue(request.getHeaderValues(HttpHeader.ACCEPT.getName()).containsAll(Arrays.asList(
+      MediaType.APPLICATION_OCTET_STREAM_VALUE)));
+  }
+
+  @Test
+  public void testSetAndGetParameterValues() throws Exception {
+    final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries"), HttpMethod.PUT);
+    final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
+
+    assertEquals(expectedLink, request.getLink());
+    assertTrue(request.getParameters().isEmpty());
+
+    request.addParameterValues("parameterOne", "value");
+    request.addParameterValues("parameterTwo", "test", "testing", "tested");
+
+    assertEquals("value", request.getParameterValue("parameterOne"));
+    assertEquals(1, request.getParameterValues("parameterOne").size());
+    assertEquals("test", request.getParameterValue("parameterTwo"));
+    assertEquals(3, request.getParameterValues("parameterTwo").size());
+    assertTrue(request.getParameterValues("parameterTwo").containsAll(Arrays.asList("test", "testing", "tested")));
+
+    request.setParameter("parameterTwo", "development");
+
+    assertEquals("development", request.getParameterValue("parameterTwo"));
+    assertEquals(1, request.getParameterValues("parameterTwo").size());
+    assertTrue(request.getParameterValues("parameterTwo").containsAll(Arrays.asList("development")));
+  }
+
+  @SuppressWarnings("unused")
+  private static interface Library {
+    public String getName();
+  }
+
+  @SuppressWarnings("unused")
+  private static interface Book {
+    public String getAuthor();
+    public String getIsbn();
+    public String getTitle();
+    public Integer getYear();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7c20e693/geode-web/src/test/java/org/apache/geode/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java
new file mode 100644
index 0000000..9ecf645
--- /dev/null
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/http/converter/SerializableObjectHttpMessageConverterJUnitTest.java
@@ -0,0 +1,165 @@
+/*
+ * 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.management.internal.web.http.converter;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Calendar;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpInputMessage;
+import org.springframework.http.HttpOutputMessage;
+import org.springframework.http.MediaType;
+
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The SerializableObjectHttpMessageConverterJUnitTest class is a test suite of test cases testing the contract
+ * and functionality of the SerializableObjectHttpMessageConverter class.
+ * <p/>
+ * @see com.gemstone.gemfire.management.internal.web.http.converter.SerializableObjectHttpMessageConverter
+ * @see org.jmock.Mockery
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 8.0
+ */
+@Category(UnitTest.class)
+public class SerializableObjectHttpMessageConverterJUnitTest {
+
+  private Mockery mockContext;
+
+  @Before
+  public void setUp() {
+    mockContext = new Mockery();
+    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
+  }
+
+  @After
+  public void tearDown() {
+    mockContext.assertIsSatisfied();
+    mockContext = null;
+  }
+
+  @Test
+  public void testCreateSerializableObjectHttpMessageConverter() {
+    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
+
+    assertNotNull(converter);
+    assertTrue(converter.getSupportedMediaTypes().contains(MediaType.APPLICATION_OCTET_STREAM));
+    assertTrue(converter.getSupportedMediaTypes().contains(MediaType.ALL));
+  }
+
+  @Test
+  public void testSupport() {
+    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
+
+    assertTrue(converter.supports(Boolean.class));
+    assertTrue(converter.supports(Calendar.class));
+    assertTrue(converter.supports(Character.class));
+    assertTrue(converter.supports(Integer.class));
+    assertTrue(converter.supports(Double.class));
+    assertTrue(converter.supports(String.class));
+    assertTrue(converter.supports(Serializable.class));
+    assertFalse(converter.supports(Object.class));
+    assertFalse(converter.supports(null));
+  }
+
+  @Test
+  public void testReadInternal() throws IOException {
+    final String expectedInputMessageBody = "Expected content of the HTTP input message body!";
+
+    final HttpInputMessage mockInputMessage = mockContext.mock(HttpInputMessage.class, "HttpInputMessage");
+
+    mockContext.checking(new Expectations() {{
+      oneOf(mockInputMessage).getBody();
+      will(returnValue(new ByteArrayInputStream(IOUtils.serializeObject(expectedInputMessageBody))));
+    }});
+
+    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
+
+    final Serializable obj = converter.readInternal(String.class, mockInputMessage);
+
+    assertTrue(obj instanceof String);
+    assertEquals(expectedInputMessageBody, obj);
+  }
+
+  @Test
+  public void testSetContentLength() {
+    final byte[] bytes = { (byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE };
+
+    final HttpHeaders headers = new HttpHeaders();
+
+    final HttpOutputMessage mockOutputMessage = mockContext.mock(HttpOutputMessage.class, "HttpOutputMessage");
+
+    mockContext.checking(new Expectations() {{
+      oneOf(mockOutputMessage).getHeaders();
+      will(returnValue(headers));
+    }});
+
+    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
+
+    converter.setContentLength(mockOutputMessage, bytes);
+
+    assertEquals(bytes.length, headers.getContentLength());
+  }
+
+  @Test
+  public void testWriteInternal() throws IOException {
+    final String expectedOutputMessageBody = "Expected media of the HTTP output message body!";
+
+    final byte[] expectedOutputMessageBodyBytes = IOUtils.serializeObject(expectedOutputMessageBody);
+
+    final ByteArrayOutputStream out = new ByteArrayOutputStream(expectedOutputMessageBodyBytes.length);
+
+    final HttpHeaders headers = new HttpHeaders();
+
+    final HttpOutputMessage mockOutputMessage = mockContext.mock(HttpOutputMessage.class, "HttpOutputMessage");
+
+    mockContext.checking(new Expectations() {{
+      oneOf(mockOutputMessage).getHeaders();
+      will(returnValue(headers));
+      oneOf(mockOutputMessage).getBody();
+      will(returnValue(out));
+    }});
+
+    final SerializableObjectHttpMessageConverter converter = new SerializableObjectHttpMessageConverter();
+
+    converter.writeInternal(expectedOutputMessageBody, mockOutputMessage);
+
+    final byte[] actualOutputMessageBodyBytes = out.toByteArray();
+
+    assertEquals(expectedOutputMessageBodyBytes.length, headers.getContentLength());
+    assertEquals(expectedOutputMessageBodyBytes.length, actualOutputMessageBodyBytes.length);
+
+    for (int index = 0; index < actualOutputMessageBodyBytes.length; index++) {
+      assertEquals(expectedOutputMessageBodyBytes[index], actualOutputMessageBodyBytes[index]);
+    }
+  }
+
+}


[35/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java
deleted file mode 100644
index 17c76ed..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-@Category(DistributedTest.class)
-public class PDXNewWanDUnitTest extends WANTestBase{
-
-  private static final long serialVersionUID = 1L;
-  
-  public PDXNewWanDUnitTest() {
-    super();
-  }
-
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 1 member
-   *   2> Site 2 : 1 locator, 1 member
-   *   3> DR is defined on  member 1 on site1
-   *   4> Serial GatewaySender is defined on member 1 on site1
-   *   5> Same DR is defined on site2 member 1
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.    
-   */
-  @Test
-  public void testWANPDX_RR_SerialSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_RR", 1 ));
-  }
-  
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 1 member
-   *   2> Site 2 : 1 locator, 1 member
-   *   3> DR is defined on  member 1 on site1
-   *   4> Serial GatewaySender is defined on member 1 on site1
-   *   5> Same DR is defined on site2 member 1
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.
-   *   8> Bounce site 1 and delete all of it's data
-   *   9> Make sure that site 1 get the the PDX types along with entries
-   *   and can deserialize entries.     
-   */
-  @Test
-  public void testWANPDX_RemoveRemoteData() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_RR", 1 ));
-    
-    
-    //bounce vm2
-    vm2.invoke(() -> WANTestBase.closeCache());
-    
-    vm2.invoke(() -> WANTestBase.deletePDXDir());
-    
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-    
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-      2 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_RR", 2 ));
-  }
-  
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 1 member
-   *   2> Site 2 : 1 locator, 1 member
-   *   3> DR is defined on  member 1 on site1
-   *   4> Serial GatewaySender is defined on member 1 on site1
-   *   5> Same DR is defined on site2 member 1
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.
-   *   8> Bounce site 1 and delete all of it's data
-   *   9> Make some conflicting PDX registries in site 1 before the reconnect
-   *   10> Make sure we flag a warning about the conflicting updates.     
-   */
-  @Test
-  public void testWANPDX_ConflictingData() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_RR", 1 ));
-    
-    //bounce vm3
-    vm3.invoke(() -> WANTestBase.closeCache());
-    
-    IgnoredException ex1 = IgnoredException.addIgnoredException("Trying to add a PDXType with the same id");
-    IgnoredException ex2 = IgnoredException.addIgnoredException("CacheWriterException");
-    IgnoredException ex3 = IgnoredException.addIgnoredException("does match the existing PDX type");
-    IgnoredException ex4 = IgnoredException.addIgnoredException("ServerOperationException");
-    IgnoredException ex5 = IgnoredException.addIgnoredException("Stopping the processor");
-    
-    try {
-    //blow away vm3's PDX data
-    vm3.invoke(() -> WANTestBase.deletePDXDir());
-    
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    //Define a different type from vm3
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable2( getTestMethodName() + "_RR",
-      2 ));
-    
-    //Give the updates some time to make it over the WAN
-    Wait.pause(10000);
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_RR", 1 ));
-    
-    vm3.invoke(() -> WANTestBase.closeCache());
-    } finally {
-      ex1.remove();
-      ex2.remove();
-      ex3.remove();
-      ex4.remove();
-      ex5.remove();
-    }
-  }
-  
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 1 member
-   *   2> Site 2 : 1 locator, 1 member
-   *   3> Site 3 : 1 locator, 1 member
-   *   3> DR is defined on  member 1 on site1
-   *   4> Serial GatewaySender is defined on member 1 on site1
-   *   5> Same DR is defined on site2 member 1
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.    
-   */
-  @Test
-  public void testWANPDX_RR_SerialSender3Sites() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    
-    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(lnPort, vm3);
-    createCacheInVMs(nyPort, vm4);
-    createCacheInVMs(tkPort, vm5);
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    vm5.invoke(() -> WANTestBase.createReceiver());
-
-
-    //Create all of our gateway senders
-    vm3.invoke(() -> WANTestBase.createSender( "ny", 2,
-        false, 100, 10, false, false, null, true ));
-    vm3.invoke(() -> WANTestBase.createSender( "tk", 3,
-      false, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 1,
-      false, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.createSender( "tk", 3,
-    false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 1,
-      false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ny", 2,
-    false, 100, 10, false, false, null, true ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ny,tk", isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln,tk", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln,ny", isOffHeap() ));
-    
-    //Start all of the senders
-    vm3.invoke(() -> WANTestBase.startSender( "ny" ));
-    vm3.invoke(() -> WANTestBase.startSender( "tk" ));
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm4.invoke(() -> WANTestBase.startSender( "tk" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ny" ));
-    
-    //Pause ln to ny. This means the PDX type will not be dispatched
-    //to ny from ln
-    vm3.invoke(() -> WANTestBase.pauseSender( "ny" ));
-    
-    Wait.pause(5000);
-    
-    //Do some puts that define a PDX type in ln
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-      1 ));
-    
-    //Make sure that tk received the update
-    vm5.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_RR", 1 ));
-    
-    //Make ny didn't receive the update because the sender is paused 
-    vm4.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_RR", 0 ));
-    
-    //Now, do a put from tk. This serialized object will be distributed
-    //to ny from tk, using the type defined by ln.
-    vm5.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-      2 ));
-    
-    //Verify the ny can read the object
-    vm4.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_RR", 2 ));
-    
-    //Wait for vm3 to receive the update (prevents a broken pipe suspect string) 
-    vm3.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_RR", 2 ));
-  }
-  
-  @Test
-  public void testWANPDX_RR_SerialSender_StartedLater() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-        10 ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-      40 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_RR", 40 ));
-  }
-  
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 1 member
-   *   2> Site 2 : 1 locator, 1 member
-   *   3> PR is defined on  member 1 on site1
-   *   4> Serial GatewaySender is defined on member 1 on site1
-   *   5> Same PR is defined on site2 member 1
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.    
-   */
-  
-  @Test
-  public void testWANPDX_PR_SerialSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 1 ));
-  }
-  
-  @Test
-  public void testWANPDX_PR_SerialSender_StartedLater() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        20 ));
-    
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-      40 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 40 ));
-  }
-  
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 2 member
-   *   2> Site 2 : 1 locator, 2 member
-   *   3> PR is defined on  member 1, 2 on site1
-   *   4> Serial GatewaySender is defined on member 1 on site1
-   *   5> Same PR is defined on site2 member 1, 2
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.    
-   */
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_SerialSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null,1, 5, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 10 ));
-  }
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_SerialSender_StartedLater() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-    vm4.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-    
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 5, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 1, 5, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-      40 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 40 ));
-  }
-  
-  /**
-   * Test
-   *   1> Site 1 : 1 locator, 1 member
-   *   2> Site 2 : 1 locator, 1 member
-   *   3> PR is defined on  member 1 on site1
-   *   4> Parallel GatewaySender is defined on member 1 on site1
-   *   5> Same PR is defined on site2 member 1
-   *   6> Put is done with value which is PDXSerializable
-   *   7> Validate whether other sites member receive this put operation.    
-   */
-  
-  @Test
-  public void testWANPDX_PR_ParallelSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 0, 1, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 1, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 1));
-  }
-  
-  @Test
-  public void testWANPDX_PR_ParallelSender_47826() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 0, 1, isOffHeap() ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2, true,
-        100, 10, false, false, null, true ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 0, 1, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable(
-        getTestMethodName() + "_PR", 1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 1 ));
-  }
-  
-  @Test
-  public void testWANPDX_PR_ParallelSender_StartedLater() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-      40 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 40 ));
-  }
-  
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_ParallelSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-
-    startSenderInVMs("ln", vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 10 ));
-  }
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_ParallelSender_StartedLater() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-    vm4.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, null, true ));
-   vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, null, true ));
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    startSenderInVMsAsync("ln", vm3, vm4);
-
-    vm4.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-      40 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 40 ));
-  }
-  
-  
-  @Test
-  public void testWANPDX_RR_SerialSenderWithFilter() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, new PDXGatewayEventFilter(), true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_RR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_RR", 1 ));
-    
-    vm3.invoke(() -> PDXNewWanDUnitTest.verifyFilterInvocation( 1));
-  }
-  
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_ParallelSenderWithFilter() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        true, 100, 10, false, false, new PDXGatewayEventFilter(), true ));
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      true, 100, 10, false, false, new PDXGatewayEventFilter(), true ));
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-
-    startSenderInVMs("ln", vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 10 ));
-    
-    vm3.invoke(() -> PDXNewWanDUnitTest.verifyFilterInvocation( 5));
-    vm4.invoke(() -> PDXNewWanDUnitTest.verifyFilterInvocation( 5));
-  }
-  
-  
-  /**
-   * When remote site bounces then we should send pdx event again.
-   */
-  @Ignore
-  @Test
-  public void testWANPDX_PR_SerialSender_RemoteSite_Bounce() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3);
-
-    vm3.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        1 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 1 ));
-    
-    vm2.invoke(() -> WANTestBase.killSender());
-
-    createReceiverInVMs(vm2, vm4);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 2, isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 2, isOffHeap() ));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-      1 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-      getTestMethodName() + "_PR", 1 ));
-  }
-  
-
-  
-  
-  public static void verifyFilterInvocation(int invocation) {
-    assertEquals(((PDXGatewayEventFilter)eventFilter).beforeEnqueueInvoked, invocation);
-    assertEquals(((PDXGatewayEventFilter)eventFilter).beforeTransmitInvoked, invocation);
-    assertEquals(((PDXGatewayEventFilter)eventFilter).afterAckInvoked, invocation);
-  }
-
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java
deleted file mode 100644
index 1981feb..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- * 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.internal.cache.wan.misc;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-
-@Category(DistributedTest.class)
-public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBase {
-  
-  public ReplicatedRegion_ParallelWANPersistenceDUnitTest() {
-    super();
-    // TODO Auto-generated constructor stub
-  }
-
-  final String expectedExceptions = null;
-
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DR_PGSPERSISTENCE_VALIDATEQUEUE_Restart_Validate_Receiver() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
-        .getName());
-    try {
-*/      vm4.invoke(() -> WANTestBase.killSender());
-      vm5.invoke(() -> WANTestBase.killSender());
-      vm6.invoke(() -> WANTestBase.killSender());
-      vm7.invoke(() -> WANTestBase.killSender());
-/*    }
-    finally {
-      exp1.remove();
-    }
-*/    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm4.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_RR", 3000, 10000 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 10000 ));
-    
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DRPERSISTENCE_PGSPERSISTENCE_VALIDATEQUEUE_Restart_Validate_Receiver() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    //create cache in local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
-            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
-            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
-            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln",
-            Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
-        .getName());
-    try {*/
-      vm4.invoke(() -> WANTestBase.killSender());
-      vm5.invoke(() -> WANTestBase.killSender());
-      vm6.invoke(() -> WANTestBase.killSender());
-      vm7.invoke(() -> WANTestBase.killSender());
-/*    }
-    finally {
-      exp1.remove();
-    }*/
-    
-    //restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    
-/*    exp1 = addExpectedException(CacheClosedException.class.getName());
-    try {
-*/      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 3000 ));
-      vm3.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 3000 ));
-
-      vm4.invoke(() -> WANTestBase.doNextPuts(
-          getTestMethodName() + "_RR", 3000, 10000 ));
-
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 10000 ));
-      vm3.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 10000 ));
-/*    }
-    finally {
-      exp1.remove();
-    }
-*/  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DRPERSISTENCE_PRPERSISTENCE_PGSPERSISTENCE_VALIDATEQUEUE_Restart_Validate_Receiver() {
-    //create locator on local site
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    //create locator on remote site
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //create receiver on remote site
-    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap() ));
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    
-    //create cache in local site
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    //create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4);
-    
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //start puts in region on local site
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 3000 ));
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 3000 ));
-    LogWriterUtils.getLogWriter().info("Completed puts in the region");
-    
-    //--------------------close and rebuild local site -------------------------------------------------
-    //kill the senders
-/*    ExpectedException exp1 = addExpectedException(CacheClosedException.class
-        .getName());
-    try {
-*/      vm4.invoke(() -> WANTestBase.killSender());
-      vm5.invoke(() -> WANTestBase.killSender());
-      vm6.invoke(() -> WANTestBase.killSender());
-      vm7.invoke(() -> WANTestBase.killSender());
-/*    }
-    finally {
-      exp1.remove();
-    }
-*/    
-    LogWriterUtils.getLogWriter().info("Killed all the senders.");
-    
-    //restart the vm
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-    
-   //create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-    vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore3, true ));
-    vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10, false, true, null, diskStore4, true ));
-    
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-    
-    //create PR on local site
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv4 = vm7.invokeAsync(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK, DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    inv1 = vm4.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
-            100, isOffHeap() ));
-    inv2 = vm5.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
-            100, isOffHeap() ));
-    inv3 = vm6.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
-            100, isOffHeap() ));
-    inv4 = vm7.invokeAsync(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", "ln", 1,
-            100, isOffHeap() ));
-
-    try {
-      inv1.join();
-      inv2.join();
-      inv3.join();
-      inv4.join();
-    }
-    catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-    
-    //start the senders in async mode. This will ensure that the 
-    //node of shadow PR that went down last will come up first
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    //wait for senders running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now running...");
-    
-    //----------------------------------------------------------------------------------------------------
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 3000 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 3000 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 3000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 3000 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 3000 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 3000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 3000 ));
-    
-    vm4.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_RR", 3000, 10000 ));
-    vm4.invoke(() -> WANTestBase.doNextPuts( getTestMethodName() + "_PR", 3000, 10000 ));
-    
-/*    exp1 = addExpectedException(CacheClosedException.class.getName());
-    try {*/
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 10000 ));
-      vm3.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR", 10000 ));
-
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_PR", 10000 ));
-      vm3.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_PR", 10000 ));
-/*    }
-    finally {
-      exp1.remove();
-    }
-*/    
-  }
-  
-  /**Below test is disabled intentionally
-  1> In this release 8.0, for rolling upgrade support queue name is changed to old style
-  2>Common parallel sender for different non colocated regions is not supported in 8.0 so no need to bother about
-      ParallelGatewaySenderQueue#convertPathToName
-  3> We have to enabled it in next release
-  4> Version based rolling upgrade support should be provided. based on the version of the gemfire QSTRING should be used between 8.0 
-     and version prior to 8.0*/
-  @Ignore
-  @Test
-  public void test_DRPERSISTENCE_PGSPERSISTENCE_4NODES_2NODESDOWN_Validate_Receiver()
-      throws Exception {
-
-    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    // create senders with disk store
-    String diskStore1 = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
-            false, true, null, null, true ));
-    String diskStore2 = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
-            false, true, null, null, true ));
-    String diskStore3 = (String) vm6.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
-            false, true, null, null, true ));
-    String diskStore4 = (String) vm7.invoke(() -> WANTestBase.createSenderWithDiskStore( "ln", 2, true, 100, 10,
-            false, true, null, null, true ));
-
-    LogWriterUtils.getLogWriter().info(
-        "The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + ","
-            + diskStore4);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-        DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    Thread.sleep(60000);
-    {
-      AsyncInvocation inv1 = vm7.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts0(getTestMethodName() + "_RR", 10000 ));
-      Thread.sleep(1000);
-      AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-      Thread.sleep(2000);
-      AsyncInvocation inv3 = vm6.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts1(getTestMethodName() + "_RR", 10000 ));
-      Thread.sleep(1500);
-      AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
-      try {
-        inv1.join();
-        inv2.join();
-        inv3.join();
-        inv4.join();
-      } catch (Exception e) {
-        Assert.fail("UnExpected Exception", e);
-      }
-    }
-
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    LogWriterUtils.getLogWriter().info("Created back the cache");
-
-    // create senders with disk store
-    vm4.invoke(() -> WANTestBase.createSenderWithDiskStore(
-        "ln", 2, true, 100, 10, false, true, null, diskStore1, true ));
-    vm5.invoke(() -> WANTestBase.createSenderWithDiskStore(
-        "ln", 2, true, 100, 10, false, true, null, diskStore2, true ));
-
-    LogWriterUtils.getLogWriter().info("Created the senders back from the disk store.");
-
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-            DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv2 = vm5.invokeAsync(() -> WANTestBase.createReplicatedRegion( getTestMethodName() + "_RR", "ln", Scope.DISTRIBUTED_ACK,
-            DataPolicy.PERSISTENT_REPLICATE, isOffHeap() ));
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> ReplicatedRegion_ParallelWANPropagationDUnitTest.doPuts2(getTestMethodName() + "_RR", 15000 ));
-    try {
-      inv1.join();
-      inv2.join();
-
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail();
-    }
-
-    startSenderInVMsAsync("ln", vm4, vm5);
-
-    LogWriterUtils.getLogWriter().info("Waiting for senders running.");
-    // wait for senders running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 15000 ));
-  }
-}


[40/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
deleted file mode 100755
index 1d4e947..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.EvictionAction;
-import com.gemstone.gemfire.cache.EvictionAttributes;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.client.internal.PoolImpl;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
-import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.ha.HAContainerRegion;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.jayway.awaitility.Awaitility;
-
-@Category(DistributedTest.class)
-public class Simple2CacheServerDUnitTest extends WANTestBase {
-  private static final int NUM_KEYS = 10;
-  static int afterPrimaryCount = 0;
-  static int afterProxyReinitialized = 0;
-  
-  public Simple2CacheServerDUnitTest() {
-    super();
-  }
-  
-  @Test
-  public void testNormalClient2MultipleCacheServer() throws Exception {
-    doMultipleCacheServer(false);
-  }
-  
-  public void doMultipleCacheServer(boolean durable) throws Exception {
-    Integer lnPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    vm1.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm1.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    int serverPort = vm1.invoke(() -> WANTestBase.createCacheServer());
-    int serverPort2 = vm1.invoke(() -> WANTestBase.createCacheServer());
-
-    if (durable) {
-      vm1.invoke(() -> setCacheClientProxyTestHook());
-    } else {
-      vm2.invoke(() -> setClientServerObserver());
-    }
-    vm2.invoke(() -> CacheClientNotifierDUnitTest.createClientWithLocator(lnPort, "localhost", getTestMethodName() + "_PR" , "123", durable));
-
-    vm0.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm0.invoke(() -> WANTestBase.createPersistentPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    int serverPort3 = vm0.invoke(() -> WANTestBase.createCacheServer());
-    
-    if (durable) {
-      vm1.invoke(() -> checkResultAndUnsetCacheClientProxyTestHook());
-    } else {
-      vm2.invoke(() -> checkResultAndUnsetClientServerObserver());
-    }
-    Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
-    
-    // close the current primary cache server, then re-test
-    int serverPortAtVM1 = vm1.invoke(()-> findCacheServerForPrimaryProxy());
-    if (serverPortAtVM1 != 0) {
-      vm1.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPortAtVM1));
-      LogService.getLogger().info("Closed cache server on vm1:"+serverPortAtVM1);
-      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
-    } else {
-      vm0.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPort3));
-      LogService.getLogger().info("Closed cache server on vm0:"+serverPort3);
-      assertTrue(checkProxyIsPrimary(vm1));
-    }
-    disconnectAllFromDS();
-  }
-  
-  private static int findCacheServerForPrimaryProxy() {
-    List<CacheServer> cacheServers = ((GemFireCacheImpl)cache).getCacheServers();
-    CacheServerImpl server = null;
-    for (CacheServer cs:cacheServers) {
-      server = (CacheServerImpl)cs;
-      long acceptorId = server.getAcceptor().getAcceptorId();
-      for (CacheClientProxy proxy:CacheClientNotifier.getInstance().getClientProxies()) {
-        if (proxy.isPrimary() == false) {
-          continue;
-        }
-        if (proxy.getAcceptorId() == acceptorId) {
-          LogService.getLogger().info("Found cache server "+server+" for the primary proxy "+proxy);
-          return server.getPort();
-        }
-      }
-    }
-    return 0;
-  }
-  
-  public static void setClientServerObserver()
-  {
-    PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = true;
-    ClientServerObserverHolder
-    .setInstance(new ClientServerObserverAdapter() {
-      public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint)
-      {
-        LogService.getLogger().info("After primary is set");
-        afterPrimaryCount++;
-      }
-    });
-  }
-
-  public static void checkResultAndUnsetClientServerObserver()
-  {
-    PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = false;
-    // setPrimary only happened once
-    assertEquals(1, afterPrimaryCount);
-    afterPrimaryCount = 0;
-  }
-
-  public static void setCacheClientProxyTestHook()
-  {
-    CacheClientProxy.testHook = new CacheClientProxy.TestHook() {
-      @Override
-      public void doTestHook(String spot) {
-        if (spot.equals("CLIENT_RECONNECTED")) {
-          afterProxyReinitialized++;
-        }
-      }
-    };
-  }
-
-  public static void checkResultAndUnsetCacheClientProxyTestHook()
-  {
-    // Reinitialize only happened once
-    CacheClientProxy.testHook = null;
-    assertEquals(1, afterProxyReinitialized);
-    afterProxyReinitialized = 0;
-  }
-  
-  private boolean checkProxyIsPrimary(VM vm) {
-    SerializableCallable checkProxyIsPrimary = new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        final CacheClientNotifier ccn = CacheClientNotifier.getInstance();
-        Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return (ccn.getClientProxies().size() == 1); }); 
-        
-        Iterator iter_prox = ccn.getClientProxies().iterator();
-        CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
-        return proxy.isPrimary();
-      }
-    };
-    return (Boolean)vm.invoke(checkProxyIsPrimary);
-  }
-}


[49/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/ChunkKey.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/ChunkKey.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/ChunkKey.java
deleted file mode 100644
index 8fbe356..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/ChunkKey.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.UUID;
-
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * The key for a single chunk on a file stored within a region.
- */
-public class ChunkKey implements DataSerializableFixedID {
-  UUID fileId;
-  int chunkId;
-  
-  /**
-   * Constructor used for serialization only.
-   */
-  public ChunkKey() {
-  }
-
-  ChunkKey(UUID fileName, int chunkId) {
-    this.fileId = fileName;
-    this.chunkId = chunkId;
-  }
-
-  /**
-   * @return the fileName
-   */
-  public UUID getFileId() {
-    return fileId;
-  }
-
-  /**
-   * @return the chunkId
-   */
-  public int getChunkId() {
-    return chunkId;
-  }
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + fileId.hashCode();
-    result = prime * result + chunkId;
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj) {
-      return true;
-    }
-    if (obj == null) {
-      return false;
-    }
-    if (!(obj instanceof ChunkKey)) {
-      return false;
-    }
-    ChunkKey other = (ChunkKey) obj;
-    if (chunkId != other.chunkId) {
-      return false;
-    }
-    if (fileId == null) {
-      if (other.fileId != null) {
-        return false;
-      }
-    } else if (!fileId.equals(other.fileId)) {
-      return false;
-    }
-    return true;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_CHUNK_KEY;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    out.writeInt(chunkId);
-    out.writeLong(fileId.getMostSignificantBits());
-    out.writeLong(fileId.getLeastSignificantBits());
-  }
-
-  @Override
-  public void fromData(DataInput in)
-      throws IOException, ClassNotFoundException {
-    chunkId = in.readInt();
-    long high = in.readLong();
-    long low = in.readLong();
-    fileId = new UUID(high, low);
-  }
-
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/File.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/File.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/File.java
deleted file mode 100644
index d27717e..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/File.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.nio.file.Files;
-import java.util.UUID;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * A file that is stored in a gemfire region.
- */
-public class File implements DataSerializableFixedID {
-  
-  private transient FileSystem fileSystem;
-  private transient int chunkSize;
-
-  private String name;
-  long length = 0;
-  int chunks = 0;
-  long created = System.currentTimeMillis();
-  long modified = created;
-  UUID id = UUID.randomUUID();
-  
-  /**
-   * Constructor for serialization only
-   */
-  public File() {
-  }
-
-  File(final FileSystem fileSystem, final String name) {
-    setFileSystem(fileSystem);
-    
-    this.name = name;
-  }
-
-  /**
-   * @return the name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * @return the length
-   */
-  public long getLength() {
-    return length;
-  }
-
-  /**
-   * @return the created
-   */
-  public long getCreated() {
-    return created;
-  }
-
-  /**
-   * @return the modified
-   */
-  public long getModified() {
-    return modified;
-  }
-
-  /**
-   * Get an input stream that reads from the beginning the file
-   * 
-   * The input stream is not threadsafe
-   */
-  public SeekableInputStream getInputStream() {
-    // TODO get read lock?
-    return new FileInputStream(this);
-  }
-
-  /**
-   * Get an output stream that appends to the end
-   * of the file.
-   */
-  public OutputStream getOutputStream() {
-    return new FileOutputStream(this);
-  }
-
-  void setFileSystem(final FileSystem fileSystem) {
-    this.fileSystem = fileSystem;
-    this.chunkSize = FileSystem.CHUNK_SIZE;
-  }
-
-  int getChunkSize() {
-    return chunkSize;
-  }
-
-  public FileSystem getFileSystem() {
-    return fileSystem;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_FILE;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeString(name, out);
-    out.writeLong(length);
-    out.writeInt(chunks);
-    out.writeLong(created);
-    out.writeLong(modified);
-    out.writeLong(id.getMostSignificantBits());
-    out.writeLong(id.getLeastSignificantBits());
-  }
-
-  @Override
-  public void fromData(DataInput in)
-      throws IOException, ClassNotFoundException {
-    name = DataSerializer.readString(in);
-    length = in.readLong();
-    chunks = in.readInt();
-    created = in.readLong();
-    modified = in.readLong();
-    long high = in.readLong();
-    long low = in.readLong();
-    id = new UUID(high, low);
-  }
-
-
-  /**
-   * Export this to a {@link java.io.File}
-   */
-  public void export(final java.io.File exportLocation)
-  {
-    java.io.File targetFile = new java.io.File(exportLocation, getName());
-    try {
-      Files.copy(getInputStream(), targetFile.toPath());
-    }
-    catch (IOException e) {
-      throw new InternalGemFireError("Could not export file " + getName(), e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileInputStream.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileInputStream.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileInputStream.java
deleted file mode 100644
index 18194aa..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileInputStream.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.io.EOFException;
-import java.io.IOException;
-
-/**
- * An input stream that reads chunks from
- * a File saved in the region. This input stream
- * will keep going back to the region to look for
- * chunks until nothing is found.
- */
-final class FileInputStream extends SeekableInputStream {
-
-  private final File file;
-  private byte[] chunk = null;
-  private int chunkPosition = 0;
-  private int chunkId = 0;
-  private boolean open = true;
-
-  public FileInputStream(File file) {
-    this.file = file;
-    nextChunk();
-  }
-
-  public FileInputStream(FileInputStream other) {
-    this.file = other.file;
-    this.chunk = other.chunk;
-    this.chunkId = other.chunkId;
-    this.chunkPosition = other.chunkPosition;
-    this.open = other.open;
-  }
-
-  @Override
-  public int read() throws IOException {
-    assertOpen();
-
-    checkAndFetchNextChunk();
-
-    if (null == chunk) {
-      return -1;
-    }
-
-    return chunk[chunkPosition++] & 0xff;
-  }
-  
-  @Override
-  public void seek(long position) throws IOException {
-    if(position > file.length) {
-      throw new EOFException();
-    }
-    int targetChunk = (int) (position / file.getChunkSize());
-    int targetPosition = (int) (position % file.getChunkSize());
-    
-    if(targetChunk != (this.chunkId - 1)) {
-      chunk = file.getFileSystem().getChunk(this.file, targetChunk);
-      chunkId = targetChunk + 1;
-      chunkPosition = targetPosition;
-    } else {
-      chunkPosition = targetPosition;
-    }
-  }
-  
-  
-
-  @Override
-  public long skip(long n) throws IOException {
-    int currentPosition = (chunkId - 1) * file.getChunkSize() + chunkPosition;
-    seek(currentPosition + n);
-    return n;
-  }
-  
-  @Override
-  public void reset() throws IOException {
-    seek(0);
-  }
-
-  @Override
-  public int read(byte[] b, int off, int len) throws IOException {
-    assertOpen();
-
-    checkAndFetchNextChunk();
-
-    if (null == chunk) {
-      return -1;
-    }
-
-    int read = 0;
-    while (len > 0) {
-      final int min = Math.min(remaining(), len);
-      System.arraycopy(chunk, chunkPosition, b, off, min);
-      off += min;
-      len -= min;
-      chunkPosition += min;
-      read += min;
-
-      if (len > 0) {
-        // we read to the end of the chunk, fetch another.
-        nextChunk();
-        if (null == chunk) {
-          break;
-        }
-      }
-    }
-
-    return read;
-  }
-
-  @Override
-  public int available() throws IOException {
-    assertOpen();
-
-    return remaining();
-  }
-
-  @Override
-  public void close() throws IOException {
-    if (open) {
-      open = false;
-    }
-  }
-
-  private int remaining() {
-    return chunk.length - chunkPosition;
-  }
-
-  private void checkAndFetchNextChunk() {
-    if (null != chunk && remaining() <= 0) {
-      nextChunk();
-    }
-  }
-
-  private void nextChunk() {
-    chunk = file.getFileSystem().getChunk(this.file, chunkId++);
-    chunkPosition = 0;
-  }
-
-  private void assertOpen() throws IOException {
-    if (!open) {
-      throw new IOException("Closed");
-    }
-  }
-  
-  @Override
-  public FileInputStream clone() {
-    return new FileInputStream(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileOutputStream.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileOutputStream.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileOutputStream.java
deleted file mode 100644
index 3f9f614..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileOutputStream.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-final class FileOutputStream extends OutputStream {
-
-  private final File file;
-  private ByteBuffer buffer;
-  private boolean open = true;
-  private long length;
-  private int chunks;
-
-  public FileOutputStream(final File file) {
-    this.file = file;
-    buffer = ByteBuffer.allocate(file.getChunkSize());
-    this.length = file.length;
-    this.chunks = file.chunks;
-    if(chunks > 0 && file.length % file.getChunkSize() != 0) {
-      //If the last chunk was incomplete, we're going to update it
-      //rather than add a new chunk. This guarantees that all chunks
-      //are full except for the last chunk.
-      chunks--;
-      byte[] previousChunkData = file.getFileSystem().getChunk(file, chunks);
-      buffer.put(previousChunkData);
-    }
-  }
-
-  @Override
-  public void write(final int b) throws IOException {
-    assertOpen();
-    
-    if (buffer.remaining() == 0) {
-      flushBuffer();
-    }
-
-    buffer.put((byte) b);
-    length++;
-  }
-  
-  @Override
-  public void write(final byte[] b, int off, int len) throws IOException {
-    assertOpen();
-    
-    while (len > 0) {
-      if (buffer.remaining() == 0) {
-        flushBuffer();
-      }
-
-      final int min = Math.min(buffer.remaining(), len);
-      buffer.put(b, off, min);
-      off += min;
-      len -= min;
-      length += min;
-    }
-  }
-
-  @Override
-  public void close() throws IOException {
-    if (open) {
-      flushBuffer();
-      file.modified = System.currentTimeMillis();
-      file.length = length;
-      file.chunks = chunks;
-      file.getFileSystem().updateFile(file);
-      open = false;
-      buffer = null;
-    }
-  }
-
-  private void flushBuffer() {
-    byte[] chunk = Arrays.copyOfRange(buffer.array(), buffer.arrayOffset(), buffer.position());
-    file.getFileSystem().putChunk(file, chunks++, chunk);
-    buffer.rewind();
-  }
-
-  private void assertOpen() throws IOException {
-    if (!open) {
-      throw new IOException("Closed");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystem.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystem.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystem.java
deleted file mode 100644
index 5f4fb77..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystem.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * A Filesystem like interface that stores file data in geode regions.
- * 
- * This filesystem is safe for use with multiple threads if the threads are not
- * modifying the same files. A single file is not safe to modify by multiple
- * threads, even between different members of the distributed system.
- * 
- * Changes to a file may not be visible to other members of the system until the
- * FileOutputStream is closed.
- *
- */
-public class FileSystem {
-  // private final Cache cache;
-  private final ConcurrentMap<String, File> fileRegion;
-  private final ConcurrentMap<ChunkKey, byte[]> chunkRegion;
-  
-  static final int CHUNK_SIZE = 1024 * 1024; //1 MB
-  private final FileSystemStats stats;
-
-  /**
-   * Create filesystem that will store data in the two provided regions. The fileRegion contains
-   * metadata about the files, and the chunkRegion contains the actual data. If data from either region is missing
-   * or inconsistent, no guarantees are made about what this class will do, so it's best if these regions are colocated
-   * and in the same disk store to ensure the data remains together.
-   * @param fileRegion the region to store metadata about the files
-   * @param chunkRegion the region to store actual file data.
-   */
-  public FileSystem(ConcurrentMap<String, File> fileRegion, ConcurrentMap<ChunkKey, byte[]> chunkRegion, FileSystemStats stats) {
-    this.fileRegion = fileRegion;
-    this.chunkRegion = chunkRegion;
-    this.stats = stats;
-  }
-
-  public Collection<String> listFileNames() {
-    return fileRegion.keySet();
-  }
-
-  public File createFile(final String name) throws IOException {
-    // TODO lock region ?
-    final File file = new File(this, name);
-    if (null != fileRegion.putIfAbsent(name, file)) {
-      throw new IOException("File exists.");
-    }
-    stats.incFileCreates(1);
-    // TODO unlock region ?
-    return file;
-  }
-
-  public File createTemporaryFile(final String name) throws IOException {
-    final File file = new File(this, name);
-    stats.incTemporaryFileCreates(1);
-    return file;
-  }
-  
-  public File getFile(final String name) throws FileNotFoundException {
-    final File file = fileRegion.get(name);
-    
-    if (null == file) {
-      throw new FileNotFoundException(name);
-    }
-    
-    file.setFileSystem(this);
-    return file;
-  }
-
-  public void deleteFile(final String name) throws FileNotFoundException {
-    // TODO locks?
-
-    // TODO - What is the state of the system if 
-    // things crash in the middle of removing this file?
-    // Seems like a file will be left with some 
-    // dangling chunks at the end of the file
-    File file = fileRegion.remove(name);
-    if(file == null) {
-      throw new FileNotFoundException(name);
-    }
-
-    // TODO consider removeAll with all ChunkKeys listed.
-    final ChunkKey key = new ChunkKey(file.id, 0);
-    while (true) {
-      // TODO consider mutable ChunkKey
-      if (null == chunkRegion.remove(key)) {
-        // no more chunks
-        break;
-      }
-      key.chunkId++;
-    }
-
-    stats.incFileDeletes(1);
-  }
-  
-  public void renameFile(String source, String dest) throws IOException {
-    final File sourceFile = fileRegion.get(source);
-    if (null == sourceFile) {
-      throw new FileNotFoundException(source);
-    }
-    
-    final File destFile = createFile(dest);
-    
-    destFile.chunks = sourceFile.chunks;
-    destFile.created = sourceFile.created;
-    destFile.length = sourceFile.length;
-    destFile.modified = sourceFile.modified;
-    destFile.id = sourceFile.id;
-    updateFile(destFile);
-    
-    // TODO - What is the state of the system if 
-    // things crash in the middle of moving this file?
-    // Seems like we will have two files pointing
-    // at the same data
-
-    fileRegion.remove(source);
-
-    stats.incFileRenames(1);
-  }
-  
-  byte[] getChunk(final File file, final int id) {
-    final ChunkKey key = new ChunkKey(file.id, id);
-    
-    //The file's metadata indicates that this chunk shouldn't
-    //exist. Purge all of the chunks that are larger than the file metadata
-    if(id >= file.chunks) {
-      while(chunkRegion.containsKey(key)) {
-        chunkRegion.remove(key);
-        key.chunkId++;
-      }
-      
-      return null;
-    }
-    
-    final byte[] chunk = chunkRegion.get(key);
-    stats.incReadBytes(chunk.length);
-    return chunk;
-  }
-
-  public void putChunk(final File file, final int id, final byte[] chunk) {
-    final ChunkKey key = new ChunkKey(file.id, id);
-    chunkRegion.put(key, chunk);
-    stats.incWrittenBytes(chunk.length);
-  }
-
-  void updateFile(File file) {
-    fileRegion.put(file.getName(), file);
-  }
-
-  public ConcurrentMap<String, File> getFileRegion() {
-    return fileRegion;
-  }
-
-  public ConcurrentMap<ChunkKey, byte[]> getChunkRegion() {
-    return chunkRegion;
-  }
-
-  /**
-   * Export all of the files in the filesystem to the provided directory
-   */
-  public void export(final java.io.File exportLocation) {
-
-    listFileNames().stream().forEach(fileName-> {
-      try {
-        getFile(fileName).export(exportLocation);
-      }
-      catch (FileNotFoundException e) {
-        //ignore this, it was concurrently removed
-      }
-
-    });
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystemStats.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystemStats.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystemStats.java
deleted file mode 100644
index e6bbf0d..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/FileSystemStats.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.util.function.IntSupplier;
-import java.util.function.LongSupplier;
-
-import com.gemstone.gemfire.StatisticDescriptor;
-import com.gemstone.gemfire.Statistics;
-import com.gemstone.gemfire.StatisticsFactory;
-import com.gemstone.gemfire.StatisticsType;
-import com.gemstone.gemfire.StatisticsTypeFactory;
-import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
-
-public class FileSystemStats {
-  private static final StatisticsType statsType;
-  private static final String statsTypeName = "FileSystemStats";
-  private static final String statsTypeDescription = "Statistics about in memory file system implementation";
-
-  private final Statistics stats;
-
-  private static final int readBytesId;
-  private static final int writtenBytesId;
-  private static final int fileCreatesId;
-  private static final int temporaryFileCreatesId;
-  private static final int fileDeletesId;
-  private static final int fileRenamesId;
-  private static final int filesId;
-  private static final int chunksId;
-  private static final int bytesId;
-
-  static {
-    final StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
-    statsType = f.createType(
-      statsTypeName,
-      statsTypeDescription,
-      new StatisticDescriptor[] {
-        f.createLongCounter("readBytes", "Number of bytes written", "bytes"),
-        f.createLongCounter("writtenBytes", "Number of bytes read", "bytes"),
-        f.createIntCounter("fileCreates", "Number of files created", "files"),
-        f.createIntCounter("temporaryFileCreates", "Number of temporary files created", "files"),
-        f.createIntCounter("fileDeletes", "Number of files deleted", "files"),
-        f.createIntCounter("fileRenames", "Number of files renamed", "files"),
-        f.createIntGauge("files", "Number of files on this member", "files"),
-        f.createIntGauge("chunks", "Number of file chunks on this member", "chunks"),
-        f.createLongGauge("bytes", "Number of bytes on this member", "bytes"),
-      }
-    );
-
-    readBytesId = statsType.nameToId("readBytes");
-    writtenBytesId = statsType.nameToId("writtenBytes");
-    fileCreatesId = statsType.nameToId("fileCreates");
-    temporaryFileCreatesId = statsType.nameToId("temporaryFileCreates");
-    fileDeletesId = statsType.nameToId("fileDeletes");
-    fileRenamesId = statsType.nameToId("fileRenames");
-    filesId = statsType.nameToId("files");
-    chunksId = statsType.nameToId("chunks");
-    bytesId = statsType.nameToId("bytes");
-  }
-
-  public FileSystemStats(StatisticsFactory f, String name) {
-    this.stats = f.createAtomicStatistics(statsType, name);
-  }
-
-  public void incReadBytes(int delta) {
-    stats.incLong(readBytesId, delta);
-  }
-
-  public void incWrittenBytes(int delta) {
-    stats.incLong(writtenBytesId, delta);
-  }
-
-  public void incFileCreates(final int delta) {
-    stats.incInt(fileCreatesId,delta);
-  }
-
-  public void incTemporaryFileCreates(final int delta) {
-    stats.incInt(temporaryFileCreatesId, delta);
-  }
-
-  public void incFileDeletes(final int delta) {
-    stats.incInt(fileDeletesId,delta);
-  }
-
-  public void incFileRenames(final int delta) {
-    stats.incInt(fileRenamesId,delta);
-  }
-
-  public void setFileSupplier(IntSupplier supplier) {
-    stats.setIntSupplier(filesId, supplier);
-  }
-
-  public int getFiles() {
-    return stats.getInt(filesId);
-  }
-
-  public void setChunkSupplier(IntSupplier supplier) {
-    stats.setIntSupplier(chunksId, supplier);
-  }
-
-  public int getChunks() {
-    return stats.getInt(chunksId);
-  }
-
-  public void setBytesSupplier(LongSupplier supplier) {
-    stats.setLongSupplier(bytesId, supplier);
-  }
-
-  public long getBytes() {
-    return stats.getLong(bytesId);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/SeekableInputStream.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/SeekableInputStream.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/SeekableInputStream.java
deleted file mode 100644
index e10e0c4..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/SeekableInputStream.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.lucene.internal.filesystem;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * An input stream that supports seeking to a particular position.
- */
-public abstract class SeekableInputStream extends InputStream {
-  
-  /**
-   * Seek to a position in the stream. The position is relative to the beginning
-   * of the stream (in other words, just before the first byte that was ever
-   * read).
-   * 
-   * @param position
-   * @throws IOException if the seek goes past the end of the stream
-   */
-  public abstract void seek(long position) throws IOException;
-  
-  public abstract SeekableInputStream clone();
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/package-info.java
deleted file mode 100644
index f8b612c..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/filesystem/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-/**
- * A distributed filesystem implementation that uses a geode region as the underlying storage mechanism.
- *
- * Users of this filesystem should interact with the {@link com.gemstone.gemfire.cache.lucene.internal.filesystem.FileSystem} class.
- *
- */
-
-package com.gemstone.gemfire.cache.lucene.internal.filesystem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java
deleted file mode 100644
index ba9f73b..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-import java.beans.ConstructorProperties;
-
-public class LuceneIndexMetrics {
-
-  private final String regionPath;
-
-  private final String indexName;
-
-  private final int queryExecutions;
-
-  private final long queryExecutionTime;
-
-  private final float queryRate;
-
-  private final long queryRateAverageLatency;
-
-  private final int queryExecutionsInProgress;
-
-  private final long queryExecutionTotalHits;
-
-  private final int updates;
-
-  private final long updateTime;
-
-  private final float updateRate;
-
-  private final long updateRateAverageLatency;
-
-  private final int updatesInProgress;
-
-  private final int commits;
-
-  private final long commitTime;
-
-  private final float commitRate;
-
-  private final long commitRateAverageLatency;
-
-  private final int commitsInProgress;
-
-  private final int documents;
-
-  /**
-   * This constructor is to be used by internal JMX framework only. A user should
-   * not try to create an instance of this class.
-   */
-  @ConstructorProperties( { "regionPath", "indexName", "queryExecutions", "queryExecutionTime", "queryRate",
-      "queryRateAverageLatency", "queryExecutionsInProgress", "queryExecutionTotalHits", "updates",
-      "updateTime", "updateRate", "updateRateAverageLatency", "updatesInProgress", "commits",
-      "commitTime", "commitRate", "commitRateAverageLatency", "commitsInProgress", "documents"
-  })
-  public LuceneIndexMetrics(String regionPath, String indexName, int queryExecutions, long queryExecutionTime,
-      float queryRate, long queryRateAverageLatency, int queryExecutionsInProgress, long queryExecutionTotalHits,
-      int updates, long updateTime, float updateRate, long updateRateAverageLatency, int updatesInProgress,
-      int commits, long commitTime, float commitRate, long commitRateAverageLatency, int commitsInProgress,
-      int documents) {
-    this.regionPath = regionPath;
-    this.indexName = indexName;
-    this.queryExecutions = queryExecutions;
-    this.queryExecutionTime = queryExecutionTime;
-    this.queryRate = queryRate;
-    this.queryRateAverageLatency = queryRateAverageLatency;
-    this.queryExecutionsInProgress = queryExecutionsInProgress;
-    this.queryExecutionTotalHits = queryExecutionTotalHits;
-    this.updates = updates;
-    this.updateTime = updateTime;
-    this.updateRate = updateRate;
-    this.updateRateAverageLatency = updateRateAverageLatency;
-    this.updatesInProgress = updatesInProgress;
-    this.commits = commits;
-    this.commitTime = commitTime;
-    this.commitRate = commitRate;
-    this.commitRateAverageLatency = commitRateAverageLatency;
-    this.commitsInProgress = commitsInProgress;
-    this.documents = documents;
-  }
-
-  public String getRegionPath() {
-    return this.regionPath;
-  }
-
-  public String getIndexName() {
-    return this.indexName;
-  }
-
-  public int getQueryExecutions() {
-    return this.queryExecutions;
-  }
-
-  public long getQueryExecutionTime() {
-    return this.queryExecutionTime;
-  }
-
-  public float getQueryRate() {
-    return this.queryRate;
-  }
-
-  public long getQueryRateAverageLatency() {
-    return this.queryRateAverageLatency;
-  }
-
-  public int getQueryExecutionsInProgress() {
-    return this.queryExecutionsInProgress;
-  }
-
-  public long getQueryExecutionTotalHits() {
-    return this.queryExecutionTotalHits;
-  }
-
-  public int getUpdates() {
-    return this.updates;
-  }
-
-  public long getUpdateTime() {
-    return this.updateTime;
-  }
-
-  public float getUpdateRate() {
-    return this.updateRate;
-  }
-
-  public long getUpdateRateAverageLatency() {
-    return this.updateRateAverageLatency;
-  }
-
-  public int getUpdatesInProgress() {
-    return this.updatesInProgress;
-  }
-
-  public int getCommits() {
-    return this.commits;
-  }
-
-  public long getCommitTime() {
-    return this.commitTime;
-  }
-
-  public float getCommitRate() {
-    return this.commitRate;
-  }
-
-  public long getCommitRateAverageLatency() {
-    return this.commitRateAverageLatency;
-  }
-
-  public int getCommitsInProgress() {
-    return this.commitsInProgress;
-  }
-
-  public int getDocuments() {
-    return documents;
-  }
-
-  @Override
-  public String toString() {
-    return new StringBuilder()
-        .append(getClass().getSimpleName())
-        .append("[")
-        .append("regionPath=")
-        .append(this.regionPath)
-        .append("; indexName=")
-        .append(this.indexName)
-        .append("; queryExecutions=")
-        .append(this.queryExecutions)
-        .append("; queryExecutionTime=")
-        .append(this.queryExecutionTime)
-        .append("; queryRate=")
-        .append(this.queryRate)
-        .append("; queryRateAverageLatency=")
-        .append(this.queryRateAverageLatency)
-        .append("; queryExecutionsInProgress=")
-        .append(this.queryExecutionsInProgress)
-        .append("; queryExecutionTotalHits=")
-        .append(this.queryExecutionTotalHits)
-        .append("; updates=")
-        .append(this.updates)
-        .append("; updateTime=")
-        .append(this.updateTime)
-        .append("; updateRate=")
-        .append(this.updateRate)
-        .append("; updateRateAverageLatency=")
-        .append(this.updateRateAverageLatency)
-        .append("; updatesInProgress=")
-        .append(this.updatesInProgress)
-        .append("; commits=")
-        .append(this.commits)
-        .append("; commitTime=")
-        .append(this.commitTime)
-        .append("; commitRate=")
-        .append(this.commitRate)
-        .append("; commitRateAverageLatency=")
-        .append(this.commitRateAverageLatency)
-        .append("; commitsInProgress=")
-        .append(this.commitsInProgress)
-        .append("; documents=")
-        .append(this.documents)
-        .append("]")
-        .toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexStatsMonitor.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexStatsMonitor.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexStatsMonitor.java
deleted file mode 100644
index 30a2659..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexStatsMonitor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
-import com.gemstone.gemfire.management.internal.ManagementStrings;
-import com.gemstone.gemfire.management.internal.beans.stats.MBeanStatsMonitor;
-import com.gemstone.gemfire.management.internal.beans.stats.StatType;
-import com.gemstone.gemfire.management.internal.beans.stats.StatsAverageLatency;
-import com.gemstone.gemfire.management.internal.beans.stats.StatsRate;
-
-public class LuceneIndexStatsMonitor extends MBeanStatsMonitor {
-
-  private StatsRate updateRate;
-
-  private StatsAverageLatency updateRateAverageLatency;
-
-  private StatsRate commitRate;
-
-  private StatsAverageLatency commitRateAverageLatency;
-
-  private StatsRate queryRate;
-
-  private StatsAverageLatency queryRateAverageLatency;
-
-  public static final String LUCENE_SERVICE_MXBEAN_MONITOR_PREFIX = "LuceneServiceMXBeanMonitor_";
-
-  public LuceneIndexStatsMonitor(LuceneIndex index) {
-    super(LUCENE_SERVICE_MXBEAN_MONITOR_PREFIX + index.getRegionPath() + "_" + index.getName());
-    addStatisticsToMonitor(((LuceneIndexImpl) index).getIndexStats().getStats());
-    configureMetrics();
-  }
-
-  private void configureMetrics() {
-    this.queryRate = new StatsRate(StatsKey.QUERIES, StatType.INT_TYPE, this);
-
-    this.updateRate = new StatsRate(StatsKey.UPDATES, StatType.INT_TYPE, this);
-
-    this.commitRate = new StatsRate(StatsKey.COMMITS, StatType.INT_TYPE, this);
-
-    this.queryRateAverageLatency = new StatsAverageLatency(
-        StatsKey.QUERIES, StatType.INT_TYPE, StatsKey.QUERY_TIME, this);
-
-    this.updateRateAverageLatency = new StatsAverageLatency(
-        StatsKey.UPDATES, StatType.INT_TYPE, StatsKey.UPDATE_TIME, this);
-
-    this.commitRateAverageLatency = new StatsAverageLatency(
-        StatsKey.COMMITS, StatType.INT_TYPE, StatsKey.COMMIT_TIME, this);
-  }
-
-  protected LuceneIndexMetrics getIndexMetrics(LuceneIndex index) {
-    int queryExecutions = getStatistic(StatsKey.QUERIES).intValue();
-    long queryExecutionTime = getStatistic(StatsKey.QUERY_TIME).longValue();
-    float queryRateValue = this.queryRate.getRate();
-    long queryRateAverageLatencyValue = this.queryRateAverageLatency.getAverageLatency();
-    int queryExecutionsInProgress = getStatistic(StatsKey.QUERIES_IN_PROGRESS).intValue();
-    long queryExecutionTotalHits = getStatistic(StatsKey.QUERIES_TOTAL_HITS).longValue();
-
-    int updates = getStatistic(StatsKey.UPDATES).intValue();
-    long updateTime = getStatistic(StatsKey.UPDATE_TIME).longValue();
-    float updateRateValue = this.updateRate.getRate();
-    long updateRateAverageLatencyValue = this.updateRateAverageLatency.getAverageLatency();
-    int updatesInProgress = getStatistic(StatsKey.UPDATES_IN_PROGRESS).intValue();
-
-    int commits = getStatistic(StatsKey.COMMITS).intValue();
-    long commitTime = getStatistic(StatsKey.COMMIT_TIME).longValue();
-    float commitRateValue = this.commitRate.getRate();
-    long commitRateAverageLatencyValue = this.commitRateAverageLatency.getAverageLatency();
-    int commitsInProgress = getStatistic(StatsKey.COMMITS_IN_PROGRESS).intValue();
-
-    int documents = getStatistic(StatsKey.DOCUMENTS).intValue();
-
-    return new LuceneIndexMetrics(index.getRegionPath(), index.getName(), queryExecutions, queryExecutionTime,
-        queryRateValue, queryRateAverageLatencyValue, queryExecutionsInProgress, queryExecutionTotalHits,
-        updates, updateTime, updateRateValue, updateRateAverageLatencyValue, updatesInProgress, commits,
-        commitTime, commitRateValue, commitRateAverageLatencyValue, commitsInProgress, documents);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java
deleted file mode 100644
index edbfadc..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class LuceneServiceBridge {
-
-  private LuceneService service;
-
-  private Map<String,LuceneIndexStatsMonitor> monitors;
-
-  public LuceneServiceBridge(LuceneService service) {
-    this.service = service;
-    this.monitors = new ConcurrentHashMap<>();
-  }
-
-  public void addIndex(LuceneIndex index) {
-    // Create monitor on the index
-    LuceneIndexStatsMonitor monitor = new LuceneIndexStatsMonitor(index);
-
-    // Register the monitor
-    this.monitors.put(getMonitorKey(index), monitor);
-  }
-
-  public LuceneIndexMetrics[] listIndexMetrics() {
-    Collection<LuceneIndex> indexes = this.service.getAllIndexes();
-    LuceneIndexMetrics[] indexMetrics = new LuceneIndexMetrics[indexes.size()];
-    int i=0;
-    for (LuceneIndex index : this.service.getAllIndexes()) {
-      indexMetrics[i++] = getIndexMetrics((LuceneIndexImpl)index);
-    }
-    return indexMetrics;
-  }
-
-  public LuceneIndexMetrics[] listIndexMetrics(String regionPath) {
-    if(!regionPath.startsWith(Region.SEPARATOR)) {
-      regionPath = Region.SEPARATOR + regionPath;
-    }
-    List<LuceneIndexMetrics> indexMetrics = new ArrayList();
-    for (LuceneIndex index : this.service.getAllIndexes()) {
-      if (index.getRegionPath().equals(regionPath)) {
-        indexMetrics.add(getIndexMetrics((LuceneIndexImpl) index));
-      }
-    }
-    return indexMetrics.toArray(new LuceneIndexMetrics[indexMetrics.size()]);
-  }
-
-  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName) {
-    LuceneIndexImpl index = (LuceneIndexImpl) this.service.getIndex(indexName, regionPath);
-    return index == null ? null : getIndexMetrics(index);
-  }
-
-  private String getMonitorKey(LuceneIndex index) {
-    return index.getRegionPath() + "_" + index.getName();
-  }
-
-  private LuceneIndexMetrics getIndexMetrics(LuceneIndexImpl index) {
-    LuceneIndexStatsMonitor monitor = this.monitors.get(getMonitorKey(index));
-    return monitor.getIndexMetrics(index);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java
deleted file mode 100644
index 4320a9a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
-
-import javax.management.NotificationBroadcasterSupport;
-
-public class LuceneServiceMBean extends NotificationBroadcasterSupport
-    implements LuceneServiceMXBean, CacheServiceMBeanBase {
-
-  private LuceneServiceBridge bridge;
-
-  public LuceneServiceMBean(LuceneService service) {
-    this.bridge = new LuceneServiceBridge(service);
-  }
-
-  @Override
-  public LuceneIndexMetrics[] listIndexMetrics() {
-    return this.bridge.listIndexMetrics();
-  }
-
-  @Override
-  public LuceneIndexMetrics[] listIndexMetrics(String regionPath) {
-    return this.bridge.listIndexMetrics(regionPath);
-  }
-
-  @Override
-  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName) {
-    return this.bridge.listIndexMetrics(regionPath, indexName);
-  }
-
-  @Override
-  public String getId() {
-    return "LuceneService";
-  }
-
-  @Override
-  public Class getInterfaceClass() {
-    return LuceneServiceMXBean.class;
-  }
-
-  public void addIndex(LuceneIndex index) {
-    this.bridge.addIndex(index);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java
deleted file mode 100644
index e19bc83..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-import com.gemstone.gemfire.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission.Operation;
-import org.apache.geode.security.ResourcePermission.Resource;
-
-/**
- * MBean that provides access to the {@link com.gemstone.gemfire.cache.lucene.LuceneService}.
- */
-@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
-public interface LuceneServiceMXBean {
-
-  /**
-   * Returns an array of {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
-   * instances defined in this member
-   *
-   * @return an array of LuceneIndexMetrics for the LuceneIndexes defined in this member
-   */
-  public LuceneIndexMetrics[] listIndexMetrics();
-
-  /**
-   * Returns an array of {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
-   * instances defined on the input region in this member
-   *
-   * @param regionPath The full path of the region to retrieve
-   *
-   * @return an array of LuceneIndexMetrics for the LuceneIndex instances defined on the input region
-   * in this member
-   */
-  public LuceneIndexMetrics[] listIndexMetrics(String regionPath);
-
-  /**
-   * Returns a {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
-   * with the input index name defined on the input region in this member.
-   *
-   * @param regionPath The full path of the region to retrieve
-   * @param indexName The name of the index to retrieve
-   *
-   * @return a LuceneIndexMetrics for the LuceneIndex with the input index name defined on the input region
-   * in this member.
-   */
-  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName);
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/ManagementIndexListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/ManagementIndexListener.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/ManagementIndexListener.java
deleted file mode 100644
index f88058a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/ManagementIndexListener.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.internal.IndexListenerAdapter;
-
-public class ManagementIndexListener extends IndexListenerAdapter {
-
-  private LuceneServiceMBean mbean;
-
-  public ManagementIndexListener(LuceneServiceMBean mbean) {
-    this.mbean = mbean;
-  }
-
-  @Override
-  public void afterIndexCreated(LuceneIndex index) {
-    mbean.addIndex(index);
-  }
-
-  @Override
-  public void beforeIndexDestroyed(LuceneIndex index) {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/StatsKey.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/StatsKey.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/StatsKey.java
deleted file mode 100644
index 3438937..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/StatsKey.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.lucene.internal.management;
-
-public class StatsKey {
-
-  public static final String UPDATES = "updates";
-  public static final String UPDATE_TIME = "updateTime";
-  public static final String UPDATES_IN_PROGRESS = "updatesInProgress";
-
-  public static final String COMMITS = "commits";
-  public static final String COMMIT_TIME = "commitTime";
-  public static final String COMMITS_IN_PROGRESS = "commitsInProgress";
-
-  public static final String QUERIES = "queryExecutions";
-  public static final String QUERY_TIME = "queryExecutionTime";
-  public static final String QUERIES_IN_PROGRESS = "queryExecutionsInProgress";
-  public static final String QUERIES_TOTAL_HITS = "queryExecutionTotalHits";
-
-  public static final String DOCUMENTS = "documents";
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/package-info.java
deleted file mode 100644
index 22670f3..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * Internal lucene classes, not intended to be used directly.
- */
-
-package com.gemstone.gemfire.cache.lucene.internal;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
deleted file mode 100644
index e487884..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.lucene.internal.repository;
-
-import java.io.IOException;
-
-import com.gemstone.gemfire.cache.Region;
-
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.search.Query;
-
-/**
- * An Repository interface for the writing data to lucene.
- */
-public interface IndexRepository {
-
-  /**
-   * Create a new entry in the lucene index
-   * @throws IOException 
-   */
-  void create(Object key, Object value) throws IOException;
-
-  /**
-   * Update the entries in the lucene index
-   * @throws IOException 
-   */
-  void update(Object key, Object value) throws IOException;
-  
-  /**
-   * Delete the entries in the lucene index
-   * @throws IOException 
-   */
-  void delete(Object key) throws IOException;
-  
-  /**
-   * Query the index index repository, passing the results to the collector
-   * Only the documents with the top scores, up to the limit, will be passed
-   * to the collector, in order of score.
-   * 
-   * @param query
-   * @param limit the maximum number of hits to return
-   * @param collector the class to aggregate the hits
-   * 
-   * @throws IOException
-   */
-  public void query(Query query, int limit, IndexResultCollector collector) throws IOException;
-
-  /**
-   * Commit the changes to all lucene index
-   * @throws IOException 
-   */
-  void commit() throws IOException;
-
-  Region<?, ?> getRegion();
-
-  /**
-   * Check to see if this repository is closed due to
-   * underlying resources being closed or destroyed
-   * @return true if this repository is closed.
-   */
-  public boolean isClosed();
-
-  /**
-   * For debugging purposes, return the underlying IndexWriter
-   */
-  IndexWriter getWriter();
-
-  /**
-   * Clean up any resources associated with this index repository.
-   */
-  void cleanup();
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
deleted file mode 100644
index 8c7754a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.lucene.internal.repository;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.SerializerUtil;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.logging.LogService;
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.*;
-import org.apache.lucene.store.AlreadyClosedException;
-
-import java.io.IOException;
-import java.util.function.IntSupplier;
-
-/**
- * A repository that writes to a single lucene index writer
- */
-public class IndexRepositoryImpl implements IndexRepository {
-  
-  private static final boolean APPLY_ALL_DELETES = System
-      .getProperty(DistributionConfig.GEMFIRE_PREFIX + "IndexRepository.APPLY_ALL_DELETES", "true")
-      .equalsIgnoreCase("true");
-  
-  private final IndexWriter writer;
-  private final LuceneSerializer serializer;
-  private final SearcherManager searcherManager;
-  private Region<?,?> region;
-  private Region<?,?> userRegion;
-  private LuceneIndexStats stats;
-  private DocumentCountSupplier documentCountSupplier;
-
-  private static final Logger logger = LogService.getLogger();
-  
-  public IndexRepositoryImpl(Region<?,?> region, IndexWriter writer, LuceneSerializer serializer, LuceneIndexStats stats, Region<?, ?> userRegion) throws IOException {
-    this.region = region;
-    this.userRegion = userRegion;
-    this.writer = writer;
-    searcherManager = new SearcherManager(writer, APPLY_ALL_DELETES, true, null);
-    this.serializer = serializer;
-    this.stats = stats;
-    documentCountSupplier = new DocumentCountSupplier();
-    stats.addDocumentsSupplier(documentCountSupplier);
-  }
-
-  @Override
-  public void create(Object key, Object value) throws IOException {
-    long start = stats.startUpdate();
-    try {
-      Document doc = new Document();
-      SerializerUtil.addKey(key, doc);
-      serializer.toDocument(value, doc);
-      writer.addDocument(doc);
-    } finally {
-      stats.endUpdate(start);
-    }
-  }
-
-  @Override
-  public void update(Object key, Object value) throws IOException {
-    long start = stats.startUpdate();
-    try {
-      Document doc = new Document();
-      SerializerUtil.addKey(key, doc);
-      serializer.toDocument(value, doc);
-      writer.updateDocument(SerializerUtil.getKeyTerm(doc), doc);
-    } finally {
-      stats.endUpdate(start);
-    }
-  }
-
-  @Override
-  public void delete(Object key) throws IOException {
-    long start = stats.startUpdate();
-    try {
-      Term keyTerm = SerializerUtil.toKeyTerm(key);
-      writer.deleteDocuments(keyTerm);
-    } finally {
-      stats.endUpdate(start);
-    }
-  }
-
-  @Override
-  public void query(Query query, int limit, IndexResultCollector collector) throws IOException {
-    long start = stats.startQuery();
-    int totalHits = 0;
-    IndexSearcher searcher = searcherManager.acquire();
-    try {
-      TopDocs docs = searcher.search(query, limit);
-      totalHits = docs.totalHits;
-      for(ScoreDoc scoreDoc : docs.scoreDocs) {
-        Document doc = searcher.doc(scoreDoc.doc);
-        Object key = SerializerUtil.getKey(doc);
-        if (logger.isDebugEnabled()) {
-          logger.debug("query found doc:"+doc+":"+scoreDoc);
-        }
-        collector.collect(key, scoreDoc.score);
-      }
-    } finally {
-      searcherManager.release(searcher);
-      stats.endQuery(start, totalHits);
-    }
-  }
-
-  @Override
-  public synchronized void commit() throws IOException {
-    long start = stats.startCommit();
-    try {
-      writer.commit();
-      searcherManager.maybeRefresh();
-    } finally {
-      stats.endCommit(start);
-    }
-  }
-
-  public IndexWriter getWriter() {
-    return writer;
-  }
-
-  @Override
-  public Region<?, ?> getRegion() {
-    return region;
-  }
-
-  public LuceneSerializer getSerializer() {
-    return serializer;
-  }
-
-  @Override
-  public boolean isClosed() {
-    return userRegion.isDestroyed();
-  }
-
-  @Override
-  public void cleanup() {
-    stats.removeDocumentsSupplier(documentCountSupplier);
-    try {
-      writer.close();
-    }
-    catch (IOException e) {
-      logger.warn("Unable to clean up index repository", e);
-    }
-  }
-
-  private class DocumentCountSupplier implements IntSupplier {
-    @Override
-    public int getAsInt() {
-      if(isClosed()) {
-        stats.removeDocumentsSupplier(this);
-        return 0;
-      }
-      try {
-        return writer.numDocs();
-      } catch(AlreadyClosedException e) {
-        //ignore
-        return 0;
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexResultCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexResultCollector.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexResultCollector.java
deleted file mode 100644
index 7fd9e2a..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexResultCollector.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.lucene.internal.repository;
-
-import com.gemstone.gemfire.annotations.Experimental;
-
-/**
- * Interface for collection results of a query on
- * an IndexRepository. See {@link IndexRepository#query(org.apache.lucene.search.Query, int, IndexResultCollector)}
- */
-@Experimental
-public interface IndexResultCollector {
-  /**
-   * @return Name/identifier of this collector
-   */
-  public String getName();
-
-  /**
-   * @return Number of results collected by this collector
-   */
-  public int size();
-
-  /**
-   * Collect a single document
-   * 
-   * @param key the gemfire key of the object
-   * @param score the lucene score of this object
-   */
-  void collect(Object key, float score);
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/RepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/RepositoryManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/RepositoryManager.java
deleted file mode 100644
index 8f8d202..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/RepositoryManager.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.lucene.internal.repository;
-
-import java.util.Collection;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-
-/**
- * {@link RepositoryManager} instances will be used to get {@link IndexRepository} instances hosting index data for
- * {@link Region}s
- */
-public interface RepositoryManager {
-
-  IndexRepository getRepository(Region region, Object key, Object callbackArg) throws BucketNotFoundException;
-
-  /**
-   * Returns a collection of {@link IndexRepository} instances hosting index data of the input list of bucket ids. The
-   * bucket needs to be present on this member.
-   * 
-   * @return a collection of {@link IndexRepository} instances
-   * @throws BucketNotFoundException if any of the requested buckets is not found on this member
-   */
-  Collection<IndexRepository> getRepositories(RegionFunctionContext context) throws BucketNotFoundException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/package-info.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/package-info.java
deleted file mode 100644
index 894b464..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-/**
- * The repository package contains classes for managing a Lucene index in geode.
- *
- * All lucene index access should be through the {@link com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository}
- * class.
- */
-package com.gemstone.gemfire.cache.lucene.internal.repository;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
deleted file mode 100644
index 271f0fd..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.lucene.internal.repository.serializer;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.document.Document;
-
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.util.concurrent.CopyOnWriteWeakHashMap;
-import com.gemstone.gemfire.pdx.PdxInstance;
-
-/**
- * An implementation of LuceneSerializer that reads the fields
- * of a given object using reflection or from a PDX instance and
- * writes them to a lucene document.
- */
-public class HeterogeneousLuceneSerializer implements LuceneSerializer {
-  /**
-   * The set of indexed fields for this mapper
-   */
-  private String[] indexedFields;
-  
-  /**
-   * A mapper for converting a PDX object into a document
-   */
-  private LuceneSerializer pdxMapper;
-
-  /**
-   * Mappers for each individual class type that this class has seen.
-   * 
-   * Weak so that entry will be removed if a class is garbage collected.
-   */
-  private Map<Class<?>, LuceneSerializer> mappers = new CopyOnWriteWeakHashMap<Class<?>, LuceneSerializer>();
-  
-  private static final Logger logger = LogService.getLogger();
-  
-  public HeterogeneousLuceneSerializer(String[] indexedFields) {
-    this.indexedFields = indexedFields;
-    pdxMapper = new PdxLuceneSerializer(indexedFields);
-
-
-    addSerializersForPrimitiveValues();
-  }
-
-  /**
-   * Add serializers for the primitive value types (String, Number, etc.)
-   * if the user has requested that the whole value be serialized
-   */
-  private void addSerializersForPrimitiveValues() {
-    if(Arrays.asList(indexedFields).contains(LuceneService.REGION_VALUE_FIELD)) {
-      final PrimitiveSerializer primitiveSerializer = new PrimitiveSerializer();
-      SerializerUtil.supportedPrimitiveTypes().stream()
-        .forEach(type -> mappers.put(type, primitiveSerializer));
-    }
-  }
-
-  @Override
-  public void toDocument(Object value, Document doc) {
-    
-    LuceneSerializer mapper = getFieldMapper(value);
-    
-    mapper.toDocument(value, doc);
-    if (logger.isDebugEnabled()) {
-      logger.debug("HeterogeneousLuceneSerializer.toDocument:"+doc);
-    }
-  }
-
-  /**
-   * Get the field mapper based on the type of the given object.
-   */
-  private LuceneSerializer getFieldMapper(Object value) {
-    if(value instanceof PdxInstance) {
-      return pdxMapper;
-    } else {
-      Class<?> clazz = value.getClass();
-      LuceneSerializer mapper = mappers.get(clazz);
-      if(mapper == null) {
-        mapper = new ReflectionLuceneSerializer(clazz, indexedFields);
-        mappers.put(clazz, mapper);
-      }
-      return mapper;
-    }
-  }
-  
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/LuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/LuceneSerializer.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/LuceneSerializer.java
deleted file mode 100644
index 421dc0b..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/LuceneSerializer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.lucene.internal.repository.serializer;
-
-import org.apache.lucene.document.Document;
-
-/**
- * An interface for writing the fields of an
- * object into a lucene document
- */
-public interface LuceneSerializer {
-
-  /**
-   * Add the fields of the given value to the document
-   */
-  void toDocument(Object value, Document doc);
-  
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
deleted file mode 100644
index 13465d7..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.lucene.internal.repository.serializer;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.document.Document;
-
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.pdx.PdxInstance;
-
-/**
- * LuceneSerializer which can handle any PdxInstance
- */
-class PdxLuceneSerializer implements LuceneSerializer {
-
-  private String[] indexedFields;
-
-  private static final Logger logger = LogService.getLogger();
-
-  public PdxLuceneSerializer(String[] indexedFields) {
-    this.indexedFields = indexedFields;
-  }
-
-  @Override
-  public void toDocument(Object value, Document doc) {
-    PdxInstance pdx = (PdxInstance) value;
-    for(String field : indexedFields) {
-      if(pdx.hasField(field)) {
-        Object fieldValue = pdx.getField(field);
-        if (fieldValue == null) {
-          continue;
-        }
-        SerializerUtil.addField(doc, field, fieldValue);
-      }
-    }
-    if (logger.isDebugEnabled()) {
-      logger.debug("PdxLuceneSerializer.toDocument:"+doc);
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
deleted file mode 100644
index d096637..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.lucene.internal.repository.serializer;
-
-import com.gemstone.gemfire.cache.lucene.LuceneService;
-
-import org.apache.lucene.document.Document;
-
-/**
- * A LuceneSerializer that can serialize a primitive value (String, int, long, double)
- * by creating a document with a special field containing the value
- */
-public class PrimitiveSerializer implements LuceneSerializer {
-
-  @Override
-  public void toDocument(final Object value, final Document doc) {
-    SerializerUtil.addField(doc, LuceneService.REGION_VALUE_FIELD, value);
-  }
-}



[38/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
deleted file mode 100644
index 19edd7d..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import com.jayway.awaitility.Awaitility;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.cache.EntryExistsException;
-import com.gemstone.gemfire.cache.client.ServerOperationException;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.cache.wan.GatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
-import com.gemstone.gemfire.internal.cache.wan.BatchException70;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-import java.net.SocketException;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Test the functionality of ParallelGatewaySender with multiple dispatchers.
- *
- */
-@Category(DistributedTest.class)
-public class ConcurrentParallelGatewaySenderDUnitTest extends WANTestBase {
-  
-  public ConcurrentParallelGatewaySenderDUnitTest() {
-    super();
-  }
-  
-  /**
-   * Normal happy scenario test case.
-   * checks that all the dispatchers have successfully 
-   * dispatched something individually.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationConcurrentArtifacts() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    try {
-      // set the test hook to find out dispatched events by each of the
-      // concurrent dispatcher
-      vm4.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
-      vm5.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
-      vm6.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
-      vm7.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.TRUE ));
-
-      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-          1000 ));
-
-      // verify all buckets drained on all sender nodes.
-      vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-      vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-      vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-      vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained( "ln" ));
-
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_PR", 1000 ));
-
-      int dispatched1 = (Integer)vm4.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
-      int dispatched2 = (Integer)vm5.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
-      int dispatched3 = (Integer)vm6.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
-      int dispatched4 = (Integer)vm7.invoke(() -> WANTestBase.verifyAndGetEventsDispatchedByConcurrentDispatchers( "ln" ));
-
-      assertEquals(1000, dispatched1 + dispatched2 + dispatched3 + dispatched4);
-    }
-    finally {
-      vm4.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
-      vm5.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
-      vm6.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
-      vm7.invoke(() -> ConcurrentParallelGatewaySenderDUnitTest.setTestHook("ln", Boolean.FALSE ));
-    }
-  }
-  
-  /**
-   * Normal happy scenario test case.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  
-  /**
-   * Normal happy scenario test case when bucket division tests boundary cases.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithUnEqualBucketDivision() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-        1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  
-  /**
-   * Initially the GatewayReceiver is not up but later it comes up.
-   * We verify that 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagation_withoutRemoteSite() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //keep a larger batch to minimize number of exception occurrences in the log
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 300, false, false, null, true, 6, OrderPolicy.PARTITION ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    createReceiverInVMs(vm2, vm3);
-
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    // Just making sure that though the remote site is started later,
-    // remote site is still able to get the data. Since the receivers are
-    // started before creating partition region it is quite possible that the
-    // region may loose some of the events. This needs to be handled by the code
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 1000 ));
-  }
-  
-  /**
-   * Testing for colocated region with orderPolicy Partition
-   */
-  @Test
-  public void testParallelPropagationColocatedPartitionedRegions() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.PARTITION ));
-
-
-    vm4.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
-
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createCustomerOrderShipmentPartitionedRegion("ln", 1, 100, isOffHeap() ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.putcolocatedPartitionedRegion( 1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      customerRegionName, 1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      orderRegionName, 1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      shipmentRegionName, 1000 ));
-  }
-  
-  /**
-   * Local and remote sites are up and running.
-   * Local site cache is closed and the site is built again.
-   * Puts are done to local site.
-   * Expected: Remote site should receive all the events put after the local
-   * site was built back.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationWithLocalCacheClosedAndRebuilt() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    //before doing any puts, let the senders be running in order to ensure that
-    //not a single event will be lost
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR",
-      1000 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-              getTestMethodName() + "_PR", 1000 ));
-    //-------------------Close and rebuild local site ---------------------------------
-
-    vm4.invoke(() -> WANTestBase.killSender());
-    vm5.invoke(() -> WANTestBase.killSender());
-    vm6.invoke(() -> WANTestBase.killSender());
-    vm7.invoke(() -> WANTestBase.killSender());
-    
-    Integer regionSize = 
-      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_PR" ));
-    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
-    
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
-    
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.PARTITION ));
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    //------------------------------------------------------------------------------------
-    
-    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_PR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-  }
-  
-  /**
-   * Colocated regions using ConcurrentParallelGatewaySender.
-   * Normal scenario 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelColocatedPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-  }
-  
-  
-  /**
-   * Colocated regions using ConcurrentParallelGatewaySender.
-   * Normal scenario 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelColocatedPropagationOrderPolicyPartition() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.PARTITION ));
-
-    vm4.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createColocatedPartitionedRegions( getTestMethodName(), null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName(), 1000 ));
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName(), 1000 ));
-  }
-  
-  @Test
-  public void testPartitionedParallelPropagationHA() throws Exception {
-    IgnoredException.addIgnoredException(SocketException.class.getName()); // for Connection reset
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    AsyncInvocation inv1 = vm7.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
-    vm2.invoke(() -> Awaitility.await().atMost(30000, TimeUnit.MILLISECONDS).until(() ->
-      assertEquals("Failure in waiting for at least 10 events to be received by the receiver",
-        true, (getRegionSize(getTestMethodName() + "_PR") > 10 ))));
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));
-    vm2.invoke(() -> Awaitility.await().atMost(30000, TimeUnit.MILLISECONDS).until(() ->
-      assertEquals("Failure in waiting for additional 2000 events to be received by the receiver ",
-        true,getRegionSize(getTestMethodName() + "_PR") > 7000 )));
-    AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());
-    inv1.join();
-    inv2.join();
-    inv3.join();
-    inv4.join();
-
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 10000 ));
-    
-    //verify all buckets drained on the sender nodes that up and running.
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-  }
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_ConcurrentParallelSender() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap()));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
-
-    startSenderInVMs("ln", vm3, vm4);
-
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 10 ));
-  }
-  
-  @Test
-  public void testWANPDX_PR_MultipleVM_ConcurrentParallelSender_StartedLater() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver_PDX( nyPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-    vm4.invoke(() -> WANTestBase.createCache_PDX( lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 0, 2, isOffHeap()));
-
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", "ln", 0, 2, isOffHeap()));
-    
-    vm3.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-        10 ));
-
-    startSenderInVMsAsync("ln", vm3, vm4);
-
-    vm4.invoke(() -> WANTestBase.doPutsPDXSerializable( getTestMethodName() + "_PR",
-      40 ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize_PDX(
-        getTestMethodName() + "_PR", 40 ));
-  }
-
-  public static void setTestHook(String senderId, boolean hook) {
-    Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
-    for (GatewaySender s : senders) {
-      if (s.getId().equals(senderId)) {
-        sender = s;
-        break;
-      }
-    }
-    ConcurrentParallelGatewaySenderEventProcessor cProc = (ConcurrentParallelGatewaySenderEventProcessor)((AbstractGatewaySender)sender)
-        .getEventProcessor();
-    if (cProc == null) return;
-    cProc.TEST_HOOK = hook;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java
deleted file mode 100644
index da8a631..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOffHeapDUnitTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-@SuppressWarnings("serial")
-@Category(DistributedTest.class)
-public class ConcurrentParallelGatewaySenderOffHeapDUnitTest extends
-    ConcurrentParallelGatewaySenderDUnitTest {
-
-  public ConcurrentParallelGatewaySenderOffHeapDUnitTest() {
-    super();
-  }
-
-  @Override
-  public boolean isOffHeap() {
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java
deleted file mode 100644
index ab1c06b..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java
+++ /dev/null
@@ -1,796 +0,0 @@
-/*
- * 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.internal.cache.wan.concurrent;
-
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTestBase {
-  private static final long serialVersionUID = 1L;
-  
-  public ConcurrentParallelGatewaySenderOperation_1_DUnitTest() {
-    super();
-  }
-
-  @Override
-  protected final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-  }
-  
-  @Test
-  public void testParallelGatewaySenderWithoutStarting() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    vm5.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    vm6.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    vm7.invoke(() -> WANTestBase.verifySenderStoppedState( "ln" ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 0 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 0 ));
-  }
-  
-  /**
-   * Defect 44323 (ParallelGatewaySender should not be started on Accessor node)
-   */
-  @Test
-  public void testParallelGatewaySenderStartOnAccessorNode() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
-        getTestMethodName() + "_PR", "ln", 1, 100 ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
-        getTestMethodName() + "_PR", "ln", 1, 100 ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    
-    //start the senders
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
-  }
-
-  
-  /**
-   * Normal scenario in which the sender is paused in between.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationSenderPause() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //FIRST RUN: now, the senders are started. So, start the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-    
-    //now, pause all of the senders
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    Wait.pause(2000);
-    //SECOND RUN: keep one thread doing puts to the region
-    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //verify region size remains on remote vm and is restricted below a specified limit (i.e. number of puts in the first run)
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
-  }
-
-  /**
-   * Normal scenario in which a paused sender is resumed.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationSenderResume() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 8, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //now, the senders are started. So, start the puts
-    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //now, pause all of the senders
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    
-    //sleep for a second or two
-    Wait.pause(2000);
-    
-    //resume the senders
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    Wait.pause(2000);
-    
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    //find the region size on remote vm
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
- 
-  }
-  
-  /**
-   * Negative scenario in which a sender that is stopped (and not paused) is resumed.
-   * Expected: resume is only valid for pause. If a sender which is stopped is resumed,
-   * it will not be started again.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationSenderResumeNegativeScenario() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(nyPort, vm4, vm5);
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    //wait till the senders are running
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-    //start the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-
-    //let the queue drain completely
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
-    
-    //stop the senders
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    //now, try to resume a stopped sender
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    
-    //do more puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //validate region size on remote vm to contain only the events put in local site 
-    //before the senders are stopped.
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 100 ));
-  }
-
-  /**
-   * Normal scenario in which a sender is stopped.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationSenderStop() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 3, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 100 ));
-    
-    //now, stop all of the senders
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    //SECOND RUN: keep one thread doing puts
-    vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //verify region size remains on remote vm and is restricted below a specified limit (number of puts in the first run)
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 100 ));
-  }
-
-  /**
-   * Normal scenario in which a sender is stopped and then started again.
-   */
-  @Test
-  public void testParallelPropagationSenderStartAfterStop() throws Throwable {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
-    
-    //now, stop all of the senders
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    Wait.pause(2000);
-
-    //SECOND RUN: do some of the puts after the senders are stopped
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-    
-    //start the senders again
-    AsyncInvocation vm4start = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm5start = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm6start = vm6.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm7start = vm7.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    int START_TIMEOUT = 30000;
-    vm4start.getResult(START_TIMEOUT);
-    vm5start.getResult(START_TIMEOUT);
-    vm6start.getResult(START_TIMEOUT);
-    vm7start.getResult(START_TIMEOUT);
-
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-
-    //SECOND RUN: do some more puts
-    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    async.join();
-    
-    //verify all the buckets on all the sender nodes are drained
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    //verify the events propagate to remote site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
-    
-    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm6.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-    vm7.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
-  }
-
-  /**
-   * Normal scenario in which a sender is stopped and then started again.
-   * Differs from above test case in the way that when the sender is starting from
-   * stopped state, puts are simultaneously happening on the region by another thread.
-   * @throws Exception
-   */
-  @Ignore("Bug47553")
-  @Test
-  public void testParallelPropagationSenderStartAfterStop_Scenario2() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-      getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 7, OrderPolicy.KEY ));
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    //make sure all the senders are running before doing any puts
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("All the senders are now started");
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
-    
-    LogWriterUtils.getLogWriter().info("Done few puts");
-    
-    //now, stop all of the senders
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("All the senders are stopped");
-    Wait.pause(2000);
-    
-    //SECOND RUN: do some of the puts after the senders are stopped
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Done some more puts in second run");
-    
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-    
-    //SECOND RUN: start async puts on region
-    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
-    LogWriterUtils.getLogWriter().info("Started high number of puts by async thread");
-
-    LogWriterUtils.getLogWriter().info("Starting the senders at the same time");
-    //when puts are happening by another thread, start the senders
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("All the senders are started");
-    
-    async.join();
-        
-    Wait.pause(2000);
-    
-    //verify all the buckets on all the sender nodes are drained
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    //verify that the queue size ultimately becomes zero. That means all the events propagate to remote site.
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln", 0 ));
-  }
-  
-  /**
-   * Normal scenario in which a sender is stopped and then started again on accessor node.
-   * @throws Exception
-   */
-  @Test
-  public void testParallelPropagationSenderStartAfterStopOnAccessorNode() throws Throwable {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
-        getTestMethodName() + "_PR", "ln", 1, 100));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegionAsAccessor(
-        getTestMethodName() + "_PR", "ln", 1, 100));
-
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-      true, 100, 10, false, false, null, true, 4, OrderPolicy.KEY ));
-
-    startSenderInVMs("ln", vm4, vm5, vm6, vm7);
-
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-
-
-    createReceiverInVMs(vm2, vm3);
-
-    //make sure all the senders are not running on accessor nodes and running on non-accessor nodes
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    //FIRST RUN: now, the senders are started. So, do some of the puts
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 ));
-
-    //now, stop all of the senders
-    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.stopSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.stopSender( "ln" ));
-
-    //SECOND RUN: do some of the puts after the senders are stopped
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-    
-    //start the senders again
-    AsyncInvocation vm4start = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm5start = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm6start = vm6.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    AsyncInvocation vm7start = vm7.invokeAsync(() -> WANTestBase.startSender( "ln" ));
-    vm4start.join();
-    vm5start.join();
-    vm6start.join();
-    vm7start.join();
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-
-
-    //Region size on remote site should remain same and below the number of puts done in the FIRST RUN
-    vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200 ));
-
-    //SECOND RUN: do some more puts
-    AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    async.join();
-
-    //verify all buckets drained only on non-accessor nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    
-    //verify the events propagate to remote site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000 ));
-  }
-
-  
-  /**
-   * Normal scenario in which a combinations of start, pause, resume operations
-   * is tested
-   */
-  @Test
-  public void testStartPauseResumeParallelGatewaySender() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Created cache on local site");
-    
-    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm6.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
-        true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY ));
-    
-    LogWriterUtils.getLogWriter().info("Created senders on local site");
-    
-    vm4.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm6.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", "ln", 1, 100, isOffHeap() ));
-
-    LogWriterUtils.getLogWriter().info("Created PRs on local site");
-    
-    vm2.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createPartitionedRegion(
-        getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
-    LogWriterUtils.getLogWriter().info("Created PRs on remote site");
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Done 1000 puts on local site");
-    
-    //Since puts are already done on userPR, it will have the buckets created. 
-    //During sender start, it will wait until those buckets are created for shadowPR as well.
-    //Start the senders in async threads, so colocation of shadowPR will be complete and 
-    //missing buckets will be created in PRHARedundancyProvider.createMissingBuckets().
-    startSenderInVMsAsync("ln", vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm6.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm7.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    LogWriterUtils.getLogWriter().info("Started senders on local site");
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));
-    LogWriterUtils.getLogWriter().info("Done 5000 puts on local site");
-    
-    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.pauseSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Paused senders on local site");
-    
-    vm4.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    vm5.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    vm6.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    vm7.invoke(() -> WANTestBase.verifySenderPausedState( "ln" ));
-    
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 ));
-    LogWriterUtils.getLogWriter().info("Started 1000 async puts on local site");
-
-    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.resumeSender( "ln" ));
-    LogWriterUtils.getLogWriter().info("Resumed senders on local site");
-
-    vm4.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-    vm5.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-    vm6.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-    vm7.invoke(() -> WANTestBase.verifySenderResumedState( "ln" ));
-
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail("Interrupted the async invocation.");
-    }
-    
-    //verify all buckets drained on all sender nodes.
-    vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm6.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-    vm7.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 5000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_PR", 5000 ));
-  }
-}


[61/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/main/java/org/apache/geode)


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/701c6861
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/701c6861
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/701c6861

Branch: refs/heads/feature/GEODE-37_2
Commit: 701c686150bbeaa8323937fc18695c245baf2708
Parents: 9b1ec72
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Sep 13 15:43:20 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Tue Sep 13 15:43:20 2016 -0700

----------------------------------------------------------------------
 .../client/internal/GatewaySenderBatchOp.java   | 312 --------
 .../cache/client/internal/SenderProxy.java      |  42 -
 .../internal/locator/wan/LocatorDiscovery.java  | 234 ------
 .../internal/locator/wan/LocatorHelper.java     | 142 ----
 .../locator/wan/LocatorJoinMessage.java         | 105 ---
 .../wan/LocatorMembershipListenerImpl.java      | 213 -----
 .../locator/wan/RemoteLocatorJoinRequest.java   |  84 --
 .../locator/wan/RemoteLocatorJoinResponse.java  |  86 --
 .../locator/wan/RemoteLocatorPingRequest.java   |  55 --
 .../locator/wan/RemoteLocatorPingResponse.java  |  54 --
 .../locator/wan/RemoteLocatorRequest.java       |  63 --
 .../locator/wan/RemoteLocatorResponse.java      |  71 --
 .../internal/locator/wan/WANFactoryImpl.java    |  74 --
 .../locator/wan/WanLocatorDiscovererImpl.java   | 154 ----
 .../cache/wan/AbstractRemoteGatewaySender.java  | 166 ----
 .../cache/wan/GatewayReceiverFactoryImpl.java   | 145 ----
 .../internal/cache/wan/GatewayReceiverImpl.java | 251 ------
 .../wan/GatewaySenderEventRemoteDispatcher.java | 802 -------------------
 .../cache/wan/GatewaySenderFactoryImpl.java     | 382 ---------
 .../wan/parallel/ParallelGatewaySenderImpl.java | 263 ------
 ...rentParallelGatewaySenderEventProcessor.java |  66 --
 ...moteParallelGatewaySenderEventProcessor.java | 122 ---
 ...urrentSerialGatewaySenderEventProcessor.java |  45 --
 ...RemoteSerialGatewaySenderEventProcessor.java |  50 --
 .../wan/serial/SerialGatewaySenderImpl.java     | 256 ------
 .../client/internal/GatewaySenderBatchOp.java   | 312 ++++++++
 .../cache/client/internal/SenderProxy.java      |  42 +
 .../internal/locator/wan/LocatorDiscovery.java  | 234 ++++++
 .../internal/locator/wan/LocatorHelper.java     | 142 ++++
 .../locator/wan/LocatorJoinMessage.java         | 105 +++
 .../wan/LocatorMembershipListenerImpl.java      | 213 +++++
 .../locator/wan/RemoteLocatorJoinRequest.java   |  84 ++
 .../locator/wan/RemoteLocatorJoinResponse.java  |  86 ++
 .../locator/wan/RemoteLocatorPingRequest.java   |  55 ++
 .../locator/wan/RemoteLocatorPingResponse.java  |  54 ++
 .../locator/wan/RemoteLocatorRequest.java       |  63 ++
 .../locator/wan/RemoteLocatorResponse.java      |  71 ++
 .../internal/locator/wan/WANFactoryImpl.java    |  74 ++
 .../locator/wan/WanLocatorDiscovererImpl.java   | 154 ++++
 .../cache/wan/AbstractRemoteGatewaySender.java  | 166 ++++
 .../cache/wan/GatewayReceiverFactoryImpl.java   | 145 ++++
 .../internal/cache/wan/GatewayReceiverImpl.java | 251 ++++++
 .../wan/GatewaySenderEventRemoteDispatcher.java | 802 +++++++++++++++++++
 .../cache/wan/GatewaySenderFactoryImpl.java     | 382 +++++++++
 .../wan/parallel/ParallelGatewaySenderImpl.java | 263 ++++++
 ...rentParallelGatewaySenderEventProcessor.java |  66 ++
 ...moteParallelGatewaySenderEventProcessor.java | 122 +++
 ...urrentSerialGatewaySenderEventProcessor.java |  45 ++
 ...RemoteSerialGatewaySenderEventProcessor.java |  50 ++
 .../wan/serial/SerialGatewaySenderImpl.java     | 256 ++++++
 50 files changed, 4237 insertions(+), 4237 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/GatewaySenderBatchOp.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/GatewaySenderBatchOp.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/GatewaySenderBatchOp.java
deleted file mode 100755
index b042da0..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/GatewaySenderBatchOp.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * 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.client.internal;
-
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.cache.client.ServerOperationException;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.cache.EventID;
-import com.gemstone.gemfire.internal.cache.tier.MessageType;
-import com.gemstone.gemfire.internal.cache.tier.sockets.ChunkedMessage;
-import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
-import com.gemstone.gemfire.internal.cache.tier.sockets.Part;
-import com.gemstone.gemfire.internal.cache.wan.BatchException70;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventImpl;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventRemoteDispatcher.GatewayAck;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-import java.net.SocketTimeoutException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.logging.log4j.Logger;
-
-@SuppressWarnings("unchecked")
-public class GatewaySenderBatchOp {
-  
-  private static final Logger logger = LogService.getLogger();
-  
-  /**
-   * Send a list of gateway events to a server to execute
-   * using connections from the given pool
-   * to communicate with the server.
-   * @param con the connection to send the message on.
-   * @param pool the pool to use to communicate with the server.
-   * @param events list of gateway events
-   * @param batchId the ID of this batch
-   */
-  public static void executeOn(Connection con, ExecutablePool pool, List events, int batchId, boolean isRetry)
-  {
-    AbstractOp op = null;
-    //System.out.println("Version: "+con.getWanSiteVersion());
-    //Is this check even needed anymore?  It looks like we just create the same exact op impl with the same parameters...
-    if (Version.GFE_651.compareTo(con.getWanSiteVersion()) >= 0) {
-      op = new GatewaySenderGFEBatchOpImpl(events, batchId, con.getDistributedSystemId(), isRetry);
-    } else {
-      // Default should create a batch of server version (ACCEPTOR.VERSION)
-      op = new GatewaySenderGFEBatchOpImpl(events, batchId, con.getDistributedSystemId(), isRetry);
-    }
-    pool.executeOn(con, op, true/*timeoutFatal*/);
-  }
-  
-  
-  public static Object executeOn(Connection con, ExecutablePool pool)
-  {
-    AbstractOp op = new GatewaySenderGFEBatchOpImpl();
-    return pool.executeOn(con, op, true/*timeoutFatal*/);
-  }
-                                                               
-  private GatewaySenderBatchOp() {
-    // no instances allowed
-  }
-  
-  static class GatewaySenderGFEBatchOpImpl extends AbstractOp {
-    
-    /**
-     * @throws com.gemstone.gemfire.SerializationException if serialization fails
-     */
-    public GatewaySenderGFEBatchOpImpl(List events, int batchId, int dsId, boolean isRetry)  {
-      super(MessageType.GATEWAY_RECEIVER_COMMAND, calcPartCount(events));
-      boolean removeFromQueueOnException = true;
-      if (isRetry) {
-        getMessage().setIsRetry();
-      }
-      getMessage().addIntPart(events.size());
-      getMessage().addIntPart(batchId);
-      getMessage().addIntPart(dsId);
-      getMessage().addBytesPart(
-          new byte[] { removeFromQueueOnException ? (byte)1 : (byte)0 });
-      // Add each event
-      for (Iterator i = events.iterator(); i.hasNext();) {
-        GatewaySenderEventImpl event = (GatewaySenderEventImpl)i.next();
-        // Add action
-        int action = event.getAction();
-        getMessage().addIntPart(action);
-        { // Add posDup flag
-          byte posDupByte = (byte)(event.getPossibleDuplicate()?0x01:0x00);
-          getMessage().addBytesPart(new byte[] {posDupByte});
-        }
-        if (action >= 0 && action <= 3) {
-          // 0 = create
-          // 1 = update
-          // 2 = destroy
-          String regionName = event.getRegionPath();
-          EventID eventId = event.getEventId();
-          Object key = event.getKey();
-          Object callbackArg = event.getSenderCallbackArgument();
-
-          // Add region name
-          getMessage().addStringPart(regionName);
-          // Add event id
-          getMessage().addObjPart(eventId);
-          // Add key
-          getMessage().addStringOrObjPart(key);
-          if (action < 2 /* it is 0 or 1 */) {
-            byte[] value = event.getSerializedValue();
-            byte valueIsObject = event.getValueIsObject();;
-            // Add value (which is already a serialized byte[])
-            getMessage().addRawPart(value, (valueIsObject == 0x01));
-          }
-          // Add callback arg if necessary
-          if (callbackArg == null) {
-            getMessage().addBytesPart(new byte[] {0x00});
-          } else {
-            getMessage().addBytesPart(new byte[] {0x01});
-            getMessage().addObjPart(callbackArg);
-          }
-          getMessage().addLongPart(event.getVersionTimeStamp());
-        }
-      }
-    }
-
-    public GatewaySenderGFEBatchOpImpl() {
-      super(MessageType.GATEWAY_RECEIVER_COMMAND, 0);
-    }
-
-    @Override
-    public Object attempt(Connection cnx) throws Exception {
-      if (getMessage().getNumberOfParts() == 0) {
-        return attemptRead(cnx);
-      }
-      this.failed = true;
-      this.timedOut = false;
-      long start = startAttempt(cnx.getStats());
-      try {
-        try {
-          attemptSend(cnx);
-          this.failed = false;
-        } finally {
-          endSendAttempt(cnx.getStats(), start);
-        }
-      } finally {
-        endAttempt(cnx.getStats(), start);
-      }
-      return this.failed;
-    }
-    
-    private Object attemptRead(Connection cnx) throws Exception {
-      this.failed = true;
-      try {
-        Object result = attemptReadResponse(cnx);
-        this.failed = false;
-        return result;
-      } catch (SocketTimeoutException ste) {
-        this.failed = false;
-        this.timedOut = true;
-        throw ste;
-      } catch (Exception e) {
-        throw e;
-      }
-    }
-    
-    
-    /**
-     * Attempts to read a response to this operation by reading it from the
-     * given connection, and returning it.
-     * @param cnx the connection to read the response from
-     * @return the result of the operation
-     *         or <code>null</code> if the operation has no result.
-     * @throws Exception if the execute failed
-     */
-    protected Object attemptReadResponse(Connection cnx) throws Exception {
-      Message msg = createResponseMessage();
-      if (msg != null) {
-        msg.setComms(cnx.getSocket(), cnx.getInputStream(),
-            cnx.getOutputStream(),
-            ((ConnectionImpl)cnx).getCommBufferForAsyncRead(), cnx.getStats());
-        if (msg instanceof ChunkedMessage) {
-          try {
-            return processResponse(msg, cnx);
-          } finally {
-            msg.unsetComms();
-            // TODO (ashetkar) Handle the case when we fail to read the
-            // connection id.
-            processSecureBytes(cnx, msg);
-          }
-        }
-
-        try {
-          msg.recv();
-        } finally {
-          msg.unsetComms();
-          processSecureBytes(cnx, msg);
-        }
-        return processResponse(msg, cnx);
-      }
-      
-      return null;
-    }
-    
-    
-    private static int calcPartCount(List events) {
-      int numberOfParts = 4; // for the number of events and the batchId
-      for (Iterator i = events.iterator(); i.hasNext();) {
-        GatewaySenderEventImpl event = (GatewaySenderEventImpl)i.next();
-        numberOfParts += event.getNumberOfParts();
-      }
-      return numberOfParts;
-    }
-
-    @Override
-    protected void processSecureBytes(Connection cnx, Message message)
-        throws Exception {
-    }
-
-    @Override
-    protected boolean needsUserId() {
-      return false;
-    }
-
-    @Override
-    protected void sendMessage(Connection cnx) throws Exception {
-      getMessage().clearMessageHasSecurePartFlag();
-      getMessage().send(false);
-    }
-
-    @Override
-    protected Object processResponse(Message msg) throws Exception {
-      GatewayAck ack = null;
-      try {
-        // Read the header which describes the type of message following
-        switch (msg.getMessageType()) {
-        case MessageType.REPLY:
-          // Read the chunk
-          Part part0 = msg.getPart(0);
-          if (part0.isBytes() && part0.getLength() == 1 && part0.getSerializedForm()[0] == 0) {
-            // REPLY_OKAY from a CloseConnection
-            break;
-          }
-          int batchId = part0.getInt();
-          int numEvents = msg.getPart(1).getInt();
-          ack = new GatewayAck(batchId, numEvents);
-          break;
-        case MessageType.EXCEPTION:
-          part0 = msg.getPart(0);
-
-          Object obj = part0.getObject();
-          if (obj instanceof List) {
-            List<BatchException70> l = (List<BatchException70>)part0.getObject();
-
-           // if (logger.isDebugEnabled()) {
-              logger.info("We got an exception from the GatewayReceiver. MessageType : {} obj :{}", msg.getMessageType(), obj);
-            //}
-            // don't throw Exception but set it in the Ack
-            BatchException70 be = new BatchException70(l);
-            ack = new GatewayAck(be, l.get(0).getBatchId());
-
-          } else if (obj instanceof Throwable) {
-            String s = ": While reading Ack from receiver "
-                + ((Throwable)obj).getMessage();
-            throw new ServerOperationException(s, (Throwable)obj);
-          }
-          break;
-        default:
-          throw new InternalGemFireError(
-              LocalizedStrings.Op_UNKNOWN_MESSAGE_TYPE_0
-                  .toLocalizedString(Integer.valueOf(msg.getMessageType())));
-        }
-      } finally {
-        msg.clear();
-      }
-      return ack;
-    }
-    
-    @Override
-    protected boolean isErrorResponse(int msgType) {
-      return false;
-    }
-    @Override
-    protected long startAttempt(ConnectionStats stats) {
-      return stats.startGatewayBatch();
-    }
-    @Override
-    protected void endSendAttempt(ConnectionStats stats, long start) {
-      stats.endGatewayBatchSend(start, hasFailed());
-    }
-    @Override
-    protected void endAttempt(ConnectionStats stats, long start) {
-      stats.endGatewayBatch(start, hasTimedOut(), hasFailed());
-    }
-    
-    @Override
-    public boolean isGatewaySenderOp() {
-      return true;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/SenderProxy.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/SenderProxy.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/SenderProxy.java
deleted file mode 100644
index 8647d12..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/SenderProxy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.client.internal;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.distributed.internal.ServerLocation;
-
-/**
- * Used to send operations from a sender to a receiver.
- * @since GemFire 8.1
- */
-public class SenderProxy extends ServerProxy{
-  public SenderProxy(InternalPool pool) {
-    super(pool);
-  }
-
-  public void dispatchBatch_NewWAN(Connection con, List events, int batchId, boolean isRetry)
-  {
-    GatewaySenderBatchOp.executeOn(con, this.pool, events, batchId, isRetry);
-  }
-  
-  public Object receiveAckFromReceiver(Connection con)
-  {
-    return GatewaySenderBatchOp.executeOn(con, this.pool);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorDiscovery.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorDiscovery.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorDiscovery.java
deleted file mode 100644
index 60973ed..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorDiscovery.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
-import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import com.gemstone.gemfire.internal.net.*;
-import com.gemstone.gemfire.internal.tcp.ConnectionException;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * This class represent a runnable task which exchange the locator information
- * with local locators(within the site) as well as remote locators (across the
- * site)
- * 
- * @since GemFire 7.0
- */
-public class LocatorDiscovery{
-
-  private static final Logger logger = LogService.getLogger();
-
-  private WanLocatorDiscoverer discoverer;
-
-  private DistributionLocatorId locatorId;
-  
-  private LocatorMembershipListener locatorListener;
-  
-  RemoteLocatorJoinRequest request;
-  
-  TcpClient locatorClient;
-
-  public static final int WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT = Integer
-      .getInteger("WANLocator.CONNECTION_RETRY_ATTEMPT", 50000).intValue();
-
-  public static final int WAN_LOCATOR_CONNECTION_INTERVAL = Integer.getInteger(
-      "WANLocator.CONNECTION_INTERVAL", 10000).intValue();
-
-  public static final int WAN_LOCATOR_PING_INTERVAL = Integer.getInteger(
-      "WANLocator.PING_INTERVAL", 10000).intValue();
-
-  public LocatorDiscovery(WanLocatorDiscoverer discoverer, DistributionLocatorId locator,RemoteLocatorJoinRequest request,
-      LocatorMembershipListener locatorListener) {
-    this.discoverer = discoverer;
-    this.locatorId = locator;
-    this.request = request; 
-    this.locatorListener = locatorListener;
-    this.locatorClient = new TcpClient();
-  }
-  
-  /**
-   * When a batch fails, then this keeps the last time when a failure was logged
-   * . We don't want to swamp the logs in retries due to same batch failures.
-   */
-  private final ConcurrentHashMap<DistributionLocatorId, long[]> failureLogInterval = new ConcurrentHashMap<DistributionLocatorId, long[]>();
-
-  /**
-   * The maximum size of {@link #failureLogInterval} beyond which it will start
-   * logging all failure instances. Hopefully this should never happen in
-   * practice.
-   */
-  private static final int FAILURE_MAP_MAXSIZE = Integer.getInteger(
-      DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.FAILURE_MAP_MAXSIZE", 1000000);
-
-  /**
-   * The maximum interval for logging failures of the same event in millis.
-   */
-  private static final int FAILURE_LOG_MAX_INTERVAL = Integer.getInteger(
-      DistributionConfig.GEMFIRE_PREFIX + "LocatorDiscovery.FAILURE_LOG_MAX_INTERVAL", 300000);
-
-  public final boolean skipFailureLogging(DistributionLocatorId locatorId) {
-    boolean skipLogging = false;
-    if (this.failureLogInterval.size() < FAILURE_MAP_MAXSIZE) {
-      long[] logInterval = this.failureLogInterval.get(locatorId);
-      if (logInterval == null) {
-        logInterval = this.failureLogInterval.putIfAbsent(locatorId,
-            new long[] { System.currentTimeMillis(), 1000 });
-      }
-      if (logInterval != null) {
-        long currentTime = System.currentTimeMillis();
-        if ((currentTime - logInterval[0]) < logInterval[1]) {
-          skipLogging = true;
-        } else {
-          logInterval[0] = currentTime;
-          if (logInterval[1] <= (FAILURE_LOG_MAX_INTERVAL / 2)) {
-            logInterval[1] *= 2;
-          }
-        }
-      }
-    }
-    return skipLogging;
-  }
-
-
-  public class LocalLocatorDiscovery implements Runnable {
-    public void run() {
-      exchangeLocalLocators();
-    }
-  }
-
-  public class RemoteLocatorDiscovery implements Runnable {
-    public void run() {
-      exchangeRemoteLocators();
-    }
-  }
-
-  private WanLocatorDiscoverer getDiscoverer() {
-    return this.discoverer;
-  }
-  
-  private void exchangeLocalLocators() {
-    int retryAttempt = 1;
-    while (!getDiscoverer().isStopped()) {
-      try {
-        RemoteLocatorJoinResponse response = (RemoteLocatorJoinResponse)locatorClient
-            .requestToServer(locatorId.getHost(), locatorId.getPort(), request,
-                WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
-        if (response != null) {
-          LocatorHelper.addExchangedLocators(response.getLocators(),
-              this.locatorListener);
-          logger.info(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_EXCHANGED_LOCATOR_INFORMATION_0_WITH_1,
-              new Object[] { request.getLocator(), locatorId, response.getLocators() }));
-          break;
-        }
-      }
-      catch (IOException ioe) {
-        if (retryAttempt == WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT) {
-          ConnectionException coe = new ConnectionException(
-              "Not able to connect to local locator after "
-              + WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT + " retry attempts",
-          ioe);
-          logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2,
-              new Object[] { request.getLocator(),locatorId, retryAttempt }), coe);
-          break;
-        }
-        if (skipFailureLogging(locatorId)) {
-          logger.warn(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2_RETRYING_IN_3_MS,
-              new Object[] { request.getLocator(), locatorId, retryAttempt, WAN_LOCATOR_CONNECTION_INTERVAL }));
-        }
-        try {
-          Thread.sleep(WAN_LOCATOR_CONNECTION_INTERVAL);
-        }
-        catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-        }
-        retryAttempt++;
-        continue;
-      }
-      catch (ClassNotFoundException classNotFoundException) {
-        logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_ENCOUNTERED_UNEXPECTED_EXCEPTION), classNotFoundException);
-        break;
-      }
-    }
-  }
-  
-  public void exchangeRemoteLocators() {
-    int retryAttempt = 1;
-    DistributionLocatorId remoteLocator = this.locatorId;
-    while (!getDiscoverer().isStopped()) {
-      RemoteLocatorJoinResponse response;
-      try {
-        response = (RemoteLocatorJoinResponse)locatorClient
-            .requestToServer(remoteLocator.getHost(), remoteLocator.getPort(),
-                request, WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
-        if (response != null) {
-          LocatorHelper.addExchangedLocators(response.getLocators(), this.locatorListener);
-          logger.info(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_EXCHANGED_LOCATOR_INFORMATION_0_WITH_1,
-              new Object[] { request.getLocator(), locatorId, response.getLocators() }));
-          RemoteLocatorPingRequest pingRequest = new RemoteLocatorPingRequest(
-              "");
-          while (true) {
-            Thread.sleep(WAN_LOCATOR_PING_INTERVAL);
-            RemoteLocatorPingResponse pingResponse = (RemoteLocatorPingResponse)locatorClient
-                .requestToServer(remoteLocator.getHost(),
-                    remoteLocator.getPort(), pingRequest,
-                    WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
-            if (pingResponse != null) {
-              continue;
-            }
-            break;
-          }
-        }
-      }
-      catch (IOException ioe) {
-        if (retryAttempt == WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT) {
-          logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2,
-              new Object[] { request.getLocator(), remoteLocator, retryAttempt}), ioe);
-          break;
-        }
-        if (skipFailureLogging(remoteLocator)) {
-          logger.warn(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2_RETRYING_IN_3_MS,
-              new Object[] { request.getLocator(), remoteLocator, retryAttempt, WAN_LOCATOR_CONNECTION_INTERVAL }));
-        }
-        try {
-          Thread.sleep(WAN_LOCATOR_CONNECTION_INTERVAL);
-        }
-        catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-        }
-        retryAttempt++;
-        continue;
-      }
-      catch (ClassNotFoundException classNotFoundException) {
-        logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_ENCOUNTERED_UNEXPECTED_EXCEPTION), classNotFoundException);
-        break;
-      }
-      catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorHelper.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorHelper.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorHelper.java
deleted file mode 100644
index 83b6db3..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorHelper.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import com.gemstone.gemfire.distributed.internal.InternalLocator;
-import com.gemstone.gemfire.cache.client.internal.locator.wan.LocatorMembershipListener;
-import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
-import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-/**
- * This is a helper class which helps to add the locator information to the allLocatorInfoMap.
- * 
- *
- */
-public class LocatorHelper {
-  
-  public final static Object locatorObject = new Object();
-  /**
-   * 
-   * This methods add the given locator to allLocatorInfoMap.
-   * It also invokes a locatorlistener to inform other locators in allLocatorInfoMap about this newly added locator.
-   * @param distributedSystemId
-   * @param locator
-   * @param locatorListener
-   * @param sourceLocator
-   */
-  public static boolean addLocator(int distributedSystemId,
-      DistributionLocatorId locator, LocatorMembershipListener locatorListener,
-      DistributionLocatorId sourceLocator) {
-      ConcurrentHashMap<Integer, Set<DistributionLocatorId>> allLocatorsInfo = (ConcurrentHashMap<Integer, Set<DistributionLocatorId>>)locatorListener
-          .getAllLocatorsInfo();
-      Set<DistributionLocatorId> locatorsSet = new CopyOnWriteHashSet<DistributionLocatorId>();
-      locatorsSet.add(locator);
-      Set<DistributionLocatorId> existingValue = allLocatorsInfo.putIfAbsent(distributedSystemId, locatorsSet);
-      if(existingValue != null){
-        if (!existingValue.contains(locator)) {
-          existingValue.add(locator);
-          addServerLocator(distributedSystemId, locatorListener, locator);
-          locatorListener.locatorJoined(distributedSystemId, locator,
-              sourceLocator);
-        }
-        else {
-          return false;
-        }
-      }else{
-        addServerLocator(distributedSystemId, locatorListener, locator);
-        locatorListener.locatorJoined(distributedSystemId, locator,
-          sourceLocator);
-      }
-    return true;
-  }
-
-  /**
-   * This methods decides whether the given locator is server locator, if so
-   * then add this locator in allServerLocatorsInfo map.
-   * 
-   * @param distributedSystemId
-   * @param locatorListener
-   * @param locator
-   */
-  private static void addServerLocator(Integer distributedSystemId,
-      LocatorMembershipListener locatorListener, DistributionLocatorId locator) {
-    if (!locator.isServerLocator()) {
-      return;
-    }
-    ConcurrentHashMap<Integer, Set<String>> allServerLocatorsInfo = (ConcurrentHashMap<Integer, Set<String>>)locatorListener
-        .getAllServerLocatorsInfo();
-    
-    Set<String> locatorsSet = new CopyOnWriteHashSet<String>();
-    locatorsSet.add(locator.toString());
-    Set<String> existingValue = allServerLocatorsInfo.putIfAbsent(distributedSystemId, locatorsSet);
-    if(existingValue != null){
-      if (!existingValue.contains(locator.toString())) {
-        existingValue.add(locator.toString());
-      }
-    }
-  }
-
-  /**
-   * This method adds the map of locatorsinfo sent by other locator to this locator's allLocatorInfo
-   * 
-   * @param locators
-   * @param locatorListener
-   */
-  public static boolean addExchangedLocators(Map<Integer, Set<DistributionLocatorId>> locators,
-                                             LocatorMembershipListener locatorListener) {
-
-    ConcurrentHashMap<Integer, Set<DistributionLocatorId>> allLocators = (ConcurrentHashMap<Integer, Set<DistributionLocatorId>>)locatorListener
-        .getAllLocatorsInfo();
-    if (!allLocators.equals(locators)) {
-      for (Map.Entry<Integer, Set<DistributionLocatorId>> entry : locators
-          .entrySet()) {
-        Set<DistributionLocatorId> existingValue = allLocators.putIfAbsent(
-            entry.getKey(), new CopyOnWriteHashSet<DistributionLocatorId>(entry
-                .getValue()));
-
-        if (existingValue != null) {
-          Set<DistributionLocatorId> localLocators = allLocators.get(entry
-              .getKey());
-          if (!localLocators.equals(entry.getValue())) {
-            entry.getValue().removeAll(localLocators);
-            for (DistributionLocatorId locator : entry.getValue()) {
-              localLocators.add(locator);
-              addServerLocator(entry.getKey(), locatorListener, locator);
-              locatorListener.locatorJoined(entry.getKey(), locator, null);
-            }
-          }
-
-        }
-        else {
-          for (DistributionLocatorId locator : entry.getValue()) {
-            addServerLocator(entry.getKey(), locatorListener, locator);
-            locatorListener.locatorJoined(entry.getKey(), locator, null);
-          }
-        }
-      }
-      return true;
-    }
-    return false;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorJoinMessage.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorJoinMessage.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorJoinMessage.java
deleted file mode 100644
index 86ae0d6..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorJoinMessage.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.client.internal.locator.ServerLocationRequest;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-
-public class LocatorJoinMessage extends ServerLocationRequest {
-
-  private DistributionLocatorId locator;
-  
-  private int distributedSystemId;
-  
-  private DistributionLocatorId sourceLocator;
-
-  public LocatorJoinMessage() {
-    super();
-  }
-
-  public LocatorJoinMessage(int distributedSystemId, DistributionLocatorId locator,
-      DistributionLocatorId sourceLocator, String serverGroup) {
-    super(serverGroup);
-    this.locator = locator;
-    this.distributedSystemId = distributedSystemId;
-    this.sourceLocator = sourceLocator;
-  }
-
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    super.fromData(in);
-    this.locator = DataSerializer.readObject(in);
-    this.distributedSystemId = in.readInt();
-    this.sourceLocator = DataSerializer.readObject(in);
-  }
-
-  public void toData(DataOutput out) throws IOException {
-    super.toData(out);
-    DataSerializer.writeObject(locator, out);
-    out.writeInt(this.distributedSystemId);
-    DataSerializer.writeObject(sourceLocator, out);
-  }
-
-  public DistributionLocatorId getLocator() {
-    return this.locator;
-  }
-
-  public int getDistributedSystemId() {
-    return distributedSystemId;
-  }
-  
-  public DistributionLocatorId getSourceLocator() {
-    return sourceLocator;
-  }
-  
-  public int getDSFID() {
-    return DataSerializableFixedID.LOCATOR_JOIN_MESSAGE;
-  }
-
-  @Override
-  public String toString() {
-    return "LocatorJoinMessage{distributedSystemId="+ distributedSystemId +" locators=" + locator + " Source Locator : " + sourceLocator +"}";
-  }
-
-  @Override
-  public boolean equals(Object obj){
-    if ( this == obj ) return true;
-    if ( !(obj instanceof LocatorJoinMessage) ) return false;
-    LocatorJoinMessage myObject = (LocatorJoinMessage)obj;
-    if((this.distributedSystemId == myObject.getDistributedSystemId()) && this.locator.equals(myObject.getLocator())){
-      return true;
-    }
-    return false;
-  }
-  
-  @Override
-  public int hashCode() {
-    // it is sufficient for all messages having the same locator to hash to the same bucket
-    if (this.locator == null) {
-      return 0;
-    } else {
-      return this.locator.hashCode();
-    }
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java
deleted file mode 100644
index 01e01e7..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/LocatorMembershipListenerImpl.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
-import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * An implementation of
- * {@link com.gemstone.gemfire.cache.client.internal.locator.wan.LocatorMembershipListener}
- * 
- * 
- */
-public class LocatorMembershipListenerImpl implements LocatorMembershipListener {
-
-  private ConcurrentMap<Integer, Set<DistributionLocatorId>> allLocatorsInfo = new ConcurrentHashMap<Integer, Set<DistributionLocatorId>>();
-  
-  private ConcurrentMap<Integer, Set<String>> allServerLocatorsInfo = new ConcurrentHashMap<Integer, Set<String>>();
-  
-  private static final Logger logger = LogService.getLogger();
-  
-  private DistributionConfig config;
-  
-  private TcpClient tcpClient;
-  
-  private int port;
-  
-  public LocatorMembershipListenerImpl() {
-    this.tcpClient = new TcpClient();
-  }
-  
-  public void setPort(int port){
-    this.port = port;
-  }
-
-  public void setConfig(DistributionConfig config) {
-    this.config = config;
-  }
-  
-  /**
-   * When the new locator is added to remote locator metadata, inform all other
-   * locators in remote locator metadata about the new locator so that they can
-   * update their remote locator metadata.
-   * 
-   * @param locator
-   */
-  
-  public void locatorJoined(final int distributedSystemId,
-      final DistributionLocatorId locator,
-      final DistributionLocatorId sourceLocator) {
-    Thread distributeLocator = new Thread(new Runnable() {
-      public void run() {
-        ConcurrentMap<Integer, Set<DistributionLocatorId>> remoteLocators = getAllLocatorsInfo();
-        ArrayList<DistributionLocatorId> locatorsToRemove = new ArrayList<DistributionLocatorId>();
-        
-        String localLocator = config.getStartLocator();
-        DistributionLocatorId localLocatorId = null;
-        if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) {
-          localLocatorId = new DistributionLocatorId(port, config
-              .getBindAddress());
-        }
-        else {
-          localLocatorId = new DistributionLocatorId(localLocator);
-        }
-        locatorsToRemove.add(localLocatorId);
-        locatorsToRemove.add(locator);
-        locatorsToRemove.add(sourceLocator);
-        
-        Map<Integer, Set<DistributionLocatorId>> localCopy = new HashMap<Integer, Set<DistributionLocatorId>>();
-        for(Map.Entry<Integer, Set<DistributionLocatorId>> entry : remoteLocators.entrySet()){
-          Set<DistributionLocatorId> value = new CopyOnWriteHashSet<DistributionLocatorId>(entry.getValue());
-          localCopy.put(entry.getKey(), value);
-        }  
-        for(Map.Entry<Integer, Set<DistributionLocatorId>> entry : localCopy.entrySet()){
-          for(DistributionLocatorId removeLocId : locatorsToRemove){
-            if(entry.getValue().contains(removeLocId)){
-              entry.getValue().remove(removeLocId);
-            }
-          }
-          for (DistributionLocatorId value : entry.getValue()) {
-            try {
-              tcpClient.requestToServer(value.getHost(), value.getPort(),
-                  new LocatorJoinMessage(distributedSystemId, locator, localLocatorId, ""), 1000, false);
-            }
-            catch (Exception e) {
-              if (logger.isDebugEnabled()) {
-                logger.debug(LocalizedMessage.create(LocalizedStrings.LOCATOR_MEMBERSHIP_LISTENER_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_1_WIHT_2_3, 
-                    new Object[] { locator.getHost(), locator.getPort(), value.getHost(), value.getPort() }));
-              }
-            }
-            try {
-              tcpClient.requestToServer(locator.getHost(), locator.getPort(),
-                  new LocatorJoinMessage(entry.getKey(), value, localLocatorId, ""), 1000, false);
-            }
-            catch (Exception e) {
-              if (logger.isDebugEnabled()) {
-                logger.debug(LocalizedMessage.create(LocalizedStrings.LOCATOR_MEMBERSHIP_LISTENER_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_1_WIHT_2_3,
-                    new Object[] { value.getHost(), value.getPort(), locator.getHost(), locator.getPort() }));
-              }
-            }
-          }
-        }
-      }
-    });
-    distributeLocator.setDaemon(true);
-    distributeLocator.start();
-  }
-
-  public Object handleRequest(Object request) {
-    Object response = null;
-    if (request instanceof RemoteLocatorJoinRequest) {
-      response = updateAllLocatorInfo((RemoteLocatorJoinRequest)request);
-    }
-    else if (request instanceof LocatorJoinMessage) {
-      response = informAboutRemoteLocators((LocatorJoinMessage)request);
-    }
-    else if (request instanceof RemoteLocatorPingRequest) {
-      response = getPingResponse((RemoteLocatorPingRequest)request);
-    }
-    else if (request instanceof RemoteLocatorRequest) {
-      response = getRemoteLocators((RemoteLocatorRequest)request);
-    }
-    return response;
-  }
-  
-  /**
-   * A locator from the request is checked against the existing remote locator
-   * metadata. If it is not available then added to existing remote locator
-   * metadata and LocatorMembershipListener is invoked to inform about the
-   * this newly added locator to all other locators available in remote locator
-   * metadata. As a response, remote locator metadata is sent.
-   * 
-   * @param request
-   */
-  private synchronized Object updateAllLocatorInfo(RemoteLocatorJoinRequest request) {
-    int distributedSystemId = request.getDistributedSystemId();
-    DistributionLocatorId locator = request.getLocator();
-
-    LocatorHelper.addLocator(distributedSystemId, locator, this, null);
-    return new RemoteLocatorJoinResponse(this.getAllLocatorsInfo());
-  }
-  
-  private Object getPingResponse(RemoteLocatorPingRequest request) {
-   return new RemoteLocatorPingResponse();
-  }
-  
-  private Object informAboutRemoteLocators(LocatorJoinMessage request){
-    // TODO: FInd out the importance of list locatorJoinMessages. During
-    // refactoring I could not understand its significance
-//    synchronized (locatorJoinObject) {
-//      if (locatorJoinMessages.contains(request)) {
-//        return null;
-//      }
-//      locatorJoinMessages.add(request);  
-//    }
-    int distributedSystemId = request.getDistributedSystemId();
-    DistributionLocatorId locator = request.getLocator();
-    DistributionLocatorId sourceLocatorId = request.getSourceLocator();
-
-    LocatorHelper.addLocator(distributedSystemId, locator, this, sourceLocatorId);
-    return null;
-  }
-  
-  private Object getRemoteLocators(RemoteLocatorRequest request) {
-    int dsId = request.getDsId();
-    Set<String> locators = this.getRemoteLocatorInfo(dsId);
-    return new RemoteLocatorResponse(locators);
-  }
-  
-  public Set<String> getRemoteLocatorInfo(int dsId) {
-    return this.allServerLocatorsInfo.get(dsId);
-  }
-
-  public ConcurrentMap<Integer,Set<DistributionLocatorId>> getAllLocatorsInfo() {
-    return this.allLocatorsInfo;
-  }
-  
-  public ConcurrentMap<Integer,Set<String>> getAllServerLocatorsInfo() {
-    return this.allServerLocatorsInfo;
-  }
-  
-  public void clearLocatorInfo(){
-    allLocatorsInfo.clear();
-    allServerLocatorsInfo.clear();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java
deleted file mode 100644
index c058333..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinRequest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.cache.client.internal.locator.ServerLocationRequest;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-
-/**
- * Requests remote locators of a remote WAN site
- * 
- * 
- * @since GemFire 6.6
- * 
- */
-public class RemoteLocatorJoinRequest implements DataSerializableFixedID {
-
-  private DistributionLocatorId locator = null;
- 
-  private int distributedSystemId = -1;
-
-  public RemoteLocatorJoinRequest() {
-    super();
-  }
-
-  public RemoteLocatorJoinRequest(int distributedSystemId, DistributionLocatorId locator,
-      String serverGroup) {
-    this.distributedSystemId = distributedSystemId;
-    this.locator = locator;
-  }
-
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.locator = DataSerializer.readObject(in);
-    this.distributedSystemId = in.readInt();
-  }
-
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeObject(locator, out);
-    out.writeInt(this.distributedSystemId);
-  }
-
-  public DistributionLocatorId getLocator() {
-    return this.locator;
-  }
-  
-  public int getDistributedSystemId() {
-    return distributedSystemId;
-  }
-  
-  public int getDSFID() {
-    return DataSerializableFixedID.REMOTE_LOCATOR_JOIN_REQUEST;
-  }
-
-  @Override
-  public String toString() {
-    return "RemoteLocatorJoinRequest{locator=" + locator + "}";
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java
deleted file mode 100644
index 42c3bb0..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorJoinResponse.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-
-/**
- * List of remote locators as a response
- * 
- * 
- * 
- */
-public class RemoteLocatorJoinResponse implements DataSerializableFixedID{
-
-  private HashMap<Integer, Set<DistributionLocatorId>> locators = new HashMap<Integer, Set<DistributionLocatorId>>();
-  
-  /** Used by DataSerializer */
-  public RemoteLocatorJoinResponse() {
-    super();
-  }
-
-  public RemoteLocatorJoinResponse(
-      Map<Integer, Set<DistributionLocatorId>> locators) {
-    super();
-    this.locators = new HashMap<Integer, Set<DistributionLocatorId>>();
-    for (Map.Entry<Integer, Set<DistributionLocatorId>> entry : locators
-        .entrySet()) {
-      this.locators.put(entry.getKey(), new CopyOnWriteHashSet<DistributionLocatorId>(
-          entry.getValue()));
-    }
-  }
-  
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.locators = DataSerializer.readHashMap(in);
-    
-  }
-
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeHashMap(locators, out);
-  }
-
-  public Map<Integer, Set<DistributionLocatorId>> getLocators() {
-    return this.locators;
-  }
-
-  @Override
-  public String toString() {
-    return "RemoteLocatorJoinResponse{locators=" + locators + "}";
-  }
-
-  public int getDSFID() {
-    return DataSerializableFixedID.REMOTE_LOCATOR_JOIN_RESPONSE;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java
deleted file mode 100644
index a1cb951..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingRequest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * 
- *
- */
-
-public class RemoteLocatorPingRequest implements DataSerializableFixedID{
-
-  public RemoteLocatorPingRequest() {
-    super();
-  }
-
-  public RemoteLocatorPingRequest(String serverGroup) {
-  }
-
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-  }
-
-  public void toData(DataOutput out) throws IOException {
-  }
-
-  public int getDSFID() {
-    return DataSerializableFixedID.REMOTE_LOCATOR_PING_REQUEST;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java
deleted file mode 100644
index 54fdc04..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorPingResponse.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * 
- */
-public class RemoteLocatorPingResponse implements DataSerializableFixedID {
-
-
-  /** Used by DataSerializer */
-  public RemoteLocatorPingResponse() {
-    super();
-  }
-
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-  }
-
-  public void toData(DataOutput out) throws IOException {
-  }
-
-
-
-  public int getDSFID() {
-    return DataSerializableFixedID.REMOTE_LOCATOR_PING_RESPONSE;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorRequest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorRequest.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorRequest.java
deleted file mode 100644
index d23ca93..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-/**
- * 
- *
- */
-public class RemoteLocatorRequest implements DataSerializableFixedID{
-  private int distributedSystemId ;
-
-  public RemoteLocatorRequest() {
-    super();
-  }
-  public RemoteLocatorRequest(int dsId, String serverGroup) {
-    this.distributedSystemId = dsId;
-  }
-  
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.distributedSystemId = in.readInt();
-  }
-
-  public void toData(DataOutput out) throws IOException {
-    out.writeInt(this.distributedSystemId);
-  }
-
-  public int getDsId() {
-    return this.distributedSystemId;
-  }
-  
-  public int getDSFID() {
-    return DataSerializableFixedID.REMOTE_LOCATOR_REQUEST;
-  }
-
-  @Override
-  public String toString() {
-    return "RemoteLocatorRequest{dsName=" + distributedSystemId + "}";
-  }
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorResponse.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorResponse.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorResponse.java
deleted file mode 100644
index a7ff6fd..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/RemoteLocatorResponse.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Set;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * 
- *
- */
-public class RemoteLocatorResponse implements DataSerializableFixedID{
-
-  private Set<String> locators ;
-
-  /** Used by DataSerializer */
-  public RemoteLocatorResponse() {
-    super();
-  }
-  
-  public RemoteLocatorResponse(Set<String> locators) {
-    this.locators = locators;
-  }
-  
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.locators = DataSerializer.readObject(in);
-  }
-
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeObject(this.locators, out);
-  }
-
-  public Set<String> getLocators() {
-    return this.locators;
-  }
-  
-  @Override
-  public String toString() {
-    return "RemoteLocatorResponse{locators=" + locators +"}";
-  }
-
-  public int getDSFID() {
-    return DataSerializableFixedID.REMOTE_LOCATOR_RESPONSE;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-     return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WANFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WANFactoryImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WANFactoryImpl.java
deleted file mode 100644
index 2844594..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WANFactoryImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
-import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
-import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
-import com.gemstone.gemfire.internal.DSFIDFactory;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.cache.wan.GatewayReceiverFactoryImpl;
-import com.gemstone.gemfire.internal.cache.wan.GatewaySenderFactoryImpl;
-import com.gemstone.gemfire.internal.cache.wan.spi.WANFactory;
-
-public class WANFactoryImpl implements WANFactory {
-  
-  @Override
-  public void initialize() {
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.REMOTE_LOCATOR_JOIN_REQUEST,
-        RemoteLocatorJoinRequest.class);
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.REMOTE_LOCATOR_JOIN_RESPONSE,
-        RemoteLocatorJoinResponse.class);
-    DSFIDFactory.registerDSFID(DataSerializableFixedID.REMOTE_LOCATOR_REQUEST,
-        RemoteLocatorRequest.class);
-    DSFIDFactory.registerDSFID(DataSerializableFixedID.LOCATOR_JOIN_MESSAGE,
-        LocatorJoinMessage.class);
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.REMOTE_LOCATOR_PING_REQUEST,
-        RemoteLocatorPingRequest.class);
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.REMOTE_LOCATOR_PING_RESPONSE,
-        RemoteLocatorPingResponse.class);
-    DSFIDFactory.registerDSFID(DataSerializableFixedID.REMOTE_LOCATOR_RESPONSE,
-        RemoteLocatorResponse.class);
-  }
-
-  @Override
-  public GatewaySenderFactory createGatewaySenderFactory(Cache cache) {
-    return new GatewaySenderFactoryImpl(cache);
-  }
-
-  @Override
-  public GatewayReceiverFactory createGatewayReceiverFactory(Cache cache) {
-    return new GatewayReceiverFactoryImpl(cache);
-  }
-
-  @Override
-  public WanLocatorDiscoverer createLocatorDiscoverer() {
-    return new WanLocatorDiscovererImpl();
-  }
-
-  @Override
-  public LocatorMembershipListener createLocatorMembershipListener() {
-    return new LocatorMembershipListenerImpl();
-  }
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java b/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java
deleted file mode 100644
index 1d44e65..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/cache/client/internal/locator/wan/WanLocatorDiscovererImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.client.internal.locator.wan;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
-import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
-import org.apache.logging.log4j.Logger;
-
-import java.util.StringTokenizer;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-public class WanLocatorDiscovererImpl implements WanLocatorDiscoverer{
-
-  private static final Logger logger = LogService.getLogger();
-
-  private volatile boolean stopped = false;
-  
-  private ExecutorService _executor;
-  
-  public WanLocatorDiscovererImpl() {
-    
-  }
-  
-  @Override
-  public void discover(int port,
-                       DistributionConfigImpl config,
-                       LocatorMembershipListener locatorListener,
-                       final String hostnameForClients) {
-    final LoggingThreadGroup loggingThreadGroup = LoggingThreadGroup
-        .createThreadGroup("WAN Locator Discovery Logger Group", logger);
-
-    final ThreadFactory threadFactory = new ThreadFactory() {
-      public Thread newThread(final Runnable task) {
-        final Thread thread = new Thread(loggingThreadGroup, task,
-            "WAN Locator Discovery Thread");
-        thread.setDaemon(true);
-        return thread;
-      }
-    };
-
-    this._executor = Executors.newCachedThreadPool(threadFactory);
-    exchangeLocalLocators(port, config, locatorListener, hostnameForClients);
-    exchangeRemoteLocators(port, config, locatorListener, hostnameForClients);
-    this._executor.shutdown();
-  }
-
-  @Override
-  public void stop() {
-    this.stopped = true;
-  }
-
-  @Override
-  public boolean isStopped() {
-    return this.stopped;
-  }
-
-  /**
-   * For WAN 70 Exchange the locator information within the distributed system
-   *
-   * @param config
-   * @param hostnameForClients
-   */
-  private void exchangeLocalLocators(int port,
-                                     DistributionConfigImpl config,
-                                     LocatorMembershipListener locatorListener,
-                                     final String hostnameForClients) {
-    String localLocator = config.getStartLocator();
-    DistributionLocatorId locatorId = null;
-    if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) {
-      locatorId = new DistributionLocatorId(port, config.getBindAddress(), hostnameForClients);
-    }
-    else {
-      locatorId = new DistributionLocatorId(localLocator);
-    }
-    LocatorHelper.addLocator(config.getDistributedSystemId(), locatorId, locatorListener, null);
-
-    RemoteLocatorJoinRequest request = buildRemoteDSJoinRequest(port, config, hostnameForClients);
-    StringTokenizer locatorsOnThisVM = new StringTokenizer(
-        config.getLocators(), ",");
-    while (locatorsOnThisVM.hasMoreTokens()) {
-      DistributionLocatorId localLocatorId = new DistributionLocatorId(
-          locatorsOnThisVM.nextToken());
-      if (!locatorId.equals(localLocatorId)) {
-        LocatorDiscovery localDiscovery = new LocatorDiscovery(this, localLocatorId, request, locatorListener);
-        LocatorDiscovery.LocalLocatorDiscovery localLocatorDiscovery = localDiscovery.new LocalLocatorDiscovery();
-        this._executor.execute(localLocatorDiscovery);
-      }
-    }
-  }
-  
-  /**
-   * For WAN 70 Exchange the locator information across the distributed systems
-   * (sites)
-   *
-   * @param config
-   * @param hostnameForClients
-   */
-  private void exchangeRemoteLocators(int port,
-                                      DistributionConfigImpl config,
-                                      LocatorMembershipListener locatorListener,
-                                      final String hostnameForClients) {
-    RemoteLocatorJoinRequest request = buildRemoteDSJoinRequest(port, config, hostnameForClients);
-    String remoteDistributedSystems = config.getRemoteLocators();
-    if (remoteDistributedSystems.length() > 0) {
-      StringTokenizer remoteLocators = new StringTokenizer(
-          remoteDistributedSystems, ",");
-      while (remoteLocators.hasMoreTokens()) {
-        DistributionLocatorId remoteLocatorId = new DistributionLocatorId(
-            remoteLocators.nextToken());
-        LocatorDiscovery localDiscovery = new LocatorDiscovery(this, remoteLocatorId,
-            request, locatorListener);
-        LocatorDiscovery.RemoteLocatorDiscovery remoteLocatorDiscovery = localDiscovery.new RemoteLocatorDiscovery();
-        this._executor.execute(remoteLocatorDiscovery);
-      }
-    }
-  }
-  
-  private RemoteLocatorJoinRequest buildRemoteDSJoinRequest(int port,
-                                                            DistributionConfigImpl config,
-                                                            final String hostnameForClients) {
-    String localLocator = config.getStartLocator();
-    DistributionLocatorId locatorId = null;
-    if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) {
-      locatorId = new DistributionLocatorId(port, config.getBindAddress(), hostnameForClients);
-    }
-    else {
-      locatorId = new DistributionLocatorId(localLocator);
-    }
-    RemoteLocatorJoinRequest request = new RemoteLocatorJoinRequest(
-        config.getDistributedSystemId(), locatorId, "");
-    return request;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/701c6861/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractRemoteGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractRemoteGatewaySender.java b/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractRemoteGatewaySender.java
deleted file mode 100644
index 163a611..0000000
--- a/geode-wan/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractRemoteGatewaySender.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.internal.cache.wan;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.client.internal.PoolImpl;
-import com.gemstone.gemfire.cache.client.internal.locator.wan.RemoteLocatorRequest;
-import com.gemstone.gemfire.cache.client.internal.locator.wan.RemoteLocatorResponse;
-import com.gemstone.gemfire.cache.wan.GatewayReceiver;
-import com.gemstone.gemfire.distributed.internal.WanLocatorDiscoverer;
-import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
-import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.net.ConnectException;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-public abstract class AbstractRemoteGatewaySender extends AbstractGatewaySender {
-  private static final Logger logger = LogService.getLogger();
-  
-  public AbstractRemoteGatewaySender() {
-    
-  }
-  public AbstractRemoteGatewaySender(Cache cache, GatewaySenderAttributes attrs){
-    super(cache, attrs);
-  }
-  
-  /** used to reduce warning logs in case remote locator is down (#47634) */ 
-  protected int proxyFailureTries = 0; 
-  
-  public synchronized void initProxy() {
-    // return if it is being used for WBCL or proxy is already created
-    if (this.remoteDSId == DEFAULT_DISTRIBUTED_SYSTEM_ID || this.proxy != null
-        && !this.proxy.isDestroyed()) {
-      return;
-    }
-
-    int locatorCount = 0;
-    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
-    pf.setPRSingleHopEnabled(false);
-    if (this.locatorDiscoveryCallback != null) {
-      pf.setLocatorDiscoveryCallback(locatorDiscoveryCallback);
-    }
-    pf.setReadTimeout(this.socketReadTimeout);
-    pf.setIdleTimeout(connectionIdleTimeOut);
-    pf.setSocketBufferSize(socketBufferSize);
-    pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
-    RemoteLocatorRequest request = new RemoteLocatorRequest(this.remoteDSId, pf
-        .getPoolAttributes().getServerGroup());
-    String locators = ((GemFireCacheImpl) this.cache).getDistributedSystem()
-        .getConfig().getLocators();
-    if (logger.isDebugEnabled()) {
-      logger.debug("Gateway Sender is attempting to configure pool with remote locator information");
-    }
-    StringTokenizer locatorsOnThisVM = new StringTokenizer(locators, ",");
-    while (locatorsOnThisVM.hasMoreTokens()) {
-      String localLocator = locatorsOnThisVM.nextToken();
-      DistributionLocatorId locatorID = new DistributionLocatorId(localLocator);
-      try {
-        RemoteLocatorResponse response = (RemoteLocatorResponse) new TcpClient()
-            .requestToServer(locatorID.getHost(), locatorID.getPort(), request,
-                WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
-
-        if (response != null) {
-          if (response.getLocators() == null) {
-            if (logProxyFailure()) {
-              logger.warn(LocalizedMessage.create(
-                  LocalizedStrings.AbstractGatewaySender_REMOTE_LOCATOR_FOR_REMOTE_SITE_0_IS_NOT_AVAILABLE_IN_LOCAL_LOCATOR_1,
-                      new Object[] { remoteDSId, localLocator }));
-            }
-            continue;
-          }
-          if (logger.isDebugEnabled()) {
-            logger.debug("Received the remote site {} location information:", this.remoteDSId, response.getLocators());
-          }
-          StringBuffer strBuffer = new StringBuffer();
-          Iterator<String> itr = response.getLocators().iterator();
-          while (itr.hasNext()) {
-            DistributionLocatorId locatorId = new DistributionLocatorId(itr.next());
-            pf.addLocator(locatorId.getHost().getHostName(), locatorId.getPort());
-            locatorCount++;
-          }
-          break;
-        }
-      } catch (IOException ioe) {
-        if (logProxyFailure()) {
-          // don't print stack trace for connection failures
-          String ioeStr = "";
-          if (!logger.isDebugEnabled() && ioe instanceof ConnectException) {
-            ioeStr = ": " + ioe.toString();
-            ioe = null;
-          }
-        logger.warn(LocalizedMessage.create(
-            LocalizedStrings.AbstractGatewaySender_SENDER_0_IS_NOT_ABLE_TO_CONNECT_TO_LOCAL_LOCATOR_1,
-                new Object[] { this.id, localLocator + ioeStr  }), ioe);        
-        }
-        continue;
-      } catch (ClassNotFoundException e) {
-        if (logProxyFailure()) {
-          logger.warn(LocalizedMessage.create(
-              LocalizedStrings.AbstractGatewaySender_SENDER_0_IS_NOT_ABLE_TO_CONNECT_TO_LOCAL_LOCATOR_1,
-                  new Object[] { this.id, localLocator }), e);
-        }
-        continue;
-      }
-    }
-
-    if (locatorCount == 0) {
-      if (logProxyFailure()) {
-        logger.fatal(LocalizedMessage.create(
-            LocalizedStrings.AbstractGatewaySender_SENDER_0_COULD_NOT_GET_REMOTE_LOCATOR_INFORMATION_FOR_SITE_1,
-                new Object[] { this.id, this.remoteDSId }));
-      }
-      this.proxyFailureTries++;
-      throw new GatewaySenderConfigurationException(
-          LocalizedStrings.AbstractGatewaySender_SENDER_0_COULD_NOT_GET_REMOTE_LOCATOR_INFORMATION_FOR_SITE_1
-              .toLocalizedString(new Object[] { this.id, this.remoteDSId}));
-    }
-    pf.init(this);
-    this.proxy = ((PoolImpl) pf.create(this.getId()));
-    if (this.proxyFailureTries > 0) {
-      logger.info(LocalizedMessage.create(LocalizedStrings.AbstractGatewaySender_SENDER_0_GOT_REMOTE_LOCATOR_INFORMATION_FOR_SITE_1,
-              new Object[] { this.id, this.remoteDSId, this.proxyFailureTries }));
-      this.proxyFailureTries = 0;
-    }
-  }
-  
-  protected boolean logProxyFailure() {
-    assert Thread.holdsLock(this);
-    // always log the first failure
-    if (logger.isDebugEnabled() || this.proxyFailureTries == 0) {
-      return true;
-    } else {
-      // subsequent failures will be logged on 30th, 300th, 3000th try
-      // each try is at 100millis from higher layer so this accounts for logging
-      // after 3s, 30s and then every 5mins
-      if (this.proxyFailureTries >= 3000) {
-        return (this.proxyFailureTries % 3000) == 0;
-      } else {
-        return (this.proxyFailureTries == 30 || this.proxyFailureTries == 300);
-      }
-    }
-  }
-}


[02/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java
new file mode 100644
index 0000000..609885d
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandPauseResumeDUnitTest.java
@@ -0,0 +1,688 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandPauseResumeDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  @Test
+  public void testPauseGatewaySender_ErrorConditions() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
+        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.PAUSE_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
+        + " --" + CliStrings.PAUSE_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a member
+   */
+  @Test
+  public void testPauseGatewaySender_onMember() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    pause(10000);
+    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
+        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.PAUSE_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is paused on member"));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+  }
+
+  @Test
+  public void testPauseGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+            2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createSender( "ln",
+            2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createSender( "ln",
+            2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+            "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+            "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+            "ln", true, false ));
+
+    pause(10000);
+    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
+            + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+              "testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+              .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+            "ln", true, true ));
+    vm4.invoke(() -> verifySenderState(
+            "ln", true, true ));
+    vm5.invoke(() -> verifySenderState(
+            "ln", true, true ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a group of members
+   */
+  @Test
+  public void testPauseGatewaySender_Group() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    pause(10000);
+    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
+        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.PAUSE_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testPauseGatewaySender_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, true ));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more
+   * sender members belongs to multiple groups
+   */
+  @Test
+  public void testPauseGatewaySender_MultipleGroup() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1, SenderGroup2" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm6.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup2" ));
+    vm6.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm7.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup3" ));
+    vm7.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+    vm6.invoke(() -> startSender( "ln" ));
+    vm7.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    pause(10000);
+    String command = CliStrings.PAUSE_GATEWAYSENDER + " --"
+        + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.PAUSE_GATEWAYSENDER__GROUP + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testPauseGatewaySender_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  @Test
+  public void testResumeGatewaySender_ErrorConditions() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
+        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.RESUME_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
+        + " --" + CliStrings.RESUME_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testResumeGatewaySender_ErrorConditions stringResult : "
+              + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testResumeGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    vm3.invoke(() -> pauseSender( "ln" ));
+    vm4.invoke(() -> pauseSender( "ln" ));
+    vm5.invoke(() -> pauseSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, true ));
+
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
+        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a member
+   */
+  @Test
+  public void testResumeGatewaySender_onMember() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    vm3.invoke(() -> pauseSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
+        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.RESUME_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is resumed on member"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a group of members
+   */
+  @Test
+  public void testResumeGatewaySender_Group() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    vm3.invoke(() -> pauseSender( "ln" ));
+    vm4.invoke(() -> pauseSender( "ln" ));
+    vm5.invoke(() -> pauseSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, true ));
+
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
+        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.RESUME_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more
+   * sender members belongs to multiple groups
+   */
+  @Test
+  public void testResumeGatewaySender_MultipleGroup() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1, SenderGroup2" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm6.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup2" ));
+    vm6.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm7.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup3" ));
+    vm7.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+    vm6.invoke(() -> startSender( "ln" ));
+    vm7.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    vm3.invoke(() -> pauseSender( "ln" ));
+    vm4.invoke(() -> pauseSender( "ln" ));
+    vm5.invoke(() -> pauseSender( "ln" ));
+    vm6.invoke(() -> pauseSender( "ln" ));
+    vm7.invoke(() -> pauseSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, true ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, true ));
+
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --"
+        + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.RESUME_GATEWAYSENDER__GROUP
+        + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, true ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java
new file mode 100644
index 0000000..9271614
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandStatusDUnitTest.java
@@ -0,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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandStatusDUnitTest extends WANCommandTestBase{
+  
+  private static final long serialVersionUID = 1L;
+
+  @Test
+  public void testGatewaySenderStatus(){
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+    
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createCache( lnPort ));
+    vm3.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, true ));
+    vm3.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+
+    vm4.invoke(() -> createCache( lnPort ));
+    vm4.invoke(() -> createSender(
+      "ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    
+    vm5.invoke(() -> createCache( lnPort ));
+    vm5.invoke(() -> createSender(
+      "ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      
+      tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+      
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewaySenderStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    
+    vm3.invoke(() -> startSender( "ln_Serial" ));
+    vm3.invoke(() -> startSender( "ln_Parallel" ));
+
+    vm4.invoke(() -> startSender( "ln_Serial" ));
+    vm4.invoke(() -> startSender( "ln_Parallel" ));
+
+    vm5.invoke(() -> startSender( "ln_Serial" ));
+    vm5.invoke(() -> startSender( "ln_Parallel" ));
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial";
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      
+      tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+      
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewaySenderStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewaySenderStatus_OnMember(){
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createCache( lnPort ));
+    vm3.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, true ));
+    vm3.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+
+    vm4.invoke(() -> createCache( lnPort ));
+    vm4.invoke(() -> createSender(
+      "ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    
+    vm5.invoke(() -> createCache( lnPort ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --"
+        + CliStrings.STATUS_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
+    
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
+      TabularResultData tableResultData =
+          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+        
+    
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    
+    vm3.invoke(() -> startSender( "ln_Serial" ));
+    vm3.invoke(() -> startSender( "ln_Parallel" ));
+
+    vm4.invoke(() -> startSender( "ln_Serial" ));
+    vm4.invoke(() -> startSender( "ln_Parallel" ));
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --"
+        + CliStrings.STATUS_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
+    
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+//      TabularResultData tableResultData =
+//        (TabularResultData) cmdResult.getResultData();
+//      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+//      assertIndexDetailsEquals(1, result_Status.size());
+//      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
+      TabularResultData tableResultData =
+          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    
+    final DistributedMember vm5Member = (DistributedMember) vm5.invoke(() -> getMember());
+   
+    command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --"
+        + CliStrings.STATUS_GATEWAYSENDER__MEMBER + "=" + vm5Member.getId();
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+//      ErrorResultData errorResultData =
+//        (ErrorResultData) cmdResult.getResultData();
+      assertTrue(cmdResult != null);
+      
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewaySenderStatus_OnGroups(){
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm7.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createCacheWithGroups( lnPort, "Serial_Sender, Parallel_Sender"));
+    vm3.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, true ));
+    vm3.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+
+    vm4.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender, Parallel_Sender"));
+    vm4.invoke(() -> createSender(
+      "ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    
+    vm5.invoke(() -> createCacheWithGroups( lnPort,"Parallel_Sender"));
+    vm5.invoke(() -> createSender(
+      "ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, true));
+
+    vm6.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender"));
+    
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --" + CliStrings.STATUS_GATEWAYSENDER__GROUP + "=Serial_Sender";
+    
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(2, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      
+      tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(1, result_hosts.size());
+      
+      
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewaySenderStatus_OnGroups : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    
+    vm3.invoke(() -> startSender( "ln_Serial" ));
+    vm3.invoke(() -> startSender( "ln_Parallel" ));
+
+    vm4.invoke(() -> startSender( "ln_Serial" ));
+    vm4.invoke(() -> startSender( "ln_Parallel" ));
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --"
+    + CliStrings.STATUS_GATEWAYSENDER__ID + "=ln_Serial --" + CliStrings.STATUS_GATEWAYSENDER__GROUP + "=Serial_Sender";
+    
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(2, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      
+      tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(1, result_hosts.size());
+      
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewaySenderStatus_OnGroups : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewayReceiverStatus(){
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createAndStartReceiver( lnPort ));
+    vm4.invoke(() -> createAndStartReceiver( lnPort ));
+    vm5.invoke(() -> createAndStartReceiver( lnPort ));
+    
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYRECEIVER; 
+    CommandResult cmdResult = executeCommand(command);
+    
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      
+      tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+      
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+    
+    vm3.invoke(() -> stopReceiver());
+    vm4.invoke(() -> stopReceiver());
+    vm5.invoke(() -> stopReceiver());
+    
+    pause(10000);
+    
+    command = CliStrings.STATUS_GATEWAYRECEIVER; 
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      
+      tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+      
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewayReceiverStatus_OnMember(){
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createAndStartReceiver( lnPort ));
+    vm4.invoke(() -> createAndStartReceiver( lnPort ));
+    vm5.invoke(() -> createAndStartReceiver( lnPort ));
+    
+    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
+    
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYRECEIVER+ " --"
+    + CliStrings.STATUS_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
+    
+    CommandResult cmdResult = executeCommand(command);
+    
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      //TabularResultData tableResultData = (TabularResultData) cmdResult.getResultData();
+      //List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      //assertIndexDetailsEquals(1, result_Status.size());
+      //assertFalse(strCmdResult.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      TabularResultData tableResultData =
+          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+    
+    vm3.invoke(() -> stopReceiver());
+    vm4.invoke(() -> stopReceiver());
+    vm5.invoke(() -> stopReceiver());
+    
+    pause(10000);
+    
+    command = CliStrings.STATUS_GATEWAYRECEIVER+ " --"
+    + CliStrings.STATUS_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
+    
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      
+//      TabularResultData tableResultData =
+//        (TabularResultData) cmdResult.getResultData();
+//      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+//      assertIndexDetailsEquals(1, result_Status.size());
+//      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      
+      TabularResultData tableResultData =
+          ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewayReceiverStatus_OnGroups(){
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm7.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG1, RG2" ));
+    vm4.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG1, RG2"  ));
+    vm5.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG1"  ));
+    vm6.invoke(() -> createAndStartReceiverWithGroup( lnPort, "RG2"  ));
+    
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYRECEIVER + " --"
+        + CliStrings.STATUS_GATEWAYRECEIVER__GROUP + "=RG1";
+    
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+    
+    vm3.invoke(() -> stopReceiver());
+    vm4.invoke(() -> stopReceiver());
+    vm5.invoke(() -> stopReceiver());
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYRECEIVER + " --"+ CliStrings.STATUS_GATEWAYRECEIVER__GROUP + "=RG1";
+    
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testGatewayReceiverStatus_OnGroups : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/management/WANManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/WANManagementDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/WANManagementDUnitTest.java
new file mode 100644
index 0000000..c21cf26
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/management/WANManagementDUnitTest.java
@@ -0,0 +1,513 @@
+/*
+ * 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.management;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+
+/**
+ * Tests for WAN artifacts like Sender and Receiver. The purpose of this test is
+ * not to check WAN functionality , but to verify ManagementServices running
+ * properly and reflecting WAN behaviour and data properly
+ * 
+ * 
+ */
+@Category(DistributedTest.class)
+public class WANManagementDUnitTest extends ManagementTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+   
+  public static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
+
+  public WANManagementDUnitTest() throws Exception {
+    super();
+    }
+
+  @Test
+  public void testMBeanCallback() throws Exception {
+
+    VM nyLocator =   getManagedNodeList().get(0);
+    VM nyReceiver =  getManagedNodeList().get(1);
+    VM puneSender =  getManagedNodeList().get(2);
+    VM managing =    getManagingNode();
+    VM puneLocator = Host.getLocator();
+    
+    int punePort = (Integer) puneLocator.invoke(() -> WANManagementDUnitTest.getLocatorPort());
+
+    Integer nyPort = (Integer)nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
+    
+ 
+
+    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
+    managing.invoke(() -> WANTestBase.createManagementCache( punePort ));
+    startManagingNode(managing);
+
+    // keep a larger batch to minimize number of exception occurrences in the
+    // log
+    puneSender.invoke(() -> WANTestBase.createSender( "pn",
+        12, true, 100, 300, false, false, null, true ));
+    managing.invoke(() -> WANTestBase.createSender( "pn",
+      12, true, 100, 300, false, false, null, true ));
+
+
+    puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
+    managing.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
+    
+    nyReceiver.invoke(() -> WANTestBase.createCache( nyPort ));
+    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
+    nyReceiver.invoke(() -> WANTestBase.createReceiver());
+
+    WANTestBase.startSenderInVMs("pn", puneSender, managing);
+
+    // make sure all the senders are running before doing any puts
+    puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
+    managing.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
+
+    
+ 
+    
+    checkSenderMBean(puneSender, getTestMethodName() + "_PR");
+    checkSenderMBean(managing, getTestMethodName() + "_PR");
+    
+    checkReceiverMBean(nyReceiver);
+    
+    stopGatewaySender(puneSender);
+    startGatewaySender(puneSender);
+    
+    DistributedMember puneMember = (DistributedMember) puneSender.invoke(() -> WANManagementDUnitTest.getMember());
+
+    checkProxySender(managing, puneMember);
+    checkSenderNavigationAPIS(managing, puneMember);
+
+  }
+  
+  @Test
+  public void testReceiverMBean() throws Exception {
+
+    VM nyLocator = getManagedNodeList().get(0);
+    VM nyReceiver = getManagedNodeList().get(1);
+    VM puneSender = getManagedNodeList().get(2);
+    VM managing = getManagingNode();
+    VM puneLocator = Host.getLocator();
+
+    int punePort = (Integer) puneLocator.invoke(() -> WANManagementDUnitTest.getLocatorPort());
+
+    Integer nyPort = (Integer) nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
+
+    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
+
+    nyReceiver.invoke(() -> WANTestBase.createCache( nyPort ));
+    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
+    nyReceiver.invoke(() -> WANTestBase.createReceiver());
+
+    // keep a larger batch to minimize number of exception occurrences in the
+    // log
+    puneSender.invoke(() -> WANTestBase.createSender( "pn",
+        12, true, 100, 300, false, false, null, true ));
+
+    puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", "pn", 1, 100, false ));
+
+    puneSender.invoke(() -> WANTestBase.startSender( "pn" ));
+
+    // make sure all the senders are running before doing any puts
+    puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
+
+    managing.invoke(() -> WANTestBase.createManagementCache( nyPort ));
+    startManagingNode(managing);
+
+
+    checkSenderMBean(puneSender, getTestMethodName() + "_PR");
+    checkReceiverMBean(nyReceiver);
+
+    DistributedMember nyMember = (DistributedMember) nyReceiver.invoke(() -> WANManagementDUnitTest.getMember());
+
+    checkProxyReceiver(managing, nyMember);
+    checkReceiverNavigationAPIS(managing, nyMember);
+    
+
+  }
+  
+  
+  @Test
+  public void testAsyncEventQueue() throws Exception {
+    
+    VM nyLocator =   getManagedNodeList().get(0);
+    VM nyReceiver =  getManagedNodeList().get(1);
+    VM puneSender =  getManagedNodeList().get(2);
+    VM managing =    getManagingNode();
+    VM puneLocator = Host.getLocator();
+    
+    int punePort = (Integer) puneLocator.invoke(() -> WANManagementDUnitTest.getLocatorPort());
+
+    Integer nyPort = (Integer)nyLocator.invoke(() -> WANTestBase.createFirstRemoteLocator( 12, punePort ));
+    
+ 
+
+    puneSender.invoke(() -> WANTestBase.createCache( punePort ));
+    managing.invoke(() -> WANTestBase.createManagementCache( punePort ));
+    startManagingNode(managing);
+
+
+    puneSender.invoke(() -> WANTestBase.createAsyncEventQueue(
+      "pn", false, 100, 100, false, false, "puneSender", false ));
+    managing.invoke(() -> WANTestBase.createAsyncEventQueue(
+      "pn", false, 100, 100, false, false, "managing", false ));
+
+
+    puneSender.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
+      getTestMethodName() + "_RR", "pn", false ));
+    managing.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
+      getTestMethodName() + "_RR", "pn", false ));
+
+    WANTestBase.createCacheInVMs(nyPort, nyReceiver);
+    nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR", null, 1, 100, false ));
+    nyReceiver.invoke(() -> WANTestBase.createReceiver());
+
+    checkAsyncQueueMBean(puneSender);
+    checkAsyncQueueMBean(managing);
+    
+    
+    DistributedMember puneMember = (DistributedMember) puneSender.invoke(() -> WANManagementDUnitTest.getMember());
+
+    checkProxyAsyncQueue(managing, puneMember);
+    
+  }
+
+  
+  @SuppressWarnings("serial")
+  protected void checkSenderNavigationAPIS(final VM vm,
+      final DistributedMember senderMember) {
+    SerializableRunnable checkNavigationAPIS = new SerializableRunnable(
+        "Check Sender Navigation APIs") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
+        ObjectName expectedName = service.getGatewaySenderMBeanName(
+            senderMember, "pn");
+        try {
+          ObjectName actualName = bean.fetchGatewaySenderObjectName(
+              senderMember.getId(), "pn");
+          assertEquals(expectedName, actualName);
+        } catch (Exception e) {
+          fail("Sender Navigation Failed " + e);
+        }
+
+        assertEquals(2, bean.listGatewaySenderObjectNames().length);
+        try {
+          assertEquals(1, bean.listGatewaySenderObjectNames(senderMember
+              .getId()).length);
+        } catch (Exception e) {
+          fail("Sender Navigation Failed " + e);
+        }
+
+      }
+    };
+    vm.invoke(checkNavigationAPIS);
+  }
+
+  @SuppressWarnings("serial")
+  protected void checkReceiverNavigationAPIS(final VM vm,
+      final DistributedMember receiverMember) {
+    SerializableRunnable checkNavigationAPIS = new SerializableRunnable(
+        "Check Receiver Navigation APIs") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
+        ObjectName expectedName = service
+            .getGatewayReceiverMBeanName(receiverMember);
+        try {
+          ObjectName actualName = bean
+              .fetchGatewayReceiverObjectName(receiverMember.getId());
+          assertEquals(expectedName, actualName);
+        } catch (Exception e) {
+          fail("Receiver Navigation Failed " + e);
+        }
+
+        assertEquals(1, bean.listGatewayReceiverObjectNames().length);
+
+      }
+    };
+    vm.invoke(checkNavigationAPIS);
+  }
+    
+  private static int getLocatorPort(){
+    return Locator.getLocators().get(0).getPort();
+  }
+  private static DistributedMember getMember(){
+    return GemFireCacheImpl.getInstance().getMyId();
+  }
+  
+  /**
+   * Checks Proxy GatewaySender
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkProxySender(final VM vm, final DistributedMember senderMember) {
+    SerializableRunnable checkProxySender = new SerializableRunnable("Check Proxy Sender") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+        .getManagementService(cache);
+        GatewaySenderMXBean bean = null;
+        try {
+          bean = MBeanUtil.getGatewaySenderMbeanProxy(senderMember, "pn");
+        } catch (Exception e) {
+          fail("Could not obtain Sender Proxy in desired time " + e);
+        }
+        assertNotNull(bean);
+        final ObjectName senderMBeanName = service.getGatewaySenderMBeanName(
+            senderMember, "pn");
+        try {
+          MBeanUtil.printBeanDetails(senderMBeanName);
+        } catch (Exception e) {
+          fail("Error while Printing Bean Details " + e);
+        }
+        
+        if(service.isManager()){
+          DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
+          Map<String, Boolean> dsMap = dsBean.viewRemoteClusterStatus();
+          
+          LogWriterUtils.getLogWriter().info(
+              "<ExpectedString> Ds Map is: " + dsMap
+                  + "</ExpectedString> ");
+          
+        }
+
+      }
+    };
+    vm.invoke(checkProxySender);
+  }
+  
+  /**
+   * Checks Proxy GatewayReceiver
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkProxyReceiver(final VM vm,
+      final DistributedMember senderMember) {
+    SerializableRunnable checkProxySender = new SerializableRunnable(
+        "Check Proxy Receiver") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        GatewayReceiverMXBean bean = null;
+        try {
+          bean = MBeanUtil.getGatewayReceiverMbeanProxy(senderMember);
+        } catch (Exception e) {
+          fail("Could not obtain Sender Proxy in desired time " + e);
+        }
+        assertNotNull(bean);
+        final ObjectName receiverMBeanName = service
+            .getGatewayReceiverMBeanName(senderMember);
+        try {
+          MBeanUtil.printBeanDetails(receiverMBeanName);
+        } catch (Exception e) {
+          fail("Error while Printing Bean Details " + e);
+        }
+
+      }
+    };
+    vm.invoke(checkProxySender);
+  }
+  
+  
+  /**
+   * stops a gateway sender
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void stopGatewaySender(final VM vm) {
+    SerializableRunnable stopGatewaySender = new SerializableRunnable("Stop Gateway Sender") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+        .getManagementService(cache);
+        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
+        assertNotNull(bean);
+        bean.stop();
+        assertFalse(bean.isRunning());
+      }
+    };
+    vm.invoke(stopGatewaySender);
+  }
+  
+  /**
+   * start a gateway sender
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void startGatewaySender(final VM vm) {
+    SerializableRunnable stopGatewaySender = new SerializableRunnable("Start Gateway Sender") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+        .getManagementService(cache);
+        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
+        assertNotNull(bean);
+        bean.start();
+        assertTrue(bean.isRunning());
+      }
+    };
+    vm.invoke(stopGatewaySender);
+  }
+
+
+ 
+  /**
+   * Checks whether a GatewayReceiverMBean is created or not
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkReceiverMBean(final VM vm) {
+    SerializableRunnable checkMBean = new SerializableRunnable("Check Receiver MBean") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+        .getManagementService(cache);
+        GatewayReceiverMXBean bean = service.getLocalGatewayReceiverMXBean();
+        assertNotNull(bean);
+      }
+    };
+    vm.invoke(checkMBean);
+  }
+
+  /**
+   * Checks whether a GatewayReceiverMBean is created or not
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkSenderMBean(final VM vm, final String regionPath) {
+    SerializableRunnable checkMBean = new SerializableRunnable("Check Sender MBean") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+
+        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
+        assertNotNull(bean);
+        assertTrue(bean.isConnected());
+
+        ObjectName regionBeanName = service.getRegionMBeanName(cache
+            .getDistributedSystem().getDistributedMember(), "/" + regionPath);
+        RegionMXBean rBean = service.getMBeanInstance(regionBeanName,
+            RegionMXBean.class);
+        assertTrue(rBean.isGatewayEnabled());
+        
+       
+      }
+    };
+    vm.invoke(checkMBean);
+  }
+  
+  /**
+   * Checks whether a Async Queue MBean is created or not
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkAsyncQueueMBean(final VM vm) {
+    SerializableRunnable checkAsyncQueueMBean = new SerializableRunnable(
+        "Check Async Queue MBean") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        AsyncEventQueueMXBean bean = service.getLocalAsyncEventQueueMXBean("pn");
+        assertNotNull(bean);
+        // Already in started State
+      }
+    };
+    vm.invoke(checkAsyncQueueMBean);
+  }
+
+  /**
+   * Checks Proxy Async Queue
+   * 
+   * @param vm
+   *          reference to VM
+   */
+  @SuppressWarnings("serial")
+  protected void checkProxyAsyncQueue(final VM vm,
+      final DistributedMember senderMember) {
+    SerializableRunnable checkProxyAsyncQueue = new SerializableRunnable(
+        "Check Proxy Async Queue") {
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        ManagementService service = ManagementService
+            .getManagementService(cache);
+        AsyncEventQueueMXBean bean = null;
+        try {
+          bean = MBeanUtil.getAsyncEventQueueMBeanProxy(senderMember, "pn");
+        } catch (Exception e) {
+          fail("Could not obtain Sender Proxy in desired time " + e);
+        }
+        assertNotNull(bean);
+        final ObjectName queueMBeanName = service.getAsyncEventQueueMBeanName(
+            senderMember, "pn");
+
+        try {
+          MBeanUtil.printBeanDetails(queueMBeanName);
+        } catch (Exception e) {
+          fail("Error while Printing Bean Details " + e);
+        }
+
+      }
+    };
+    vm.invoke(checkProxyAsyncQueue);
+  }
+}


[04/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
new file mode 100644
index 0000000..9b0953e
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
@@ -0,0 +1,630 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+
+/**
+ * DUnit tests for 'create gateway-receiver' command.
+ */
+@Category(DistributedTest.class)
+public class WanCommandCreateGatewayReceiverDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * GatewayReceiver with all default attributes
+   */
+  @Test
+  public void testCreateGatewayReceiverWithDefault() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(4, status.size());//expected size 4 includes the manager node
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START,
+            GatewayReceiver.DEFAULT_START_PORT,
+            GatewayReceiver.DEFAULT_END_PORT,
+            GatewayReceiver.DEFAULT_BIND_ADDRESS,
+            GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+            GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START,
+            GatewayReceiver.DEFAULT_START_PORT,
+            GatewayReceiver.DEFAULT_END_PORT,
+            GatewayReceiver.DEFAULT_BIND_ADDRESS,
+            GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+            GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null ));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START,
+            GatewayReceiver.DEFAULT_START_PORT,
+            GatewayReceiver.DEFAULT_END_PORT,
+            GatewayReceiver.DEFAULT_BIND_ADDRESS,
+            GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+            GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null ));
+  }
+
+  /**
+   * GatewayReceiver with given attributes
+   */
+  @Test
+  public void testCreateGatewayReceiver() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART+ "=true"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(4, status.size());//expected size 4 includes the manager node
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+  }
+  
+  /**
+   * GatewayReceiver with given attributes and a single GatewayTransportFilter.
+   */
+  @Test
+  public void testCreateGatewayReceiverWithGatewayTransportFilter() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART+ "=false"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER + "=com.gemstone.gemfire.cache30.MyGatewayTransportFilter1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(4, status.size());//expected size 4 includes the manager node
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    List<String> transportFilters = new ArrayList<String>();
+    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter1");
+    
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( true, 10000,
+            11000, "localhost", 100000, 512000, transportFilters ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( true, 10000,
+            11000, "localhost", 100000, 512000, transportFilters ));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes( true, 10000,
+            11000, "localhost", 100000, 512000, transportFilters ));
+  }
+  
+  /**
+   * GatewayReceiver with given attributes and multiple GatewayTransportFilters.
+   */
+  @Test
+  public void testCreateGatewayReceiverWithMultipleGatewayTransportFilters() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER + " --"
+        + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost" + " --"
+        + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --"
+        + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
+        + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE
+        + "=512000" + " --"
+        + CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER
+        + "=com.gemstone.gemfire.cache30.MyGatewayTransportFilter1,com.gemstone.gemfire.cache30.MyGatewayTransportFilter2";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(4, status.size());//expected size 4 includes the manager node
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    List<String> transportFilters = new ArrayList<String>();
+    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter1");
+    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter2");
+    
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START, 10000,
+            11000, "localhost", 100000, 512000, transportFilters ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START, 10000,
+            11000, "localhost", 100000, 512000, transportFilters ));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes( !GatewayReceiver.DEFAULT_MANUAL_START, 10000,
+            11000, "localhost", 100000, 512000, transportFilters ));
+  }
+
+  /**
+   * GatewayReceiver with given attributes.
+   * Error scenario where startPort is greater than endPort.
+   */
+  @Test
+  public void testCreateGatewayReceiver_Error() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(4, status.size());// expected size 4 includes the manager
+                                     // node
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation should have failed", status.get(i)
+            .indexOf("ERROR:") != -1);
+      }
+    } else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+  }
+
+  /**
+   * GatewayReceiver with given attributes on the given member.
+   */
+  @Test
+  public void testCreateGatewayReceiver_onMember() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+    
+    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(1, status.size());
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+  }
+
+  /**
+   * GatewayReceiver with given attributes on multiple members.
+   */
+  @Test
+  public void testCreateGatewayReceiver_onMultipleMembers() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+    
+    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
+    final DistributedMember vm4Member = (DistributedMember) vm4.invoke(() -> getMember());
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId() + "," + vm4Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(2, status.size());
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+  }
+  
+  /**
+   * GatewayReceiver with given attributes on the given group.
+   */
+  @Test
+  public void testCreateGatewayReceiver_onGroup() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+    vm4.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+    vm5.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(3, status.size());//
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+  }
+
+  /**
+   * GatewayReceiver with given attributes on the given group.
+   * Only 2 of 3 members are part of the group.
+   */
+  @Test
+  public void testCreateGatewayReceiver_onGroup_Scenario2() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+    vm4.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+    vm5.invoke(() -> createCacheWithGroups( punePort, "receiverGroup2" ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(2, status.size());//
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+  }
+
+  /**
+   * GatewayReceiver with given attributes on multiple groups.
+   */
+  @Test
+  public void testCreateGatewayReceiver_onMultipleGroups() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer)puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer)vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+    vm4.invoke(() -> createCacheWithGroups( punePort, "receiverGroup1" ));
+    vm5.invoke(() -> createCacheWithGroups( punePort, "receiverGroup2" ));
+
+    String command = CliStrings.CREATE_GATEWAYRECEIVER 
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000"
+        + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1,receiverGroup2";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData)cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(3, status.size());//
+      // verify there is no error in the status
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewayReceiver creation failed with: " + status.get(i),
+            status.get(i).indexOf("ERROR:") == -1);
+      }
+    }
+    else {
+      fail("testCreateGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes( false, 10000,
+            11000, "localhost", 100000, 512000, null ));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
new file mode 100644
index 0000000..c084e76
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
@@ -0,0 +1,706 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+
+@Category(DistributedTest.class)
+public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
+  
+  private static final long serialVersionUID = 1L;
+
+  private CommandResult executeCommandWithIgnoredExceptions(String command) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      CommandResult commandResult = executeCommand(command);
+      return commandResult;
+    } finally {
+      exln.remove();
+    }
+  }
+
+
+  /**
+   * GatewaySender with all default attributes
+   */
+  @Test
+  public void testCreateGatewaySenderWithDefault() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(5, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+  
+  /**
+   * GatewaySender with given attribute values
+   */
+  @Test
+  public void testCreateGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";   
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(5, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    
+    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
+    vm4.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
+    vm5.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
+  }
+
+  /**
+   * GatewaySender with given attribute values.
+   * Error scenario where dispatcher threads is set to more than 1 and 
+   * no order policy provided.
+   */
+  @Test
+  public void testCreateGatewaySender_Error() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(5, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation should fail", status.get(i).indexOf("ERROR:") != -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+  }
+
+  /**
+   * GatewaySender with given attribute values and event filters.
+   */
+  @Test
+  public void testCreateGatewaySenderWithGatewayEventFilters() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__GATEWAYEVENTFILTER + 
+        "=com.gemstone.gemfire.cache30.MyGatewayEventFilter1,com.gemstone.gemfire.cache30.MyGatewayEventFilter2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(5, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    
+    List<String> eventFilters = new ArrayList<String>();
+    eventFilters.add("com.gemstone.gemfire.cache30.MyGatewayEventFilter1");
+    eventFilters.add("com.gemstone.gemfire.cache30.MyGatewayEventFilter2");
+    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, eventFilters, null ));
+    vm4.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, eventFilters, null ));
+    vm5.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, eventFilters, null ));
+  }
+
+  /**
+   * GatewaySender with given attribute values and transport filters.
+   */
+  @Test
+  public void testCreateGatewaySenderWithGatewayTransportFilters() {
+
+    Integer punePort = (Integer) vm1.invoke(() ->createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER + "=com.gemstone.gemfire.cache30.MyGatewayTransportFilter1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(5, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    
+    List<String> transportFilters = new ArrayList<String>();
+    transportFilters.add("com.gemstone.gemfire.cache30.MyGatewayTransportFilter1");
+    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters ));
+    vm4.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters ));
+    vm5.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters ));
+  }
+
+  /**
+   * GatewaySender with given attribute values on given member.
+   */
+  @Test
+  public void testCreateGatewaySender_OnMember() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+    
+    final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MEMBER + "=" + vm3Member.getId()
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(1, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    
+    vm3.invoke(() -> verifySenderAttributes( "ln", 2, false, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, 2, OrderPolicy.THREAD, null, null ));
+  }
+
+  /**
+   * GatewaySender with given attribute values on given group
+   */
+  @Test
+  public void testCreateGatewaySender_Group() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__GROUP + "=SenderGroup1"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(3, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+  
+  /**
+   * GatewaySender with given attribute values on given group.
+   * Only 2 of 3 members are part of the group.
+   */
+  @Test
+  public void testCreateGatewaySender_Group_Scenario2() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createCacheWithGroups( punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createCacheWithGroups( punePort, "SenderGroup2" ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__GROUP + "=SenderGroup1"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(2, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+  
+  /**
+   * Parallel GatewaySender with given attribute values
+   */
+  @Test
+  public void testCreateParallelGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" 
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Status");
+      assertEquals(5, status.size());
+      for (int i = 0; i < status.size(); i++) {
+        assertTrue("GatewaySender creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
+      }
+    } else {
+      fail("testCreateGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    
+    vm3.invoke(() -> verifySenderAttributes( "ln", 2, true, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, GatewaySender.DEFAULT_DISPATCHER_THREADS, null, null, null ));
+    vm4.invoke(() -> verifySenderAttributes( "ln", 2, true, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, GatewaySender.DEFAULT_DISPATCHER_THREADS, null, null, null ));
+    vm5.invoke(() -> verifySenderAttributes( "ln", 2, true, true, 1000, socketReadTimeout, true, 1000, 5000,
+            true, false, 1000, 100, GatewaySender.DEFAULT_DISPATCHER_THREADS, null, null, null ));
+  }
+  
+  /**
+   * Parallel GatewaySender with given attribute values.
+   * Provide dispatcherThreads as 2 which is not valid for Parallel sender.
+   */
+  @Test
+  public void testCreateParallelGatewaySender_Error() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort
+        + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+
+    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT+1000;
+    String command = CliStrings.CREATE_GATEWAYSENDER + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ID + "=ln" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=true" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true"
+        + " --" + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" + " --"
+        + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD";
+    IgnoredException exp = IgnoredException.addIgnoredException(GatewaySenderException.class
+        .getName());
+    try {
+      CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+      if (cmdResult != null) {
+        String strCmdResult = commandResultToString(cmdResult);
+        getLogWriter().info(
+            "testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
+        assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+        TabularResultData resultData = (TabularResultData) cmdResult
+            .getResultData();
+        List<String> status = resultData.retrieveAllValues("Status");
+        assertEquals(5, status.size());
+        for (int i = 0; i < status.size(); i++) {
+          assertTrue("GatewaySender creation should have failed", status.get(i)
+              .indexOf("ERROR:") != -1);
+        }
+      } else {
+        fail("testCreateGatewaySender failed as did not get CommandResult");
+      }
+    } finally {
+      exp.remove();
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java
new file mode 100644
index 0000000..23ca687
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStartDUnitTest.java
@@ -0,0 +1,276 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandGatewayReceiverStartDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Test wan commands for error in input 1> start gateway-sender command needs
+   * only one of member or group.
+   */
+  @Test
+  public void testStartGatewayReceiver_ErrorConditions() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createReceiver( punePort ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.START_GATEWAYRECEIVER + " --"
+        + CliStrings.START_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId() + " --"
+        + CliStrings.START_GATEWAYRECEIVER__GROUP + "=RG1";
+    
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewayReceiver_ErrorConditions stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStartGatewayReceiver_ErrorConditions failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testStartGatewayReceiver() {
+    
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createReceiver( punePort ));
+    vm4.invoke(() -> createReceiver( punePort ));
+    vm5.invoke(() -> createReceiver( punePort ));
+    
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+    
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertTrue(status.contains("Error"));
+    } else {
+      fail("testStartGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a member
+   */
+  @Test
+  public void testStartGatewayReceiver_onMember() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+    
+    vm3.invoke(() -> createReceiver( punePort ));
+    vm4.invoke(() -> createReceiver( punePort ));
+    vm5.invoke(() -> createReceiver( punePort ));
+
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+    
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER + " --"
+        + CliStrings.START_GATEWAYRECEIVER__MEMBER+ "=" + vm1Member.getId();
+    
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewayReceiver_onMember stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is started on member"));
+    } else {
+      fail("testStartGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a group of members
+   */
+  @Test
+  public void testStartGatewayReceiver_Group() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
+    vm4.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
+    vm5.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
+
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+    
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER + " --"
+        + CliStrings.START_GATEWAYRECEIVER__GROUP + "=RG1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewayReceiver_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewayReceiver_Group failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more
+   * sender members belongs to multiple groups
+   * 
+   */
+  @Test
+  public void testStartGatewayReceiver_MultipleGroup() {
+    
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+    
+    vm3.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
+    vm4.invoke(() -> createReceiverWithGroup( punePort, "RG1" ));
+    vm5.invoke(() -> createReceiverWithGroup( punePort, "RG1, RG2" ));
+    vm6.invoke(() -> createReceiverWithGroup( punePort, "RG1, RG2" ));
+    vm7.invoke(() -> createReceiverWithGroup( punePort, "RG3" ));
+    
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+    vm6.invoke(() -> verifyReceiverState( false ));
+    vm7.invoke(() -> verifyReceiverState( false ));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER + " --"
+        + CliStrings.START_GATEWAYRECEIVER__GROUP + "=RG1,RG2";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewayReceiver_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true));
+    vm5.invoke(() -> verifyReceiverState( true ));
+    vm6.invoke(() -> verifyReceiverState( true ));
+    vm7.invoke(() -> verifyReceiverState( false ));
+  }
+
+}


[51/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-lucene/src/main/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-lucene/src/main/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
deleted file mode 100644
index 220ae0e..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import static com.gemstone.gemfire.distributed.internal.DistributionStats.getStatTime;
-
-import java.util.function.IntSupplier;
-
-import com.gemstone.gemfire.StatisticDescriptor;
-import com.gemstone.gemfire.Statistics;
-import com.gemstone.gemfire.StatisticsFactory;
-import com.gemstone.gemfire.StatisticsType;
-import com.gemstone.gemfire.StatisticsTypeFactory;
-import com.gemstone.gemfire.internal.CopyOnWriteHashSet;
-import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
-
-public class LuceneIndexStats {
-  // statistics type
-  private static final StatisticsType statsType;
-  private static final String statsTypeName = "LuceneIndexStats";
-  private static final String statsTypeDescription = "Statistics about lucene indexes";
-
-  private static final int queryExecutionsId;
-  private static final int queryExecutionTimeId;
-  private static final int queryExecutionsInProgressId;
-  private static final int queryExecutionTotalHitsId;
-  private static final int updatesId;
-  private static final int updateTimeId;
-  private static final int updatesInProgressId;
-  private static final int commitsId;
-  private static final int commitTimeId;
-  private static final int commitsInProgressId;
-  private static final int documentsId;
-
-  private final Statistics stats;
-  private final CopyOnWriteHashSet<IntSupplier> documentsSuppliers = new CopyOnWriteHashSet<>();
-
-  static {
-    final StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
-    statsType = f.createType(
-      statsTypeName,
-      statsTypeDescription,
-      new StatisticDescriptor[] {
-        f.createIntCounter("queryExecutions", "Number of lucene queries executed on this member", "operations"),
-        f.createLongCounter("queryExecutionTime", "Amount of time spent executing lucene queries", "nanoseconds"),
-        f.createIntGauge("queryExecutionsInProgress", "Number of query executions currently in progress", "operations"),
-        f.createLongCounter("queryExecutionTotalHits", "Total number of documents returned by query executions", "entries"),
-        f.createIntCounter("updates", "Number of lucene index documents added/removed on this member", "operations"),
-        f.createLongCounter("updateTime", "Amount of time spent adding or removing documents from the index", "nanoseconds"),
-        f.createIntGauge("updatesInProgress", "Number of index updates in progress", "operations"),
-        f.createIntCounter("commits", "Number of lucene index commits on this member", "operations"),
-        f.createLongCounter("commitTime", "Amount of time spent in lucene index commits", "nanoseconds"),
-        f.createIntGauge("commitsInProgress", "Number of lucene index commits in progress", "operations"),
-        f.createIntGauge("documents", "Number of documents in the index", "documents"),
-      }
-    );
-
-    queryExecutionsId = statsType.nameToId("queryExecutions");
-    queryExecutionTimeId = statsType.nameToId("queryExecutionTime");
-    queryExecutionsInProgressId = statsType.nameToId("queryExecutionsInProgress");
-    queryExecutionTotalHitsId = statsType.nameToId("queryExecutionTotalHits");
-    updatesId = statsType.nameToId("updates");
-    updateTimeId = statsType.nameToId("updateTime");
-    updatesInProgressId = statsType.nameToId("updatesInProgress");
-    commitsId = statsType.nameToId("commits");
-    commitTimeId = statsType.nameToId("commitTime");
-    commitsInProgressId = statsType.nameToId("commitsInProgress");
-    documentsId = statsType.nameToId("documents");
-  }
-
-  public LuceneIndexStats(StatisticsFactory f, String name) {
-    this.stats = f.createAtomicStatistics(statsType, name);
-    stats.setIntSupplier(documentsId, this::computeDocumentCount);
-  }
-
-  /**
-   * @return the timestamp that marks the start of the operation
-   */
-  public long startQuery() {
-    stats.incInt(queryExecutionsInProgressId, 1);
-    return getStatTime();
-  }
-  /**
-   * @param start the timestamp taken when the operation started
-   */
-  public void endQuery(long start, final int totalHits) {
-    stats.incLong(queryExecutionTimeId, getStatTime()-start);
-    stats.incInt(queryExecutionsInProgressId, -1);
-    stats.incInt(queryExecutionsId, 1);
-    stats.incLong(queryExecutionTotalHitsId, totalHits);
-  }
-
-  /**
-   * @return the timestamp that marks the start of the operation
-   */
-  public long startUpdate() {
-    stats.incInt(updatesInProgressId, 1);
-    return getStatTime();
-  }
-  /**
-   * @param start the timestamp taken when the operation started
-   */
-  public void endUpdate(long start) {
-    stats.incLong(updateTimeId, getStatTime()-start);
-    stats.incInt(updatesInProgressId, -1);
-    stats.incInt(updatesId, 1);
-  }
-
-  /**
-   * @return the timestamp that marks the start of the operation
-   */
-  public long startCommit() {
-    stats.incInt(commitsInProgressId, 1);
-    return getStatTime();
-  }
-  /**
-   * @param start the timestamp taken when the operation started
-   */
-  public void endCommit(long start) {
-    stats.incLong(commitTimeId, getStatTime()-start);
-    stats.incInt(commitsInProgressId, -1);
-    stats.incInt(commitsId, 1);
-  }
-
-  public void addDocumentsSupplier(IntSupplier supplier) {
-    this.documentsSuppliers.add(supplier);
-  }
-
-  public void removeDocumentsSupplier(IntSupplier supplier) {
-    this.documentsSuppliers.remove(supplier);
-  }
-
-  public int getDocuments() {
-    return this.stats.getInt(documentsId);
-  }
-
-  private int computeDocumentCount() {
-    return this.documentsSuppliers.stream()
-      .mapToInt(IntSupplier::getAsInt)
-      .sum();
-  }
-
-  public int getQueryExecutions() {
-    return stats.getInt(queryExecutionsId);
-  }
-
-  public long getQueryExecutionTime() {
-    return stats.getLong(queryExecutionTimeId);
-  }
-
-  public int getQueryExecutionsInProgress() {
-    return stats.getInt(queryExecutionsInProgressId);
-  }
-
-  public long getQueryExecutionTotalHits() {
-    return stats.getLong(queryExecutionTotalHitsId);
-  }
-
-  public int getUpdates() {
-    return stats.getInt(updatesId);
-  }
-
-  public long getUpdateTime() {
-    return stats.getLong(updateTimeId);
-  }
-
-  public int getUpdatesInProgress() {
-    return stats.getInt(updatesInProgressId);
-  }
-
-  public int getCommits() {
-    return stats.getInt(commitsId);
-  }
-
-  public long getCommitTime() {
-    return stats.getLong(commitTimeId);
-  }
-
-  public int getCommitsInProgress() {
-    return stats.getInt(commitsInProgressId);
-  }
-
-  public Statistics getStats() {
-    return this.stats;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
deleted file mode 100644
index 21c019b..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.lucene.LuceneQuery;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
-
-public class LuceneQueryFactoryImpl implements LuceneQueryFactory {
-  private int limit = DEFAULT_LIMIT;
-  private int pageSize = DEFAULT_PAGESIZE;
-  private String[] projectionFields = null;
-  private Cache cache;
-  
-  LuceneQueryFactoryImpl(Cache cache) {
-    this.cache = cache;
-  }
-  
-  @Override
-  public LuceneQueryFactory setPageSize(int pageSize) {
-    this.pageSize = pageSize;
-    return this;
-  }
-
-  @Override
-  public LuceneQueryFactory setResultLimit(int limit) {
-    this.limit = limit;
-    return this;
-  }
-
-  @Override
-  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, String queryString, String defaultField) {
-    return create(indexName, regionName, new StringQueryProvider(queryString, defaultField));
-  }
-  
-  @Override
-  public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, LuceneQueryProvider provider) {
-    Region<K, V> region = cache.getRegion(regionName);
-    if(region == null) {
-      throw new IllegalArgumentException("Region not found: " + regionName);
-    }
-    LuceneQueryImpl<K, V> luceneQuery = new LuceneQueryImpl<K, V>(indexName, region, provider, projectionFields, limit, pageSize);
-    return luceneQuery;
-  }
-  
-  @Override
-  public LuceneQueryFactory setProjectionFields(String... fieldNames) {
-    projectionFields = fieldNames.clone();
-    return this;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
deleted file mode 100644
index ef2f4ee..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.Execution;
-import com.gemstone.gemfire.cache.execute.FunctionException;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.cache.lucene.LuceneQuery;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
-import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
-import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunctionContext;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntries;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollector;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollectorManager;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesFunctionCollector;
-
-public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
-  private int limit = LuceneQueryFactory.DEFAULT_LIMIT;
-  private int pageSize = LuceneQueryFactory.DEFAULT_PAGESIZE;
-  private String indexName;
-  // The projected fields are local to a specific index per Query object. 
-  private String[] projectedFieldNames;
-  /* the lucene Query object to be wrapped here */
-  private LuceneQueryProvider query;
-  private Region<K, V> region;
-  private String defaultField;
-  
-  public LuceneQueryImpl(String indexName, Region<K, V> region, LuceneQueryProvider provider, String[] projectionFields,
-      int limit, int pageSize) {
-    this.indexName = indexName;
-    this.region = region;
-    this.limit = limit;
-    this.pageSize = pageSize;
-    this.projectedFieldNames = projectionFields;
-    this.query = provider;
-  }
-
-  @Override
-  public Collection<K> findKeys() throws LuceneQueryException {
-    TopEntries<K> entries = findTopEntries();
-    final List<EntryScore<K>> hits = entries.getHits();
-
-    return hits.stream()
-      .map(hit -> hit.getKey())
-      .collect(Collectors.toList());
-  }
-
-  @Override
-  public Collection<V> findValues() throws LuceneQueryException {
-    final List<LuceneResultStruct<K, V>> page = findResults();
-
-    return page.stream()
-      .map(entry -> entry.getValue())
-      .collect(Collectors.toList());
-  }
-
-  @Override
-  public List<LuceneResultStruct<K, V>> findResults() throws LuceneQueryException {
-    PageableLuceneQueryResults<K, V> pages = findPages(0);
-    if(!pages.hasNext()) {
-      return Collections.emptyList();
-    }
-
-    return pages.next();
-  }
-
-  @Override
-  public PageableLuceneQueryResults<K, V> findPages() throws LuceneQueryException {
-    return findPages(pageSize);
-  }
-
-  private PageableLuceneQueryResults<K, V> findPages(int pageSize) throws LuceneQueryException {
-    TopEntries<K> entries = findTopEntries();
-    return new PageableLuceneQueryResultsImpl<K, V>(entries.getHits(), region, pageSize);
-  }
-
-  private TopEntries<K> findTopEntries() throws LuceneQueryException {
-    TopEntriesCollectorManager manager = new TopEntriesCollectorManager(null, limit);
-    LuceneFunctionContext<TopEntriesCollector> context = new LuceneFunctionContext<>(query, indexName, manager, limit);
-    TopEntriesFunctionCollector collector = new TopEntriesFunctionCollector(context);
-
-    ResultCollector<TopEntriesCollector, TopEntries<K>> rc = (ResultCollector<TopEntriesCollector, TopEntries<K>>) onRegion()
-        .withArgs(context)
-        .withCollector(collector)
-        .execute(LuceneFunction.ID);
-
-    //TODO provide a timeout to the user?
-    TopEntries<K> entries;
-    try {
-      entries = rc.getResult();
-    } catch(FunctionException e) {
-      if(e.getCause() instanceof LuceneQueryException) {
-        throw new LuceneQueryException(e);
-      } else {
-        throw e;
-      }
-    }
-    return entries;
-  }
-
-  protected Execution onRegion() {
-    return FunctionService.onRegion(region);
-  }
-
-  @Override
-  public int getPageSize() {
-    return this.pageSize;
-  }
-
-  @Override
-  public int getLimit() {
-    return this.limit;
-  }
-
-  @Override
-  public String[] getProjectedFieldNames() {
-    return this.projectedFieldNames;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndex.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndex.java
deleted file mode 100755
index e708691..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndex.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-
-public class LuceneRawIndex extends LuceneIndexImpl {
-  
-  protected LuceneRawIndex(String indexName, String regionPath, Cache cache) {
-    super(indexName, regionPath, cache);
-  }
-
-  @Override
-  protected RepositoryManager createRepositoryManager() {
-    HeterogeneousLuceneSerializer mapper = new HeterogeneousLuceneSerializer(getFieldNames());
-    return new RawLuceneRepositoryManager(this, mapper);
-  }
-  
-  @Override
-  public void dumpFiles(String directory) {
-    return;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndexFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndexFactory.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndexFactory.java
deleted file mode 100755
index 6c3bad6..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneRawIndexFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-
-public class LuceneRawIndexFactory extends LuceneIndexFactory {
-  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
-    return new LuceneRawIndex(indexName, regionPath, cache);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpl.java
deleted file mode 100644
index a3794f2..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneResultStructImpl.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
-
-public class LuceneResultStructImpl<K,V> implements LuceneResultStruct<K,V> {
-  K key;
-  V value;
-  float score;
-
-  public LuceneResultStructImpl(K key, V value, float score) {
-    this.key = key;
-    this.value = value;
-    this.score = score;
-  }
-
-  @Override
-  public Object getProjectedField(String fieldName) {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public K getKey() {
-    return key;
-  }
-
-  @Override
-  public V getValue() {
-    return value;
-  }
-
-  @Override
-  public float getScore() {
-    return score;
-  }
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + ((key == null) ? 0 : key.hashCode());
-    result = prime * result + Float.floatToIntBits(score);
-    result = prime * result + ((value == null) ? 0 : value.hashCode());
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (obj == null)
-      return false;
-    if (getClass() != obj.getClass())
-      return false;
-    LuceneResultStructImpl other = (LuceneResultStructImpl) obj;
-    if (key == null) {
-      if (other.key != null)
-        return false;
-    } else if (!key.equals(other.key))
-      return false;
-    if (Float.floatToIntBits(score) != Float.floatToIntBits(other.score))
-      return false;
-    if (value == null) {
-      if (other.value != null)
-        return false;
-    } else if (!value.equals(other.value))
-      return false;
-    return true;
-  }
-
-  @Override
-  public String toString() {
-    return "LuceneResultStructImpl [key=" + key + ", value=" + value
-        + ", score=" + score + "]";
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
deleted file mode 100644
index 81a62b8..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.util.*;
-
-import com.gemstone.gemfire.cache.lucene.internal.management.LuceneServiceMBean;
-import com.gemstone.gemfire.cache.lucene.internal.management.ManagementIndexListener;
-import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.EvictionAlgorithm;
-import com.gemstone.gemfire.cache.EvictionAttributes;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryFactory;
-import com.gemstone.gemfire.cache.lucene.internal.directory.DumpDirectoryFiles;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunctionContext;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntries;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollector;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesCollectorManager;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
-import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
-import com.gemstone.gemfire.cache.lucene.internal.xml.LuceneServiceXmlGenerator;
-import com.gemstone.gemfire.internal.DSFIDFactory;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.cache.extension.Extensible;
-import com.gemstone.gemfire.internal.cache.CacheService;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.RegionListener;
-import com.gemstone.gemfire.internal.cache.xmlcache.XmlGenerator;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * Implementation of LuceneService to create lucene index and query.
- * 
- * 
- * @since GemFire 8.5
- */
-public class LuceneServiceImpl implements InternalLuceneService {
-  public static LuceneIndexFactory luceneIndexFactory = new LuceneIndexFactory();
-  private static final Logger logger = LogService.getLogger();
-
-  private GemFireCacheImpl cache;
-  private final HashMap<String, LuceneIndex> indexMap = new HashMap<String, LuceneIndex>();
-  private final HashMap<String, LuceneIndexCreationProfile> definedIndexMap = new HashMap<>();
-  private IndexListener managementListener;
-
-  public LuceneServiceImpl() {
-    
-  }
-
-  public void init(final Cache cache) {
-    if (cache == null) {
-      throw new IllegalStateException(LocalizedStrings.CqService_CACHE_IS_NULL.toLocalizedString());
-    }
-    GemFireCacheImpl gfc = (GemFireCacheImpl) cache;
-    gfc.getCancelCriterion().checkCancelInProgress(null);
-
-    this.cache = gfc;
-
-    FunctionService.registerFunction(new LuceneFunction());
-    FunctionService.registerFunction(new DumpDirectoryFiles());
-    registerDataSerializables();
-  }
-
-  @Override
-  public CacheServiceMBeanBase getMBean() {
-    LuceneServiceMBean mbean = new LuceneServiceMBean(this);
-    this.managementListener = new ManagementIndexListener(mbean);
-    return mbean;
-  }
-
-  @Override
-  public Class<? extends CacheService> getInterface() {
-    return InternalLuceneService.class;
-  }
-
-  public static String getUniqueIndexName(String indexName, String regionPath) {
-    if (!regionPath.startsWith("/")) {
-      regionPath = "/"+regionPath;
-    }
-    String name = indexName + "#" + regionPath.replace('/', '_');
-    return name;
-  }
-
-  @Override
-  public void createIndex(String indexName, String regionPath, String... fields) {
-    if(fields == null || fields.length == 0) {
-      throw new IllegalArgumentException("At least one field must be indexed");
-    }
-    StandardAnalyzer analyzer = new StandardAnalyzer();
-    
-    createIndex(indexName, regionPath, analyzer, null, fields);
-  }
-  
-  @Override
-  public void createIndex(String indexName, String regionPath, Map<String, Analyzer> fieldAnalyzers) {
-    if(fieldAnalyzers == null || fieldAnalyzers.isEmpty()) {
-      throw new IllegalArgumentException("At least one field must be indexed");
-    }
-    Analyzer analyzer = new PerFieldAnalyzerWrapper(new StandardAnalyzer(), fieldAnalyzers);
-    Set<String> fieldsSet = fieldAnalyzers.keySet();
-    String[] fields = (String[])fieldsSet.toArray(new String[fieldsSet.size()]);
-
-    createIndex(indexName, regionPath, analyzer, fieldAnalyzers, fields);
-  }
-
-  public void createIndex(final String indexName, String regionPath,
-      final Analyzer analyzer, final Map<String, Analyzer> fieldAnalyzers,
-      final String... fields) {
-
-    if(!regionPath.startsWith("/")) {
-      regionPath = "/" + regionPath;
-    }
-
-    registerDefinedIndex(LuceneServiceImpl.getUniqueIndexName(indexName, regionPath),
-                                new LuceneIndexCreationProfile(indexName, regionPath, fields, analyzer, fieldAnalyzers));
-
-    Region region = cache.getRegion(regionPath);
-    if(region != null) {
-      definedIndexMap.remove(LuceneServiceImpl.getUniqueIndexName(indexName, regionPath));
-      throw new IllegalStateException("The lucene index must be created before region");
-    }
-
-    final String dataRegionPath = regionPath;
-    cache.addRegionListener(new RegionListener() {
-      @Override
-      public RegionAttributes beforeCreate(Region parent, String regionName,
-          RegionAttributes attrs, InternalRegionArguments internalRegionArgs) {
-        RegionAttributes updatedRA = attrs;
-        String path = parent == null ? "/" + regionName : parent.getFullPath() + "/" + regionName;
-
-        if(path.equals(dataRegionPath)) {
-
-          if (!attrs.getDataPolicy().withPartitioning()) {
-            // replicated region
-            throw new UnsupportedOperationException("Lucene indexes on replicated regions are not supported");
-          }
-
-          //For now we cannot support eviction with local destroy.
-          //Eviction with overflow to disk still needs to be supported
-          EvictionAttributes evictionAttributes = attrs.getEvictionAttributes();
-          EvictionAlgorithm evictionAlgorithm = evictionAttributes.getAlgorithm();
-          if (evictionAlgorithm != EvictionAlgorithm.NONE && evictionAttributes.getAction().isLocalDestroy()) {
-            throw new UnsupportedOperationException("Lucene indexes on regions with eviction and action local destroy are not supported");
-          }
-
-          String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, dataRegionPath);
-          if (!attrs.getAsyncEventQueueIds().contains(aeqId)) {
-            AttributesFactory af = new AttributesFactory(attrs);
-            af.addAsyncEventQueueId(aeqId);
-            updatedRA = af.create();
-          }
-
-          // Add index creation profile
-          internalRegionArgs.addCacheServiceProfile(new LuceneIndexCreationProfile(indexName, dataRegionPath, fields, analyzer, fieldAnalyzers));
-        }
-        return updatedRA;
-      }
-      
-      @Override
-      public void afterCreate(Region region) {
-        if(region.getFullPath().equals(dataRegionPath)) {
-          afterDataRegionCreated(indexName, analyzer, dataRegionPath, fieldAnalyzers, fields);
-          cache.removeRegionListener(this);
-        }
-      }
-    });
-  }
-
-
-  /**
-   * Finish creating the lucene index after the data region is created .
-   * 
-   * Public because this is called by the Xml parsing code
-   */
-  public void afterDataRegionCreated(final String indexName,
-      final Analyzer analyzer, final String dataRegionPath,
-      final Map<String, Analyzer> fieldAnalyzers, final String... fields) {
-    LuceneIndexImpl index = createIndexRegions(indexName, dataRegionPath);
-    index.setSearchableFields(fields);
-    index.setAnalyzer(analyzer);
-    index.setFieldAnalyzers(fieldAnalyzers);
-    index.initialize();
-    registerIndex(index);
-    if (this.managementListener != null) {
-      this.managementListener.afterIndexCreated(index);
-    }
-  }
-  
-  private LuceneIndexImpl createIndexRegions(String indexName, String regionPath) {
-    Region dataregion = this.cache.getRegion(regionPath);
-    if (dataregion == null) {
-      logger.info("Data region "+regionPath+" not found");
-      return null;
-    }
-    //Convert the region name into a canonical form
-    regionPath = dataregion.getFullPath();
-    return luceneIndexFactory.create(indexName, regionPath, cache);
-  }
-
-  private void registerDefinedIndex(final String regionAndIndex, final LuceneIndexCreationProfile luceneIndexCreationProfile) {
-    if (definedIndexMap.containsKey(regionAndIndex) || indexMap.containsKey(regionAndIndex))
-      throw new IllegalArgumentException("Lucene index already exists in region");
-    definedIndexMap.put(regionAndIndex, luceneIndexCreationProfile);
-  }
-
-  @Override
-  public LuceneIndex getIndex(String indexName, String regionPath) {
-    Region region = cache.getRegion(regionPath);
-    if(region == null) {
-      return null;
-    }
-    return indexMap.get(getUniqueIndexName(indexName, region.getFullPath()));
-  }
-
-  @Override
-  public Collection<LuceneIndex> getAllIndexes() {
-    return indexMap.values();
-  }
-
-  @Override
-  public void destroyIndex(LuceneIndex index) {
-    LuceneIndexImpl indexImpl = (LuceneIndexImpl) index;
-    indexMap.remove(getUniqueIndexName(index.getName(), index.getRegionPath()));
-//    indexImpl.close();
-  }
-
-  @Override
-  public LuceneQueryFactory createLuceneQueryFactory() {
-    return new LuceneQueryFactoryImpl(cache);
-  }
-
-  @Override
-  public XmlGenerator<Cache> getXmlGenerator() {
-    return new LuceneServiceXmlGenerator();
-  }
-
-  @Override
-  public void beforeCreate(Extensible<Cache> source, Cache cache) {
-    // Nothing to do here.
-  }
-
-  @Override
-  public void onCreate(Extensible<Cache> source, Extensible<Cache> target) {
-    //This is called when CacheCreation (source) is turned into a GemfireCacheImpl (target)
-    //nothing to do there.
-  }
-
-  public void registerIndex(LuceneIndex index){
-    String regionAndIndex = getUniqueIndexName(index.getName(), index.getRegionPath()); 
-    if( !indexMap.containsKey( regionAndIndex )) {
-      indexMap.put(regionAndIndex, index);
-    }
-    definedIndexMap.remove(regionAndIndex);
-  }
-
-  public void unregisterIndex(final String region){
-    if( indexMap.containsKey( region )) indexMap.remove( region );
-  }
-
-  /**Public for test purposes */
-  public static void registerDataSerializables() {
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_CHUNK_KEY,
-        ChunkKey.class);
-    
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_FILE,
-        File.class);
-    
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_FUNCTION_CONTEXT,
-        LuceneFunctionContext.class);
-    
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_STRING_QUERY_PROVIDER,
-        StringQueryProvider.class);
-    
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_TOP_ENTRIES_COLLECTOR_MANAGER,
-        TopEntriesCollectorManager.class);
-    
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_ENTRY_SCORE,
-        EntryScore.class);
-    
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_TOP_ENTRIES,
-        TopEntries.class);
-
-    DSFIDFactory.registerDSFID(
-        DataSerializableFixedID.LUCENE_TOP_ENTRIES_COLLECTOR,
-        TopEntriesCollector.class);
-  }
-
-  public Collection<LuceneIndexCreationProfile> getAllDefinedIndexes() {
-    return definedIndexMap.values();
-  }
-
-  public LuceneIndexCreationProfile getDefinedIndex(String indexName, String regionPath) {
-    return definedIndexMap.get(getUniqueIndexName(indexName , regionPath));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
deleted file mode 100644
index 1563df0..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
-import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
-import com.gemstone.gemfire.cache.lucene.internal.distributed.EntryScore;
-
-/**
- * Implementation of PageableLuceneQueryResults that fetchs a page at a time
- * from the server, given a set of EntryScores (key and score).
- *
- * @param <K> The type of the key
- * @param <V> The type of the value
- */
-public class PageableLuceneQueryResultsImpl<K,V> implements PageableLuceneQueryResults<K,V> {
-
-  /**
-   *  list of docs matching search query
-   */
-  private final List<EntryScore<K>> hits;
-
-  /**
-   * * Current page of results
-   */
-  private List<LuceneResultStruct<K,V>> currentPage;
-  /**
-   * The maximum score. Lazily evaluated
-   */
-  private float maxScore = Float.MIN_VALUE;
-  
-  /**
-   * The user region where values are stored.
-   */
-  private final Region<K, V> userRegion;
-  
-  /**
-   * The start of the next page of results we want to fetch 
-   */
-  private int currentHit = 0;
-  
-  /**
-   * The page size the user wants.
-   */
-  private int pageSize;
-  
-  public PageableLuceneQueryResultsImpl(List<EntryScore<K>> hits, Region<K,V> userRegion, int pageSize) {
-    this.hits = hits;
-    this.userRegion = userRegion;
-    this.pageSize = pageSize == 0 ? Integer.MAX_VALUE : pageSize;
-  }
-
-
-  public List<LuceneResultStruct<K,V>> getHitEntries(int fromIndex, int toIndex) {
-    List<EntryScore<K>> scores = hits.subList(fromIndex, toIndex);
-    ArrayList<K> keys = new ArrayList<K>(scores.size());
-    for(EntryScore<K> score : scores) {
-      keys.add(score.getKey());
-    }
-
-    Map<K,V> values = userRegion.getAll(keys);
-
-    ArrayList<LuceneResultStruct<K,V>> results = new ArrayList<LuceneResultStruct<K,V>>(scores.size());
-    for(EntryScore<K> score : scores) {
-      V value = values.get(score.getKey());
-      if (value!=null)
-        results.add(new LuceneResultStructImpl(score.getKey(), value, score.getScore()));
-    }
-    return results;
-  }
-
-  @Override
-  public List<LuceneResultStruct<K,V>> next() {
-    if(!hasNext()) {
-      throw new NoSuchElementException();
-    }
-    List<LuceneResultStruct<K,V>> result = advancePage();
-    currentPage = null;
-    return result;
-  }
-
-  private List<LuceneResultStruct<K, V>> advancePage() {
-    if(currentPage != null) {
-      return currentPage;
-    }
-
-    int resultSize = (pageSize != Integer.MAX_VALUE) ? pageSize : hits.size();
-    currentPage = new ArrayList<LuceneResultStruct<K,V>>(resultSize);
-    while (currentPage.size()<pageSize && currentHit < hits.size()) {
-      int end = currentHit + pageSize - currentPage.size();
-      end = end > hits.size() ? hits.size() : end;
-      currentPage.addAll(getHitEntries(currentHit, end));
-      currentHit = end;
-    }
-    return currentPage;
-  }
-
-  @Override
-  public boolean hasNext() {
-
-    advancePage();
-    if ( currentPage.isEmpty() ) {
-      return false;
-    }
-    return true;
-  }
-
-  @Override
-  public int size() {
-    return hits.size();
-  }
-
-  @Override
-  public float getMaxScore() {
-    if(maxScore == Float.MIN_VALUE) {
-      for(EntryScore<K> score : hits) {
-        maxScore = Math.max(maxScore, score.getScore());
-      }
-    }
-    
-    return maxScore;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
deleted file mode 100644
index d5dd7b1..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.IOException;
-
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-
-/**
- * Manages index repositories for partitioned regions.
- * 
- * This class lazily creates the IndexRepository for each individual
- * bucket. If a Bucket is rebalanced, this class will create a new
- * index repository when the bucket returns to this node.
- */
-public class PartitionedRepositoryManager extends AbstractPartitionedRepositoryManager {
-
-  public static IndexRepositoryFactory indexRepositoryFactory = new IndexRepositoryFactory();
-
-  public PartitionedRepositoryManager(LuceneIndexImpl index,
-      LuceneSerializer serializer) {
-    super(index, serializer);
-  }
-
-  @Override
-  public IndexRepository createOneIndexRepository(Integer bucketId,
-      LuceneSerializer serializer, LuceneIndexImpl index,
-      PartitionedRegion userRegion) throws IOException {
-    return indexRepositoryFactory.createIndexRepository(bucketId, serializer, index, userRegion);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawIndexRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawIndexRepositoryFactory.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawIndexRepositoryFactory.java
deleted file mode 100755
index 131e297..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawIndexRepositoryFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.NIOFSDirectory;
-import org.apache.lucene.store.RAMDirectory;
-
-import com.gemstone.gemfire.cache.lucene.internal.directory.RegionDirectory;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepositoryImpl;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
-import com.gemstone.gemfire.internal.cache.BucketRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-
-public class RawIndexRepositoryFactory extends IndexRepositoryFactory {
-  public RawIndexRepositoryFactory() {
-  }
-
-  public IndexRepository createIndexRepository(final Integer bucketId,
-                                        LuceneSerializer serializer,
-                                        LuceneIndexImpl index, PartitionedRegion userRegion)
-    throws IOException
-  {
-    final IndexRepository repo;
-    LuceneRawIndex indexForRaw = (LuceneRawIndex)index;
-    BucketRegion dataBucket = getMatchingBucket(userRegion, bucketId);
-
-    Directory dir = null;
-    if (indexForRaw.withPersistence()) {
-      String bucketLocation = LuceneServiceImpl.getUniqueIndexName(index.getName(), index.getRegionPath()+"_"+bucketId);
-      File location = new File(index.getName(), bucketLocation);
-      if (!location.exists()) {
-        location.mkdirs();
-      }
-      dir = new NIOFSDirectory(location.toPath());
-    } else {
-      dir = new RAMDirectory();
-    }
-    IndexWriterConfig config = new IndexWriterConfig(indexForRaw.getAnalyzer());
-    IndexWriter writer = new IndexWriter(dir, config);
-    return new IndexRepositoryImpl(null, writer, serializer, indexForRaw.getIndexStats(), dataBucket);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawLuceneRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawLuceneRepositoryManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawLuceneRepositoryManager.java
deleted file mode 100755
index 234245e..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/RawLuceneRepositoryManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.IOException;
-
-import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
-import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.LuceneSerializer;
-import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-
-public class RawLuceneRepositoryManager extends AbstractPartitionedRepositoryManager {
-  public static IndexRepositoryFactory indexRepositoryFactory = new RawIndexRepositoryFactory();
-  
-  public RawLuceneRepositoryManager(LuceneIndexImpl index,
-      LuceneSerializer serializer) {
-    super(index, serializer);
-  }
-  
-  public void close() {
-    for (IndexRepository repo:indexRepositories.values()) {
-      repo.cleanup();
-    }
-  }
-
-  @Override
-  public IndexRepository createOneIndexRepository(Integer bucketId,
-      LuceneSerializer serializer, LuceneIndexImpl index,
-      PartitionedRegion userRegion) throws IOException {
-    return indexRepositoryFactory.createIndexRepository(bucketId, serializer, index, userRegion);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/StringQueryProvider.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/StringQueryProvider.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/StringQueryProvider.java
deleted file mode 100644
index c5d145e..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/StringQueryProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.lucene.internal;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
-import org.apache.lucene.queryparser.flexible.standard.StandardQueryParser;
-import org.apache.lucene.search.Query;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.GemFireCheckedException;
-import com.gemstone.gemfire.GemFireException;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryException;
-import com.gemstone.gemfire.cache.lucene.LuceneQueryProvider;
-import com.gemstone.gemfire.cache.query.QueryException;
-import com.gemstone.gemfire.internal.DataSerializableFixedID;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-/**
- * Constructs a Lucene Query object by parsing a search string. The class uses {@link StandardQueryParser}. It sets
- * searchable fields in a {@link LuceneIndex} as default fields.
- */
-public class StringQueryProvider implements LuceneQueryProvider, DataSerializableFixedID {
-
-  private static final long serialVersionUID = 1L;
-
-  private static final Logger logger = LogService.getLogger();
-
-  // the following members hold input data and needs to be sent on wire
-  private String query;
-
-  // the following members hold derived objects and need not be serialized
-  private transient Query luceneQuery;
-
-  private String defaultField;
-
-  public StringQueryProvider() {
-    this(null, null);
-  }
-
-  public StringQueryProvider(String query, String defaultField) {
-    this.query = query;
-    this.defaultField = defaultField;
-  }
-
-  @Override
-  public synchronized Query getQuery(LuceneIndex index) throws LuceneQueryException {
-    if (luceneQuery == null) {
-      String[] fields = index.getFieldNames();
-      LuceneIndexImpl indexImpl = (LuceneIndexImpl) index;
-      StandardQueryParser parser = new StandardQueryParser(indexImpl.getAnalyzer());
-      try {
-        luceneQuery = parser.parse(query, defaultField);
-        if (logger.isDebugEnabled()) {
-          logger.debug("User query " + query + " is parsed to be: " + luceneQuery);
-        }
-      } catch (QueryNodeException e) {
-        logger.debug("Query node exception:" + query, e);
-        throw new LuceneQueryException("Malformed lucene query: " + query, e);
-      }
-    }
-    return luceneQuery;
-  }
-
-  /**
-   * @return the query string used to construct this query provider
-   */
-  public String getQueryString() {
-    return query;
-  }
-
-  @Override
-  public Version[] getSerializationVersions() {
-    return null;
-  }
-
-  @Override
-  public int getDSFID() {
-    return LUCENE_STRING_QUERY_PROVIDER;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeString(query, out);
-    DataSerializer.writeString(defaultField, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    query = DataSerializer.readString(in);
-    defaultField = DataSerializer.readString(in);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneCliStrings.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneCliStrings.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneCliStrings.java
deleted file mode 100644
index b424d8f..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneCliStrings.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.lucene.internal.cli;
-
-public class LuceneCliStrings {
-  //Common parameters/options
-  public static final String LUCENE__INDEX_NAME = "name";
-  public static final String LUCENE__REGION_PATH = "region";
-
-  //List lucene index commands
-  public static final String LUCENE_LIST_INDEX = "list lucene indexes";
-  public static final String LUCENE_LIST_INDEX__HELP = "Display the list of lucene indexes created for all members.";
-  public static final String LUCENE_LIST_INDEX__ERROR_MESSAGE = "An error occurred while collecting all lucene index information across the Geode cluster: %1$s";
-  public static final String LUCENE_LIST_INDEX__INDEXES_NOT_FOUND_MESSAGE = "No lucene indexes found";
-  public static final String LUCENE_LIST_INDEX__STATS = "with-stats";
-  public static final String LUCENE_LIST_INDEX__STATS__HELP = "Display lucene index stats";
-
-  //Create lucene index commands 
-  public static final String LUCENE_CREATE_INDEX = "create lucene index";
-  public static final String LUCENE_CREATE_INDEX__HELP = "Create a lucene index that can be used to execute queries.";
-  public static final String LUCENE_CREATE_INDEX__NAME__HELP = "Name of the lucene index to create.";
-  public static final String LUCENE_CREATE_INDEX__REGION_HELP = "Name/Path of the region where the lucene index is created on.";
-  public static final String LUCENE_CREATE_INDEX__FIELD = "field";
-  public static final String LUCENE_CREATE_INDEX__FIELD_HELP = "fields on the region values which are stored in the lucene index.";
-  public static final String LUCENE_CREATE_INDEX__ANALYZER = "analyzer";
-  public static final String LUCENE_CREATE_INDEX__ANALYZER_HELP = "Type of the analyzer for each field.";
-  public static final String LUCENE_CREATE_INDEX__GROUP = "group";
-  public static final String LUCENE_CREATE_INDEX__GROUP__HELP = "Group of members in which the lucene index will be created.";
-  public static final String CREATE_INDEX__SUCCESS__MSG = "Index successfully created with following details";
-  public static final String CREATE_INDEX__FAILURE__MSG = "Failed to create index \"{0}\" due to following reasons";
-  public static final String CREATE_INDEX__NAME__MSG = "Name       : {0}";
-  public static final String CREATE_INDEX__REGIONPATH__MSG = "RegionPath : {0}";
-  public static final String CREATE_INDEX__MEMBER__MSG = "Members which contain the index";
-  public static final String CREATE_INDEX__NUMBER__AND__MEMBER = "{0}. {1}";
-  public static final String CREATE_INDEX__EXCEPTION__OCCURRED__ON = "Occurred on following members";
-  
-  //Describe lucene index commands
-  public static final String LUCENE_DESCRIBE_INDEX = "describe lucene index";
-  public static final String LUCENE_DESCRIBE_INDEX__HELP = "Display the describe of lucene indexes created for all members.";
-  public static final String LUCENE_DESCRIBE_INDEX__ERROR_MESSAGE = "An error occurred while collecting lucene index information across the Geode cluster: %1$s";
-  public static final String LUCENE_DESCRIBE_INDEX__NAME__HELP = "Name of the lucene index to describe.";
-  public static final String LUCENE_DESCRIBE_INDEX__REGION_HELP = "Name/Path of the region where the lucene index to be described exists.";
-
-  
-  //Search lucene index commands
-  public static final String LUCENE_SEARCH_INDEX = "search lucene";
-  public static final String LUCENE_SEARCH_INDEX__HELP = "Search lucene index";
-  public static final String LUCENE_SEARCH_INDEX__ERROR_MESSAGE = "An error occurred while searching lucene index across the Geode cluster: %1$s";
-  public static final String LUCENE_SEARCH_INDEX__NAME__HELP = "Name of the lucene index to search.";
-  public static final String LUCENE_SEARCH_INDEX__REGION_HELP = "Name/Path of the region where the lucene index exists.";
-  public static final String LUCENE_SEARCH_INDEX__QUERY_STRING="queryStrings";
-  public static final String LUCENE_SEARCH_INDEX__LIMIT="limit";
-  public static final String LUCENE_SEARCH_INDEX__LIMIT__HELP="Number of search results needed";
-  public static final String LUCENE_SEARCH_INDEX__QUERY_STRING__HELP="Query string to search the lucene index";
-  public static final String LUCENE_SEARCH_INDEX__DEFAULT_FIELD="defaultField";
-  public static final String LUCENE_SEARCH_INDEX__DEFAULT_FIELD__HELP="Default field to search in";
-  public static final String LUCENE_SEARCH_INDEX__NO_RESULTS_MESSAGE="No results";
-  public static final String LUCENE_SEARCH_INDEX__PAGE_SIZE="pageSize";
-  public static final String LUCENE_SEARCH_INDEX__PAGE_SIZE__HELP="Number of results to be returned in a page";
-  public static final String LUCENE_SEARCH_INDEX__KEYSONLY="keys-only";
-  public static final String LUCENE_SEARCH_INDEX__KEYSONLY__HELP="Return only keys of search results.";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05e6d966/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
deleted file mode 100755
index 200a14f..0000000
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * 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.lucene.internal.cli;
-
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.apache.geode.security.ResourcePermission.Operation;
-import org.apache.geode.security.ResourcePermission.Resource;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
-import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.execute.Execution;
-import com.gemstone.gemfire.cache.execute.FunctionAdapter;
-import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-
-import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneCreateIndexFunction;
-import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneDescribeIndexFunction;
-import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneListIndexFunction;
-import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneSearchIndexFunction;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.execute.AbstractExecution;
-import com.gemstone.gemfire.internal.security.IntegratedSecurityService;
-import com.gemstone.gemfire.internal.security.SecurityService;
-import com.gemstone.gemfire.management.cli.CliMetaData;
-import com.gemstone.gemfire.management.cli.ConverterHint;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.CliUtil;
-import com.gemstone.gemfire.management.internal.cli.commands.AbstractCommandsSupport;
-import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResultException;
-import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.management.internal.security.ResourceOperation;
-
-/**
- * The LuceneIndexCommands class encapsulates all Geode shell (Gfsh) commands related to Lucene indexes defined in Geode.
- * </p>
- * @see AbstractCommandsSupport
- * @see LuceneIndexDetails
- * @see LuceneListIndexFunction
- */
-@SuppressWarnings("unused")
-public class LuceneIndexCommands extends AbstractCommandsSupport {
-  private static final LuceneCreateIndexFunction createIndexFunction = new LuceneCreateIndexFunction();
-  private static final LuceneDescribeIndexFunction describeIndexFunction = new LuceneDescribeIndexFunction();
-  private static final LuceneSearchIndexFunction searchIndexFunction = new LuceneSearchIndexFunction();
-  private List<LuceneSearchResults> searchResults=null;
-
-  private SecurityService securityService = IntegratedSecurityService.getSecurityService();
-
-  @CliCommand(value = LuceneCliStrings.LUCENE_LIST_INDEX, help = LuceneCliStrings.LUCENE_LIST_INDEX__HELP)
-  @CliMetaData(shellOnly = false, relatedTopic={CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA })
-  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
-  public Result listIndex(
-    @CliOption(key = LuceneCliStrings.LUCENE_LIST_INDEX__STATS,
-      mandatory=false,
-      specifiedDefaultValue = "true",
-      unspecifiedDefaultValue = "false",
-      help = LuceneCliStrings.LUCENE_LIST_INDEX__STATS__HELP) final boolean stats) {
-
-    try {
-      return toTabularResult(getIndexListing(),stats);
-    }
-    catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN,
-        LuceneCliStrings.LUCENE_LIST_INDEX));
-    }
-    catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    }
-    catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().info(t);
-      return ResultBuilder.createGemFireErrorResult(String.format(LuceneCliStrings.LUCENE_LIST_INDEX__ERROR_MESSAGE,
-        toString(t, isDebugging())));
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  protected List<LuceneIndexDetails> getIndexListing() {
-    final Execution functionExecutor = getMembersFunctionExecutor(getMembers(getCache()));
-
-    if (functionExecutor instanceof AbstractExecution) {
-      ((AbstractExecution) functionExecutor).setIgnoreDepartedMembers(true);
-    }
-
-    final ResultCollector resultsCollector = functionExecutor.execute(new LuceneListIndexFunction());
-    final List<Set<LuceneIndexDetails>> results = (List<Set<LuceneIndexDetails>>) resultsCollector.getResult();
-
-    return results.stream()
-      .flatMap(set -> set.stream())
-      .sorted()
-      .collect(Collectors.toList());
-  }
-
-  protected Result toTabularResult(final List<LuceneIndexDetails> indexDetailsList, boolean stats) {
-    if (!indexDetailsList.isEmpty()) {
-      final TabularResultData indexData = ResultBuilder.createTabularResultData();
-
-      for (final LuceneIndexDetails indexDetails : indexDetailsList) {
-        indexData.accumulate("Index Name", indexDetails.getIndexName());
-        indexData.accumulate("Region Path", indexDetails.getRegionPath());
-        indexData.accumulate("Indexed Fields", indexDetails.getSearchableFieldNamesString());
-        indexData.accumulate("Field Analyzer", indexDetails.getFieldAnalyzersString());
-        indexData.accumulate("Status", indexDetails.getInitialized() == true ? "Initialized" : "Defined");
-
-        if (stats == true) {
-          if (!indexDetails.getInitialized()) {
-            indexData.accumulate("Query Executions", "NA");
-            indexData.accumulate("Updates", "NA");
-            indexData.accumulate("Commits", "NA");
-            indexData.accumulate("Documents", "NA");
-          }
-          else {
-            indexData.accumulate("Query Executions", indexDetails.getIndexStats().get("queryExecutions"));
-            indexData.accumulate("Updates", indexDetails.getIndexStats().get("updates"));
-            indexData.accumulate("Commits", indexDetails.getIndexStats().get("commits"));
-            indexData.accumulate("Documents", indexDetails.getIndexStats().get("documents"));
-          }
-        }
-      }
-      return ResultBuilder.buildResult(indexData);
-    }
-    else {
-      return ResultBuilder.createInfoResult(LuceneCliStrings.LUCENE_LIST_INDEX__INDEXES_NOT_FOUND_MESSAGE);
-    }
-  }
-
-  @CliCommand(value = LuceneCliStrings.LUCENE_CREATE_INDEX, help = LuceneCliStrings.LUCENE_CREATE_INDEX__HELP)
-  @CliMetaData(shellOnly = false, relatedTopic={CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA }, writesToSharedConfiguration=true)
-  //TODO : Add optionContext for indexName
-  public Result createIndex(
-    @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
-      mandatory=true,
-      help = LuceneCliStrings.LUCENE_CREATE_INDEX__NAME__HELP) final String indexName,
-
-    @CliOption (key = LuceneCliStrings.LUCENE__REGION_PATH,
-      mandatory = true,
-      optionContext = ConverterHint.REGIONPATH,
-      help = LuceneCliStrings.LUCENE_CREATE_INDEX__REGION_HELP) final String regionPath,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD,
-      mandatory = true,
-      help = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD_HELP)
-    @CliMetaData (valueSeparator = ",") final String[] fields,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER,
-      mandatory = false,
-      unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
-      help = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER_HELP)
-    @CliMetaData (valueSeparator = ",") final String[] analyzers,
-
-    @CliOption (key = LuceneCliStrings.LUCENE_CREATE_INDEX__GROUP,
-      optionContext = ConverterHint.MEMBERGROUP,
-      unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
-      help = LuceneCliStrings.LUCENE_CREATE_INDEX__GROUP__HELP)
-    @CliMetaData (valueSeparator = ",") final String[] groups) {
-
-    Result result = null;
-    XmlEntity xmlEntity = null;
-
-    this.securityService.authorizeRegionManage(regionPath);
-    try {
-      final Cache cache = getCache();
-      LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath, fields, analyzers);
-      final ResultCollector<?, ?> rc = this.executeFunctionOnGroups(createIndexFunction, groups, indexInfo);
-      final List<CliFunctionResult> funcResults = (List<CliFunctionResult>) rc.getResult();
-
-      final TabularResultData tabularResult = ResultBuilder.createTabularResultData();
-      for (final CliFunctionResult cliFunctionResult : funcResults) {
-        tabularResult.accumulate("Member",cliFunctionResult.getMemberIdOrName());
-
-          if (cliFunctionResult.isSuccessful()) {
-            tabularResult.accumulate("Status","Successfully created lucene index");
-//            if (xmlEntity == null) {
-//              xmlEntity = cliFunctionResult.getXmlEntity();
-//            }
-          }
-          else {
-            tabularResult.accumulate("Status","Failed: "+cliFunctionResult.getMessage());
-          }
-      }
-        result = ResultBuilder.buildResult(tabularResult);
-      }
-     catch (CommandResultException crex) {
-      result = crex.getResult();
-    } catch (Exception e) {
-      result = ResultBuilder.createGemFireErrorResult(e.getMessage());
-    }
-//    TODO - store in cluster config
-//    if (xmlEntity != null) {
-//      result.setCommandPersisted((new SharedConfigurationWriter()).addXmlEntity(xmlEntity, groups));
-//    }
-
-    return result;
-  }
-
-  @CliCommand(value = LuceneCliStrings.LUCENE_DESCRIBE_INDEX, help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__HELP)
-  @CliMetaData(shellOnly = false, relatedTopic={CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA })
-  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
-  public Result describeIndex(
-    @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
-      mandatory=true,
-      help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__NAME__HELP) final String indexName,
-
-    @CliOption (key = LuceneCliStrings.LUCENE__REGION_PATH,
-      mandatory = true,
-      optionContext = ConverterHint.REGIONPATH,
-      help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__REGION_HELP) final String regionPath) {
-    try {
-      LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath);
-      return toTabularResult(getIndexDetails(indexInfo),true);
-    }
-    catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN,
-        LuceneCliStrings.LUCENE_DESCRIBE_INDEX));
-    }
-    catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    }
-    catch (IllegalArgumentException e) {
-      return ResultBuilder.createInfoResult(e.getMessage());
-    }
-    catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().info(t);
-      return ResultBuilder.createGemFireErrorResult(String.format(LuceneCliStrings.LUCENE_DESCRIBE_INDEX__ERROR_MESSAGE,
-        toString(t, isDebugging())));
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  protected List<LuceneIndexDetails> getIndexDetails(LuceneIndexInfo indexInfo) throws Exception {
-    this.securityService.authorizeRegionManage(indexInfo.getRegionPath());
-    final ResultCollector<?, ?> rc = this.executeFunctionOnGroups(describeIndexFunction, new String[] {}, indexInfo);
-    final List<LuceneIndexDetails> funcResults = (List<LuceneIndexDetails>) rc.getResult();
-    return funcResults.stream().filter(indexDetails -> indexDetails != null).collect(Collectors.toList());
-  }
-
-  @CliCommand(value = LuceneCliStrings.LUCENE_SEARCH_INDEX, help = LuceneCliStrings.LUCENE_SEARCH_INDEX__HELP)
-  @CliMetaData(shellOnly = false, relatedTopic = { CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA })
-  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
-  public Result searchIndex(
-    @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
-      mandatory = true,
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__NAME__HELP) final String indexName,
-
-    @CliOption(key = LuceneCliStrings.LUCENE__REGION_PATH,
-      mandatory = true,
-      optionContext = ConverterHint.REGIONPATH,
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__REGION_HELP) final String regionPath,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING,
-      mandatory = true,
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING__HELP) final String queryString,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD,
-      mandatory = true,
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD__HELP) final String defaultField,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT,
-      mandatory = false,
-      unspecifiedDefaultValue = "-1",
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT__HELP) final int limit,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE,
-      mandatory = false,
-      unspecifiedDefaultValue = "-1",
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE__HELP) int pageSize,
-
-    @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY,
-      mandatory = false,
-      unspecifiedDefaultValue = "false",
-      help = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY__HELP) boolean keysOnly)
-  {
-    try {
-      LuceneQueryInfo queryInfo = new LuceneQueryInfo(indexName, regionPath, queryString, defaultField, limit, keysOnly);
-      if (pageSize == -1) {
-        pageSize = Integer.MAX_VALUE;
-      }
-      searchResults = getSearchResults(queryInfo);
-      return displayResults(pageSize, keysOnly);
-    }
-    catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN,
-        LuceneCliStrings.LUCENE_SEARCH_INDEX));
-    }
-    catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    }
-    catch (IllegalArgumentException e) {
-      return ResultBuilder.createInfoResult(e.getMessage());
-    }
-    catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().info(t);
-      return ResultBuilder.createGemFireErrorResult(String.format(LuceneCliStrings.LUCENE_SEARCH_INDEX__ERROR_MESSAGE,
-        toString(t, isDebugging())));
-    }
-  }
-
-  private Result displayResults(int pageSize, boolean keysOnly) throws Exception {
-    if (searchResults.size() == 0) {
-      return ResultBuilder.createInfoResult(LuceneCliStrings.LUCENE_SEARCH_INDEX__NO_RESULTS_MESSAGE);
-    }
-
-    Gfsh gfsh = initGfsh();
-    boolean pagination = searchResults.size() > pageSize;
-    int fromIndex = 0;
-    int toIndex = pageSize < searchResults.size() ? pageSize : searchResults.size();
-    int currentPage = 1;
-    int totalPages = (int) Math.ceil((float) searchResults.size() / pageSize);
-    boolean skipDisplay = false;
-    String step = null;
-    do {
-
-      if (!skipDisplay) {
-        CommandResult commandResult = (CommandResult) getResults(fromIndex, toIndex, keysOnly);
-        if (!pagination) {
-          return commandResult;
-        }
-        Gfsh.println();
-        while (commandResult.hasNextLine()) {
-          gfsh.printAsInfo(commandResult.nextLine());
-        }
-        gfsh.printAsInfo("\t\tPage " + currentPage + " of " + totalPages);
-        String message = ("Press n to move to next page, q to quit and p to previous page : ");
-        step = gfsh.interact(message);
-      }
-
-      switch (step) {
-        case "n":
-        {
-          if (currentPage == totalPages) {
-            gfsh.printAsInfo("No more results to display.");
-            step = gfsh.interact("Press p to move to last page and q to quit.");
-            skipDisplay = true;
-            continue;
-          }
-
-          if(skipDisplay) {
-            skipDisplay=false;
-          }
-          else {
-            currentPage++;
-            int current = fromIndex;
-            fromIndex = toIndex;
-            toIndex = (pageSize + fromIndex >= searchResults.size()) ? searchResults.size() : pageSize + fromIndex;
-          }
-          break;
-        }
-        case "p": {
-          if (currentPage == 1) {
-            gfsh.printAsInfo("At the top of the search results.");
-            step = gfsh.interact("Press n to move to the first page and q to quit.");
-            skipDisplay=true;
-            continue;
-          }
-
-          if (skipDisplay) {
-            skipDisplay = false;
-          }
-          else {
-            currentPage--;
-            int current = fromIndex;
-            toIndex = fromIndex;
-            fromIndex = current - pageSize <= 0 ? 0 : current - pageSize;
-          }
-          break;
-        }
-        case "q":
-          return ResultBuilder.createInfoResult("Search complete.");
-        default:
-          Gfsh.println("Invalid option");
-          break;
-      }
-    } while(true);
-  }
-
-  protected Gfsh initGfsh() {
-    return Gfsh.getCurrentInstance();
-  }
-
-  private List<LuceneSearchResults> getSearchResults(final LuceneQueryInfo queryInfo) throws Exception {
-    securityService.authorizeRegionManage(queryInfo.getRegionPath());
-
-    final String[] groups = {};
-    final ResultCollector<?, ?> rc = this.executeSearch(queryInfo);
-    final List<Set<LuceneSearchResults>> functionResults = (List<Set<LuceneSearchResults>>) rc.getResult();
-
-    return functionResults.stream()
-      .flatMap(set -> set.stream())
-      .sorted()
-      .collect(Collectors.toList());
-  }
-
-  private Result getResults(int fromIndex, int toIndex, boolean keysonly) throws Exception {
-    final TabularResultData data = ResultBuilder.createTabularResultData();
-    for (int i = fromIndex; i < toIndex; i++) {
-      if (!searchResults.get(i).getExeptionFlag()) {
-        data.accumulate("key", searchResults.get(i).getKey());
-        if (!keysonly) {
-          data.accumulate("value", searchResults.get(i).getValue());
-          data.accumulate("score", searchResults.get(i).getScore());
-        }
-      }
-      else {
-        throw new Exception(searchResults.get(i).getExceptionMessage());
-      }
-    }
-    return ResultBuilder.buildResult(data);
-  }
-
-  protected ResultCollector<?, ?> executeFunctionOnGroups(FunctionAdapter function,
-                                                          String[] groups,
-                                                          final LuceneIndexInfo indexInfo) throws IllegalArgumentException, CommandResultException
-  {
-    final Set<DistributedMember> targetMembers;
-    if (function != createIndexFunction) {
-      targetMembers = CliUtil.getMembersForeRegionViaFunction(getCache(), indexInfo.getRegionPath());
-      if (targetMembers.isEmpty()) {
-        throw new IllegalArgumentException("Region not found.");
-      }
-    }
-    else {
-      targetMembers = CliUtil.findAllMatchingMembers(groups, null);
-    }
-    return CliUtil.executeFunction(function, indexInfo, targetMembers);
-  }
-
-  protected ResultCollector<?, ?> executeSearch(final LuceneQueryInfo queryInfo) throws Exception {
-    final Set<DistributedMember> targetMembers = CliUtil.getMembersForeRegionViaFunction(getCache(),queryInfo.getRegionPath());
-    if (targetMembers.isEmpty())
-      throw new IllegalArgumentException("Region not found.");
-    return CliUtil.executeFunction(searchIndexFunction, queryInfo, targetMembers);
-  }
-
-  @CliAvailabilityIndicator({LuceneCliStrings.LUCENE_SEARCH_INDEX, LuceneCliStrings.LUCENE_CREATE_INDEX,
-    LuceneCliStrings.LUCENE_DESCRIBE_INDEX, LuceneCliStrings.LUCENE_LIST_INDEX})
-  public boolean indexCommandsAvailable() {
-    return (!CliUtil.isGfshVM() || (getGfsh() != null && getGfsh().isConnectedAndReady()));
-  }
-}


[26/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java
deleted file mode 100644
index 0cb60be..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationDUnitTest.java
+++ /dev/null
@@ -1,1336 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.EntryExistsException;
-import com.gemstone.gemfire.cache.client.ServerOperationException;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.cache.wan.BatchException70;
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class SerialWANPropagationDUnitTest extends WANTestBase {
-
-  @Override
-  public final void postSetUpWANTestBase() throws Exception {
-    IgnoredException.addIgnoredException("Connection reset");
-    IgnoredException.addIgnoredException("Broken pipe");
-    IgnoredException.addIgnoredException("Connection refused");
-    IgnoredException.addIgnoredException("could not get remote locator information");
-    IgnoredException.addIgnoredException("Unexpected IOException");
-  }
-
-  /**
-   * this test is disabled due to a high rate of failure in unit test runs
-   * see ticket #52190
-   */
-  @Ignore("TODO: test is disabled because of #52190")
-  @Test
-  public void testReplicatedSerialPropagation_withoutRemoteLocator() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //keep the batch size high enough to reduce the number of exceptions in the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 400, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-
-  protected SerializableRunnableIF createReplicatedRegionRunnable() {
-    return () -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()   );
-  }
-
-  @Test
-  public void testReplicatedSerialPropagation_withoutRemoteSite() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //keep the batch size high enough to reduce the number of exceptions in the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 400, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 400, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-    
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  /**
-   * Added to reproduce the bug #46595
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithoutRemoteSite_defect46595()
-      throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    // reduce the batch-size so maximum number of batches will be sent
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 5, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 5, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    IgnoredException.addIgnoredException(IOException.class.getName());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        10000 ));
-
-    // pause for some time before starting up the remote site
-    Wait.pause(10000);
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", null, isOffHeap()  ));
-  
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationWithLocalSiteClosedAndRebuilt() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-    
-    //---------close local site and build again-----------------------------------------
-    vm4.invoke(() -> WANTestBase.killSender( ));
-    vm5.invoke(() -> WANTestBase.killSender( ));
-    vm6.invoke(() -> WANTestBase.killSender( ));
-    vm7.invoke(() -> WANTestBase.killSender( ));
-    
-    Integer regionSize = 
-      (Integer) vm2.invoke(() -> WANTestBase.getRegionSize(getTestMethodName() + "_RR" ));
-    LogWriterUtils.getLogWriter().info("Region size on remote is: " + regionSize);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-      false, 100, 10, false, false, null, true ));
-    
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    vm5.invoke(() -> WANTestBase.waitForSenderRunningState( "ln" ));
-    
-    IgnoredException.addIgnoredException(EntryExistsException.class.getName());
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-      1000 ));
-    //----------------------------------------------------------------------------------
-
-    //verify remote site receives all the events
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-
-  /**
-   * Two regions configured with the same sender and put is in progress 
-   * on both the regions.
-   * One of the two regions is destroyed in the middle.
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithLocalRegionDestroy() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 20, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 20, false, false, null, true ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    //create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    //create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-    //do puts in RR_2 in main thread
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 500 ));
-    //destroy RR_2 after above puts are complete
-    vm4.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
-    
-    inv1.join();
-
-    //vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_2", 500 ));
-  }
-
-  /**
-   * 1 region and sender configured on local site and 1 region and a 
-   * receiver configured on remote site. Puts to the local region are in progress.
-   * Remote region is destroyed in the middle.
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 500, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 500, false, false, null, true ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-    //destroy RR_1 in remote site
-    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_1"));
-
-    inv1.join();
-
-    //verify that all is well in local site. All the events should be present in local region
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 1000 ));
-    //assuming some events might have been dispatched before the remote region was destroyed,
-    //sender's region queue will have events less than 1000 but the queue will not be empty.
-    //NOTE: this much verification might be sufficient in DUnit. Hydra will take care of 
-    //more in depth validations.
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty("ln" ));
-  }
-  
-  /**
-   * Two regions configured in local with the same sender and put is in progress 
-   * on both the regions. Same two regions are configured on remote site as well.
-   * One of the two regions is destroyed in the middle on remote site.
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy2() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 200, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 200, false, false, null, true ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    //create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
-    
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    //create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    //destroy RR_2 on remote site in the middle
-    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName() + "_RR_2"));
-    
-    //expected exceptions in the logs
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    //start puts in RR_2 in another thread
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
-    
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-
-    inv1.join();
-
-    //though region RR_2 is destroyed, RR_1 should still get all the events put in it 
-    //in local site
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 1000 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteRegionDestroy3()
-      throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    // these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    // senders are created on local site
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 200, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 200, false, false, null, true ));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    // create another RR (RR_2) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", null, isOffHeap()  ));
-    
-    // start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    // create another RR (RR_2) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_2", "ln", isOffHeap()  ));
-
-    IgnoredException.addIgnoredException(BatchException70.class.getName());
-    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
-    
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-    // start puts in RR_2 in another thread
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_2", 1000 ));
-    // destroy RR_2 on remote site in the middle
-    vm2.invoke(() -> WANTestBase.destroyRegion( getTestMethodName()
-        + "_RR_2" ));
-
-    inv1.join();
-    inv2.join();
-
-    // though region RR_2 is destroyed, RR_1 should still get all the events put
-    // in it
-    // in local site
-    try {
-      vm2.invoke(() -> WANTestBase.validateRegionSize(
-          getTestMethodName() + "_RR_1", 1000 ));
-    } finally {
-      System.setProperty(
-          DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
-      vm4.invoke(new CacheSerializableRunnable("UnSetting system property ") {
-        public void run2() throws CacheException {
-          System.setProperty(
-              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
-        }
-      });
-
-      vm5.invoke(new CacheSerializableRunnable("UnSetting system property ") {
-        public void run2() throws CacheException {
-          System.setProperty(
-              DistributionConfig.GEMFIRE_PREFIX + "GatewaySender.REMOVE_FROM_QUEUE_ON_EXCEPTION", "False");
-        }
-      });
-    }
-  }
-  
-  /**
-   * one region and sender configured on local site and the same region and a 
-   * receiver configured on remote site. Puts to the local region are in progress.
-   * Receiver on remote site is stopped in the middle by closing remote site cache.
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteReceiverStopped() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    //these are part of remote site
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    //these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    //senders are created on local site. Batch size is kept to a high (170) so 
-    //there will be less number of exceptions (occur during dispatchBatch) in the log 
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 350, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 350, false, false, null, true ));
-
-    //create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    //start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    //create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    //start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 500 ));
-    //close cache in remote site. This will automatically kill the remote receivers.
-    vm2.invoke(() -> WANTestBase.closeCache());
-
-    inv1.join();
-
-    //verify that all is well in local site
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 500 ));
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty("ln" ));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteReceiverRestarted()
-      throws Exception {
-    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    // these are part of remote site
-    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    // senders are created on local site. Batch size is kept to a high (170) so
-    // there will be less number of exceptions (occur during dispatchBatch) in
-    // the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 350, false, false, null, true ));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    // start the senders on local site
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
-    // close cache in remote site. This will automatically kill the remote
-    // receivers.
-    Wait.pause(2000);
-    vm2.invoke(() -> WANTestBase.closeCache());
-
-    inv1.join();
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-
-    // verify that all is well in local site
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 8000 ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-
-    vm2.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteReceiverRestarted_SenderReceiverPersistent()
-      throws Exception {
-    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    // these are part of remote site
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    // senders are created on local site. Batch size is kept to a high (170) so
-    // there will be less number of exceptions (occur during dispatchBatch) in
-    // the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 350, false, true, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 350, false, true, null, true));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
-    vm2.invoke(() -> WANTestBase.addListenerToSleepAfterCreateEvent(2000, getTestMethodName() + "_RR_1"));
-    // start the senders on local site
-    startSenderInVMs("ln", vm4, vm5);
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
-
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
-    // close cache in remote site. This will automatically kill the remote
-    // receivers.
-    vm2.invoke(() -> WANTestBase.closeCache());
-
-    inv1.join();
-
-    // verify that all is well in local site
-    vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
-
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents("ln", 0));
-
-    vm2.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats(1, 1));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteSiteBouncedBack_ReceiverPersistent()
-      throws Exception {
-    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    // these are part of remote site
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    // senders are created on local site. Batch size is kept to a high (170) so
-    // there will be less number of exceptions (occur during dispatchBatch) in
-    // the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 350, false, false, null, true ));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    // start the senders on local site
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
-    // close cache in remote site. This will automatically kill the remote
-    // receivers.
-    Wait.pause(2000);
-    vm1.invoke(() -> WANTestBase.shutdownLocator());
-    vm2.invoke(() -> WANTestBase.closeCache());
-
-    inv1.join();
-
-    // Do some extra puts after cache close so that some events are in the queue.
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-
-    // verify that all is well in local site
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 8000 ));
-
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
-
-    vm1.invoke(() -> WANTestBase.bringBackLocatorOnOldPort(
-        2, lnPort, nyPort ));
-
-    createCacheInVMs(nyPort, vm2);
-
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(
-      getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR_1", 8000 ));
-    
-    vm2.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteSiteBouncedBackWithMultipleRemoteLocators()
-      throws Exception {
-    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort1 = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer nyPort2 = (Integer) vm3.invoke(() -> WANTestBase.createSecondRemoteLocator( 2, nyPort1, lnPort ));
-
-    // these are part of remote site
-    createCacheInVMs(nyPort1, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    // senders are created on local site. Batch size is kept to a high (170) so
-    // there will be less number of exceptions (occur during dispatchBatch) in
-    // the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 350, false, false, null, true ));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-
-    // start the senders on local site
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR_1", "ln", isOffHeap()  ));
-
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
-    // close cache in remote site. This will automatically kill the remote
-    // receivers.
-    Wait.pause(2000);
-    vm1.invoke(() -> WANTestBase.shutdownLocator());
-    vm2.invoke(() -> WANTestBase.closeCache());
-
-    inv1.join();
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 1000 ));
-    // verify that all is well in local site
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR_1", 8000 ));
-
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
-
-    createCacheInVMs(nyPort2, vm6);
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR_1", null, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents( "ln",
-        0 ));
-
-    vm6.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteReceiverRestartedOnOtherNode() throws Exception {
-    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    // these are part of remote site
-    createCacheInVMs(nyPort, vm2, vm3);
-
-    // these are part of local site
-    createCacheInVMs(lnPort, vm4);
-
-    // senders are created on local site. Batch size is kept to a high (170) so
-    // there will be less number of exceptions (occur during dispatchBatch) in
-    // the log
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2, false, 100, 350, false, false, null, true ));
-
-    // create one RR (RR_1) on remote site
-    vm2.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
-
-    vm2.invoke(() -> addListenerToSleepAfterCreateEvent(2000, getTestMethodName() + "_RR_1"));
-    vm3.invoke(() -> addListenerToSleepAfterCreateEvent(2000, getTestMethodName() + "_RR_1"));
-
-    // create one RR (RR_1) on local site
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
-    // start the senders on local site
-    vm4.invoke(() -> WANTestBase.startSender("ln"));
-
-    // start puts in RR_1 in another thread
-    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR_1", 8000 ));
-    // close cache in remote site. This will automatically kill the remote
-    // receivers.
-    vm2.invoke(() -> WANTestBase.closeCache());
-    vm3.invoke(() -> WANTestBase.closeCache());
-
-    inv1.join();
-
-    // verify that all is well in local site
-    vm4.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
-
-    vm4.invoke(() -> WANTestBase.verifyRegionQueueNotEmpty( "ln" ));
-
-    createCacheInVMs(nyPort, vm3);
-    vm3.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.validateQueueContents("ln", 0));
-
-    vm3.invoke(() -> WANTestBase.checkMinimumGatewayReceiverStats( 1, 1 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 8000));
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationToTwoWanSites() throws Exception {
-    Integer lnPort = createFirstLocatorWithDSId(1);
-    Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    createCacheInVMs(tkPort, vm3);
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial1",
-        2, false, 100, 10, false, false, null, true ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "lnSerial2",
-        3, false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("lnSerial1", vm4, vm5);
-    startSenderInVMs("lnSerial2", vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationHA() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-
-    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
-    Wait.pause(2000);
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    
-    inv1.join();
-    inv2.join();
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-  }
-  
-  /**
-   * Local site:: vm4: Primary vm5: Secondary
-   * 
-   * Remote site:: vm2, vm3, vm6, vm7: All hosting receivers
-   * 
-   * vm4 is killed, so vm5 takes primary charge
-   *
-   * SUR: disabling due to connection information not available in open source
-   * enable this once in closed source
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void testReplicatedSerialPropagationHA_ReceiverAffinity()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3, vm6, vm7);
-    createReceiverInVMs(vm2, vm3, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Started receivers on remote site");
-
-    WANTestBase.createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    LogWriterUtils.getLogWriter().info("Started senders on local site");
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-
-    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
-    LogWriterUtils.getLogWriter().info("Started async puts on local site");
-    Wait.pause(1000);
-
-    Map oldConnectionInfo = (Map)vm4.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
-    assertNotNull(oldConnectionInfo);
-    String oldServerHost = (String)oldConnectionInfo.get("serverHost");
-    int oldServerPort = (Integer)oldConnectionInfo.get("serverPort");
-    LogWriterUtils.getLogWriter().info("Got sender to receiver connection information");
-
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    inv2.join();
-    LogWriterUtils.getLogWriter().info("Killed primary sender on local site");
-    Wait.pause(5000);// give some time for vm5 to take primary charge
-
-    Map newConnectionInfo = (Map)vm5.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
-    assertNotNull(newConnectionInfo);
-    String newServerHost = (String)newConnectionInfo.get("serverHost");
-    int newServerPort = (Integer)newConnectionInfo.get("serverPort");
-    LogWriterUtils.getLogWriter().info("Got new sender to receiver connection information");
-    assertEquals(oldServerHost, newServerHost);
-    assertEquals(oldServerPort, newServerPort);
-
-    LogWriterUtils.getLogWriter()
-        .info(
-            "Matched the new connection info with old connection info. Receiver affinity verified.");
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-  }
-
-  /**
-   * Local site:: vm4: Primary vm5: Secondary
-   * 
-   * Remote site:: vm2, vm3, vm6, vm7: All hosting receivers
-   * 
-   * vm4 is killed, so vm5 takes primary charge. vm4 brought up. vm5 is killed,
-   * so vm4 takes primary charge again.
-   *
-   * SUR: commenting due to connection information not available in open source
-   * enable this once in closed source
-   */
-  @Ignore("TODO: test is disabled")
-  @Test
-  public void testReplicatedSerialPropagationHA_ReceiverAffinityScenario2()
-      throws Exception {
-
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3, vm6, vm7);
-    createReceiverInVMs(vm2, vm3, vm6, vm7);
-
-    LogWriterUtils.getLogWriter().info("Started receivers on remote site");
-
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    LogWriterUtils.getLogWriter().info("Started senders on local site");
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-
-    AsyncInvocation inv1 = vm5.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10000 ));
-    LogWriterUtils.getLogWriter().info("Started async puts on local site");
-    Wait.pause(1000);
-
-    Map oldConnectionInfo = (Map)vm4.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
-    assertNotNull(oldConnectionInfo);
-    String oldServerHost = (String)oldConnectionInfo.get("serverHost");
-    int oldServerPort = (Integer)oldConnectionInfo.get("serverPort");
-    LogWriterUtils.getLogWriter().info("Got sender to receiver connection information");
-
-    // ---------------------------- KILL vm4
-    // --------------------------------------
-    AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());
-    inv2.join();
-    LogWriterUtils.getLogWriter().info("Killed vm4 (primary sender) on local site");
-    // -----------------------------------------------------------------------------
-
-    vm5.invoke(() -> WANTestBase.waitForSenderToBecomePrimary( "ln" ));
-    LogWriterUtils.getLogWriter().info("vm5 sender has now acquired primary status");
-    Wait.pause(5000);// give time to process unprocessedEventsMap
-
-    // ---------------------------REBUILD vm4
-    // --------------------------------------
-    LogWriterUtils.getLogWriter().info("Rebuilding vm4....");
-    createCacheInVMs(lnPort, vm4);
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm4.invoke(createReplicatedRegionRunnable());
-    LogWriterUtils.getLogWriter().info("Rebuilt vm4");
-    // -----------------------------------------------------------------------------
-
-    // --------------------------- KILL vm5
-    // ----------------------------------------
-    inv1.join();// once the puts are done, kill vm5
-    LogWriterUtils.getLogWriter().info("puts in vm5 are done");
-
-    inv2 = vm5.invokeAsync(() -> WANTestBase.killSender());
-    inv2.join();
-    vm4.invoke(() -> WANTestBase.waitForSenderToBecomePrimary( "ln" ));
-    // -----------------------------------------------------------------------------
-
-    Map newConnectionInfo = (Map)vm4.invoke(() -> WANTestBase.getSenderToReceiverConnectionInfo( "ln" ));
-    assertNotNull(newConnectionInfo);
-    String newServerHost = (String)newConnectionInfo.get("serverHost");
-    int newServerPort = (Integer)newConnectionInfo.get("serverPort");
-    LogWriterUtils.getLogWriter().info("Got new sender to receiver connection information");
-    assertEquals(oldServerHost, newServerHost);
-    assertEquals(oldServerPort, newServerPort);
-    LogWriterUtils.getLogWriter()
-        .info(
-            "Matched the new connection info with old connection info. Receiver affinity verified.");
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 10000 ));
-  }
-
-  @Test
-  public void testNormalRegionSerialPropagation() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2);
-    vm2.invoke(() -> WANTestBase.createReceiver());
-
-    createCacheInVMs(lnPort, vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", null, isOffHeap()  ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
-
-    vm4.invoke(() -> WANTestBase.createNormalRegion(
-        getTestMethodName() + "_RR", "ln" ));
-    vm5.invoke(() -> WANTestBase.createNormalRegion(
-        getTestMethodName() + "_RR", "ln" ));
-
-    vm5.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    vm4.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
-        0, 0, 0));
-
-    vm5.invoke(() -> WANTestBase.checkQueueStats( "ln", 0,
-        1000, 0, 0 ));
-    
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 1000));
-
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 0));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 0 ));
-    
-    vm2.invoke(() -> WANTestBase.checkGatewayReceiverStats(0, 0, 0));
-  }
-  
-  /**
-   * Added for defect #48582 NPE when WAN sender configured but not started.
-   * All to all topology with 2 WAN sites:
-   * Site 1 (LN site): vm4, vm5, vm6, vm7
-   * Site 2 (NY site): vm2, vm3
-   */
-  @Test
-  public void testReplicatedSerialPropagationWithRemoteSenderConfiguredButNotStarted() {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    createCacheInVMs(nyPort, vm2, vm3);
-    createReceiverInVMs(vm2, vm3);
-
-    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
-    createReceiverInVMs(vm4, vm5);
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-
-    startSenderInVMs("ln", vm4, vm5);
-
-    vm4.invoke(createReplicatedRegionRunnable());
-    vm5.invoke(createReplicatedRegionRunnable());
-    vm6.invoke(createReplicatedRegionRunnable());
-    vm7.invoke(createReplicatedRegionRunnable());
-    
-    vm2.invoke(() -> WANTestBase.createSender( "ny", 1,
-        false, 100, 10, false, false, null, true ));
-    vm3.invoke(() -> WANTestBase.createSender( "ny", 1,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny", isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny", isOffHeap() ));
-    
-    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
-        1000 ));
-
-    startSenderInVMs("ny", vm2, vm3);
-
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1000 ));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java
deleted file mode 100644
index 6859249..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANPropagationLoopBackDUnitTest.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * 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.internal.cache.wan.serial;
-
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class SerialWANPropagationLoopBackDUnitTest extends WANTestBase {
-  
-  private static final long serialVersionUID = 1L;
-  
-  public SerialWANPropagationLoopBackDUnitTest() {
-    super();
-  }
-  
-  @Test
-  public void testReplicatedSerialPropagationLoopBack() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-
-    vm2.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm3.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm2.invoke(() -> WANTestBase.createReceiver());
-    vm3.invoke(() -> WANTestBase.createReceiver());
-
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm7.invoke(() -> WANTestBase.createCache( nyPort ));
-
-    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm6.invoke(() -> WANTestBase.createSender( "ny", 1,
-        false, 100, 10, false, false, null, true ));
-
-    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny", isOffHeap() ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm6.invoke(() -> WANTestBase.startSender( "ny" ));
-    
-    vm4.invoke(() -> WANTestBase.addQueueListener( "ln",
-        false ));
-    vm6.invoke(() -> WANTestBase.addQueueListener( "ny",
-        false ));
-    
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln", isOffHeap()));
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny", isOffHeap()));
-
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 1; i++) {
-      keyValues.put(i, i);
-    }
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    keyValues.clear();
-    for(int i=1; i< 2; i++) {
-      keyValues.put(i, i);
-    }
-    vm6.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    vm2.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 2 ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 2 ));
-    
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 2 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 2 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 2 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", 2 ));
-  
-  
-    Wait.pause(5000);
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
-    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ny", 0 ));
-    
-    Map queueMap1 = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap2 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue());
-
-    List createList1 = (List)queueMap1.get("Create");
-    List updateList1 = (List)queueMap1.get("Update");
-    List createList2 = (List)queueMap2.get("Create");
-    List updateList2 = (List)queueMap2.get("Update");
-    
-    assertEquals(0, updateList1.size());
-    assertEquals(0, updateList2.size());
-    
-    assertEquals(1, createList1.size());
-    assertEquals(1, createList2.size());
-  }
-
-  @Test
-  public void testReplicatedSerialPropagationLoopBack3SitesLoop() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(lnPort, vm3, vm6);
-    createCacheInVMs(nyPort, vm4, vm7);
-    createCacheInVMs(tkPort, vm5);
-
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap()));
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ny", isOffHeap()));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "tk", isOffHeap()));
-
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ln", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-      getTestMethodName() + "_RR", "ny", isOffHeap() ));
-
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    vm5.invoke(() -> WANTestBase.createReceiver());
-
-    vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
-        false, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny", 3,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "tk", 1,
-      false, 100, 10, false, false, null, true ));
-
-    vm6.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm7.invoke(() -> WANTestBase.startSender( "ny" ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk" ));
-
-    // using vm5 for sender in ds 3. cache is already created.
-    vm6.invoke(() -> WANTestBase.addQueueListener( "ln",
-      false ));
-    vm7.invoke(() -> WANTestBase.addQueueListener( "ny",
-      false ));
-    vm5.invoke(() -> WANTestBase.addQueueListener( "tk",
-      false ));
-
-    int totalSize = 3;
-    int increment = 1;
-
-    final Map keyValues = new HashMap();
-    for(int i=0; i< increment; i++) {
-      keyValues.put(i, i);
-    }
-    vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    keyValues.clear();
-    for(int i = increment; i< 2*increment; i++) {
-      keyValues.put(i, i);
-    }
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    keyValues.clear();
-    for(int i=2*increment; i< totalSize; i++) {
-      keyValues.put(i, i);
-    }
-    vm5.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-        
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", totalSize ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", totalSize ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", totalSize ));
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", totalSize ));
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-      getTestMethodName() + "_RR", totalSize ));
-    
-    
-    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
-    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 0 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 0 ));
-    
-    
-    
-    Map queueMap1 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap2 = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap3 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    
-    List createList1 = (List)queueMap1.get("Create");
-    List updateList1 = (List)queueMap1.get("Update");
-    List createList2 = (List)queueMap2.get("Create");
-    List updateList2 = (List)queueMap2.get("Update");
-    List createList3 = (List)queueMap3.get("Create");
-    List updateList3 = (List)queueMap3.get("Update");
-    
-    assertEquals(0, updateList1.size());
-    assertEquals(0, updateList2.size());
-    assertEquals(0, updateList3.size());
-    
-    assertEquals(2, createList1.size());
-    assertEquals(2, createList2.size());
-    assertEquals(2, createList3.size());
-  }
-  
-  
-  @Test
-  public void testReplicatedSerialPropagationLoopBack3SitesNtoNPutInAllDS() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    createCacheInVMs(lnPort, vm3, vm6);
-    createCacheInVMs(nyPort, vm4, vm7);
-    createCacheInVMs(tkPort, vm5);
-
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    vm5.invoke(() -> WANTestBase.createReceiver());
-    
-    // using vm5 for sender in ds 3. cache is already created.
-    
-    vm6.invoke(() -> WANTestBase.createSender( "ln1", 2,
-        false, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny1", 3,
-        false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
-      false, 100, 10, false, false, null, true ));
-
-    vm6.invoke(() -> WANTestBase.createSender( "ln2", 3,
-      false, 100, 10, false, false, null, true ));
-    vm7.invoke(() -> WANTestBase.createSender( "ny2", 1,
-      false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "tk2", 2,
-    false, 100, 10, false, false, null, true ));
-
-    
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap()));
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny1,ny2", isOffHeap()));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "tk1,tk2", isOffHeap() ));
-
-    vm6.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm7.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
-    
-    vm6.invoke(() -> WANTestBase.startSender( "ln2" ));
-    vm7.invoke(() -> WANTestBase.startSender( "ny2" ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk2" ));
-    
-    
-    vm6.invoke(() -> WANTestBase.addQueueListener( "ln1",
-      false ));
-    vm7.invoke(() -> WANTestBase.addQueueListener( "ny1",
-      false ));
-    vm5.invoke(() -> WANTestBase.addQueueListener( "tk1",
-      false ));
-    vm6.invoke(() -> WANTestBase.addSecondQueueListener( "ln2",
-      false ));
-    vm7.invoke(() -> WANTestBase.addSecondQueueListener( "ny2",
-      false ));
-    vm5.invoke(() -> WANTestBase.addSecondQueueListener( "tk2",
-      false ));
-  
-    
-    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() ));
-    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny1,ny2", isOffHeap() ));
-    
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 1; i++) {
-      keyValues.put(i, i);
-    }
-    vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    keyValues.clear();
-    for(int i=1; i< 2; i++) {
-      keyValues.put(i, i);
-    }
-    vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    keyValues.clear();
-    for(int i=2; i< 3; i++) {
-      
-      keyValues.put(i, i);
-    }
-    vm5.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    Wait.pause(2000);
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 3 ));
-    vm6.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 3 ));
-    vm7.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 3 ));
-    
-    Wait.pause(5000);
-    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln1", 0 ));
-    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk1", 0 ));
-    vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln2", 0 ));
-    vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk2", 0 ));
-    
-    
-    Map queueMap1 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap2 = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap3 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap4 = (HashMap)vm6.invoke(() -> WANTestBase.checkQueue2());
-    Map queueMap5 = (HashMap)vm7.invoke(() -> WANTestBase.checkQueue2());
-    Map queueMap6 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue2());
-    
-    List createList1 = (List)queueMap1.get("Create");
-    List updateList1 = (List)queueMap1.get("Update");
-    List createList2 = (List)queueMap2.get("Create");
-    List updateList2 = (List)queueMap2.get("Update");
-    List createList3 = (List)queueMap3.get("Create");
-    List updateList3 = (List)queueMap3.get("Update");
-    
-    List createList4 = (List)queueMap4.get("Create");
-    List updateList4 = (List)queueMap4.get("Update");
-    
-    List createList5 = (List)queueMap5.get("Create");
-    List updateList5 = (List)queueMap5.get("Update");
-    
-    List createList6 = (List)queueMap6.get("Create");
-    List updateList6 = (List)queueMap6.get("Update");
-    
-    
-    assertEquals(0, updateList1.size());
-    assertEquals(0, updateList2.size());
-    assertEquals(0, updateList3.size());
-    assertEquals(0, updateList4.size());
-    assertEquals(0, updateList5.size());
-    assertEquals(0, updateList6.size());
-    
-    assertEquals(1, createList1.size());
-    assertEquals(1, createList2.size());
-    assertEquals(1, createList3.size());
-    assertEquals(1, createList4.size());
-    assertEquals(1, createList5.size());
-    assertEquals(1, createList6.size());
-  }
-
-  
-  @Test
-  public void testReplicatedSerialPropagationLoopBack3SitesNtoNPutFromOneDS() throws Exception {
-    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
-    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
-    Integer tkPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnPort ));
-
-    vm3.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm4.invoke(() -> WANTestBase.createCache( nyPort ));
-    vm5.invoke(() -> WANTestBase.createCache( tkPort ));
-    vm3.invoke(() -> WANTestBase.createReceiver());
-    vm4.invoke(() -> WANTestBase.createReceiver());
-    vm5.invoke(() -> WANTestBase.createReceiver());
-    
-    
-    vm3.invoke(() -> WANTestBase.createSender( "ln1", 2,
-        false, 100, 10, false, false, null, true ));
-    vm3.invoke(() -> WANTestBase.createSender( "ln2", 3,
-      false, 100, 10, false, false, null, true ));
-    
-    vm4.invoke(() -> WANTestBase.createSender( "ny1", 3,
-        false, 100, 10, false, false, null, true ));
-    vm4.invoke(() -> WANTestBase.createSender( "ny2", 1,
-      false, 100, 10, false, false, null, true ));
-    
-    vm5.invoke(() -> WANTestBase.createSender( "tk1", 1,
-      false, 100, 10, false, false, null, true ));
-    vm5.invoke(() -> WANTestBase.createSender( "tk2", 2,
-    false, 100, 10, false, false, null, true ));
-
-    
-    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() ));
-    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "ny1,ny2", isOffHeap() ));
-    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
-        getTestMethodName() + "_RR", "tk1,tk2", isOffHeap() ));
-
-    
-    vm3.invoke(() -> WANTestBase.startSender( "ln1" ));
-    vm4.invoke(() -> WANTestBase.startSender( "ny1" ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk1" ));
-    
-    vm3.invoke(() -> WANTestBase.startSender( "ln2" ));
-    vm4.invoke(() -> WANTestBase.startSender( "ny2" ));
-    vm5.invoke(() -> WANTestBase.startSender( "tk2" ));
-    
-    
-    vm3.invoke(() -> WANTestBase.addQueueListener( "ln1",
-      false ));
-    vm4.invoke(() -> WANTestBase.addQueueListener( "ny1",
-      false ));
-    vm5.invoke(() -> WANTestBase.addQueueListener( "tk1",
-      false ));
-    vm3.invoke(() -> WANTestBase.addSecondQueueListener( "ln2",
-      false ));
-    vm4.invoke(() -> WANTestBase.addSecondQueueListener( "ny2",
-      false ));
-    vm5.invoke(() -> WANTestBase.addSecondQueueListener( "tk2",
-      false ));
-  
-    final Map keyValues = new HashMap();
-    for(int i=0; i< 1; i++) {
-      keyValues.put(i, i);
-    }
-    vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
-      keyValues ));
-    
-    vm3.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1 ));
-    vm4.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1 ));
-    vm5.invoke(() -> WANTestBase.validateRegionSize(
-        getTestMethodName() + "_RR", 1 ));
-    
-    Wait.pause(5000);
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln1", 0 ));
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny1", 0 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk1", 0 ));
-    vm3.invoke(() -> WANTestBase.verifyQueueSize( "ln2", 0 ));
-    vm4.invoke(() -> WANTestBase.verifyQueueSize( "ny2", 0 ));
-    vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk2", 0 ));
-    
-    
-    Map queueMap1 = (HashMap)vm3.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap2 = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap3 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue());
-    Map queueMap4 = (HashMap)vm3.invoke(() -> WANTestBase.checkQueue2());
-    Map queueMap5 = (HashMap)vm4.invoke(() -> WANTestBase.checkQueue2());
-    Map queueMap6 = (HashMap)vm5.invoke(() -> WANTestBase.checkQueue2());
-    
-    List createList1 = (List)queueMap1.get("Create");
-    List updateList1 = (List)queueMap1.get("Update");
-    List createList2 = (List)queueMap2.get("Create");
-    List updateList2 = (List)queueMap2.get("Update");
-    List createList3 = (List)queueMap3.get("Create");
-    List updateList3 = (List)queueMap3.get("Update");
-    
-    List createList4 = (List)queueMap4.get("Create");
-    List updateList4 = (List)queueMap4.get("Update");
-    
-    List createList5 = (List)queueMap5.get("Create");
-    List updateList5 = (List)queueMap5.get("Update");
-    
-    List createList6 = (List)queueMap6.get("Create");
-    List updateList6 = (List)queueMap6.get("Update");
-    
-    
-    assertEquals(0, updateList1.size());
-    assertEquals(0, updateList2.size());
-    assertEquals(0, updateList3.size());
-    assertEquals(0, updateList4.size());
-    assertEquals(0, updateList5.size());
-    assertEquals(0, updateList6.size());
-    
-    assertEquals(1, createList1.size());
-    assertEquals(0, createList2.size());
-    assertEquals(0, createList3.size());
-    assertEquals(1, createList4.size());
-    assertEquals(0, createList5.size());
-    assertEquals(0, createList6.size());
-  }
-
-}


[03/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
new file mode 100644
index 0000000..c627353
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
@@ -0,0 +1,281 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandGatewayReceiverStopDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Test wan commands for error in input 1> start gateway-sender command needs
+   * only one of member or group.
+   */
+  @Test
+  public void testStopGatewayReceiver_ErrorConditions() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createReceiver( punePort ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
+        + CliStrings.STOP_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId()
+        + " --" + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1";
+
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewayReceiver_ErrorConditions stringResult : "
+              + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStopGatewayReceiver_ErrorConditions failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testStopGatewayReceiver() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createAndStartReceiver( punePort ));
+    vm4.invoke(() -> createAndStartReceiver( punePort ));
+    vm5.invoke(() -> createAndStartReceiver( punePort ));
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYRECEIVER;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a member
+   */
+  @Test
+  public void testStopGatewayReceiver_onMember() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createAndStartReceiver( punePort ));
+    vm4.invoke(() -> createAndStartReceiver( punePort ));
+    vm5.invoke(() -> createAndStartReceiver( punePort ));
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
+        + CliStrings.STOP_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId();
+
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewayReceiver_onMember stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("stopped on member"));
+    } else {
+      fail("testStopGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a group of members
+   */
+  @Test
+  public void testStopGatewayReceiver_Group() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
+    vm4.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
+    vm5.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
+        + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewayReceiver_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewayReceiver_Group failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more
+   * sender members belongs to multiple groups
+   * 
+   */
+  @Test
+  public void testStopGatewayReceiver_MultipleGroup() {
+
+    VM puneLocator = Host.getLocator();
+    int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
+    vm4.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
+    vm5.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1" ));
+    vm6.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG1, RG2" ));
+    vm7.invoke(() -> createAndStartReceiverWithGroup( punePort, "RG3" ));
+
+    vm3.invoke(() -> verifyReceiverState( true ));
+    vm4.invoke(() -> verifyReceiverState( true ));
+    vm5.invoke(() -> verifyReceiverState( true ));
+    vm6.invoke(() -> verifyReceiverState( true ));
+    vm7.invoke(() -> verifyReceiverState( true ));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
+        + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1,RG2";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewayReceiver_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewayReceiver failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifyReceiverState( false ));
+    vm4.invoke(() -> verifyReceiverState( false ));
+    vm5.invoke(() -> verifyReceiverState( false ));
+    vm6.invoke(() -> verifyReceiverState( false ));
+    vm7.invoke(() -> verifyReceiverState( true ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
new file mode 100644
index 0000000..74839a9
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
@@ -0,0 +1,400 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandGatewaySenderStartDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Test wan commands for error in input 1> start gateway-sender command needs
+   * only one of member or group.
+   */
+  @Test
+  public void testStartGatewaySender_ErrorConditions() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+    
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.START_GATEWAYSENDER + " --"
+        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.START_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId() + " --"
+        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenserGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  private CommandResult executeCommandWithIgnoredExceptions(String command) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      CommandResult commandResult = executeCommand(command);
+      return commandResult;
+    } finally {
+      exln.remove();
+    }
+  }
+
+  @Test
+  public void testStartGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --"
+        + CliStrings.START_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a member
+   */
+  @Test
+  public void testStartGatewaySender_onMember() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --"
+        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.START_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is started on member"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a group of members
+   */
+  @Test
+  public void testStartGatewaySender_Group() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+    
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --"
+        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewaySender_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more
+   * sender members belongs to multiple groups
+   */
+  @Test
+  public void testStartGatewaySender_MultipleGroup() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1, SenderGroup2" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm6.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1, SenderGroup2" ));
+    vm6.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm7.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup3" ));
+    vm7.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", false, false ));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --"
+        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStartGatewaySender_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", false, false ));
+  }
+
+  /**
+   * Test to validate the test scenario when one of the member ion group does
+   * not have the sender.
+   */
+  @Test
+  public void testStartGatewaySender_Group_MissingSenderFromGroup() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --"
+        + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.START_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      assertTrue(strCmdResult.contains("Error"));
+      assertTrue(strCmdResult.contains("is not available"));
+      getLogWriter().info(
+          "testStartGatewaySender_Group stringResult : " + strCmdResult
+              + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
new file mode 100644
index 0000000..a33d793
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
@@ -0,0 +1,352 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandGatewaySenderStopDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private CommandResult executeCommandWithIgnoredExceptions(String command) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    CommandResult commandResult =  executeCommand(command);
+    exln.remove();
+    return commandResult;
+  }
+
+  @Test
+  public void testStopGatewaySender_ErrorConditions() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+
+    String command = CliStrings.STOP_GATEWAYSENDER + " --"
+        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.STOP_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
+        + " --" + CliStrings.STOP_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testStopGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --"
+        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a member
+   */
+  @Test
+  public void testStopGatewaySender_onMember() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --"
+        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.STOP_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is stopped on member"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on
+   * a group of members
+   */
+  @Test
+  public void testStopGatewaySender_Group() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --"
+        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.STOP_GATEWAYSENDER__GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info(
+              "testStopGatewaySender_Group stringResult : " + strCmdResult
+                  + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more
+   * sender members belongs to multiple groups
+   */
+  @Test
+  public void testStopGatewaySender_MultipleGroup() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm3.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm4.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1" ));
+    vm4.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm5.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup1, SenderGroup2" ));
+    vm5.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm6.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup2" ));
+    vm6.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+    vm7.invoke(() -> createCacheWithGroups(
+        punePort, "SenderGroup3" ));
+    vm7.invoke(() -> createSender( "ln",
+        2, false, 100, 400, false, false, null, true ));
+
+    vm3.invoke(() -> startSender( "ln" ));
+    vm4.invoke(() -> startSender( "ln" ));
+    vm5.invoke(() -> startSender( "ln" ));
+    vm6.invoke(() -> startSender( "ln" ));
+    vm7.invoke(() -> startSender( "ln" ));
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", true, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, false ));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --"
+        + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
+        + CliStrings.STOP_GATEWAYSENDER__GROUP + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info(
+              "testStopGatewaySender_Group stringResult : " + strCmdResult
+                  + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult
+          .getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+
+    vm3.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm4.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm5.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm6.invoke(() -> verifySenderState(
+        "ln", false, false ));
+    vm7.invoke(() -> verifySenderState(
+        "ln", true, false ));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
new file mode 100644
index 0000000..0c91f33
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
@@ -0,0 +1,381 @@
+/*
+ * 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.internal.cache.wan.wancommand;
+
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.List;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+import static com.gemstone.gemfire.test.dunit.Wait.pause;
+
+@Category(DistributedTest.class)
+public class WanCommandListDUnitTest extends WANCommandTestBase {
+
+  private static final long serialVersionUID = 1L;
+
+  @Test
+  public void testListGatewayWithNoSenderReceiver() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createCache( punePort ));
+    
+    pause(10000);
+    String command = CliStrings.LIST_GATEWAY;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testListGatewaySender : : " + strCmdResult);
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testListGatewaySender() {
+
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+    vm7.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createCache( punePort ));
+    vm3.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+    vm3.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+
+    vm4.invoke(() -> createCache( punePort ));
+    vm4.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+    vm4.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+
+    vm5.invoke(() -> createCache( punePort ));
+    vm5.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+
+    pause(10000);
+    String command = CliStrings.LIST_GATEWAY;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testListGatewaySender" + strCmdResult);
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableResultData =
+      ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_senderIds = tableResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertTrue(result_senderIds.contains("ln_Serial"));
+      assertTrue(result_senderIds.contains("ln_Parallel"));
+      assertEquals(5, result_senderIds.size());
+      
+      assertEquals(null, ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER));
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testListGatewayReceiver() {
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm3.invoke(() -> createAndStartReceiver( lnPort ));
+    vm4.invoke(() -> createAndStartReceiver( lnPort ));
+
+    vm5
+        .invoke(() -> createCache( nyPort ));
+    vm5.invoke(() -> createSender(
+        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
+    vm6
+        .invoke(() -> createCache( nyPort ));
+    vm6.invoke(() -> createSender(
+        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
+    vm6.invoke(() -> createSender(
+        "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
+
+    pause(10000);
+    String command = CliStrings.LIST_GATEWAY;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testListGatewayReceiver" + strCmdResult);
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> ports = tableResultData.retrieveAllValues(CliStrings.RESULT_PORT);
+      assertEquals(2, ports.size());
+      List<String> hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, hosts.size());
+      
+      assertEquals(null, ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER));
+      
+      
+    } else {
+      fail("testListGatewayReceiver failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testListGatewaySenderGatewayReceiver() throws GfJsonException {
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createCache( lnPort ));
+    vm3.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+    vm3.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+
+    vm4.invoke(() -> createCache( lnPort ));
+    vm4.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+    vm4.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+
+    vm5.invoke(() -> createAndStartReceiver( lnPort ));
+
+    vm7.invoke(() -> createCache( nyPort ));
+    vm7.invoke(() -> createSender(
+        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
+    vm7.invoke(() -> createSender(
+        "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
+
+    pause(10000);
+    String command = CliStrings.LIST_GATEWAY;
+    CommandResult cmdResult = executeCommand(command);
+    
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testListGatewaySenderGatewayReceiver : " + strCmdResult );
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableSenderResultData = ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertEquals(4, senders.size());
+      List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(4, hosts.size());
+      
+      
+      TabularResultData tableReceiverResultData = ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
+      assertEquals(1, ports.size());
+      hosts = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(1, hosts.size());
+    } else {
+      fail("testListGatewaySenderGatewayReceiver failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testListGatewaySenderGatewayReceiver_group() {
+
+    Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
+
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
+
+    vm6.invoke(() -> createAndStartReceiver( nyPort ));
+
+    vm3.invoke(() -> createCacheWithGroups( lnPort, "Serial_Sender, Parallel_Sender"));
+    vm3.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+    vm3.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+
+    vm4.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender, Parallel_Sender"));
+    vm4.invoke(() -> createSender(
+        "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+    vm4.invoke(() -> createSender(
+        "ln_Serial", 2, false, 100, 400, false, false, null, false ));
+
+    vm5.invoke(() -> createAndStartReceiverWithGroup( lnPort, "Parallel_Sender,Receiver_Group" ));
+    vm5.invoke(() -> createSender(
+      "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
+    
+
+    vm7.invoke(() -> createCache( nyPort ));
+    vm7.invoke(() -> createSender(
+        "ln_Serial", 1, false, 100, 400, false, false, null, false ));
+    vm7.invoke(() -> createSender(
+        "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
+
+    pause(10000);
+    String command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableSenderResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertEquals(4, senders.size());
+      List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(4, hosts.size());
+      
+    } else {
+      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
+    }
+    
+    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Parallel_Sender";
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      TabularResultData tableSenderResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertEquals(5, senders.size());
+      
+      TabularResultData tableReceiverResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
+      assertEquals(1, ports.size());
+      
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
+    }
+    
+    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Receiver_Group";
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableSenderResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertEquals(1, senders.size());
+      
+      TabularResultData tableReceiverResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
+      assertEquals(1, ports.size());
+      
+    } else {
+      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
+    }
+
+    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender,Parallel_Sender";
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableSenderResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertEquals(5, senders.size());
+      
+      TabularResultData tableReceiverResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
+      assertEquals(1, ports.size());
+    } else {
+      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
+    }
+
+    command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender,Parallel_Sender,Receiver_Group";
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info(
+          "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      
+      TabularResultData tableSenderResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
+      assertEquals(5, senders.size());
+      
+      TabularResultData tableReceiverResultData =
+        ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
+      assertEquals(1, ports.size());
+      
+    } else {
+      fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
+    }
+    
+  }
+}


[13/61] [abbrv] incubator-geode git commit: GEODE-37 change package name from com.gemstone.gemfire (for ./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to ./geode-wan/src/test/java/org/apache/geode)

Posted by hi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANLocatorServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANLocatorServerDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANLocatorServerDUnitTest.java
new file mode 100644
index 0000000..7973c05
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANLocatorServerDUnitTest.java
@@ -0,0 +1,192 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.client.internal.Connection;
+import com.gemstone.gemfire.cache.client.internal.PoolImpl;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class WANLocatorServerDUnitTest extends WANTestBase {
+
+  static PoolImpl proxy;
+
+  @Override
+  protected final void postSetUpWANTestBase() throws Exception {
+    final Host host = Host.getHost(0);
+  }
+
+  @Test
+  public void test_3Locators_2Servers() {
+
+    int port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+
+    int port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+
+    int port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+
+    vm0.invoke(() -> WANLocatorServerDUnitTest.createLocator(
+        port1, port2, port3, port1 ));
+
+    vm1.invoke(() -> WANLocatorServerDUnitTest.createLocator(
+        port1, port2, port3, port2 ));
+
+    vm2.invoke(() -> WANLocatorServerDUnitTest.createLocator(
+        port1, port2, port3, port3 ));
+
+    vm3.invoke(() -> WANLocatorServerDUnitTest.createReceiver(
+        port1, port2, port3 ));
+    vm5.invoke(() -> WANLocatorServerDUnitTest.createClient(
+        port1, port2, port3 ));
+
+    vm0.invoke(() -> WANLocatorServerDUnitTest.disconnect());
+    vm1.invoke(() -> WANLocatorServerDUnitTest.disconnect());
+    vm2.invoke(() -> WANLocatorServerDUnitTest.disconnect());
+
+    vm0.invoke(() -> WANLocatorServerDUnitTest.createLocator(
+        port1, port2, port3, port1 ));
+
+    vm1.invoke(() -> WANLocatorServerDUnitTest.createLocator(
+        port1, port2, port3, port2 ));
+
+    vm2.invoke(() -> WANLocatorServerDUnitTest.createLocator(
+        port1, port2, port3, port3 ));
+
+    vm5.invoke(() -> WANLocatorServerDUnitTest.tryNewConnection());
+  }
+
+  public static void createLocator(Integer port1, Integer port2, Integer port3,
+      Integer startingPort) {
+    WANTestBase test = new WANTestBase(getTestMethodName());
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + 1);
+    props.setProperty(LOCATORS, "localhost[" + port1
+        + "],localhost[" + port2 + "],localhost[" + port3 + "]");
+    props.setProperty(START_LOCATOR, "localhost["
+        + startingPort
+        + "],server=true,peer=true,hostname-for-clients=localhost");
+    test.getSystem(props);
+  }
+
+  public static void createReceiver(Integer port1, Integer port2, Integer port3) {
+    WANTestBase test = new WANTestBase(getTestMethodName());
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + port1
+        + "],localhost[" + port2 + "],localhost[" + port3 + "]");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+    GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    fact.setStartPort(port);
+    fact.setEndPort(port);
+    fact.setManualStart(true);
+    GatewayReceiver receiver = fact.create();
+    try {
+      receiver.start();
+    }
+    catch (IOException e) {
+      fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port, e);
+    }
+  }
+
+  public static void createServer(Integer port1, Integer port2, Integer port3) {
+    WANTestBase test = new WANTestBase(getTestMethodName());
+    Properties props = test.getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + port1
+        + "],localhost[" + port2 + "],localhost[" + port3 + "]");
+
+    InternalDistributedSystem ds = test.getSystem(props);
+    cache = CacheFactory.create(ds);
+    CacheServer server = cache.addCacheServer();
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    server.setPort(port);
+    try {
+      server.start();
+    }
+    catch (IOException e) {
+      fail("Test " + test.getName() + " failed to start CacheServer on port " + port, e);
+    }
+    LogWriterUtils.getLogWriter().info(
+        "Server Started on port : " + port + " : server : " + server);
+  }
+
+  public static void disconnect() {
+    WANTestBase test = new WANTestBase(getTestMethodName());
+    test.getSystem().disconnect();
+  }
+
+  public static void createClient(Integer port1, Integer port2, Integer port3) {
+    ClientCacheFactory cf = new ClientCacheFactory();
+    cache = (Cache)cf.create();
+    PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
+    pf.setReadTimeout(0);
+    pf.setIdleTimeout(-1);
+    pf.setMinConnections(4);
+    pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
+    pf.addLocator("localhost", port1);
+    pf.addLocator("localhost", port2);
+    pf.addLocator("localhost", port3);
+    pf.init((GatewaySender)null);
+    proxy = ((PoolImpl)pf.create("KISHOR_POOL"));
+    Connection con1 = proxy.acquireConnection();
+    try {
+      con1.close(true);
+    }
+    catch (Exception e) {
+      fail("createClient failed", e);
+    }
+  }
+
+  public static void tryNewConnection() {
+    Connection con1 = null;
+    try {
+      con1 = proxy.acquireConnection();
+    }
+    catch (Exception e) {
+      Assert.fail("No Exception expected", e);
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANSSLDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANSSLDUnitTest.java
new file mode 100644
index 0000000..00bfa1a
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANSSLDUnitTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class WANSSLDUnitTest extends WANTestBase{
+
+  public WANSSLDUnitTest() {
+    super();
+  }
+
+  @Test
+  public void testSenderSSLReceiverSSL(){
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiverWithSSL( nyPort ));
+
+    vm4.invoke(() -> WANTestBase.createCacheWithSSL( lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, false, null, true ));
+
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", null, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+        1000 ));
+
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        getTestMethodName() + "_RR", 1000 ));
+  }
+  
+  @Test
+  public void testSenderNoSSLReceiverSSL() {
+    IgnoredException.addIgnoredException("Unexpected IOException");
+    IgnoredException.addIgnoredException("SSL Error");
+    IgnoredException.addIgnoredException("Unrecognized SSL message");
+    try {
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      vm2.invoke(() -> WANTestBase.createReceiverWithSSL( nyPort ));
+
+      vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+          false, 100, 10, false, false, null, true ));
+
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", null, isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+          1000 ));
+
+      vm2.invoke(() -> WANTestBase.validateRegionSize(
+          getTestMethodName() + "_RR", 1000 ));
+      fail("Expected exception as only Receiver is SSL enabled. Not Sender");
+    }
+    catch (Exception e) {
+      assertTrue(e.getCause().getMessage().contains("Server expecting SSL connection"));
+    }
+  }
+  
+  @Test
+  public void testSenderSSLReceiverNoSSL(){
+    IgnoredException.addIgnoredException("Acceptor received unknown");
+    IgnoredException.addIgnoredException("failed accepting client");
+    IgnoredException.addIgnoredException("Error in connecting to peer");
+    IgnoredException.addIgnoredException("Remote host closed connection during handshake");
+      Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+      Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+      createCacheInVMs(nyPort, vm2);
+      vm2.invoke(() -> WANTestBase.createReceiver());
+
+      vm4.invoke(() -> WANTestBase.createCacheWithSSL( lnPort ));
+
+      vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+          false, 100, 10, false, false, null, true ));
+
+      vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", null, isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+      vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+          getTestMethodName() + "_RR", "ln", isOffHeap() ));
+
+      vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR",
+          1 ));
+
+      Boolean doesSizeMatch = (Boolean)vm2.invoke(() -> WANSSLDUnitTest.ValidateSSLRegionSize(
+          getTestMethodName() + "_RR", 1 ));
+      
+      assertFalse(doesSizeMatch);
+  }
+  
+  public static boolean ValidateSSLRegionSize (String regionName, final int regionSize) {
+      final Region r = cache.getRegion(Region.SEPARATOR + regionName);
+      assertNotNull(r);
+      WaitCriterion wc = new WaitCriterion() {
+        public boolean done() {
+          return false;
+        }
+
+        public String description() {
+          return null;
+        }
+      };
+      Wait.waitForCriterion(wc, 2000, 500, false);
+      
+      if(r.size() == regionSize){
+        return true;
+      }
+      return false;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java
new file mode 100644
index 0000000..4148789
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java
@@ -0,0 +1,561 @@
+/*
+ * 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.internal.cache.wan.misc;
+
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.gemstone.gemfire.GemFireConfigException;
+import com.gemstone.gemfire.IncompatibleSystemException;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.OSProcess;
+import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+
+@Category(DistributedTest.class)
+public class WanAutoDiscoveryDUnitTest extends WANTestBase {
+
+  
+  public WanAutoDiscoveryDUnitTest() {
+    super();
+  }
+
+  @Override
+  protected void postSetUpWANTestBase() throws Exception {
+    final Host host = Host.getHost(0);
+  }
+  
+  /**
+   * Test to validate that sender can not be started without locator started.
+   * else GemFireConfigException will be thrown.
+   */
+  @Test
+  public void test_GatewaySender_Started_Before_Locator() {
+    try {
+      int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+      vm0.invoke(() -> WANTestBase.createCache(port));      
+      vm0.invoke(() -> WANTestBase.createSender("ln",2,false,100,10,false,false, null, false));
+      fail("Expected GemFireConfigException but not thrown");
+    }
+    catch (Exception e) {
+      if (!(e.getCause() instanceof GemFireConfigException)) {
+        Assert.fail("Expected GemFireConfigException but received :", e);
+      }
+    }
+  }
+  
+  /**
+   * Test to validate that all locators in one DS should have same name. Though
+   * this test passes, it causes other below tests to fail. In this test, VM1 is
+   * throwing IncompatibleSystemException after startInitLocator. I think, after
+   * throwing this exception, locator is not stopped properly and hence other
+   * tests are failing.
+   * 
+   * @throws Exception
+   */
+  @Ignore
+  @Test
+  public void test_AllLocatorsInDSShouldHaveDistributedSystemId() throws Exception {
+    try {
+      Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+
+      Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondLocator( 2,
+              lnLocPort1 ));
+      fail("Expected IncompatibleSystemException but not thrown");
+    }
+    catch (Exception e) {
+      if (!(e.getCause()instanceof IncompatibleSystemException)) {
+        Assert.fail("Expected IncompatibleSystemException but received :", e);
+      }
+    }
+  }
+  
+  /**
+   * Test to validate that multiple locators added on LN site and multiple
+   * locators on Ny site recognizes each other
+   * @throws Exception 
+   */
+  @Test
+  public void test_NY_Recognises_ALL_LN_Locators() throws Exception {
+    Set<InetSocketAddress> locatorPorts = new HashSet<>();
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+    dsVsPort.put(1, locatorPorts);
+
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
+
+    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
+    
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(2, locatorPorts);
+    Integer nyLocPort1 = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
+    
+    Integer nyLocPort2 = (Integer)vm3.invoke(() -> WANTestBase.createSecondRemoteLocator(
+            2, nyLocPort1, lnLocPort1));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort2));
+    
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+  }
+
+  /**
+   * Test to validate that multiple locators added two sets receive eachothers
+   * hostname for client setting even when the locator is started through the API.
+   */
+  @Test
+  public void locatorsReceiveHostnameForClientsFromRemoteSite() throws Exception {
+    Set<InetSocketAddress> locatorPorts = new HashSet<>();
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+    dsVsPort.put(1, locatorPorts);
+
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
+
+    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
+
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(2, locatorPorts);
+    Integer nyLocPort1 = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
+
+    Integer nyLocPort2 = (Integer)vm3.invoke(() -> WANTestBase.createSecondRemoteLocatorWithAPI(
+      2, nyLocPort1, lnLocPort1, "localhost"));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort2));
+
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+  }
+
+  /**
+   * Test to validate that TK site's locator is recognized by LN and NY. Test to
+   * validate that HK site's locator is recognized by LN , NY, TK.
+   */
+  @Test
+  public void test_NY_Recognises_TK_AND_HK_Through_LN_Locator() {
+
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+
+    Set<InetSocketAddress> locatorPorts = new HashSet<>();
+    dsVsPort.put(1, locatorPorts);
+    
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
+
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(2, locatorPorts);
+    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
+
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(3, locatorPorts);
+    Integer tkLocPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort));
+
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(4, locatorPorts);
+    Integer hkLocPort = (Integer)vm3.invoke(() -> WANTestBase.createFirstRemoteLocator( 4, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", hkLocPort));
+
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+  }
+
+  @Test
+  public void test_TK_Recognises_LN_AND_NY() {
+
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+
+    Set<InetSocketAddress> locatorPorts = new HashSet<>();
+    dsVsPort.put(1, locatorPorts);
+    
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
+
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(2, locatorPorts);
+    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
+
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(3, locatorPorts);
+    Integer tkLocPort = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemoteLocator( 3, nyLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort));
+
+
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+  }
+  
+  @Test
+  public void test_NY_Recognises_TK_AND_HK_Simultaneously() {
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+
+    Set<InetSocketAddress> locatorPortsln = new HashSet<>();
+    dsVsPort.put(1, locatorPortsln);
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    locatorPortsln.add(new InetSocketAddress("localhost", lnLocPort1));
+
+    Set<InetSocketAddress> locatorPortsny = new HashSet<>();
+    dsVsPort.put(2, locatorPortsny);
+    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
+    locatorPortsny.add(new InetSocketAddress("localhost", nyLocPort1));
+
+    int AsyncInvocationArrSize = 4;
+    AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize];
+
+    Set<InetSocketAddress> locatorPortstk = new HashSet<>();
+    dsVsPort.put(3, locatorPortstk);
+    async[0] = vm2.invokeAsync(() -> WANTestBase.createFirstRemoteLocator( 3, lnLocPort1 ));
+
+    Set<InetSocketAddress> locatorPortshk = new HashSet<>();
+    dsVsPort.put(4, locatorPortshk);
+    async[1] = vm3.invokeAsync(() -> WANTestBase.createFirstRemoteLocator(4, nyLocPort1));
+
+    ArrayList<Integer> locatorPortsln2 = new ArrayList<Integer>();
+    async[2] = vm4.invokeAsync(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
+    
+    ArrayList<Integer> locatorPortsny2 = new ArrayList<Integer>();
+    async[3] = vm5.invokeAsync(() -> WANTestBase.createSecondLocator( 2, nyLocPort1 ));
+
+    
+    try {
+      async[0].join();
+      async[1].join();
+      async[2].join();
+      async[3].join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail();
+    }
+    
+    locatorPortstk.add(new InetSocketAddress("localhost", (Integer)async[0].getReturnValue()));
+    locatorPortshk.add(new InetSocketAddress("localhost", (Integer)async[1].getReturnValue()));
+    locatorPortsln.add(new InetSocketAddress("localhost", (Integer)async[2].getReturnValue()));
+    locatorPortsny.add(new InetSocketAddress("localhost", (Integer)async[3].getReturnValue()));
+    
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+  }
+  
+  
+  @Test
+  public void test_LN_Sender_recognises_ALL_NY_Locators() {
+    
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    
+    Integer lnLocPort2 = (Integer)vm5.invoke(() -> WANTestBase.createSecondLocator( 1, lnLocPort1 ));
+    
+    vm2.invoke(() -> WANTestBase.createCache(lnLocPort1, lnLocPort2));
+    
+    vm2.invoke(() -> WANTestBase.createSender("ln",2,false,100,10,false,false, null, true));
+    
+    Integer nyLocPort1 = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnLocPort1 ));
+    
+    vm2.invoke(() -> WANTestBase.startSender("ln"));
+
+    //Since to fix Bug#46289, we have moved call to initProxy in getConnection which will be called only when batch is getting dispatched.
+    //So for locator discovery callback to work, its now expected that atleast try to send a batch so that proxy will be initialized
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+      getTestMethodName() + "_RR", "ln", isOffHeap() ));
+  
+     vm2.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_RR", 10));
+
+    Integer nyLocPort2 = (Integer)vm3
+        .invoke(() -> WANTestBase.createSecondRemoteLocator(
+            2, nyLocPort1, lnLocPort1 ));
+
+    InetSocketAddress locatorToWaitFor = new InetSocketAddress("localhost",
+        nyLocPort2);
+
+    vm2.invoke(() -> WANTestBase.checkLocatorsinSender("ln", locatorToWaitFor ));
+
+    Integer nyLocPort3 = (Integer)vm4
+        .invoke(() -> WANTestBase.createSecondRemoteLocator(
+            2, nyLocPort1, lnLocPort1 ));
+    
+    InetSocketAddress locatorToWaitFor2 = new InetSocketAddress("localhost", nyLocPort3);
+
+    vm2.invoke(() -> WANTestBase.checkLocatorsinSender("ln", locatorToWaitFor2 ));
+
+  }
+
+  @Test
+  public void test_RingTopology() {
+
+    int [] ports = AvailablePortHelper.getRandomAvailableTCPPortsForDUnitSite(4);
+
+    final Set<String> site1LocatorsPort = new HashSet<String>();
+    site1LocatorsPort.add("localhost["+ports[0]+"]");
+   
+    final Set<String> site2LocatorsPort = new HashSet<String>();
+    site2LocatorsPort.add("localhost["+ports[1]+"]");
+   
+    final Set<String> site3LocatorsPort = new HashSet<String>();
+    site3LocatorsPort.add("localhost["+ports[2]+"]");
+   
+    final Set<String> site4LocatorsPort = new HashSet<String>();
+    site4LocatorsPort.add("localhost["+ports[3]+"]");
+   
+    Map<Integer, Set<String>> dsVsPort = new HashMap<Integer, Set<String>>();
+    dsVsPort.put(1, site1LocatorsPort);
+    dsVsPort.put(2, site2LocatorsPort);
+    dsVsPort.put(3, site3LocatorsPort);
+    dsVsPort.put(4, site4LocatorsPort);
+   
+    int AsyncInvocationArrSize = 9;
+    AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize];
+   
+    async[0] = vm0.invokeAsync(() -> WANTestBase.createLocator( 1, ports[0], site1LocatorsPort, site2LocatorsPort));
+   
+    async[1] = vm1.invokeAsync(() -> WANTestBase.createLocator( 2, ports[1], site2LocatorsPort, site3LocatorsPort));
+   
+    async[2] = vm2.invokeAsync(() -> WANTestBase.createLocator( 3, ports[2], site3LocatorsPort, site4LocatorsPort));
+   
+    async[3] = vm3.invokeAsync(() -> WANTestBase.createLocator( 4, ports[3], site4LocatorsPort, site1LocatorsPort));
+   
+   // pause(5000);
+    try {
+      async[0].join();
+      async[1].join();
+      async[2].join();
+      async[3].join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail("Could not join async operations");
+    }
+   
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+  }
+
+  @Ignore
+  @Test
+  public void test_3Sites3Locators() {
+    final Set<String> site1LocatorsPort = new HashSet<String>();
+    int site1Port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site1LocatorsPort.add("localhost["+site1Port1+"]");
+    int site1Port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site1LocatorsPort.add("localhost["+site1Port2+"]");
+    int site1Port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site1LocatorsPort.add("localhost["+site1Port3+"]");
+    
+    final Set<String> site2LocatorsPort = new HashSet<String>();
+    int site2Port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site2LocatorsPort.add("localhost["+site2Port1+"]");
+    int site2Port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site2LocatorsPort.add("localhost["+site2Port2+"]");
+    int site2Port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site2LocatorsPort.add("localhost["+site2Port3+"]");
+    
+    final Set<String> site3LocatorsPort = new HashSet<String>();
+    int site3Port1 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site3LocatorsPort.add("localhost["+site3Port1+"]");
+    final int site3Port2 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site3LocatorsPort.add("localhost["+site3Port2+"]");
+    int site3Port3 = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    site3LocatorsPort.add("localhost["+site3Port3+"]");
+
+    Map<Integer, Set<String>> dsVsPort = new HashMap<Integer, Set<String>>();
+    dsVsPort.put(1, site1LocatorsPort);
+    dsVsPort.put(2, site2LocatorsPort);
+    dsVsPort.put(3, site3LocatorsPort);
+    
+    int AsyncInvocationArrSize = 9;
+    AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize];
+    
+    async[0] = vm0.invokeAsync(() -> WANTestBase.createLocator( 1, site1Port1, site1LocatorsPort, site2LocatorsPort));
+    
+    async[8] = vm0.invokeAsync(() -> WANTestBase.checkAllSiteMetaDataFor3Sites(dsVsPort));
+    
+    async[1] = vm1.invokeAsync(() -> WANTestBase.createLocator( 1, site1Port2, site1LocatorsPort, site2LocatorsPort));
+    async[2] = vm2.invokeAsync(() -> WANTestBase.createLocator( 1, site1Port3, site1LocatorsPort, site2LocatorsPort));
+    
+    async[3] = vm3.invokeAsync(() -> WANTestBase.createLocator( 2, site2Port1, site2LocatorsPort, site3LocatorsPort));
+    async[4] = vm4.invokeAsync(() -> WANTestBase.createLocator( 2, site2Port2, site2LocatorsPort, site3LocatorsPort));
+    async[5] = vm5.invokeAsync(() -> WANTestBase.createLocator( 2, site2Port3, site2LocatorsPort, site3LocatorsPort));
+    
+    async[6] = vm6.invokeAsync(() -> WANTestBase.createLocator( 3, site3Port1, site3LocatorsPort, site1LocatorsPort));
+    async[7] = vm7.invokeAsync(() -> WANTestBase.createLocator( 3, site3Port2, site3LocatorsPort, site1LocatorsPort));
+    
+    WANTestBase.createLocator(3, site3Port3, site3LocatorsPort, site1LocatorsPort);
+    long startTime = System.currentTimeMillis();
+    
+    try {
+      async[0].join();
+      async[1].join();
+      async[2].join();
+      async[3].join();
+      async[4].join();
+      async[5].join();
+      async[6].join();
+      async[7].join();
+      async[8].join();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+      fail("Could not join async operations");
+    }
+    Long endTime = null;
+    try {
+      endTime = (Long)async[8].getResult();
+    }
+    catch (Throwable e) {
+      e.printStackTrace();
+     Assert.fail("Could not get end time", e);
+    }
+    
+    LogWriterUtils.getLogWriter().info("Time taken for all 9 locators discovery in 3 sites: " + (endTime.longValue() - startTime));
+    
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm4.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm5.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm6.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    vm7.invoke(() -> WANTestBase.checkAllSiteMetaDataFor3Sites( dsVsPort ));
+    WANTestBase.checkAllSiteMetaDataFor3Sites(dsVsPort);
+  }
+  
+  
+  @Test
+  public void test_LN_Peer_Locators_Exchange_Information() {
+    Set<InetSocketAddress> locatorPorts = new HashSet<>();
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+    dsVsPort.put(1, locatorPorts);
+
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
+
+    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondPeerLocator( 1, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
+    
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+  }
+  
+  @Test
+  public void test_LN_NY_TK_5_PeerLocators_1_ServerLocator() {
+    Map<Integer, Set<InetSocketAddress>> dsVsPort = new HashMap<>();
+    
+    
+    Set<InetSocketAddress> locatorPorts = new HashSet<>();
+    dsVsPort.put(1, locatorPorts);
+    Integer lnLocPort1 = (Integer)vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort1));
+    Integer lnLocPort2 = (Integer)vm1.invoke(() -> WANTestBase.createSecondPeerLocator( 1, lnLocPort1 ));
+    locatorPorts.add(new InetSocketAddress("localhost", lnLocPort2));
+    
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(2, locatorPorts);
+    Integer nyLocPort1 = (Integer)vm2.invoke(() -> WANTestBase.createFirstRemotePeerLocator(2, lnLocPort1));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort1));
+    Integer nyLocPort2 = (Integer)vm3.invoke(() -> WANTestBase.createSecondRemotePeerLocator( 2, nyLocPort1, lnLocPort2));
+    locatorPorts.add(new InetSocketAddress("localhost", nyLocPort2));
+    
+    locatorPorts = new HashSet<>();
+    dsVsPort.put(3, locatorPorts);
+    Integer tkLocPort1 = (Integer)vm4.invoke(() -> WANTestBase.createFirstRemotePeerLocator(3, nyLocPort1));
+    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort1));
+    Integer tkLocPort2 = (Integer)vm5.invoke(() -> WANTestBase.createSecondRemotePeerLocator( 3, tkLocPort1, nyLocPort1));
+    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort2));
+    Integer tkLocPort3 = (Integer)vm6.invoke(() -> WANTestBase.createSecondRemoteLocator( 3, tkLocPort1, nyLocPort2));
+    locatorPorts.add(new InetSocketAddress("localhost", tkLocPort3));
+    
+   // pause(5000);
+    
+    vm0.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm1.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm2.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm3.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm4.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm5.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+    vm6.invoke(() -> WANTestBase.checkAllSiteMetaData( dsVsPort ));
+        
+  }
+
+  @Test
+  public void testNoThreadLeftBehind() {
+    // Get active thread count before test
+    int activeThreadCountBefore = Thread.activeCount();
+
+    // Start / stop locator
+    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
+    WANTestBase.createFirstRemoteLocator( 2, port );
+    disconnectFromDS();
+
+    // Validate active thread count after test
+
+    // Wait up to 60 seconds for all threads started during the test
+    // (including the 'WAN Locator Discovery Thread') to stop
+    // Note: Awaitility is not being used since it adds threads
+    for (int i=0; i<60; i++) {
+      if (Thread.activeCount() > activeThreadCountBefore) {
+        try {
+          Thread.sleep(1000);
+        } catch (InterruptedException e) {
+          fail("Caught the following exception waiting for threads to stop: " + e);
+        }
+      } else {
+        break;
+      }
+    }
+
+    // Fail if the active thread count after the test is greater than the active thread count before the test
+    if (Thread.activeCount() > activeThreadCountBefore) {
+      OSProcess.printStacks(0);
+      StringBuilder builder = new StringBuilder();
+      builder
+          .append("Expected ")
+          .append(activeThreadCountBefore)
+          .append(" threads but found ")
+          .append(Thread.activeCount())
+          .append(". Check log file for a thread dump.");
+      fail(builder.toString());
+    }
+  }
+}