You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mm...@apache.org on 2018/09/18 22:21:21 UTC
[geode-native] branch develop updated: GEODE-5259: Remove classId
from DataSerializable
This is an automated email from the ASF dual-hosted git repository.
mmartell 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 9a8751f GEODE-5259: Remove classId from DataSerializable
9a8751f is described below
commit 9a8751fb8f71686d439dca27e5fdc9fc9ed70836
Author: Michael Martell <mm...@pivotal.io>
AuthorDate: Tue Sep 18 15:21:16 2018 -0700
GEODE-5259: Remove classId from DataSerializable
- Test using type_info
- First cut at removing getClassId() from DataSerializable
- Switch to find instead of [ ] operator
- Update clicache integration tests to use new DataSerializable interface.
- Added new CSharp serialization test.
- Removed all reference to ClassId and added "type" to the Managed wrapper of DataSerializables plus tests
- Rebased with develop: switch to DSCode
- Make the DSCode version of bind private
- Cleanup bind function
- Fix serialize (wasn't writing the DSCode and the user typeId).
- Added a composite custom object test
- Update tests to use proper typeId (to match java classes).
- Update clicache integration tests to use new DataSerializable interface.
- Added new CSharp serialization test.
- Removed all reference to ClassId and added "type" to the Managed wrapper of DataSerializables plus tests
- Make the DSCode version of bind private
- Added a composite custom object test
- Update tests to use proper typeId (to match java classes).
- Switch TypeId for Portfolio and Position in clicache tests to coorespond with the Java versions of each.
- Updated DataSerializable test to use explicit compares of strings
- changed uint32_t to int32_t in TypeRegistry
- Refactor to remove compID (composite ID) and use better naming of maps
All id's are now int32_t and bit shifts were removed
- Copy geode-native symbols to allow debugging
- Refactor bind into bindDataSerializable and bindDataSerializableFixedId and rename maps
- Switch back to std::type_info
- Added ManagedDataSerializableHandler support.
- Intercepting handling of DataSerializables for managed and unmanaged.
- Refactored SerializationRegistry to collapse overloaded methods.
- Added helper methods to support the (de)serializtion methods.
- DataOutput api changed to only support std::shared_ptr<Serializable>
- Managed TypeRegistry has improved mnemonics of maps and accessors
- also removed obsolete native delegate creation
- Only copy the pdb for Debug builds
- Test code shouldn't eat exceptions when creating the cache.
- Split out DataSerializablePrimitives map.
- Refactored map names to be more expressive.
- Remove DataSerializableInternal::getInternal().
- Fix rename error of DSCodeToFactoryMap
- Fix and reformat clicache SerializationTests
- Update examples to new DataSerializable api
- Fix missing Type property in example code
- Just use System::Type in IDataSerializable
- Cleanup formatting and dead code
- Remove IDataSerializable::Type property (no longer needed)
- More file cleanup from review.
- Remove Type property from an example.
---
clicache/integration-test/DefaultCacheableN.cs | 57 +-
clicache/integration-test/PutGetTestsN.cs | 4 -
clicache/integration-test/RegionFailingTests.cs | 2 +-
clicache/integration-test/SerializationTestsN.cs | 74 +--
.../ThinClientAppDomainQueryTests.cs | 4 +-
.../integration-test/ThinClientCallbackArgN.cs | 8 +-
.../ThinClientCqAttributesMutatorTests.cs | 4 +-
clicache/integration-test/ThinClientCqIRTestsN.cs | 4 +-
clicache/integration-test/ThinClientCqPdxTest.cs | 4 +-
.../integration-test/ThinClientCqStatusTest.cs | 4 +-
.../ThinClientCqStatusTestTwoServers.cs | 4 +-
clicache/integration-test/ThinClientCqTest.cs | 4 +-
clicache/integration-test/ThinClientDeltaTest.cs | 17 +-
.../integration-test/ThinClientDeltaTestFailing.cs | 17 +-
.../integration-test/ThinClientHARegionTestsN.cs | 4 +-
.../integration-test/ThinClientPdxLocalTests.cs | 2 +-
clicache/integration-test/ThinClientPdxTests1.cs | 6 +-
clicache/integration-test/ThinClientQueryTestsN.cs | 4 +-
.../integration-test/ThinClientRegionQueryTests.cs | 4 +-
.../integration-test/ThinClientRegionTestsN.cs | 7 -
.../ThinClientRemoteParamQueryResultSetTests.cs | 4 +-
.../ThinClientRemoteParamQueryStructSetTests.cs | 4 +-
.../ThinClientRemoteQueryExclusivenessTests.cs | 4 +-
.../ThinClientRemoteQueryFailoverTests.cs | 4 +-
.../ThinClientRemoteQueryResultSetTests.cs | 4 +-
.../ThinClientRemoteQueryStructSetTests.cs | 4 +-
.../ThinClientSecurityAuthzTestsMUN.cs | 8 +-
.../ThinClientStringArrayTestsN.cs | 4 +-
clicache/integration-test2/GeodeServer.cs | 7 +-
clicache/integration-test2/SerializationTests.cs | 568 ++++++++++++++---
clicache/src/CMakeLists.txt | 2 +
clicache/src/Cache.hpp | 6 +-
clicache/src/CacheFactory.cpp | 2 +
clicache/src/DataInput.cpp | 2 +-
clicache/src/DataOutput.cpp | 3 +-
clicache/src/DistributedSystem.cpp | 4 +-
clicache/src/GeodeClassIds.hpp | 6 -
clicache/src/IAuthInitialize.hpp | 5 +-
clicache/src/IDataSerializable.hpp | 18 -
clicache/src/ManagedDataSerializableHandler.hpp | 146 +++++
clicache/src/ManagedPdxTypeHandler.hpp | 8 +-
clicache/src/TypeRegistry.cpp | 51 +-
clicache/src/TypeRegistry.hpp | 17 +-
clicache/src/impl/CacheListener.hpp | 2 +
clicache/src/impl/CacheWriter.hpp | 2 +
clicache/src/impl/CqListenerProxy.hpp | 2 +
clicache/src/impl/ManagedCacheableDelta.cpp | 15 -
clicache/src/impl/ManagedCacheableDelta.hpp | 5 -
clicache/src/impl/ManagedCacheableKey.cpp | 5 -
clicache/src/impl/ManagedCacheableKey.hpp | 12 +-
clicache/src/impl/PdxType.hpp | 6 +-
clicache/src/impl/ResultCollectorProxy.hpp | 3 +
clicache/src/impl/SafeConvert.hpp | 3 +-
clicache/test2/CMakeLists.txt | 1 +
cppcache/include/geode/DataOutput.hpp | 12 +-
cppcache/include/geode/DataSerializable.hpp | 10 +-
cppcache/include/geode/RegionAttributes.hpp | 2 -
cppcache/include/geode/TypeRegistry.hpp | 4 +-
cppcache/include/geode/internal/DSCode.hpp | 8 +-
.../geode/internal/DataSerializableInternal.hpp | 1 -
cppcache/integration-test-2/CMakeLists.txt | 15 +-
.../integration-test-2/DataSerializableTest.cpp | 156 +++++
cppcache/integration-test/CacheHelper.cpp | 15 +-
cppcache/integration-test/DeltaEx.hpp | 1 -
cppcache/integration-test/QueryHelper.hpp | 2 +-
cppcache/integration-test/ThinClientPutAll.hpp | 30 +-
.../ThinClientPutAllWithCallBack.hpp | 20 +-
cppcache/integration-test/ThinClientPutGetAll.hpp | 60 +-
.../integration-test/testPdxMetadataCheckTest.cpp | 626 ++++++++++---------
cppcache/integration-test/testSerialization.cpp | 31 +-
.../testThinClientCacheableStringArray.cpp | 8 +-
cppcache/integration-test/testThinClientCq.cpp | 676 +++++++++++----------
.../integration-test/testThinClientCqDelta.cpp | 8 +-
.../integration-test/testThinClientCqDurable.cpp | 14 +-
.../integration-test/testThinClientCqFailover.cpp | 15 +-
.../testThinClientCqHAFailover.cpp | 14 +-
cppcache/integration-test/testThinClientCqIR.cpp | 14 +-
.../testThinClientDeltaWithNotification.cpp | 4 +-
.../testThinClientHAQueryFailover.cpp | 6 +-
.../testThinClientListenerCallbackArgTest.cpp | 401 ++++++------
...ThinClientNotificationWithDeltaWithoutcache.cpp | 8 +-
.../testThinClientPdxDeltaWithNotification.cpp | 6 +-
.../integration-test/testThinClientPdxEnum.cpp | 3 +-
.../integration-test/testThinClientPdxInstance.cpp | 40 +-
.../integration-test/testThinClientPdxTests.cpp | 264 ++++----
.../testThinClientPutWithDelta.cpp | 4 +-
...ThinClientRegionQueryDifferentServerConfigs.cpp | 6 +-
.../testThinClientRegionQueryExclusiveness.cpp | 6 +-
.../testThinClientRemoteQueryFailover.cpp | 14 +-
.../testThinClientRemoteQueryFailoverPdx.cpp | 14 +-
.../testThinClientRemoteQueryRS.cpp | 12 +-
.../testThinClientRemoteQuerySS.cpp | 14 +-
.../testThinClientRemoteQueryTimeout.cpp | 14 +-
.../testThinClientRemoteRegionQuery.cpp | 17 +-
.../testThinClientSecurityCQAuthorizationMU.cpp | 6 +-
...tThinClientSecurityDurableCQAuthorizationMU.cpp | 8 +-
cppcache/src/BucketServerLocation.hpp | 14 +-
cppcache/src/CacheFactory.cpp | 16 +-
cppcache/src/CacheableToken.cpp | 6 -
cppcache/src/CacheableToken.hpp | 2 -
cppcache/src/DataOutput.cpp | 7 +-
cppcache/src/FixedPartitionAttributesImpl.hpp | 2 -
cppcache/src/GetAllServersResponse.cpp | 18 +-
cppcache/src/GetAllServersResponse.hpp | 6 +-
cppcache/src/PdxFieldType.hpp | 4 -
cppcache/src/PdxHelper.cpp | 5 +-
cppcache/src/PdxType.hpp | 2 -
cppcache/src/RegionAttributes.cpp | 14 +-
cppcache/src/SerializableHelper.hpp | 4 +-
cppcache/src/SerializationRegistry.cpp | 560 ++++++++++-------
cppcache/src/SerializationRegistry.hpp | 309 +++++-----
cppcache/src/ServerLocation.hpp | 2 -
cppcache/src/TcrMessage.cpp | 6 +-
cppcache/src/ThinClientLocatorHelper.cpp | 61 +-
cppcache/src/ThinClientLocatorHelper.hpp | 7 +-
cppcache/src/ThinClientPoolDM.cpp | 6 +-
cppcache/src/TypeRegistry.cpp | 13 +-
examples/cpp/dataserializable/Order.cpp | 5 -
examples/cpp/dataserializable/Order.hpp | 2 -
examples/cpp/dataserializable/main.cpp | 2 +-
examples/dotnet/DataSerializableCs/Order.cs | 79 ++-
examples/dotnet/DataSerializableCs/Program.cs | 2 +-
tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs | 4 +-
tests/cli/NewFwkLib/QueryTest/QueryTests.cs | 8 +-
tests/cli/NewTestObject/DeltaEx.cs | 153 +++--
tests/cli/NewTestObject/DeltaTestImpl.cs | 16 +-
tests/cli/NewTestObject/Portfolio.cs | 15 -
tests/cli/NewTestObject/PortfolioPdx.cs | 10 +-
tests/cli/NewTestObject/Position.cs | 8 -
tests/cli/NewTestObject/PositionPdx.cs | 11 -
tests/cli/NewTestObject/TestObject1.cs | 8 +-
tests/cli/PdxClassLibrary/VariousPdxTypes.cs | 5 -
tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp | 1 -
tests/cpp/testobject/BatchObject.hpp | 1 -
tests/cpp/testobject/DeltaFastAssetAccount.hpp | 2 -
tests/cpp/testobject/DeltaPSTObject.hpp | 1 -
tests/cpp/testobject/DeltaTestImpl.hpp | 2 -
tests/cpp/testobject/EqStruct.hpp | 1 -
tests/cpp/testobject/FastAsset.hpp | 1 -
tests/cpp/testobject/FastAssetAccount.hpp | 1 -
tests/cpp/testobject/PSTObject.hpp | 1 -
tests/cpp/testobject/Portfolio.hpp | 3 -
tests/cpp/testobject/Position.hpp | 1 -
tests/cpp/testobject/TestObject1.hpp | 2 -
tests/cpp/testobject/VariousPdxTypes.hpp | 7 -
145 files changed, 2911 insertions(+), 2265 deletions(-)
diff --git a/clicache/integration-test/DefaultCacheableN.cs b/clicache/integration-test/DefaultCacheableN.cs
index e9db647..bddd9d4 100644
--- a/clicache/integration-test/DefaultCacheableN.cs
+++ b/clicache/integration-test/DefaultCacheableN.cs
@@ -75,23 +75,13 @@ namespace Apache.Geode.Client.UnitTests
m_CacheableStringASCII = "asciistring";
m_cacheableStringArray = new string[] { "one", "two" };
-
- /*
- m_cacheableHashSet = CacheableHashSet.Create(2);
- m_cacheableHashSet.Add(CacheableString.Create("first"));
- m_cacheableHashSet.Add(CacheableString.Create("second"));
- * */
-
+
m_cacheableHashMap = new Dictionary<Object, Object>();
m_cacheableHashMap.Add("key-hm", "value-hm");
-
- //m_cacheableDate = DateTime.Now;
m_cacheableVector = new List<object>();
m_cacheableVector.Add("one-vec");
m_cacheableVector.Add("two-vec");
-
- //m_cacheableObject = new CustomSerializableObject();
}
}
@@ -125,25 +115,11 @@ namespace Apache.Geode.Client.UnitTests
get { return m_cacheableStringArray; }
}
- /*
- public CacheableHashSet CHashSet
- {
- get { return m_cacheableHashSet; }
- }
- * */
-
public IDictionary<object, object> CHashMap
{
get { return m_cacheableHashMap; }
}
- /*
- public DateTime CDate
- {
- get { return m_cacheableDate; }
- }
- * */
-
public IList<object> CVector
{
get { return m_cacheableVector; }
@@ -156,29 +132,8 @@ namespace Apache.Geode.Client.UnitTests
#region IDataSerializable Members
- public Int32 ClassId
- {
- get { return 0x04; }
- }
-
public void FromData(DataInput input)
{
- if (!m_initialized)
- {
- /*
- m_cacheableBoolean = (CacheableBoolean)CacheableBoolean.CreateDeserializable();
- m_cacheableInt32 = (CacheableInt32)CacheableInt32.CreateDeserializable();
- m_cacheableInt32Array = (CacheableInt32Array)CacheableInt32Array.CreateDeserializable();
- // m_cacheableFileName = (CacheableFileName)CacheableFileName.CreateDeserializable();
- //m_CacheableStringASCII = (CacheableString)CacheableString.CreateDeserializable();
- m_cacheableStringArray = (CacheableStringArray)CacheableStringArray.CreateDeserializable();
- m_cacheableHashSet = (CacheableHashSet)CacheableHashSet.CreateDeserializable();
- m_cacheableHashMap = (CacheableHashMap)CacheableHashMap.CreateDeserializable();
- m_cacheableDate = (CacheableDate)CacheableDate.CreateDeserializable();
- m_cacheableVector = (CacheableVector)CacheableVector.CreateDeserializable();
- m_cacheableObject = (CacheableObject)CacheableObject.CreateDeserializable();
- * */
- }
m_cacheableBoolean = input.ReadBoolean();
m_cacheableInt32 = input.ReadInt32();
@@ -188,8 +143,6 @@ namespace Apache.Geode.Client.UnitTests
{
m_cacheableInt32Array[item] = input.ReadInt32();
}
- //m_cacheableFileName.FromData(input);
- //m_CacheableStringASCII.FromData(input);
m_cacheableFileName = input.ReadUTF();
m_CacheableStringASCII = input.ReadUTF();
arraylen = input.ReadArrayLen();
@@ -198,11 +151,8 @@ namespace Apache.Geode.Client.UnitTests
{
m_cacheableStringArray[item] = input.ReadUTF();
}
- //m_cacheableHashSet.FromData(input);
m_cacheableHashMap = new Dictionary<Object, Object>();
input.ReadDictionary((System.Collections.IDictionary)m_cacheableHashMap);
- //m_cacheableHashMap = input.ReadDictionary();
- //m_cacheableDate = input.ReadDate();
arraylen = input.ReadArrayLen();
m_cacheableVector = new object[arraylen];
for (int item = 0; item < arraylen; item++)
@@ -227,8 +177,6 @@ namespace Apache.Geode.Client.UnitTests
{
output.WriteInt32(item);
}
- //m_cacheableFileName.ToData(output);
- //m_CacheableStringASCII.ToData(output);
output.WriteUTF(m_cacheableFileName);
output.WriteUTF(m_CacheableStringASCII);
output.WriteArrayLen(m_cacheableStringArray.Length);
@@ -236,15 +184,12 @@ namespace Apache.Geode.Client.UnitTests
{
output.WriteUTF(item);
}
- //m_cacheableHashSet.ToData(output);
output.WriteDictionary((System.Collections.IDictionary)m_cacheableHashMap);
- //output.WriteDate(m_cacheableDate);
output.WriteArrayLen(m_cacheableVector.Count);
foreach (object item in m_cacheableVector)
{
output.WriteObject(item);
}
- //output.WriteObject(m_cacheableObject);
}
}
diff --git a/clicache/integration-test/PutGetTestsN.cs b/clicache/integration-test/PutGetTestsN.cs
index 5b1b3a4..bb6add6 100644
--- a/clicache/integration-test/PutGetTestsN.cs
+++ b/clicache/integration-test/PutGetTestsN.cs
@@ -347,10 +347,6 @@ namespace Apache.Geode.Client.UnitTests
else
Util.Log("DoGetsVerify value is not null ");
uint cksum = m_cKeys[keyIndex].GetChecksum();
- //Util.Log("DoGetsVerify key clasid " + m_region[(KeyChecksumPrefix + keyIndex).ClassId]);
- //Util.Log("DoGetsVerify key clasid " + m_region[(KeyChecksumPrefix + keyIndex).ClassId]);
- //Util.Log("DoGetsVerify key type " + m_region.Get(KeyChecksumPrefix + keyIndex).GetType().ToString());
- //CacheableInt32 putCksum = m_region[KeyChecksumPrefix + keyIndex] as CacheableInt32;
Util.Log("DoGetsVerify key type " + m_region[KeyChecksumPrefix + keyIndex].GetType().ToString());
int putCksum = (int)m_region[KeyChecksumPrefix + keyIndex];
Assert.IsNotNull(putCksum,
diff --git a/clicache/integration-test/RegionFailingTests.cs b/clicache/integration-test/RegionFailingTests.cs
index 54ad644..da05188 100644
--- a/clicache/integration-test/RegionFailingTests.cs
+++ b/clicache/integration-test/RegionFailingTests.cs
@@ -293,7 +293,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable, 0);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/SerializationTestsN.cs b/clicache/integration-test/SerializationTestsN.cs
index f2a876b..84f5b64 100644
--- a/clicache/integration-test/SerializationTestsN.cs
+++ b/clicache/integration-test/SerializationTestsN.cs
@@ -90,33 +90,33 @@ namespace Apache.Geode.Client.UnitTests
public void CreateRegionForOT(string locators)
{
+ Util.LogFile = "mikesLog.log";
+ CacheHelper.SetLogging();
+
CacheHelper.CreateTCRegion2<object, object>(RegionNames[0], true, false,
null, locators, false);
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType22.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType4.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType2.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType42.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType43.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable, 0);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType22.CreateDeserializable, 0x8C0);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType4.CreateDeserializable, 0x8FC0);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType2.CreateDeserializable, 0x8C);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType42.CreateDeserializable, 0x6F3F97);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType43.CreateDeserializable, 0x7FFFFFFF);
}
public void DoNPuts(int n)
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable, 0);
Assert.Fail("Expected exception in registering the type again.");
}
- catch (IllegalStateException ex)
+ catch (IllegalArgumentException ex)
{
Util.Log("Got expected exception in RegisterType: {0}", ex);
}
IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
for (int i = 0; i < n; i++)
{
- //CacheableInt32 key = new CacheableInt32(i);
- //region.Put(key, key);
-
int key = i;
region[key] = key;
}
@@ -126,10 +126,10 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(OtherType.CreateDeserializable, 0);
Assert.Fail("Expected exception in registering the type again.");
}
- catch (IllegalStateException ex)
+ catch (IllegalArgumentException ex)
{
Util.Log("Got expected exception in RegisterType: {0}", ex);
}
@@ -491,14 +491,6 @@ namespace Apache.Geode.Client.UnitTests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x0;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
@@ -627,14 +619,6 @@ namespace Apache.Geode.Client.UnitTests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x8C;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
@@ -765,14 +749,6 @@ namespace Apache.Geode.Client.UnitTests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x8C0;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
@@ -902,14 +878,6 @@ namespace Apache.Geode.Client.UnitTests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x8FC0;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
@@ -1040,14 +1008,6 @@ namespace Apache.Geode.Client.UnitTests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x6F3F97;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
@@ -1178,14 +1138,6 @@ namespace Apache.Geode.Client.UnitTests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x7FFFFFFF;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
diff --git a/clicache/integration-test/ThinClientAppDomainQueryTests.cs b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
index 46c453a..ed58d28 100644
--- a/clicache/integration-test/ThinClientAppDomainQueryTests.cs
+++ b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
@@ -64,8 +64,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientCallbackArgN.cs b/clicache/integration-test/ThinClientCallbackArgN.cs
index ec3aef5..c3205fe 100644
--- a/clicache/integration-test/ThinClientCallbackArgN.cs
+++ b/clicache/integration-test/ThinClientCallbackArgN.cs
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
using System;
using System.Threading;
@@ -248,8 +248,8 @@ namespace Apache.Geode.Client.UnitTests
GIRegion region = null;
region = CacheHelper.CreateTCRegion_Pool<int, object>(RegionName, true, caching,
callbackLis, locators, "__TESTPOOL1_", true);
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
public void ValidateLocalListenerWriterData()
@@ -454,7 +454,7 @@ namespace Apache.Geode.Client.UnitTests
{
if (!isRegistered)
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DefaultType.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DefaultType.CreateDeserializable, 4);
isRegistered = true;
}
}
diff --git a/clicache/integration-test/ThinClientCqAttributesMutatorTests.cs b/clicache/integration-test/ThinClientCqAttributesMutatorTests.cs
index b2ad64c..bf76011 100644
--- a/clicache/integration-test/ThinClientCqAttributesMutatorTests.cs
+++ b/clicache/integration-test/ThinClientCqAttributesMutatorTests.cs
@@ -258,8 +258,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientCqIRTestsN.cs b/clicache/integration-test/ThinClientCqIRTestsN.cs
index 5e17906..048a044 100644
--- a/clicache/integration-test/ThinClientCqIRTestsN.cs
+++ b/clicache/integration-test/ThinClientCqIRTestsN.cs
@@ -73,8 +73,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientCqPdxTest.cs b/clicache/integration-test/ThinClientCqPdxTest.cs
index 985d1db..16a7d00 100644
--- a/clicache/integration-test/ThinClientCqPdxTest.cs
+++ b/clicache/integration-test/ThinClientCqPdxTest.cs
@@ -297,8 +297,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientCqStatusTest.cs b/clicache/integration-test/ThinClientCqStatusTest.cs
index a7c6c2d..b30ba5b 100644
--- a/clicache/integration-test/ThinClientCqStatusTest.cs
+++ b/clicache/integration-test/ThinClientCqStatusTest.cs
@@ -297,8 +297,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 3);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 2);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientCqStatusTestTwoServers.cs b/clicache/integration-test/ThinClientCqStatusTestTwoServers.cs
index 0831535..45b9b0b 100644
--- a/clicache/integration-test/ThinClientCqStatusTestTwoServers.cs
+++ b/clicache/integration-test/ThinClientCqStatusTestTwoServers.cs
@@ -298,8 +298,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 3);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 2);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientCqTest.cs b/clicache/integration-test/ThinClientCqTest.cs
index 2c066c9..c328ed1 100644
--- a/clicache/integration-test/ThinClientCqTest.cs
+++ b/clicache/integration-test/ThinClientCqTest.cs
@@ -296,8 +296,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientDeltaTest.cs b/clicache/integration-test/ThinClientDeltaTest.cs
index 012c8e6..8816f6f 100644
--- a/clicache/integration-test/ThinClientDeltaTest.cs
+++ b/clicache/integration-test/ThinClientDeltaTest.cs
@@ -120,11 +120,6 @@ namespace Apache.Geode.Client.UnitTests
#region IDataSerializable Members
- public int ClassId
- {
- get { return 151; }
- }
-
public void FromData(DataInput input)
{
_deltaUpdate = input.ReadInt32();
@@ -221,7 +216,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -256,7 +251,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -304,7 +299,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -337,7 +332,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestAD.Create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestAD.Create, 151);
}
catch (IllegalStateException)
{
@@ -461,7 +456,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -478,7 +473,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestImpl.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestImpl.CreateDeserializable, 0x1E);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientDeltaTestFailing.cs b/clicache/integration-test/ThinClientDeltaTestFailing.cs
index e800c84..f940105 100644
--- a/clicache/integration-test/ThinClientDeltaTestFailing.cs
+++ b/clicache/integration-test/ThinClientDeltaTestFailing.cs
@@ -122,11 +122,6 @@ namespace Apache.Geode.Client.UnitTests
#region IDataSerializable Members
- public int ClassId
- {
- get { return 151; }
- }
-
public void FromData(DataInput input)
{
_deltaUpdate = input.ReadInt32();
@@ -217,7 +212,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -261,7 +256,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -294,7 +289,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -327,7 +322,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestAD.Create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestAD.Create, 151);
}
catch (IllegalStateException)
{
@@ -417,7 +412,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1);
}
catch (IllegalStateException)
{
@@ -434,7 +429,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestImpl.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(DeltaTestImpl.CreateDeserializable, 0x1E);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientHARegionTestsN.cs b/clicache/integration-test/ThinClientHARegionTestsN.cs
index 5192349..87be756 100644
--- a/clicache/integration-test/ThinClientHARegionTestsN.cs
+++ b/clicache/integration-test/ThinClientHARegionTestsN.cs
@@ -641,8 +641,8 @@ namespace Apache.Geode.Client.UnitTests
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test/ThinClientPdxLocalTests.cs b/clicache/integration-test/ThinClientPdxLocalTests.cs
index f675155..1d14dc1 100644
--- a/clicache/integration-test/ThinClientPdxLocalTests.cs
+++ b/clicache/integration-test/ThinClientPdxLocalTests.cs
@@ -98,7 +98,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable, 5005);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(NestedPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes1.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes2.CreateDeserializable);
diff --git a/clicache/integration-test/ThinClientPdxTests1.cs b/clicache/integration-test/ThinClientPdxTests1.cs
index 9f95028..5982b55 100755
--- a/clicache/integration-test/ThinClientPdxTests1.cs
+++ b/clicache/integration-test/ThinClientPdxTests1.cs
@@ -530,7 +530,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable, 5005);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(NestedPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes1.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes2.CreateDeserializable);
@@ -558,7 +558,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable, 5005);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(NestedPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes1.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes2.CreateDeserializable);
@@ -769,7 +769,7 @@ namespace Apache.Geode.Client.UnitTests
{
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(PdxInsideIGeodeSerializable.CreateDeserializable, 5005);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(NestedPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes1.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTypes2.CreateDeserializable);
diff --git a/clicache/integration-test/ThinClientQueryTestsN.cs b/clicache/integration-test/ThinClientQueryTestsN.cs
index d5fa0a8..d4edc35 100644
--- a/clicache/integration-test/ThinClientQueryTestsN.cs
+++ b/clicache/integration-test/ThinClientQueryTestsN.cs
@@ -80,8 +80,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRegionQueryTests.cs b/clicache/integration-test/ThinClientRegionQueryTests.cs
index 6b47752..5a9341c 100644
--- a/clicache/integration-test/ThinClientRegionQueryTests.cs
+++ b/clicache/integration-test/ThinClientRegionQueryTests.cs
@@ -79,8 +79,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRegionTestsN.cs b/clicache/integration-test/ThinClientRegionTestsN.cs
index 0faf4cd..86590c4 100644
--- a/clicache/integration-test/ThinClientRegionTestsN.cs
+++ b/clicache/integration-test/ThinClientRegionTestsN.cs
@@ -240,13 +240,6 @@ namespace Apache.Geode.Client.UnitTests
output.WriteInt32(MAccountid);
}
- public Int32 ClassId
- {
- get
- {
- return 0x04;
- }
- }
public ulong ObjectSize
{
diff --git a/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs b/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs
index 4b1c860..5e976c3 100644
--- a/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs
+++ b/clicache/integration-test/ThinClientRemoteParamQueryResultSetTests.cs
@@ -79,8 +79,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs b/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs
index 8435777..41a70c6 100644
--- a/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs
+++ b/clicache/integration-test/ThinClientRemoteParamQueryStructSetTests.cs
@@ -79,8 +79,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs b/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs
index 2add876..1da9635 100644
--- a/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs
+++ b/clicache/integration-test/ThinClientRemoteQueryExclusivenessTests.cs
@@ -78,8 +78,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs b/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs
index 2ae797e2..58c8485 100644
--- a/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs
+++ b/clicache/integration-test/ThinClientRemoteQueryFailoverTests.cs
@@ -79,8 +79,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs b/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs
index d87cabb..fa6297f 100644
--- a/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs
+++ b/clicache/integration-test/ThinClientRemoteQueryResultSetTests.cs
@@ -80,8 +80,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs b/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs
index 61a5d8d..7a7fdcd 100644
--- a/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs
+++ b/clicache/integration-test/ThinClientRemoteQueryStructSetTests.cs
@@ -80,8 +80,8 @@ namespace Apache.Geode.Client.UnitTests
public void InitClient()
{
CacheHelper.Init();
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
CacheHelper.DCache.TypeRegistry.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
}
diff --git a/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs b/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs
index 0dc2863..4ab7d21 100644
--- a/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs
+++ b/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs
@@ -238,8 +238,8 @@ namespace Apache.Geode.Client.UnitTests
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
Util.Log("registerCQ portfolio registered");
}
catch (IllegalStateException)
@@ -267,8 +267,8 @@ namespace Apache.Geode.Client.UnitTests
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
Util.Log("doCQPut portfolio registered");
}
catch (IllegalStateException)
diff --git a/clicache/integration-test/ThinClientStringArrayTestsN.cs b/clicache/integration-test/ThinClientStringArrayTestsN.cs
index f4251ea..02dd6b0 100644
--- a/clicache/integration-test/ThinClientStringArrayTestsN.cs
+++ b/clicache/integration-test/ThinClientStringArrayTestsN.cs
@@ -72,8 +72,8 @@ namespace Apache.Geode.Client.UnitTests
CacheHelper.Init();
try
{
- CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
- CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
+ CacheHelper.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
}
catch (IllegalStateException)
{
diff --git a/clicache/integration-test2/GeodeServer.cs b/clicache/integration-test2/GeodeServer.cs
index 877378a..59d597e 100644
--- a/clicache/integration-test2/GeodeServer.cs
+++ b/clicache/integration-test2/GeodeServer.cs
@@ -77,11 +77,8 @@ public class GeodeServer : IDisposable
StartInfo =
{
FileName = Config.GeodeGfsh,
- Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort +
- " --J=-Dgemfire.jmx-manager-port=" + locatorJmxPort + " --http-service-port=0\"" +
- " -e \"connect --locator=localhost[" + LocatorPort + "]\"" +
- " -e \"configure pdx " + readSerializedStr + "\"" +
- " -e \"start server --bind-address=localhost --server-port=0 --log-level=all --classpath=" + Config.JavaobjectJarPath + "\"" +
+ Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort + "\"" +
+ " -e \"start server --bind-address=localhost --server-port=0\"" +
" -e \"create region --name=" + regionName + " --type=PARTITION\"" +
" -e \"create region --name=testRegion1 --type=PARTITION\"",
WindowStyle = ProcessWindowStyle.Hidden,
diff --git a/clicache/integration-test2/SerializationTests.cs b/clicache/integration-test2/SerializationTests.cs
index 59281ee..9ece2bc 100644
--- a/clicache/integration-test2/SerializationTests.cs
+++ b/clicache/integration-test2/SerializationTests.cs
@@ -24,108 +24,516 @@ using System.Collections.Generic;
namespace Apache.Geode.Client.IntegrationTests
{
+ public class Order : IDataSerializable
+ {
+ public int OrderId { get; set; }
+ public string Name { get; set; }
+ public short Quantity { get; set; }
- [Trait("Category", "Integration")]
+ // A default constructor is required for deserialization
+ public Order() { }
+
+ public Order(int orderId, string name, short quantity)
+ {
+ OrderId = orderId;
+ Name = name;
+ Quantity = quantity;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(OrderId);
+ output.WriteUTF(Name);
+ output.WriteInt16(Quantity);
+ }
+
+ public void FromData(DataInput input)
+ {
+ OrderId = input.ReadInt32();
+ Name = input.ReadUTF();
+ Quantity = input.ReadInt16();
+ }
+
+ public ulong ObjectSize
+ {
+ get { return 0; }
+ }
+
+ public static ISerializable CreateDeserializable()
+ {
+ return new Order();
+ }
+
+ }
+
+ public struct CData
+ {
+ #region Private members
+
+ private Int32 m_first;
+ private Int64 m_second;
+
+ #endregion
+
+ #region Public accessors
+
+ public Int32 First
+ {
+ get
+ {
+ return m_first;
+ }
+ set
+ {
+ m_first = value;
+ }
+ }
+
+ public Int64 Second
+ {
+ get
+ {
+ return m_second;
+ }
+ set
+ {
+ m_second = value;
+ }
+ }
+
+ #endregion
+
+ public CData(Int32 first, Int64 second)
+ {
+ m_first = first;
+ m_second = second;
+ }
+
+ public static bool operator ==(CData obj1, CData obj2)
+ {
+ return ((obj1.m_first == obj2.m_first) && (obj1.m_second == obj2.m_second));
+ }
+
+ public static bool operator !=(CData obj1, CData obj2)
+ {
+ return ((obj1.m_first != obj2.m_first) || (obj1.m_second != obj2.m_second));
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is CData)
+ {
+ CData otherObj = (CData)obj;
+ return ((m_first == otherObj.m_first) && (m_second == otherObj.m_second));
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return m_first.GetHashCode() ^ m_second.GetHashCode();
+ }
+ };
+ public class OtherType : IDataSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ #region IDataSerializable Members
+
+ public void FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt64 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ #endregion
+
+ public static ISerializable CreateDeserializable()
+ {
+ return new OtherType();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType ot = obj as OtherType;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+ }
+
+ public class OtherType2 : IDataSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType2()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType2(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType2(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+ #region IDataSerializable Members
+
+ public void FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt64 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ #endregion
+
+ public static ISerializable CreateDeserializable()
+ {
+ return new OtherType2();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType2 ot = obj as OtherType2;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+ }
+
+ [Trait("Category", "Integration")]
public class SerializationTests : IDisposable
{
- private GeodeServer GeodeServer;
- private CacheXml CacheXml;
- private Cache Cache;
+ private GeodeServer GeodeServer;
+ private CacheXml CacheXml;
+ private Cache Cache;
- public SerializationTests()
- {
- GeodeServer = new GeodeServer();
- CacheXml = new CacheXml(new FileInfo("cache.xml"), GeodeServer);
+ public SerializationTests()
+ {
+ GeodeServer = new GeodeServer();
+ }
- var cacheFactory = new CacheFactory();
- Cache = cacheFactory.Create();
- Cache.InitializeDeclarativeCache(CacheXml.File.FullName);
+ public void Dispose()
+ {
+ try
+ {
+ if (null != Cache)
+ {
+ Cache.Close();
+ }
}
-
- public void Dispose()
+ finally
{
- try
+ try
+ {
+ if (null != CacheXml)
{
- if (null != Cache)
- {
- Cache.Close();
- }
- }
- finally
- {
- try
- {
- if (null != CacheXml)
- {
- CacheXml.Dispose();
- }
- }
- finally
- {
- GeodeServer.Dispose();
- }
+ CacheXml.Dispose();
}
+ }
+ finally
+ {
+ GeodeServer.Dispose();
+ }
}
+ }
private void putAndCheck(IRegion<object, object> region, object key, object value)
{
- region[key] = value;
- Assert.Equal(value, region[key]);
+ region[key] = value;
+ var retrievedValue = region[key];
+ Assert.Equal(value, retrievedValue);
}
+
[Fact]
public void BuiltInSerializableTypes()
{
- var region = Cache.GetRegion<object, object>("testRegion");
- Assert.NotNull(region);
-
- putAndCheck(region, "CacheableString", "foo");
- putAndCheck(region, "CacheableByte", (Byte)8);
- putAndCheck(region, "CacheableInt16", (Int16)16);
- putAndCheck(region, "CacheableInt32", (Int32)32);
- putAndCheck(region, "CacheableInt64", (Int64)64);
- putAndCheck(region, "CacheableBoolean", (Boolean)true);
- putAndCheck(region, "CacheableCharacter", 'c');
- putAndCheck(region, "CacheableDouble", (Double)1.5);
- putAndCheck(region, "CacheableFloat", (float)2.5);
-
- putAndCheck(region, "CacheableStringArray", new String[] { "foo", "bar" });
- putAndCheck(region, "CacheableBytes", new Byte[] { 8, 8 });
- putAndCheck(region, "CacheableInt16Array", new Int16[] { 16, 16 });
- putAndCheck(region, "CacheableInt32Array", new Int32[] { 32, 32 });
- putAndCheck(region, "CacheableInt64Array", new Int64[] { 64, 64 });
- putAndCheck(region, "CacheableBooleanArray", new Boolean[] { true, false });
- putAndCheck(region, "CacheableCharacterArray", new Char[] { 'c', 'a' });
- putAndCheck(region, "CacheableDoubleArray", new Double[] { 1.5, 1.7 });
- putAndCheck(region, "CacheableFloatArray", new float[] { 2.5F, 2.7F });
-
- putAndCheck(region, "CacheableDate", new DateTime());
-
- putAndCheck(region, "CacheableHashMap", new Dictionary<int, string>() { { 1, "one" }, { 2, "two" } });
- putAndCheck(region, "CacheableHashTable", new Hashtable() { { 1, "one" }, { 2, "two" } });
- putAndCheck(region, "CacheableVector", new ArrayList() { "one", "two" });
- putAndCheck(region, "CacheableArrayList", new List<string>() { "one", "two" });
- putAndCheck(region, "CacheableLinkedList", new LinkedList<object>(new string[] { "one", "two" }));
- putAndCheck(region, "CacheableStack", new Stack<object>(new string[] { "one", "two" }));
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
- {
- var cacheableHashSet = new CacheableHashSet();
- cacheableHashSet.Add("one");
- cacheableHashSet.Add("two");
- putAndCheck(region, "CacheableHashSet", cacheableHashSet);
- }
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", GeodeServer.LocatorPort);
+ poolFactory.Create("pool");
- {
- var cacheableLinkedHashSet = new CacheableLinkedHashSet();
- cacheableLinkedHashSet.Add("one");
- cacheableLinkedHashSet.Add("two");
- putAndCheck(region, "CacheableLinkedHashSet", cacheableLinkedHashSet);
- }
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var region = regionFactory.Create<object, object>("testRegion");
+ Assert.NotNull(region);
+
+ putAndCheck(region, "CacheableString", "foo");
+ putAndCheck(region, "CacheableByte", (Byte)8);
+ putAndCheck(region, "CacheableInt16", (Int16)16);
+ putAndCheck(region, "CacheableInt32", (Int32)32);
+ putAndCheck(region, "CacheableInt64", (Int64)64);
+ putAndCheck(region, "CacheableBoolean", (Boolean)true);
+ putAndCheck(region, "CacheableCharacter", 'c');
+ putAndCheck(region, "CacheableDouble", (Double)1.5);
+ putAndCheck(region, "CacheableFloat", (float)2.5);
+
+ putAndCheck(region, "CacheableStringArray", new String[] { "foo", "bar" });
+ putAndCheck(region, "CacheableBytes", new Byte[] { 8, 8 });
+ putAndCheck(region, "CacheableInt16Array", new Int16[] { 16, 16 });
+ putAndCheck(region, "CacheableInt32Array", new Int32[] { 32, 32 });
+ putAndCheck(region, "CacheableInt64Array", new Int64[] { 64, 64 });
+ putAndCheck(region, "CacheableBooleanArray", new Boolean[] { true, false });
+ putAndCheck(region, "CacheableCharacterArray", new Char[] { 'c', 'a' });
+ putAndCheck(region, "CacheableDoubleArray", new Double[] { 1.5, 1.7 });
+ putAndCheck(region, "CacheableFloatArray", new float[] { 2.5F, 2.7F });
+
+ putAndCheck(region, "CacheableDate", new DateTime());
+
+ putAndCheck(region, "CacheableHashMap", new Dictionary<int, string>() { { 1, "one" }, { 2, "two" } });
+ putAndCheck(region, "CacheableHashTable", new Hashtable() { { 1, "one" }, { 2, "two" } });
+ putAndCheck(region, "CacheableVector", new ArrayList() { "one", "two" });
+ putAndCheck(region, "CacheableArrayList", new List<string>() { "one", "two" });
+ putAndCheck(region, "CacheableLinkedList", new LinkedList<object>(new string[] { "one", "two" }));
+ putAndCheck(region, "CacheableStack", new Stack<object>(new string[] { "one", "two" }));
+
+ {
+ var cacheableHashSet = new CacheableHashSet();
+ cacheableHashSet.Add("one");
+ cacheableHashSet.Add("two");
+ putAndCheck(region, "CacheableHashSet", cacheableHashSet);
+ }
+
+ {
+ var cacheableLinkedHashSet = new CacheableLinkedHashSet();
+ cacheableLinkedHashSet.Add("one");
+ cacheableLinkedHashSet.Add("two");
+ putAndCheck(region, "CacheableLinkedHashSet", cacheableLinkedHashSet);
+ }
- Cache.TypeRegistry.RegisterPdxType(PdxType.CreateDeserializable);
- putAndCheck(region, "PdxType", new PdxType());
+ cache.TypeRegistry.RegisterPdxType(PdxType.CreateDeserializable);
+ putAndCheck(region, "PdxType", new PdxType());
}
+
+ [Fact]
+ public void PutGetCustomSerializableTypes()
+ {
+ var cacheFactory = new CacheFactory()
+ .Set("log-level", "none");
+ var cache = cacheFactory.Create();
+
+ Console.WriteLine("Registering for data serialization");
+
+ cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 0x42);
+
+ var poolFactory = cache.GetPoolFactory()
+ .AddLocator("localhost", GeodeServer.LocatorPort);
+ poolFactory.Create("pool");
+
+ var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetPoolName("pool");
+ var orderRegion = regionFactory.Create<int, Order>("testRegion");
+ Assert.NotNull(orderRegion);
+
+ const int orderKey = 65;
+ var order = new Order(orderKey, "Donuts", 12);
+
+ orderRegion.Put(orderKey, order, null);
+ var orderRetrieved = orderRegion.Get(orderKey, null);
+ Assert.Equal(order.ToString(), orderRetrieved.ToString());
+
+ cache.Close();
}
+ }
-}
\ No newline at end of file
+}
diff --git a/clicache/src/CMakeLists.txt b/clicache/src/CMakeLists.txt
index 756dbba..6b73f89 100644
--- a/clicache/src/CMakeLists.txt
+++ b/clicache/src/CMakeLists.txt
@@ -146,6 +146,7 @@ add_library(${PROJECT_NAME} SHARED
LocalRegion.hpp
Log.cpp
Log.hpp
+ ManagedDataSerializableHandler.hpp
ManagedPdxTypeHandler.hpp
native_conditional_shared_ptr.hpp
native_conditional_unique_ptr.hpp
@@ -355,6 +356,7 @@ add_dependencies(client-libraries ${PROJECT_NAME})
add_subdirectory(templates)
+
# For Visual Studio organization
source_group("Configure In Files" FILES ${CONFIGURE_IN_FILES})
source_group("Configure Out Files" FILES ${CONFIGURE_OUT_FILES})
diff --git a/clicache/src/Cache.hpp b/clicache/src/Cache.hpp
index 1835101..d45d10d 100644
--- a/clicache/src/Cache.hpp
+++ b/clicache/src/Cache.hpp
@@ -298,7 +298,11 @@ namespace Apache
{
return m_pdxTypeRegistry;
}
-
+
+ Apache::Geode::Client::TypeRegistry^ GetTypeRegistry()
+ {
+ return m_typeRegistry;
+ }
private:
/// <summary>
diff --git a/clicache/src/CacheFactory.cpp b/clicache/src/CacheFactory.cpp
index 6e00569..5e718e9 100644
--- a/clicache/src/CacheFactory.cpp
+++ b/clicache/src/CacheFactory.cpp
@@ -30,6 +30,7 @@
#include "impl/CacheResolver.hpp"
#include "impl/ManagedAuthInitialize.hpp"
#include "ManagedPdxTypeHandler.hpp"
+#include "ManagedDataSerializableHandler.hpp"
using namespace System;
@@ -76,6 +77,7 @@ namespace Apache
DistributedSystem::registerCliCallback();
auto&& cacheImpl = CacheRegionHelper::getCacheImpl(nativeCache.get());
cacheImpl->getSerializationRegistry()->setPdxTypeHandler(new ManagedPdxTypeHandler());
+ cacheImpl->getSerializationRegistry()->setDataSerializableHandler(new ManagedDataSerializableHandler());
return cache;
_GF_MG_EXCEPTION_CATCH_ALL2
diff --git a/clicache/src/DataInput.cpp b/clicache/src/DataInput.cpp
index cc72252..5419baa 100644
--- a/clicache/src/DataInput.cpp
+++ b/clicache/src/DataInput.cpp
@@ -726,7 +726,7 @@ namespace Apache
}
else
{
- createType = m_cache->TypeRegistry->GetManagedDelegateGeneric(compId);
+ createType = m_cache->TypeRegistry->GetManagedObjectFactory(compId);
if (createType == nullptr)
{
Object^ retVal = ReadDotNetTypes(typeId);
diff --git a/clicache/src/DataOutput.cpp b/clicache/src/DataOutput.cpp
index 6b2a5b6..846ff4e 100644
--- a/clicache/src/DataOutput.cpp
+++ b/clicache/src/DataOutput.cpp
@@ -719,7 +719,8 @@ namespace Apache
}
else if (auto dataSerializable = dynamic_cast<IDataSerializable^>(obj))
{
- auto id = dataSerializable->ClassId;
+ auto id = m_cache->TypeRegistry->GetIdForManagedType(dataSerializable->GetType());
+
auto dsCode = getDataSerializableDsCode(id);
WriteByte(static_cast<int8_t>(dsCode));
switch (dsCode) {
diff --git a/clicache/src/DistributedSystem.cpp b/clicache/src/DistributedSystem.cpp
index 2c42947..42335fa 100644
--- a/clicache/src/DistributedSystem.cpp
+++ b/clicache/src/DistributedSystem.cpp
@@ -165,7 +165,7 @@ namespace Apache
{
// Registers overrides in the C++ layer to incercept deserialization into managed layer.
- auto&& typeRegistry = cache->TypeRegistry;
+ auto typeRegistry = cache->TypeRegistry;
typeRegistry->RegisterDataSerializablePrimitiveOverrideNativeDeserialization(
static_cast<int8_t>(native::internal::DSCode::CacheableBytes),
@@ -295,7 +295,7 @@ namespace Apache
void DistributedSystem::RegisterDataSerializableFixedIdsOverrideNativeDeserialization(Cache^ cache)
{
- auto&& typeRegistry = cache->TypeRegistry;
+ auto typeRegistry = cache->TypeRegistry;
typeRegistry->RegisterDataSerializableFixedIdTypeOverrideNativeDeserialization(
static_cast<int8_t>(native::DSFid::EnumInfo),
diff --git a/clicache/src/GeodeClassIds.hpp b/clicache/src/GeodeClassIds.hpp
index 8d5acb0..f28b031 100644
--- a/clicache/src/GeodeClassIds.hpp
+++ b/clicache/src/GeodeClassIds.hpp
@@ -55,12 +55,6 @@ namespace Apache
static_cast<System::UInt32>(apache::geode::client::internal::DSCode::BooleanArray) + 0x80000000;
/// <summary>
- /// ClassId of <c>RegionAttributes</c> class
- /// </summary>
- literal System::UInt32 RegionAttributes =
- static_cast<System::UInt32>(apache::geode::client::internal::DSCode::RegionAttributes) + 0x80000000;
-
- /// <summary>
/// ClassId of <c>CacheableUndefined</c> class
/// Implementation note: this has DSFID of FixedIDByte hence a
/// different increment.
diff --git a/clicache/src/IAuthInitialize.hpp b/clicache/src/IAuthInitialize.hpp
index e057303..947c590 100644
--- a/clicache/src/IAuthInitialize.hpp
+++ b/clicache/src/IAuthInitialize.hpp
@@ -20,7 +20,7 @@
#include "geode_defs.hpp"
-#include "Properties.hpp"
+//#include "Properties.hpp"
using namespace System;
@@ -31,6 +31,9 @@ namespace Apache
namespace Client
{
+ generic<class TPropKey, class TPropValue>
+ ref class Properties;
+
/// <summary>
/// Specifies the mechanism to obtain credentials for a client.
/// It is mandantory for clients when the server is running in secure
diff --git a/clicache/src/IDataSerializable.hpp b/clicache/src/IDataSerializable.hpp
index 2abc59a..56ed0fc 100644
--- a/clicache/src/IDataSerializable.hpp
+++ b/clicache/src/IDataSerializable.hpp
@@ -57,24 +57,6 @@ namespace Apache
/// </param>
/// <returns>the deserialized object</returns>
void FromData( DataInput^ input );
-
- /// <summary>
- /// Returns the classId of the instance being serialized.
- /// This is used by deserialization to determine what instance
- /// type to create and deserialize into.
- /// </summary>
- /// <remarks>
- /// The classId must be unique within an application suite
- /// and in the range 0 to ((2^31)-1) both inclusive. An application can
- /// thus define upto 2^31 custom <c>ISerializable</c> classes.
- /// Returning a value greater than ((2^31)-1) may result in undefined
- /// behaviour.
- /// </remarks>
- /// <returns>the classId</returns>
- property Int32 ClassId
- {
- Int32 get( );
- }
};
} // namespace Client
diff --git a/clicache/src/ManagedDataSerializableHandler.hpp b/clicache/src/ManagedDataSerializableHandler.hpp
new file mode 100644
index 0000000..01cfc38
--- /dev/null
+++ b/clicache/src/ManagedDataSerializableHandler.hpp
@@ -0,0 +1,146 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#pragma once
+
+#include "begin_native.hpp"
+#include <SerializationRegistry.hpp>
+#include "end_native.hpp"
+
+#include "impl/CacheResolver.hpp"
+#include "impl/ManagedCacheableKey.hpp"
+#include "impl/SafeConvert.hpp"
+
+namespace apache {
+ namespace geode {
+ namespace client {
+ namespace Managed = Apache::Geode::Client;
+
+ /**
+ * Intercept (de)serialization of DataSerializable types into the .NET managed layer.
+ */
+ class ManagedDataSerializableHandler : public DataSerializableHandler
+ {
+ public:
+ ~ManagedDataSerializableHandler() noexcept override = default;
+
+ void serialize(const std::shared_ptr<DataSerializable>& dataSerializable,
+ DataOutput& dataOutput, bool isDelta) const override
+ {
+ Managed::ISerializable^ data = Managed::SafeUMSerializableConvertGeneric(dataSerializable);
+ auto cache = CacheResolver::Lookup(dataOutput.getCache());
+
+ int32_t objectID = cache->GetTypeRegistry()->GetIdForManagedType(data->GetType());
+
+ auto dsCode = SerializationRegistry::getSerializableDataDsCode(objectID);
+
+ dataOutput.write(static_cast<int8_t>(dsCode));
+ switch (dsCode) {
+ case DSCode::CacheableUserData:
+ dataOutput.write(static_cast<int8_t>(objectID));
+ break;
+ case DSCode::CacheableUserData2:
+ dataOutput.writeInt(static_cast<int16_t>(objectID));
+ break;
+ case DSCode::CacheableUserData4:
+ dataOutput.writeInt(static_cast<int32_t>(objectID));
+ break;
+ default:
+ IllegalStateException("Invalid DS Code.");
+ }
+
+ if (isDelta) {
+ const Delta* ptr = dynamic_cast<const Delta*>(dataSerializable.get());
+ ptr->toDelta(dataOutput);
+ }
+ else {
+ dataSerializable->toData(dataOutput);
+ }
+ }
+
+ std::shared_ptr<DataSerializable> deserialize(DataInput& dataInput, DSCode typeId) const override
+ {
+ try
+ {
+ int32_t classId = -1;
+
+ switch (typeId) {
+ case DSCode::CacheableUserData: {
+ classId = dataInput.read();
+ break;
+ }
+ case DSCode::CacheableUserData2: {
+ classId = dataInput.readInt16();
+ break;
+ }
+ case DSCode::CacheableUserData4: {
+ classId = dataInput.readInt32();
+ break;
+ }
+ default:
+ break;
+ }
+
+ auto cache = CacheResolver::Lookup(dataInput.getCache());
+ auto createType = cache->GetTypeRegistry()->GetManagedObjectFactory(classId);
+
+ if (createType == nullptr) {
+ LOGERROR(
+ "Unregistered class ID %d during deserialization: Did the "
+ "application register serialization types?",
+ classId);
+
+ // instead of a null key or null value... an Exception should be thrown..
+ throw IllegalStateException("Unregistered class ID in deserialization");
+ }
+
+ auto managedDataSerializable = (Apache::Geode::Client::IDataSerializable^) createType();
+ auto nativeDataSerializable = std::shared_ptr<DataSerializable>(
+ dynamic_cast<DataSerializable*>(GetNativeWrapperForManagedIDataSerializable(managedDataSerializable)));
+ nativeDataSerializable->fromData(dataInput);
+
+ return nativeDataSerializable;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex)
+ {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+
+ return nullptr;
+ }
+ inline DSCode getSerializableDataDsCode(int32_t classId) {
+ if (classId <= std::numeric_limits<int8_t>::max() &&
+ classId >= std::numeric_limits<int8_t>::min()) {
+ return DSCode::CacheableUserData;
+ } else if (classId <= std::numeric_limits<int16_t>::max() &&
+ classId >= std::numeric_limits<int16_t>::min()) {
+ return DSCode::CacheableUserData2;
+ } else {
+ return DSCode::CacheableUserData4;
+ }
+ }
+
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
diff --git a/clicache/src/ManagedPdxTypeHandler.hpp b/clicache/src/ManagedPdxTypeHandler.hpp
index 5fc46d7..e3cd50f 100644
--- a/clicache/src/ManagedPdxTypeHandler.hpp
+++ b/clicache/src/ManagedPdxTypeHandler.hpp
@@ -45,10 +45,10 @@ namespace apache {
{
try
{
- auto&& cache = CacheResolver::Lookup(dataOutput.getCache());
+ auto cache = CacheResolver::Lookup(dataOutput.getCache());
Managed::DataOutput managedDataOutput(&dataOutput, true, cache);
- auto&& managedPdx = wrappedPdxSerializable->ptr();
+ auto managedPdx = wrappedPdxSerializable->ptr();
Managed::Internal::PdxHelper::SerializePdx(%managedDataOutput, managedPdx);
managedDataOutput.WriteBytesToUMDataOutput();
@@ -72,11 +72,11 @@ namespace apache {
{
try
{
- auto&& cache = CacheResolver::Lookup(dataInput.getCache());
+ auto cache = CacheResolver::Lookup(dataInput.getCache());
Managed::DataInput managedDataInput(&dataInput, true, cache);
- auto&& serializationRegistry = CacheRegionHelper::getCacheImpl(dataInput.getCache())->getSerializationRegistry().get();
+ auto serializationRegistry = CacheRegionHelper::getCacheImpl(dataInput.getCache())->getSerializationRegistry().get();
auto managedPdx = Apache::Geode::Client::Internal::PdxHelper::DeserializePdx(%managedDataInput, false, serializationRegistry);
dataInput.advanceCursor(managedDataInput.BytesReadInternally);
diff --git a/clicache/src/TypeRegistry.cpp b/clicache/src/TypeRegistry.cpp
index c47eeb6..f23311a 100644
--- a/clicache/src/TypeRegistry.cpp
+++ b/clicache/src/TypeRegistry.cpp
@@ -173,49 +173,36 @@ namespace Apache
return retVal();
}
- void TypeRegistry::RegisterType(TypeFactoryMethod^ creationMethod)
+ void TypeRegistry::RegisterType(TypeFactoryMethod^ creationMethod, int32_t id)
{
if (creationMethod == nullptr) {
throw gcnew IllegalArgumentException("Serializable.RegisterType(): "
"null TypeFactoryMethod delegate passed");
}
- //--------------------------------------------------------------
-
- int32_t classId;
-
//adding user type as well in global builtin hashmap
auto obj = creationMethod();
- if (auto dataSerializable = dynamic_cast<IDataSerializable^>(obj))
- {
- classId = dataSerializable->ClassId;
- } else
- {
+ auto dataSerializable = dynamic_cast<IDataSerializable^>(obj);
+ if (nullptr == dataSerializable) {
throw gcnew IllegalArgumentException("Unknown serialization type.");
}
- if (!ManagedDelegatesGeneric->ContainsKey(classId))
+ if (!ObjectIDDelegatesMap->ContainsKey(id))
{
- ManagedDelegatesGeneric->Add(classId, creationMethod);
+ ObjectIDDelegatesMap->Add(id, creationMethod);
+ }
+ else
+ {
+ throw gcnew IllegalArgumentException("A class with given ID is already registered");
+ }
+
+ if (!ObjectTypeIDMap->ContainsKey(dataSerializable->GetType()))
+ {
+ ObjectTypeIDMap->Add(dataSerializable->GetType(), id);
}
-
- auto delegateObj = gcnew DelegateWrapperGeneric(creationMethod);
- auto nativeDelegate = gcnew TypeFactoryNativeMethodGeneric(delegateObj,
- &DelegateWrapperGeneric::NativeDelegateGeneric);
-
- // this is avoid object being Gced
- NativeDelegatesGeneric->Add(nativeDelegate);
-
// register the type in the DelegateMap, this is pure c# for create domain object
- Log::Fine("Registering serializable class ID " + classId);
- DelegateMapGeneric[classId] = creationMethod;
-
- _GF_MG_EXCEPTION_TRY2
- auto&& nativeTypeRegistry = CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry();
- auto nativeDelegateFunction = static_cast<std::shared_ptr<native::Serializable>(*)()>(
- System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(nativeDelegate).ToPointer());
- nativeTypeRegistry->addType(nativeDelegateFunction);
- _GF_MG_EXCEPTION_CATCH_ALL2
+ Log::Fine("Registering serializable class ID " + id);
+ DelegateMapGeneric[id] = creationMethod;
}
void TypeRegistry::RegisterDataSerializablePrimitiveOverrideNativeDeserialization(
@@ -240,7 +227,7 @@ namespace Apache
auto&& serializationRegistry = CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry();
auto nativeDelegateFunction = static_cast<std::shared_ptr<native::Serializable>(*)()>(
System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(nativeDelegate).ToPointer());
- serializationRegistry->addType(dsCode, nativeDelegateFunction);
+ serializationRegistry->setDataSerializablePrimitiveType(nativeDelegateFunction, static_cast<DSCode>(dsCode));
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -263,7 +250,7 @@ namespace Apache
auto&& serializationRegistry = CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry();
auto nativeDelegateFunction = static_cast<std::shared_ptr<native::Serializable>(*)()>(
System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(nativeDelegate).ToPointer());
- serializationRegistry->addType2(fixedId, nativeDelegateFunction);
+ serializationRegistry->addDataSerializableFixedIdType(fixedId, nativeDelegateFunction);
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -272,7 +259,7 @@ namespace Apache
DsCodeToDataSerializablePrimitiveNativeDelegate->Remove(typeId);
_GF_MG_EXCEPTION_TRY2
- CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry()->removeType(typeId);
+ CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry()->removeDataSerializableType(typeId);
_GF_MG_EXCEPTION_CATCH_ALL2
}
diff --git a/clicache/src/TypeRegistry.hpp b/clicache/src/TypeRegistry.hpp
index 7729c27..6ebd02e 100644
--- a/clicache/src/TypeRegistry.hpp
+++ b/clicache/src/TypeRegistry.hpp
@@ -121,7 +121,7 @@ namespace Apache
/// in registering the type; check <c>Utils::LastError</c> for more
/// information in the latter case.
/// </exception>
- void RegisterType(TypeFactoryMethod^ creationMethod);
+ void RegisterType(TypeFactoryMethod^ creationMethod, int32_t id);
internal:
void RegisterDataSerializablePrimitiveOverrideNativeDeserialization(
@@ -140,10 +140,16 @@ namespace Apache
/// <summary>
/// This is to get manged delegates.
/// </summary>
- TypeFactoryMethod^ GetManagedDelegateGeneric(System::Int64 typeId)
+ TypeFactoryMethod^ GetManagedObjectFactory(System::Int64 typeId)
{
TypeFactoryMethod^ ret = nullptr;
- ManagedDelegatesGeneric->TryGetValue(typeId, ret);
+ ObjectIDDelegatesMap->TryGetValue(typeId, ret);
+ return ret;
+ }
+ System::Int32 GetIdForManagedType(System::Type^ type)
+ {
+ System::Int32 ret;
+ ObjectTypeIDMap->TryGetValue(type, ret);
return ret;
}
@@ -223,13 +229,16 @@ namespace Apache
Dictionary<String^, PdxTypeFactoryMethod^>^ PdxDelegateMap =
gcnew Dictionary<String^, PdxTypeFactoryMethod^>();
- Dictionary<System::Int64, TypeFactoryMethod^>^ ManagedDelegatesGeneric =
+ Dictionary<System::Int64, TypeFactoryMethod^>^ ObjectIDDelegatesMap =
gcnew Dictionary<System::Int64, TypeFactoryMethod^>();
List<TypeFactoryNativeMethodGeneric^>^ NativeDelegatesGeneric =
gcnew List<TypeFactoryNativeMethodGeneric^>();
Dictionary<UInt32, TypeFactoryMethod^>^ DelegateMapGeneric =
gcnew Dictionary<UInt32, TypeFactoryMethod^>();
+ Dictionary<System::Type^, System::Int32>^ ObjectTypeIDMap =
+ gcnew Dictionary<System::Type^, System::Int32>();
+
Dictionary<Byte, TypeFactoryMethod^>^ DsCodeToDataSerializablePrimitiveTypeFactoryMethod =
gcnew Dictionary<Byte, TypeFactoryMethod^>();
diff --git a/clicache/src/impl/CacheListener.hpp b/clicache/src/impl/CacheListener.hpp
index 2c8a7da..4fdd62f 100644
--- a/clicache/src/impl/CacheListener.hpp
+++ b/clicache/src/impl/CacheListener.hpp
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#pragma once
+
#include "../ICacheListener.hpp"
#include "../CacheListenerAdapter.hpp"
#include "../ICacheListener.hpp"
diff --git a/clicache/src/impl/CacheWriter.hpp b/clicache/src/impl/CacheWriter.hpp
index 0f19279..8d130c3 100644
--- a/clicache/src/impl/CacheWriter.hpp
+++ b/clicache/src/impl/CacheWriter.hpp
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#pragma once
+
//#include "../../../ICacheWriter.hpp"
#include "../CacheWriterAdapter.hpp"
#include "../ICacheWriter.hpp"
diff --git a/clicache/src/impl/CqListenerProxy.hpp b/clicache/src/impl/CqListenerProxy.hpp
index 85dfd27..efda4dc 100644
--- a/clicache/src/impl/CqListenerProxy.hpp
+++ b/clicache/src/impl/CqListenerProxy.hpp
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#pragma once
+
//#include "../../../ICqListener.hpp"
//#include "../../../CqListener.hpp"
#include "../ICqListener.hpp"
diff --git a/clicache/src/impl/ManagedCacheableDelta.cpp b/clicache/src/impl/ManagedCacheableDelta.cpp
index 42b9d09..0739d8f 100644
--- a/clicache/src/impl/ManagedCacheableDelta.cpp
+++ b/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -98,21 +98,6 @@ namespace apache
return 0;
}
- int32_t ManagedCacheableDeltaGeneric::getClassId() const
- {
- try {
- return m_managedSerializableptr->ClassId;
- }
- catch (Apache::Geode::Client::GeodeException^ ex) {
- ex->ThrowNative();
- }
- catch (System::Exception^ ex) {
- Apache::Geode::Client::GeodeException::ThrowNative(ex);
- }
-
- throw std::exception("unreachable");
- }
-
bool ManagedCacheableDeltaGeneric::hasDelta() const
{
return m_managedptr->HasDelta();
diff --git a/clicache/src/impl/ManagedCacheableDelta.hpp b/clicache/src/impl/ManagedCacheableDelta.hpp
index fd109cd..fb7b193 100644
--- a/clicache/src/impl/ManagedCacheableDelta.hpp
+++ b/clicache/src/impl/ManagedCacheableDelta.hpp
@@ -56,7 +56,6 @@ namespace apache
: Delta(), m_managedptr(managedptr)
{
m_managedSerializableptr = dynamic_cast<Apache::Geode::Client::IDataSerializable^>(managedptr);
- m_classId = m_managedSerializableptr->ClassId;
m_objectSize = 0;
}
@@ -65,7 +64,6 @@ namespace apache
: Delta(), m_managedptr(managedptr)
{
m_hashcode = hashcode;
- m_classId = classId;
m_managedSerializableptr = dynamic_cast<Apache::Geode::Client::IDataSerializable^> (managedptr);
m_objectSize = 0;
}
@@ -76,8 +74,6 @@ namespace apache
void fromData(apache::geode::client::DataInput& input) override;
- int32_t getClassId() const override;
-
void toDelta(apache::geode::client::DataOutput& output) const override;
void fromDelta(apache::geode::client::DataInput& input) override;
@@ -102,7 +98,6 @@ namespace apache
private:
int m_hashcode;
- int m_classId;
size_t m_objectSize;
/// <summary>
diff --git a/clicache/src/impl/ManagedCacheableKey.cpp b/clicache/src/impl/ManagedCacheableKey.cpp
index dc36cea..4165769 100644
--- a/clicache/src/impl/ManagedCacheableKey.cpp
+++ b/clicache/src/impl/ManagedCacheableKey.cpp
@@ -97,11 +97,6 @@ namespace apache
return 0;
}
- int32_t ManagedCacheableKeyGeneric::getClassId() const
- {
- return m_classId;
- }
-
std::string ManagedCacheableKeyGeneric::toString() const
{
try {
diff --git a/clicache/src/impl/ManagedCacheableKey.hpp b/clicache/src/impl/ManagedCacheableKey.hpp
index e9f212c..491c22a 100644
--- a/clicache/src/impl/ManagedCacheableKey.hpp
+++ b/clicache/src/impl/ManagedCacheableKey.hpp
@@ -60,16 +60,15 @@ namespace apache
{
private:
int m_hashcode;
- int m_classId;
size_t m_objectSize;
public:
inline ManagedCacheableKeyGeneric(
- Apache::Geode::Client::IDataSerializable^ managedptr, int hashcode, int classId)
+ Apache::Geode::Client::IDataSerializable^ managedptr, int hashcode)
: m_managedptr(managedptr) {
m_hashcode = hashcode;
- m_classId = classId;
m_objectSize = 0;
+ msclr::interop::marshal_context context;
}
/// <summary>
/// Constructor to initialize with the provided managed object.
@@ -80,8 +79,8 @@ namespace apache
inline ManagedCacheableKeyGeneric(Apache::Geode::Client::IDataSerializable^ managedptr)
: m_managedptr(managedptr) {
m_hashcode = 0;
- m_classId = managedptr->ClassId;
m_objectSize = 0;
+ msclr::interop::marshal_context context;
}
ManagedCacheableKeyGeneric(const ManagedCacheableKeyGeneric&) = delete;
@@ -95,8 +94,6 @@ namespace apache
void fromData(apache::geode::client::DataInput& input) override;
- int32_t getClassId() const override;
-
bool operator == (const CacheableKey& other) const override;
virtual bool operator == (const ManagedCacheableKeyGeneric& other) const;
@@ -109,6 +106,7 @@ namespace apache
}
+
private:
/// <summary>
@@ -178,8 +176,6 @@ namespace apache
void fromData(DataInput& input) override;
- int8_t getInternalId() const override { return 0; }
-
inline Apache::Geode::Client::IDataSerializableInternal^ ptr() const
{
return m_managedptr;
diff --git a/clicache/src/impl/PdxType.hpp b/clicache/src/impl/PdxType.hpp
index 864f3de..90c6854 100644
--- a/clicache/src/impl/PdxType.hpp
+++ b/clicache/src/impl/PdxType.hpp
@@ -130,11 +130,7 @@ namespace Apache
Int32 get() { return m_geodeTypeId; }
void set(Int32 value) { m_geodeTypeId = value; }
}
- /* property Type^ PdxDomainType
- {
- Type^ get() {return m_pdxDomainType;}
- void set(Type^ type) {m_pdxDomainType = type;}
- }*/
+
property String^ PdxClassName
{
String^ get() { return m_className; }
diff --git a/clicache/src/impl/ResultCollectorProxy.hpp b/clicache/src/impl/ResultCollectorProxy.hpp
index e27e817..64adad7 100644
--- a/clicache/src/impl/ResultCollectorProxy.hpp
+++ b/clicache/src/impl/ResultCollectorProxy.hpp
@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#pragma once
+
//#include "../../../geode_includes.hpp"
//#include "../../../IResultCollector.hpp"
//#include "../../../ResultCollector.hpp"
diff --git a/clicache/src/impl/SafeConvert.hpp b/clicache/src/impl/SafeConvert.hpp
index 73acc85..a52d221 100644
--- a/clicache/src/impl/SafeConvert.hpp
+++ b/clicache/src/impl/SafeConvert.hpp
@@ -103,7 +103,7 @@ namespace Apache
}
else
{
- return new native::ManagedCacheableKeyGeneric(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
+ return new native::ManagedCacheableKeyGeneric(mg_obj, mg_obj->GetHashCode());
}
}
@@ -190,7 +190,6 @@ namespace Apache
{
if (mg_obj == nullptr) return NULL;
//for cacheables types
- //return new native::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
{
return new native::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
}
diff --git a/clicache/test2/CMakeLists.txt b/clicache/test2/CMakeLists.txt
index b45423c..75dec76 100644
--- a/clicache/test2/CMakeLists.txt
+++ b/clicache/test2/CMakeLists.txt
@@ -23,6 +23,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packages.config ${CMAKE_CURRENT_BINAR
add_library( ${PROJECT_NAME} SHARED
Tests2.cs
xunit.runner.json
+ packages.config
)
set_source_files_properties(cache.xml xunit.runner.json geode.properties PROPERTIES
diff --git a/cppcache/include/geode/DataOutput.hpp b/cppcache/include/geode/DataOutput.hpp
index 520a131..0c072e2 100644
--- a/cppcache/include/geode/DataOutput.hpp
+++ b/cppcache/include/geode/DataOutput.hpp
@@ -357,14 +357,6 @@ class APACHE_GEODE_EXPORT DataOutput {
}
/**
- * Write a <code>Serializable</code> object to the <code>DataOutput</code>.
- *
- * @param objptr pointer to the <code>Serializable</code> object
- * to be written
- */
- void writeObject(const Serializable* objptr) { writeObjectInternal(objptr); }
-
- /**
* Get an internal pointer to the current location in the
* <code>DataOutput</code> byte array.
*/
@@ -516,8 +508,8 @@ class APACHE_GEODE_EXPORT DataOutput {
virtual const SerializationRegistry& getSerializationRegistry() const;
private:
- void writeObjectInternal(const Serializable* ptr, bool isDelta = false);
- void writeObjectInternal(const std::shared_ptr<Serializable>& ptr, bool isDelta = false);
+ void writeObjectInternal(const std::shared_ptr<Serializable>& ptr,
+ bool isDelta = false);
static void acquireLock();
static void releaseLock();
diff --git a/cppcache/include/geode/DataSerializable.hpp b/cppcache/include/geode/DataSerializable.hpp
index 74caa95..3e39d0e 100644
--- a/cppcache/include/geode/DataSerializable.hpp
+++ b/cppcache/include/geode/DataSerializable.hpp
@@ -17,6 +17,9 @@
#pragma once
+#include <typeinfo>
+#include <typeindex>
+
#ifndef GEODE_DATASERIALIZABLE_H_
#define GEODE_DATASERIALIZABLE_H_
@@ -48,14 +51,13 @@ class APACHE_GEODE_EXPORT DataSerializable : public virtual Serializable {
virtual void fromData(DataInput& dataInput) = 0;
/**
- * @brief Return the classId of the instance being serialized.
+ * @brief Return the std::type_info of the instance being serialized.
* This is used by deserialization to determine what instance
* type to create and deserialize into.
*
- * The classId must be unique within an application suite.
- * Using a negative value may result in undefined behavior.
+ * The type must be unique within an application suite.
*/
- virtual int32_t getClassId() const = 0;
+ const std::type_info& getType() const { return typeid(*this); }
};
} // namespace client
diff --git a/cppcache/include/geode/RegionAttributes.hpp b/cppcache/include/geode/RegionAttributes.hpp
index 481f9e9..12241c0 100644
--- a/cppcache/include/geode/RegionAttributes.hpp
+++ b/cppcache/include/geode/RegionAttributes.hpp
@@ -206,8 +206,6 @@ class APACHE_GEODE_EXPORT RegionAttributes
void fromData(DataInput& in) override;
- int8_t getInternalId() const override;
-
/**
* This method returns the path of the library from which
* the factory function will be invoked on a cache server.
diff --git a/cppcache/include/geode/TypeRegistry.hpp b/cppcache/include/geode/TypeRegistry.hpp
index 30817e5..48ca614 100644
--- a/cppcache/include/geode/TypeRegistry.hpp
+++ b/cppcache/include/geode/TypeRegistry.hpp
@@ -44,7 +44,7 @@ class APACHE_GEODE_EXPORT TypeRegistry {
* registered, or there is an error in registering the type; check errno
* for more information in the latter case.
*/
- void registerType(TypeFactoryMethod creationFunction);
+ void registerType(TypeFactoryMethod creationFunction, int32_t id);
/**
* @brief register an Pdx instance factory method for a given type.
@@ -61,6 +61,8 @@ class APACHE_GEODE_EXPORT TypeRegistry {
*/
void registerPdxSerializer(std::shared_ptr<PdxSerializer> pdxSerializer);
+ TypeFactoryMethod getCreationFunction(int32_t);
+
std::shared_ptr<PdxSerializer> getPdxSerializer();
private:
diff --git a/cppcache/include/geode/internal/DSCode.hpp b/cppcache/include/geode/internal/DSCode.hpp
index aa9ef9a..3c9abdf 100644
--- a/cppcache/include/geode/internal/DSCode.hpp
+++ b/cppcache/include/geode/internal/DSCode.hpp
@@ -31,12 +31,10 @@ enum class DSCode : int32_t {
FixedIDShort = 2,
CacheableLinkedList = 10,
Properties = 11,
- CacheableToken = 14, // because there's no equivalence in java
PdxType = 17, // internal hack to read pdxtype in c# layer, look usuage in
- // TcrMessage and C# DistributedM.cpp
- BooleanArray = 26,
+ // TcrMessage and C# DistributedM.cpp
+ BooleanArray = 26,
CharArray = 27,
- RegionAttributes = 30, // because there's no equivalence in java
NullObj = 41,
CacheableString = 42,
Class = 43,
@@ -89,4 +87,4 @@ enum class DSCode : int32_t {
} // namespace geode
} // namespace apache
-#endif //NATIVECLIENT_DSCODE_H
+#endif // NATIVECLIENT_DSCODE_H
diff --git a/cppcache/include/geode/internal/DataSerializableInternal.hpp b/cppcache/include/geode/internal/DataSerializableInternal.hpp
index 949249d..b617dc4 100644
--- a/cppcache/include/geode/internal/DataSerializableInternal.hpp
+++ b/cppcache/include/geode/internal/DataSerializableInternal.hpp
@@ -37,7 +37,6 @@ class APACHE_GEODE_EXPORT DataSerializableInternal
~DataSerializableInternal() override = default;
virtual void toData(DataOutput& dataOutput) const = 0;
virtual void fromData(DataInput& dataInput) = 0;
- virtual int8_t getInternalId() const = 0;
};
} // namespace internal
diff --git a/cppcache/integration-test-2/CMakeLists.txt b/cppcache/integration-test-2/CMakeLists.txt
index 8e0233c..9916ff7 100644
--- a/cppcache/integration-test-2/CMakeLists.txt
+++ b/cppcache/integration-test-2/CMakeLists.txt
@@ -30,7 +30,8 @@ add_executable(integration-test-2
RegisterKeysTest.cpp
StructTest.cpp
EnableChunkHandlerThreadTest.cpp
- )
+ DataSerializableTest.cpp
+)
target_compile_definitions(integration-test-2
PUBLIC
@@ -40,7 +41,7 @@ target_compile_definitions(integration-test-2
target_include_directories(integration-test-2
PUBLIC
- ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(integration-test-2
@@ -54,9 +55,9 @@ target_link_libraries(integration-test-2
Boost::system
Boost::log
Boost::filesystem
- PRIVATE
+ PRIVATE
_WarningsAsError
- internal
+ internal
)
if(WIN32)
@@ -68,10 +69,12 @@ if(WIN32)
foreach (_target apache-geode testobject)
add_custom_command(TARGET integration-test-2 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "$<TARGET_FILE:${_target}>" "$<TARGET_FILE_DIR:integration-test-2>")
+ "$<TARGET_FILE:${_target}>"
+ "$<$<CONFIG:Debug>:$<TARGET_PDB_FILE:${_target}>>"
+ "$<TARGET_FILE_DIR:integration-test-2>")
endforeach()
endif()
enable_testing()
include(GoogleTest)
-gtest_discover_tests(integration-test-2)
+gtest_discover_tests(integration-test-2)
\ No newline at end of file
diff --git a/cppcache/integration-test-2/DataSerializableTest.cpp b/cppcache/integration-test-2/DataSerializableTest.cpp
new file mode 100644
index 0000000..a2deae4
--- /dev/null
+++ b/cppcache/integration-test-2/DataSerializableTest.cpp
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <geode/DataSerializable.hpp>
+#include <geode/RegionShortcut.hpp>
+#include <geode/DataInput.hpp>
+#include <geode/DataOutput.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/TypeRegistry.hpp>
+
+#include "framework/Cluster.h"
+
+namespace {
+
+using namespace apache::geode::client;
+
+class Simple : public DataSerializable {
+ public:
+ inline Simple() : Simple("TestSimple", 30) {}
+
+ inline Simple(std::string name, int age)
+ : name_(std::move(name)), age_(age) {}
+
+ ~Simple() noexcept override = default;
+
+ using DataSerializable::fromData;
+ using DataSerializable::toData;
+
+ void fromData(DataInput& dataInput) override {
+ name_ = dataInput.readString();
+ age_ = dataInput.readInt32();
+ }
+
+ void toData(DataOutput& dataOutput) const override {
+ dataOutput.writeString(name_);
+ dataOutput.writeInt(age_);
+ }
+
+ static std::shared_ptr<DataSerializable> createDeserializable() {
+ return std::make_shared<Simple>();
+ }
+
+ std::string getName() { return name_; }
+ int getAge() { return age_; }
+
+ private:
+ std::string name_;
+ int age_;
+};
+
+class DataSerializableObject : public DataSerializable {
+ public:
+ inline DataSerializableObject()
+ : DataSerializableObject("TestDataSerializableObject", nullptr, nullptr) {
+ }
+
+ inline DataSerializableObject(std::string name,
+ std::shared_ptr<CacheableStringArray> csArray,
+ std::shared_ptr<Simple> simple)
+ : name_(std::move(name)), csArray_(csArray), simple_(simple) {}
+
+ ~DataSerializableObject() noexcept override = default;
+
+ using DataSerializable::fromData;
+ using DataSerializable::toData;
+
+ void fromData(DataInput& dataInput) override {
+ name_ = dataInput.readString();
+ csArray_ =
+ std::dynamic_pointer_cast<CacheableStringArray>(dataInput.readObject());
+
+ simple_ = std::dynamic_pointer_cast<Simple>(dataInput.readObject());
+ }
+
+ void toData(DataOutput& dataOutput) const override {
+ dataOutput.writeString(name_);
+ dataOutput.writeObject(csArray_);
+ dataOutput.writeObject(simple_);
+ }
+
+ static std::shared_ptr<DataSerializable> createDeserializable() {
+ return std::make_shared<DataSerializableObject>();
+ }
+
+ std::string getName() { return name_; }
+ std::shared_ptr<CacheableStringArray> getCSArray() { return csArray_; }
+ std::shared_ptr<Simple> getSimple() { return simple_; }
+
+ private:
+ std::string name_;
+ std::shared_ptr<CacheableStringArray> csArray_;
+ std::shared_ptr<Simple> simple_;
+};
+
+TEST(DataSerializableTest, isSerializableAndDeserializable) {
+ Cluster cluster{LocatorCount{1}, ServerCount{1}};
+ cluster.getGfsh()
+ .create()
+ .region()
+ .withName("region")
+ .withType("PARTITION")
+ .execute();
+
+ auto cache = cluster.createCache();
+ auto region = cache.createRegionFactory(RegionShortcut::PROXY)
+ .setPoolName("default")
+ .create("region");
+
+ std::vector<std::shared_ptr<CacheableString>> cstr{
+ CacheableString::create("Taaa"), CacheableString::create("Tbbb"),
+ CacheableString::create("Tccc"), CacheableString::create("Tddd")};
+ auto cacheStrArray = CacheableStringArray::create(cstr);
+
+ auto dsObject = std::make_shared<DataSerializableObject>(
+ "name", cacheStrArray, std::make_shared<Simple>("simple", 10));
+
+ cache.getTypeRegistry().registerType(
+ DataSerializableObject::createDeserializable, 77);
+ cache.getTypeRegistry().registerType(Simple::createDeserializable, 78);
+
+ region->put("objectOne", dsObject);
+
+ auto returnedObject = std::dynamic_pointer_cast<DataSerializableObject>(
+ region->get("objectOne"));
+
+ ASSERT_NE(nullptr, returnedObject);
+ EXPECT_EQ(dsObject->getName(), returnedObject->getName());
+ EXPECT_EQ(dsObject->getSimple()->getName(), returnedObject->getSimple()->getName());
+ EXPECT_EQ(dsObject->getSimple()->getAge(), returnedObject->getSimple()->getAge());
+ auto originalArray = dsObject->getCSArray();
+ auto returnedArray = returnedObject->getCSArray();
+ for(uint32_t index = 0; index < 4; ++index)
+ {
+ EXPECT_EQ(originalArray->operator[](index)->toString(), returnedArray->operator[](index)->toString());
+ }
+
+}
+} // namespace
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index 3bbf75f..c52787d 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -181,17 +181,10 @@ CacheHelper::CacheHelper(const bool,
if (pp == nullptr) {
pp = Properties::create();
}
- try {
- LOG(" in cachehelper before createCacheFactory");
- auto cacheFactory = CacheFactory(pp);
- cachePtr = std::make_shared<Cache>(cacheFactory.create());
- m_doDisconnect = false;
- } catch (const Exception& excp) {
- LOG("Geode exception while creating cache, logged in following line");
- LOG(excp.what());
- } catch (...) {
- LOG("Throwing exception while creating cache....");
- }
+ LOG(" in cachehelper before createCacheFactory");
+ auto cacheFactory = CacheFactory(pp);
+ cachePtr = std::make_shared<Cache>(cacheFactory.create());
+ m_doDisconnect = false;
}
CacheHelper::CacheHelper(const bool, bool pdxIgnoreUnreadFields,
diff --git a/cppcache/integration-test/DeltaEx.hpp b/cppcache/integration-test/DeltaEx.hpp
index ebcd2a8..3533d89 100644
--- a/cppcache/integration-test/DeltaEx.hpp
+++ b/cppcache/integration-test/DeltaEx.hpp
@@ -79,7 +79,6 @@ class DeltaEx : public DataSerializable, public Delta {
counter = input.readInt32();
fromDataCount++;
}
- virtual int32_t getClassId() const override { return 1; }
std::shared_ptr<Delta> clone() const override {
cloneCount++;
return std::make_shared<DeltaEx>(*this);
diff --git a/cppcache/integration-test/QueryHelper.hpp b/cppcache/integration-test/QueryHelper.hpp
index ce4920b..01d17d3 100644
--- a/cppcache/integration-test/QueryHelper.hpp
+++ b/cppcache/integration-test/QueryHelper.hpp
@@ -273,7 +273,7 @@ void QueryHelper::populatePDXObject(std::shared_ptr<Region>& rptr) {
// Register PdxType Object
auto cacheImpl = CacheRegionHelper::getCacheImpl(&rptr->getCache());
- cacheImpl->getSerializationRegistry()->addPdxType(
+ cacheImpl->getSerializationRegistry()->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
diff --git a/cppcache/integration-test/ThinClientPutAll.hpp b/cppcache/integration-test/ThinClientPutAll.hpp
index 32c3c9c..07ec729 100644
--- a/cppcache/integration-test/ThinClientPutAll.hpp
+++ b/cppcache/integration-test/ThinClientPutAll.hpp
@@ -389,11 +389,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::PdxTypes1::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::PdxTypes2::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::Address::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxType::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxTypes3::createDeserializable);
} catch (Exception e) {
LOG("Got expected Exception for Serialization, already registered");
}
@@ -429,11 +434,16 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::PdxTypes1::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::PdxTypes2::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::Address::createDeserializable);
- serializationRegistry->addPdxType(PdxTests::PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxType::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::PdxTypes3::createDeserializable);
} catch (Exception e) {
LOG("Got expected Exception for Serialization, already registered");
}
diff --git a/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp b/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
index b9171b5..629eccc 100644
--- a/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
+++ b/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
@@ -390,15 +390,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterClient1Keys)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::Address::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes3::createDeserializable);
} catch (Exception e) {
LOG("Got expected Exception for Serialization, already registered");
@@ -435,15 +435,15 @@ DUNIT_TASK_DEFINITION(CLIENT2, RegisterClient2Keys)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::Address::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes3::createDeserializable);
} catch (Exception e) {
LOG("Got expected Exception for Serialization, already registered");
diff --git a/cppcache/integration-test/ThinClientPutGetAll.hpp b/cppcache/integration-test/ThinClientPutGetAll.hpp
index f4066d4..6ce7452 100644
--- a/cppcache/integration-test/ThinClientPutGetAll.hpp
+++ b/cppcache/integration-test/ThinClientPutGetAll.hpp
@@ -235,58 +235,68 @@ DUNIT_TASK_DEFINITION(CLIENT1, putallAndGetallPdxWithCallBackArg)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes9::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes9::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes10::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes10::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -412,58 +422,68 @@ DUNIT_TASK_DEFINITION(CLIENT1, putallAndGetallPdx)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes9::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes9::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes10::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes10::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testPdxMetadataCheckTest.cpp b/cppcache/integration-test/testPdxMetadataCheckTest.cpp
index f69a5ff..d95d724 100644
--- a/cppcache/integration-test/testPdxMetadataCheckTest.cpp
+++ b/cppcache/integration-test/testPdxMetadataCheckTest.cpp
@@ -76,367 +76,357 @@ bool isPoolConfig = false; // To track if pool case is running
// "Portfolios3" };
void initClient(const bool isthinClient, bool isPdxIgnoreUnreadFields,
- const std::shared_ptr<Properties>& configPtr = nullptr) {
- LOGINFO("isPdxIgnoreUnreadFields = %d ", isPdxIgnoreUnreadFields);
- if (cacheHelper == nullptr) {
- cacheHelper = new CacheHelper(isthinClient, isPdxIgnoreUnreadFields, false,
- configPtr, false);
- }
- ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
+ const std::shared_ptr<Properties>& configPtr = nullptr) {
+ LOGINFO("isPdxIgnoreUnreadFields = %d ", isPdxIgnoreUnreadFields);
+ if (cacheHelper == nullptr) {
+ cacheHelper = new CacheHelper(isthinClient, isPdxIgnoreUnreadFields, false,
+ configPtr, false);
+ }
+ ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void initClient1(bool isPdxIgnoreUnreadFields = false) {
- // Create just one pool and attach all regions to that.
- initClient(true, isPdxIgnoreUnreadFields);
- isPoolConfig = true;
- createPool(poolNames[0], locHostPort, nullptr, 0, false);
- createRegionAndAttachPool("DistRegionAck", USE_ACK, poolNames[0],
- true /*Caching enabled*/);
- LOG("StepOne complete.");
+ // Create just one pool and attach all regions to that.
+ initClient(true, isPdxIgnoreUnreadFields);
+ isPoolConfig = true;
+ createPool(poolNames[0], locHostPort, nullptr, 0, false);
+ createRegionAndAttachPool("DistRegionAck", USE_ACK, poolNames[0],
+ true /*Caching enabled*/);
+ LOG("StepOne complete.");
}
void initClient2(bool isPdxIgnoreUnreadFields = false) {
- // Create just one pool and attach all regions to that.
- initClient(true, isPdxIgnoreUnreadFields);
- isPoolConfig = true;
- createPool(poolNames[0], locHostPort, nullptr, 0,
- true /*ClientNotification enabled*/);
- createRegionAndAttachPool("DistRegionAck", USE_ACK, poolNames[0],
- true /*Caching enabled*/);
- LOG("StepOne complete.");
+ // Create just one pool and attach all regions to that.
+ initClient(true, isPdxIgnoreUnreadFields);
+ isPoolConfig = true;
+ createPool(poolNames[0], locHostPort, nullptr, 0,
+ true /*ClientNotification enabled*/);
+ createRegionAndAttachPool("DistRegionAck", USE_ACK, poolNames[0],
+ true /*Caching enabled*/);
+ LOG("StepOne complete.");
}
DUNIT_TASK_DEFINITION(SERVER1, StartLocator)
-{
- // starting locator 1 2
- if (isLocator) {
- CacheHelper::initLocator(1);
- }
- LOG("Locator started");
-}
+ {
+ // starting locator 1 2
+ if (isLocator) {
+ CacheHelper::initLocator(1);
+ }
+ LOG("Locator started");
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER1, CreateServerWithLocator_PdxMetadataTest)
-{
- LOG("Starting SERVER1...");
- if (isLocalServer) {
- CacheHelper::initServer(1, "cacheserverPdx2.xml", locHostPort);
- }
- LOG("SERVER1 started");
-}
+ {
+ LOG("Starting SERVER1...");
+ if (isLocalServer) {
+ CacheHelper::initServer(1, "cacheserverPdx2.xml", locHostPort);
+ }
+ LOG("SERVER1 started");
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepOnePoolLoc_PdxMetadataTest)
-{
- LOG("Starting Step One with Pool + Locator lists");
- initClient1();
-}
+ {
+ LOG("Starting Step One with Pool + Locator lists");
+ initClient1();
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, StepTwoPoolLoc_PdxMetadataTest)
-{
- LOG("Starting Step Two with Pool + Locator");
- initClient2();
-}
+ {
+ LOG("Starting Step Two with Pool + Locator");
+ initClient2();
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, generateJavaPdxType)
-{
- auto regPtr0 = getHelper()->getRegion("DistRegionAck");
- auto args = CacheableKey::create("saveAllJavaPdxTypes");
- auto key = CacheableKey::create(1);
- auto routingObj = CacheableVector::create();
- routingObj->push_back(key);
-
- auto funcExec = FunctionService::onRegion(regPtr0);
-
- auto collector = funcExec.withArgs(args)
- .withFilter(routingObj)
- .execute("ComparePdxTypes");
- ASSERT(collector != nullptr, "onRegion collector nullptr");
-
- auto result = collector->getResult();
- LOGINFO("NIL:: testTCPDXTests: result->size = %d ", result->size());
- if (result == nullptr) {
- ASSERT(false, "echo String : result is nullptr");
- }
- else {
- //
- bool gotResult = false;
- for (size_t i = 0; i < result->size(); i++) {
- try {
- auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(
- result->operator[](i));
- LOGINFO("NIL:: boolValue is %d ", boolValue->value());
- bool resultVal = boolValue->value();
- ASSERT(resultVal == true,
- "Function should return true NIL LINE_1508");
- gotResult = true;
- }
- catch (ClassCastException& ex) {
- LOG("exFuncNameSendException casting to int for arrayList arguement "
- "exception.");
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.what();
- LOG(logmsg.c_str());
- LOG(ex.getStackTrace());
- LOG("exFuncNameSendException now casting to "
- "UserFunctionExecutionExceptionPtr for arrayList arguement "
- "exception.");
- auto uFEPtr =
- std::dynamic_pointer_cast<UserFunctionExecutionException>(
- result->operator[](i));
- ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage().c_str());
- }
- catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
- }
- }
- ASSERT(gotResult == true, "Function should (gotResult) return true ");
- //
- }
-}
+ {
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto args = CacheableKey::create("saveAllJavaPdxTypes");
+ auto key = CacheableKey::create(1);
+ auto routingObj = CacheableVector::create();
+ routingObj->push_back(key);
+
+ auto funcExec = FunctionService::onRegion(regPtr0);
+
+ auto collector = funcExec.withArgs(args)
+ .withFilter(routingObj)
+ .execute("ComparePdxTypes");
+ ASSERT(collector != nullptr, "onRegion collector nullptr");
+
+ auto result = collector->getResult();
+ LOGINFO("NIL:: testTCPDXTests: result->size = %d ", result->size());
+ if (result == nullptr) {
+ ASSERT(false, "echo String : result is nullptr");
+ } else {
+ //
+ bool gotResult = false;
+ for (size_t i = 0; i < result->size(); i++) {
+ try {
+ auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(
+ result->operator[](i));
+ LOGINFO("NIL:: boolValue is %d ", boolValue->value());
+ bool resultVal = boolValue->value();
+ ASSERT(resultVal == true,
+ "Function should return true NIL LINE_1508");
+ gotResult = true;
+ } catch (ClassCastException& ex) {
+ LOG("exFuncNameSendException casting to int for arrayList arguement "
+ "exception.");
+ std::string logmsg = "";
+ logmsg += ex.getName();
+ logmsg += ": ";
+ logmsg += ex.what();
+ LOG(logmsg.c_str());
+ LOG(ex.getStackTrace());
+ LOG("exFuncNameSendException now casting to "
+ "UserFunctionExecutionExceptionPtr for arrayList arguement "
+ "exception.");
+ auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(
+ result->operator[](i));
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
+ LOGINFO("Done casting to uFEPtr");
+ LOGINFO("Read expected uFEPtr exception %s ",
+ uFEPtr->getMessage().c_str());
+ } catch (...) {
+ FAIL(
+ "exFuncNameSendException casting to string for bool arguement "
+ "Unknown exception.");
+ }
+ }
+ ASSERT(gotResult == true, "Function should (gotResult) return true ");
+ //
+ }
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, putAllPdxTypes)
-{
- auto serializationRegistry =
- CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
- ->getSerializationRegistry();
-
- try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes9::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- try {
- serializationRegistry->addPdxType(PdxTypes10::createDeserializable);
- }
- catch (const IllegalStateException&) {
- // ignore exception
- }
- // TODO::Uncomment it once PortfolioPdx/PositionPdx Classes are ready
- // serializationRegistry->addPdxType(PdxTests.PortfolioPdx.CreateDeserializable);
- // serializationRegistry->addPdxType(PdxTests.PositionPdx.CreateDeserializable);
-
- auto regPtr0 = getHelper()->getRegion("DistRegionAck");
-
- auto p1 = std::make_shared<PdxTypes1>();
- auto keyport1 = CacheableKey::create(p1->getClassName().c_str());
- regPtr0->put(keyport1, p1);
-
- auto p2 = std::make_shared<PdxTypes2>();
- auto keyport2 = CacheableKey::create(p2->getClassName().c_str());
- regPtr0->put(keyport2, p2);
-
- auto p3 = std::make_shared<PdxTypes3>();
- auto keyport3 = CacheableKey::create(p3->getClassName().c_str());
- regPtr0->put(keyport3, p3);
-
- auto p4 = std::make_shared<PdxTypes4>();
- auto keyport4 = CacheableKey::create(p4->getClassName().c_str());
- regPtr0->put(keyport4, p4);
-
- auto p5 = std::make_shared<PdxTypes5>();
- auto keyport5 = CacheableKey::create(p5->getClassName().c_str());
- regPtr0->put(keyport5, p5);
-
- auto p6 = std::make_shared<PdxTypes6>();
- auto keyport6 = CacheableKey::create(p6->getClassName().c_str());
- regPtr0->put(keyport6, p6);
-
- auto p7 = std::make_shared<PdxTypes7>();
- auto keyport7 = CacheableKey::create(p7->getClassName().c_str());
- regPtr0->put(keyport7, p7);
-
- auto p8 = std::make_shared<PdxTypes8>();
- auto keyport8 = CacheableKey::create(p8->getClassName().c_str());
- regPtr0->put(keyport8, p8);
-
- auto p9 = std::make_shared<PdxTypes9>();
- auto keyport9 = CacheableKey::create(p9->getClassName().c_str());
- regPtr0->put(keyport9, p9);
-
- auto p10 = std::make_shared<PdxTypes10>();
- auto keyport10 = CacheableKey::create(p10->getClassName().c_str());
- regPtr0->put(keyport10, p10);
-
- //
-}
+ {
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
+
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes9::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ try {
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes10::createDeserializable);
+ } catch (const IllegalStateException&) {
+ // ignore exception
+ }
+ // TODO::Uncomment it once PortfolioPdx/PositionPdx Classes are ready
+ // serializationRegistry->addPdxType(PdxTests.PortfolioPdx.CreateDeserializable);
+ // serializationRegistry->addPdxType(PdxTests.PositionPdx.CreateDeserializable);
+
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+
+ auto p1 = std::make_shared<PdxTypes1>();
+ auto keyport1 = CacheableKey::create(p1->getClassName().c_str());
+ regPtr0->put(keyport1, p1);
+
+ auto p2 = std::make_shared<PdxTypes2>();
+ auto keyport2 = CacheableKey::create(p2->getClassName().c_str());
+ regPtr0->put(keyport2, p2);
+
+ auto p3 = std::make_shared<PdxTypes3>();
+ auto keyport3 = CacheableKey::create(p3->getClassName().c_str());
+ regPtr0->put(keyport3, p3);
+
+ auto p4 = std::make_shared<PdxTypes4>();
+ auto keyport4 = CacheableKey::create(p4->getClassName().c_str());
+ regPtr0->put(keyport4, p4);
+
+ auto p5 = std::make_shared<PdxTypes5>();
+ auto keyport5 = CacheableKey::create(p5->getClassName().c_str());
+ regPtr0->put(keyport5, p5);
+
+ auto p6 = std::make_shared<PdxTypes6>();
+ auto keyport6 = CacheableKey::create(p6->getClassName().c_str());
+ regPtr0->put(keyport6, p6);
+
+ auto p7 = std::make_shared<PdxTypes7>();
+ auto keyport7 = CacheableKey::create(p7->getClassName().c_str());
+ regPtr0->put(keyport7, p7);
+
+ auto p8 = std::make_shared<PdxTypes8>();
+ auto keyport8 = CacheableKey::create(p8->getClassName().c_str());
+ regPtr0->put(keyport8, p8);
+
+ auto p9 = std::make_shared<PdxTypes9>();
+ auto keyport9 = CacheableKey::create(p9->getClassName().c_str());
+ regPtr0->put(keyport9, p9);
+
+ auto p10 = std::make_shared<PdxTypes10>();
+ auto keyport10 = CacheableKey::create(p10->getClassName().c_str());
+ regPtr0->put(keyport10, p10);
+
+ //
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, verifyDotNetPdxTypes)
-{
- auto regPtr0 = getHelper()->getRegion("DistRegionAck");
- auto args = CacheableKey::create("compareDotNETPdxTypes");
- auto key = CacheableKey::create(1);
- auto routingObj = CacheableVector::create();
- routingObj->push_back(key);
-
- auto funcExec = FunctionService::onRegion(regPtr0);
-
- auto collector = funcExec.withArgs(args)
- .withFilter(routingObj)
- .execute("ComparePdxTypes");
- ASSERT(collector != nullptr, "onRegion collector nullptr");
-
- auto result = collector->getResult();
- LOGINFO("NIL:: testTCPDXTests:verifyDotNetPdxTypes result->size = %d ",
- result->size());
- if (result == nullptr) {
- ASSERT(false, "echo String : result is nullptr");
- }
- else {
- bool gotResult = false;
- for (size_t i = 0; i < result->size(); i++) {
- try {
- auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(
- result->operator[](i));
- LOGINFO("NIL::verifyDotNetPdxTypes boolValue is %d ",
- boolValue->value());
- bool resultVal = boolValue->value();
- ASSERT(resultVal == true,
- "Function should return true NIL LINE_1508");
- gotResult = true;
- }
- catch (ClassCastException& ex) {
- LOG("exFuncNameSendException casting to int for arrayList arguement "
- "exception.");
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.what();
- LOG(logmsg.c_str());
- LOG(ex.getStackTrace());
- LOG("exFuncNameSendException now casting to "
- "UserFunctionExecutionExceptionPtr for arrayList arguement "
- "exception.");
- auto uFEPtr =
- std::dynamic_pointer_cast<UserFunctionExecutionException>(
- result->operator[](i));
- ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage().c_str());
- }
- catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
- }
- }
- ASSERT(gotResult == true, "Function should (gotResult) return true ");
- }
-}
+ {
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto args = CacheableKey::create("compareDotNETPdxTypes");
+ auto key = CacheableKey::create(1);
+ auto routingObj = CacheableVector::create();
+ routingObj->push_back(key);
+
+ auto funcExec = FunctionService::onRegion(regPtr0);
+
+ auto collector = funcExec.withArgs(args)
+ .withFilter(routingObj)
+ .execute("ComparePdxTypes");
+ ASSERT(collector != nullptr, "onRegion collector nullptr");
+
+ auto result = collector->getResult();
+ LOGINFO("NIL:: testTCPDXTests:verifyDotNetPdxTypes result->size = %d ",
+ result->size());
+ if (result == nullptr) {
+ ASSERT(false, "echo String : result is nullptr");
+ } else {
+ bool gotResult = false;
+ for (size_t i = 0; i < result->size(); i++) {
+ try {
+ auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(
+ result->operator[](i));
+ LOGINFO("NIL::verifyDotNetPdxTypes boolValue is %d ",
+ boolValue->value());
+ bool resultVal = boolValue->value();
+ ASSERT(resultVal == true,
+ "Function should return true NIL LINE_1508");
+ gotResult = true;
+ } catch (ClassCastException& ex) {
+ LOG("exFuncNameSendException casting to int for arrayList arguement "
+ "exception.");
+ std::string logmsg = "";
+ logmsg += ex.getName();
+ logmsg += ": ";
+ logmsg += ex.what();
+ LOG(logmsg.c_str());
+ LOG(ex.getStackTrace());
+ LOG("exFuncNameSendException now casting to "
+ "UserFunctionExecutionExceptionPtr for arrayList arguement "
+ "exception.");
+ auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(
+ result->operator[](i));
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
+ LOGINFO("Done casting to uFEPtr");
+ LOGINFO("Read expected uFEPtr exception %s ",
+ uFEPtr->getMessage().c_str());
+ } catch (...) {
+ FAIL(
+ "exFuncNameSendException casting to string for bool arguement "
+ "Unknown exception.");
+ }
+ }
+ ASSERT(gotResult == true, "Function should (gotResult) return true ");
+ }
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
-{
- LOG("cleanProc 1...");
- isPoolConfig = false;
- cleanProc();
-}
+ {
+ LOG("cleanProc 1...");
+ isPoolConfig = false;
+ cleanProc();
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CloseCache2)
-{
- LOG("cleanProc 2...");
- isPoolConfig = false;
- cleanProc();
-}
+ {
+ LOG("cleanProc 2...");
+ isPoolConfig = false;
+ cleanProc();
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER1, CloseServer)
-{
- LOG("closing Server1...");
- if (isLocalServer) {
- CacheHelper::closeServer(1);
- LOG("SERVER1 stopped");
- }
-}
+ {
+ LOG("closing Server1...");
+ if (isLocalServer) {
+ CacheHelper::closeServer(1);
+ LOG("SERVER1 stopped");
+ }
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(LOCATOR, CloseLocator)
-{
- if (isLocator) {
- CacheHelper::closeLocator(1);
- LOG("Locator1 stopped");
- }
-}
+ {
+ if (isLocator) {
+ CacheHelper::closeLocator(1);
+ LOG("Locator1 stopped");
+ }
+ }
END_TASK_DEFINITION
-DUNIT_MAIN {
- CALL_TASK(StartLocator)
- CALL_TASK(CreateServerWithLocator_PdxMetadataTest)
- CALL_TASK(StepOnePoolLoc_PdxMetadataTest)
- CALL_TASK(StepTwoPoolLoc_PdxMetadataTest)
+DUNIT_MAIN
+{CALL_TASK(StartLocator) CALL_TASK(CreateServerWithLocator_PdxMetadataTest)
+ CALL_TASK(StepOnePoolLoc_PdxMetadataTest)
+ CALL_TASK(StepTwoPoolLoc_PdxMetadataTest)
- CALL_TASK(generateJavaPdxType)
+ CALL_TASK(generateJavaPdxType)
- CALL_TASK(putAllPdxTypes)
+ CALL_TASK(putAllPdxTypes)
- CALL_TASK(verifyDotNetPdxTypes)
+ CALL_TASK(verifyDotNetPdxTypes)
- CALL_TASK(CloseCache1)
- CALL_TASK(CloseCache2)
- CALL_TASK(CloseServer)
+ CALL_TASK(CloseCache1) CALL_TASK(CloseCache2)
+ CALL_TASK(CloseServer)
- CALL_TASK(CloseLocator)
-}
-END_MAIN
+ CALL_TASK(CloseLocator)} END_MAIN
diff --git a/cppcache/integration-test/testSerialization.cpp b/cppcache/integration-test/testSerialization.cpp
index 7fbec79..f424e7f 100644
--- a/cppcache/integration-test/testSerialization.cpp
+++ b/cppcache/integration-test/testSerialization.cpp
@@ -72,8 +72,7 @@ class OtherType : public DataSerializable {
CData m_struct;
int32_t m_classIdToReturn;
- explicit OtherType(int32_t classIdToReturn = g_classIdToReturn)
- : m_classIdToReturn(classIdToReturn) {
+ OtherType() {
m_struct.a = 0;
m_struct.b = 0;
m_struct.c = 0;
@@ -95,24 +94,13 @@ class OtherType : public DataSerializable {
}
static std::shared_ptr<Serializable> createDeserializable() {
- return std::make_shared<OtherType>(g_classIdToReturn);
+ return std::make_shared<OtherType>();
}
- static std::shared_ptr<Serializable> createDeserializable2() {
- return std::make_shared<OtherType>(g_classIdToReturn2);
- }
-
- static std::shared_ptr<Serializable> createDeserializable4() {
- return std::make_shared<OtherType>(g_classIdToReturn4);
- }
-
- int32_t getClassId() const override { return m_classIdToReturn; }
-
uint32_t size() const { return sizeof(CData); }
- static std::shared_ptr<Cacheable> uniqueCT(
- int32_t i, int32_t classIdToReturn = g_classIdToReturn) {
- auto ot = std::make_shared<OtherType>(classIdToReturn);
+ static std::shared_ptr<Cacheable> uniqueCT(int32_t i) {
+ auto ot = std::make_shared<OtherType>();
ot->m_struct.a = (int)i;
ot->m_struct.b = (i % 2 == 0) ? true : false;
ot->m_struct.c = static_cast<char>(65) + i;
@@ -166,9 +154,8 @@ DUNIT_TASK(Sender, SetupAndPutInts)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(OtherType::createDeserializable);
- serializationRegistry->addType(OtherType::createDeserializable2);
- serializationRegistry->addType(OtherType::createDeserializable4);
+ serializationRegistry->addDataSerializableType(
+ OtherType::createDeserializable, g_classIdToReturn);
getHelper()->createPooledRegion("DistRegionAck", USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
@@ -185,9 +172,7 @@ DUNIT_TASK(Sender, SendCT)
{
for (int32_t i = 0; i < 30; i += 3) {
try {
- regionPtr->put(i, OtherType::uniqueCT(i, g_classIdToReturn));
- regionPtr->put(i + 1, OtherType::uniqueCT(i + 1, g_classIdToReturn2));
- regionPtr->put(i + 2, OtherType::uniqueCT(i + 2, g_classIdToReturn4));
+ regionPtr->put(i, OtherType::uniqueCT(i));
} catch (const apache::geode::client::TimeoutException&) {
}
}
@@ -198,8 +183,6 @@ DUNIT_TASK(Sender, RValidateCT)
{
for (int32_t i = 0; i < 30; i += 3) {
OtherType::validateCT(i, regionPtr->get(i));
- OtherType::validateCT(i + 1, regionPtr->get(i + 1));
- OtherType::validateCT(i + 2, regionPtr->get(i + 2));
}
}
ENDTASK
diff --git a/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
index a3bbc93..8f1532c 100644
--- a/cppcache/integration-test/testThinClientCacheableStringArray.cpp
+++ b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
@@ -70,8 +70,10 @@ DUNIT_TASK(CLIENT1, StepOne)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
auto regptr = getHelper()->createPooledRegion(
_regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true);
@@ -113,7 +115,7 @@ DUNIT_TASK(CLIENT1, StepThree)
position->getSecId()->value().c_str(),
position->getSharesOutstanding());
} else if (ser) {
- printf(" query pulled object %s\n", ser->toString().c_str());
+ printf(" query pulled object %s\n", ser->toString().c_str());
} else {
printf(" query pulled nullptr object\n");
}
diff --git a/cppcache/integration-test/testThinClientCq.cpp b/cppcache/integration-test/testThinClientCq.cpp
index 8068f3b..d454534 100644
--- a/cppcache/integration-test/testThinClientCq.cpp
+++ b/cppcache/integration-test/testThinClientCq.cpp
@@ -91,11 +91,15 @@ void initClientCq(const bool isthinClient) {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -310,10 +314,11 @@ END_TASK_DEFINITION
void stepOne() {
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
- auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto regptr = getHelper()->getRegion(regionNamesCq[0]);
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
- LOG("StepOne complete.");
+ LOG("StepOne complete.");
}
void initCqStatusClient() {
@@ -358,10 +363,11 @@ END_TASK_DEFINITION
void stepOne2() {
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
- auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto regptr = getHelper()->getRegion(regionNamesCq[0]);
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
- LOG("StepOne2 complete.");
+ LOG("StepOne2 complete.");
}
DUNIT_TASK_DEFINITION(CLIENT2, StepOne2_PoolLocator)
@@ -370,17 +376,17 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepTwo)
{
- auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
+ auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
+ auto subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
- QueryHelper* qh = &QueryHelper::getHelper();
+ QueryHelper* qh = &QueryHelper::getHelper();
- if (!m_isPdx) {
- qh->populatePortfolioData(regPtr0, 2, 1, 1);
- qh->populatePositionData(subregPtr0, 2, 1);
- } else {
- qh->populatePortfolioPdxData(regPtr0, 2, 1, 1);
- qh->populatePositionPdxData(subregPtr0, 2, 1);
+ if (!m_isPdx) {
+ qh->populatePortfolioData(regPtr0, 2, 1, 1);
+ qh->populatePositionData(subregPtr0, 2, 1);
+ } else {
+ qh->populatePortfolioPdxData(regPtr0, 2, 1, 1);
+ qh->populatePositionPdxData(subregPtr0, 2, 1);
}
LOG("StepTwo complete.");
@@ -405,8 +411,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
for (i = 0; i < MAX_LISTNER; i++) {
auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
- auto cqAttr = cqFac.create();
- auto qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
+ auto cqAttr = cqFac.create();
+ auto qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
}
try {
@@ -427,28 +433,28 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
{
try {
LOG("Testing bug #1026");
- auto regionPtr = getHelper()->getRegion(regionNamesCq[0]);
- regionPtr->put("1026_Key1", "asdas");
- regionPtr->put("1026_Key2",
- "Schüler"); // string with extended charater set
- regionPtr->put("1026_Key3",
- "Gebäude"); // string with extended charater set
- regionPtr->put("1026_Key4",
- "Königin"); // string with extended charater set
-
- const char* qryStr = "select * from /Portfolios p where p='Schüler'";
-
- std::shared_ptr<CqListener> cqLstner(new MyCqListener1026);
- cqFac.addCqListener(cqLstner);
- auto cqAttr = cqFac.create();
- auto qry = qs->newCq("1026_MyCq", qryStr, cqAttr);
-
- // execute Cq Query with initial Results
- auto resultsPtr = qry->executeWithInitialResults();
-
- LOGINFO("ResultSet Query returned %d rows", resultsPtr->size());
- LOG("Testing bug #1026 Complete");
- // Iterate through the rows of the query result.
+ auto regionPtr = getHelper()->getRegion(regionNamesCq[0]);
+ regionPtr->put("1026_Key1", "asdas");
+ regionPtr->put("1026_Key2",
+ "Schüler"); // string with extended charater set
+ regionPtr->put("1026_Key3",
+ "Gebäude"); // string with extended charater set
+ regionPtr->put("1026_Key4",
+ "Königin"); // string with extended charater set
+
+ const char* qryStr = "select * from /Portfolios p where p='Schüler'";
+
+ std::shared_ptr<CqListener> cqLstner(new MyCqListener1026);
+ cqFac.addCqListener(cqLstner);
+ auto cqAttr = cqFac.create();
+ auto qry = qs->newCq((char*)"1026_MyCq", qryStr, cqAttr);
+
+ // execute Cq Query with initial Results
+ auto resultsPtr = qry->executeWithInitialResults();
+
+ LOGINFO("ResultSet Query returned %d rows", resultsPtr->size());
+ LOG("Testing bug #1026 Complete");
+ // Iterate through the rows of the query result.
} catch (const Exception& geodeExcp) {
LOGERROR("CqQuery Geode Exception: %s", geodeExcp.what());
FAIL(geodeExcp.what());
@@ -460,34 +466,34 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
{
- auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
+ auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
+ auto subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
- QueryHelper* qh = &QueryHelper::getHelper();
+ QueryHelper* qh = &QueryHelper::getHelper();
- if (!m_isPdx) {
- qh->populatePortfolioData(regPtr0, 3, 2, 1);
- qh->populatePositionData(subregPtr0, 3, 2);
- } else {
- qh->populatePortfolioPdxData(regPtr0, 3, 2, 1);
- qh->populatePositionPdxData(subregPtr0, 3, 2);
- }
-
- std::shared_ptr<Cacheable> port = nullptr;
- for (int i = 1; i < 3; i++) {
if (!m_isPdx) {
- port = std::shared_ptr<Cacheable>(new Portfolio(i, 2));
+ qh->populatePortfolioData(regPtr0, 3, 2, 1);
+ qh->populatePositionData(subregPtr0, 3, 2);
} else {
- port = std::shared_ptr<Cacheable>(new PortfolioPdx(i, 2));
+ qh->populatePortfolioPdxData(regPtr0, 3, 2, 1);
+ qh->populatePositionPdxData(subregPtr0, 3, 2);
}
- auto keyport = CacheableKey::create("port1-1");
- regPtr0->put(keyport, port);
- SLEEP(10); // sleep a while to allow server query to complete
- }
+ std::shared_ptr<Cacheable> port = nullptr;
+ for (int i = 1; i < 3; i++) {
+ if (!m_isPdx) {
+ port = std::shared_ptr<Cacheable>(new Portfolio(i, 2));
+ } else {
+ port = std::shared_ptr<Cacheable>(new PortfolioPdx(i, 2));
+ }
+
+ auto keyport = CacheableKey::create("port1-1");
+ regPtr0->put(keyport, port);
+ SLEEP(10); // sleep a while to allow server query to complete
+ }
- LOG("StepTwo2 complete. Sleeping .25 min for server query to complete...");
- SLEEP(15000); // sleep .25 min to allow server query to complete
+ LOG("StepTwo2 complete. Sleeping .25 min for server query to complete...");
+ SLEEP(15000); // sleep .25 min to allow server query to complete
}
END_TASK_DEFINITION
@@ -524,84 +530,84 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
for (i = 0; i < MAX_LISTNER; i++) {
sprintf(buf, "get info for cq[%s]:", cqNames[i]);
LOG(buf);
- auto cqy = qs->getCq(cqNames[i]);
- auto cqStats = cqy->getStatistics();
- sprintf(buf,
- "Cq[%s]From CqStatistics: numInserts[%d], numDeletes[%d], "
- "numUpdates[%d], numEvents[%d]",
- cqNames[i], cqStats->numInserts(), cqStats->numDeletes(),
- cqStats->numUpdates(), cqStats->numEvents());
- LOG(buf);
- for (j = 0; j <= i; j++) {
- inserts[j] += cqStats->numInserts();
- updates[j] += cqStats->numUpdates();
- deletes[j] += cqStats->numDeletes();
- events[j] += cqStats->numEvents();
- }
- auto cqAttr = cqy->getCqAttributes();
- auto vl = cqAttr->getCqListeners();
- sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
- vl.size());
- LOG(buf);
- ASSERT(vl.size() == static_cast<size_t>(i + 1),
- "incorrect number of listeners");
- if (i == (MAX_LISTNER - 1)) {
- MyCqListener* myLl[MAX_LISTNER];
- for (int k = 0; k < MAX_LISTNER; k++) {
- MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].get());
- myLl[ml->getId()] = ml;
- }
- for (j = 0; j < MAX_LISTNER; j++) {
- MyCqListener* ml = myLl[j];
- sprintf(buf,
- "MyCount for Listener[%d]: numInserts[%d], numDeletes[%d], "
- "numUpdates[%d], numEvents[%d]",
- j, ml->getNumInserts(), ml->getNumDeletes(),
- ml->getNumUpdates(), ml->getNumEvents());
- LOG(buf);
- sprintf(buf,
- "sum of stats for Listener[%d]: numInserts[%d], "
- "numDeletes[%d], numUpdates[%d], numEvents[%d]",
- j, inserts[j], deletes[j], updates[j], events[j]);
- LOG(buf);
- ASSERT(ml->getNumInserts() == inserts[j],
- "accumulative insert count incorrect");
- ASSERT(ml->getNumUpdates() == updates[j],
- "accumulative updates count incorrect");
- ASSERT(ml->getNumDeletes() == deletes[j],
- "accumulative deletes count incorrect");
- ASSERT(ml->getNumEvents() == events[j],
- "accumulative events count incorrect");
- }
- LOG("removing listener");
- auto cqAttrMtor = cqy->getCqAttributesMutator();
- auto ptr = vl[0];
- cqAttrMtor.removeCqListener(ptr);
- vl = cqAttr->getCqListeners();
- sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
- vl.size());
- LOG(buf);
- ASSERT(vl.size() == i, "incorrect number of listeners");
- }
+ auto cqy = qs->getCq(cqNames[i]);
+ auto cqStats = cqy->getStatistics();
+ sprintf(buf,
+ "Cq[%s]From CqStatistics: numInserts[%d], numDeletes[%d], "
+ "numUpdates[%d], numEvents[%d]",
+ cqNames[i], cqStats->numInserts(), cqStats->numDeletes(),
+ cqStats->numUpdates(), cqStats->numEvents());
+ LOG(buf);
+ for (j = 0; j <= i; j++) {
+ inserts[j] += cqStats->numInserts();
+ updates[j] += cqStats->numUpdates();
+ deletes[j] += cqStats->numDeletes();
+ events[j] += cqStats->numEvents();
+ }
+ auto cqAttr = cqy->getCqAttributes();
+ auto vl = cqAttr->getCqListeners();
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
+ vl.size());
+ LOG(buf);
+ ASSERT(vl.size() == static_cast<size_t>(i + 1),
+ "incorrect number of listeners");
+ if (i == (MAX_LISTNER - 1)) {
+ MyCqListener* myLl[MAX_LISTNER];
+ for (int k = 0; k < MAX_LISTNER; k++) {
+ MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].get());
+ myLl[ml->getId()] = ml;
+ }
+ for (j = 0; j < MAX_LISTNER; j++) {
+ MyCqListener* ml = myLl[j];
+ sprintf(buf,
+ "MyCount for Listener[%d]: numInserts[%d], numDeletes[%d], "
+ "numUpdates[%d], numEvents[%d]",
+ j, ml->getNumInserts(), ml->getNumDeletes(),
+ ml->getNumUpdates(), ml->getNumEvents());
+ LOG(buf);
+ sprintf(buf,
+ "sum of stats for Listener[%d]: numInserts[%d], "
+ "numDeletes[%d], numUpdates[%d], numEvents[%d]",
+ j, inserts[j], deletes[j], updates[j], events[j]);
+ LOG(buf);
+ ASSERT(ml->getNumInserts() == inserts[j],
+ "accumulative insert count incorrect");
+ ASSERT(ml->getNumUpdates() == updates[j],
+ "accumulative updates count incorrect");
+ ASSERT(ml->getNumDeletes() == deletes[j],
+ "accumulative deletes count incorrect");
+ ASSERT(ml->getNumEvents() == events[j],
+ "accumulative events count incorrect");
+ }
+ LOG("removing listener");
+ auto cqAttrMtor = cqy->getCqAttributesMutator();
+ auto ptr = vl[0];
+ cqAttrMtor.removeCqListener(ptr);
+ vl = cqAttr->getCqListeners();
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
+ vl.size());
+ LOG(buf);
+ ASSERT(vl.size() == i, "incorrect number of listeners");
+ }
}
try {
- auto cqy = qs->getCq(cqNames[1]);
- cqy->stop();
-
- cqy = qs->getCq(cqNames[6]);
-
- sprintf(buf, "cq[%s] should have been running!", cqNames[6]);
- ASSERT(cqy->isRunning() == true, buf);
- bool got_exception = false;
- try {
- cqy->execute();
- } catch (IllegalStateException& excp) {
- std::string failmsg = "";
- failmsg += excp.getName();
- failmsg += ": ";
- failmsg += excp.what();
- LOG(failmsg.c_str());
- got_exception = true;
+ auto cqy = qs->getCq(cqNames[1]);
+ cqy->stop();
+
+ cqy = qs->getCq(cqNames[6]);
+
+ sprintf(buf, "cq[%s] should have been running!", cqNames[6]);
+ ASSERT(cqy->isRunning() == true, buf);
+ bool got_exception = false;
+ try {
+ cqy->execute();
+ } catch (IllegalStateException& excp) {
+ std::string failmsg = "";
+ failmsg += excp.getName();
+ failmsg += ": ";
+ failmsg += excp.what();
+ LOG(failmsg.c_str());
+ got_exception = true;
}
sprintf(buf, "cq[%s] should gotten exception!", cqNames[6]);
ASSERT(got_exception == true, buf);
@@ -629,43 +635,43 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
FAIL(failmsg.c_str());
LOG(excp.getStackTrace());
}
- auto serviceStats = qs->getCqServiceStatistics();
- ASSERT(serviceStats != nullptr, "serviceStats is nullptr");
- sprintf(buf,
- "numCqsActive=%d, numCqsCreated=%d, "
- "numCqsClosed=%d,numCqsStopped=%d, numCqsOnClient=%d",
- serviceStats->numCqsActive(), serviceStats->numCqsCreated(),
- serviceStats->numCqsClosed(), serviceStats->numCqsStopped(),
- serviceStats->numCqsOnClient());
- LOG(buf);
- /*
- for(i=0; i < MAX_LISTNER; i++)
- {
- auto cqy = qs->getCq(cqNames[i]);
- CqState state = cqy->getState();
- CqState cqState;
- cqState.setState(state);
- sprintf(buf, "cq[%s] is in state[%s]", cqNames[i], cqState.toString());
+ auto serviceStats = qs->getCqServiceStatistics();
+ ASSERT(serviceStats != nullptr, "serviceStats is nullptr");
+ sprintf(buf,
+ "numCqsActive=%d, numCqsCreated=%d, "
+ "numCqsClosed=%d,numCqsStopped=%d, numCqsOnClient=%d",
+ serviceStats->numCqsActive(), serviceStats->numCqsCreated(),
+ serviceStats->numCqsClosed(), serviceStats->numCqsStopped(),
+ serviceStats->numCqsOnClient());
LOG(buf);
- }
- */
-
- ASSERT(serviceStats->numCqsActive() == 6, "active count incorrect!");
- ASSERT(serviceStats->numCqsCreated() == 9, "created count incorrect!");
- ASSERT(serviceStats->numCqsClosed() == 1, "closed count incorrect!");
- ASSERT(serviceStats->numCqsStopped() == 2, "stopped count incorrect!");
- ASSERT(serviceStats->numCqsOnClient() == 8, "cq count incorrect!");
-
- try {
- qs->stopCqs();
- } catch (Exception& excp) {
- std::string failmsg = "";
- failmsg += excp.getName();
- failmsg += ": ";
- failmsg += excp.what();
- LOG(failmsg.c_str());
- FAIL(failmsg.c_str());
- LOG(excp.getStackTrace());
+ /*
+ for(i=0; i < MAX_LISTNER; i++)
+ {
+ auto cqy = qs->getCq(cqNames[i]);
+ CqState state = cqy->getState();
+ CqState cqState;
+ cqState.setState(state);
+ sprintf(buf, "cq[%s] is in state[%s]", cqNames[i], cqState.toString());
+ LOG(buf);
+ }
+ */
+
+ ASSERT(serviceStats->numCqsActive() == 6, "active count incorrect!");
+ ASSERT(serviceStats->numCqsCreated() == 9, "created count incorrect!");
+ ASSERT(serviceStats->numCqsClosed() == 1, "closed count incorrect!");
+ ASSERT(serviceStats->numCqsStopped() == 2, "stopped count incorrect!");
+ ASSERT(serviceStats->numCqsOnClient() == 8, "cq count incorrect!");
+
+ try {
+ qs->stopCqs();
+ } catch (Exception& excp) {
+ std::string failmsg = "";
+ failmsg += excp.getName();
+ failmsg += ": ";
+ failmsg += excp.what();
+ LOG(failmsg.c_str());
+ FAIL(failmsg.c_str());
+ LOG(excp.getStackTrace());
}
sprintf(buf,
"numCqsActive=%d, numCqsCreated=%d, "
@@ -706,19 +712,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
i = 0;
auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
- auto cqAttr = cqFac.create();
- try {
- auto qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
- qry->execute();
- qry->stop();
- qry->close();
- } catch (Exception& excp) {
- std::string failmsg = "";
- failmsg += excp.getName();
- failmsg += ": ";
- failmsg += excp.what();
- LOG(failmsg.c_str());
- FAIL(failmsg.c_str());
+ auto cqAttr = cqFac.create();
+ try {
+ auto qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
+ qry->execute();
+ qry->stop();
+ qry->close();
+ } catch (Exception& excp) {
+ std::string failmsg = "";
+ failmsg += excp.getName();
+ failmsg += ": ";
+ failmsg += excp.what();
+ LOG(failmsg.c_str());
+ FAIL(failmsg.c_str());
}
LOG("StepFour complete.");
@@ -805,25 +811,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ)
{
SLEEP(10000);
// Create CqAttributes and Install Listener
- auto pool = getHelper()->getCache()->getPoolManager().find(regionName);
- auto qs = pool->getQueryService();
- CqAttributesFactory cqFac;
- auto cqLstner = std::make_shared<MyCqStatusListener>(100);
- cqFac.addCqListener(cqLstner);
- auto cqAttr = cqFac.create();
- auto cq = qs->newCq(const_cast<char*>(cqName), cqQueryStatusString, cqAttr);
-
- cq->execute();
- SLEEP(20000);
-
- cqAttr = cq->getCqAttributes();
- auto vl = cqAttr->getCqListeners();
- MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].get());
- LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
- ASSERT(myStatusCq->getCqsConnectedCount() == 1,
- "incorrect number of CqStatus Connected count.");
- LOG("createCQ complete.");
+ auto pool = getHelper()->getCache()->getPoolManager().find(regionName);
+ auto qs = pool->getQueryService();
+ CqAttributesFactory cqFac;
+ auto cqLstner = std::make_shared<MyCqStatusListener>(100);
+ cqFac.addCqListener(cqLstner);
+ auto cqAttr = cqFac.create();
+ auto cq = qs->newCq(const_cast<char*>(cqName), cqQueryStatusString, cqAttr);
+
+ cq->execute();
+ SLEEP(20000);
+
+ cqAttr = cq->getCqAttributes();
+ auto vl = cqAttr->getCqListeners();
+ MyCqStatusListener* myStatusCq =
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
+ LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
+ ASSERT(myStatusCq->getCqsConnectedCount() == 1,
+ "incorrect number of CqStatus Connected count.");
+ LOG("createCQ complete.");
}
END_TASK_DEFINITION
@@ -899,10 +905,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
END_TASK_DEFINITION
void executeCq(const char* poolName, const char* name) {
- auto pool = getHelper()->getCache()->getPoolManager().find(poolName);
- std::shared_ptr<QueryService> qs;
- if (pool != nullptr) {
- qs = pool->getQueryService();
+ auto pool = getHelper()->getCache()->getPoolManager().find(poolName);
+ std::shared_ptr<QueryService> qs;
+ if (pool != nullptr) {
+ qs = pool->getQueryService();
}
auto cq = qs->getCq(const_cast<char*>(name));
cq->execute();
@@ -1012,21 +1018,21 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, putEntries)
{
- auto regPtr0 = getHelper()->getRegion(regionName);
- auto regPtr1 = getHelper()->getRegion(regionName1);
- std::shared_ptr<Cacheable> val = nullptr;
- char KeyStr[256] = {0};
- char valStr[256] = {0};
- for (int i = 1; i <= 5; i++) {
- ACE_OS::snprintf(KeyStr, 256, "Key-%d ", i);
- ACE_OS::snprintf(valStr, 256, "val-%d ", i);
- auto keyport = CacheableKey::create(KeyStr);
- auto valport = CacheableString::create(valStr);
- regPtr0->put(keyport, valport);
- regPtr1->put(keyport, valport);
- SLEEP(10 * 1000); // sleep a while to allow server query to complete
- }
- LOGINFO("putEntries complete");
+ auto regPtr0 = getHelper()->getRegion(regionName);
+ auto regPtr1 = getHelper()->getRegion(regionName1);
+ std::shared_ptr<Cacheable> val = nullptr;
+ char KeyStr[256] = {0};
+ char valStr[256] = {0};
+ for (int i = 1; i <= 5; i++) {
+ ACE_OS::snprintf(KeyStr, 256, "Key-%d ", i);
+ ACE_OS::snprintf(valStr, 256, "val-%d ", i);
+ auto keyport = CacheableKey::create(KeyStr);
+ auto valport = CacheableString::create(valStr);
+ regPtr0->put(keyport, valport);
+ regPtr1->put(keyport, valport);
+ SLEEP(10 * 1000); // sleep a while to allow server query to complete
+ }
+ LOGINFO("putEntries complete");
}
END_TASK_DEFINITION
@@ -1066,114 +1072,114 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
{
SLEEP(10000);
// Create CqAttributes and Install Listener
- auto pool = getHelper()->getCache()->getPoolManager().find(regionName);
- auto qs = pool->getQueryService();
- CqAttributesFactory cqFac;
- auto cqLstner = std::make_shared<MyCqListener>(1);
- auto cqStatusLstner = std::make_shared<MyCqStatusListener>(100);
- cqFac.addCqListener(cqLstner);
- cqFac.addCqListener(cqStatusLstner);
- auto cqAttr = cqFac.create();
-
- auto cq = qs->newCq(const_cast<char*>(cqName), cqQueryStatusString, cqAttr);
- cq->execute();
- SLEEP(20000);
- LOG("ProcessCQ Query executed.");
-
- auto regPtr0 = getHelper()->getRegion(regionName);
- std::shared_ptr<Cacheable> val = nullptr;
- char KeyStr[256] = {0};
- char valStr[256] = {0};
- for (int i = 1; i <= 5; i++) {
- ACE_OS::snprintf(KeyStr, 256, "Key-%d ", i);
- ACE_OS::snprintf(valStr, 256, "val-%d ", i);
- auto keyport = CacheableKey::create(KeyStr);
- auto valport = CacheableString::create(valStr);
- regPtr0->put(keyport, valport);
- SLEEP(10 * 1000); // sleep a while to allow server query to complete
- }
- LOGINFO("putEntries complete");
-
- cqAttr = cq->getCqAttributes();
- auto vl = cqAttr->getCqListeners();
- ASSERT(vl.size() == 2, "incorrect number of CqListeners count.");
- MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[1].get());
- LOGINFO("No of insert events = %d ", myStatusCq->getNumInserts());
- LOGINFO("No of OnCqConnected events = %d ",
- myStatusCq->getCqsConnectedCount());
- ASSERT(myStatusCq->getNumInserts() == 5,
- "incorrect number of CqStatus Updates count.");
- ASSERT(myStatusCq->getCqsConnectedCount() == 1,
- "incorrect number of CqStatus Connected count.");
-
- MyCqListener* myCq = dynamic_cast<MyCqListener*>(vl[0].get());
- LOGINFO("No of insert events = %d ", myCq->getNumInserts());
- ASSERT(myCq->getNumInserts() == 5,
- "incorrect number of CqStatus Updates count.");
-
- auto cqAttrMtor = cq->getCqAttributesMutator();
- auto ptr = vl[0];
- cqAttrMtor.removeCqListener(ptr);
- vl = cqAttr->getCqListeners();
- LOGINFO("number of listeners = %d", vl.size());
-
- ASSERT(vl.size() == 1, "incorrect number of listeners");
-
- cqAttrMtor.removeCqListener(vl[0]);
- LOGINFO("removeCqListener again");
- vl = cqAttr->getCqListeners();
- LOGINFO("number of listeners = %d", vl.size());
-
- ASSERT(vl.size() == 0, "incorrect number of listeners");
-
- std::vector<std::shared_ptr<CqListener>> v2;
- v2.push_back(cqStatusLstner);
- v2.push_back(cqLstner);
- cqAttrMtor.setCqListeners(v2);
- LOG("ProcessCQ setCqListeneres done.");
-
- cqAttr = cq->getCqAttributes();
- auto vl3 = cqAttr->getCqListeners();
- ASSERT(vl3.size() == 2, "incorrect number of CqListeners count.");
-
- auto myStatusCq2 = std::dynamic_pointer_cast<MyCqStatusListener>(vl3[0]);
- myStatusCq2->clear();
-
- for (int i = 1; i <= 5; i++) {
- ACE_OS::snprintf(KeyStr, 256, "Key-%d ", i);
- ACE_OS::snprintf(valStr, 256, "val-%d ", i);
- auto keyport = CacheableKey::create(KeyStr);
- auto valport = CacheableString::create(valStr);
- regPtr0->put(keyport, valport);
- SLEEP(10 * 1000); // sleep a while to allow server query to complete
- }
- LOGINFO("putEntries complete again");
-
- std::vector<std::shared_ptr<CqListener>> vl21;
- vl21.push_back(cqStatusLstner);
- vl21.push_back(cqLstner);
- cqFac.initCqListeners(vl21);
- LOGINFO("initCqListeners complete.");
-
- cqAttr = cq->getCqAttributes();
- auto vl2 = cqAttr->getCqListeners();
- ASSERT(vl2.size() == 2, "incorrect number of CqListeners count.");
- myStatusCq2 = std::dynamic_pointer_cast<MyCqStatusListener>(vl2[0]);
- LOGINFO("No of insert events = %d ", myStatusCq2->getNumUpdates());
- LOGINFO("No of OnCqConnected events = %d ",
- myStatusCq2->getCqsConnectedCount());
- ASSERT(myStatusCq2->getNumUpdates() == 5,
- "incorrect number of CqStatus Updates count.");
- ASSERT(myStatusCq2->getCqsConnectedCount() == 0,
- "incorrect number of CqStatus Connected count.");
-
- auto myCq2 = std::dynamic_pointer_cast<MyCqListener>(vl2[1]);
- LOGINFO("No of insert events = %d ", myCq2->getNumInserts());
- ASSERT(myCq2->getNumUpdates() == 5,
- "incorrect number of CqStatus Updates count.");
-
- LOG("ProcessCQ complete.");
+ auto pool = getHelper()->getCache()->getPoolManager().find(regionName);
+ auto qs = pool->getQueryService();
+ CqAttributesFactory cqFac;
+ auto cqLstner = std::make_shared<MyCqListener>(1);
+ auto cqStatusLstner = std::make_shared<MyCqStatusListener>(100);
+ cqFac.addCqListener(cqLstner);
+ cqFac.addCqListener(cqStatusLstner);
+ auto cqAttr = cqFac.create();
+
+ auto cq = qs->newCq(const_cast<char*>(cqName), cqQueryStatusString, cqAttr);
+ cq->execute();
+ SLEEP(20000);
+ LOG("ProcessCQ Query executed.");
+
+ auto regPtr0 = getHelper()->getRegion(regionName);
+ std::shared_ptr<Cacheable> val = nullptr;
+ char KeyStr[256] = {0};
+ char valStr[256] = {0};
+ for (int i = 1; i <= 5; i++) {
+ ACE_OS::snprintf(KeyStr, 256, "Key-%d ", i);
+ ACE_OS::snprintf(valStr, 256, "val-%d ", i);
+ auto keyport = CacheableKey::create(KeyStr);
+ auto valport = CacheableString::create(valStr);
+ regPtr0->put(keyport, valport);
+ SLEEP(10 * 1000); // sleep a while to allow server query to complete
+ }
+ LOGINFO("putEntries complete");
+
+ cqAttr = cq->getCqAttributes();
+ auto vl = cqAttr->getCqListeners();
+ ASSERT(vl.size() == 2, "incorrect number of CqListeners count.");
+ MyCqStatusListener* myStatusCq =
+ dynamic_cast<MyCqStatusListener*>(vl[1].get());
+ LOGINFO("No of insert events = %d ", myStatusCq->getNumInserts());
+ LOGINFO("No of OnCqConnected events = %d ",
+ myStatusCq->getCqsConnectedCount());
+ ASSERT(myStatusCq->getNumInserts() == 5,
+ "incorrect number of CqStatus Updates count.");
+ ASSERT(myStatusCq->getCqsConnectedCount() == 1,
+ "incorrect number of CqStatus Connected count.");
+
+ MyCqListener* myCq = dynamic_cast<MyCqListener*>(vl[0].get());
+ LOGINFO("No of insert events = %d ", myCq->getNumInserts());
+ ASSERT(myCq->getNumInserts() == 5,
+ "incorrect number of CqStatus Updates count.");
+
+ auto cqAttrMtor = cq->getCqAttributesMutator();
+ auto ptr = vl[0];
+ cqAttrMtor.removeCqListener(ptr);
+ vl = cqAttr->getCqListeners();
+ LOGINFO("number of listeners = %d", vl.size());
+
+ ASSERT(vl.size() == 1, "incorrect number of listeners");
+
+ cqAttrMtor.removeCqListener(vl[0]);
+ LOGINFO("removeCqListener again");
+ vl = cqAttr->getCqListeners();
+ LOGINFO("number of listeners = %d", vl.size());
+
+ ASSERT(vl.size() == 0, "incorrect number of listeners");
+
+ std::vector<std::shared_ptr<CqListener>> v2;
+ v2.push_back(cqStatusLstner);
+ v2.push_back(cqLstner);
+ cqAttrMtor.setCqListeners(v2);
+ LOG("ProcessCQ setCqListeneres done.");
+
+ cqAttr = cq->getCqAttributes();
+ auto vl3 = cqAttr->getCqListeners();
+ ASSERT(vl3.size() == 2, "incorrect number of CqListeners count.");
+
+ auto myStatusCq2 = std::dynamic_pointer_cast<MyCqStatusListener>(vl3[0]);
+ myStatusCq2->clear();
+
+ for (int i = 1; i <= 5; i++) {
+ ACE_OS::snprintf(KeyStr, 256, "Key-%d ", i);
+ ACE_OS::snprintf(valStr, 256, "val-%d ", i);
+ auto keyport = CacheableKey::create(KeyStr);
+ auto valport = CacheableString::create(valStr);
+ regPtr0->put(keyport, valport);
+ SLEEP(10 * 1000); // sleep a while to allow server query to complete
+ }
+ LOGINFO("putEntries complete again");
+
+ std::vector<std::shared_ptr<CqListener>> vl21;
+ vl21.push_back(cqStatusLstner);
+ vl21.push_back(cqLstner);
+ cqFac.initCqListeners(vl21);
+ LOGINFO("initCqListeners complete.");
+
+ cqAttr = cq->getCqAttributes();
+ auto vl2 = cqAttr->getCqListeners();
+ ASSERT(vl2.size() == 2, "incorrect number of CqListeners count.");
+ myStatusCq2 = std::dynamic_pointer_cast<MyCqStatusListener>(vl2[0]);
+ LOGINFO("No of insert events = %d ", myStatusCq2->getNumUpdates());
+ LOGINFO("No of OnCqConnected events = %d ",
+ myStatusCq2->getCqsConnectedCount());
+ ASSERT(myStatusCq2->getNumUpdates() == 5,
+ "incorrect number of CqStatus Updates count.");
+ ASSERT(myStatusCq2->getCqsConnectedCount() == 0,
+ "incorrect number of CqStatus Connected count.");
+
+ auto myCq2 = std::dynamic_pointer_cast<MyCqListener>(vl2[1]);
+ LOGINFO("No of insert events = %d ", myCq2->getNumInserts());
+ ASSERT(myCq2->getNumUpdates() == 5,
+ "incorrect number of CqStatus Updates count.");
+
+ LOG("ProcessCQ complete.");
}
END_TASK_DEFINITION
diff --git a/cppcache/integration-test/testThinClientCqDelta.cpp b/cppcache/integration-test/testThinClientCqDelta.cpp
index ebb480c..075aa2f 100644
--- a/cppcache/integration-test/testThinClientCqDelta.cpp
+++ b/cppcache/integration-test/testThinClientCqDelta.cpp
@@ -161,7 +161,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaTestImpl::create);
+ serializationRegistry->addDataSerializableType(DeltaTestImpl::create, 30);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -178,7 +178,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaTestImpl::create);
+ serializationRegistry->addDataSerializableType(DeltaTestImpl::create, 30);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -208,7 +208,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1_NoPools)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaTestImpl::create);
+ serializationRegistry->addDataSerializableType(DeltaTestImpl::create, 30);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -224,7 +224,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_NoPools)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaTestImpl::create);
+ serializationRegistry->addDataSerializableType(DeltaTestImpl::create, 30);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
diff --git a/cppcache/integration-test/testThinClientCqDurable.cpp b/cppcache/integration-test/testThinClientCqDurable.cpp
index b70652a..80ba7c5 100644
--- a/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -85,11 +85,15 @@ void initClientWithId(int ClientIdx, bool typeRegistered = false) {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientCqFailover.cpp b/cppcache/integration-test/testThinClientCqFailover.cpp
index afcb4aa..51940e7 100644
--- a/cppcache/integration-test/testThinClientCqFailover.cpp
+++ b/cppcache/integration-test/testThinClientCqFailover.cpp
@@ -124,8 +124,10 @@ void initClientCq(const bool isthinClient) {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -160,7 +162,8 @@ void stepOne() {
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
QueryHelper* qh = &QueryHelper::getHelper();
@@ -178,7 +181,8 @@ void stepOne2() {
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
@@ -224,8 +228,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
SLEEP(15000);
} catch (IllegalStateException& ise) {
char isemsg[500] = {0};
- ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s",
- ise.what());
+ ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what());
LOG(isemsg);
FAIL(isemsg);
} catch (Exception& excp) {
diff --git a/cppcache/integration-test/testThinClientCqHAFailover.cpp b/cppcache/integration-test/testThinClientCqHAFailover.cpp
index 888d267..e01d41a 100644
--- a/cppcache/integration-test/testThinClientCqHAFailover.cpp
+++ b/cppcache/integration-test/testThinClientCqHAFailover.cpp
@@ -123,8 +123,10 @@ void initClientCq() {
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -227,7 +229,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
auto count = results->size();
sprintf(buf, "results size=%zd", count);
LOG(buf);
- for (auto&& ser: hacks::range(*results)) {
+ for (auto&& ser : hacks::range(*results)) {
count--;
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(ser)) {
printf(" query pulled portfolio object ID %d, pkid %s\n",
@@ -238,9 +240,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
position->getSharesOutstanding());
} else if (ser) {
printf(" query pulled object %s\n", ser->toString().c_str());
- } else {
- printf(" query pulled nullptr object\n");
- }
+ } else {
+ printf(" query pulled nullptr object\n");
+ }
}
sprintf(buf, "results last count=%zd", count);
LOG(buf);
diff --git a/cppcache/integration-test/testThinClientCqIR.cpp b/cppcache/integration-test/testThinClientCqIR.cpp
index 2704700..39343b4 100644
--- a/cppcache/integration-test/testThinClientCqIR.cpp
+++ b/cppcache/integration-test/testThinClientCqIR.cpp
@@ -60,11 +60,15 @@ void initClientCq(const bool isthinClient) {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientDeltaWithNotification.cpp b/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
index d25fc3d..6579e19 100644
--- a/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
+++ b/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
@@ -202,7 +202,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1_Init)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore type reregistration exception.
}
@@ -216,7 +216,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, Client2_Init)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore type reregistration exception.
}
diff --git a/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/cppcache/integration-test/testThinClientHAQueryFailover.cpp
index 0201a93..6b466dd 100644
--- a/cppcache/integration-test/testThinClientHAQueryFailover.cpp
+++ b/cppcache/integration-test/testThinClientHAQueryFailover.cpp
@@ -93,8 +93,10 @@ void initClient() {
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Portfolio::createDeserializable);
- serializationRegistry->addType(Position::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore reregistration exception
}
diff --git a/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp b/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
index 97ce2f7..cbeb413 100644
--- a/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
+++ b/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
@@ -92,17 +92,17 @@ class CallbackListener : public CacheListener {
auto callbkArg = std::dynamic_pointer_cast<Portfolio>(eventCallback);
- auto fromCallback = callbkArg->getPkid();
- auto mCallback = mCallbkArg->getPkid();
+ auto fromCallback = callbkArg->getPkid();
+ auto mCallback = mCallbkArg->getPkid();
- LOGFINE(" values are %s === %s ", fromCallback->value().c_str(),
- mCallback->value().c_str());
+ LOGFINE(" values are %s === %s ", fromCallback->value().c_str(),
+ mCallback->value().c_str());
- if (*(fromCallback.get()) == *(mCallback.get())) {
- LOGFINE("values are same");
- updateEvent++;
- } else {
- LOGFINE("values are NOT same");
+ if (*(fromCallback.get()) == *(mCallback.get())) {
+ LOGFINE("values are same");
+ updateEvent++;
+ } else {
+ LOGFINE("values are NOT same");
}
} catch (const ClassCastException& ex) {
LOGFINE(" in class cast exception %s ", ex.what());
@@ -164,190 +164,199 @@ class CallbackListener : public CacheListener {
}
};
//---------------------------------------------------------------------------------
- std::shared_ptr<CallbackListener> reg1Listener1 = nullptr;
- std::shared_ptr<CacheableString> callBackStrPtr;
- std::shared_ptr<Cacheable> callBackPortFolioPtr;
-
- void setCacheListener(const char* regName,
- std::shared_ptr<CallbackListener> regListener) {
- auto reg = getHelper()->getRegion(regName);
- auto attrMutator = reg->getAttributesMutator();
- attrMutator->setCacheListener(regListener);
- }
-
- void validateEventCount(int line) {
- LOGINFO("ValidateEvents called from line (%d).", line);
- int num = reg1Listener1->getCreates();
- char buf[1024];
- sprintf(buf, "Didn't get expected callback arg in aftercreate event");
- ASSERT(7 == num, buf);
- num = reg1Listener1->getUpdates();
- sprintf(buf, "Didn't get expected callback arg in afterupdate events");
- ASSERT(3 == num, buf);
- num = reg1Listener1->getInvalidates();
- sprintf(buf, "Didn't get expected callback arg in afterInvalidates events");
- ASSERT(2 == num, buf);
- num = reg1Listener1->getDestroys();
- sprintf(buf, "Didn't get expected callback arg in afterdestroy events");
- ASSERT(5 == num, buf);
- num = reg1Listener1->getRegionInvalidates();
- sprintf(buf,
- "Didn't get expected callback arg in afterRegionInvalidates events");
- ASSERT(1 == num, buf);
- num = reg1Listener1->getRegionDestroys();
- sprintf(buf,
- "Didn't get expected callback arg in afterRegiondestroy events");
- ASSERT(1 == num, buf);
- num = reg1Listener1->getRegionClear();
- sprintf(buf, "Didn't get expected callback arg in afterRegionClear events");
- ASSERT(1 == num, buf);
- }
-
- DUNIT_TASK_DEFINITION(SERVER1, StartServer)
- {
- if (isLocalServer) {
- CacheHelper::initServer(1, "cacheserver_notify_subscription5.xml");
- }
- LOG("SERVER started");
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
- {
- initClient(true);
-
- callBackStrPtr = CacheableString::create("Gemstone's Callback");
-
- createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
- "__TEST_POOL1__", true /*client notification*/);
- auto serializationRegistry =
- CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
- ->getSerializationRegistry();
- serializationRegistry->addType(Portfolio::createDeserializable);
- serializationRegistry->addType(Position::createDeserializable);
- reg1Listener1 = std::make_shared<CallbackListener>();
- callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
-
- reg1Listener1->setCallBackArg(callBackPortFolioPtr);
- setCacheListener(regionNames[0], reg1Listener1);
- auto regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys();
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2_Pool_Locator)
- {
- initClient(true);
-
- callBackStrPtr = CacheableString::create("Gemstone's Callback");
-
- createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
- "__TEST_POOL1__", true /*client notification*/);
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT2, testCreatesAndUpdates)
- {
- auto regPtr = getHelper()->getRegion(regionNames[0]);
-
- callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
- regPtr->create("aaa", "bbb", callBackPortFolioPtr);
- regPtr->create(keys[1], vals[1], callBackPortFolioPtr);
- regPtr->put(keys[1], nvals[1], callBackPortFolioPtr);
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT1, testInvalidates)
- {
- auto regPtr = getHelper()->getRegion(regionNames[0]);
-
- callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
- regPtr->localCreate(1234, 1234, callBackPortFolioPtr);
- regPtr->localCreate(12345, 12345, callBackPortFolioPtr);
- regPtr->localCreate(12346, 12346, callBackPortFolioPtr);
- regPtr->localPut(1234, vals[1], callBackPortFolioPtr);
- regPtr->localInvalidate(1234, callBackPortFolioPtr);
- ASSERT(regPtr->localRemove(12345, 12345, callBackPortFolioPtr) == true,
- "Result of remove should be true, as this value exists locally.");
- ASSERT(regPtr->containsKey(12345) == false, "containsKey should be false");
- ASSERT(regPtr->localRemoveEx(12346, callBackPortFolioPtr) == true,
- "Result of remove should be true, as this value exists locally.");
- ASSERT(regPtr->containsKey(12346) == false, "containsKey should be false");
- regPtr->invalidate(keys[1], callBackPortFolioPtr);
- regPtr->invalidateRegion(callBackPortFolioPtr);
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT2, testDestroy)
- {
- auto regPtr = getHelper()->getRegion(regionNames[0]);
-
- callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
- regPtr->destroy(keys[1], callBackPortFolioPtr);
- ASSERT(regPtr->removeEx("aaa", callBackPortFolioPtr) == true,
- "Result of remove should be true, as this value exists.");
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT2, testRemove)
- {
- auto regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->remove(keys[1], nvals[1], callBackPortFolioPtr);
- regPtr->destroyRegion(callBackPortFolioPtr);
- }
- END_TASK_DEFINITION
- DUNIT_TASK_DEFINITION(CLIENT1, testlocalClear)
- {
- auto regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->localClear(callBackPortFolioPtr);
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT1, testValidate)
- {
- dunit::sleep(10000);
- validateEventCount(__LINE__);
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT1, StopClient1)
- {
- cleanProc();
- LOG("CLIENT1 stopped");
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(CLIENT2, StopClient2)
- {
- cleanProc();
- LOG("CLIENT2 stopped");
- }
- END_TASK_DEFINITION
-
- DUNIT_TASK_DEFINITION(SERVER1, StopServer)
- {
- if (isLocalServer) CacheHelper::closeServer(1);
- LOG("SERVER stopped");
- }
- END_TASK_DEFINITION
-
- DUNIT_MAIN
- {
- CALL_TASK(CreateLocator1);
- CALL_TASK(CreateServer1_With_Locator_XML5)
-
- CALL_TASK(SetupClient1_Pool_Locator);
- CALL_TASK(SetupClient2_Pool_Locator);
- CALL_TASK(testCreatesAndUpdates);
- CALL_TASK(testInvalidates);
- CALL_TASK(testDestroy);
- CALL_TASK(testCreatesAndUpdates);
- CALL_TASK(testlocalClear);
- CALL_TASK(testRemove);
- CALL_TASK(testValidate);
- CALL_TASK(StopClient1);
- CALL_TASK(StopClient2);
- CALL_TASK(StopServer);
- CALL_TASK(CloseLocator1);
- }
- END_MAIN
+std::shared_ptr<CallbackListener> reg1Listener1 = nullptr;
+std::shared_ptr<CacheableString> callBackStrPtr;
+std::shared_ptr<Cacheable> callBackPortFolioPtr;
+
+void setCacheListener(const char* regName,
+ std::shared_ptr<CallbackListener> regListener) {
+ auto reg = getHelper()->getRegion(regName);
+ auto attrMutator = reg->getAttributesMutator();
+ attrMutator->setCacheListener(regListener);
+}
+
+void validateEventCount(int line) {
+ LOGINFO("ValidateEvents called from line (%d).", line);
+ int num = reg1Listener1->getCreates();
+ char buf[1024];
+ sprintf(buf, "Didn't get expected callback arg in aftercreate event");
+ ASSERT(7 == num, buf);
+ num = reg1Listener1->getUpdates();
+ sprintf(buf, "Didn't get expected callback arg in afterupdate events");
+ ASSERT(3 == num, buf);
+ num = reg1Listener1->getInvalidates();
+ sprintf(buf, "Didn't get expected callback arg in afterInvalidates events");
+ ASSERT(2 == num, buf);
+ num = reg1Listener1->getDestroys();
+ sprintf(buf, "Didn't get expected callback arg in afterdestroy events");
+ ASSERT(5 == num, buf);
+ num = reg1Listener1->getRegionInvalidates();
+ sprintf(buf,
+ "Didn't get expected callback arg in afterRegionInvalidates events");
+ ASSERT(1 == num, buf);
+ num = reg1Listener1->getRegionDestroys();
+ sprintf(buf, "Didn't get expected callback arg in afterRegiondestroy events");
+ ASSERT(1 == num, buf);
+ num = reg1Listener1->getRegionClear();
+ sprintf(buf, "Didn't get expected callback arg in afterRegionClear events");
+ ASSERT(1 == num, buf);
+}
+
+DUNIT_TASK_DEFINITION(SERVER1, StartServer)
+ {
+ if (isLocalServer) {
+ CacheHelper::initServer(1, "cacheserver_notify_subscription5.xml");
+ }
+ LOG("SERVER started");
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
+ {
+ initClient(true);
+
+ callBackStrPtr = CacheableString::create("Gemstone's Callback");
+
+ createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
+ "__TEST_POOL1__", true /*client notification*/);
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ reg1Listener1 = std::make_shared<CallbackListener>();
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
+
+ reg1Listener1->setCallBackArg(callBackPortFolioPtr);
+ setCacheListener(regionNames[0], reg1Listener1);
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
+ regPtr->registerAllKeys();
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2_Pool_Locator)
+ {
+ initClient(true);
+
+ callBackStrPtr = CacheableString::create("Gemstone's Callback");
+
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+
+ createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
+ "__TEST_POOL1__", true /*client notification*/);
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT2, testCreatesAndUpdates)
+ {
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
+
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
+ regPtr->create("aaa", "bbb", callBackPortFolioPtr);
+ regPtr->create(keys[1], vals[1], callBackPortFolioPtr);
+ regPtr->put(keys[1], nvals[1], callBackPortFolioPtr);
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT1, testInvalidates)
+ {
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
+
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
+ regPtr->localCreate(1234, 1234, callBackPortFolioPtr);
+ regPtr->localCreate(12345, 12345, callBackPortFolioPtr);
+ regPtr->localCreate(12346, 12346, callBackPortFolioPtr);
+ regPtr->localPut(1234, vals[1], callBackPortFolioPtr);
+ regPtr->localInvalidate(1234, callBackPortFolioPtr);
+ ASSERT(regPtr->localRemove(12345, 12345, callBackPortFolioPtr) == true,
+ "Result of remove should be true, as this value exists locally.");
+ ASSERT(regPtr->containsKey(12345) == false, "containsKey should be false");
+ ASSERT(regPtr->localRemoveEx(12346, callBackPortFolioPtr) == true,
+ "Result of remove should be true, as this value exists locally.");
+ ASSERT(regPtr->containsKey(12346) == false, "containsKey should be false");
+ regPtr->invalidate(keys[1], callBackPortFolioPtr);
+ regPtr->invalidateRegion(callBackPortFolioPtr);
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT2, testDestroy)
+ {
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
+
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
+ regPtr->destroy(keys[1], callBackPortFolioPtr);
+ ASSERT(regPtr->removeEx("aaa", callBackPortFolioPtr) == true,
+ "Result of remove should be true, as this value exists.");
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT2, testRemove)
+ {
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
+ regPtr->remove(keys[1], nvals[1], callBackPortFolioPtr);
+ regPtr->destroyRegion(callBackPortFolioPtr);
+ }
+END_TASK_DEFINITION
+DUNIT_TASK_DEFINITION(CLIENT1, testlocalClear)
+ {
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
+ regPtr->localClear(callBackPortFolioPtr);
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT1, testValidate)
+ {
+ dunit::sleep(10000);
+ validateEventCount(__LINE__);
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT1, StopClient1)
+ {
+ cleanProc();
+ LOG("CLIENT1 stopped");
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT2, StopClient2)
+ {
+ cleanProc();
+ LOG("CLIENT2 stopped");
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(SERVER1, StopServer)
+ {
+ if (isLocalServer) CacheHelper::closeServer(1);
+ LOG("SERVER stopped");
+ }
+END_TASK_DEFINITION
+
+DUNIT_MAIN
+ {
+ CALL_TASK(CreateLocator1);
+ CALL_TASK(CreateServer1_With_Locator_XML5)
+
+ CALL_TASK(SetupClient1_Pool_Locator);
+ CALL_TASK(SetupClient2_Pool_Locator);
+ CALL_TASK(testCreatesAndUpdates);
+ CALL_TASK(testInvalidates);
+ CALL_TASK(testDestroy);
+ CALL_TASK(testCreatesAndUpdates);
+ CALL_TASK(testlocalClear);
+ CALL_TASK(testRemove);
+ CALL_TASK(testValidate);
+ CALL_TASK(StopClient1);
+ CALL_TASK(StopClient2);
+ CALL_TASK(StopServer);
+ CALL_TASK(CloseLocator1);
+ }
+END_MAIN
diff --git a/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp b/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
index 689af59..0ff127e 100644
--- a/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
+++ b/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
@@ -115,7 +115,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -130,7 +130,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1_NoPools)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -163,7 +163,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_NoPools)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
diff --git a/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp b/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
index 12662a2..261bbb8 100644
--- a/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
+++ b/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
@@ -199,7 +199,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1_PdxInit)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(PdxDeltaEx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxDeltaEx::createDeserializable);
} catch (IllegalStateException&) {
// ignore type reregistration exception.
}
@@ -212,7 +213,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, Client2_PdxInit)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(PdxDeltaEx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxDeltaEx::createDeserializable);
} catch (IllegalStateException&) {
// ignore type reregistration exception.
}
diff --git a/cppcache/integration-test/testThinClientPdxEnum.cpp b/cppcache/integration-test/testThinClientPdxEnum.cpp
index 3338502..8491903 100644
--- a/cppcache/integration-test/testThinClientPdxEnum.cpp
+++ b/cppcache/integration-test/testThinClientPdxEnum.cpp
@@ -106,7 +106,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxEnumQuery)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(PdxEnumTestClass::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxEnumTestClass::createDeserializable);
LOG("PdxEnumTestClass Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("PdxEnumTestClass IllegalStateException");
diff --git a/cppcache/integration-test/testThinClientPdxInstance.cpp b/cppcache/integration-test/testThinClientPdxInstance.cpp
index 2509627..bc812b2 100644
--- a/cppcache/integration-test/testThinClientPdxInstance.cpp
+++ b/cppcache/integration-test/testThinClientPdxInstance.cpp
@@ -261,7 +261,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithIdentityField)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(SerializePdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ SerializePdx::createDeserializable);
LOG("SerializePdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("SerializePdx IllegalStateException");
@@ -287,7 +288,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCacheableObjectArrayWithPdxFields)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
LOG("Address Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("Address IllegalStateException");
@@ -335,7 +337,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(SerializePdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ SerializePdx::createDeserializable);
LOG("SerializePdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("SerializePdx IllegalStateException");
@@ -457,7 +460,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyCacheableObjectArrayWithPdxField)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
LOG("Address Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("Address IllegalStateException");
@@ -576,7 +580,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -662,7 +666,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getObject)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -670,14 +674,16 @@ DUNIT_TASK_DEFINITION(CLIENT2, getObject)
}
try {
- serializationRegistry->addPdxType(ChildPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ ChildPdx::createDeserializable);
LOG("ChildPdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("ChildPdx IllegalStateException");
}
try {
- serializationRegistry->addPdxType(ParentPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ ParentPdx::createDeserializable);
LOG("ParentPdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("ParentPdx IllegalStateException");
@@ -796,7 +802,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxInstanceEquals)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -863,7 +869,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -871,7 +877,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
LOG("Address Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("Address IllegalStateException");
@@ -2217,14 +2224,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
LOG("Address Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("Address IllegalStateException");
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -2232,14 +2240,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
}
try {
- serializationRegistry->addPdxType(ChildPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ ChildPdx::createDeserializable);
LOG("ChildPdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("ChildPdx IllegalStateException");
}
try {
- serializationRegistry->addPdxType(ParentPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ ParentPdx::createDeserializable);
LOG("ParentPdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("ParentPdx IllegalStateException");
diff --git a/cppcache/integration-test/testThinClientPdxTests.cpp b/cppcache/integration-test/testThinClientPdxTests.cpp
index ce12ec2..16d6358 100644
--- a/cppcache/integration-test/testThinClientPdxTests.cpp
+++ b/cppcache/integration-test/testThinClientPdxTests.cpp
@@ -443,13 +443,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, testPdxWriterAPIsWithInvalidArgs)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(InvalidPdxUsage::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ InvalidPdxUsage::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
AddressWithInvalidAPIUsage::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -494,12 +495,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, testPdxReaderAPIsWithInvalidArgs)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(InvalidPdxUsage::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ InvalidPdxUsage::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
AddressWithInvalidAPIUsage::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -532,7 +534,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, testPutWithMultilevelInheritance)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTests::Child::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::Child::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -568,7 +571,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, testGetWithMultilevelInheritance)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTests::Child::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTests::Child::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -657,14 +661,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, JavaPutGet)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -694,13 +699,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, JavaGet)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -728,7 +734,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, putAtVersionTwoR21)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypesR2V2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -758,7 +764,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOneR22)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypesV1R2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -827,7 +833,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAtVersionOne31)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType3V1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -856,7 +862,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo32)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes3V2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -924,7 +930,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAtVersionOne21)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType2V1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -952,7 +958,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo22)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2V2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1019,7 +1025,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAtVersionOne11)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType1V1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1050,7 +1056,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, putAtVersionTwo1)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypesR1V2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1081,7 +1087,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne2)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypesV1R1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1186,7 +1192,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, putV2PdxUI)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypesIgnoreUnreadFieldsV2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1218,7 +1224,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putV1PdxUI)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypesIgnoreUnreadFieldsV1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1257,7 +1263,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo12)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1V2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1391,9 +1397,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Puts2)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1474,9 +1480,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, Get2)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1497,14 +1503,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyPdxInGet)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -1567,20 +1574,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyNestedPdxInGet)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(NestedPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ NestedPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1609,21 +1617,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutMixedVersionNestedPdx)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
MixedVersionNestedPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1657,59 +1665,68 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyPdxInGFSInGet)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addType(
- PdxInsideIGeodeSerializable::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ PdxInsideIGeodeSerializable::createDeserializable, 0x10);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(NestedPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ NestedPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -1736,59 +1753,68 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyPdxInGFSGetOnly)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addType(
- PdxInsideIGeodeSerializable::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ PdxInsideIGeodeSerializable::createDeserializable, 0x10);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(NestedPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ NestedPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -1815,21 +1841,21 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyMixedVersionNestedGetOnly)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
MixedVersionNestedPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1863,20 +1889,21 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyNestedGetOnly)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(NestedPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ NestedPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -1901,14 +1928,15 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyGetOnly)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -1959,58 +1987,68 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes9::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes9::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes10::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes10::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -2518,52 +2556,62 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAllPdxTypes)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes9::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes9::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes10::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes10::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -2690,7 +2738,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, client1PutsV1Object)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType3V1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -2712,7 +2760,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, client2GetsV1ObjectAndPutsV2Object)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxTypes3V2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -2800,52 +2848,62 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTypes1::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes1::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes2::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes2::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes3::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes3::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes4::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes4::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes5::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes5::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes6::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes6::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes7::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes7::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes8::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes8::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes9::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes9::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(PdxTypes10::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PdxTypes10::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -3325,7 +3383,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCharTypes)
->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::CharTypes::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -3359,7 +3417,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getCharTypes)
LOG("Trying to GET PDX objects.....\n");
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::CharTypes::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
@@ -3402,14 +3460,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
// QueryHelper * qh = &QueryHelper::getHelper();
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -3523,14 +3582,15 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
LOG("Trying to GET PDX objects.....\n");
try {
- serializationRegistry->addPdxType(
+ serializationRegistry->addPdxSerializableType(
PdxTests::PdxType::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
try {
- serializationRegistry->addPdxType(Address::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ Address::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientPutWithDelta.cpp b/cppcache/integration-test/testThinClientPutWithDelta.cpp
index 9b0866b..fa0e5f4 100644
--- a/cppcache/integration-test/testThinClientPutWithDelta.cpp
+++ b/cppcache/integration-test/testThinClientPutWithDelta.cpp
@@ -117,7 +117,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// ignore exception caused by type reregistration.
}
@@ -156,7 +156,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_DisableDelta)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(DeltaEx::create);
+ serializationRegistry->addDataSerializableType(DeltaEx::create, 1);
} catch (IllegalStateException&) {
// Ignore the exception caused by re-registration of DeltaEx.
}
diff --git a/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp b/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
index e8df38e..a2b7293 100644
--- a/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
+++ b/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
@@ -57,8 +57,10 @@ void initClient() {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp b/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
index bf839e9..e2a9e04 100644
--- a/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
+++ b/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
@@ -63,8 +63,10 @@ void clientOperations() {
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
index 28911ba..5a79605 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
@@ -125,11 +125,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterTypesAndCreatePoolAndRegion)
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
index 0076b58..9887132 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
@@ -121,11 +121,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterTypesAndCreatePoolAndRegion)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRemoteQueryRS.cpp b/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
index 3b39a16..ac041be 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
@@ -71,10 +71,14 @@ void stepOne() {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
index 9954c83..f44120e 100644
--- a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
@@ -232,11 +232,15 @@ void stepOne() {
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp b/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
index b5b6a27..8da8917 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
@@ -70,11 +70,15 @@ void stepOne() {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp b/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
index 0df1de5..3535d23 100644
--- a/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
+++ b/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
@@ -94,11 +94,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOnePoolLocator)
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
-
- serializationRegistry->addPdxType(PositionPdx::createDeserializable);
- serializationRegistry->addPdxType(PortfolioPdx::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
+
+ serializationRegistry->addPdxSerializableType(
+ PositionPdx::createDeserializable);
+ serializationRegistry->addPdxSerializableType(
+ PortfolioPdx::createDeserializable);
} catch (const IllegalStateException&) {
// ignore exception
}
@@ -112,7 +116,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOnePoolLocator)
createRegionAndAttachPool(qRegionNames[3], USE_ACK, poolNames[1]);
auto regptr = getHelper()->getRegion(qRegionNames[0]);
- auto subregPtr = regptr->createSubregion(qRegionNames[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(qRegionNames[1], regptr->getAttributes());
LOG("StepOne complete.");
}
diff --git a/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
index 37c16d3..7afc3d9 100644
--- a/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
@@ -166,8 +166,10 @@ void initClientCq(const bool isthinClient) {
auto serializationRegistry =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
->getSerializationRegistry();
- serializationRegistry->addType(Position::createDeserializable);
- serializationRegistry->addType(Portfolio::createDeserializable);
+ serializationRegistry->addDataSerializableType(
+ Position::createDeserializable, 2);
+ serializationRegistry->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp b/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
index a007cb3..8874401 100644
--- a/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
@@ -171,10 +171,10 @@ void initClientCq(const bool isthinClient, int clientIdx) {
try {
CacheImpl* cacheImpl =
CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get());
- cacheImpl->getSerializationRegistry()->addType(
- Position::createDeserializable);
- cacheImpl->getSerializationRegistry()->addType(
- Portfolio::createDeserializable);
+ cacheImpl->getSerializationRegistry()->addDataSerializableType(
+ Position::createDeserializable, 2);
+ cacheImpl->getSerializationRegistry()->addDataSerializableType(
+ Portfolio::createDeserializable, 3);
} catch (const IllegalStateException&) {
// ignore exception
}
diff --git a/cppcache/src/BucketServerLocation.hpp b/cppcache/src/BucketServerLocation.hpp
index ac27d08..9c44f2a 100644
--- a/cppcache/src/BucketServerLocation.hpp
+++ b/cppcache/src/BucketServerLocation.hpp
@@ -83,7 +83,7 @@ class BucketServerLocation : public ServerLocation {
// TODO: should fail here since m_numServerGroups is int8_t?
}
m_serverGroups = CacheableStringArray::create(
- std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + size));
+ std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + size));
m_numServerGroups = static_cast<int8_t>(size);
} else {
m_serverGroups = nullptr;
@@ -124,9 +124,9 @@ class BucketServerLocation : public ServerLocation {
}
}
if (m_numServerGroups > 0) {
- m_serverGroups =
- CacheableStringArray::create(
- std::vector<std::shared_ptr<CacheableString>>(serverGroups, serverGroups + m_numServerGroups));
+ m_serverGroups = CacheableStringArray::create(
+ std::vector<std::shared_ptr<CacheableString>>(
+ serverGroups, serverGroups + m_numServerGroups));
}
}
@@ -134,8 +134,6 @@ class BucketServerLocation : public ServerLocation {
return sizeof(int32_t) + sizeof(bool) + sizeof(int8_t);
}
- int8_t getInternalId() const override { return 0; }
-
BucketServerLocation& operator=(const BucketServerLocation& rhs) {
if (this == &rhs) return *this;
this->m_serverName = rhs.m_serverName;
@@ -162,7 +160,9 @@ class BucketServerLocation : public ServerLocation {
this->m_serverGroups = rhs.m_serverGroups;
}
- inline std::shared_ptr<CacheableStringArray> getServerGroups() { return m_serverGroups; }
+ inline std::shared_ptr<CacheableStringArray> getServerGroups() {
+ return m_serverGroups;
+ }
};
} // namespace client
diff --git a/cppcache/src/CacheFactory.cpp b/cppcache/src/CacheFactory.cpp
index 5d203f7..a0c6eb9 100644
--- a/cppcache/src/CacheFactory.cpp
+++ b/cppcache/src/CacheFactory.cpp
@@ -100,23 +100,25 @@ Cache CacheFactory::create() const {
const auto& memberListForVersionStamp =
std::ref(*(cacheImpl->getMemberListForVersionStamp()));
- serializationRegistry->addType2(
+ serializationRegistry->addDataSerializableFixedIdType(
std::bind(TXCommitMessage::create, memberListForVersionStamp));
- serializationRegistry->addType(
- //TODO: This looks like the only thing to do here, but I'm not sure
- static_cast<int64_t>(DSCode::PdxType),
- std::bind(PdxType::CreateDeserializable, std::ref(*pdxTypeRegistry)));
+ serializationRegistry->setDataSerializablePrimitiveType(
+ // TODO: This looks like the only thing to do here, but I'm not sure
+ std::bind(PdxType::CreateDeserializable, std::ref(*pdxTypeRegistry)),
+ DSCode::PdxType);
- serializationRegistry->addType2(
+ serializationRegistry->addDataSerializableFixedIdType(
std::bind(VersionTag::createDeserializable, memberListForVersionStamp));
- serializationRegistry->addType2(
+ serializationRegistry->addDataSerializableFixedIdType(
static_cast<int64_t>(DSFid::DiskVersionTag),
std::bind(DiskVersionTag::createDeserializable,
memberListForVersionStamp));
serializationRegistry->setPdxTypeHandler(new PdxTypeHandler());
+ serializationRegistry->setDataSerializableHandler(
+ new DataSerializableHandler());
pdxTypeRegistry->setPdxIgnoreUnreadFields(cache.getPdxIgnoreUnreadFields());
pdxTypeRegistry->setPdxReadSerialized(cache.getPdxReadSerialized());
diff --git a/cppcache/src/CacheableToken.cpp b/cppcache/src/CacheableToken.cpp
index 496863a..5fd0ab3 100644
--- a/cppcache/src/CacheableToken.cpp
+++ b/cppcache/src/CacheableToken.cpp
@@ -50,12 +50,6 @@ void CacheableToken::fromData(DataInput& input) {
m_value = static_cast<TokenType>(input.readInt32());
}
-int8_t CacheableToken::getInternalId() const {
- return static_cast<int8_t>(DSCode::CacheableToken);
-}
-
-//------ ctor
-
CacheableToken::CacheableToken() : m_value(CacheableToken::NOT_USED) {}
CacheableToken::CacheableToken(TokenType value) : m_value(value) {}
diff --git a/cppcache/src/CacheableToken.hpp b/cppcache/src/CacheableToken.hpp
index a800332..ff853c8 100644
--- a/cppcache/src/CacheableToken.hpp
+++ b/cppcache/src/CacheableToken.hpp
@@ -72,8 +72,6 @@ class APACHE_GEODE_EXPORT CacheableToken
*/
static std::shared_ptr<Serializable> createDeserializable();
- virtual int8_t getInternalId() const override;
-
~CacheableToken() override = default;
inline bool isInvalid() { return m_value == INVALID; }
diff --git a/cppcache/src/DataOutput.cpp b/cppcache/src/DataOutput.cpp
index 31844ad..0b713ba 100644
--- a/cppcache/src/DataOutput.cpp
+++ b/cppcache/src/DataOutput.cpp
@@ -125,11 +125,8 @@ void DataOutput::checkinBuffer(uint8_t* buffer, size_t size) {
TSSDataOutput::s_tssDataOutput->poolBuffer(buffer, size);
}
-void DataOutput::writeObjectInternal(const Serializable* ptr, bool isDelta) {
- getSerializationRegistry().serialize(ptr, *this, isDelta);
-}
-
-void DataOutput::writeObjectInternal(const std::shared_ptr<Serializable>& ptr, bool isDelta) {
+void DataOutput::writeObjectInternal(const std::shared_ptr<Serializable>& ptr,
+ bool isDelta) {
getSerializationRegistry().serialize(ptr, *this, isDelta);
}
diff --git a/cppcache/src/FixedPartitionAttributesImpl.hpp b/cppcache/src/FixedPartitionAttributesImpl.hpp
index 6ac972d..f9b6ab0 100644
--- a/cppcache/src/FixedPartitionAttributesImpl.hpp
+++ b/cppcache/src/FixedPartitionAttributesImpl.hpp
@@ -71,8 +71,6 @@ class FixedPartitionAttributesImpl : public internal::DataSerializableInternal {
sizeof(decltype(m_partitionName)::value_type));
}
- int8_t getInternalId() const override { return 0; }
-
FixedPartitionAttributesImpl& operator=(
const FixedPartitionAttributesImpl& rhs) {
if (this == &rhs) return *this;
diff --git a/cppcache/src/GetAllServersResponse.cpp b/cppcache/src/GetAllServersResponse.cpp
index 78a82eb..4447634 100644
--- a/cppcache/src/GetAllServersResponse.cpp
+++ b/cppcache/src/GetAllServersResponse.cpp
@@ -21,18 +21,18 @@ namespace geode {
namespace client {
void GetAllServersResponse::toData(DataOutput& output) const {
- int32_t length = static_cast<int32_t>(m_servers.size());
- output.writeInt(length);
- for (int32_t i = 0; i < length; i++) {
- output.writeObject(&m_servers.at(i));
+ int32_t numServers = static_cast<int32_t>(m_servers.size());
+ output.writeInt(numServers);
+ for (int32_t i = 0; i < numServers; i++) {
+ output.writeObject(m_servers.at(i));
}
}
void GetAllServersResponse::fromData(DataInput& input) {
- int length = input.readInt32();
- LOGFINER("GetAllServersResponse::fromData length = %d ", length);
- for (int i = 0; i < length; i++) {
- ServerLocation sLoc;
- sLoc.fromData(input);
+ int numServers = input.readInt32();
+ LOGFINER("GetAllServersResponse::fromData length = %d ", numServers);
+ for (int i = 0; i < numServers; i++) {
+ std::shared_ptr<ServerLocation> sLoc = std::make_shared<ServerLocation>();
+ sLoc->fromData(input);
m_servers.push_back(sLoc);
}
}
diff --git a/cppcache/src/GetAllServersResponse.hpp b/cppcache/src/GetAllServersResponse.hpp
index 3043711..c7a92ea 100644
--- a/cppcache/src/GetAllServersResponse.hpp
+++ b/cppcache/src/GetAllServersResponse.hpp
@@ -34,7 +34,7 @@ namespace client {
class GetAllServersResponse : public internal::DataSerializableFixedId_t<
internal::DSFid::GetAllServersResponse> {
- std::vector<ServerLocation> m_servers;
+ std::vector<std::shared_ptr<ServerLocation> > m_servers;
public:
static std::shared_ptr<Serializable> create() {
@@ -47,7 +47,9 @@ class GetAllServersResponse : public internal::DataSerializableFixedId_t<
size_t objectSize() const override {
return sizeof(GetAllServersResponse) + m_servers.capacity();
}
- std::vector<ServerLocation> getServers() { return m_servers; }
+ std::vector<std::shared_ptr<ServerLocation> > getServers() {
+ return m_servers;
+ }
~GetAllServersResponse() override = default;
};
diff --git a/cppcache/src/PdxFieldType.hpp b/cppcache/src/PdxFieldType.hpp
index 36e5954..bbef230 100644
--- a/cppcache/src/PdxFieldType.hpp
+++ b/cppcache/src/PdxFieldType.hpp
@@ -89,10 +89,6 @@ class APACHE_GEODE_EXPORT PdxFieldType
virtual void fromData(DataInput& input) override;
- virtual int8_t getInternalId() const override {
- return static_cast<int32_t>(m_typeId);
- }
-
virtual size_t objectSize() const override {
auto size = sizeof(PdxFieldType);
size += m_className.length();
diff --git a/cppcache/src/PdxHelper.cpp b/cppcache/src/PdxHelper.cpp
index c231185..684cef8 100644
--- a/cppcache/src/PdxHelper.cpp
+++ b/cppcache/src/PdxHelper.cpp
@@ -155,7 +155,7 @@ std::shared_ptr<PdxSerializable> PdxHelper::deserializePdx(DataInput& dataInput,
LOGDEBUG("deserializePdx ClassName = " + pdxClassname +
", isLocal = " + std::to_string(pType->isLocal()));
- pdxObjectptr = serializationRegistry->getPdxType(pdxClassname);
+ pdxObjectptr = serializationRegistry->getPdxSerializableType(pdxClassname);
if (pType->isLocal()) // local type no need to read Unread data
{
auto plr = PdxLocalReader(dataInput, pType, length, pdxTypeRegistry);
@@ -190,7 +190,8 @@ std::shared_ptr<PdxSerializable> PdxHelper::deserializePdx(DataInput& dataInput,
* Fix : Commented the line
*/
// pdxClassname = pType->getPdxClassName();
- pdxObjectptr = serializationRegistry->getPdxType(pType->getPdxClassName());
+ pdxObjectptr =
+ serializationRegistry->getPdxSerializableType(pType->getPdxClassName());
auto pdxRealObject = pdxObjectptr;
if (pdxLocalType == nullptr) // need to know local type
{
diff --git a/cppcache/src/PdxType.hpp b/cppcache/src/PdxType.hpp
index f6395eb..2d45a46 100644
--- a/cppcache/src/PdxType.hpp
+++ b/cppcache/src/PdxType.hpp
@@ -113,8 +113,6 @@ class PdxType : public internal::DataSerializableInternal,
void fromData(DataInput& input) override;
- int8_t getInternalId() const override { return static_cast<int8_t>(DSCode::PdxType); }
-
static std::shared_ptr<Serializable> CreateDeserializable(
PdxTypeRegistry& pdxTypeRegistry) {
return std::make_shared<PdxType>(pdxTypeRegistry, "", false);
diff --git a/cppcache/src/RegionAttributes.cpp b/cppcache/src/RegionAttributes.cpp
index cdb1bef..afe7f39 100644
--- a/cppcache/src/RegionAttributes.cpp
+++ b/cppcache/src/RegionAttributes.cpp
@@ -136,7 +136,8 @@ std::shared_ptr<CacheListener> RegionAttributes::getCacheListener() const {
return m_cacheListener;
}
-std::shared_ptr<PartitionResolver> RegionAttributes::getPartitionResolver() const {
+std::shared_ptr<PartitionResolver> RegionAttributes::getPartitionResolver()
+ const {
if (!m_partitionResolver && !m_partitionResolverLibrary.empty()) {
if (CacheXmlParser::managedPartitionResolverFn &&
m_partitionResolverFactory.find('.') != std::string::npos) {
@@ -155,7 +156,8 @@ std::shared_ptr<PartitionResolver> RegionAttributes::getPartitionResolver() cons
return m_partitionResolver;
}
-std::shared_ptr<PersistenceManager> RegionAttributes::getPersistenceManager() const {
+std::shared_ptr<PersistenceManager> RegionAttributes::getPersistenceManager()
+ const {
if (!m_persistenceManager && !m_persistenceLibrary.empty()) {
if (CacheXmlParser::managedPartitionResolverFn &&
m_persistenceFactory.find('.') != std::string::npos) {
@@ -272,18 +274,12 @@ uint32_t RegionAttributes::getLruEntriesLimit() const {
return m_lruEntriesLimit;
}
-DiskPolicyType RegionAttributes::getDiskPolicy() const {
- return m_diskPolicy;
-}
+DiskPolicyType RegionAttributes::getDiskPolicy() const { return m_diskPolicy; }
std::shared_ptr<Serializable> RegionAttributes::createDeserializable() {
return std::make_shared<RegionAttributes>();
}
-int8_t RegionAttributes::getInternalId() const {
- return static_cast<int8_t>(DSCode::RegionAttributes);
-}
-
namespace impl {
void writeBool(DataOutput& out, bool field) {
diff --git a/cppcache/src/SerializableHelper.hpp b/cppcache/src/SerializableHelper.hpp
index acc16a0..a6d7bec 100644
--- a/cppcache/src/SerializableHelper.hpp
+++ b/cppcache/src/SerializableHelper.hpp
@@ -82,7 +82,7 @@ inline bool SerializableHelper<DataSerializablePrimitive>::metadataEqualTo(
template <>
inline bool SerializableHelper<DataSerializable>::metadataEqualTo(
const DataSerializable& lhs, const DataSerializable& rhs) {
- return lhs.getClassId() == rhs.getClassId();
+ return lhs.getType() == rhs.getType();
}
template <>
@@ -94,7 +94,7 @@ inline bool SerializableHelper<PdxSerializable>::equalTo(
template <>
inline bool SerializableHelper<DataSerializableInternal>::metadataEqualTo(
const DataSerializableInternal& lhs, const DataSerializableInternal& rhs) {
- return lhs.getInternalId() == rhs.getInternalId();
+ return true;
}
} // namespace client
diff --git a/cppcache/src/SerializationRegistry.cpp b/cppcache/src/SerializationRegistry.cpp
index 15e93d3..ea2b5ad 100644
--- a/cppcache/src/SerializationRegistry.cpp
+++ b/cppcache/src/SerializationRegistry.cpp
@@ -58,6 +58,7 @@
#include "DiskStoreId.hpp"
#include "DiskVersionTag.hpp"
#include "PdxHelper.hpp"
+#include "CacheRegionHelper.hpp"
namespace apache {
namespace geode {
@@ -67,71 +68,101 @@ void TheTypeMap::setup() {
// Register Geode builtins here!!
// update type ids in DSCode.hpp
- bind(CacheableByte::createDeserializable);
- bind(CacheableBoolean::createDeserializable);
- bind(BooleanArray::createDeserializable);
- bind(CacheableBytes::createDeserializable);
- bind(CacheableFloat::createDeserializable);
- bind(CacheableFloatArray::createDeserializable);
- bind(CacheableDouble::createDeserializable);
- bind(CacheableDoubleArray::createDeserializable);
- bind(CacheableDate::createDeserializable);
- bind(CacheableFileName::createDeserializable);
- bind(CacheableHashMap::createDeserializable);
- bind(CacheableHashSet::createDeserializable);
- bind(CacheableHashTable::createDeserializable);
- bind(CacheableIdentityHashMap::createDeserializable);
- bind(CacheableLinkedHashSet::createDeserializable);
- bind(CacheableInt16::createDeserializable);
- bind(CacheableInt16Array::createDeserializable);
- bind(CacheableInt32::createDeserializable);
- bind(CacheableInt32Array::createDeserializable);
- bind(CacheableInt64::createDeserializable);
- bind(CacheableInt64Array::createDeserializable);
- bind(CacheableObjectArray::createDeserializable);
- bind(CacheableString::createDeserializable);
- bind(CacheableString::createDeserializableHuge);
- bind(CacheableString::createUTFDeserializable);
- bind(CacheableString::createUTFDeserializableHuge);
- bind(CacheableStringArray::createDeserializable);
- bind(CacheableVector::createDeserializable);
- bind(CacheableArrayList::createDeserializable);
- bind(CacheableLinkedList::createDeserializable);
- bind(CacheableStack::createDeserializable);
- bind(CacheableCharacter::createDeserializable);
- bind(CharArray::createDeserializable);
- bind(CacheableToken::createDeserializable);
- bind(RegionAttributes::createDeserializable);
- bind(Properties::createDeserializable);
-
- bind2(CacheableUndefined::createDeserializable);
- bind2(EventId::createDeserializable);
- bind2(Struct::createDeserializable);
- bind2(ClientConnectionResponse::create);
- bind2(QueueConnectionResponse::create);
- bind2(LocatorListResponse::create);
- bind2(ClientProxyMembershipID::createDeserializable);
- bind2(GetAllServersResponse::create);
- bind2(EnumInfo::createDeserializable);
- bind2(DiskStoreId::createDeserializable);
+ bindDataSerializablePrimitive(CacheableByte::createDeserializable,
+ DSCode::CacheableByte);
+ bindDataSerializablePrimitive(CacheableBoolean::createDeserializable,
+ DSCode::CacheableBoolean);
+ bindDataSerializablePrimitive(BooleanArray::createDeserializable,
+ DSCode::BooleanArray);
+ bindDataSerializablePrimitive(CacheableBytes::createDeserializable,
+ DSCode::CacheableBytes);
+ bindDataSerializablePrimitive(CacheableFloat::createDeserializable,
+ DSCode::CacheableFloat);
+ bindDataSerializablePrimitive(CacheableFloatArray::createDeserializable,
+ DSCode::CacheableFloatArray);
+ bindDataSerializablePrimitive(CacheableDouble::createDeserializable,
+ DSCode::CacheableDouble);
+ bindDataSerializablePrimitive(CacheableDoubleArray::createDeserializable,
+ DSCode::CacheableDoubleArray);
+ bindDataSerializablePrimitive(CacheableDate::createDeserializable,
+ DSCode::CacheableDate);
+ bindDataSerializablePrimitive(CacheableFileName::createDeserializable,
+ DSCode::CacheableFileName);
+ bindDataSerializablePrimitive(CacheableHashMap::createDeserializable,
+ DSCode::CacheableHashMap);
+ bindDataSerializablePrimitive(CacheableHashSet::createDeserializable,
+ DSCode::CacheableHashSet);
+ bindDataSerializablePrimitive(CacheableHashTable::createDeserializable,
+ DSCode::CacheableHashTable);
+ bindDataSerializablePrimitive(CacheableIdentityHashMap::createDeserializable,
+ DSCode::CacheableIdentityHashMap);
+ bindDataSerializablePrimitive(CacheableLinkedHashSet::createDeserializable,
+ DSCode::CacheableLinkedHashSet);
+ bindDataSerializablePrimitive(CacheableInt16::createDeserializable,
+ DSCode::CacheableInt16);
+ bindDataSerializablePrimitive(CacheableInt16Array::createDeserializable,
+ DSCode::CacheableInt16Array);
+ bindDataSerializablePrimitive(CacheableInt32::createDeserializable,
+ DSCode::CacheableInt32);
+ bindDataSerializablePrimitive(CacheableInt32Array::createDeserializable,
+ DSCode::CacheableInt32Array);
+ bindDataSerializablePrimitive(CacheableInt64::createDeserializable,
+ DSCode::CacheableInt64);
+ bindDataSerializablePrimitive(CacheableInt64Array::createDeserializable,
+ DSCode::CacheableInt64Array);
+ bindDataSerializablePrimitive(CacheableObjectArray::createDeserializable,
+ DSCode::CacheableObjectArray);
+ bindDataSerializablePrimitive(CacheableString::createDeserializable,
+ DSCode::CacheableASCIIString);
+ bindDataSerializablePrimitive(CacheableString::createDeserializableHuge,
+ DSCode::CacheableASCIIStringHuge);
+ bindDataSerializablePrimitive(CacheableString::createUTFDeserializable,
+ DSCode::CacheableString);
+ bindDataSerializablePrimitive(CacheableString::createUTFDeserializableHuge,
+ DSCode::CacheableStringHuge);
+ bindDataSerializablePrimitive(CacheableStringArray::createDeserializable,
+ DSCode::CacheableStringArray);
+ bindDataSerializablePrimitive(CacheableVector::createDeserializable,
+ DSCode::CacheableVector);
+ bindDataSerializablePrimitive(CacheableArrayList::createDeserializable,
+ DSCode::CacheableArrayList);
+ bindDataSerializablePrimitive(CacheableLinkedList::createDeserializable,
+ DSCode::CacheableLinkedList);
+ bindDataSerializablePrimitive(CacheableStack::createDeserializable,
+ DSCode::CacheableStack);
+ bindDataSerializablePrimitive(CacheableCharacter::createDeserializable,
+ DSCode::CacheableCharacter);
+ bindDataSerializablePrimitive(CharArray::createDeserializable,
+ DSCode::CharArray);
+ bindDataSerializablePrimitive(Properties::createDeserializable,
+ DSCode::Properties);
+
+ bindDataSerializableFixedId(CacheableUndefined::createDeserializable);
+ bindDataSerializableFixedId(EventId::createDeserializable);
+ bindDataSerializableFixedId(Struct::createDeserializable);
+ bindDataSerializableFixedId(ClientConnectionResponse::create);
+ bindDataSerializableFixedId(QueueConnectionResponse::create);
+ bindDataSerializableFixedId(LocatorListResponse::create);
+ bindDataSerializableFixedId(ClientProxyMembershipID::createDeserializable);
+ bindDataSerializableFixedId(GetAllServersResponse::create);
+ bindDataSerializableFixedId(EnumInfo::createDeserializable);
+ bindDataSerializableFixedId(DiskStoreId::createDeserializable);
}
/** This starts at reading the typeid.. assumes the length has been read. */
std::shared_ptr<Serializable> SerializationRegistry::deserialize(
DataInput& input, int8_t typeId) const {
- bool findinternal = false;
- auto typedTypeId = static_cast<DSCode>(typeId);
- int64_t compId = typeId;
+ auto dsCode = static_cast<DSCode>(typeId);
if (typeId == -1) {
- compId = input.read();
- typedTypeId = static_cast<DSCode>(compId);
+ dsCode = static_cast<DSCode>(input.read());
}
- LOGDEBUG("SerializationRegistry::deserialize typeid = %d currentTypeId= %" PRId8,
- typeId, typedTypeId);
+ LOGDEBUG(
+ "SerializationRegistry::deserialize typeid = %d currentTypeId= %" PRId8,
+ typeId, dsCode);
- switch (typedTypeId) {
+ switch (dsCode) {
case DSCode::CacheableNullString: {
return std::shared_ptr<Serializable>(
CacheableString::createDeserializable());
@@ -144,65 +175,65 @@ std::shared_ptr<Serializable> SerializationRegistry::deserialize(
enumObject->fromData(input);
return enumObject;
}
- case DSCode::CacheableUserData: {
- compId |= ((static_cast<int64_t>(input.read())) << 32);
- break;
+ case DSCode::CacheableUserData:
+ case DSCode::CacheableUserData2:
+ case DSCode::CacheableUserData4: {
+ return dataSerializeableHandler->deserialize(input, dsCode);
}
- case DSCode::CacheableUserData2: {
- compId |= ((static_cast<int64_t>(input.readInt16())) << 32);
- break;
+ case DSCode::FixedIDByte:
+ case DSCode::FixedIDShort:
+ case DSCode::FixedIDInt: {
+ return deserializeDataSerializableFixedId(input, dsCode);
}
- case DSCode::CacheableUserData4: {
- int32_t classId = input.readInt32();
- compId |= ((static_cast<int64_t>(classId)) << 32);
- break;
+ case DSCode::NullObj: {
+ return nullptr;
}
+ default:
+ break;
+ }
+
+ TypeFactoryMethod createType = nullptr;
+
+ theTypeMap.findDataSerializablePrimitive(dsCode, createType);
+
+ if (createType == nullptr) {
+ throw IllegalStateException("Unregistered type in deserialization");
+ }
+
+ std::shared_ptr<Serializable> obj(createType());
+
+ deserialize(input, obj);
+
+ return obj;
+}
+
+std::shared_ptr<Serializable>
+SerializationRegistry::deserializeDataSerializableFixedId(DataInput& input,
+ DSCode dsCode) const {
+ int32_t fixedId = 0;
+ switch (dsCode) {
case DSCode::FixedIDByte: {
- compId = input.read();
- findinternal = true;
+ fixedId = input.read();
break;
}
case DSCode::FixedIDShort: {
- compId = input.readInt16();
- findinternal = true;
+ fixedId = input.readInt16();
break;
}
case DSCode::FixedIDInt: {
- int32_t fixedId = input.readInt32();
- compId = fixedId;
- findinternal = true;
+ fixedId = input.readInt32();
break;
}
- case DSCode::NullObj: {
- return nullptr;
- }
default:
- break;
+ throw IllegalStateException("Invalid fixed ID");
}
TypeFactoryMethod createType = nullptr;
- if (findinternal) {
- theTypeMap.find2(compId, createType);
- } else {
- theTypeMap.find(compId, createType);
- }
+ theTypeMap.findDataSerializableFixedId(fixedId, createType);
if (createType == nullptr) {
- if (findinternal) {
- LOGERROR(
- "Unregistered class ID %d during deserialization: Did the "
- "application register serialization types?",
- compId);
- } else {
- LOGERROR(
- "Unregistered class ID %d during deserialization: Did the "
- "application register serialization types?",
- (compId >> 32));
- }
-
- // instead of a null key or null value... an Exception should be thrown..
- throw IllegalStateException("Unregistered class ID in deserialization");
+ throw IllegalStateException("Unregistered type in deserialization");
}
std::shared_ptr<Serializable> obj(createType());
@@ -213,98 +244,64 @@ std::shared_ptr<Serializable> SerializationRegistry::deserialize(
}
void SerializationRegistry::deserialize(
- DataInput& input, std::shared_ptr<Serializable> obj) const {
+ DataInput& input, const std::shared_ptr<Serializable>& obj) const {
if (!obj) {
// nothing to read
- } else if (const auto dataSerializableInternal =
+ } else if (const auto&& dataSerializableInternal =
std::dynamic_pointer_cast<DataSerializableInternal>(obj)) {
- deserialize(input, dataSerializableInternal);
- } else if (const auto dataSerializableFixedId =
+ dataSerializableInternal->fromData(input);
+ } else if (const auto&& dataSerializableFixedId =
std::dynamic_pointer_cast<DataSerializableFixedId>(obj)) {
- deserialize(input, dataSerializableFixedId);
- } else if (const auto dataSerializablePrimitive =
+ dataSerializableFixedId->fromData(input);
+ } else if (const auto&& dataSerializablePrimitive =
std::dynamic_pointer_cast<DataSerializablePrimitive>(obj)) {
- deserialize(input, dataSerializablePrimitive);
- } else if (const auto dataSerializable =
- std::dynamic_pointer_cast<DataSerializable>(obj)) {
- deserialize(input, dataSerializable);
- } else if (const auto pdxSerializable =
- std::dynamic_pointer_cast<PdxSerializable>(obj)) {
- deserialize(input, pdxSerializable);
+ dataSerializablePrimitive->fromData(input);
} else {
throw UnsupportedOperationException("Serialization type not implemented.");
}
}
-void SerializationRegistry::deserialize(
- DataInput& input,
- std::shared_ptr<DataSerializableInternal> dataSerializableInternal) const {
- dataSerializableInternal->fromData(input);
-}
-
-void SerializationRegistry::deserialize(
- DataInput& input,
- std::shared_ptr<DataSerializableFixedId> dataSerializableFixedId) const {
- dataSerializableFixedId->fromData(input);
-}
-
-void SerializationRegistry::deserialize(
- DataInput& input,
- std::shared_ptr<DataSerializablePrimitive> dataSerializablePrimitive)
- const {
- dataSerializablePrimitive->fromData(input);
-}
-
-void SerializationRegistry::deserialize(
- DataInput& input,
- std::shared_ptr<DataSerializable> dataSerializable) const {
- dataSerializable->fromData(input);
-}
-
-void SerializationRegistry::deserialize(
- DataInput& /*input*/,
- std::shared_ptr<PdxSerializable> /*pdxSerializable*/) const {
- throw UnsupportedOperationException(
- "SerializationRegistry::deserialize<PdxSerializable> not implemented");
-}
-
-void SerializationRegistry::serializeWithoutHeader(const std::shared_ptr<PdxSerializable>& obj,
- DataOutput& output) const {
+void SerializationRegistry::serializeWithoutHeader(
+ const std::shared_ptr<PdxSerializable>& obj, DataOutput& output) const {
pdxTypeHandler->serialize(obj, output);
}
-void SerializationRegistry::addType(TypeFactoryMethod func) {
- theTypeMap.bind(func);
+void SerializationRegistry::addDataSerializableType(TypeFactoryMethod func,
+ int32_t id) {
+ theTypeMap.bindDataSerializable(func, id);
}
-void SerializationRegistry::addPdxType(TypeFactoryMethodPdx func) {
- theTypeMap.bindPdxType(func);
+void SerializationRegistry::addPdxSerializableType(TypeFactoryMethodPdx func) {
+ theTypeMap.bindPdxSerializable(func);
}
-void SerializationRegistry::addType(int64_t compId, TypeFactoryMethod func) {
- theTypeMap.rebind(compId, func);
+void SerializationRegistry::removeDataSerializableType(int32_t id) {
+ theTypeMap.unbindDataSerializable(id);
}
-void SerializationRegistry::removeType(int64_t compId) {
- theTypeMap.unbind(compId);
+void SerializationRegistry::addDataSerializableFixedIdType(
+ TypeFactoryMethod func) {
+ theTypeMap.bindDataSerializableFixedId(func);
}
-void SerializationRegistry::addType2(TypeFactoryMethod func) {
- theTypeMap.bind2(func);
+void SerializationRegistry::addDataSerializableFixedIdType(
+ int32_t id, TypeFactoryMethod func) {
+ theTypeMap.rebindDataSerializableFixedId(id, func);
}
-void SerializationRegistry::addType2(int64_t compId, TypeFactoryMethod func) {
- theTypeMap.rebind2(compId, func);
+void SerializationRegistry::removeDataSerializableFixeIdType(int32_t id) {
+ theTypeMap.unbindDataSerializableFixedId(id);
}
-void SerializationRegistry::removeType2(int64_t compId) {
- theTypeMap.unbind2(compId);
+void SerializationRegistry::setDataSerializablePrimitiveType(
+ TypeFactoryMethod func, DSCode dsCode) {
+ theTypeMap.rebindDataSerializablePrimitive(dsCode, func);
}
-std::shared_ptr<PdxSerializable> SerializationRegistry::getPdxType(
+std::shared_ptr<PdxSerializable> SerializationRegistry::getPdxSerializableType(
const std::string& className) const {
TypeFactoryMethodPdx objectType = nullptr;
- theTypeMap.findPdxType(className, objectType);
+ theTypeMap.findPdxSerializable(className, objectType);
std::shared_ptr<PdxSerializable> pdxSerializable;
if (nullptr == objectType) {
@@ -368,96 +365,127 @@ std::shared_ptr<Serializable> SerializationRegistry::GetEnum(
}
void TheTypeMap::clear() {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_mapLock);
- m_map->unbind_all();
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableMapLock);
+ m_dataSerializableMap->unbind_all();
- std::lock_guard<util::concurrent::spinlock_mutex> guard2(m_map2Lock);
- m_map2->unbind_all();
+ std::lock_guard<util::concurrent::spinlock_mutex> guard2(
+ m_dataSerializableFixedIdMapLock);
+ m_dataSerializableFixedIdMap->unbind_all();
+
+ std::lock_guard<util::concurrent::spinlock_mutex> guard3(
+ m_pdxSerializableMapLock);
+ m_pdxSerializableMap->unbind_all();
+}
- std::lock_guard<util::concurrent::spinlock_mutex> guard3(m_pdxTypemapLock);
- m_pdxTypemap->unbind_all();
+void TheTypeMap::findDataSerializable(int32_t id,
+ TypeFactoryMethod& func) const {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableMapLock);
+ m_dataSerializableMap->find(id, func);
}
-void TheTypeMap::find(int64_t id, TypeFactoryMethod& func) const {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_mapLock);
- m_map->find(id, func);
+void TheTypeMap::findDataSerializableFixedId(int32_t id,
+ TypeFactoryMethod& func) const {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableFixedIdMapLock);
+ m_dataSerializableFixedIdMap->find(id, func);
}
-void TheTypeMap::find2(int64_t id, TypeFactoryMethod& func) const {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_map2Lock);
- m_map2->find(id, func);
+void TheTypeMap::findDataSerializablePrimitive(DSCode dsCode,
+ TypeFactoryMethod& func) const {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializablePrimitiveMapLock);
+ m_dataSerializablePrimitiveMap->find(dsCode, func);
}
-void TheTypeMap::bind(TypeFactoryMethod func) {
+void TheTypeMap::bindDataSerializable(TypeFactoryMethod func, int32_t id) {
auto obj = func();
- int64_t compId;
- if (const auto dataSerializablePrimitive =
- std::dynamic_pointer_cast<DataSerializablePrimitive>(obj)) {
- compId = static_cast<int64_t>(dataSerializablePrimitive->getDsCode());
- } else if (const auto dataSerializableInternal =
- std::dynamic_pointer_cast<DataSerializableInternal>(obj)) {
- compId = static_cast<int64_t>(dataSerializableInternal->getInternalId());
- } else if (const auto dataSerializable =
- std::dynamic_pointer_cast<DataSerializable>(obj)) {
- auto id = dataSerializable->getClassId();
- compId = static_cast<int64_t>(
- SerializationRegistry::getSerializableDataDsCode(id)) |
- static_cast<int64_t>(id) << 32;
+ if (const auto dataSerializable =
+ std::dynamic_pointer_cast<DataSerializable>(obj)) {
+ typeToClassId.emplace(dataSerializable->getType(), id);
} else {
throw UnsupportedOperationException(
"TheTypeMap::bind: Serialization type not implemented.");
}
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_mapLock);
- int bindRes = m_map->bind(compId, func);
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableMapLock);
+ int bindRes = m_dataSerializableMap->bind(id, func);
if (bindRes == 1) {
- LOGERROR("A class with ID %d is already registered.", compId);
+ LOGERROR("A class with ID %d is already registered.", id);
throw IllegalStateException("A class with given ID is already registered.");
} else if (bindRes == -1) {
- LOGERROR("Unknown error while adding class ID %d to map.", compId);
+ LOGERROR("Unknown error while adding class ID %d to map.", id);
throw IllegalStateException("Unknown error while adding type to map.");
}
}
-void TheTypeMap::rebind(int64_t compId, TypeFactoryMethod func) {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_mapLock);
- int bindRes = m_map->rebind(compId, func);
+void TheTypeMap::rebindDataSerializable(int32_t id, TypeFactoryMethod func) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableMapLock);
+ int bindRes = m_dataSerializableMap->rebind(id, func);
if (bindRes == -1) {
LOGERROR(
"Unknown error "
"while adding class ID %d to map.",
- compId);
+ id);
throw IllegalStateException(
"Unknown error "
"while adding type to map.");
}
}
-void TheTypeMap::unbind(int64_t compId) {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_mapLock);
- m_map->unbind(compId);
+void TheTypeMap::unbindDataSerializable(int32_t id) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableMapLock);
+ m_dataSerializableMap->unbind(id);
}
-void TheTypeMap::bind2(TypeFactoryMethod func) {
+void TheTypeMap::bindDataSerializablePrimitive(TypeFactoryMethod func,
+ DSCode dsCode) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializablePrimitiveMapLock);
+ int bindRes = m_dataSerializablePrimitiveMap->bind(dsCode, func);
+ if (bindRes == 1) {
+ LOGERROR("A class with DSCode %d is already registered.", dsCode);
+ throw IllegalStateException(
+ "A class with given DSCode is already registered.");
+ } else if (bindRes == -1) {
+ LOGERROR("Unknown error while adding DSCode %d to map.", dsCode);
+ throw IllegalStateException("Unknown error while adding type to map.");
+ }
+}
+
+void TheTypeMap::rebindDataSerializablePrimitive(DSCode dsCode,
+ TypeFactoryMethod func) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializablePrimitiveMapLock);
+ m_dataSerializablePrimitiveMap->rebind(dsCode, func);
+}
+
+void TheTypeMap::bindDataSerializableFixedId(TypeFactoryMethod func) {
auto obj = func();
- int64_t compId = 0;
+ int32_t id = 0;
if (const auto dataSerializableFixedId =
std::dynamic_pointer_cast<DataSerializableFixedId>(obj)) {
- compId = static_cast<int64_t>(dataSerializableFixedId->getDSFID());
+ id = static_cast<int64_t>(dataSerializableFixedId->getDSFID());
} else {
throw UnsupportedOperationException(
- "TheTypeMap::bind2: Unknown serialization type.");
+ "TheTypeMap::bindDataSerializableInternal: Unknown serialization "
+ "type.");
}
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_map2Lock);
- int bindRes = m_map2->bind(compId, func);
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableFixedIdMapLock);
+ int bindRes = m_dataSerializableFixedIdMap->bind(id, func);
if (bindRes == 1) {
LOGERROR(
"A fixed class with "
"ID %d is already registered.",
- compId);
+ id);
throw IllegalStateException(
"A fixed class with "
"given ID is already registered.");
@@ -465,29 +493,33 @@ void TheTypeMap::bind2(TypeFactoryMethod func) {
LOGERROR(
"Unknown error "
"while adding class ID %d to map2.",
- compId);
+ id);
throw IllegalStateException(
"Unknown error "
"while adding to map2.");
}
}
-void TheTypeMap::rebind2(int64_t compId, TypeFactoryMethod func) {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_map2Lock);
- m_map2->rebind(compId, func);
+void TheTypeMap::rebindDataSerializableFixedId(int32_t id,
+ TypeFactoryMethod func) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableFixedIdMapLock);
+ m_dataSerializableFixedIdMap->rebind(id, func);
}
-void TheTypeMap::unbind2(int64_t compId) {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_map2Lock);
- m_map2->unbind(compId);
+void TheTypeMap::unbindDataSerializableFixedId(int32_t id) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_dataSerializableFixedIdMapLock);
+ m_dataSerializableFixedIdMap->unbind(id);
}
-void TheTypeMap::bindPdxType(TypeFactoryMethodPdx func) {
+void TheTypeMap::bindPdxSerializable(TypeFactoryMethodPdx func) {
auto obj = func();
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_pdxTypemapLock);
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_pdxSerializableMapLock);
auto&& objFullName = obj->getClassName();
- int bindRes = m_pdxTypemap->bind(objFullName, func);
+ int bindRes = m_pdxSerializableMap->bind(objFullName, func);
if (bindRes == 1) {
LOGERROR("A object with FullName " + objFullName +
@@ -501,16 +533,18 @@ void TheTypeMap::bindPdxType(TypeFactoryMethodPdx func) {
}
}
-void TheTypeMap::findPdxType(const std::string& objFullName,
- TypeFactoryMethodPdx& func) const {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_pdxTypemapLock);
- m_pdxTypemap->find(objFullName, func);
+void TheTypeMap::findPdxSerializable(const std::string& objFullName,
+ TypeFactoryMethodPdx& func) const {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_pdxSerializableMapLock);
+ m_pdxSerializableMap->find(objFullName, func);
}
-void TheTypeMap::rebindPdxType(std::string objFullName,
- TypeFactoryMethodPdx func) {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_pdxTypemapLock);
- int bindRes = m_pdxTypemap->rebind(objFullName, func);
+void TheTypeMap::rebindPdxSerializable(std::string objFullName,
+ TypeFactoryMethodPdx func) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_pdxSerializableMapLock);
+ int bindRes = m_pdxSerializableMap->rebind(objFullName, func);
if (bindRes == -1) {
LOGERROR("Unknown error while adding Pdx Object FullName " + objFullName +
" to map.");
@@ -520,13 +554,15 @@ void TheTypeMap::rebindPdxType(std::string objFullName,
}
}
-void TheTypeMap::unbindPdxType(const std::string& objFullName) {
- std::lock_guard<util::concurrent::spinlock_mutex> guard(m_pdxTypemapLock);
- m_pdxTypemap->unbind(objFullName);
+void TheTypeMap::unbindPdxSerializable(const std::string& objFullName) {
+ std::lock_guard<util::concurrent::spinlock_mutex> guard(
+ m_pdxSerializableMapLock);
+ m_pdxSerializableMap->unbind(objFullName);
}
-void PdxTypeHandler::serialize(const std::shared_ptr<PdxSerializable>& pdxSerializable,
- DataOutput& dataOutput) const {
+void PdxTypeHandler::serialize(
+ const std::shared_ptr<PdxSerializable>& pdxSerializable,
+ DataOutput& dataOutput) const {
PdxHelper::serializePdx(dataOutput, pdxSerializable);
}
@@ -535,6 +571,80 @@ std::shared_ptr<PdxSerializable> PdxTypeHandler::deserialize(
return PdxHelper::deserializePdx(dataInput, false);
}
+void DataSerializableHandler::serialize(
+ const std::shared_ptr<DataSerializable>& dataSerializable,
+ DataOutput& dataOutput, bool isDelta) const {
+ auto&& cacheImpl = CacheRegionHelper::getCacheImpl(dataOutput.getCache());
+ auto&& type = dataSerializable->getType();
+
+ auto&& objectId =
+ cacheImpl->getSerializationRegistry()->getIdForDataSerializableType(type);
+ auto&& dsCode = SerializationRegistry::getSerializableDataDsCode(objectId);
+
+ dataOutput.write(static_cast<int8_t>(dsCode));
+ switch (dsCode) {
+ case DSCode::CacheableUserData:
+ dataOutput.write(static_cast<int8_t>(objectId));
+ break;
+ case DSCode::CacheableUserData2:
+ dataOutput.writeInt(static_cast<int16_t>(objectId));
+ break;
+ case DSCode::CacheableUserData4:
+ dataOutput.writeInt(static_cast<int32_t>(objectId));
+ break;
+ default:
+ IllegalStateException("Invalid DS Code.");
+ }
+
+ if (isDelta) {
+ const Delta* ptr = dynamic_cast<const Delta*>(dataSerializable.get());
+ ptr->toDelta(dataOutput);
+ } else {
+ dataSerializable->toData(dataOutput);
+ ;
+ }
+}
+
+std::shared_ptr<DataSerializable> DataSerializableHandler::deserialize(
+ DataInput& input, DSCode typeId) const {
+ int32_t classId = -1;
+ switch (typeId) {
+ case DSCode::CacheableUserData: {
+ classId = input.read();
+ break;
+ }
+ case DSCode::CacheableUserData2: {
+ classId = input.readInt16();
+ break;
+ }
+ case DSCode::CacheableUserData4: {
+ classId = input.readInt32();
+ break;
+ }
+ default:
+ break;
+ }
+ TypeFactoryMethod createType =
+ input.getCache()->getTypeRegistry().getCreationFunction(classId);
+
+ if (createType == nullptr) {
+ LOGERROR(
+ "Unregistered class ID %d during deserialization: Did the "
+ "application register serialization types?",
+ classId);
+
+ // instead of a null key or null value... an Exception should be thrown..
+ throw IllegalStateException("Unregistered class ID in deserialization");
+ }
+
+ std::shared_ptr<DataSerializable> serializableObject(
+ std::dynamic_pointer_cast<DataSerializable>(createType()));
+
+ serializableObject->fromData(input);
+
+ return serializableObject;
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/SerializationRegistry.hpp b/cppcache/src/SerializationRegistry.hpp
index 08d2e21..0a68bef 100644
--- a/cppcache/src/SerializationRegistry.hpp
+++ b/cppcache/src/SerializationRegistry.hpp
@@ -22,6 +22,11 @@
#include <string>
#include <functional>
+#include <typeinfo>
+#include <iostream>
+#include <memory>
+#include <typeindex>
+#include <unordered_map>
#include <ace/Hash_Map_Manager.h>
#include <ace/Thread_Mutex.h>
@@ -56,13 +61,29 @@ class ACE_Export ACE_Hash<int64_t> {
} // namespace ACE_VERSIONED_NAMESPACE_NAME
#endif
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+using apache::geode::client::DSCode;
+template <>
+class ACE_Hash<DSCode> {
+ public:
+ inline u_long operator()(const DSCode key) {
+ return static_cast<u_long>(key);
+ }
+};
+
+ACE_END_VERSIONED_NAMESPACE_DECL
+
namespace apache {
namespace geode {
namespace client {
using internal::DataSerializableInternal;
-typedef ACE_Hash_Map_Manager<int64_t, TypeFactoryMethod, ACE_Null_Mutex>
+typedef ACE_Hash_Map_Manager<DSCode, TypeFactoryMethod, ACE_Null_Mutex>
+ DSCodeToFactoryMap;
+
+typedef ACE_Hash_Map_Manager<int32_t, TypeFactoryMethod, ACE_Null_Mutex>
IdToFactoryMap;
typedef ACE_Hash_Map_Manager<std::string, TypeFactoryMethodPdx, ACE_Null_Mutex>
@@ -70,37 +91,46 @@ typedef ACE_Hash_Map_Manager<std::string, TypeFactoryMethodPdx, ACE_Null_Mutex>
class TheTypeMap : private NonCopyable {
private:
- IdToFactoryMap* m_map;
- IdToFactoryMap* m_map2; // to hold Fixed IDs since GFE 5.7.
- StrToPdxFactoryMap* m_pdxTypemap;
- mutable util::concurrent::spinlock_mutex m_mapLock;
- mutable util::concurrent::spinlock_mutex m_map2Lock;
- mutable util::concurrent::spinlock_mutex m_pdxTypemapLock;
+ DSCodeToFactoryMap* m_dataSerializablePrimitiveMap;
+ IdToFactoryMap* m_dataSerializableMap;
+ IdToFactoryMap* m_dataSerializableFixedIdMap;
+ StrToPdxFactoryMap* m_pdxSerializableMap;
+ mutable util::concurrent::spinlock_mutex m_dataSerializablePrimitiveMapLock;
+ mutable util::concurrent::spinlock_mutex m_dataSerializableMapLock;
+ mutable util::concurrent::spinlock_mutex m_dataSerializableFixedIdMapLock;
+ mutable util::concurrent::spinlock_mutex m_pdxSerializableMapLock;
+
+ public:
+ std::unordered_map<std::type_index, int32_t> typeToClassId;
public:
TheTypeMap() {
- m_map = new IdToFactoryMap();
+ // map to hold DataSerializablePrimitive
+ m_dataSerializablePrimitiveMap = new DSCodeToFactoryMap();
- // second map to hold internal Data Serializable Fixed IDs - since GFE 5.7
- m_map2 = new IdToFactoryMap();
+ // map to hold Data Serializable IDs
+ m_dataSerializableMap = new IdToFactoryMap();
+
+ // map to hold internal Data Serializable Fixed IDs
+ m_dataSerializableFixedIdMap = new IdToFactoryMap();
// map to hold PDX types <string, funptr>.
- m_pdxTypemap = new StrToPdxFactoryMap();
+ m_pdxSerializableMap = new StrToPdxFactoryMap();
setup();
}
virtual ~TheTypeMap() {
- if (m_map != nullptr) {
- delete m_map;
+ if (m_dataSerializableMap != nullptr) {
+ delete m_dataSerializableMap;
}
- if (m_map2 != nullptr) {
- delete m_map2;
+ if (m_dataSerializableFixedIdMap != nullptr) {
+ delete m_dataSerializableFixedIdMap;
}
- if (m_pdxTypemap != nullptr) {
- delete m_pdxTypemap;
+ if (m_pdxSerializableMap != nullptr) {
+ delete m_pdxSerializableMap;
}
}
@@ -108,30 +138,40 @@ class TheTypeMap : private NonCopyable {
void clear();
- void find(int64_t id, TypeFactoryMethod& func) const;
+ void findDataSerializable(int32_t id, TypeFactoryMethod& func) const;
+
+ void bindDataSerializable(TypeFactoryMethod func, int32_t id);
+
+ void rebindDataSerializable(int32_t id, TypeFactoryMethod func);
+
+ void unbindDataSerializable(int32_t id);
+
+ void findDataSerializableFixedId(int32_t id, TypeFactoryMethod& func) const;
- void find2(int64_t id, TypeFactoryMethod& func) const;
+ void bindDataSerializableFixedId(TypeFactoryMethod func);
- void bind(TypeFactoryMethod func);
+ void rebindDataSerializableFixedId(int32_t idd, TypeFactoryMethod func);
- inline void rebind(int64_t compId, TypeFactoryMethod func);
+ void unbindDataSerializableFixedId(int32_t id);
- inline void unbind(int64_t compId);
+ void bindPdxSerializable(TypeFactoryMethodPdx func);
- inline void bind2(TypeFactoryMethod func);
+ void findPdxSerializable(const std::string& objFullName,
+ TypeFactoryMethodPdx& func) const;
- inline void rebind2(int64_t compId, TypeFactoryMethod func);
+ void unbindPdxSerializable(const std::string& objFullName);
- inline void unbind2(int64_t compId);
+ void rebindPdxSerializable(std::string objFullName,
+ TypeFactoryMethodPdx func);
- inline void bindPdxType(TypeFactoryMethodPdx func);
+ void findDataSerializablePrimitive(DSCode dsCode,
+ TypeFactoryMethod& func) const;
- inline void findPdxType(const std::string& objFullName,
- TypeFactoryMethodPdx& func) const;
+ void bindDataSerializablePrimitive(TypeFactoryMethod func, DSCode id);
- inline void unbindPdxType(const std::string& objFullName);
+ void rebindDataSerializablePrimitive(DSCode dsCode, TypeFactoryMethod func);
- void rebindPdxType(std::string objFullName, TypeFactoryMethodPdx func);
+ private:
};
class Pool;
@@ -143,12 +183,27 @@ class Pool;
class PdxTypeHandler {
public:
virtual ~PdxTypeHandler() noexcept = default;
- virtual void serialize(const std::shared_ptr<PdxSerializable>& pdxSerializable,
- DataOutput& dataOutput) const;
+ virtual void serialize(
+ const std::shared_ptr<PdxSerializable>& pdxSerializable,
+ DataOutput& dataOutput) const;
virtual std::shared_ptr<PdxSerializable> deserialize(
DataInput& dataInput) const;
};
+/**
+ * Used to register handlers for the DataSerializable. .NET client extends this
+ * to intercept for (de)serialization.
+ */
+class DataSerializableHandler {
+ public:
+ virtual ~DataSerializableHandler() noexcept = default;
+ virtual void serialize(
+ const std::shared_ptr<DataSerializable>& dataSerializable,
+ DataOutput& dataOutput, bool isDelta) const;
+ virtual std::shared_ptr<DataSerializable> deserialize(DataInput& input,
+ DSCode typeId) const;
+};
+
class APACHE_GEODE_EXPORT SerializationRegistry {
public:
SerializationRegistry() : theTypeMap() {}
@@ -157,21 +212,24 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
* then write whatever the object's toData requires. The length at the
* front is backfilled after the serialization.
*/
- inline void serialize(const Serializable* obj, DataOutput& output,
- bool isDelta = false) const {
+ inline void serialize(const std::shared_ptr<Serializable>& obj,
+ DataOutput& output, bool isDelta = false) const {
if (obj == nullptr) {
output.write(static_cast<int8_t>(DSCode::NullObj));
- } else if (const auto dataSerializableFixedId =
- dynamic_cast<const DataSerializableFixedId*>(obj)) {
+ } else if (auto&& pdxSerializable =
+ std::dynamic_pointer_cast<PdxSerializable>(obj)) {
+ serialize(pdxSerializable, output);
+ } else if (const auto&& dataSerializableFixedId =
+ std::dynamic_pointer_cast<DataSerializableFixedId>(obj)) {
serialize(dataSerializableFixedId, output);
- } else if (const auto dataSerializablePrimitive =
- dynamic_cast<const DataSerializablePrimitive*>(obj)) {
+ } else if (const auto&& dataSerializablePrimitive =
+ std::dynamic_pointer_cast<DataSerializablePrimitive>(obj)) {
serialize(dataSerializablePrimitive, output);
- } else if (const auto dataSerializable =
- dynamic_cast<const DataSerializable*>(obj)) {
- serialize(dataSerializable, output, isDelta);
- } else if (const auto dataSerializableInternal =
- dynamic_cast<const DataSerializableInternal*>(obj)) {
+ } else if (const auto&& dataSerializable =
+ std::dynamic_pointer_cast<DataSerializable>(obj)) {
+ dataSerializeableHandler->serialize(dataSerializable, output, isDelta);
+ } else if (const auto&& dataSerializableInternal =
+ std::dynamic_pointer_cast<DataSerializableInternal>(obj)) {
serialize(dataSerializableInternal, output);
} else {
throw UnsupportedOperationException(
@@ -180,34 +238,25 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
}
}
- inline void serialize(const std::shared_ptr<Serializable>& obj, DataOutput& output,
- bool isDelta = false) const {
- if (obj == nullptr) {
- output.write(static_cast<int8_t>(DSCode::NullObj));
- } else if (auto&& pdxSerializable =
- std::dynamic_pointer_cast<PdxSerializable>(obj)) {
- serialize(pdxSerializable, output);
- } else {
- serialize(obj.get(), output, isDelta);
- }
- }
-
- inline void serializeWithoutHeader(const Serializable* obj,
+ inline void serializeWithoutHeader(const std::shared_ptr<Serializable>& obj,
DataOutput& output) const {
- if (const auto dataSerializableFixedId =
- dynamic_cast<const DataSerializableFixedId*>(obj)) {
+ if (auto&& pdxSerializable =
+ std::dynamic_pointer_cast<PdxSerializable>(obj)) {
+ serializeWithoutHeader(pdxSerializable, output);
+ } else if (const auto&& dataSerializableFixedId =
+ std::dynamic_pointer_cast<DataSerializableFixedId>(obj)) {
serializeWithoutHeader(dataSerializableFixedId, output);
- } else if (const auto dataSerializablePrimitive =
- dynamic_cast<const DataSerializablePrimitive*>(obj)) {
+ } else if (const auto&& dataSerializablePrimitive =
+ std::dynamic_pointer_cast<DataSerializablePrimitive>(obj)) {
serializeWithoutHeader(dataSerializablePrimitive, output);
- } else if (const auto dataSerializable =
- dynamic_cast<const DataSerializable*>(obj)) {
+ } else if (const auto&& dataSerializable =
+ std::dynamic_pointer_cast<DataSerializable>(obj)) {
serializeWithoutHeader(dataSerializable, output);
- } else if (const auto pdxSerializable =
- dynamic_cast<const PdxSerializable*>(obj)) {
+ } else if (const auto&& pdxSerializable =
+ std::dynamic_pointer_cast<PdxSerializable>(obj)) {
serializeWithoutHeader(pdxSerializable, output);
- } else if (const auto dataSerializableInternal =
- dynamic_cast<const DataSerializableInternal*>(obj)) {
+ } else if (const auto&& dataSerializableInternal =
+ std::dynamic_pointer_cast<DataSerializableInternal>(obj)) {
serializeWithoutHeader(dataSerializableInternal, output);
} else {
throw UnsupportedOperationException(
@@ -216,21 +265,6 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
}
}
- inline void serializeWithoutHeader(const std::shared_ptr<Serializable>& obj, DataOutput& output
- ) const {
- if (auto&& pdxSerializable =
- std::dynamic_pointer_cast<PdxSerializable>(obj)) {
- serializeWithoutHeader(pdxSerializable, output);
- } else {
- serializeWithoutHeader(obj.get(), output);
- }
- }
-
- inline void serialize(const std::shared_ptr<Serializable>& obj,
- DataOutput& output) const {
- serialize(obj.get(), output);
- }
-
/**
* Read the length, typeid, and run the objs fromData. Returns the New
* object.
@@ -238,26 +272,23 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
std::shared_ptr<Serializable> deserialize(DataInput& input,
int8_t typeId = -1) const;
- void addType(TypeFactoryMethod func);
-
- void addType(int64_t compId, TypeFactoryMethod func);
+ void addDataSerializableType(TypeFactoryMethod func, int32_t id);
- void addPdxType(TypeFactoryMethodPdx func);
+ void addPdxSerializableType(TypeFactoryMethodPdx func);
void setPdxSerializer(std::shared_ptr<PdxSerializer> pdxSerializer);
std::shared_ptr<PdxSerializer> getPdxSerializer();
- void removeType(int64_t compId);
+ void removeDataSerializableType(int32_t id);
- // following for internal types with Data Serializable Fixed IDs - since GFE
- // 5.7
+ void addDataSerializableFixedIdType(TypeFactoryMethod func);
- void addType2(TypeFactoryMethod func);
+ void addDataSerializableFixedIdType(int32_t id, TypeFactoryMethod func);
- void addType2(int64_t compId, TypeFactoryMethod func);
+ void removeDataSerializableFixeIdType(int32_t id);
- void removeType2(int64_t compId);
+ void setDataSerializablePrimitiveType(TypeFactoryMethod func, DSCode dsCode);
int32_t GetPDXIdForType(Pool* pool,
std::shared_ptr<Serializable> pdxType) const;
@@ -271,19 +302,39 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
std::shared_ptr<Serializable> GetEnum(std::shared_ptr<Pool> pool,
int32_t val) const;
- std::shared_ptr<PdxSerializable> getPdxType(
+ std::shared_ptr<PdxSerializable> getPdxSerializableType(
const std::string& className) const;
void setPdxTypeHandler(PdxTypeHandler* handler) {
this->pdxTypeHandler = std::unique_ptr<PdxTypeHandler>(handler);
}
+ void setDataSerializableHandler(DataSerializableHandler* handler) {
+ this->dataSerializeableHandler =
+ std::unique_ptr<DataSerializableHandler>(handler);
+ }
+
+ TypeFactoryMethod getDataSerializableCreationMethod(int32_t objectId) {
+ TypeFactoryMethod createType;
+ theTypeMap.findDataSerializable(objectId, createType);
+ return createType;
+ }
+
+ int32_t getIdForDataSerializableType(std::type_index objectType) const {
+ auto&& typeIterator = theTypeMap.typeToClassId.find(objectType);
+ auto&& id = typeIterator->second;
+ return id;
+ }
private:
std::unique_ptr<PdxTypeHandler> pdxTypeHandler;
std::shared_ptr<PdxSerializer> pdxSerializer;
+ std::unique_ptr<DataSerializableHandler> dataSerializeableHandler;
TheTypeMap theTypeMap;
- inline void serialize(const DataSerializableFixedId* obj,
+ std::shared_ptr<Serializable> deserializeDataSerializableFixedId(
+ DataInput& input, DSCode dsCode) const;
+
+ inline void serialize(const std::shared_ptr<DataSerializableFixedId>& obj,
DataOutput& output) const {
auto id = static_cast<int32_t>(obj->getDSFID());
if (id <= std::numeric_limits<int8_t>::max() &&
@@ -302,12 +353,13 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
serializeWithoutHeader(obj, output);
}
- inline void serializeWithoutHeader(const DataSerializableFixedId* obj,
- DataOutput& output) const {
+ inline void serializeWithoutHeader(
+ const std::shared_ptr<DataSerializableFixedId>& obj,
+ DataOutput& output) const {
obj->toData(output);
}
- inline void serialize(const DataSerializablePrimitive* obj,
+ inline void serialize(const std::shared_ptr<DataSerializablePrimitive>& obj,
DataOutput& output) const {
auto id = obj->getDsCode();
output.write(static_cast<int8_t>(id));
@@ -315,60 +367,29 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
serializeWithoutHeader(obj, output);
}
- inline void serializeWithoutHeader(const DataSerializablePrimitive* obj,
- DataOutput& output) const {
+ inline void serializeWithoutHeader(
+ const std::shared_ptr<DataSerializablePrimitive>& obj,
+ DataOutput& output) const {
obj->toData(output);
}
- inline void serialize(const DataSerializable* obj, DataOutput& output,
- bool isDelta) const {
- auto id = obj->getClassId();
- auto dsCode = getSerializableDataDsCode(id);
-
- output.write(static_cast<int8_t>(dsCode));
- switch (dsCode) {
- case DSCode::CacheableUserData:
- output.write(static_cast<int8_t>(id));
- break;
- case DSCode::CacheableUserData2:
- output.writeInt(static_cast<int16_t>(id));
- break;
- case DSCode::CacheableUserData4:
- output.writeInt(static_cast<int32_t>(id));
- break;
- default:
- IllegalStateException("Invalid DS Code.");
- }
-
- if (isDelta) {
- const Delta* ptr = dynamic_cast<const Delta*>(obj);
- ptr->toDelta(output);
- } else {
- serializeWithoutHeader(obj, output);
- }
- }
-
- inline void serializeWithoutHeader(const DataSerializable* obj,
- DataOutput& output) const {
- obj->toData(output);
- }
-
- inline void serialize(const std::shared_ptr<PdxSerializable>& obj, DataOutput& output) const {
+ inline void serialize(const std::shared_ptr<PdxSerializable>& obj,
+ DataOutput& output) const {
output.write(static_cast<int8_t>(DSCode::PDX));
-
serializeWithoutHeader(obj, output);
}
void serializeWithoutHeader(const std::shared_ptr<PdxSerializable>& obj,
DataOutput& output) const;
- inline void serialize(const DataSerializableInternal* obj,
+ inline void serialize(const std::shared_ptr<DataSerializableInternal>& obj,
DataOutput& output) const {
serializeWithoutHeader(obj, output);
}
- inline void serializeWithoutHeader(const DataSerializableInternal* obj,
- DataOutput& output) const {
+ inline void serializeWithoutHeader(
+ const std::shared_ptr<DataSerializableInternal>& obj,
+ DataOutput& output) const {
obj->toData(output);
}
@@ -386,22 +407,8 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
}
private:
- void deserialize(DataInput& input, std::shared_ptr<Serializable> obj) const;
-
void deserialize(DataInput& input,
- std::shared_ptr<DataSerializableInternal> obj) const;
-
- void deserialize(DataInput& input,
- std::shared_ptr<DataSerializableFixedId> obj) const;
-
- void deserialize(DataInput& input,
- std::shared_ptr<DataSerializablePrimitive> obj) const;
-
- void deserialize(DataInput& input,
- std::shared_ptr<DataSerializable> obj) const;
-
- [[noreturn]] void deserialize(DataInput& input,
- std::shared_ptr<PdxSerializable> obj) const;
+ const std::shared_ptr<Serializable>& obj) const;
};
} // namespace client
diff --git a/cppcache/src/ServerLocation.hpp b/cppcache/src/ServerLocation.hpp
index 2f22736..0ccf8b8 100644
--- a/cppcache/src/ServerLocation.hpp
+++ b/cppcache/src/ServerLocation.hpp
@@ -88,8 +88,6 @@ class APACHE_GEODE_EXPORT ServerLocation
return size;
}
- int8_t getInternalId() const override { return 0; }
-
void printInfo() {
LOGDEBUG(" Got Host %s, and port %d", getServerName().c_str(), m_port);
}
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 9d05374..5a4f832 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -494,7 +494,7 @@ void TcrMessage::writeObjectPart(
deltaPtr->toDelta(*m_request);
} else if (isObject) {
if (callToData) {
- m_request->getSerializationRegistry().serializeWithoutHeader(se.get(),
+ m_request->getSerializationRegistry().serializeWithoutHeader(se,
*m_request);
} else {
if (getAllKeyList != nullptr) {
@@ -936,8 +936,8 @@ void TcrMessage::handleByteArrayResponse(
} else if (m_msgTypeRequest == TcrMessage::GET_PDX_TYPE_BY_ID) {
// PdxType will come in response
input.advanceCursor(5); // part header
- m_value =
- serializationRegistry.deserialize(input, static_cast<int8_t>(DSCode::PdxType));
+ m_value = serializationRegistry.deserialize(
+ input, static_cast<int8_t>(DSCode::PdxType));
} else if (m_msgTypeRequest == TcrMessage::GET_PDX_ENUM_BY_ID) {
// PdxType will come in response
input.advanceCursor(5); // part header
diff --git a/cppcache/src/ThinClientLocatorHelper.cpp b/cppcache/src/ThinClientLocatorHelper.cpp
index e55cd0a..6e701f1 100644
--- a/cppcache/src/ThinClientLocatorHelper.cpp
+++ b/cppcache/src/ThinClientLocatorHelper.cpp
@@ -83,7 +83,8 @@ Connector* ThinClientLocatorHelper::createConnection(
}
GfErrType ThinClientLocatorHelper::getAllServers(
- std::vector<ServerLocation>& servers, const std::string& serverGrp) {
+ std::vector<std::shared_ptr<ServerLocation> >& servers,
+ const std::string& serverGrp) {
ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
auto& sysProps = m_poolDM->getConnectionManager()
@@ -103,24 +104,22 @@ GfErrType ThinClientLocatorHelper::getAllServers(
ConnectionWrapper cw(conn);
createConnection(conn, loc.getServerName().c_str(), loc.getPort(),
sysProps.connectTimeout(), buffSize);
- GetAllServersRequest request(serverGrp);
+ std::shared_ptr<GetAllServersRequest> request =
+ std::make_shared<GetAllServersRequest>(serverGrp);
auto data =
m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data.writeInt((int32_t)1001); // GOSSIPVERSION
- data.writeObject(&request);
+ data.writeObject(request);
auto sentLength = conn->send(
reinterpret_cast<char*>(const_cast<uint8_t*>(data.getBuffer())), data.getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : std::chrono::seconds(10));
if (sentLength <= 0) {
- // conn->close(); delete conn; conn = nullptr;
continue;
}
char buff[BUFF_SIZE];
auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : std::chrono::seconds(10));
- // conn->close();
- // delete conn; conn = nullptr;
if (receivedLength <= 0) {
continue;
}
@@ -129,9 +128,6 @@ GfErrType ThinClientLocatorHelper::getAllServers(
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- /* adongre
- * SSL Enabled on Location and not in the client
- */
if (di.read() == REPLY_SSL_ENABLED && !sysProps.sslEnabled()) {
LOGERROR("SSL is enabled on locator, enable SSL in client as well");
throw AuthenticationRequiredException(
@@ -157,7 +153,6 @@ GfErrType ThinClientLocatorHelper::getAllServers(
GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
ClientProxyMembershipID& memId, std::list<ServerLocation>& outEndpoint,
std::string&, int redundancy, const std::set<ServerLocation>& exclEndPts,
- /*const std::set<TcrEndpoint*>& exclEndPts,*/
const std::string& serverGrp) {
ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
auto& sysProps = m_poolDM->getConnectionManager()
@@ -195,25 +190,23 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
ConnectionWrapper cw(conn);
createConnection(conn, loc.getServerName().c_str(), loc.getPort(),
sysProps.connectTimeout(), buffSize);
- QueueConnectionRequest request(memId, exclEndPts, redundancy, false,
- serverGrp);
+ std::shared_ptr<QueueConnectionRequest> request =
+ std::make_shared<QueueConnectionRequest>(
+ memId, exclEndPts, redundancy, false, serverGrp);
auto data =
m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data.writeInt((int32_t)1001); // GOSSIPVERSION
- data.writeObject(&request);
+ data.writeObject(request);
auto sentLength = conn->send(
reinterpret_cast<char*>(const_cast<uint8_t*>(data.getBuffer())), data.getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
if (sentLength <= 0) {
- // conn->close(); delete conn; conn = nullptr;
continue;
}
char buff[BUFF_SIZE];
auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
- // conn->close();
- // delete conn; conn = nullptr;
if (receivedLength <= 0) {
continue;
}
@@ -221,9 +214,6 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- /* adongre
- * ssl defect
- */
const auto acceptanceCode = di.read();
if (acceptanceCode == REPLY_SSL_ENABLED && !sysProps.sslEnabled()) {
LOGERROR("SSL is enabled on locator, enable SSL in client as well");
@@ -292,29 +282,28 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
data.writeInt(1001); // GOSSIPVERSION
if (currentServer == nullptr) {
LOGDEBUG("Creating ClientConnectionRequest");
- ClientConnectionRequest request(exclEndPts, serverGrp);
- data.writeObject(&request);
+ std::shared_ptr<ClientConnectionRequest> request =
+ std::make_shared<ClientConnectionRequest>(exclEndPts, serverGrp);
+ data.writeObject(request);
} else {
LOGDEBUG("Creating ClientReplacementRequest for connection: ",
currentServer->getEndpointObject()->name().c_str());
- ClientReplacementRequest request(
- currentServer->getEndpointObject()->name(), exclEndPts, serverGrp);
- data.writeObject(&request);
+ std::shared_ptr<ClientReplacementRequest> request =
+ std::make_shared<ClientReplacementRequest>(
+ currentServer->getEndpointObject()->name(), exclEndPts,
+ serverGrp);
+ data.writeObject(request);
}
auto sentLength = conn->send(
reinterpret_cast<char*>(const_cast<uint8_t*>(data.getBuffer())), data.getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
if (sentLength <= 0) {
- // conn->close();
- // delete conn;
continue;
}
char buff[BUFF_SIZE];
auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
- // conn->close();
- // delete conn;
if (receivedLength <= 0) {
continue; // return GF_EUNDEF;
}
@@ -322,9 +311,6 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- /* adongre
- * SSL is enabled on locator and not in the client
- */
const auto acceptanceCode = di.read();
if (acceptanceCode == REPLY_SSL_ENABLED && !sysProps.sslEnabled()) {
LOGERROR("SSL is enabled on locator, enable SSL in client as well");
@@ -338,7 +324,6 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
response->printInfo();
if (!response->serverFound()) {
LOGFINE("Server not found");
- // return GF_NOTCON;
locatorFound = true;
continue;
}
@@ -384,17 +369,16 @@ GfErrType ThinClientLocatorHelper::updateLocators(
ConnectionWrapper cw(conn);
createConnection(conn, serLoc.getServerName().c_str(), serLoc.getPort(),
sysProps.connectTimeout(), buffSize);
- LocatorListRequest request(serverGrp);
+ std::shared_ptr<LocatorListRequest> request =
+ std::make_shared<LocatorListRequest>(serverGrp);
auto data =
m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data.writeInt((int32_t)1001); // GOSSIPVERSION
- data.writeObject(&request);
+ data.writeObject(request);
auto sentLength = conn->send(
reinterpret_cast<char*>(const_cast<uint8_t*>(data.getBuffer())), data.getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
if (sentLength <= 0) {
- // conn->close();
- // delete conn;
conn = nullptr;
continue;
}
@@ -402,8 +386,6 @@ GfErrType ThinClientLocatorHelper::updateLocators(
auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
- // conn->close();
- // delete conn; conn = nullptr;
if (receivedLength <= 0) {
continue;
}
@@ -411,9 +393,6 @@ GfErrType ThinClientLocatorHelper::updateLocators(
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- /* adongre
- * SSL Enabled on Location and not in the client
- */
const auto acceptanceCode = di.read();
if (acceptanceCode == REPLY_SSL_ENABLED && !sysProps.sslEnabled()) {
LOGERROR("SSL is enabled on locator, enable SSL in client as well");
diff --git a/cppcache/src/ThinClientLocatorHelper.hpp b/cppcache/src/ThinClientLocatorHelper.hpp
index 0e0157f..84866e1 100644
--- a/cppcache/src/ThinClientLocatorHelper.hpp
+++ b/cppcache/src/ThinClientLocatorHelper.hpp
@@ -47,11 +47,10 @@ class ThinClientLocatorHelper {
GfErrType getEndpointForNewCallBackConn(
ClientProxyMembershipID& memId, std::list<ServerLocation>& outEndpoint,
std::string& additionalLoc, int redundancy,
- const std::set<ServerLocation>& exclEndPts,
- /*const std::set<TcrEndpoint*>& exclEndPts,*/
+ const std::set<ServerLocation>& exclEndPts, const std::string& serverGrp);
+ GfErrType getAllServers(
+ std::vector<std::shared_ptr<ServerLocation> >& servers,
const std::string& serverGrp);
- GfErrType getAllServers(std::vector<ServerLocation>& servers,
- const std::string& serverGrp);
int32_t getCurLocatorsNum() {
return static_cast<int32_t>(m_locHostPort.size());
}
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index 112439b..a316ee4 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -718,7 +718,7 @@ const std::shared_ptr<CacheableStringArray> ThinClientPoolDM::getServers() {
return CacheableStringArray::create(
std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
} else if (!m_attrs->m_initLocList.empty()) {
- std::vector<ServerLocation> vec;
+ std::vector<std::shared_ptr<ServerLocation>> vec;
// TODO thread - why is this member volatile?
const_cast<ThinClientLocatorHelper*>(
reinterpret_cast<volatile ThinClientLocatorHelper*>(m_locHelper))
@@ -727,8 +727,8 @@ const std::shared_ptr<CacheableStringArray> ThinClientPoolDM::getServers() {
auto ptrArr = new std::shared_ptr<CacheableString>[vec.size()];
int32_t i = 0;
for (auto&& serLoc : vec) {
- ptrArr[i++] = CacheableString::create(serLoc.getServerName() + ":" +
- std::to_string(serLoc.getPort()));
+ ptrArr[i++] = CacheableString::create(serLoc->getServerName() + ":" +
+ std::to_string(serLoc->getPort()));
}
return CacheableStringArray::create(
std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
diff --git a/cppcache/src/TypeRegistry.cpp b/cppcache/src/TypeRegistry.cpp
index 22e2c5d..bc930d2 100644
--- a/cppcache/src/TypeRegistry.cpp
+++ b/cppcache/src/TypeRegistry.cpp
@@ -25,12 +25,14 @@ namespace client {
TypeRegistry::TypeRegistry(CacheImpl* cache) : m_cache(cache) {}
-void TypeRegistry::registerType(TypeFactoryMethod creationFunction) {
- m_cache->getSerializationRegistry()->addType(creationFunction);
+void TypeRegistry::registerType(TypeFactoryMethod creationFunction,
+ int32_t id) {
+ m_cache->getSerializationRegistry()->addDataSerializableType(creationFunction,
+ id);
}
void TypeRegistry::registerPdxType(TypeFactoryMethodPdx creationFunction) {
- m_cache->getSerializationRegistry()->addPdxType(creationFunction);
+ m_cache->getSerializationRegistry()->addPdxSerializableType(creationFunction);
}
void TypeRegistry::registerPdxSerializer(
@@ -42,6 +44,11 @@ std::shared_ptr<PdxSerializer> TypeRegistry::getPdxSerializer() {
return m_cache->getSerializationRegistry()->getPdxSerializer();
}
+TypeFactoryMethod TypeRegistry::getCreationFunction(int32_t objectId) {
+ return m_cache->getSerializationRegistry()->getDataSerializableCreationMethod(
+ objectId);
+}
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/examples/cpp/dataserializable/Order.cpp b/examples/cpp/dataserializable/Order.cpp
index e58acdb..46599b3 100644
--- a/examples/cpp/dataserializable/Order.cpp
+++ b/examples/cpp/dataserializable/Order.cpp
@@ -52,9 +52,4 @@ std::shared_ptr<DataSerializable> Order::create() {
return std::make_shared<Order>();
}
-int32_t Order::getClassId() const {
- // No longer used by the interface
- return 7;
-}
-
} // namespace customserializable
diff --git a/examples/cpp/dataserializable/Order.hpp b/examples/cpp/dataserializable/Order.hpp
index 242ebd1..8fd4387 100644
--- a/examples/cpp/dataserializable/Order.hpp
+++ b/examples/cpp/dataserializable/Order.hpp
@@ -52,8 +52,6 @@ class Order : public DataSerializable {
size_t objectSize() const override;
static std::shared_ptr<DataSerializable> create();
-
- int32_t getClassId() const override;
private:
uint32_t order_id_;
diff --git a/examples/cpp/dataserializable/main.cpp b/examples/cpp/dataserializable/main.cpp
index 876d738..c3e57c2 100644
--- a/examples/cpp/dataserializable/main.cpp
+++ b/examples/cpp/dataserializable/main.cpp
@@ -41,7 +41,7 @@ int main(int argc, char** argv) {
auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY);
auto region = regionFactory.setPoolName("pool").create("custom_orders");
- cache.getTypeRegistry().registerType(Order::create);
+ cache.getTypeRegistry().registerType(Order::create, 7);
std::cout << "Create orders" << std::endl;
auto order1 = std::make_shared<Order>(1, "product x", 23);
diff --git a/examples/dotnet/DataSerializableCs/Order.cs b/examples/dotnet/DataSerializableCs/Order.cs
index 41f3c65..e23078f 100644
--- a/examples/dotnet/DataSerializableCs/Order.cs
+++ b/examples/dotnet/DataSerializableCs/Order.cs
@@ -19,56 +19,51 @@ using System;
namespace Apache.Geode.Examples.Serializer
{
- public class Order : IDataSerializable
- {
- public int OrderId { get; set; }
- public string Name { get; set; }
- public short Quantity { get; set; }
+ public class Order : IDataSerializable
+ {
+ public int OrderId { get; set; }
+ public string Name { get; set; }
+ public short Quantity { get; set; }
- // A default constructor is required for deserialization
- public Order() { }
+ // A default constructor is required for deserialization
+ public Order() { }
- public Order(int orderId, string name, short quantity)
- {
- OrderId = orderId;
- Name = name;
- Quantity = quantity;
- }
+ public Order(int orderId, string name, short quantity)
+ {
+ OrderId = orderId;
+ Name = name;
+ Quantity = quantity;
+ }
- public override string ToString()
- {
- return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
- }
+ public override string ToString()
+ {
+ return string.Format("Order: [{0}, {1}, {2}]", OrderId, Name, Quantity);
+ }
- public void ToData(DataOutput output)
- {
- output.WriteInt32(OrderId);
- output.WriteUTF(Name);
- output.WriteInt16(Quantity);
- }
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(OrderId);
+ output.WriteUTF(Name);
+ output.WriteInt16(Quantity);
+ }
- public void FromData(DataInput input)
- {
- OrderId = input.ReadInt32();
- Name = input.ReadUTF();
- Quantity = input.ReadInt16();
- }
+ public void FromData(DataInput input)
+ {
+ OrderId = input.ReadInt32();
+ Name = input.ReadUTF();
+ Quantity = input.ReadInt16();
+ }
- public Int32 ClassId
- {
- get { return 0x42; }
- }
+ public ulong ObjectSize
+ {
+ get { return 0; }
+ }
- public ulong ObjectSize
- {
- get { return 0; }
- }
-
- public static ISerializable CreateDeserializable()
- {
- return new Order();
- }
+ public static ISerializable CreateDeserializable()
+ {
+ return new Order();
}
+ }
}
diff --git a/examples/dotnet/DataSerializableCs/Program.cs b/examples/dotnet/DataSerializableCs/Program.cs
index 4b2647d..84e6529 100644
--- a/examples/dotnet/DataSerializableCs/Program.cs
+++ b/examples/dotnet/DataSerializableCs/Program.cs
@@ -30,7 +30,7 @@ namespace Apache.Geode.Examples.Serializer
Console.WriteLine("Registering for data serialization");
- cache.TypeRegistry.RegisterType(Order.CreateDeserializable);
+ cache.TypeRegistry.RegisterType(Order.CreateDeserializable, 7);
var poolFactory = cache.GetPoolFactory()
.AddLocator("localhost", 10334);
diff --git a/tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs b/tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs
index db7bd0a..e3fc098 100644
--- a/tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs
+++ b/tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs
@@ -521,8 +521,8 @@ namespace Apache.Geode.Client.FwkLib
if (!isObjectRegistered)
{
- CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(DeltaTestImpl.CreateDeserializable);
- CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(TestObject1.CreateDeserializable);
+ CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(DeltaTestImpl.CreateDeserializable, 0x1E);
+ CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(TestObject1.CreateDeserializable, 0x1F);
isObjectRegistered = true;
}
IRegion<TKey, TVal> region = CreateRootRegion();
diff --git a/tests/cli/NewFwkLib/QueryTest/QueryTests.cs b/tests/cli/NewFwkLib/QueryTest/QueryTests.cs
index cecdcd3..99380d4 100644
--- a/tests/cli/NewFwkLib/QueryTest/QueryTests.cs
+++ b/tests/cli/NewFwkLib/QueryTest/QueryTests.cs
@@ -689,9 +689,9 @@ namespace Apache.Geode.Client.FwkLib
FwkInfo("isObjectRegistered value is {0}",isObjectRegistered);
if (!isObjectRegistered)
{
- CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
+ CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
FwkInfo("Completed Portfolio registeration");
- CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
+ CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterPdxType(PortfolioPdx.CreateDeserializable);
CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterPdxType(PositionPdx.CreateDeserializable);
FwkInfo("Completed other object registeration");
@@ -1390,8 +1390,8 @@ namespace Apache.Geode.Client.FwkLib
if (isTypeRegistered != "registered")
{
FwkInfo("Getting inside for registeration");
- CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable);
- CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable);
+ CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Position.CreateDeserializable, 7);
+ CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterType(Portfolio.CreateDeserializable, 8);
CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
CacheHelper<TKey, TVal>.DCache.TypeRegistry.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
diff --git a/tests/cli/NewTestObject/DeltaEx.cs b/tests/cli/NewTestObject/DeltaEx.cs
index 7f23e2a..8be4f47 100644
--- a/tests/cli/NewTestObject/DeltaEx.cs
+++ b/tests/cli/NewTestObject/DeltaEx.cs
@@ -20,92 +20,83 @@ using System;
using Apache.Geode.Client;
namespace Apache.Geode.Client.Tests
{
- public class DeltaEx : IDelta, IDataSerializable, ICloneable
- {
- private int counter;
- private bool IsDelta;
- public static int ToDeltaCount = 0;
- public static int FromDeltaCount = 0;
- public static int ToDataCount = 0;
- public static int FromDataCount = 0;
- public static int CloneCount = 0;
-
- public DeltaEx()
- {
- counter = 24;
- IsDelta = false;
- }
- public DeltaEx(int count)
- {
- count = 0;
- IsDelta = false;
- }
- public bool HasDelta()
- {
- return IsDelta;
- }
- public void ToDelta(Apache.Geode.Client.DataOutput DataOut)
- {
- DataOut.WriteInt32(counter);
- ToDeltaCount++;
- }
+ public class DeltaEx : IDelta, IDataSerializable, ICloneable
+ {
+ private int counter;
+ private bool IsDelta;
+ public static int ToDeltaCount = 0;
+ public static int FromDeltaCount = 0;
+ public static int ToDataCount = 0;
+ public static int FromDataCount = 0;
+ public static int CloneCount = 0;
- public void FromDelta(Apache.Geode.Client.DataInput DataIn)
- {
- int val = DataIn.ReadInt32();
- if( FromDeltaCount == 1 )
- {
- FromDeltaCount++;
- throw new Apache.Geode.Client.InvalidDeltaException();
- }
- counter+=val;
- FromDeltaCount++;
- }
-
- public void ToData(Apache.Geode.Client.DataOutput DataOut)
- {
- DataOut.WriteInt32( counter );
- ToDataCount++;
- }
- public void FromData(Apache.Geode.Client.DataInput DataIn)
- {
- counter = DataIn.ReadInt32();
- FromDataCount++;
- }
+ public DeltaEx()
+ {
+ counter = 24;
+ IsDelta = false;
+ }
+ public DeltaEx(int count)
+ {
+ count = 0;
+ IsDelta = false;
+ }
+ public bool HasDelta()
+ {
+ return IsDelta;
+ }
+ public void ToDelta(Apache.Geode.Client.DataOutput DataOut)
+ {
+ DataOut.WriteInt32(counter);
+ ToDeltaCount++;
+ }
- public Int32 ClassId
- {
- get
- {
- //UInt32 classId = 1;
- return 0x01;
- }
- }
+ public void FromDelta(Apache.Geode.Client.DataInput DataIn)
+ {
+ int val = DataIn.ReadInt32();
+ if (FromDeltaCount == 1)
+ {
+ FromDeltaCount++;
+ throw new Apache.Geode.Client.InvalidDeltaException();
+ }
+ counter += val;
+ FromDeltaCount++;
+ }
- public UInt64 ObjectSize
- {
- get
- {
- return 0;
- }
- }
- public void SetDelta(bool isDelta)
- {
- IsDelta = isDelta;
- }
+ public void ToData(Apache.Geode.Client.DataOutput DataOut)
+ {
+ DataOut.WriteInt32(counter);
+ ToDataCount++;
+ }
+ public void FromData(Apache.Geode.Client.DataInput DataIn)
+ {
+ counter = DataIn.ReadInt32();
+ FromDataCount++;
+ }
- public static Apache.Geode.Client.ISerializable create()
- {
- return new DeltaEx();
- }
- public Object Clone()
- {
- CloneCount++;
- return new DeltaEx();
- }
- public int getCounter()
+ public UInt64 ObjectSize
+ {
+ get
{
- return counter;
+ return 0;
}
}
+ public void SetDelta(bool isDelta)
+ {
+ IsDelta = isDelta;
+ }
+
+ public static Apache.Geode.Client.ISerializable create()
+ {
+ return new DeltaEx();
+ }
+ public Object Clone()
+ {
+ CloneCount++;
+ return new DeltaEx();
+ }
+ public int getCounter()
+ {
+ return counter;
+ }
+ }
}
diff --git a/tests/cli/NewTestObject/DeltaTestImpl.cs b/tests/cli/NewTestObject/DeltaTestImpl.cs
index 6183d63..5e7e21c 100644
--- a/tests/cli/NewTestObject/DeltaTestImpl.cs
+++ b/tests/cli/NewTestObject/DeltaTestImpl.cs
@@ -46,7 +46,7 @@ namespace Apache.Geode.Client.Tests
intVar = 1;
str = "test";
doubleVar = 1.1;
- byte [] arr2 = new byte[1];
+ byte[] arr2 = new byte[1];
byteArr = arr2;
testobj = null;
hasDelta = false;
@@ -59,7 +59,7 @@ namespace Apache.Geode.Client.Tests
{
this.intVar = rhs.intVar;
this.str = rhs.str;
- this.doubleVar=rhs.doubleVar;
+ this.doubleVar = rhs.doubleVar;
this.byteArr = rhs.byteArr;
this.testobj = rhs.testobj;
this.toDeltaCounter = rhs.GetToDeltaCounter();
@@ -87,13 +87,7 @@ namespace Apache.Geode.Client.Tests
return 0;
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x1E;
- }
- }
+
public static ISerializable CreateDeserializable()
{
return new DeltaTestImpl();
@@ -196,7 +190,7 @@ namespace Apache.Geode.Client.Tests
testobj = (TestObject1)input.ReadObject();
lock (LOCK_THIS_CLASS)
{
- fromDataCount++;
+ fromDataCount++;
}
}
@@ -236,7 +230,7 @@ namespace Apache.Geode.Client.Tests
if ((deltaBits & BYTE_ARR_MASK) == BYTE_ARR_MASK)
{
output.WriteObject(byteArr);
- }
+ }
if ((deltaBits & TEST_OBJ_MASK) == TEST_OBJ_MASK)
{
output.WriteObject(testobj);
diff --git a/tests/cli/NewTestObject/Portfolio.cs b/tests/cli/NewTestObject/Portfolio.cs
index a3c8f0f..78920b9 100644
--- a/tests/cli/NewTestObject/Portfolio.cs
+++ b/tests/cli/NewTestObject/Portfolio.cs
@@ -142,14 +142,6 @@ namespace Apache.Geode.Client.Tests
}
}
- public string Type
- {
- get
- {
- return m_type;
- }
- }
-
public static string[] SecIds
{
get
@@ -289,13 +281,6 @@ namespace Apache.Geode.Client.Tests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x08;
- }
- }
#endregion
diff --git a/tests/cli/NewTestObject/PortfolioPdx.cs b/tests/cli/NewTestObject/PortfolioPdx.cs
index d2937be..9368dc9 100644
--- a/tests/cli/NewTestObject/PortfolioPdx.cs
+++ b/tests/cli/NewTestObject/PortfolioPdx.cs
@@ -232,15 +232,7 @@ namespace Apache.Geode.Client.Tests
}
#endregion
-/*
- public Int32 ClassId
- {
- get
- {
- return 0x03;
- }
- }
-*/
+
public static IPdxSerializable CreateDeserializable()
{
return new PortfolioPdx();
diff --git a/tests/cli/NewTestObject/Position.cs b/tests/cli/NewTestObject/Position.cs
index 126700b..544d2c3 100644
--- a/tests/cli/NewTestObject/Position.cs
+++ b/tests/cli/NewTestObject/Position.cs
@@ -225,14 +225,6 @@ namespace Apache.Geode.Client.Tests
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x07;
- }
- }
-
#endregion
public static ISerializable CreateDeserializable()
diff --git a/tests/cli/NewTestObject/PositionPdx.cs b/tests/cli/NewTestObject/PositionPdx.cs
index 418c43b..7e29a69 100644
--- a/tests/cli/NewTestObject/PositionPdx.cs
+++ b/tests/cli/NewTestObject/PositionPdx.cs
@@ -156,17 +156,6 @@ namespace Apache.Geode.Client.Tests
}
#endregion
-/*
-
- public Int32 ClassId
- {
- get
- {
- return 0x02;
- }
- }
-
- */
public static IPdxSerializable CreateDeserializable()
{
diff --git a/tests/cli/NewTestObject/TestObject1.cs b/tests/cli/NewTestObject/TestObject1.cs
index c7407bf..05464be 100644
--- a/tests/cli/NewTestObject/TestObject1.cs
+++ b/tests/cli/NewTestObject/TestObject1.cs
@@ -45,13 +45,7 @@ namespace Apache.Geode.Client.Tests
return 0;
}
}
- public Int32 ClassId
- {
- get
- {
- return 0x1F;
- }
- }
+
public void FromData(DataInput input)
{
arr = input.ReadBytes();
diff --git a/tests/cli/PdxClassLibrary/VariousPdxTypes.cs b/tests/cli/PdxClassLibrary/VariousPdxTypes.cs
index d7704da..f3f35af 100644
--- a/tests/cli/PdxClassLibrary/VariousPdxTypes.cs
+++ b/tests/cli/PdxClassLibrary/VariousPdxTypes.cs
@@ -852,11 +852,6 @@ namespace PdxTests
#region IDataSerializable Members
- public Int32 ClassId
- {
- get { return 5005; }
- }
-
public void FromData(DataInput input)
{
m_i1 = input.ReadInt32();
diff --git a/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp b/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
index bf8d665..249863a 100644
--- a/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
+++ b/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
@@ -20,7 +20,6 @@
#include <memory>
#include "native_shared_ptr.hpp"
#include "PkcsAuthInit.hpp"
-//#include "IAuthInitialize.hpp"
using namespace System;
diff --git a/tests/cpp/testobject/BatchObject.hpp b/tests/cpp/testobject/BatchObject.hpp
index 1c7c89a..2ff49e8 100644
--- a/tests/cpp/testobject/BatchObject.hpp
+++ b/tests/cpp/testobject/BatchObject.hpp
@@ -56,7 +56,6 @@ class TESTOBJECT_EXPORT BatchObject : public TimestampedObject {
~BatchObject() override = default;
virtual void toData(apache::geode::client::DataOutput& output) const override;
virtual void fromData(apache::geode::client::DataInput& input) override;
- virtual int32_t getClassId() const override { return 25; }
std::string toString() const override;
virtual size_t objectSize() const override {
diff --git a/tests/cpp/testobject/DeltaFastAssetAccount.hpp b/tests/cpp/testobject/DeltaFastAssetAccount.hpp
index d73ba4f..99fdddd 100644
--- a/tests/cpp/testobject/DeltaFastAssetAccount.hpp
+++ b/tests/cpp/testobject/DeltaFastAssetAccount.hpp
@@ -121,8 +121,6 @@ class TESTOBJECT_EXPORT DeltaFastAssetAccount : public DataSerializable,
}
}
- int32_t getClassId() const override { return 41; }
-
bool hasDelta() const override { return true; }
size_t objectSize() const override {
diff --git a/tests/cpp/testobject/DeltaPSTObject.hpp b/tests/cpp/testobject/DeltaPSTObject.hpp
index 7bc80d0..55e5ea2 100644
--- a/tests/cpp/testobject/DeltaPSTObject.hpp
+++ b/tests/cpp/testobject/DeltaPSTObject.hpp
@@ -54,7 +54,6 @@ class TESTOBJECT_EXPORT DeltaPSTObject : public DataSerializable, public Delta {
void toDelta(DataOutput& output) const override;
std::string toString() const override;
bool hasDelta() const override { return true; }
- int32_t getClassId() const override { return 42; }
size_t objectSize() const override {
auto objectSize = sizeof(DeltaPSTObject);
diff --git a/tests/cpp/testobject/DeltaTestImpl.hpp b/tests/cpp/testobject/DeltaTestImpl.hpp
index 3bab1d3..051e008 100644
--- a/tests/cpp/testobject/DeltaTestImpl.hpp
+++ b/tests/cpp/testobject/DeltaTestImpl.hpp
@@ -80,8 +80,6 @@ class TESTOBJECT_EXPORT DeltaTestImpl : public DataSerializable, public Delta {
bool hasDelta() const override { return m_hasDelta; }
- int32_t getClassId() const override { return 30; }
-
inline std::shared_ptr<Delta> clone() const override {
return std::make_shared<DeltaTestImpl>(*this);
}
diff --git a/tests/cpp/testobject/EqStruct.hpp b/tests/cpp/testobject/EqStruct.hpp
index 41d5a75..455049d 100644
--- a/tests/cpp/testobject/EqStruct.hpp
+++ b/tests/cpp/testobject/EqStruct.hpp
@@ -102,7 +102,6 @@ class TESTOBJECT_EXPORT EqStruct : public TimestampedObject {
~EqStruct() override = default;
virtual void toData(apache::geode::client::DataOutput& output) const override;
virtual void fromData(apache::geode::client::DataInput& input) override;
- virtual int32_t getClassId() const override { return 101; }
std::string toString() const override;
virtual size_t objectSize() const override {
diff --git a/tests/cpp/testobject/FastAsset.hpp b/tests/cpp/testobject/FastAsset.hpp
index 63f68dc..00d5288 100644
--- a/tests/cpp/testobject/FastAsset.hpp
+++ b/tests/cpp/testobject/FastAsset.hpp
@@ -54,7 +54,6 @@ class TESTOBJECT_EXPORT FastAsset : public TimestampedObject {
~FastAsset() override = default;
void toData(DataOutput& output) const override;
void fromData(DataInput& input) override;
- int32_t getClassId() const override { return 24; }
size_t objectSize() const override {
auto objectSize = sizeof(FastAsset);
diff --git a/tests/cpp/testobject/FastAssetAccount.hpp b/tests/cpp/testobject/FastAssetAccount.hpp
index 4163bdb..fc7c90f 100644
--- a/tests/cpp/testobject/FastAssetAccount.hpp
+++ b/tests/cpp/testobject/FastAssetAccount.hpp
@@ -65,7 +65,6 @@ class TESTOBJECT_EXPORT FastAssetAccount : public TimestampedObject {
~FastAssetAccount() override = default;
void toData(DataOutput& output) const override;
void fromData(DataInput& input) override;
- int32_t getClassId() const override { return 23; }
std::string toString() const override;
size_t objectSize() const override {
diff --git a/tests/cpp/testobject/PSTObject.hpp b/tests/cpp/testobject/PSTObject.hpp
index a4f43b8..cc09153 100644
--- a/tests/cpp/testobject/PSTObject.hpp
+++ b/tests/cpp/testobject/PSTObject.hpp
@@ -58,7 +58,6 @@ class TESTOBJECT_EXPORT PSTObject : public TimestampedObject {
~PSTObject() override = default;
void toData(DataOutput& output) const override;
void fromData(DataInput& input) override;
- int32_t getClassId() const override { return 0x04; }
std::string toString() const override;
size_t objectSize() const override {
diff --git a/tests/cpp/testobject/Portfolio.hpp b/tests/cpp/testobject/Portfolio.hpp
index 1ef669d..8a81727 100644
--- a/tests/cpp/testobject/Portfolio.hpp
+++ b/tests/cpp/testobject/Portfolio.hpp
@@ -114,8 +114,6 @@ class TESTOBJECT_EXPORT Portfolio : public DataSerializable {
int32_t getNewValSize() const { return newValSize; }
- std::shared_ptr<CacheableString> getType() const { return this->type; }
-
std::shared_ptr<CacheableDate> getCreationDate() const {
return creationDate;
}
@@ -130,7 +128,6 @@ class TESTOBJECT_EXPORT Portfolio : public DataSerializable {
void toData(DataOutput& output) const override;
void fromData(DataInput& input) override;
- int32_t getClassId() const override { return 0x03; }
std::string toString() const override;
};
diff --git a/tests/cpp/testobject/Position.hpp b/tests/cpp/testobject/Position.hpp
index 4b30e85..7256e55 100644
--- a/tests/cpp/testobject/Position.hpp
+++ b/tests/cpp/testobject/Position.hpp
@@ -72,7 +72,6 @@ class TESTOBJECT_EXPORT Position : public DataSerializable {
~Position() override = default;
void toData(DataOutput& output) const override;
void fromData(DataInput& input) override;
- int32_t getClassId() const override { return 0x02; }
std::string toString() const override;
size_t objectSize() const override {
diff --git a/tests/cpp/testobject/TestObject1.hpp b/tests/cpp/testobject/TestObject1.hpp
index 6edcb80..89d2756 100644
--- a/tests/cpp/testobject/TestObject1.hpp
+++ b/tests/cpp/testobject/TestObject1.hpp
@@ -56,8 +56,6 @@ class TESTOBJECT_EXPORT TestObject1 : public DataSerializable {
int32_t getIdentifier() { return identifier; }
- int32_t getClassId() const override { return 31; }
-
static Serializable* create();
};
diff --git a/tests/cpp/testobject/VariousPdxTypes.hpp b/tests/cpp/testobject/VariousPdxTypes.hpp
index 9325661..8921d8f 100644
--- a/tests/cpp/testobject/VariousPdxTypes.hpp
+++ b/tests/cpp/testobject/VariousPdxTypes.hpp
@@ -558,13 +558,6 @@ class TESTOBJECT_EXPORT PdxInsideIGeodeSerializable : public DataSerializable {
void toData(DataOutput& output) const override;
- virtual int32_t getClassId() const override { return 0x10; }
-
- // const std::string& getClassName() const override {
- // static std::string className = "PdxTests.PdxInsideIGeodeSerializable";
- // return className;
- // }
-
static std::shared_ptr<Serializable> createDeserializable() {
return std::make_shared<PdxInsideIGeodeSerializable>();
}