You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/05/17 17:50:03 UTC
[21/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testLRUList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testLRUList.cpp b/src/cppcache/integration-test/testLRUList.cpp
index 8e24bd2..4bd3d83 100644
--- a/src/cppcache/integration-test/testLRUList.cpp
+++ b/src/cppcache/integration-test/testLRUList.cpp
@@ -37,7 +37,7 @@ using namespace test;
class MyNode : public SharedBase, public LRUEntryProperties {
public:
- static MyNode* create(const CacheableKeyPtr& key = NULLPTR) {
+ static MyNode* create(const CacheableKeyPtr& key = nullptr) {
return new MyNode();
}
virtual ~MyNode() {}
@@ -63,11 +63,11 @@ BEGIN_TEST(LRUListTest)
MyNodePtr* tenNodes = new MyNodePtr[10];
for (int i = 0; i < 10; i++) {
- tenNodes[i] = MyNode::create();
+ tenNodes[i] = std::shared_ptr<MyNode>(MyNode::create());
tenNodes[i]->setValue(i);
// add each node to list
lruList.appendEntry(tenNodes[i]);
- MyNodePtr myPtr = dynCast<MyNodePtr>(tenNodes[i]);
+ auto myPtr = std::dynamic_pointer_cast<MyNode>(tenNodes[i]);
cout << " appendEntry( " << myPtr->getValue() << " )" << endl;
}
@@ -111,18 +111,18 @@ BEGIN_TEST(TestEndOfList)
MyNodePtr nodePtr;
lruList.getLRUEntry(nodePtr);
sprintf(msgbuf, "expected node %d", k);
- ASSERT(dynCast<MyNodePtr>(nodePtr)->getValue() == k, msgbuf);
+ ASSERT(std::dynamic_pointer_cast<MyNode>(nodePtr)->getValue() == k, msgbuf);
k++;
}
// now list should be empty...
MyNodePtr emptyPtr;
lruList.getLRUEntry(emptyPtr);
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ ASSERT(emptyPtr == nullptr, "expected NULL");
// do it again...
- emptyPtr = NULLPTR;
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ emptyPtr = nullptr;
+ ASSERT(emptyPtr == nullptr, "expected NULL");
lruList.getLRUEntry(emptyPtr);
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ ASSERT(emptyPtr == nullptr, "expected NULL");
// now add something to the list... and retest...
{
MyNodePtr tmp(MyNode::create());
@@ -131,11 +131,11 @@ BEGIN_TEST(TestEndOfList)
}
MyNodePtr hundredPtr;
lruList.getLRUEntry(hundredPtr);
- ASSERT(hundredPtr != NULLPTR, "expected to not be NULL");
- ASSERT(dynCast<MyNodePtr>(hundredPtr)->getValue() == 100,
+ ASSERT(hundredPtr != nullptr, "expected to not be NULL");
+ ASSERT(std::dynamic_pointer_cast<MyNode>(hundredPtr)->getValue() == 100,
"expected value of 100");
lruList.getLRUEntry(emptyPtr);
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ ASSERT(emptyPtr == nullptr, "expected NULL");
}
END_TEST(TestEndOfList)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 8655796..a700a98 100644
--- a/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -99,7 +99,7 @@ void checkOverflowTokenValues(RegionPtr& regionPtr, uint32_t num) {
nonoverflowCount++;
}
- valuePtr = NULLPTR;
+ valuePtr = nullptr;
}
ASSERT(count == 0, "No of overflowed entries should be zero");
ASSERT(nonoverflowCount == v.size(),
@@ -128,10 +128,10 @@ void checkOverflowToken(RegionPtr& regionPtr, uint32_t lruLimit) {
invalidCount++;
} else if (CacheableToken::isDestroyed(valuePtr)) {
destoyedCount++;
- } else if (valuePtr != NULLPTR) {
+ } else if (valuePtr != nullptr) {
normalCount++;
}
- valuePtr = NULLPTR;
+ valuePtr = nullptr;
}
printf("Keys vector size is %d\n", v.size());
printf("Normal entries count is %d\n", normalCount);
@@ -181,9 +181,8 @@ uint32_t doNgetLargeData(RegionPtr& regionPtr, int num) {
for (int i = 0; i < num; i++) {
printf("Getting key = %d\n", i);
- CacheableStringPtr valuePtr =
- dynCast<CacheableStringPtr>(regionPtr->get(i));
- if (valuePtr == NULLPTR) {
+ auto valuePtr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(i));
+ if (valuePtr == nullptr) {
countNotFound++;
} else {
countFound++;
@@ -201,10 +200,9 @@ uint32_t doNget(RegionPtr& regionPtr, uint32_t num, uint32_t start = 0) {
for (uint32_t i = start; i < num; i++) {
char keybuf[100];
sprintf(keybuf, "key-%d", i);
- CacheableStringPtr valuePtr =
- dynCast<CacheableStringPtr>(regionPtr->get(keybuf));
+ auto valuePtr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keybuf));
printf("Getting key = %s\n", keybuf);
- if (valuePtr == NULLPTR) {
+ if (valuePtr == nullptr) {
countNotFound++;
} else {
countFound++;
@@ -286,16 +284,16 @@ void verifyGetAll(RegionPtr region, int startIndex) {
for (int i = 0; i <= 100; i++) keysVector.push_back(CacheableKey::create(i));
// keysVector.push_back(CacheableKey::create(101)); //key not there
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- region->getAll(keysVector, valuesMap, NULLPTR, false);
+ region->getAll(keysVector, valuesMap, nullptr, false);
if (valuesMap->size() == keysVector.size()) {
int i = startIndex;
for (HashMapOfCacheable::Iterator iter = valuesMap->begin();
iter != valuesMap->end(); iter++, i++) {
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(iter.first());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(iter.first());
CacheablePtr mVal = iter.second();
- if (mVal != NULLPTR) {
+ if (mVal != nullptr) {
int val = atoi(mVal->toString()->asChar());
ASSERT(val == i, "value not matched");
}
@@ -308,7 +306,7 @@ void createRegion(RegionPtr& regionPtr, const char* regionName,
CacheFactoryPtr cacheFactoryPtr =
CacheFactory::createCacheFactory(cacheProps);
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
regionFactoryPtr->setCachingEnabled(true);
regionFactoryPtr->setLruEntriesLimit(10);
@@ -317,7 +315,7 @@ void createRegion(RegionPtr& regionPtr, const char* regionName,
regionFactoryPtr->setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
sqLiteProps);
regionPtr = regionFactoryPtr->create(regionName);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
}
void setSqLiteProperties(PropertiesPtr& sqliteProperties,
@@ -327,7 +325,7 @@ void setSqLiteProperties(PropertiesPtr& sqliteProperties,
sqliteProperties->insert(MAX_PAGE_COUNT, maxPageCount);
sqliteProperties->insert(PAGE_SIZE, pageSize);
sqliteProperties->insert(PERSISTENCE_DIR, pDir.c_str());
- ASSERT(sqliteProperties != NULLPTR,
+ ASSERT(sqliteProperties != nullptr,
"Expected sqlite properties to be NON-NULL");
}
// creation of subregion.
@@ -337,7 +335,7 @@ void createSubRegion(RegionPtr& regionPtr, RegionPtr& subRegion,
RegionAttributesPtr regionAttributesPtr;
setAttributes(regionAttributesPtr, pDir);
subRegion = regionPtr->createSubregion(regionName, regionAttributesPtr);
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", pDir.c_str(), regionName, regionName);
ACE_stat fileStat;
@@ -356,7 +354,7 @@ BEGIN_TEST(OverFlowTest)
RegionPtr regionPtr;
createRegion(regionPtr, "OverFlowRegion", cacheProperties,
sqliteProperties);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** put some values into the cache. */
doNput(regionPtr, 50);
@@ -384,12 +382,12 @@ BEGIN_TEST(OverFlowTest)
RegionPtr subRegion;
for (int i = 0; i < 10; i++) {
createSubRegion(regionPtr, subRegion, "SubRegion");
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
checkOverflowToken(subRegion,
10); // check the overflow count for each reion
subRegion->destroyRegion();
ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
- subRegion = NULLPTR;
+ subRegion = nullptr;
ACE_TCHAR hname[MAXHOSTNAMELEN];
ACE_OS::hostname(hname, sizeof(hname) - 1);
char sqliteDirSubRgn[512];
@@ -421,7 +419,7 @@ BEGIN_TEST(OverFlowTest_absPath)
RegionPtr regionPtr;
createRegion(regionPtr, "OverFlowRegion", cacheProperties,
sqliteProperties);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** put some values into the cache. */
@@ -449,10 +447,10 @@ BEGIN_TEST(OverFlowTest_absPath)
RegionPtr subRegion;
for (int i = 0; i < 10; i++) {
createSubRegion(regionPtr, subRegion, "SubRegion", absPersistenceDir);
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
subRegion->destroyRegion();
ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
- subRegion = NULLPTR;
+ subRegion = nullptr;
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", absPersistenceDir.c_str(), "SubRegion",
"SubRegion");
@@ -469,7 +467,7 @@ BEGIN_TEST(OverFlowTest_SqLiteFull)
{
CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory();
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
regionFactoryPtr->setCachingEnabled(true);
regionFactoryPtr->setLruEntriesLimit(1);
@@ -483,7 +481,7 @@ BEGIN_TEST(OverFlowTest_SqLiteFull)
regionFactoryPtr->setPersistenceManager(
"SqLiteImpl", "createSqLiteInstance", sqliteProperties);
RegionPtr regionPtr = regionFactoryPtr->create("OverFlowRegion");
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
try {
doNput(regionPtr, 100);
@@ -514,8 +512,8 @@ END_TEST(OverFlowTest_SqLiteFull)
// CachePtr cachePtr ;
// PropertiesPtr pp = Properties::create();
// startDSandCreateCache(dsysPtr, cachePtr, pp);
-// ASSERT(dsysPtr != NULLPTR, "Expected dsys to be NON-NULL");
-// ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+// ASSERT(dsysPtr != nullptr, "Expected dsys to be NON-NULL");
+// ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
//
// RegionAttributesPtr attrsPtr;
// AttributesFactory attrsFact;
@@ -531,11 +529,11 @@ END_TEST(OverFlowTest_SqLiteFull)
// attrsFact.setPersistenceManager("SqLiteImpl","createSqLiteInstance",sqliteProperties);
//
// attrsPtr = attrsFact.createRegionAttributes( );
-// ASSERT(attrsPtr != NULLPTR, "Expected region attributes to be NON-NULL");
+// ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-NULL");
//
// /** Create a region with caching and LRU. */
// RegionPtr regionPtr = cachePtr->createRegion( "OverFlowRegion", attrsPtr );
-// ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+// ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
//
// /** put one million values into the cache. to test the large data values*/
// doNputLargeData(regionPtr, 1024 * 1); //arround 100 GB data
@@ -552,10 +550,10 @@ END_TEST(OverFlowTest_SqLiteFull)
// for(int i = 0; i<10; i++)
// {
// createSubRegion(regionPtr,subRegion,attrsPtr,"SubRegion");
-// ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+// ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
// subRegion->destroyRegion();
// ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
-// subRegion = NULLPTR;
+// subRegion = nullptr;
// ACE_TCHAR hname[MAXHOSTNAMELEN];
// ACE_OS::hostname( hname, sizeof(hname)-1);
// char sqliteDirSubRgn[512];
@@ -582,7 +580,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
pp->insert("heap-lru-delta", 10);
CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
regionFactoryPtr->setCachingEnabled(true);
regionFactoryPtr->setLruEntriesLimit(1024 * 10);
@@ -597,7 +595,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
regionFactoryPtr->setPersistenceManager(
"SqLiteImpl", "createSqLiteInstance", sqliteProperties);
RegionPtr regionPtr = regionFactoryPtr->create("OverFlowRegion");
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** put some values into the cache. */
@@ -619,7 +617,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
RegionAttributesPtr regionAttributesPtr;
setAttributes(regionAttributesPtr);
subRegion = regionPtr->createSubregion("SubRegion", regionAttributesPtr);
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", sqlite_dir.c_str(), "SubRegion",
"SubRegion");
@@ -630,7 +628,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
doNget(subRegion, 50);
subRegion->destroyRegion();
ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
- subRegion = NULLPTR;
+ subRegion = nullptr;
ASSERT(ACE_OS::stat(fileName, &fileStat) == -1,
"persistence file still present");
}
@@ -643,17 +641,17 @@ BEGIN_TEST(OverFlowTest_MultiThreaded)
{
/** Creating a cache to manage regions. */
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionAttributesPtr attrsPtr;
setAttributes(attrsPtr);
- ASSERT(attrsPtr != NULLPTR, "Expected region attributes to be NON-NULL");
+ ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-NULL");
/** Create a region with caching and LRU. */
RegionPtr regionPtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
cacheImpl->createRegion("OverFlowRegion", attrsPtr, regionPtr);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** test to verify same region repeatedly to ensure that the persistece
@@ -684,17 +682,17 @@ BEGIN_TEST(OverFlowTest_PutGetAll)
{
/** Creating a cache to manage regions. */
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionAttributesPtr attrsPtr;
setAttributes(attrsPtr);
- ASSERT(attrsPtr != NULLPTR, "Expected region attributes to be NON-NULL");
+ ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-NULL");
/** Create a region with caching and LRU. */
RegionPtr regionPtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
cacheImpl->createRegion("OverFlowRegion", attrsPtr, regionPtr);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
// putAll some entries
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp b/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
index 35fdc8f..1b5af27 100644
--- a/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
+++ b/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
@@ -42,7 +42,7 @@ class GetRegionThread : public ACE_Task_Base {
SLEEP(40);
try {
RegionPtr rptr = getHelper()->getRegion(m_path.c_str());
- if (rptr != NULLPTR) {
+ if (rptr != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
ASSERT(m_regionCreateDone == true, "regionCreate Not Done");
}
@@ -58,7 +58,7 @@ class GetRegionThread : public ACE_Task_Base {
}
try {
RegionPtr rptr = getHelper()->getRegion(m_subPath.c_str());
- if (rptr != NULLPTR) {
+ if (rptr != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
ASSERT(m_subRegionCreateDone == true, "subRegionCreate Not Done");
return 0;
@@ -111,7 +111,7 @@ ENDTASK
DUNIT_TASK(s2p2, CreateNormalRegion)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
LOG("create normal region");
getThread =
new GetRegionThread("DistRegionAck", "DistRegionAck/AuthSubregion");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testRegionMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testRegionMap.cpp b/src/cppcache/integration-test/testRegionMap.cpp
index c3c4255..df268b2 100644
--- a/src/cppcache/integration-test/testRegionMap.cpp
+++ b/src/cppcache/integration-test/testRegionMap.cpp
@@ -70,7 +70,7 @@ BEGIN_TEST(TestRegionLRULastTen)
int total = 0;
for (int k = 10; k < 20; k++) {
expected += k;
- CacheableStringPtr key = dynCast<CacheableStringPtr>(vecKeys.back());
+ auto key = std::dynamic_pointer_cast<CacheableString>(vecKeys.back());
vecKeys.pop_back();
total += atoi(key->asChar());
}
@@ -151,8 +151,8 @@ BEGIN_TEST(TestRecentlyUsedBit)
sprintf(buf, "%d", 15);
CacheableStringPtr value2Ptr;
CacheableKeyPtr key2 = CacheableKey::create(buf);
- value2Ptr = dynCast<CacheableStringPtr>(regionPtr->get(key2));
- ASSERT(value2Ptr != NULLPTR, "expected to find key 15 in cache.");
+ value2Ptr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(key2));
+ ASSERT(value2Ptr != nullptr, "expected to find key 15 in cache.");
for (i = 20; i < 35; i++) {
sprintf(buf, "%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -201,7 +201,7 @@ BEGIN_TEST(TestEmptiedMap)
sprintf(buf, "%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
regionPtr->destroy(key);
- cout << "removed key " << dynCast<CacheableStringPtr>(key)->asChar()
+ cout << "removed key " << std::dynamic_pointer_cast<CacheableString>(key)->asChar()
<< endl;
}
VectorOfCacheableKey vecKeys;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testRegionTemplateArgs.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testRegionTemplateArgs.cpp b/src/cppcache/integration-test/testRegionTemplateArgs.cpp
index 523f80e..457825c 100644
--- a/src/cppcache/integration-test/testRegionTemplateArgs.cpp
+++ b/src/cppcache/integration-test/testRegionTemplateArgs.cpp
@@ -24,7 +24,7 @@
using namespace apache::geode::client;
bool CheckBytesEqual(CacheableBytesPtr result, CacheablePtr expected) {
- CacheableBytesPtr expectedPtr = dynCast<CacheableBytesPtr>(expected);
+ auto expectedPtr = std::dynamic_pointer_cast<CacheableBytes>(expected);
// Assume that the bytes are really a char*
return (strcmp((char*)result->value(), (char*)expectedPtr->value()) == 0);
}
@@ -39,7 +39,7 @@ BEGIN_TEST(CheckTemplates)
AttributesFactory afact;
RegionAttributesPtr attrs = afact.createRegionAttributes();
RegionPtr regPtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
cacheImpl->createRegion("TestRegion", attrs, regPtr);
const char charKey[] = "test key";
@@ -74,19 +74,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, valPtr);
regPtr->put(intKey, valPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
@@ -100,19 +100,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, bytesPtr);
regPtr->put(intKey, bytesPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
@@ -126,20 +126,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, stringPtr);
regPtr->put(intKey, stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
// End with stringPtr
@@ -152,20 +152,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, int32Ptr);
regPtr->put(intKey, int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
// End with int32Ptr
@@ -178,19 +178,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, charVal);
regPtr->put(intKey, charVal);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
@@ -204,15 +204,15 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, intVal);
regPtr->put(intKey, intVal);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
// End with intVal
@@ -236,19 +236,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, valPtr);
regPtr->create(intKey, valPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
@@ -303,19 +303,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, bytesPtr);
regPtr->create(intKey, bytesPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
@@ -370,20 +370,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, stringPtr);
regPtr->create(intKey, stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
regPtr->localInvalidate(keyPtr);
@@ -437,20 +437,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, int32Ptr);
regPtr->create(intKey, int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
regPtr->localInvalidate(keyPtr);
@@ -504,19 +504,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, charVal);
regPtr->create(intKey, charVal);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
@@ -571,19 +571,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, intVal);
regPtr->create(intKey, intVal);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
@@ -644,23 +644,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, valPtr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(charKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(intKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
@@ -716,23 +716,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, bytesPtr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(charKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(intKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
@@ -788,24 +788,24 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, stringPtr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(intKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(charKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
regPtr->invalidate(keyPtr);
@@ -860,24 +860,24 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, int32Ptr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(intKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(charKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
regPtr->invalidate(keyPtr);
@@ -932,23 +932,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, charVal);
resEntryPtr = regPtr->getEntry(keyPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(intKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(charKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
@@ -1004,23 +1004,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, intVal);
resEntryPtr = regPtr->getEntry(keyPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(intKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(charKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testSerialization.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSerialization.cpp b/src/cppcache/integration-test/testSerialization.cpp
index 07782e9..608ccb8 100644
--- a/src/cppcache/integration-test/testSerialization.cpp
+++ b/src/cppcache/integration-test/testSerialization.cpp
@@ -32,6 +32,7 @@
#include <CppCacheLibrary.hpp>
#include "CacheHelper.hpp"
+#include <memory>
using namespace apache::geode::client;
@@ -51,7 +52,7 @@ SharedPtr<T> duplicate(const SharedPtr<T>& orig) {
uint32_t length = 0;
const uint8_t* buffer = dout.getBuffer(&length);
DataInput din(buffer, length);
- result = static_cast<T*>(SerializationRegistry::deserialize(din).ptr());
+ result = std::static_pointer_cast<T>(SerializationRegistry::deserialize(din));
// din.readObject(result);
return result;
@@ -129,8 +130,8 @@ class OtherType : public Serializable {
char logmsg[1000];
sprintf(logmsg, "validateCT for %d", i);
LOG(logmsg);
- XASSERT(otPtr != NULLPTR);
- OtherType* ot = static_cast<OtherType*>(otPtr.ptr());
+ XASSERT(otPtr != nullptr);
+ OtherType* ot = static_cast<OtherType*>(otPtr.get());
XASSERT(ot != NULL);
printf("Validating OtherType: %d, %s, %c, %e\n", ot->m_struct.a,
@@ -163,7 +164,7 @@ DUNIT_TASK(NoDist, SerializeInMemory)
str = CacheableString::create("");
copy = duplicate(str);
- ASSERT(copy != NULLPTR, "error null copy.");
+ ASSERT(copy != nullptr, "error null copy.");
ASSERT(copy->length() == 0, "expected 0 length.");
CacheableInt32Ptr intkey = CacheableInt32::create(1);
@@ -241,7 +242,7 @@ DUNIT_TASK(Sender, SetupAndPutInts)
Serializable::registerType(OtherType::createDeserializable2);
Serializable::registerType(OtherType::createDeserializable4);
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion("DistRegionAck", USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
LOG("SenderInit complete.");
@@ -286,7 +287,7 @@ ENDTASK
DUNIT_TASK(Sender, CloseCacheS)
{
- regionPtr = NULLPTR;
+ regionPtr = nullptr;
cleanProc();
}
ENDTASK
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testSharedPtr.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSharedPtr.cpp b/src/cppcache/integration-test/testSharedPtr.cpp
deleted file mode 100644
index a8753ad..0000000
--- a/src/cppcache/integration-test/testSharedPtr.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define ROOT_NAME "testSharedPtr"
-
-#include "fw_dunit.hpp"
-#include <geode/GeodeCppCache.hpp>
-
-#include <HostAsm.hpp>
-
-using namespace apache::geode::client;
-
-// Test some HostAsm code first..
-DUNIT_TASK(s1p1, HostAsm)
- {
- volatile int32_t counter = 0;
- XASSERT(counter == 0);
- HostAsm::atomicAdd(counter, 1);
- XASSERT(counter == 1);
- HostAsm::atomicAdd(counter, 3);
- XASSERT(counter == 4);
-
- HostAsm::atomicAdd(counter, -1);
- XASSERT(counter == 3);
- }
-END_TASK(HostAsm)
-
-// Test Or and And.
-DUNIT_TASK(s1p1, AndOr)
- {
- volatile uint32_t bits = 0;
- uint32_t mask1 = 0x00000001ul;
- uint32_t mask2 = 0x00000002ul;
-
- HostAsm::atomicOr(bits, mask1);
- XASSERT(bits == 1);
- HostAsm::atomicAnd(bits, ~mask1);
- XASSERT(bits == 0);
- HostAsm::atomicOr(bits, mask1);
- HostAsm::atomicOr(bits, mask2);
- XASSERT(bits == 3);
- HostAsm::atomicAnd(bits, ~mask1);
- XASSERT(bits == 2);
- HostAsm::atomicAnd(bits, ~mask2);
- XASSERT(bits == 0);
- }
-END_TASK(AndOr)
-
-bool deleted = false;
-
-class TestObj : public SharedBase {
- public:
- TestObj() : SharedBase() {}
-
- ~TestObj() { deleted = true; }
-};
-
-typedef SharedPtr<TestObj> TestObjPtr;
-
-DUNIT_TASK(s1p1, A)
- {
- char logmsg[1024];
- deleted = false;
- TestObj* obj = new TestObj();
- sprintf(logmsg, "TestObj->refCount(): %d\n", obj->refCount());
- LOG(logmsg);
- ASSERT(obj->refCount() == 0, "refcount should be 0, no ptrs yet.");
- TestObjPtr* ptr = new TestObjPtr(obj);
- sprintf(logmsg, "TestObj->refCount(): %d\n", obj->refCount());
- LOG(logmsg);
- ASSERT((*ptr)->refCount() == 1, "Expected refCount == 1");
- delete ptr;
- ASSERT(deleted == true, "Expected destruction.");
- }
-END_TASK(A)
-
-DUNIT_TASK(s1p1, B)
- {
- deleted = false;
- TestObjPtr* heapPtr = new TestObjPtr();
- {
- TestObjPtr ptr(new TestObj());
- ASSERT(ptr->refCount() == 1, "Expected refCount == 1");
- *heapPtr = ptr;
- ASSERT(ptr->refCount() == 2, "Expected refCount == 2");
- }
- ASSERT(deleted == false, "Only one reference went away, should be alive.");
- ASSERT((*heapPtr)->refCount() == 1, "Expected refCount == 1");
- delete heapPtr;
- ASSERT(deleted == true,
- "Now last reference is gone, so TestObj should be deleted.");
- LOG("Finished successfully.");
- }
-END_TASK(B)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testSystemProperties.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSystemProperties.cpp b/src/cppcache/integration-test/testSystemProperties.cpp
index 4ed4582..0d0659c 100644
--- a/src/cppcache/integration-test/testSystemProperties.cpp
+++ b/src/cppcache/integration-test/testSystemProperties.cpp
@@ -35,7 +35,7 @@ const bool checkSecurityProperties(PropertiesPtr securityProperties,
return false;
}
CacheableStringPtr tempValue = securityProperties->find(key);
- if (tempValue == NULLPTR) {
+ if (tempValue == nullptr) {
return (false);
}
flag = strcmp(tempValue->asChar(), value);
@@ -44,7 +44,7 @@ const bool checkSecurityProperties(PropertiesPtr securityProperties,
BEGIN_TEST(DEFAULT)
{
- SystemProperties* sp = new SystemProperties(NULLPTR, "./non-existent");
+ SystemProperties* sp = new SystemProperties(nullptr, "./non-existent");
ASSERT(sp->statisticsSampleInterval() == 1, "expected 1");
ASSERT(sp->statisticsEnabled() == true, "expected true");
LOG(sp->statisticsArchiveFile());
@@ -77,7 +77,7 @@ BEGIN_TEST(CONFIG)
// Make sure product can at least log to stdout.
Log::init(Log::Config, NULL, 0);
- SystemProperties* sp = new SystemProperties(NULLPTR, "test.properties");
+ SystemProperties* sp = new SystemProperties(nullptr, "test.properties");
ASSERT(sp->statisticsSampleInterval() == 1, "expected 1");
ASSERT(sp->statisticsEnabled() == true, "expected true");
const char* safname = sp->statisticsArchiveFile();
@@ -99,7 +99,7 @@ BEGIN_TEST(NEW_CONFIG)
// Make sure product can at least log to stdout.
Log::init(Log::Config, NULL, 0);
- SystemProperties* sp = new SystemProperties(NULLPTR, filePath.c_str());
+ SystemProperties* sp = new SystemProperties(nullptr, filePath.c_str());
ASSERT(sp->statisticsSampleInterval() == 700, "expected 700");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp b/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
index 5a9fdc5..ececb02 100644
--- a/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
+++ b/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
@@ -50,10 +50,10 @@ class DisconnectCacheListioner : public CacheListener {
}
};
-CacheListenerPtr cptr1(new DisconnectCacheListioner(0));
-CacheListenerPtr cptr2(new DisconnectCacheListioner(1));
-CacheListenerPtr cptr3(new DisconnectCacheListioner(2));
-CacheListenerPtr cptr4(new DisconnectCacheListioner(3));
+auto cptr1 = std::make_shared<DisconnectCacheListioner>(0);
+auto cptr2 = std::make_shared<DisconnectCacheListioner>(1);
+auto cptr3 = std::make_shared<DisconnectCacheListioner>(2);
+auto cptr4 = std::make_shared<DisconnectCacheListioner>(3);
#include "LocatorHelper.hpp"
@@ -62,7 +62,7 @@ void createPooledRegionMine(bool callReadyForEventsAPI = false) {
poolFacPtr->setSubscriptionEnabled(true);
getHelper()->addServerLocatorEPs(locatorsG, poolFacPtr);
if ((PoolManager::find("__TEST_POOL1__")) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create("__TEST_POOL1__");
}
SLEEP(10000);
@@ -85,7 +85,7 @@ void createPooledRegionMine(bool callReadyForEventsAPI = false) {
af.setCacheListener(cptr4);
RegionAttributesPtr rattrsPtr4 = af.createRegionAttributes();
CacheImpl* cacheImpl =
- CacheRegionHelper::getCacheImpl(getHelper()->cachePtr.ptr());
+ CacheRegionHelper::getCacheImpl(getHelper()->cachePtr.get());
RegionPtr region1;
cacheImpl->createRegion(regionNames[0], rattrsPtr1, region1);
RegionPtr region2;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientBigValue.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientBigValue.cpp b/src/cppcache/integration-test/testThinClientBigValue.cpp
index 987aed6..e072c1c 100644
--- a/src/cppcache/integration-test/testThinClientBigValue.cpp
+++ b/src/cppcache/integration-test/testThinClientBigValue.cpp
@@ -61,11 +61,11 @@ void putSize(RegionPtr& rptr, const char* buf, int size) {
void verify(CacheableBytesPtr& valuePtr, int size) {
char msg[200];
sprintf(msg, "verifying value of size %d", size);
- ASSERT(size == 0 || valuePtr != NULLPTR, msg);
+ ASSERT(size == 0 || valuePtr != nullptr, msg);
sprintf(msg, "value size is not %d", size);
int tryCnt = 0;
bool notIt = true;
- int valSize = (valuePtr != NULLPTR ? valuePtr->length() : 0);
+ int valSize = (valuePtr != nullptr ? valuePtr->length() : 0);
while ((notIt == true) && (tryCnt++ < 10)) {
notIt = (valSize != size);
SLEEP(100);
@@ -109,7 +109,7 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
}
@@ -118,7 +118,7 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
}
@@ -155,11 +155,11 @@ DUNIT_TASK(CLIENT2, VerifyPuts)
sprintf(keybuf, "key%010d", i);
CacheableKeyPtr keyPtr = CacheableKey::create(keybuf);
CacheableBytesPtr valPtr =
- dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
int ntry = 20;
- while ((ntry-- > 0) && (valPtr == NULLPTR)) {
+ while ((ntry-- > 0) && (valPtr == nullptr)) {
SLEEP(200);
- valPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ valPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
}
LOG("from VerifyPuts");
verify(valPtr, i);
@@ -195,9 +195,8 @@ DUNIT_TASK(CLIENT2, VerifyManyPuts)
char keybuf[100];
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 107, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via get.");
@@ -231,9 +230,8 @@ DUNIT_TASK(CLIENT2, VerifyOldManyPuts)
char keybuf[100];
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 107, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via "
@@ -252,9 +250,8 @@ DUNIT_TASK(CLIENT2, VerifyUpdatedManyPuts)
char keybuf[100];
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 1007, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via "
@@ -277,20 +274,19 @@ DUNIT_TASK(CLIENT2, VerifyUpdatedManyPutsGetAll)
vec.push_back(CacheableKey::create(keybuf));
}
try {
- regPtr->getAll(vec, NULLPTR, NULLPTR, false);
+ regPtr->getAll(vec, nullptr, nullptr, false);
FAIL(
"Expected IllegalArgumentException when nothing "
"is being fetched");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
- regPtr->getAll(vec, NULLPTR, NULLPTR, true);
+ regPtr->getAll(vec, nullptr, nullptr, true);
LOG("On client getAll for entries completed.");
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 1007, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via "
@@ -324,10 +320,9 @@ DUNIT_TASK(CLIENT2, VerifyManyPutsInt64)
for (int64_t index = 0; index < entriesExpected; ++index) {
int64_t key = index * index * index;
// CacheableStringPtr valPtr =
- // dynCast<CacheableStringPtr>(regPtr->get(key));
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(CacheableInt64::create(key)));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ // std::dynamic_pointer_cast<CacheableString>(regPtr->get(key));
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(CacheableInt64::create(key)));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
}
LOG("On client Found all int64 entries with "
@@ -338,10 +333,9 @@ DUNIT_TASK(CLIENT2, VerifyManyPutsInt64)
// * index * index));
CacheableKeyPtr key = CacheableInt64::create(index * index * index);
RegionEntryPtr entry = regPtr->getEntry(key);
- ASSERT(entry != NULLPTR, "expected non-null entry");
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(entry->getValue());
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ ASSERT(entry != nullptr, "expected non-null entry");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(entry->getValue());
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
}
LOG("On client Found all int64 entries with "
@@ -365,29 +359,28 @@ DUNIT_TASK(CLIENT2, VerifyUpdatedManyPutsInt64GetAll)
vec.push_back(CacheableInt64::create(key));
}
try {
- regPtr->getAll(vec, NULLPTR, NULLPTR, false);
+ regPtr->getAll(vec, nullptr, nullptr, false);
FAIL(
"Expected IllegalArgumentException when "
"nothing is being fetched");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
- regPtr->getAll(vec, valuesMap, NULLPTR, true);
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
+ regPtr->getAll(vec, valuesMap, nullptr, true);
LOG("On client getAll for int64 entries "
"completed.");
for (int32_t index = 0; index < entriesExpected; ++index) {
CacheableKeyPtr key = vec[index];
RegionEntryPtr entry = regPtr->getEntry(key);
- ASSERT(entry != NULLPTR, "expected non-null entry");
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(entry->getValue());
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ ASSERT(entry != nullptr, "expected non-null entry");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(entry->getValue());
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
HashMapOfCacheable::Iterator iter = valuesMap->find(key);
ASSERT(iter != valuesMap->end(), "expected to find key in map");
- valPtr = dynCast<CacheableStringPtr>(iter.second());
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ valPtr = std::dynamic_pointer_cast<CacheableString>(iter.second());
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
}
LOG("On client Found all int64 entries with "
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
index f0b3ab7..5e621b3 100644
--- a/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
+++ b/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
@@ -67,7 +67,7 @@ DUNIT_TASK(CLIENT1, StepOne)
Serializable::registerType(Portfolio::createDeserializable);
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
RegionPtr regptr = getHelper()->createPooledRegion(
_regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true);
RegionAttributesPtr lattribPtr = regptr->getAttributes();
@@ -106,22 +106,22 @@ DUNIT_TASK(CLIENT1, StepThree)
while (iter.hasNext()) {
count--;
SerializablePtr ser = iter.next();
- PortfolioPtr portfolio(dynamic_cast<Portfolio*>(ser.ptr()));
- PositionPtr position(dynamic_cast<Position*>(ser.ptr()));
+ PortfolioPtr portfolio = std::dynamic_pointer_cast<Portfolio>(ser);
+ PositionPtr position = std::dynamic_pointer_cast<Position>(ser);
- if (portfolio != NULLPTR) {
+ if (portfolio != nullptr) {
printf(" query pulled portfolio object ID %d, pkid %s\n",
portfolio->getID(), portfolio->getPkid()->asChar());
}
- else if (position != NULLPTR) {
+ else if (position != nullptr) {
printf(" query pulled position object secId %s, shares %d\n",
position->getSecId()->asChar(),
position->getSharesOutstanding());
}
else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
} else {
printf(" query pulled bad object\n");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCacheables.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCacheables.cpp b/src/cppcache/integration-test/testThinClientCacheables.cpp
index 0ca8d06..30b332b 100644
--- a/src/cppcache/integration-test/testThinClientCacheables.cpp
+++ b/src/cppcache/integration-test/testThinClientCacheables.cpp
@@ -71,9 +71,9 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -87,16 +87,16 @@ void checkGets(int maxKeys, int8_t keyTypeId, int8_t valTypeId,
CacheableWrapperFactory::createInstance(valTypeId);
ASSERT(tmpval != NULL, "tmpval is NULL");
tmpkey->initKey(i, KEYSIZE);
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(tmpkey->getCacheable());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable());
CacheablePtr val = dataReg->get(key);
// also check that value is in local cache
RegionEntryPtr entry = dataReg->getEntry(key);
- ASSERT(entry != NULLPTR, "entry is NULL");
+ ASSERT(entry != nullptr, "entry is NULL");
CacheablePtr localVal = entry->getValue();
uint32_t keychksum = tmpkey->getCheckSum();
- CacheableInt32Ptr int32val = dynCast<CacheableInt32Ptr>(
+ auto int32val = std::dynamic_pointer_cast<CacheableInt32>(
verifyReg->get(static_cast<int32_t>(keychksum)));
- if (int32val == NULLPTR) {
+ if (int32val == nullptr) {
printf("GetsTask::keychksum: %u, key: %s\n", keychksum,
Utils::getCacheableKeyString(key)->asChar());
FAIL("Could not find the checksum for the given key.");
@@ -179,19 +179,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
CacheableWrapperFactory::createInstance(valTypeId);
tmpkey->initKey(i, KEYSIZE);
tmpval->initRandomValue(CacheableHelper::random(VALUESIZE) + 1);
- ASSERT(tmpkey->getCacheable() != NULLPTR,
+ ASSERT(tmpkey->getCacheable() != nullptr,
"tmpkey->getCacheable() is NULL");
// we can have NULL values now after fix for bug #294
- if (tmpval->getCacheable() != NULLPTR) {
- dataReg->put(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()),
+ if (tmpval->getCacheable() != nullptr) {
+ dataReg->put(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
tmpval->getCacheable());
} else {
try {
- dataReg->destroy(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()));
+ dataReg->destroy(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()));
} catch (const EntryNotFoundException&) {
// expected
}
- dataReg->create(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()),
+ dataReg->create(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
tmpval->getCacheable());
}
uint32_t keychksum = tmpkey->getCheckSum();
@@ -200,9 +200,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
static_cast<int32_t>(valchksum));
// also check that value is in local cache
RegionEntryPtr entry =
- dataReg->getEntry(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()));
+ dataReg->getEntry(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()));
CacheablePtr localVal;
- if (entry != NULLPTR) {
+ if (entry != nullptr) {
localVal = entry->getValue();
}
uint32_t localValChkSum = tmpval->getCheckSum(localVal);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp b/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
index 3931fe0..081bf1b 100644
--- a/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
+++ b/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
@@ -64,9 +64,9 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, false, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, false, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
uint8_t* createRandByteArray(int size) {
@@ -91,7 +91,7 @@ const char* _regionNames[] = {"DistRegionAck", "DistRegionNoAck"};
DUNIT_TASK_DEFINITION(CLIENT1, StepOne)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(_regionNames[1], NO_ACK, locatorsG,
"__TEST_POOL1__", false, false);
LOG("StepOne complete.");
@@ -129,16 +129,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
ASSERT(!verifyReg->containsValueForKey(KEY_EMPTY_BYTESARR),
"Contains value key failed for empty bytes array");
- CacheableBytesPtr bytePtrReturn =
- dynCast<CacheableBytesPtr>(verifyReg->get(KEY_BYTE));
- CacheableStringPtr stringPtrReturn =
- dynCast<CacheableStringPtr>(verifyReg->get(KEY_STRING));
- CacheableBytesPtr emptyBytesArrReturn =
- dynCast<CacheableBytesPtr>(verifyReg->get(KEY_EMPTY_BYTESARR));
+ auto bytePtrReturn = std::dynamic_pointer_cast<CacheableBytes>(verifyReg->get(KEY_BYTE));
+ auto stringPtrReturn = std::dynamic_pointer_cast<CacheableString>(verifyReg->get(KEY_STRING));
+ auto emptyBytesArrReturn = std::dynamic_pointer_cast<CacheableBytes>(verifyReg->get(KEY_EMPTY_BYTESARR));
- ASSERT(bytePtrReturn != NULLPTR, "Byte val is NULL");
- ASSERT(stringPtrReturn != NULLPTR, "String val is NULL");
- ASSERT(emptyBytesArrReturn != NULLPTR, "Empty Bytes Array ptr is NULL");
+ ASSERT(bytePtrReturn != nullptr, "Byte val is NULL");
+ ASSERT(stringPtrReturn != nullptr, "String val is NULL");
+ ASSERT(emptyBytesArrReturn != nullptr, "Empty Bytes Array ptr is NULL");
bool isSameBytes = (bytePtrReturn->length() == bytePtrSent->length() &&
!memcmp(bytePtrReturn->value(), bytePtrSent->value(),
@@ -167,9 +164,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
ASSERT(!verifyReg->containsValueForKey(KEY_EMPTY_BYTESARR),
"Contains value key failed for empty bytes array");
- CacheableBytesPtr emptyBytesArrReturn1 =
- dynCast<CacheableBytesPtr>(verifyReg->get(KEY_EMPTY_BYTESARR));
- ASSERT(emptyBytesArrReturn1 != NULLPTR, "Empty Bytes Array ptr is NULL");
+ auto emptyBytesArrReturn1 = std::dynamic_pointer_cast<CacheableBytes>(verifyReg->get(KEY_EMPTY_BYTESARR));
+ ASSERT(emptyBytesArrReturn1 != nullptr, "Empty Bytes Array ptr is NULL");
ASSERT(emptyBytesArrReturn1->length() == 0,
"Empty Bytes Array length is not 0.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientClearRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientClearRegion.cpp b/src/cppcache/integration-test/testThinClientClearRegion.cpp
index cdb6cf2..480af07 100644
--- a/src/cppcache/integration-test/testThinClientClearRegion.cpp
+++ b/src/cppcache/integration-test/testThinClientClearRegion.cpp
@@ -68,13 +68,13 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
AttributesMutatorPtr mtor = regPtr->getAttributesMutator();
- CacheListenerPtr lster(new MyCacheListener());
- CacheWriterPtr wter(new MyCacheWriter());
+ auto lster = std::make_shared<MyCacheListener>();
+ auto wter = std::make_shared<MyCacheWriter>();
mtor->setCacheListener(lster);
mtor->setCacheWriter(wter);
regPtr->registerAllKeys();
@@ -84,7 +84,7 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
@@ -131,13 +131,13 @@ DUNIT_TASK(CLIENT1, VerifyClear1)
ASSERT(regPtr->containsKeyOnServer(keyPtr), "key should be there");
RegionAttributesPtr attr = regPtr->getAttributes();
CacheListenerPtr clp = attr->getCacheListener();
- MyCacheListener* mcl = dynamic_cast<MyCacheListener*>(clp.ptr());
+ MyCacheListener* mcl = dynamic_cast<MyCacheListener*>(clp.get());
char buf[1024];
sprintf(buf, "listener clear count=%d", mcl->getClearCnt());
LOG(buf);
ASSERT(mcl->getClearCnt() == 2, buf);
CacheWriterPtr cwp = attr->getCacheWriter();
- MyCacheWriter* mcw = dynamic_cast<MyCacheWriter*>(cwp.ptr());
+ MyCacheWriter* mcw = dynamic_cast<MyCacheWriter*>(cwp.get());
sprintf(buf, "writer clear count=%d", mcw->getClearCnt());
LOG(buf);
ASSERT(mcw->getClearCnt() == 2, buf);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientConflation.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientConflation.cpp b/src/cppcache/integration-test/testThinClientConflation.cpp
index 7b0a08a..0fbe6de 100644
--- a/src/cppcache/integration-test/testThinClientConflation.cpp
+++ b/src/cppcache/integration-test/testThinClientConflation.cpp
@@ -42,11 +42,10 @@ class OperMonitor : public CacheListener {
void check(const EntryEvent& event) {
char buf[256] = {'\0'};
m_events++;
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(event.getKey());
- CacheableInt32Ptr valuePtr =
- dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(event.getKey());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
- if (valuePtr != NULLPTR) {
+ if (valuePtr != nullptr) {
m_value = valuePtr->value();
}
sprintf(buf, "Key = %s, Value = %d", keyPtr->toString(), valuePtr->value());
@@ -85,10 +84,10 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1C1 = NULLPTR;
-OperMonitorPtr mon2C1 = NULLPTR;
-OperMonitorPtr mon1C2 = NULLPTR;
-OperMonitorPtr mon2C2 = NULLPTR;
+OperMonitorPtr mon1C1 = nullptr;
+OperMonitorPtr mon2C1 = nullptr;
+OperMonitorPtr mon1C2 = nullptr;
+OperMonitorPtr mon2C2 = nullptr;
const char* regions[] = {"ConflatedRegion", "NonConflatedRegion"};
@@ -101,8 +100,8 @@ void initClientCache(OperMonitorPtr& mon1, OperMonitorPtr& mon2, int durableIdx,
initClientAndTwoRegions(durableIdx, 0, 300, conflation, regions);
// Recreate listener
- mon1 = new OperMonitor();
- mon2 = new OperMonitor();
+ mon1 = std::make_shared<OperMonitor>();
+ mon2 = std::make_shared<OperMonitor>();
setCacheListener(regions[0], mon1);
setCacheListener(regions[1], mon2);
@@ -162,7 +161,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(FEEDER, CreateRegionsAndFirstFeederUpdate)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regions[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regions[1], USE_ACK, locatorsG,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp b/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
index 5ff29bc..a9ab4fb 100644
--- a/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
+++ b/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
@@ -41,7 +41,7 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
@@ -53,7 +53,7 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);