You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/08/11 23:52:53 UTC
[37/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientPdxTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientPdxTests.cs b/clicache/integration-test/ThinClientPdxTests.cs
new file mode 100755
index 0000000..66a7935
--- /dev/null
+++ b/clicache/integration-test/ThinClientPdxTests.cs
@@ -0,0 +1,6638 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.Collections;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Threading;
+using PdxTests;
+using System.Reflection;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ class ThinClientPdxTests : ThinClientRegionSteps
+ {
+ static bool m_useWeakHashMap = false;
+ #region Private members
+
+ private UnitProcess m_client1, m_client2, m_client3, m_client4;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ m_client4 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3, m_client4 };
+ //return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try {
+ m_client1.Call(DestroyRegions);
+ m_client2.Call(DestroyRegions);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ void cleanup()
+ {
+ {
+ CacheHelper.SetExtraPropertiesFile(null);
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ try
+ {
+ client.Call(CacheHelper.Close);
+ }
+ catch (System.Runtime.Remoting.RemotingException)
+ {
+ }
+ catch (System.Net.Sockets.SocketException)
+ {
+ }
+ }
+ }
+ CacheHelper.Close();
+ }
+ }
+
+ void runDistOps()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateNonExistentRegion, CacheHelper.Locators);
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(CheckServerKeys);
+ m_client1.Call(StepFive, true);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSix, true);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void PutAndVerifyPdxInGet()
+ {
+ Serializable.RegisterPdxType(PdxType.CreateDeserializable);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object,object>(m_regionNames[0]);
+
+ region0[1] = new PdxType();
+
+ PdxType pRet = (PdxType)region0[1];
+ checkPdxInstanceToStringAtServer(region0);
+
+ Assert.AreEqual(CacheHelper.DCache.GetPdxReadSerialized(), false, "Pdx read serialized property should be false.");
+
+ }
+
+ void VerifyGetOnly()
+ {
+ Serializable.RegisterPdxType(PdxType.CreateDeserializable);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ PdxType pRet = (PdxType)region0[1];
+ checkPdxInstanceToStringAtServer(region0);
+
+
+ }
+
+ void PutAndVerifyVariousPdxTypes()
+ {
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes9.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PositionPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.AllPdxTypes.Create);
+
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ {
+ PdxTypes1 p1 = new PdxTypes1();
+ region0[11] = p1;
+ PdxTypes1 pRet = (PdxTypes1)region0[11];
+ Assert.AreEqual(p1, pRet);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes2 p2 = new PdxTypes2();
+ region0[12] = p2;
+ PdxTypes2 pRet2 = (PdxTypes2)region0[12];
+ Assert.AreEqual(p2, pRet2);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes3 p3 = new PdxTypes3();
+ region0[13] = p3;
+ PdxTypes3 pRet3 = (PdxTypes3)region0[13];
+ Assert.AreEqual(p3, pRet3);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes4 p4 = new PdxTypes4();
+ region0[14] = p4;
+ PdxTypes4 pRet4 = (PdxTypes4)region0[14];
+ Assert.AreEqual(p4, pRet4);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes5 p5 = new PdxTypes5();
+ region0[15] = p5;
+ PdxTypes5 pRet5 = (PdxTypes5)region0[15];
+ Assert.AreEqual(p5, pRet5);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes6 p6 = new PdxTypes6();
+ region0[16] = p6;
+ PdxTypes6 pRet6 = (PdxTypes6)region0[16];
+ Assert.AreEqual(p6, pRet6);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes7 p7 = new PdxTypes7();
+ region0[17] = p7;
+ PdxTypes7 pRet7 = (PdxTypes7)region0[17];
+ Assert.AreEqual(p7, pRet7);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes8 p8 = new PdxTypes8();
+ region0[18] = p8;
+ PdxTypes8 pRet8 = (PdxTypes8)region0[18];
+ Assert.AreEqual(p8, pRet8);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PdxTypes9 p9 = new PdxTypes9();
+ region0[19] = p9;
+ PdxTypes9 pRet9 = (PdxTypes9)region0[19];
+ Assert.AreEqual(p9, pRet9);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PortfolioPdx pf = new PortfolioPdx(1001, 10);
+ region0[20] = pf;
+ PortfolioPdx retpf = (PortfolioPdx)region0[20];
+ checkPdxInstanceToStringAtServer(region0);
+ //Assert.AreEqual(p9, pRet9);
+ }
+
+ {
+ PortfolioPdx pf = new PortfolioPdx(1001, 10, new string[] { "one", "two", "three" });
+ region0[21] = pf;
+ PortfolioPdx retpf = (PortfolioPdx)region0[21];
+ checkPdxInstanceToStringAtServer(region0);
+ //Assert.AreEqual(p9, pRet9);
+ }
+ {
+ PdxTypes10 p10 = new PdxTypes10();
+ region0[22] = p10;
+ PdxTypes10 pRet10 = (PdxTypes10)region0[22];
+ Assert.AreEqual(p10, pRet10);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ AllPdxTypes apt = new AllPdxTypes(true);
+ region0[23] = apt;
+ AllPdxTypes aptRet = (AllPdxTypes)region0[23];
+ Assert.AreEqual(apt, aptRet);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ }
+
+ void VerifyVariousPdxGets()
+ {
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes9.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PositionPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.AllPdxTypes.Create);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ {
+ PdxTypes1 p1 = new PdxTypes1();
+ PdxTypes1 pRet = (PdxTypes1)region0[11];
+ Assert.AreEqual(p1, pRet);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes2 p2 = new PdxTypes2();
+ PdxTypes2 pRet2 = (PdxTypes2)region0[12];
+ Assert.AreEqual(p2, pRet2);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes3 p3 = new PdxTypes3();
+ PdxTypes3 pRet3 = (PdxTypes3)region0[13];
+ Assert.AreEqual(p3, pRet3);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes4 p4 = new PdxTypes4();
+ PdxTypes4 pRet4 = (PdxTypes4)region0[14];
+ Assert.AreEqual(p4, pRet4);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes5 p5 = new PdxTypes5();
+ PdxTypes5 pRet5 = (PdxTypes5)region0[15];
+ Assert.AreEqual(p5, pRet5);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes6 p6 = new PdxTypes6();
+ PdxTypes6 pRet6 = (PdxTypes6)region0[16];
+ Assert.AreEqual(p6, pRet6);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes7 p7 = new PdxTypes7();
+ PdxTypes7 pRet7 = (PdxTypes7)region0[17];
+ Assert.AreEqual(p7, pRet7);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes8 p8 = new PdxTypes8();
+ PdxTypes8 pRet8 = (PdxTypes8)region0[18];
+ Assert.AreEqual(p8, pRet8);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PdxTypes9 p9 = new PdxTypes9();
+ PdxTypes9 pRet9 = (PdxTypes9)region0[19];
+ Assert.AreEqual(p9, pRet9);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PortfolioPdx retpf = (PortfolioPdx)region0[20];
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PortfolioPdx retpf = (PortfolioPdx)region0[21];
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PdxTypes10 p10 = new PdxTypes10();
+ PdxTypes10 pRet10 = (PdxTypes10)region0[22];
+ Assert.AreEqual(p10, pRet10);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ AllPdxTypes apt = new AllPdxTypes(true);
+ AllPdxTypes aptRet = (AllPdxTypes)region0[23];
+ Assert.AreEqual(apt, aptRet);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ }
+
+ void checkPdxInstanceToStringAtServer(Region region)
+ {
+ bool retVal = (bool)region["success"];
+ Assert.IsTrue(retVal);
+ }
+
+ private void DoputAndVerifyClientName()
+ {
+ //CacheableString cVal = new CacheableString(new string('A', 1024));
+ Region region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ string cVal = new string('A', 5);
+
+ Util.Log("Putting key = key-0");
+ region["key-0"] = cVal;
+ Util.Log("Put Operation done successfully");
+
+ //Verify the Client Name.
+ string cReceivedName = region["clientName1"] as string;
+ Util.Log(" DoputAndVerifyClientName Received Client Name = {0} ", cReceivedName);
+ Assert.AreEqual(cReceivedName.Equals("Client-1"), true, "Did not find the expected value.");
+ }
+
+ private void DoGetAndVerifyClientName()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ string cReceivedName = region["clientName2"] as string; ;
+ Util.Log("Get Operation done successfully");
+
+ //Verify the Client Name.
+ Util.Log(" DoGetAndVerifyClientName Received Client Name = {0} ", cReceivedName);
+ Assert.AreEqual(cReceivedName.Equals("Client-2"), true, "Did not find the expected value.");
+ }
+
+ public void ConfigClient1AndCreateRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ //Configure Client "name" for Client-1
+ Properties<string, string> props = Properties<string, string>.Create<string, string>();
+ props.Insert("name", "Client-1");
+ CacheHelper.InitConfig(props);
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ m_regionNames = regionNames;
+
+ }
+
+ public void ConfigClient2AndCreateRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ //Configure Client "name" for Client-2
+ Properties<string, string> props = Properties<string, string>.Create<string, string>();
+ props.Insert("name", "Client-2");
+ CacheHelper.InitConfig(props);
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ m_regionNames = regionNames;
+ }
+
+ void runtestForBug866()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ //Client Notification and local caching enabled for clients
+ m_client1.Call(ConfigClient1AndCreateRegions_Pool, RegionNames, CacheHelper.Locators, "__TESTPOOL1_", true, false, true);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(ConfigClient2AndCreateRegions_Pool, RegionNames, CacheHelper.Locators, "__TESTPOOL1_", true, false, true);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(DoputAndVerifyClientName);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(DoGetAndVerifyClientName);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }//END:: testBug866
+
+ void runPdxDistOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(PutAndVerifyPdxInGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyGetOnly);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(PutAndVerifyVariousPdxTypes);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(VerifyVariousPdxGets);
+ Util.Log("StepSeven complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void VerifyDataOutputAdvance()
+ {
+ Serializable.RegisterPdxType(MyClass.Create);
+ Serializable.RegisterPdxType(MyClasses.Create);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ MyClasses mcs = new MyClasses("1", 1000);
+
+ region0[1] = mcs;
+
+ object ret = region0[1];
+
+ Assert.AreEqual(mcs, ret);
+ }
+
+ void runPdxDistOps2()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdxSerializer.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(VerifyDataOutputAdvance);
+ Util.Log("StepThree complete.");
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void PutAndVerifyNestedPdxInGet()
+ {
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ NestedPdx np = new NestedPdx();
+ region0[1] = np;
+
+ NestedPdx pRet = (NestedPdx)region0[1];
+
+ Assert.AreEqual(np, pRet);
+ }
+
+ void VerifyNestedGetOnly()
+ {
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ NestedPdx orig = new NestedPdx();
+ NestedPdx pRet = (NestedPdx)region0[1];
+
+ Assert.AreEqual(orig, pRet);
+ }
+
+ void runNestedPdxOps()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(PutAndVerifyNestedPdxInGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyNestedGetOnly);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void PutAndVerifyPdxInIGFSInGet()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ }
+ catch (Exception )
+ {
+ }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ PdxInsideIGeodeSerializable np = new PdxInsideIGeodeSerializable();
+ region0[1] = np;
+
+ PdxInsideIGeodeSerializable pRet = (PdxInsideIGeodeSerializable)region0[1];
+
+ Assert.AreEqual(np, pRet);
+ }
+
+ void VerifyPdxInIGFSGetOnly()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ }
+ catch (Exception )
+ { }
+
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ PdxInsideIGeodeSerializable orig = new PdxInsideIGeodeSerializable();
+ PdxInsideIGeodeSerializable pRet = (PdxInsideIGeodeSerializable)region0[1];
+
+ Assert.AreEqual(orig, pRet);
+ }
+
+ void runPdxInIGFSOps()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(PutAndVerifyPdxInIGFSInGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyPdxInIGFSGetOnly);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void JavaPutGet_LinedListType()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ //Do some put to invike attached listener,
+ region0[1] = 123;
+
+ //Get
+ int value = (int)region0[1];
+ //Util.Log("JavaPutGet_LinedListType value received = " + value);
+
+ //verify that listener methods have been called.
+ Assert.IsTrue((bool)region0["success"]);
+
+ //LinkedList validation
+ LinkedList<Object> myList1 = new LinkedList<Object>();
+ myList1.AddFirst("Manan");
+ myList1.AddLast("Nishka");
+
+ //get the JSON document (as PdxInstance) that has been put from java in attached cacheListener code.
+ IPdxInstance ret = (IPdxInstance)region0["jsondoc1"];
+ LinkedList<Object> linkedList = (LinkedList<Object>)ret.GetField("kids");
+
+ //verify sizes
+ Assert.AreEqual((linkedList.Count == myList1.Count), true, " LinkedList size should be equal.");
+
+ LinkedList<Object>.Enumerator e1 = linkedList.GetEnumerator();
+ LinkedList<Object>.Enumerator e2 = myList1.GetEnumerator();
+
+ //verify content of LinkedList
+ while (e1.MoveNext() && e2.MoveNext())
+ {
+ //Util.Log("JavaPutGet_LinedListType Kids = " + e1.Current);
+ PdxType.GenericValCompare(e1.Current, e2.Current);
+ }
+
+ Util.Log("successfully completed JavaPutGet_LinedListType");
+ }
+
+ void JavaPutGet()
+ {
+ try
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ }
+ catch (Exception )
+ {
+ }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ PdxType np = new PdxType();
+ region0[1] = np;
+
+ PdxType pRet = (PdxType)region0[1];
+
+ //Assert.AreEqual(np, pRet);
+
+ Assert.IsTrue((bool)region0["success"]);
+ }
+
+ void JavaGet()
+ {
+ try
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ }
+ catch (Exception )
+ {
+ }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ PdxType np = new PdxType();
+
+ PdxType pRet = (PdxType)region0[1];
+
+ PdxType putFromjava = (PdxType)region0["putFromjava"];
+ }
+
+ void runJavaInterOpsWithLinkedListType()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverForPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool_PDXWithLL, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("Clinet-1 CreateTCRegions_Pool_PDXWithLL (pool with locator) completed.");
+
+ m_client1.Call(JavaPutGet_LinedListType);
+ Util.Log("JavaPutGet_LinedListType complete.");
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runJavaInteroperableOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserverForPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(JavaPutGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(JavaGet);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void putallAndGetallPdx()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ }
+ catch (Exception )
+ { }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IDictionary<object, object> all = new Dictionary<object, object>();
+
+ PdxTypes1 p1 = new PdxTypes1();
+ PdxTypes2 p2 = new PdxTypes2();
+ PdxTypes3 p3 = new PdxTypes3();
+ PdxTypes4 p4 = new PdxTypes4();
+ PdxTypes5 p5 = new PdxTypes5();
+ PdxTypes6 p6 = new PdxTypes6();
+ PdxTypes7 p7 = new PdxTypes7();
+ PdxTypes8 p8 = new PdxTypes8();
+
+ all.Add(21, p1);
+ all.Add(22, p2);
+ all.Add(23, p3);
+ all.Add(24, p4);
+ all.Add(25, p5);
+ all.Add(26, p6);
+ all.Add(27, p7);
+ all.Add(28, p8);
+ region0.PutAll(all);
+
+
+ ICollection<object> keys = new List<object>();
+ IDictionary<object, object> getall = new Dictionary<object, object>();
+
+ keys.Add(21);
+ keys.Add(22);
+ keys.Add(23);
+ keys.Add(24);
+ keys.Add(25);
+ keys.Add(26);
+ keys.Add(27);
+ keys.Add(28);
+ //keys.Add(p1);
+ //keys.Add(p2);
+ region0.GetAll(keys, getall, null);
+ foreach (KeyValuePair<object, object> kv in all)
+ {
+ object key = kv.Key;
+ Util.Log("putall keys "+ key.GetType() + " : " + key);
+ }
+ //IEnumerator<KeyValuePair<object, object>> ie = getall.GetEnumerator();
+ foreach (KeyValuePair<object, object> kv in getall)
+ {
+ object key = kv.Key;
+ if (key != null)
+ Util.Log("got key " + key.GetType() + " : " + key);
+ else
+ Util.Log("got NULL key ");
+ object origVal = all[key];
+ Assert.AreEqual(kv.Value, origVal);
+ }
+ }
+
+
+ void runPutAllGetAllOps()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(putallAndGetallPdx);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(putallAndGetallPdx);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ void LocalOpsStep()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+
+ }
+ catch (Exception)
+ { }
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> localregion = region0.GetLocalView();
+
+
+ PdxTypes1 p1 = new PdxTypes1();
+ string x = "";
+ localregion.Add(p1, x);
+ object val = localregion[p1];
+ //object val = region0[p1];
+ val = localregion[p1];
+ val = localregion[p1];
+ Assert.IsTrue(val.Equals(x), "value should be equal");
+ Assert.IsTrue(localregion.Remove(new KeyValuePair<Object, Object>(p1, x)), "Result of remove should be true, as this value null exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p1), "containsKey should be false");
+ try
+ {
+ localregion[p1] = null;
+ Assert.Fail("Expected IllegalArgumentException here for put");
+ }
+ catch (IllegalArgumentException)
+ {
+ Util.Log("Got Expected IllegalArgumentException");
+ }
+
+ localregion[p1] = 1;
+ localregion.Invalidate(p1);
+ try
+ {
+ object retVal = localregion[p1];
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException)
+ {
+ Util.Log("Got expected KeyNotFoundException exception");
+ }
+ Assert.IsFalse(localregion.Remove(new KeyValuePair<Object, Object>(p1, 1)), "Result of remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(localregion.ContainsKey(p1), "containsKey should be true");
+ localregion[p1] = 1;
+ Assert.IsTrue(localregion.Remove(p1), "Result of remove should be true, as this value exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p1), "containsKey should be false");
+
+ PdxTypes2 p2 = new PdxTypes2();
+ localregion.Add(p2, 1);
+ object intVal1 = localregion[p2]; // local get work for pdx object as key but it wont work with caching enable. Throws KeyNotFoundException.
+ Assert.IsTrue(intVal1.Equals(1), "intVal should be 1.");
+
+ PdxTypes3 p3 = new PdxTypes3();
+ localregion.Add(p3, "testString");
+ if (localregion.ContainsKey(p3))
+ {
+ object strVal1 = localregion[p3];
+ Assert.IsTrue(strVal1.Equals("testString"), "strVal should be testString.");
+ }
+
+ try
+ {
+ if (localregion.ContainsKey(p3))
+ {
+ localregion.Add(p3, 11);
+ Assert.Fail("Expected EntryExistException here");
+ }
+ }
+ catch (EntryExistsException)
+ {
+ Util.Log(" Expected EntryExistsException exception thrown by localCreate");
+ }
+
+ PdxTypes4 p4 = new PdxTypes4();
+ localregion.Add(p4, p1);
+ object objVal1 = localregion[p4];
+ Assert.IsTrue(objVal1.Equals(p1), "valObject and objVal should match.");
+ Assert.IsTrue(localregion.Remove(new KeyValuePair<Object, Object>(p4, p1)), "Result of remove should be true, as this value exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p4), "containsKey should be false");
+ localregion[p4] = p1;
+ Assert.IsTrue(localregion.Remove(p4), "Result of remove should be true, as this value exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p4), "containsKey should be false");
+
+ PdxTypes5 p5 = new PdxTypes5();
+
+ //object cval = region0[p1]; //this will only work when caching is enable else throws KeyNotFoundException
+
+ localregion.Clear();
+
+ }
+ void runLocalOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, true/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+
+ m_client1.Call(LocalOpsStep);
+ Util.Log("localOps complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ Assembly m_pdxVesionOneAsm;
+ Assembly m_pdxVesionTwoAsm;
+
+ #region "Version Fisrt will be here PdxType1"
+ void initializePdxAssemblyOne(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOne);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+
+ IPdxSerializable registerPdxTypeOne()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxAssemblyTwo(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwo);
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+ IPdxSerializable registerPdxTypeTwo()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void putAtVersionOne11(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOne(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance , null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine( np.ToString());
+ Console.WriteLine( pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ }
+
+ void getPutAtVersionTwo12(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwo(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance , null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOne13()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo14()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+ public void getPutAtVersionOne15()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ if (m_useWeakHashMap == false)
+ {
+ Assert.AreEqual(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData(), 0);
+ }
+ else
+ {
+ Assert.IsTrue(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData() > 0);
+ }
+ }
+
+ public void getPutAtVersionTwo16()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+
+ if (m_useWeakHashMap == false)
+ {
+ Assert.AreEqual(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData(), 0);
+ }
+ else
+ {
+ //it has extra fields, so no need to preserve data
+ Assert.IsTrue(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData() == 0);
+ }
+ }
+
+ #endregion
+ void runBasicMergeOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(putAtVersionOne11, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(getPutAtVersionTwo12, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(getPutAtVersionOne13);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(getPutAtVersionTwo14);
+ Util.Log("StepSix complete.");
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client1.Call(getPutAtVersionOne15);
+ Util.Log("StepSeven complete." + i);
+
+ m_client2.Call(getPutAtVersionTwo16);
+ Util.Log("StepEight complete." + i);
+ }
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+
+ void initializePdxAssemblyOnePS(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+
+ //object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+
+ void putFromVersion1_PS(bool useWeakHashmap)
+ {
+ //local cache is on
+ initializePdxAssemblyOnePS(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+ object np = pt.InvokeMember("Create", BindingFlags.InvokeMethod, null, null, null);
+
+ Serializable.RegisterPdxSerializer((IPdxSerializer)np);
+
+ //created new object
+ np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+ Type keytype = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+ region0[key] = np;
+
+ object pRet = region0[key];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ //this should come from local caching
+ pRet = region0.GetLocalView()[key];
+
+ Assert.IsNotNull(pRet);
+
+ region0.GetLocalView().Invalidate(key);
+ bool isKNFE = false;
+ try
+ {
+ pRet = region0.GetLocalView()[key];
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException )
+ {
+ isKNFE = true;
+ }
+
+ Assert.IsTrue(isKNFE);
+
+ pRet = region0[key];
+
+ isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ region0.GetLocalView().Remove(key);
+
+ }
+
+ void initializePdxAssemblyTwoPS(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+
+ //object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+
+ void putFromVersion2_PS(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwoPS(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+
+ object np = pt.InvokeMember("Create", BindingFlags.InvokeMethod, null, null, null);
+
+ Serializable.RegisterPdxSerializer((IPdxSerializer)np);
+
+ np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+ Type keytype = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+ region0[key] = np;
+
+ object pRet = region0[key];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ object key2 = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-2" });
+ region0[key2] = np;
+ }
+
+
+ void getputFromVersion1_PS()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+ object np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+
+ Type keytype = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+
+ object pRet = region0[key];
+
+ Assert.IsTrue(np.Equals(pRet));
+
+ //get then put.. this should merge data back
+ region0[key] = pRet;
+
+ object key2 = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-2" });
+
+ pRet = region0[key2];
+
+ Assert.IsTrue(np.Equals(pRet));
+
+ //get then put.. this should Not merge data back
+ region0[key2] = np;
+
+ }
+
+ void getAtVersion2_PS()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+ object np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+
+ Type keytype = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+ bool gotexcep = false;
+ try
+ {
+ object r = region0.GetLocalView()[key];
+ }
+ catch (Exception )
+ {
+ gotexcep = true;
+ }
+ Assert.IsTrue(gotexcep);
+
+ object pRet = region0[key];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ object key2 = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-2" });
+
+ np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+ pRet = region0[key2];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ Assert.IsTrue(!np.Equals(pRet));
+ }
+
+ void runBasicMergeOpsWithPdxSerializer()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdxSerializer.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, true/*local caching true*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(putFromVersion1_PS, m_useWeakHashMap);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(putFromVersion2_PS, m_useWeakHashMap);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(getputFromVersion1_PS);
+ Util.Log("Stepthree complete.");
+
+ m_client2.Call(getAtVersion2_PS);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(dinitPdxSerializer);
+ m_client2.Call(dinitPdxSerializer);
+
+ //m_client1.Call(getPutAtVersionOne13);
+ //Util.Log("StepFive complete.");
+
+ //m_client2.Call(getPutAtVersionTwo14);
+ //Util.Log("StepSix complete.");
+
+ //for (int i = 0; i < 10; i++)
+ //{
+ // m_client1.Call(getPutAtVersionOne15);
+ // Util.Log("StepSeven complete." + i);
+
+ // m_client2.Call(getPutAtVersionTwo16);
+ // Util.Log("StepEight complete." + i);
+ //}
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region Basic merge three PDxType2
+
+ void initializePdxAssemblyOne2(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOne2);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ IPdxSerializable registerPdxTypeOne2()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxAssemblyTwo2(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwo2);
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+ IPdxSerializable registerPdxTypeTwo2()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionOne21(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOne2(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.Pdx1");
+ object pdx1 = pt.InvokeMember("Pdx1", BindingFlags.CreateInstance, null, null, null);
+
+ for (int i = 1000; i < 1010; i++) {
+ region0[i] = pdx1;
+ }
+ }
+
+ public void getPutAtVersionTwo22(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwo2(useWeakHashmap);
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+
+ pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.Pdx1");
+ object pdx1 = pt.InvokeMember("Pdx1", BindingFlags.CreateInstance, null, null, null);
+
+ for (int i = 1000; i < 1010; i++)
+ {
+ object ret = region0[i];
+ }
+ }
+ public void getPutAtVersionOne23()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo24()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ void runBasicMergeOps2()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(putAtVersionOne21, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(getPutAtVersionTwo22, m_useWeakHashMap);
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client1.Call(getPutAtVersionOne23);
+ m_client2.Call(getPutAtVersionTwo24);
+
+ Util.Log("step complete " + i);
+ }
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ #endregion
+
+ #region Basic merge three PDxType3
+
+ void initializePdxAssemblyOne3(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOne3);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ IPdxSerializable registerPdxTypeOne3()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxAssemblyTwo3(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwo3);
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+ IPdxSerializable registerPdxTypeTwo3()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionOne31(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOne3(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+ }
+
+ public void getPutAtVersionTwo32(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwo3(useWeakHashmap);
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+ public void getPutAtVersionOne33()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo34()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ void runBasicMergeOps3()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(putAtVersionOne31, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(getPutAtVersionTwo32, m_useWeakHashMap);
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client1.Call(getPutAtVersionOne33);
+ m_client2.Call(getPutAtVersionTwo34);
+
+ Util.Log("step complete " + i);
+ }
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ #endregion
+
+ #region "Version two will first here"
+
+ void initializePdxAssemblyOneR1(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOneR1);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+
+ }
+
+ IPdxSerializable registerPdxTypeOneR1()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+
+ void initializePdxAssemblyTwoR1(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwoR1);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+
+ IPdxSerializable registerPdxTypeTwoR1()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionTwo1(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwoR1(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ Assert.AreEqual(np, pRet);
+ }
+
+ public void getPutAtVersionOne2(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOneR1(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo3()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];//get
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOne4()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo5()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOne6()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+ #endregion
+
+ void runBasicMergeOpsR1()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client2.Call(putAtVersionTwo1, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(getPutAtVersionOne2, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ m_client2.Call(getPutAtVersionTwo3);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(getPutAtVersionOne4);
+ Util.Log("StepSix complete.");
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client2.Call(getPutAtVersionTwo5);
+ Util.Log("StepSeven complete." + i);
+
+ m_client1.Call(getPutAtVersionOne6);
+ Util.Log("StepEight complete." + i);
+ }
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ IPdxSerializable registerPdxUIV1()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxUIAssemblyOne(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxUIV1);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ public void putV1PdxUI(bool useWeakHashmap)
+ {
+ initializePdxUIAssemblyOne(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+ object np = pt.InvokeMember("PdxTypesIgnoreUnreadFields", BindingFlags.CreateInstance, null, null, null);
+ object pRet = region0[1];
+ region0[1] = pRet;
+
+
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ //Assert.AreEqual(np, pRet);
+ }
+
+ IPdxSerializable registerPdxUIV2()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxUIAssemblyTwo(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxUIV2);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ public void putV2PdxUI(bool useWeakHashmap)
+ {
+ initializePdxUIAssemblyTwo(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+ object np = pt.InvokeMember("PdxTypesIgnoreUnreadFields", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ Assert.AreEqual(np, pRet);
+ region0[1] = pRet;
+ Console.WriteLine(" " + pRet);
+ }
+
+ public void getV2PdxUI()
+ {
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+ object np = pt.InvokeMember("PdxTypesIgnoreUnreadFields", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ Assert.AreEqual(np, pRet);
+ }
+ void runPdxIgnoreUnreadFieldTest()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool_PDX, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool_PDX, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client2.Call(putV2PdxUI, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(putV1PdxUI, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ m_client2.Call(getV2PdxUI);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region PdxType2 Version two first
+
+ void initializePdxAssemblyOneR2(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOneR2);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+
+ }
+
+ IPdxSerializable registerPdxTypeOneR2()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+
+ void initializePdxAssemblyTwoR2(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwoR2);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+
+ IPdxSerializable registerPdxTypeTwoR2()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionTwoR21(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwoR2(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+ }
+
+ public void getPutAtVersionOneR22(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOneR2(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwoR23()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];//get
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOneR24()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+
+ void runBasicMergeOpsR2()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client2.Call(putAtVersionTwoR21, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(getPutAtVersionOneR22, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client2.Call(getPutAtVersionTwoR23);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(getPutAtVersionOneR24);
+ Util.Log("StepSix complete.");
+ }
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #endregion
+
+ public void putFromPool1()
+ {
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Util.Log("Put from pool-1 started");
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+
+ region0[1] = new PdxTypes1();
+
+ region0[2] = new PdxTests.PdxType();
+ Util.Log("Put from pool-1 Completed");
+ }
+
+ public void putFromPool2()
+ {
+ Util.Log("Put from pool-21 started");
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[1]);
+
+ region0[1] = new PdxTypes1();
+ region0[2] = new PdxTests.PdxType();
+ object ret = region0[1];
+ ret = region0[2];
+ Util.Log("Put from pool-2 completed");
+
+ int pdxIds = Apache.Geode.Client.Internal.PdxTypeRegistry.testGetNumberOfPdxIds();
+
+ Assert.AreEqual(3, pdxIds);
+ }
+
+ public void runMultipleDSTest()
+ {
+ Util.Log("Starting runMultipleDSTest. " );
+
+ CacheHelper.SetupJavaServers(true, "cacheserverMDS1.xml", "cacheserverMDS2.xml");
+ CacheHelper.StartJavaLocator_MDS(1, "GFELOC", null, 1/*ds id is one*/);
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaLocator_MDS(2, "GFELOC2", null, 2/*ds id is one*/);
+ Util.Log("Locator 2 started.");
+
+ CacheHelper.StartJavaServerWithLocator_MDS(1, "GFECS1", 1);
+ Util.Log("Server 1 started with locator 1.");
+
+ CacheHelper.StartJavaServerWithLocator_MDS(2, "GFECS2", 2);
+ Util.Log("Server 2 started with locator 2.");
+
+ //client intialization
+ /*
+ * CreateTCRegion_Pool(string name, bool ack, bool caching,
+ ICacheListener listener, string endpoints, string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled)
+ *
+ */
+
+ m_client1.Call(CacheHelper.CreateTCRegion_Pool_MDS,
+ RegionNames[0], true, false,
+ CacheHelper.LocatorFirst, "__TESTPOOL1_",
+ false, false, false);
+
+ Util.Log("StepOne (pool-1 locators) complete. " + CacheHelper.LocatorFirst);
+
+ m_client1.Call(CacheHelper.CreateTCRegion_Pool_MDS,
+ RegionNames[1], false, false,
+ CacheHelper.LocatorSecond, "__TESTPOOL2_",
+ false, false, false);
+
+ Util.Log("StepTwo (pool-2 locators) complete. " + CacheHelper.LocatorSecond);
+
+
+ m_client1.Call(putFromPool1);
+
+ m_client1.Call(putFromPool2);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ //m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ CacheHelper.StopJavaLocator(2);
+ Util.Log("Locator 2 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+
+ }
+
+ void initializePdxSerializer()
+ {
+ Serializable.RegisterPdxSerializer(new PdxSerializer());
+
+ //Serializable.RegisterTypeForPdxSerializer(SerializePdx1.CreateDeserializable);
+ }
+
+ void doPutGetWithPdxSerializer()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ for (int i = 0; i < 10; i++)
+ {
+ object put = new SerializePdx1(true); ;
+
+ region0[i] = put;
+
+ object ret = region0[i];
+
+ Assert.AreEqual(put, ret);
+
+ put = new SerializePdx2(true);
+ region0[i + 10] = put;
+
+
+ ret = region0[i + 10];
+
+ Assert.AreEqual(put, ret);
+
+
+ put = new SerializePdx3(true, i % 2);
+ region0[i + 20] = put;
+
+ ret = region0[i + 20];
+
+ Assert.AreEqual(put, ret);
+
+ }
+ }
+
+ void doGetWithPdxSerializerC2()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ SerializePdx3 sp3Even = new SerializePdx3(true, 0);
+ SerializePdx3 sp3Odd = new SerializePdx3(true, 1);
+
+ for (int i = 0; i < 10; i++)
+ {
+ object local = new SerializePdx1(true); ;
+
+
<TRUNCATED>