geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [14/50] [abbrv] incubator-geode git commit: GEODE-1644: ClassCastException is thrown with in queries against a map index
Date Mon, 22 Aug 2016 16:39:42 GMT
GEODE-1644: ClassCastException is thrown with in queries against a map index


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

Branch: refs/heads/master
Commit: 1744e7b5a58c059433232585167b7313c00f8cb5
Parents: ce0b7e7
Author: Jason Huynh <huynhja@gmail.com>
Authored: Mon Jun 27 10:40:10 2016 -0700
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Thu Jul 14 14:12:22 2016 -0700

----------------------------------------------------------------------
 .../cache/query/internal/CompiledIn.java        |  39 +-
 .../cache/query/dunit/CompiledInDUnitTest.java  | 701 +++++++++++++++++++
 .../query/dunit/PdxStringQueryDUnitTest.java    | 221 +++---
 3 files changed, 840 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1744e7b5/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledIn.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledIn.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledIn.java
index 71f9704..42824df 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledIn.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledIn.java
@@ -591,18 +591,28 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
       if (evalColln instanceof Map) {
         Iterator itr = ((Map)evalColln).entrySet().iterator();
         while (itr.hasNext()) {
-          this.queryIndex(itr.next(),indexInfo, results,iterOperands, indpndntItr, context, projAttrib,conditioningNeeded);          
+          this.queryIndex(itr.next(),indexInfo, results,iterOperands, indpndntItr, context, projAttrib,conditioningNeeded);
         }
 
       }
       else if (evalColln instanceof Collection) {
-        //Removing duplicates from the collection
-        HashSet set = new HashSet((Collection)evalColln);
-        Iterator itr = set.iterator();
-        while (itr.hasNext()) {
-          this.queryIndex(itr.next(),indexInfo, results,iterOperands, indpndntItr, context, projAttrib,conditioningNeeded);
+        Object key = indexInfo.evaluateIndexKey(context);
+        //If the index is a map index, the key is actually an object[] tuple that contains the map key in the [1]
+        //and the evalColln in the [0] position
+        if (key instanceof Object[]) {
+          Iterator iterator = ((ResultsSet)((Object[]) key)[0]).iterator();
+          while (iterator.hasNext()) {
+            this.queryIndex(new Object[]{iterator.next(), ((Object[])key)[1]}, indexInfo, results, iterOperands, indpndntItr, context, projAttrib, conditioningNeeded);
+          }
+        }
+        else {
+          //Removing duplicates from the collection
+          HashSet set = new HashSet((Collection) evalColln);
+          Iterator itr = set.iterator();
+          while (itr.hasNext()) {
+            this.queryIndex(itr.next(), indexInfo, results, iterOperands, indpndntItr, context, projAttrib, conditioningNeeded);
+          }
         }
-
       }
       else {
         if (!evalColln.getClass().isArray()) {
@@ -840,6 +850,7 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
     }
     assert idxInfo.length == 1;
     Object key = idxInfo[0].evaluateIndexKey(context);
+
     if (key != null && key.equals(QueryService.UNDEFINED))
       return 0;
     
@@ -862,11 +873,19 @@ public class CompiledIn extends AbstractCompiledValue implements Indexable {
 
     }
     else if (evalColln instanceof Collection) {
-      Iterator itr = ((Collection)evalColln).iterator();
-      while (itr.hasNext()) {
-        size+=idxInfo[0]._index.getSizeEstimate(itr.next(), TOK_EQ, idxInfo[0]._matchLevel);
+      if (key instanceof Object[]) {
+        Iterator iterator = ((ResultsSet)((Object[]) key)[0]).iterator();
+        while (iterator.hasNext()) {
+          size+=idxInfo[0]._index.getSizeEstimate(new Object[]{iterator.next(), ((Object[])key)[1]}, TOK_EQ, idxInfo[0]._matchLevel);
+        }
       }
+      else {
 
+        Iterator itr = ((Collection) evalColln).iterator();
+        while (itr.hasNext()) {
+          size += idxInfo[0]._index.getSizeEstimate(itr.next(), TOK_EQ, idxInfo[0]._matchLevel);
+        }
+      }
     }
     else {
       if (!evalColln.getClass().isArray()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1744e7b5/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompiledInDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompiledInDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompiledInDUnitTest.java
new file mode 100644
index 0000000..ae44e50
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompiledInDUnitTest.java
@@ -0,0 +1,701 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.query.dunit;
+
+import static com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionExecutionDUnitTest.region;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.stream.IntStream;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+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.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.data.PortfolioPdx.Day;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class CompiledInDUnitTest extends JUnit4CacheTestCase {
+
+  final String rootRegionName = "root";
+  final String regionName = "PdxTest";
+  final String regName = "/" + rootRegionName + "/" + regionName;
+  private Host host;
+  private VM vm0;
+  private VM vm1;
+  private VM client;
+
+  public CompiledInDUnitTest() {
+  }
+
+  @Before
+  public void setup() {
+    host = Host.getHost(0);
+    vm0 = host.getVM(0);
+    vm1 = host.getVM(1);
+    client = host.getVM(3);
+  }
+
+  @After
+  public void closeVMs() {
+    closeClient(vm0);
+    closeClient(vm1);
+    closeClient(client);
+  }
+
+  protected void startBridgeServer(int port, boolean notifyBySubscription) throws IOException {
+
+    Cache cache = getCache();
+    CacheServer server = cache.addCacheServer();
+    server.setPort(port);
+    server.start();
+    int bridgeServerPort = server.getPort();
+  }
+
+  protected void configAndStartBridgeServer() {
+    try {
+      startBridgeServer(0, false);
+    } catch (Exception ex) {
+      Assert.fail("While starting CacheServer" + ex);
+    }
+  }
+
+  private void createPartitionRegion(final boolean isAccessor) {
+    AttributesFactory factory = new AttributesFactory();
+    PartitionAttributesFactory paf = new PartitionAttributesFactory();
+    if (isAccessor) {
+      paf.setLocalMaxMemory(0);
+    }
+    PartitionAttributes prAttr = paf.setTotalNumBuckets(20).setRedundantCopies(0).create();
+    factory.setPartitionAttributes(prAttr);
+    createRegion(this.regionName, this.rootRegionName, factory.create());
+  }
+
+
+  private void createReplicateRegion() {
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.DISTRIBUTED_ACK);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+
+    createRegion(this.regionName, this.rootRegionName, factory.create());
+  }
+
+  public void closeClient(VM client) {
+    SerializableRunnable closeCache = new CacheSerializableRunnable("Close Client") {
+      public void run2() throws CacheException {
+        LogWriterUtils.getLogWriter().info("### Close Client. ###");
+        try {
+          closeCache();
+          disconnectFromDS();
+        } catch (Exception ex) {
+          LogWriterUtils.getLogWriter().info("### Failed to get close client. ###");
+        }
+      }
+    };
+
+    client.invoke(closeCache);
+  }
+
+
+  @Test
+  public void whenMultipleEnumBindParametersAreUsedWithInQueryAndMapIndexIsPresentReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenMultipleEnumBindParametersAreUsedWithInQueryReturnCorrectResults() throws CacheException {
+    final Host host = Host.getHost(0);
+    VM vm0 = host.getVM(0);
+    VM vm1 = host.getVM(1);
+    VM client = host.getVM(3);
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryOnReplicateRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenASingleEnumBindParameterIsUsedWithInQueryAndMapIndexIsPresentReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenASingleEnumBindParameterIsUsedWithInQueryReturnCorrectResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryOnReplicateRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenMultipleTypeBindParameterIsUsedWithInQueryAndMapIndexIsPresentReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2,$3)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { 2, DayEnum.MONDAY, "Tuesday" };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenMultipleEnumBindParametersAreUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenMultipleEnumBindParametersAreUsedWithInQueryInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenASingleEnumBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenASingleEnumBindParameterIsUsedWithInQueryInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenMultipleTypeBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2,$3)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { 2, DayEnum.MONDAY, "Tuesday" };
+    vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenEnumBindArgumentIsMatchedInSetWithIteratingFieldShouldReturnResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+
+    final String queryString = "select * from " + regName + " where $1 in SET (getMapField['1'])";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenEnumBindArgumentIsMatchedInSetWithMultipleIteratingFieldShouldReturnResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+
+    final String queryString = "select * from " + regName + " where $1 in SET (getMapField['1'], getMapField['0'])";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.TUESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenEnumBindArgumentIsMatchedInSetWithMultiTypedIteratingFieldShouldReturnResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET (getMapField['1'], getMapField['2'], 'asdfasdf', getMapField['0'])";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.TUESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenANDConditionWithInSetFiltersOutAllFieldsReturnNoResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = 0;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1, $2) AND getMapField['1'] in SET($3)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY, DayEnum.WEDNESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenANDConditionWithInSetMatchesReturnResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = 5;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1, $2) AND getMapField['2'] in SET($3)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        HashMap entries = new HashMap();
+        IntStream.range(0, 10).forEach(i -> {
+          MapTestObject object = new MapTestObject(i);
+          object.getMapField().put("2", DayEnum.WEDNESDAY);
+          entries.put("key" + i, object);
+        });
+        createEntries(regionName, entries.entrySet().iterator());
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY, DayEnum.WEDNESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenInSetCollectionContainsNonUniqueValuesMatchingSetShouldNotBeDuplicated() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET($1, $1, $1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY, DayEnum.WEDNESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenORConditionWithInSetMatchesReturnResults() throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1) OR getMapField['0'] in SET($2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
+  }
+
+  @Test
+  public void whenUsingAccessorMultipleEnumBindParametersAreUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenUsingAccessorMultipleEnumBindParametersAreUsedWithInQueryInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
+    vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenUsingAccessorASingleEnumBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenUsingAccessorASingleEnumBindParameterIsUsedWithInQueryInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
+    vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
+  }
+
+  @Test
+  public void whenUsingAccessorMultipleTypeBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults()
+    throws CacheException {
+    final int numberOfEntries = 10;
+    final int numExpectedResults = numberOfEntries / 2;
+
+    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2,$3)";
+
+    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
+        createEntries(numberOfEntries, regionName);
+      }
+    });
+
+    Object[] bindArguments = new Object[] { 2, DayEnum.MONDAY, "Tuesday" };
+    vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
+  }
+
+
+  CacheSerializableRunnable executeQueryOnReplicateRegion(final int numberOfEntries,
+                                                          final String queryString,
+                                                          Object[] bindArguments) {
+    return new CacheSerializableRunnable("Execute Query in Replicated Region") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        verifyQuery(numberOfEntries, queryString, bindArguments);
+      }
+    };
+  }
+
+  CacheSerializableRunnable executeQueryWithIndexOnReplicateRegion(final int numberOfEntries,
+                                                                   final String queryString,
+                                                                   Object[] bindArguments,
+                                                                   String indexName,
+                                                                   String indexExpression,
+                                                                   String regionPath) {
+    return new CacheSerializableRunnable("Execute Query with Index in Replicated Region") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createReplicateRegion();
+        createIndex(indexName, indexExpression, regionPath);
+        verifyQuery(numberOfEntries, queryString, bindArguments);
+      }
+    };
+  }
+
+
+  CacheSerializableRunnable executeQueryOnPartitionRegion(final int numberOfEntries,
+                                                          final String queryString,
+                                                          Object[] bindArguments) {
+    return new CacheSerializableRunnable("Execute Query in Partition Regions") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(false);
+        verifyQuery(numberOfEntries, queryString, bindArguments);
+      }
+    };
+  }
+
+  CacheSerializableRunnable executeQueryWithAccessor(final int numberOfEntries,
+                                                          final String queryString,
+                                                          Object[] bindArguments) {
+    return new CacheSerializableRunnable("Execute Query with Accessor") {
+      public void run2() throws CacheException {
+        configAndStartBridgeServer();
+        createPartitionRegion(true);
+        verifyQuery(numberOfEntries, queryString, bindArguments);
+      }
+    };
+  }
+
+
+  void verifyQuery(final int numExpectedEntries, final String queryString, Object[] bindArguments) {
+    QueryService qs = getCache().getQueryService();
+    Query query = null;
+    SelectResults sr = null;
+    try {
+      query = qs.newQuery(queryString);
+
+      sr = (SelectResults) query.execute(bindArguments);
+      Iterator iterator = sr.iterator();
+
+    } catch (Exception ex) {
+      ex.printStackTrace();
+
+      Assert.fail("Failed to execute query, " + ex.getMessage());
+    }
+    Assert.assertEquals(numExpectedEntries, sr.size());
+  }
+
+  void createIndex(String indexName, String indexExpression, String regionPath) {
+    QueryService localQueryService = getCache().getQueryService();
+    try {
+      localQueryService.createIndex(indexName, indexExpression, regionPath);
+    } catch (Exception ex) {
+      Assert.fail("Failed to create index." + ex.getMessage());
+    }
+  }
+
+  void createEntries(final int numberOfEntries, String regionName) {
+    Region region = getRootRegion().getSubregion(regionName);
+    for (int i = 0; i < numberOfEntries; i++) {
+      region.put("key" + i, new MapTestObject(i));
+    }
+  }
+
+  void createEntries(String regionName, Iterator<Map.Entry> objects) {
+    Region region = getRootRegion().getSubregion(regionName);
+    objects.forEachRemaining((mk) -> {
+      region.put(mk.getKey(), mk.getValue());
+    });
+  }
+
+  enum DayEnum {
+    MONDAY, TUESDAY, WEDNESDAY
+  }//Map objects should be either [1] = DayEnum.Monday or [0] = DayEnum.Tuesday
+
+  static class MapTestObject implements Serializable {
+
+    private HashMap mapField = new HashMap<Object, Object>();
+
+    public MapTestObject(int i) {
+      int n = i % 2;
+      DayEnum enumVal = DayEnum.MONDAY;
+      if (n == 0) {
+        enumVal = DayEnum.TUESDAY;
+      }
+
+      mapField.put("" + n, enumVal);
+    }
+
+    public Map<String, DayEnum> getMapField() {
+      return mapField;
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1744e7b5/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
index 5124d85..ede8473 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxStringQueryDUnitTest.java
@@ -77,45 +77,44 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
 public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
-
+  final String rootRegionName = "root";
+  final String regionName = "PdxTest";
+  final String regName = "/" + rootRegionName + "/" + regionName;
   private static int bridgeServerPort;
 
-  private final String rootRegionName = "root";
-  private final String regionName = "PdxTest";
-  private final String regName = "/" + rootRegionName + "/" + regionName;
   private final static int orderByQueryIndex = 11;
   private final static int [] groupByQueryIndex = new int[]{7, 8, 9,10};
   
-  private final String[] queryString = new String[] { 
-      "SELECT pos.secId FROM " + regName + " p, p.positions.values pos WHERE pos.secId LIKE '%L'",//0
-      "SELECT pos.secId FROM " + regName + " p, p.positions.values pos where pos.secId = 'IBM'",//1
-      "SELECT pos.secId, p.status FROM " + regName + " p, p.positions.values pos where pos.secId > 'APPL'",//2
-      "SELECT pos.secId FROM " + regName + " p, p.positions.values pos WHERE pos.secId > 'APPL' and pos.secId < 'SUN'",//3
-      "select pos.secId from " + regName + " p, p.positions.values pos where pos.secId  IN SET ('YHOO', 'VMW')",//4
-      "select pos.secId from " + regName + " p, p.positions.values pos where NOT (pos.secId = 'VMW')",//5
-      "select pos.secId from " + regName + " p, p.positions.values pos where NOT (pos.secId IN SET('SUN', 'ORCL')) ",//6
-      "select pos.secId , count(pos.id) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' group by pos.secId ",//7
-      "select pos.secId , sum(pos.id) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' group by pos.secId ",//8,
-      "select pos.secId , count(distinct pos.secId) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' group by pos.secId ",//9
-      "select  count(distinct pos.secId) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' ",//10
-      "SELECT distinct pos.secId FROM " + regName + " p, p.positions.values pos order by pos.secId",//11
-      "SELECT distinct pos.secId FROM " + regName + " p, p.positions.values pos WHERE p.ID > 1 order by pos.secId limit 5",//12
+  private final String[] queryString = new String[] {
+    "SELECT pos.secId FROM " + regName + " p, p.positions.values pos WHERE pos.secId LIKE '%L'",//0
+    "SELECT pos.secId FROM " + regName + " p, p.positions.values pos where pos.secId = 'IBM'",//1
+    "SELECT pos.secId, p.status FROM " + regName + " p, p.positions.values pos where pos.secId > 'APPL'",//2
+    "SELECT pos.secId FROM " + regName + " p, p.positions.values pos WHERE pos.secId > 'APPL' and pos.secId < 'SUN'",//3
+    "select pos.secId from " + regName + " p, p.positions.values pos where pos.secId  IN SET ('YHOO', 'VMW')",//4
+    "select pos.secId from " + regName + " p, p.positions.values pos where NOT (pos.secId = 'VMW')",//5
+    "select pos.secId from " + regName + " p, p.positions.values pos where NOT (pos.secId IN SET('SUN', 'ORCL')) ",//6
+    "select pos.secId , count(pos.id) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' group by pos.secId ",//7
+    "select pos.secId , sum(pos.id) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' group by pos.secId ",//8,
+    "select pos.secId , count(distinct pos.secId) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' group by pos.secId ",//9
+    "select  count(distinct pos.secId) from " + regName + " p, p.positions.values pos where  pos.secId > 'APPL' ",//10
+    "SELECT distinct pos.secId FROM " + regName + " p, p.positions.values pos order by pos.secId",//11
+    "SELECT distinct pos.secId FROM " + regName + " p, p.positions.values pos WHERE p.ID > 1 order by pos.secId limit 5",//12
  };
 
- private final String[] queryString2 = new String[] { 
-      "SELECT pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE pos.secIdIndexed LIKE '%L'",//0
-      "SELECT pos.secIdIndexed FROM " + regName + " p, p.positions.values pos where pos.secIdIndexed = 'IBM'",//1
-      "SELECT pos.secIdIndexed, p.status FROM " + regName + " p, p.positions.values pos where pos.secIdIndexed > 'APPL'",//2
-      "SELECT pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE pos.secIdIndexed > 'APPL' and pos.secIdIndexed < 'SUN'",//3
-      "select pos.secIdIndexed from " + regName + " p, p.positions.values pos where pos.secIdIndexed  IN SET ('YHOO', 'VMW')",//4
-      "select pos.secIdIndexed from " + regName + " p, p.positions.values pos where NOT (pos.secIdIndexed = 'VMW')",//5
-      "select pos.secIdIndexed from " + regName + " p, p.positions.values pos where NOT (pos.secIdIndexed IN SET('SUN', 'ORCL')) ",//6
-      "select pos.secIdIndexed , count(pos.id) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL' group by pos.secIdIndexed ",//7
-      "select pos.secIdIndexed , sum(pos.id) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL' group by pos.secIdIndexed ",//8
-      "select pos.secIdIndexed , count(distinct pos.secIdIndexed) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL' group by pos.secIdIndexed ",//9
-      "select  count(distinct pos.secIdIndexed) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL'  ",//10
-      "SELECT distinct pos.secIdIndexed FROM " + regName + " p, p.positions.values pos order by pos.secIdIndexed",//11
-      "SELECT distinct pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE p.ID > 1 order by pos.secIdIndexed limit 5",//12
+ private final String[] queryString2 = new String[] {
+   "SELECT pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE pos.secIdIndexed LIKE '%L'",//0
+   "SELECT pos.secIdIndexed FROM " + regName + " p, p.positions.values pos where pos.secIdIndexed = 'IBM'",//1
+   "SELECT pos.secIdIndexed, p.status FROM " + regName + " p, p.positions.values pos where pos.secIdIndexed > 'APPL'",//2
+   "SELECT pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE pos.secIdIndexed > 'APPL' and pos.secIdIndexed < 'SUN'",//3
+   "select pos.secIdIndexed from " + regName + " p, p.positions.values pos where pos.secIdIndexed  IN SET ('YHOO', 'VMW')",//4
+   "select pos.secIdIndexed from " + regName + " p, p.positions.values pos where NOT (pos.secIdIndexed = 'VMW')",//5
+   "select pos.secIdIndexed from " + regName + " p, p.positions.values pos where NOT (pos.secIdIndexed IN SET('SUN', 'ORCL')) ",//6
+   "select pos.secIdIndexed , count(pos.id) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL' group by pos.secIdIndexed ",//7
+   "select pos.secIdIndexed , sum(pos.id) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL' group by pos.secIdIndexed ",//8
+   "select pos.secIdIndexed , count(distinct pos.secIdIndexed) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL' group by pos.secIdIndexed ",//9
+   "select  count(distinct pos.secIdIndexed) from " + regName + " p, p.positions.values pos where  pos.secIdIndexed > 'APPL'  ",//10
+   "SELECT distinct pos.secIdIndexed FROM " + regName + " p, p.positions.values pos order by pos.secIdIndexed",//11
+   "SELECT distinct pos.secIdIndexed FROM " + regName + " p, p.positions.values pos WHERE p.ID > 1 order by pos.secIdIndexed limit 5",//12
  };
 
   @Test
@@ -130,7 +129,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false,false);
+        configAndStartBridgeServer(false, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -141,7 +140,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         Index index = null;
         // create an index on statusIndexed is created
          try {
-           index = localQueryService.createIndex("secIdIndex2", "pos.secIdIndexed", regName  + " p, p.positions.values pos");
+           index = localQueryService.createIndex("secIdIndex2", "pos.secIdIndexed", regName + " p, p.positions.values pos");
              if(!(index instanceof RangeIndex)){
                fail("Range Index should have been created instead of " + index.getClass());
              }
@@ -154,7 +153,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false, false);
+        configAndStartBridgeServer(false, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -162,7 +161,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false, false);
+        configAndStartBridgeServer(false, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -370,11 +369,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
     });
-    
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
 
   @Test
@@ -389,7 +388,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false,false);
+        configAndStartBridgeServer(false, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -413,7 +412,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false, false);
+        configAndStartBridgeServer(false, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -421,7 +420,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false, false);
+        configAndStartBridgeServer(false, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -585,11 +584,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
     });
-    
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
   
   @Test
@@ -603,7 +602,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false,false);
+        configAndStartBridgeServer(false, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -614,7 +613,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         // Verify the type of index created  
         Index index = null;
           try {
-           index = localQueryService.createIndex("secIdIndex", "pos.secId", regName  + " p, p.positions.values pos");
+           index = localQueryService.createIndex("secIdIndex", "pos.secId", regName + " p, p.positions.values pos");
             if(!(index instanceof RangeIndex) ){
                fail("Range Index should have been created instead of "+ index.getClass());
              }
@@ -627,7 +626,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false, false);
+        configAndStartBridgeServer(false, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -635,7 +634,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(false,false, false);
+        configAndStartBridgeServer(false, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -790,11 +789,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
     });
-    
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
   
   @Test
@@ -809,7 +808,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false,false);
+        configAndStartBridgeServer(isPr, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -821,7 +820,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         Index index = null;
         // In the NO_INDEX case where no indexes are used an index on another field statusIndexed is created
          try {
-           index = localQueryService.createIndex("secIdIndex", "pos.secIdIndexed", regName  + " p, p.positions.values pos");
+           index = localQueryService.createIndex("secIdIndex", "pos.secIdIndexed", regName + " p, p.positions.values pos");
            if(index instanceof PartitionedIndex){
                for(Object o : ((PartitionedIndex)index).getBucketIndexes()){
                  if(!(o instanceof RangeIndex) ){
@@ -841,7 +840,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -849,7 +848,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1056,11 +1055,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
     });
-    
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
   
   @Test
@@ -1075,7 +1074,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false,false);
+        configAndStartBridgeServer(isPr, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -1106,7 +1105,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1114,7 +1113,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1284,11 +1283,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
     });
-    
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
   
   @Test
@@ -1303,7 +1302,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false,false);
+        configAndStartBridgeServer(isPr, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -1314,7 +1313,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         // Verify the type of index created  
         Index index = null;
           try {
-           index = localQueryService.createIndex("secIdIndex", "pos.secId", regName  + " p, p.positions.values pos");
+           index = localQueryService.createIndex("secIdIndex", "pos.secId", regName + " p, p.positions.values pos");
             if(index instanceof PartitionedIndex){
                for(Object o : ((PartitionedIndex)index).getBucketIndexes()){
                  if(!(o instanceof RangeIndex) ){
@@ -1334,7 +1333,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1342,7 +1341,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1512,11 +1511,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
     });
-    
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
 
   @Test
@@ -1531,7 +1530,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server1 and create index
     server0.invoke(new CacheSerializableRunnable("Create Server1") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false,false);
+        configAndStartBridgeServer(isPr, false, false);
         // create a local query service
         QueryService localQueryService = null;
         try {
@@ -1562,7 +1561,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server2
     server1.invoke(new CacheSerializableRunnable("Create Server2") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1570,7 +1569,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     // Start server3
     server2.invoke(new CacheSerializableRunnable("Create Server3") {
       public void run2() throws CacheException {
-        configAndStartBridgeServer(isPr,false, false);
+        configAndStartBridgeServer(isPr, false, false);
         Region region = getRootRegion().getSubregion(regionName);
       }
     });
@@ -1650,8 +1649,8 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
         
         // Querying the fields with null values
-        String[] qs = {"SELECT pos.secId FROM " + regName + "  p, p.positions.values pos where p.status = null",
-                      "SELECT p.pkid FROM " + regName + "  p, p.positions.values pos where pos.secId = null"};
+        String[] qs = { "SELECT pos.secId FROM " + regName + "  p, p.positions.values pos where p.status = null",
+          "SELECT p.pkid FROM " + regName + "  p, p.positions.values pos where pos.secId = null"};
         
         for(int i = 0; i <2; i++){
           try {
@@ -1673,11 +1672,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
         }
       }
      });
- 
-    this.closeClient(server2);
-    this.closeClient(client);
-    this.closeClient(server1);
-    this.closeClient(server0);
+
+    closeClient(server2);
+    closeClient(client);
+    closeClient(server1);
+    closeClient(server0);
   }
   
  
@@ -1889,12 +1888,11 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
     
     disconnectAllFromDS();
   }
-   
+
   protected void configAndStartBridgeServer(boolean isPr, boolean isAccessor, boolean asyncIndex) {
     AttributesFactory factory = new AttributesFactory();
     if (isPr) {
       PartitionAttributesFactory paf = new PartitionAttributesFactory();
-      //factory.setDataPolicy(DataPolicy.PARTITION);
       if (isAccessor){
         paf.setLocalMaxMemory(0);
       }
@@ -1902,7 +1900,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
       factory.setPartitionAttributes(prAttr);
     } else {
       factory.setScope(Scope.DISTRIBUTED_ACK);
-      factory.setDataPolicy(DataPolicy.REPLICATE);      
+      factory.setDataPolicy(DataPolicy.REPLICATE);
     }
     if (asyncIndex) {
       factory.setIndexMaintenanceSynchronous(!asyncIndex);
@@ -1914,6 +1912,7 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
       Assert.fail("While starting CacheServer", ex);
     }
   }
+
   /**
    * Starts a bridge server on the given port, using the given
    * deserializeValues and notifyBySubscription to serve up the
@@ -1941,20 +1940,20 @@ public class PdxStringQueryDUnitTest extends JUnit4CacheTestCase {
 
   /* Close Client */
   public void closeClient(VM client) {
-    SerializableRunnable closeCache =
-      new CacheSerializableRunnable("Close Client") {
-      public void run2() throws CacheException {
-        LogWriterUtils.getLogWriter().info("### Close Client. ###");
-        try {
-          closeCache();
-          disconnectFromDS();
-        } catch (Exception ex) {
-          LogWriterUtils.getLogWriter().info("### Failed to get close client. ###");
-        }
-      }
-    };
-    
-    client.invoke(closeCache);
+      SerializableRunnable closeCache =
+        new CacheSerializableRunnable("Close Client") {
+          public void run2() throws CacheException {
+            LogWriterUtils.getLogWriter().info("### Close Client. ###");
+            try {
+              closeCache();
+              disconnectFromDS();
+            } catch (Exception ex) {
+              LogWriterUtils.getLogWriter().info("### Failed to get close client. ###");
+            }
+          }
+        };
+
+      client.invoke(closeCache);
   }
   
   public void createPool(VM vm, String poolName, String server, int port, boolean subscriptionEnabled) {


Mime
View raw message