geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgkim...@apache.org
Subject [geode-native] branch develop updated: GEODE-3842: Split apart flaky .NET test (#139)
Date Tue, 17 Oct 2017 00:10:22 GMT
This is an automated email from the ASF dual-hosted git repository.

dgkimura pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 246dd48  GEODE-3842: Split apart flaky .NET test (#139)
246dd48 is described below

commit 246dd4882d5239a2e9dc79f542c4e5ea18f17d2b
Author: David Kimura <dkimura@pivotal.io>
AuthorDate: Mon Oct 16 17:10:20 2017 -0700

    GEODE-3842: Split apart flaky .NET test (#139)
    
    GEODE-3832: Split up flaky .NET ThinClientRemoteQueryTestsN
---
 clicache/integration-test/CMakeLists.txt           |   1 +
 .../integration-test/ThinClientRegionQueryTests.cs | 496 +++++++++++++++++++++
 .../ThinClientRemoteParamQueryResultSetTests.cs    | 399 +++++++++++++++++
 .../ThinClientRemoteParamQueryStructSetTests.cs    | 367 +++++++++++++++
 .../ThinClientRemoteQueryExclusivenessTests.cs     | 209 +++++++++
 .../ThinClientRemoteQueryFailoverTests.cs          | 215 +++++++++
 .../ThinClientRemoteQueryResultSetTests.cs         | 368 +++++++++++++++
 .../ThinClientRemoteQueryStructSetTests.cs         | 327 ++++++++++++++
 clicache/integration-test/UnitTests.csproj.in      |   7 +
 9 files changed, 2389 insertions(+)

diff --git a/clicache/integration-test/CMakeLists.txt b/clicache/integration-test/CMakeLists.txt
index be5e424..d15af86 100644
--- a/clicache/integration-test/CMakeLists.txt
+++ b/clicache/integration-test/CMakeLists.txt
@@ -96,6 +96,7 @@ endforeach()
 
 # Label any flaky tests here
 set_property(TEST ThinClientCqTestsN PROPERTY LABELS FLAKY)
+set_property(TEST ThinClientRemoteQueryTestsN PROPERTY LABELS FLAKY)
 
 # Label any tests that always fail here
 set_property(TEST OverflowTestsN PROPERTY LABELS OMITTED)
diff --git a/clicache/integration-test/ThinClientRegionQueryTests.cs b/clicache/integration-test/ThinClientRegionQueryTests.cs
new file mode 100644
index 0000000..0dc7b64
--- /dev/null
+++ b/clicache/integration-test/ThinClientRegionQueryTests.cs
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRegionQueryTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+      "Portfolios3" };
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+    public void StepOne(string locators, bool isPdx)
+    {
+      m_isPdx = isPdx;
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+      null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+        null, locators, "__TESTPOOL1_", true);
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+      region.CreateSubRegion(QueryRegionNames[1], regattrs);
+    }
+
+    public void StepTwo(bool isPdx)
+    {
+      m_isPdx = isPdx;
+      IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+      IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+      IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+      IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+      Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+        qh.PortfolioNumSets);
+
+      if (!m_isPdx)
+      {
+        qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+      else
+      {
+        qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+    }
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+    public void StepThreeRQ()
+    {
+      bool ErrorOccurred = false;
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+      {
+        if (qrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating query index {0}. {1}", qryIdx, qrystr.Query);
+
+        if (m_isPdx)
+        {
+          if (qryIdx == 18)
+          {
+            Util.Log("Skipping query index {0} because it is unsupported for pdx type.", qryIdx);
+            qryIdx++;
+            continue;
+          }
+        }
+
+        ISelectResults<object> results = region.Query<object>(qrystr.Query);
+
+        if (results.Size != QueryStatics.RegionQueryRowCounts[qryIdx])
+        {
+          ErrorOccurred = true;
+          Util.Log("FAIL: Query # {0} expected result size is {1}, actual is {2}", qryIdx,
+            QueryStatics.RegionQueryRowCounts[qryIdx], results.Size);
+          qryIdx++;
+          continue;
+        }
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+
+      try
+      {
+        ISelectResults<object> results = region.Query<object>("");
+        Assert.Fail("Expected IllegalArgumentException exception for empty predicate");
+      }
+      catch (IllegalArgumentException ex)
+      {
+        Util.Log("got expected IllegalArgumentException exception for empty predicate:");
+        Util.Log(ex.Message);
+      }
+
+
+      try
+      {
+        ISelectResults<object> results = region.Query<object>(QueryStatics.RegionQueries[0].Query, 2200000);
+        Assert.Fail("Expected IllegalArgumentException exception for invalid timeout");
+      }
+      catch (IllegalArgumentException ex)
+      {
+        Util.Log("got expected IllegalArgumentException exception for invalid timeout:");
+        Util.Log(ex.Message);
+      }
+
+
+      try
+      {
+        ISelectResults<object> results = region.Query<object>("bad predicate");
+        Assert.Fail("Expected QueryException exception for wrong predicate");
+      }
+      catch (QueryException ex)
+      {
+        Util.Log("got expected QueryException exception for wrong predicate:");
+        Util.Log(ex.Message);
+      }
+    }
+
+    public void StepFourRQ()
+    {
+      bool ErrorOccurred = false;
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+      {
+        if (qrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating query index {0}.{1}", qryIdx, qrystr.Query);
+
+        bool existsValue = region.ExistsValue(qrystr.Query);
+        bool expectedResult = QueryStatics.RegionQueryRowCounts[qryIdx] > 0 ? true : false;
+
+        if (existsValue != expectedResult)
+        {
+          ErrorOccurred = true;
+          Util.Log("FAIL: Query # {0} existsValue expected is {1}, actual is {2}", qryIdx,
+            expectedResult ? "true" : "false", existsValue ? "true" : "false");
+          qryIdx++;
+          continue;
+        }
+
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+      try
+      {
+        bool existsValue = region.ExistsValue("");
+        Assert.Fail("Expected IllegalArgumentException exception for empty predicate");
+      }
+      catch (IllegalArgumentException ex)
+      {
+        Util.Log("got expected IllegalArgumentException exception for empty predicate:");
+        Util.Log(ex.Message);
+      }
+
+
+      try
+      {
+        bool existsValue = region.ExistsValue(QueryStatics.RegionQueries[0].Query, 2200000);
+        Assert.Fail("Expected IllegalArgumentException exception for invalid timeout");
+      }
+      catch (IllegalArgumentException ex)
+      {
+        Util.Log("got expected IllegalArgumentException exception for invalid timeout:");
+        Util.Log(ex.Message);
+      }
+
+
+      try
+      {
+        bool existsValue = region.ExistsValue("bad predicate");
+        Assert.Fail("Expected QueryException exception for wrong predicate");
+      }
+      catch (QueryException ex)
+      {
+        Util.Log("got expected QueryException exception for wrong predicate:");
+        Util.Log(ex.Message);
+      }
+    }
+
+    public void StepFiveRQ()
+    {
+      bool ErrorOccurred = false;
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+      {
+        if (qrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating query index {0}.", qryIdx);
+
+        try
+        {
+          Object result = region.SelectValue(qrystr.Query);
+
+          if (!(QueryStatics.RegionQueryRowCounts[qryIdx] == 0 ||
+            QueryStatics.RegionQueryRowCounts[qryIdx] == 1))
+          {
+            ErrorOccurred = true;
+            Util.Log("FAIL: Query # {0} expected query exception did not occur", qryIdx);
+            qryIdx++;
+            continue;
+          }
+        }
+        catch (QueryException)
+        {
+          if (QueryStatics.RegionQueryRowCounts[qryIdx] == 0 ||
+            QueryStatics.RegionQueryRowCounts[qryIdx] == 1)
+          {
+            ErrorOccurred = true;
+            Util.Log("FAIL: Query # {0} unexpected query exception occured", qryIdx);
+            qryIdx++;
+            continue;
+          }
+        }
+        catch (Exception)
+        {
+          ErrorOccurred = true;
+          Util.Log("FAIL: Query # {0} unexpected exception occured", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+
+      try
+      {
+        Object result = region.SelectValue("");
+        Assert.Fail("Expected IllegalArgumentException exception for empty predicate");
+      }
+      catch (IllegalArgumentException ex)
+      {
+        Util.Log("got expected IllegalArgumentException exception for empty predicate:");
+        Util.Log(ex.Message);
+      }
+
+
+      try
+      {
+        Object result = region.SelectValue(QueryStatics.RegionQueries[0].Query, 2200000);
+        Assert.Fail("Expected IllegalArgumentException exception for invalid timeout");
+      }
+      catch (IllegalArgumentException ex)
+      {
+        Util.Log("got expected IllegalArgumentException exception for invalid timeout:");
+        Util.Log(ex.Message);
+      }
+
+      try
+      {
+        Object result = region.SelectValue("bad predicate");
+        Assert.Fail("Expected QueryException exception for wrong predicate");
+      }
+      catch (QueryException ex)
+      {
+        Util.Log("got expected QueryException exception for wrong predicate:");
+        Util.Log(ex.Message);
+      }
+    }
+
+    public void StepSixRQ()
+    {
+      bool ErrorOccurred = false;
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+      {
+        if ((qrystr.Category != QueryCategory.Unsupported) || (qryIdx == 3))
+        {
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+        try
+        {
+          ISelectResults<object> results = region.Query<object>(qrystr.Query);
+
+          Util.Log("Query # {0} expected exception did not occur", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+        catch (QueryException)
+        {
+          // ok, exception expected, do nothing.
+          qryIdx++;
+        }
+        catch (Exception)
+        {
+          ErrorOccurred = true;
+          Util.Log("FAIL: Query # {0} unexpected exception occured", qryIdx);
+          qryIdx++;
+        }
+      }
+
+      Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+    }
+
+    #endregion
+
+    void runRegionQuery()
+    {
+      CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      m_client2.Call(StepOne, CacheHelper.Locators, m_isPdx);
+      Util.Log("StepOne complete.");
+
+      m_client2.Call(StepTwo, m_isPdx);
+      Util.Log("StepTwo complete.");
+
+      //Extra Step
+      //m_client1.Call(StepExtra);
+
+      m_client2.Call(StepThreeRQ);
+      Util.Log("StepThree complete.");
+
+      m_client2.Call(StepFourRQ);
+      Util.Log("StepFour complete.");
+
+      m_client2.Call(StepFiveRQ);
+      Util.Log("StepFive complete.");
+
+      m_client2.Call(StepSixRQ);
+      Util.Log("StepSix complete.");
+
+      m_client2.Call(Close);
+      Util.Log("Client closed");
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+    }
+
+    static bool m_isPdx = false;
+
+    [Test]
+    public void RegionQueryWithPdx()
+    {
+      m_isPdx = true;
+      runRegionQuery();
+    }
+
+    [Test]
+    public void RegionQueryWithoutPdx()
+    {
+      m_isPdx = false;
+      runRegionQuery();
+    }
+
+  }
+}
diff --git a/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs b/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs
new file mode 100644
index 0000000..065edfa
--- /dev/null
+++ b/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs
@@ -0,0 +1,399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRemoteParamQueryResultSetTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+      "Portfolios3" };
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+    public void StepOne(string locators, bool isPdx)
+    {
+      m_isPdx = isPdx;
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+      null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+        null, locators, "__TESTPOOL1_", true);
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+      region.CreateSubRegion(QueryRegionNames[1], regattrs);
+    }
+
+    public void StepTwo(bool isPdx)
+    {
+      m_isPdx = isPdx;
+      IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+      IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+      IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+      IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+      Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+        qh.PortfolioNumSets);
+
+      if (!m_isPdx)
+      {
+        qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+      else
+      {
+        qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+    }
+
+    public void StepThreePQRS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings paramqrystr in QueryStatics.ResultSetParamQueries)
+      {
+        if (paramqrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating query index {0}. {1}", qryIdx, paramqrystr.Query);
+
+        Query<object> query = qs.NewQuery(paramqrystr.Query);
+
+        //Populate the parameter list (paramList) for the query.
+        object[] paramList = new object[QueryStatics.NoOfQueryParam[qryIdx]];
+        int numVal = 0;
+        for (int ind = 0; ind < QueryStatics.NoOfQueryParam[qryIdx]; ind++)
+        {
+          //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSet[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSet[qryIdx][ind]);
+
+          try
+          {
+            numVal = Convert.ToInt32(QueryStatics.QueryParamSet[qryIdx][ind]);
+            paramList[ind] = numVal;
+            //Util.Log("NIL::PQRS::361 Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+          }
+          catch (FormatException)
+          {
+            //Console.WriteLine("Param string is not a sequence of digits.");
+            paramList[ind] = (System.String)QueryStatics.QueryParamSet[qryIdx][ind];
+            //Util.Log("NIL::PQRS:: Interger Args:: routingObj[0] = {1}", ind, routingObj[ind].ToString());
+          }
+        }
+
+        ISelectResults<object> results = query.Execute(paramList);
+
+        //Varify the result
+        int expectedRowCount = qh.IsExpectedRowsConstantPQRS(qryIdx) ?
+        QueryStatics.ResultSetPQRowCounts[qryIdx] : QueryStatics.ResultSetPQRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+        if (!qh.VerifyRS(results, expectedRowCount))
+        {
+          ErrorOccurred = true;
+          Util.Log("Query verify failed for query index {0}.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        ResultSet<object> rs = results as ResultSet<object>;
+
+        foreach (object item in rs)
+        {
+          if (!m_isPdx)
+          {
+            Portfolio port = item as Portfolio;
+            if (port == null)
+            {
+              Position pos = item as Position;
+              if (pos == null)
+              {
+                string cs = item as string;
+                if (cs == null)
+                {
+                  Util.Log("Query got other/unknown object.");
+                }
+                else
+                {
+                  Util.Log("Query got string : {0}.", cs);
+                }
+              }
+              else
+              {
+                Util.Log("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+              }
+            }
+            else
+            {
+              Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+            }
+          }
+          else
+          {
+            PortfolioPdx port = item as PortfolioPdx;
+            if (port == null)
+            {
+              PositionPdx pos = item as PositionPdx;
+              if (pos == null)
+              {
+                string cs = item as string;
+                if (cs == null)
+                {
+                  Util.Log("Query got other/unknown object.");
+                }
+                else
+                {
+                  Util.Log("Query got string : {0}.", cs);
+                }
+              }
+              else
+              {
+                Util.Log("Query got PositionPdx object with secId {0}, shares {1}.", pos.secId, pos.getSharesOutstanding);
+              }
+            }
+            else
+            {
+              Util.Log("Query got PortfolioPdx object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+            }
+          }
+        }
+
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+    }
+
+    public void StepFourPQRS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.ResultSetParamQueries)
+      {
+        if (qrystr.Category != QueryCategory.Unsupported)
+        {
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        object[] paramList = new object[QueryStatics.NoOfQueryParam[qryIdx]];
+
+        Int32 numVal = 0;
+        for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParam[qryIdx]; ind++)
+        {
+          //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSet[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSet[qryIdx, ind]);
+
+          try
+          {
+            numVal = Convert.ToInt32(QueryStatics.QueryParamSet[qryIdx][ind]);
+            paramList[ind] = numVal;
+            //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+          }
+          catch (FormatException)
+          {
+            //Console.WriteLine("Param string is not a sequence of digits.");
+            paramList[ind] = (System.String)QueryStatics.QueryParamSet[qryIdx][ind];
+            //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+          }
+        }
+
+        try
+        {
+          ISelectResults<object> results = query.Execute(paramList);
+
+          Util.Log("Query exception did not occur for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+        catch (GeodeException)
+        {
+          // ok, exception expected, do nothing.
+          qryIdx++;
+        }
+        catch (Exception)
+        {
+          Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+      }
+
+      Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+    }
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+
+    #endregion
+
+    void runRemoteParamQueryRS()
+    {
+      CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      m_client1.Call(StepOne, CacheHelper.Locators, m_isPdx);
+      Util.Log("StepOne complete.");
+
+      m_client1.Call(StepTwo, m_isPdx);
+      Util.Log("StepTwo complete.");
+
+      m_client1.Call(StepThreePQRS);
+      Util.Log("StepThree complete.");
+
+      m_client1.Call(StepFourPQRS);
+      Util.Log("StepFour complete.");
+
+      m_client1.Call(Close);
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+    }
+
+    static bool m_isPdx = false;
+
+    [Test]
+    public void RemoteParamQueryRSWithPdx()
+    {
+      m_isPdx = true;
+      runRemoteParamQueryRS();
+    }
+
+    [Test]
+    public void RemoteParamQueryRSWithoutPdx()
+    {
+      m_isPdx = false;
+      runRemoteParamQueryRS();
+    }
+  }
+}
diff --git a/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs b/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs
new file mode 100644
index 0000000..c4fcd73
--- /dev/null
+++ b/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRemoteParamQueryStructSetTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+      "Portfolios3" };
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+    public void StepOne(string locators, bool isPdx)
+    {
+      m_isPdx = isPdx;
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+      null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+        null, locators, "__TESTPOOL1_", true);
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+      region.CreateSubRegion(QueryRegionNames[1], regattrs);
+    }
+
+    public void StepTwo(bool isPdx)
+    {
+      m_isPdx = isPdx;
+      IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+      IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+      IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+      IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+      Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+        qh.PortfolioNumSets);
+
+      if (!m_isPdx)
+      {
+        qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+      else
+      {
+        qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+    }
+
+    public void StepThreePQSS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.StructSetParamQueries)
+      {
+        if (qrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating query index {0}. {1}", qryIdx, qrystr.Query);
+
+        if (m_isPdx == true)
+        {
+          if (qryIdx == 16)
+          {
+            Util.Log("Skipping query index {0} for pdx because it has function.", qryIdx);
+            qryIdx++;
+            continue;
+          }
+        }
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        //Populate the param list, paramList for parameterized query 
+        object[] paramList = new object[QueryStatics.NoOfQueryParamSS[qryIdx]];
+
+        Int32 numVal = 0;
+        for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParamSS[qryIdx]; ind++)
+        {
+          //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSetSS[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSetSS[qryIdx, ind]);
+
+          try
+          {
+            numVal = Convert.ToInt32(QueryStatics.QueryParamSetSS[qryIdx][ind]);
+            paramList[ind] = numVal;
+            //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+          }
+          catch (FormatException)
+          {
+            //Console.WriteLine("Param string is not a sequence of digits.");
+            paramList[ind] = (System.String)QueryStatics.QueryParamSetSS[qryIdx][ind];
+            //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+          }
+        }
+
+        ISelectResults<object> results = query.Execute(paramList);
+
+        int expectedRowCount = qh.IsExpectedRowsConstantPQSS(qryIdx) ?
+        QueryStatics.StructSetPQRowCounts[qryIdx] : QueryStatics.StructSetPQRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+        if (!qh.VerifySS(results, expectedRowCount, QueryStatics.StructSetPQFieldCounts[qryIdx]))
+        {
+          ErrorOccurred = true;
+          Util.Log("Query verify failed for query index {0}.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        StructSet<object> ss = results as StructSet<object>;
+        if (ss == null)
+        {
+          Util.Log("Zero records found for query index {0}, continuing.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        uint rows = 0;
+        Int32 fields = 0;
+        foreach (Struct si in ss)
+        {
+          rows++;
+          fields = (Int32)si.Length;
+        }
+
+        Util.Log("Query index {0} has {1} rows and {2} fields.", qryIdx, rows, fields);
+
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+    }
+
+    public void StepFourPQSS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.StructSetParamQueries)
+      {
+        if (qrystr.Category != QueryCategory.Unsupported)
+        {
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        //Populate the param list
+        object[] paramList = new object[QueryStatics.NoOfQueryParamSS[qryIdx]];
+
+        Int32 numVal = 0;
+        for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParamSS[qryIdx]; ind++)
+        {
+          //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSetSS[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSetSS[qryIdx, ind]);
+
+          try
+          {
+            numVal = Convert.ToInt32(QueryStatics.QueryParamSetSS[qryIdx][ind]);
+            paramList[ind] = numVal;
+            //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+          }
+          catch (FormatException)
+          {
+            //Console.WriteLine("Param string is not a sequence of digits.");
+            paramList[ind] = (System.String)QueryStatics.QueryParamSetSS[qryIdx][ind];
+            //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+          }
+        }
+
+        try
+        {
+          ISelectResults<object> results = query.Execute(paramList);
+
+          Util.Log("Query exception did not occur for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+        catch (GeodeException)
+        {
+          // ok, exception expected, do nothing.
+          qryIdx++;
+        }
+        catch (Exception)
+        {
+          Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+      }
+
+      Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+    }
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+    #endregion
+
+    void runRemoteParamQuerySS()
+    {
+      CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      m_client2.Call(StepOne, CacheHelper.Locators, m_isPdx);
+      Util.Log("StepOne complete.");
+
+      m_client2.Call(StepTwo, m_isPdx);
+      Util.Log("StepTwo complete.");
+
+      m_client2.Call(StepThreePQSS);
+      Util.Log("StepThree complete.");
+
+      m_client2.Call(StepFourPQSS);
+      Util.Log("StepFour complete.");
+
+      //m_client2.Call(GetAllRegionQuery);
+
+      m_client2.Call(Close);
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+    }
+
+    static bool m_isPdx = false;
+
+    [Test]
+    public void RemoteParamQuerySSWithoutPdx()
+    {
+      m_isPdx = false;
+      runRemoteParamQuerySS();
+    }
+
+    [Test]
+    public void RemoteParamQuerySSWithPdx()
+    {
+      m_isPdx = true;
+      runRemoteParamQuerySS();
+    }
+  }
+}
diff --git a/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs b/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs
new file mode 100644
index 0000000..34db74f
--- /dev/null
+++ b/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRemoteQueryExclusivenessTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string QERegionName = "Portfolios";
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+    public void StepOneQE(string locators, bool isPdx)
+    {
+      m_isPdx = isPdx;
+      try
+      {
+				var poolFail = CacheHelper.DCache.GetPoolManager().CreateFactory().Create("_TESTFAILPOOL_", CacheHelper.DCache);
+				var qsFail = poolFail.GetQueryService<object, object>();
+        var qryFail = qsFail.NewQuery("select distinct * from /" + QERegionName);
+        var resultsFail = qryFail.Execute();
+        Assert.Fail("Since no endpoints defined, so exception expected");
+      }
+      catch (IllegalStateException ex)
+      {
+        Util.Log("Got expected exception: {0}", ex);
+      }
+			catch (Exception e) {
+				Util.Log("Caught unexpected exception: {0}", e);
+				throw e;
+			}
+
+      CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+        null, locators, "__TESTPOOL1_", true);
+      IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+      if (!m_isPdx)
+      {
+        Portfolio p1 = new Portfolio(1, 100);
+        Portfolio p2 = new Portfolio(2, 100);
+        Portfolio p3 = new Portfolio(3, 100);
+        Portfolio p4 = new Portfolio(4, 100);
+
+        region["1"] = p1;
+        region["2"] = p2;
+        region["3"] = p3;
+        region["4"] = p4;
+      }
+      else
+      {
+        PortfolioPdx p1 = new PortfolioPdx(1, 100);
+        PortfolioPdx p2 = new PortfolioPdx(2, 100);
+        PortfolioPdx p3 = new PortfolioPdx(3, 100);
+        PortfolioPdx p4 = new PortfolioPdx(4, 100);
+
+        region["1"] = p1;
+        region["2"] = p2;
+        region["3"] = p3;
+        region["4"] = p4;
+      }
+
+      QueryService<object, object> qs = null;
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      Query<object> qry = qs.NewQuery("select distinct * from /" + QERegionName);
+      ISelectResults<object> results = qry.Execute();
+      Int32 count = results.Size;
+      Assert.AreEqual(4, count, "Expected 4 as number of portfolio objects.");
+
+      // Bring down the region
+      region.GetLocalView().DestroyRegion();
+    }
+
+    public void StepTwoQE()
+    {
+      QueryService<object, object> qs = null;
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+      Util.Log("Going to execute the query");
+      Query<object> qry = qs.NewQuery("select distinct * from /" + QERegionName);
+      ISelectResults<object> results = qry.Execute();
+      Int32 count = results.Size;
+      Assert.AreEqual(4, count, "Expected 4 as number of portfolio objects.");
+    }
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+    #endregion
+
+    void runQueryExclusiveness()
+    {
+      CacheHelper.SetupJavaServers(true, "cacheserver_remoteoqlN.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      m_client1.Call(StepOneQE, CacheHelper.Locators, m_isPdx);
+      Util.Log("StepOne complete.");
+
+      m_client1.Call(StepTwoQE);
+      Util.Log("StepTwo complete.");
+
+      m_client1.Call(Close);
+      Util.Log("Client closed");
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+    }
+
+
+    static bool m_isPdx = false;
+
+    [Test]
+    public void QueryExclusivenessWithoutPdx()
+    {
+      m_isPdx = false;
+      runQueryExclusiveness();
+    }
+
+    [Test]
+    public void QueryExclusivenessWithPdx()
+    {
+      m_isPdx = true;
+      runQueryExclusiveness();
+    }
+  }
+}
diff --git a/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs b/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs
new file mode 100644
index 0000000..4781b6b
--- /dev/null
+++ b/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRemoteQueryFailoverTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+      "Portfolios3" };
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+    public void StepOneFailover(bool isPdx)
+    {
+      m_isPdx = isPdx;
+      // This is here so that Client1 registers information of the cacheserver
+      // that has been already started
+      CacheHelper.SetupJavaServers(true,
+        "cacheserver_remoteoqlN.xml",
+        "cacheserver_remoteoql2N.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true, null,
+        CacheHelper.Locators, "__TESTPOOL1_", true);
+
+      IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QueryRegionNames[0]);
+      if (!m_isPdx)
+      {
+        Portfolio p1 = new Portfolio(1, 100);
+        Portfolio p2 = new Portfolio(2, 200);
+        Portfolio p3 = new Portfolio(3, 300);
+        Portfolio p4 = new Portfolio(4, 400);
+
+        region["1"] = p1;
+        region["2"] = p2;
+        region["3"] = p3;
+        region["4"] = p4;
+      }
+      else
+      {
+        PortfolioPdx p1 = new PortfolioPdx(1, 100);
+        PortfolioPdx p2 = new PortfolioPdx(2, 200);
+        PortfolioPdx p3 = new PortfolioPdx(3, 300);
+        PortfolioPdx p4 = new PortfolioPdx(4, 400);
+
+        region["1"] = p1;
+        region["2"] = p2;
+        region["3"] = p3;
+        region["4"] = p4;
+      }
+    }
+
+    public void StepTwoFailover()
+    {
+      CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+      Util.Log("Cacheserver 2 started.");
+
+      IAsyncResult killRes = null;
+      KillServerDelegate ksd = new KillServerDelegate(KillServer);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      for (int i = 0; i < 10000; i++)
+      {
+        Query<object> qry = qs.NewQuery("select distinct * from /" + QueryRegionNames[0]);
+
+        ISelectResults<object> results = qry.Execute();
+
+        if (i == 10)
+        {
+          killRes = ksd.BeginInvoke(null, null);
+        }
+
+        Int32 resultSize = results.Size;
+
+        if (i % 100 == 0)
+        {
+          Util.Log("Iteration upto {0} done, result size is {1}", i, resultSize);
+        }
+
+        Assert.AreEqual(4, resultSize, "Result size is not 4!");
+      }
+
+      killRes.AsyncWaitHandle.WaitOne();
+      ksd.EndInvoke(killRes);
+    }
+
+    #endregion
+
+    void runRemoteQueryFailover()
+    {
+      try
+      {
+        m_client1.Call(StepOneFailover, m_isPdx);
+        Util.Log("StepOneFailover complete.");
+
+        m_client1.Call(StepTwoFailover);
+        Util.Log("StepTwoFailover complete.");
+
+        m_client1.Call(Close);
+        Util.Log("Client closed");
+      }
+      finally
+      {
+        m_client1.Call(CacheHelper.StopJavaServers);
+        m_client1.Call(CacheHelper.StopJavaLocator, 1);
+      }
+    }
+
+    static bool m_isPdx = false;
+
+    [Test]
+    public void RemoteQueryFailoverWithPdx()
+    {
+      m_isPdx = true;
+      runRemoteQueryFailover();
+    }
+
+    [Test]
+    public void RemoteQueryFailoverWithoutPdx()
+    {
+      m_isPdx = false;
+      runRemoteQueryFailover();
+    }
+  }
+}
diff --git a/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs b/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs
new file mode 100644
index 0000000..9834064
--- /dev/null
+++ b/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs
@@ -0,0 +1,368 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRemoteQueryResultSetTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+      "Portfolios3" };
+
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+    public void StepOne(string locators, bool isPdx)
+    {
+      m_isPdx = isPdx;
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+      null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+        null, locators, "__TESTPOOL1_", true);
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+      region.CreateSubRegion(QueryRegionNames[1], regattrs);
+    }
+
+    public void StepTwo(bool isPdx)
+    {
+      m_isPdx = isPdx;
+      IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+      IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+      IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+      IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+      Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+        qh.PortfolioNumSets);
+
+      if (!m_isPdx)
+      {
+        qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+      else
+      {
+        qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+    }
+
+    public void StepThreeRS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.ResultSetQueries)
+      {
+        if (qrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        if (m_isPdx == true)
+        {
+          if (qryIdx == 2 || qryIdx == 3 || qryIdx == 4)
+          {
+            Util.Log("Skipping query index {0} for Pdx because it is function type.", qryIdx);
+            qryIdx++;
+            continue;
+          }
+        }
+
+        Util.Log("Evaluating query index {0}. Query string {1}", qryIdx, qrystr.Query);
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        ISelectResults<object> results = query.Execute();
+
+        int expectedRowCount = qh.IsExpectedRowsConstantRS(qryIdx) ?
+          QueryStatics.ResultSetRowCounts[qryIdx] : QueryStatics.ResultSetRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+        if (!qh.VerifyRS(results, expectedRowCount))
+        {
+          ErrorOccurred = true;
+          Util.Log("Query verify failed for query index {0}.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        ResultSet<object> rs = results as ResultSet<object>;
+
+        foreach (object item in rs)
+        {
+          if (!m_isPdx)
+          {
+            Portfolio port = item as Portfolio;
+            if (port == null)
+            {
+              Position pos = item as Position;
+              if (pos == null)
+              {
+                string cs = item.ToString();
+                if (cs == null)
+                {
+                  Util.Log("Query got other/unknown object.");
+                }
+                else
+                {
+                  Util.Log("Query got string : {0}.", cs);
+                }
+              }
+              else
+              {
+                Util.Log("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+              }
+            }
+            else
+            {
+              Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+            }
+          }
+          else
+          {
+            PortfolioPdx port = item as PortfolioPdx;
+            if (port == null)
+            {
+              PositionPdx pos = item as PositionPdx;
+              if (pos == null)
+              {
+                string cs = item.ToString();
+                if (cs == null)
+                {
+                  Util.Log("Query got other/unknown object.");
+                }
+                else
+                {
+                  Util.Log("Query got string : {0}.", cs);
+                }
+              }
+              else
+              {
+                Util.Log("Query got Position object with secId {0}, shares {1}.", pos.secId, pos.getSharesOutstanding);
+              }
+            }
+            else
+            {
+              Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+            }
+          }
+        }
+
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+    }
+
+    public void StepFourRS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.ResultSetQueries)
+      {
+        if (qrystr.Category != QueryCategory.Unsupported)
+        {
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        try
+        {
+          ISelectResults<object> results = query.Execute();
+
+          Util.Log("Query exception did not occur for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+        catch (GeodeException)
+        {
+          // ok, exception expected, do nothing.
+          qryIdx++;
+        }
+        catch (Exception)
+        {
+          Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+      }
+
+      Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+    }
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+    #endregion
+
+    void runRemoteQueryRS()
+    {
+      CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      m_client1.Call(StepOne, CacheHelper.Locators, m_isPdx);
+      Util.Log("StepOne complete.");
+
+      m_client1.Call(StepTwo, m_isPdx);
+      Util.Log("StepTwo complete.");
+
+      m_client1.Call(StepThreeRS);
+      Util.Log("StepThree complete.");
+
+      m_client1.Call(StepFourRS);
+      Util.Log("StepFour complete.");
+
+      m_client1.Call(Close);
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+    }
+
+    static bool m_isPdx = false;
+
+    [Test]
+    public void RemoteQueryRSWithPdx()
+    {
+      m_isPdx = true;
+      runRemoteQueryRS();
+    }
+
+
+    [Test]
+    public void RemoteQueryRSWithoutPdx()
+    {
+      m_isPdx = false;
+      runRemoteQueryRS();
+    }
+
+  }
+}
diff --git a/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs b/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs
new file mode 100644
index 0000000..780e305
--- /dev/null
+++ b/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs
@@ -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.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+  using NUnit.Framework;
+  using Apache.Geode.DUnitFramework;
+  using Apache.Geode.Client.Tests;
+
+  using Apache.Geode.Client;
+
+  using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+  using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+  using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+  [TestFixture]
+  [Category("group1")]
+  [Category("unicast_only")]
+  [Category("generics")]
+  public class ThinClientRemoteQueryStructSetTests : ThinClientRegionSteps
+  {
+    #region Private members
+
+    private UnitProcess m_client1;
+    private UnitProcess m_client2;
+    private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+      "Portfolios3" };
+
+    #endregion
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2 };
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      m_client1.Call(Close);
+      m_client2.Call(Close);
+      CacheHelper.StopJavaServers();
+      base.EndTest();
+    }
+
+    [SetUp]
+    public override void InitTest()
+    {
+      m_client1.Call(InitClient);
+      m_client2.Call(InitClient);
+    }
+
+    #region Functions invoked by the tests
+
+    public void InitClient()
+    {
+      CacheHelper.Init();
+      Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+      Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+    }
+
+
+    public void StepOne(string locators, bool isPdx)
+    {
+      m_isPdx = isPdx;
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+      null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+        null, locators, "__TESTPOOL1_", true);
+      CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+        null, locators, "__TESTPOOL1_", true);
+
+      IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+      region.CreateSubRegion(QueryRegionNames[1], regattrs);
+    }
+
+    public void StepTwo(bool isPdx)
+    {
+      m_isPdx = isPdx;
+      IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+      IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+      IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+      IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+      IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+      Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+        qh.PortfolioNumSets);
+
+      if (!m_isPdx)
+      {
+        qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+      else
+      {
+        qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+        qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+          qh.PortfolioNumSets);
+      }
+    }
+
+    public void StepThreeSS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.StructSetQueries)
+      {
+        if (qrystr.Category == QueryCategory.Unsupported)
+        {
+          Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        if (m_isPdx == true)
+        {
+          if (qryIdx == 12 || qryIdx == 4 || qryIdx == 7 || qryIdx == 22 || qryIdx == 30 || qryIdx == 34)
+          {
+            Util.Log("Skipping query index {0} for pdx because it has function.", qryIdx);
+            qryIdx++;
+            continue;
+          }
+        }
+
+        Util.Log("Evaluating query index {0}. {1}", qryIdx, qrystr.Query);
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        ISelectResults<object> results = query.Execute();
+
+        int expectedRowCount = qh.IsExpectedRowsConstantSS(qryIdx) ?
+          QueryStatics.StructSetRowCounts[qryIdx] : QueryStatics.StructSetRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+        if (!qh.VerifySS(results, expectedRowCount, QueryStatics.StructSetFieldCounts[qryIdx]))
+        {
+          ErrorOccurred = true;
+          Util.Log("Query verify failed for query index {0}.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        StructSet<object> ss = results as StructSet<object>;
+        if (ss == null)
+        {
+          Util.Log("Zero records found for query index {0}, continuing.", qryIdx);
+          qryIdx++;
+          continue;
+        }
+
+        uint rows = 0;
+        Int32 fields = 0;
+        foreach (Struct si in ss)
+        {
+          rows++;
+          fields = (Int32)si.Length;
+        }
+
+        Util.Log("Query index {0} has {1} rows and {2} fields.", qryIdx, rows, fields);
+
+        qryIdx++;
+      }
+
+      Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+    }
+
+    public void StepFourSS()
+    {
+      bool ErrorOccurred = false;
+
+      QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+      QueryService<object, object> qs = null;
+
+      qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+      int qryIdx = 0;
+
+      foreach (QueryStrings qrystr in QueryStatics.StructSetQueries)
+      {
+        if (qrystr.Category != QueryCategory.Unsupported)
+        {
+          qryIdx++;
+          continue;
+        }
+
+        Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+        Query<object> query = qs.NewQuery(qrystr.Query);
+
+        try
+        {
+          ISelectResults<object> results = query.Execute();
+
+          Util.Log("Query exception did not occur for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+        catch (GeodeException)
+        {
+          // ok, exception expected, do nothing.
+          qryIdx++;
+        }
+        catch (Exception)
+        {
+          Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+          ErrorOccurred = true;
+          qryIdx++;
+        }
+      }
+
+      Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+    }
+
+    public void KillServer()
+    {
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+    }
+
+    public delegate void KillServerDelegate();
+
+    #endregion
+
+    void runRemoteQuerySS()
+    {
+      CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+
+      m_client2.Call(StepOne, CacheHelper.Locators, m_isPdx);
+      Util.Log("StepOne complete.");
+
+      m_client2.Call(StepTwo, m_isPdx);
+      Util.Log("StepTwo complete.");
+
+      m_client2.Call(StepThreeSS);
+      Util.Log("StepThree complete.");
+
+      m_client2.Call(StepFourSS);
+      Util.Log("StepFour complete.");
+
+      //m_client2.Call(GetAllRegionQuery);
+
+      m_client2.Call(Close);
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+    }
+
+    static bool m_isPdx = false;
+
+
+    [Test]
+    public void RemoteQuerySSWithPdx()
+    {
+      m_isPdx = true;
+      runRemoteQuerySS();
+    }
+
+    [Test]
+    public void RemoteQuerySSWithoutPdx()
+    {
+      m_isPdx = false;
+      runRemoteQuerySS();
+    }
+
+  }
+}
diff --git a/clicache/integration-test/UnitTests.csproj.in b/clicache/integration-test/UnitTests.csproj.in
index c929137..a331500 100644
--- a/clicache/integration-test/UnitTests.csproj.in
+++ b/clicache/integration-test/UnitTests.csproj.in
@@ -193,6 +193,13 @@
     <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthzTestsMUN.cs" />
     <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthzTestsN.cs" />
     <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientQueryTestsN.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRemoteQueryResultSetTests.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRemoteParamQueryResultSetTests.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRemoteQueryStructSetTests.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRemoteParamQueryStructSetTests.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRemoteQueryFailoverTests.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRemoteQueryExclusivenessTests.cs" />
+    <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRegionQueryTests.cs" />
     <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientAppDomainQueryTests.cs" />
     <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientAppDomainFunctionExecutionTests.cs" />
     <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\BuiltinCacheableWrappersN.cs" />

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message