http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp b/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp index 8a23711..1fbaf57 100644 --- a/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp +++ b/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp @@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val, free(buf); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); CacheableKeyPtr keyPtr = createKey(key); @@ -135,10 +135,9 @@ void _verifyEntry(const char* name, const char* key, const char* val, } if (val != NULL) { - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "In verify loop, get returned %s for key %s", checkPtr->asChar(), key); @@ -182,9 +181,9 @@ void createRegion(const char* name, bool ackMode, fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); // ack, caching - 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."); } @@ -198,7 +197,7 @@ void createEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -223,7 +222,7 @@ void updateEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region."); // ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been @@ -249,17 +248,16 @@ void doNetsearch(const char* name, const char* key, const char* value) { RegionPtr regPtr = getHelper()->getRegion(name); fprintf(stdout, "netsearch region %s\n", regPtr->getName()); fflush(stdout); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); // ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in // region." ); // ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been // found in region." ); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch - if (checkPtr != NULLPTR) { + if (checkPtr != nullptr) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp b/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp index e3da2a8..3f7e36b 100644 --- a/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp +++ b/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp @@ -90,7 +90,7 @@ void _verifyEntry(const char* name, const char* key, const char* val, free(buf); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); CacheableKeyPtr keyPtr = createKey(key); @@ -140,10 +140,9 @@ void _verifyEntry(const char* name, const char* key, const char* val, } if (val != NULL) { - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "In verify loop, get returned %s for key %s", checkPtr->asChar(), key); @@ -189,8 +188,8 @@ void createRegion(const char* name, bool ackMode, char* endpoints = NULL; // ack, caching RegionPtr regPtr = getHelper()->createRegion( - name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + name, ackMode, true, nullptr, endpoints, clientNotificationEnabled); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } @@ -204,7 +203,7 @@ void createEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -229,7 +228,7 @@ void updateEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region."); // ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been @@ -255,17 +254,16 @@ void doNetsearch(const char* name, const char* key, const char* value) { RegionPtr regPtr = getHelper()->getRegion(name); fprintf(stdout, "netsearch region %s\n", regPtr->getName()); fflush(stdout); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); // ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in // region." ); // ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been // found in region." ); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch - if (checkPtr != NULLPTR) { + if (checkPtr != nullptr) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp b/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp index 6b4a82a..103fbac 100644 --- a/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp +++ b/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp @@ -37,12 +37,12 @@ class DupChecker : public CacheListener { m_ops++; CacheableKeyPtr key = event.getKey(); - CacheableInt32Ptr value = dynCast<CacheableInt32Ptr>(event.getNewValue()); + auto value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue()); HashMapOfCacheable::Iterator item = m_map.find(key); if (item != m_map.end()) { - CacheableInt32Ptr check = dynCast<CacheableInt32Ptr>(item.second()); + auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second()); ASSERT(check->value() + 1 == value->value(), "Duplicate or older value received"); m_map.update(key, value); @@ -62,7 +62,7 @@ class DupChecker : public CacheListener { for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end(); item++) { - CacheableInt32Ptr check = dynCast<CacheableInt32Ptr>(item.second()); + auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second()); ASSERT(check->value() == 100, "Expected final value to be 100"); } } @@ -151,7 +151,7 @@ void _verifyEntry(const char* name, const char* key, const char* val, free(buf); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); CacheableKeyPtr keyPtr = createKey(key); @@ -201,10 +201,9 @@ void _verifyEntry(const char* name, const char* key, const char* val, } if (val != NULL) { - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "In verify loop, get returned %s for key %s", checkPtr->asChar(), key); @@ -242,7 +241,7 @@ void _verifyIntEntry(const char* name, const char* key, const int val, free(buf); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); CacheableKeyPtr keyPtr = createKey(key); @@ -292,10 +291,9 @@ void _verifyIntEntry(const char* name, const char* key, const int val, } if (val != 0) { - CacheableInt32Ptr checkPtr = - dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr)); + auto checkPtr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "In verify loop, get returned %d for key %s", checkPtr->value(), key); @@ -353,8 +351,8 @@ void createRegion(const char* name, bool ackMode, char* endpoints = NULL; // ack, caching RegionPtr regPtr = getHelper()->createRegion( - name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + name, ackMode, true, nullptr, endpoints, clientNotificationEnabled); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } @@ -368,7 +366,7 @@ void createEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -393,7 +391,7 @@ void createIntEntry(const char* name, const char* key, const int value) { CacheableInt32Ptr valPtr = CacheableInt32::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); // ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in // region." ); @@ -472,8 +470,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitClient2_R1) initClientAndRegion(1); LOG("Initialized client with redundancy level 1."); - checker1 = new DupChecker(); - checker2 = new DupChecker(); + checker1 = std::make_shared<DupChecker>(); + checker2 = std::make_shared<DupChecker>(); setCacheListener(regionNames[0], checker1); setCacheListener(regionNames[1], checker2); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp index 39fbdd4..b1ac86f 100644 --- a/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp +++ b/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp @@ -122,8 +122,8 @@ void createRegion(const char* name, bool ackMode, fflush(stdout); char* endpoints = NULL; RegionPtr regPtr = getHelper()->createRegion( - name, ackMode, false, NULLPTR, endpoints, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + name, ackMode, false, nullptr, endpoints, clientNotificationEnabled); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } @@ -165,10 +165,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne) RegionPtr rptr = getHelper()->cachePtr->getRegion(regionNames[0]); - CacheablePtr port1(new Portfolio(1, 100)); - CacheablePtr port2(new Portfolio(2, 200)); - CacheablePtr port3(new Portfolio(3, 300)); - CacheablePtr port4(new Portfolio(4, 400)); + auto port1 = std::make_shared<Portfolio>(1, 100); + auto port2 = std::make_shared<Portfolio>(2, 200); + auto port3 = std::make_shared<Portfolio>(3, 300); + auto port4 = std::make_shared<Portfolio>(4, 400); rptr->put("1", port1); rptr->put("2", port2); @@ -193,7 +193,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) try { kst = new KillServerThread(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; PoolPtr pool = PoolManager::find("__TESTPOOL1_"); qs = pool->getQueryService(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHeapLRU.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientHeapLRU.cpp b/src/cppcache/integration-test/testThinClientHeapLRU.cpp index 0a36c0d..d14f882 100644 --- a/src/cppcache/integration-test/testThinClientHeapLRU.cpp +++ b/src/cppcache/integration-test/testThinClientHeapLRU.cpp @@ -49,9 +49,9 @@ void createOnekEntries() { CacheableWrapperFactory::createInstance(GeodeTypeIds::CacheableBytes); tmpkey->initKey(i, 32); tmpval->initRandomValue(1024); - ASSERT(tmpkey->getCacheable() != NULLPTR, "tmpkey->getCacheable() is NULL"); - ASSERT(tmpval->getCacheable() != NULLPTR, "tmpval->getCacheable() is NULL"); - dataReg->put(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()), + ASSERT(tmpkey->getCacheable() != nullptr, "tmpkey->getCacheable() is NULL"); + ASSERT(tmpval->getCacheable() != nullptr, "tmpval->getCacheable() is NULL"); + dataReg->put(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()), tmpval->getCacheable()); // delete tmpkey; // delete tmpval; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp b/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp index 52666e1..8a8af97 100644 --- a/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp +++ b/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp @@ -40,7 +40,7 @@ CacheHelper *cacheHelper = NULL; void initClient(const bool isthinClient) { if (cacheHelper == NULL) { cacheHelper = new CacheHelper(isthinClient, "__TEST_POOL1__", locatorsG, - "ServerGroup1", NULLPTR, 0, true); + "ServerGroup1", nullptr, 0, true); } ASSERT(cacheHelper, "Failed to create a CacheHelper client instance."); } @@ -78,7 +78,7 @@ void _verifyEntry(const char *name, const char *key, const char *val, free(buf); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); CacheableKeyPtr keyPtr = createKey(key); @@ -127,10 +127,9 @@ void _verifyEntry(const char *name, const char *key, const char *val, } if (val != NULL) { - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "In verify loop, get returned %s for key %s", checkPtr->asChar(), key); @@ -194,8 +193,8 @@ void createRegion(const char *name, bool ackMode, const char *endpoints, fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); RegionPtr regPtr = getHelper()->createRegion( - name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + name, ackMode, true, nullptr, endpoints, clientNotificationEnabled); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } void createEntry(const char *name, const char *key, const char *value = NULL) { @@ -211,7 +210,7 @@ void createEntry(const char *name, const char *key, const char *value = NULL) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -236,7 +235,7 @@ void updateEntry(const char *name, const char *key, const char *value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region."); ASSERT(regPtr->containsValueForKey(keyPtr), @@ -262,17 +261,16 @@ void doNetsearch(const char *name, const char *key, const char *value) { RegionPtr regPtr = getHelper()->getRegion(name); fprintf(stdout, "netsearch region %s\n", regPtr->getName()); fflush(stdout); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); ASSERT(!regPtr->containsValueForKey(keyPtr), "Value should not have been found in region."); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch - if (checkPtr != NULLPTR) { + if (checkPtr != nullptr) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp b/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp index 41e4dc8..a534389 100644 --- a/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp +++ b/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp @@ -40,11 +40,10 @@ class MyListener : public CacheListener { for (int i = 0; i < 5; i++) m_gotit[i] = 0; } inline void checkEntry(const EntryEvent& event) { - CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(event.getKey()); + auto keyPtr = std::dynamic_pointer_cast<CacheableString>(event.getKey()); for (int i = 0; i < 5; i++) { if (!ACE_OS::strcmp(keys[i], keyPtr->asChar())) { - CacheableStringPtr valPtr = - dynCast<CacheableStringPtr>(event.getNewValue()); + auto valPtr = std::dynamic_pointer_cast<CacheableString>(event.getNewValue()); if (!ACE_OS::strcmp(vals[i], valPtr->asChar())) m_gotit[i] = 1; break; } @@ -60,7 +59,7 @@ class MyListener : public CacheListener { } }; -MyListenerPtr mylistner = NULLPTR; +MyListenerPtr mylistner = nullptr; void setCacheListener(const char* regName, MyListenerPtr regListener) { RegionPtr reg = getHelper()->getRegion(regName); @@ -82,7 +81,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); } @@ -91,13 +90,13 @@ 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); - mylistner = new MyListener(); + mylistner = std::make_shared<MyListener>(); setCacheListener(regionNames[0], mylistner); RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); - regPtr->registerAllKeys(false, NULLPTR, true); + regPtr->registerAllKeys(false, nullptr, true); } END_TASK(setupClient2) http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp b/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp index cff214a..fe225e3 100644 --- a/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp +++ b/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp @@ -49,7 +49,7 @@ CacheableStringPtr getUAString(int index) { DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1) { initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1", - NULLPTR, 0, true); + nullptr, 0, true); getHelper()->createPooledRegion(regionNames[0], false, locatorsG, "__TEST_POOL1__", true, true); } @@ -69,11 +69,11 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(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]); - regPtr->registerAllKeys(false, NULLPTR, true); + regPtr->registerAllKeys(false, nullptr, true); } END_TASK_DEFINITION @@ -108,8 +108,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyUpdates) char buf[1024]; sprintf(buf, "key[%s] should have been found", keys[index]); ASSERT(regPtr->containsKey(keyPtr), buf); - CacheableStringPtr val = - dynCast<CacheableStringPtr>(regPtr->getEntry(keyPtr)->getValue()); + auto val = std::dynamic_pointer_cast<CacheableString>(regPtr->getEntry(keyPtr)->getValue()); ASSERT(strcmp(val->asChar(), nvals[index]) == 0, "Incorrect value for key"); } @@ -133,8 +132,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetUnicodeStrings) RegionPtr reg0 = getHelper()->getRegion(regionNames[0]); for (int index = 0; index < 5; ++index) { CacheableStringPtr key = getUString(index); - CacheableInt32Ptr val = dynCast<CacheableInt32Ptr>(reg0->get(key)); - ASSERT(val != NULLPTR, "expected non-null value in get"); + auto val = std::dynamic_pointer_cast<CacheableInt32>(reg0->get(key)); + ASSERT(val != nullptr, "expected non-null value in get"); ASSERT(val->value() == (index + 100), "unexpected value in get"); } reg0->unregisterAllKeys(); @@ -166,9 +165,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckUpdateUnicodeStrings) RegionPtr reg0 = getHelper()->getRegion(regionNames[0]); for (int index = 0; index < 5; ++index) { CacheableStringPtr key = getUString(index); - CacheableFloatPtr val = - dynCast<CacheableFloatPtr>(reg0->getEntry(key)->getValue()); - ASSERT(val != NULLPTR, "expected non-null value in get"); + auto val = std::dynamic_pointer_cast<CacheableFloat>(reg0->getEntry(key)->getValue()); + ASSERT(val != nullptr, "expected non-null value in get"); ASSERT(val->value() == (index + 20.0F), "unexpected value in get"); } LOG("CheckUpdateUnicodeStrings complete."); @@ -192,12 +190,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetASCIIAsWideStrings) RegionPtr reg0 = getHelper()->getRegion(regionNames[0]); for (int index = 0; index < 5; ++index) { CacheableStringPtr key = getUAString(index); - CacheableStringPtr val = dynCast<CacheableStringPtr>(reg0->get(key)); + auto val = std::dynamic_pointer_cast<CacheableString>(reg0->get(key)); CacheableStringPtr expectedVal = getUString(index + 20); - ASSERT(val != NULLPTR, "expected non-null value in get"); + ASSERT(val != nullptr, "expected non-null value in get"); ASSERT(wcscmp(val->asWChar(), expectedVal->asWChar()) == 0, "unexpected value in get"); - ASSERT(*val.ptr() == *expectedVal.ptr(), "unexpected value in get"); + ASSERT(*val.get() == *expectedVal.get(), "unexpected value in get"); } VectorOfCacheableKey vec; for (int index = 0; index < 5; ++index) { @@ -227,10 +225,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckUpdateASCIIAsWideStrings) RegionPtr reg0 = getHelper()->getRegion(regionNames[0]); for (int index = 0; index < 5; ++index) { CacheableStringPtr key = getUAString(index); - CacheableStringPtr val = dynCast<CacheableStringPtr>(reg0->get(key)); + auto val = std::dynamic_pointer_cast<CacheableString>(reg0->get(key)); CacheableStringPtr expectedVal = getUAString(index + 10); - ASSERT(val != NULLPTR, "expected non-null value in get"); - ASSERT(*val.ptr() == *expectedVal.ptr(), "unexpected value in get"); + ASSERT(val != nullptr, "expected non-null value in get"); + ASSERT(*val.get() == *expectedVal.get(), "unexpected value in get"); } LOG("CheckUpdateASCIIAsWideStrings complete."); } http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientInterestNotify.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientInterestNotify.cpp b/src/cppcache/integration-test/testThinClientInterestNotify.cpp index af925d2..fcf5073 100644 --- a/src/cppcache/integration-test/testThinClientInterestNotify.cpp +++ b/src/cppcache/integration-test/testThinClientInterestNotify.cpp @@ -47,14 +47,13 @@ class EventListener : public CacheListener { char buf[256] = {'\0'}; try { - 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()); sprintf( buf, "%s: %s: Key = %s, NewValue = %s", m_name.c_str(), eventType, keyPtr->asChar(), - (valuePtr == NULLPTR ? "NULLPTR" : valuePtr->toString()->asChar())); + (valuePtr == nullptr ? "nullptr" : valuePtr->toString()->asChar())); LOG(buf); } catch (const Exception& excp) { sprintf(buf, "%s: %s: %s: %s", m_name.c_str(), eventType, excp.getName(), @@ -137,16 +136,16 @@ void setCacheListener(const char* regName, EventListenerPtr monitor) { // RegionOther means no interest registered so no events should arrive except // invalidates when NBS == false. -EventListenerPtr clientTrueRegionTrue = NULLPTR; -EventListenerPtr clientTrueRegionFalse = NULLPTR; -EventListenerPtr clientTrueRegionOther = NULLPTR; +EventListenerPtr clientTrueRegionTrue = nullptr; +EventListenerPtr clientTrueRegionFalse = nullptr; +EventListenerPtr clientTrueRegionOther = nullptr; /* -EventListenerPtr clientFalseRegionTrue = NULLPTR; -EventListenerPtr clientFalseRegionFalse = NULLPTR; -EventListenerPtr clientFalseRegionOther = NULLPTR; -EventListenerPtr clientDefaultRegionTrue = NULLPTR; -EventListenerPtr clientDefaultRegionFalse = NULLPTR; -EventListenerPtr clientDefaultRegionOther = NULLPTR; +EventListenerPtr clientFalseRegionTrue = nullptr; +EventListenerPtr clientFalseRegionFalse = nullptr; +EventListenerPtr clientFalseRegionOther = nullptr; +EventListenerPtr clientDefaultRegionTrue = nullptr; +EventListenerPtr clientDefaultRegionFalse = nullptr; +EventListenerPtr clientDefaultRegionOther = nullptr; */ const char* regions[] = {"RegionTrue", "RegionFalse", "RegionOther"}; @@ -181,9 +180,9 @@ void initClientForInterestNotify(EventListenerPtr& mon1, EventListenerPtr& mon2, name3 += regions[2]; // Recreate listeners - mon1 = new EventListener(name1.c_str()); - mon2 = new EventListener(name2.c_str()); - mon3 = new EventListener(name3.c_str()); + mon1 = std::make_shared<EventListener>(name1.c_str()); + mon2 = std::make_shared<EventListener>(name2.c_str()); + mon3 = std::make_shared<EventListener>(name3.c_str()); setCacheListener(regions[0], mon1); setCacheListener(regions[1], mon2); @@ -234,7 +233,7 @@ void registerInterests(const char* region, bool durable, bool receiveValues) { regionPtr->registerKeys(keysVector, durable, true, receiveValues); - regionPtr->registerRegex("key-regex.*", durable, NULLPTR, true, + regionPtr->registerRegex("key-regex.*", durable, nullptr, true, receiveValues); } @@ -270,7 +269,7 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(SERVER_AND_FEEDER, FeederUpAndFeed) { 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/testThinClientLRUExpiration.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientLRUExpiration.cpp b/src/cppcache/integration-test/testThinClientLRUExpiration.cpp index 4d7afd9..63371d0 100644 --- a/src/cppcache/integration-test/testThinClientLRUExpiration.cpp +++ b/src/cppcache/integration-test/testThinClientLRUExpiration.cpp @@ -109,7 +109,7 @@ void getRegionAttr(const char* name) { void ValidateDestroyRegion(const char* name) { RegionPtr rptr = getHelper()->getRegion(name); - if (rptr == NULLPTR) { + if (rptr == nullptr) { return; } try { @@ -138,8 +138,8 @@ void createRegion(const char* name, bool ackMode, int ettl, int eit, int rttl, // ); getHelper()->createRegionAndAttachPool(name, ackMode, "LRUPool", true, ettl, eit, rttl, rit, lel, action); - ASSERT(regPtr != NULLPTR, "Failed to create region."); - if (registerKey) regPtr->registerAllKeys(false, NULLPTR, false, false); + ASSERT(regPtr != nullptr, "Failed to create region."); + if (registerKey) regPtr->registerAllKeys(false, nullptr, false, false); LOG("Region created."); } @@ -151,10 +151,10 @@ void doRgnOperations(const char* name, int n, int rgnOpt = 0) { buf[15] = '\0'; memcpy(buf, "Value - ", 8); value = CacheableString::create(buf); - ASSERT(value != NULLPTR, "Failed to create value."); + ASSERT(value != nullptr, "Failed to create value."); } RegionPtr rptr = getHelper()->getRegion(name); - ASSERT(rptr != NULLPTR, "Region not found."); + ASSERT(rptr != nullptr, "Region not found."); for (int i = 0; i < n; i++) { sprintf(buf, "KeyA - %d", i + 1); CacheableKeyPtr key = CacheableKey::create(buf); @@ -184,7 +184,7 @@ void doRgnOperations(const char* name, int n, int rgnOpt = 0) { void dumpCounters(const char* regName) { RegionPtr rptr = getHelper()->getRegion(regName); printf("Region size: %d\n", rptr->size()); - if (regListener != NULLPTR) { + if (regListener != nullptr) { printf("counts:: creates: %d, updates: %d, invalidates: %d, destroys: %d\n", regListener->getCreates(), regListener->getUpdates(), regListener->getInvalidates(), regListener->getDestroys()); @@ -911,8 +911,8 @@ DUNIT_TASK(CLIENT1, StepOneCase11) // [put-0/get-5/destroy-3] ,destroyRgn - [true/false] // ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action createThinClientRegion(regionNames[4], 4, 0, 0, 0, 5, 0, 6, false); - regListener = new TallyListener(); - regWriter = new TallyWriter(); + regListener = std::make_shared<TallyListener>(); + regWriter = std::make_shared<TallyWriter>(); setCacheListener(regionNames[4], regListener); setCacheWriter(regionNames[4], regWriter); } @@ -924,8 +924,8 @@ DUNIT_TASK(CLIENT2, StepTwoCase11) // [put-0/get-5/destroy-3] ,destroyRgn - [true/false] // ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action createThinClientRegion(regionNames[4], 0, 0, 0, 0, 0, 0, 6, false); - regListener = new TallyListener(); - regWriter = new TallyWriter(); + regListener = std::make_shared<TallyListener>(); + regWriter = std::make_shared<TallyWriter>(); setCacheListener(regionNames[4], regListener); setCacheWriter(regionNames[4], regWriter); } @@ -1046,8 +1046,8 @@ DUNIT_TASK(CLIENT1, StepOneCase12) // [put-0/get-5/destroy-3] ,destroyRgn - [true/false] // ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action createThinClientRegion(regionNames[5], 4, 0, 0, 0, 5, 0, 6, false); - regListener = new TallyListener(); - regWriter = new TallyWriter(); + regListener = std::make_shared<TallyListener>(); + regWriter = std::make_shared<TallyWriter>(); setCacheListener(regionNames[5], regListener); setCacheWriter(regionNames[5], regWriter); } @@ -1059,8 +1059,8 @@ DUNIT_TASK(CLIENT2, StepTwoCase12) // [put-0/get-5/destroy-3] ,destroyRgn - [true/false] // ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action createThinClientRegion(regionNames[5], 0, 0, 0, 0, 0, 0, 6, false); - regListener = new TallyListener(); - regWriter = new TallyWriter(); + regListener = std::make_shared<TallyListener>(); + regWriter = std::make_shared<TallyWriter>(); setCacheListener(regionNames[5], regListener); setCacheWriter(regionNames[5], regWriter); } @@ -1142,8 +1142,8 @@ DUNIT_TASK(CLIENT1, StepOneCase13) initClient(true); getHelper()->createPoolWithLocators("LRUPool", locatorsG, true); createThinClientRegion(regionNames[5], 4, 0, 0, 0, 5, 0, 6, false); - regListener = new TallyListener(); - regWriter = new TallyWriter(); + regListener = std::make_shared<TallyListener>(); + regWriter = std::make_shared<TallyWriter>(); setCacheListener(regionNames[5], regListener); setCacheWriter(regionNames[5], regWriter); } @@ -1157,8 +1157,8 @@ DUNIT_TASK(CLIENT2, StepTwoCase13) initClient(true); getHelper()->createPoolWithLocators("LRUPool", locatorsG, true); createThinClientRegion(regionNames[5], 0, 0, 0, 0, 0, 0, 6, false); - regListener = new TallyListener(); - regWriter = new TallyWriter(); + regListener = std::make_shared<TallyListener>(); + regWriter = std::make_shared<TallyWriter>(); setCacheListener(regionNames[5], regListener); setCacheWriter(regionNames[5], regWriter); RegionPtr regPtr0 = getHelper()->getRegion(regionNames[5]); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp b/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp index 4ec2549..a2fc966 100644 --- a/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp +++ b/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp @@ -69,7 +69,7 @@ class CallbackListener : public CacheListener { m_regionInvalidate(0), m_regionDestroy(0), m_regionClear(0), - m_callbackArg(NULLPTR) { + m_callbackArg(nullptr) { LOG("CallbackListener contructor called"); } @@ -88,11 +88,11 @@ class CallbackListener : public CacheListener { } void check(CacheablePtr eventCallback, int& updateEvent) { - if (m_callbackArg != NULLPTR) { + if (m_callbackArg != nullptr) { try { - PortfolioPtr mCallbkArg = dynCast<PortfolioPtr>(m_callbackArg); + auto mCallbkArg = std::dynamic_pointer_cast<Portfolio>(m_callbackArg); - PortfolioPtr callbkArg = dynCast<PortfolioPtr>(eventCallback); + auto callbkArg = std::dynamic_pointer_cast<Portfolio>(eventCallback); CacheableStringPtr fromCallback = callbkArg->getPkid(); CacheableStringPtr mCallback = mCallbkArg->getPkid(); @@ -100,7 +100,7 @@ class CallbackListener : public CacheListener { LOGFINE(" values are %s === %s ", fromCallback->asChar(), mCallback->asChar()); - if (*(fromCallback.ptr()) == *(mCallback.ptr())) { + if (*(fromCallback.get()) == *(mCallback.get())) { LOGFINE("values are same"); updateEvent++; } else { @@ -109,15 +109,13 @@ class CallbackListener : public CacheListener { } catch (const ClassCastException& ex) { LOGFINE(" in class cast exception %s ", ex.getMessage()); try { - CacheableStringPtr fromCallback = - dynCast<CacheableStringPtr>(eventCallback); - CacheableStringPtr mCallback = - dynCast<CacheableStringPtr>(m_callbackArg); + auto fromCallback = std::dynamic_pointer_cast<CacheableString>(eventCallback); + auto mCallback = std::dynamic_pointer_cast<CacheableString>(m_callbackArg); LOGFINE(" values are %s === %s ", fromCallback->asChar(), mCallback->asChar()); - if (*(fromCallback.ptr()) == *(mCallback.ptr())) { + if (*(fromCallback.get()) == *(mCallback.get())) { LOGFINE("values are same"); updateEvent++; } else { @@ -167,7 +165,7 @@ class CallbackListener : public CacheListener { }; //--------------------------------------------------------------------------------- -CallbackListenerPtr reg1Listener1 = NULLPTR; +CallbackListenerPtr reg1Listener1 = nullptr; CacheableStringPtr callBackStrPtr; CacheablePtr callBackPortFolioPtr; @@ -225,8 +223,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator) Serializable::registerType(Portfolio::createDeserializable); Serializable::registerType(Position::createDeserializable); - reg1Listener1 = new CallbackListener(); - callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR); + reg1Listener1 = std::make_shared<CallbackListener>(); + callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr); reg1Listener1->setCallBackArg(callBackPortFolioPtr); setCacheListener(regionNames[0], reg1Listener1); @@ -250,7 +248,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, testCreatesAndUpdates) { RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); - callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR); + 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); @@ -261,7 +259,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testInvalidates) { RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); - callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR); + callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr); regPtr->localCreate(1234, 1234, callBackPortFolioPtr); regPtr->localCreate(12345, 12345, callBackPortFolioPtr); regPtr->localCreate(12346, 12346, callBackPortFolioPtr); @@ -282,7 +280,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, testDestroy) { RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); - callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR); + 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."); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientListenerEvents.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientListenerEvents.cpp b/src/cppcache/integration-test/testThinClientListenerEvents.cpp index 8455fde..8d2ee3f 100644 --- a/src/cppcache/integration-test/testThinClientListenerEvents.cpp +++ b/src/cppcache/integration-test/testThinClientListenerEvents.cpp @@ -81,7 +81,7 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1) { initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1", - NULLPTR, 0, true); + nullptr, 0, true); getHelper()->createPooledRegion(regionNames[0], false, locatorsG, "__TEST_POOL1__", true, true); } @@ -92,7 +92,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, doRemoteGet) RegionPtr regionPtr = getHelper()->getRegion(regionNames[0]); AttributesMutatorPtr attrMutatorPtr = regionPtr->getAttributesMutator(); - SimpleCacheListenerPtr regListener1(new SimpleCacheListener()); + auto regListener1 = std::make_shared<SimpleCacheListener>(); attrMutatorPtr->setCacheListener(regListener1); // Put 3 Entries into the Region. http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientLocator.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientLocator.cpp b/src/cppcache/integration-test/testThinClientLocator.cpp index bff52a1..ee5f879 100644 --- a/src/cppcache/integration-test/testThinClientLocator.cpp +++ b/src/cppcache/integration-test/testThinClientLocator.cpp @@ -46,7 +46,7 @@ DUNIT_TASK(CLIENT1, StepOne) { // starting client 1 initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1", - NULLPTR, 0, true); + nullptr, 0, true); getHelper()->createPooledRegion(regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true); getHelper()->createPooledRegion(regionNames[1], NO_ACK, locHostPort, @@ -57,7 +57,7 @@ END_TASK(StepOne) DUNIT_TASK(CLIENT2, StepTwo) { initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1", - NULLPTR, 0, true); + nullptr, 0, true); getHelper()->createPooledRegion(regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true); getHelper()->createPooledRegion(regionNames[1], NO_ACK, locHostPort, http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientLocatorFailover.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientLocatorFailover.cpp b/src/cppcache/integration-test/testThinClientLocatorFailover.cpp index 5deac4b..c746d39 100644 --- a/src/cppcache/integration-test/testThinClientLocatorFailover.cpp +++ b/src/cppcache/integration-test/testThinClientLocatorFailover.cpp @@ -214,20 +214,13 @@ DUNIT_TASK(CLIENT1, AgainAgainFailoverC1_All) "No locator exception should " "have been raised"); } catch (const NotConnectedException& ex) { - try { - ExceptionPtr exCause = - dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause()); - LOG("Expected " - "NoAvailableLocatorsExcepti" - "on"); - } catch (ClassCastException&) { - FAIL( - "NotConnectedException " - "with cause " - "NoAvailableLocatorsExcepti" - "on should have been " - "raised"); - } + ASSERT(std::dynamic_pointer_cast<NoAvailableLocatorsException>( + ex.getCause()), + "NotConnectedException " + "with cause " + "NoAvailableLocatorsExcepti" + "on should have been " + "raised"); } } END_TASK(AgainAgainFailoverC1_All) http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientMultiDS.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientMultiDS.cpp b/src/cppcache/integration-test/testThinClientMultiDS.cpp index d97d4e1..0951f59 100644 --- a/src/cppcache/integration-test/testThinClientMultiDS.cpp +++ b/src/cppcache/integration-test/testThinClientMultiDS.cpp @@ -170,12 +170,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_1) try { RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]); RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keys[2])); - ASSERT(checkPtr == NULLPTR, "checkPtr should be null"); - CacheableStringPtr checkPtr1 = - dynCast<CacheableStringPtr>(regPtr0->get(keys[0])); - ASSERT(checkPtr1 != NULLPTR, "checkPtr1 should not be null"); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2])); + ASSERT(checkPtr == nullptr, "checkPtr should be null"); + auto checkPtr1 = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0])); + ASSERT(checkPtr1 != nullptr, "checkPtr1 should not be null"); } catch (Exception& excp) { LOG(excp.getMessage()); ASSERT(false, "Got unexpected exception"); @@ -341,12 +339,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_secureclient1) try { RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]); RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keys[2])); - ASSERT(checkPtr == NULLPTR, "checkPtr should be null"); - CacheableStringPtr checkPtr1 = - dynCast<CacheableStringPtr>(regPtr0->get(keys[0])); - ASSERT(checkPtr1 != NULLPTR, "checkPtr1 should not be null"); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2])); + ASSERT(checkPtr == nullptr, "checkPtr should be null"); + auto checkPtr1 = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0])); + ASSERT(checkPtr1 != nullptr, "checkPtr1 should not be null"); } catch (Exception& excp) { LOG(excp.getMessage()); ASSERT(false, "Got unexpected exception"); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp b/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp index 65609b1..c27b24e 100644 --- a/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp +++ b/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp @@ -76,7 +76,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators, RegionPtr regPtr = getHelper()->createPooledRegion(name, ackMode, locators, poolname, cachingEnable, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Pooled Region created."); } @@ -86,9 +86,9 @@ void createRegionCachingDisabled(const char* name, bool ackMode, fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); // ack, caching - 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."); } http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp b/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp index 6b9f9a6..4ee95b1 100644 --- a/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp +++ b/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp @@ -83,7 +83,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_Locator_Client1) getHelper()->createRegionAndAttachPool(regionNames[1], NO_ACK, "__TEST_POOL1__"); - reg1Listener1 = new TallyListener(); + reg1Listener1 = std::make_shared<TallyListener>(); setCacheListener(regionNames[0], reg1Listener1); LOG("StepOne_Pooled_Locator_Client1 complete."); } @@ -99,7 +99,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepOne_Pooled_Locator_Client2) getHelper()->createRegionAndAttachPool(regionNames[1], NO_ACK, "__TEST_POOL1__"); - reg1Listener1 = new TallyListener(); + reg1Listener1 = std::make_shared<TallyListener>(); setCacheListener(regionNames[0], reg1Listener1); LOG("StepOne_Pooled_Locator_Client2 complete."); } @@ -256,7 +256,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllPutAllTask) LOG("VerifyAllPutAllTask started."); RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); - ASSERT(dataReg != NULLPTR, "Region not found."); + ASSERT(dataReg != nullptr, "Region not found."); LOGINFO("dataregion size is %d: ", dataReg->size()); LOGINFO("dataregion getCreates is %d: ", reg1Listener1->getCreates()); ASSERT(reg1Listener1->getCreates() == 4000, @@ -270,9 +270,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllPutAllTask) sprintf(value, "%d", item); LOGDEBUG("CPPTEST:VerifyAllPutAllTask Doing get on key using: = %s: ", key); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(dataReg->get(CacheableKey::create(key))); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(dataReg->get(CacheableKey::create(key))); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); LOGDEBUG("CPPTEST:VerifyAllPutAllTask value is: = %s: ", checkPtr->asChar()); ASSERT(atoi(checkPtr->asChar()) == item, "Value did not match."); @@ -433,7 +432,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllRemoveAllTask) LOG("VerifyAllRemoveAllTask started."); RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); - ASSERT(dataReg != NULLPTR, "Region not found."); + ASSERT(dataReg != nullptr, "Region not found."); LOGINFO("dataregion size is %d: ", dataReg->size()); LOGINFO("dataregion getDestroys is %d: ", reg1Listener1->getDestroys()); ASSERT(reg1Listener1->getDestroys() == 4000, http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPRSingleHop.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPRSingleHop.cpp b/src/cppcache/integration-test/testThinClientPRSingleHop.cpp index 43e6966..b71aa0a 100644 --- a/src/cppcache/integration-test/testThinClientPRSingleHop.cpp +++ b/src/cppcache/integration-test/testThinClientPRSingleHop.cpp @@ -119,10 +119,10 @@ class putThread : public ACE_Task_Base { if (!m_isWarmUpTask) { unsigned int seed = i; rand = ACE_OS::rand_r(&seed); - keyPtr = dynCast<CacheableKeyPtr>(CacheableInt32::create(rand)); + keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(rand)); LOGDEBUG("svc: putting key %d ", rand); } else { - keyPtr = dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); LOGDEBUG("svc: putting key %d ", i); } try { @@ -270,11 +270,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_LocatorTL) RegionPtr regPtr = getHelper()->createPooledRegionStickySingleHop( regionNames[0], USE_ACK, NULL, locatorsG, "__TEST_POOL1__", false, false); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); regPtr = getHelper()->createPooledRegionStickySingleHop( regionNames[1], NO_ACK, NULL, locatorsG, "__TEST_POOL1__", false, false); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("StepOne_Pooled_LocatorTL complete."); } @@ -289,8 +289,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask) // This is to get MetaDataService going. for (int i = 0; i < 2000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGDEBUG("CPPTEST: put item %d", i); dataReg->put(keyPtr, keyPtr->hashcode()); @@ -370,8 +369,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask3) // This is to get MetaDataService going. for (int i = 0; i < 2000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGDEBUG("CPPTEST: put item %d", i); dataReg->put(keyPtr, keyPtr->hashcode()); @@ -504,9 +502,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForAllKeysTask) CacheableWrapper* tmpkey = CacheableWrapperFactory::createInstance(keyTypeId); tmpkey->initKey(i, KEYSIZE); - CacheableKeyPtr keyPtr = dynCast<CacheableKeyPtr>(tmpkey->getCacheable()); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()); - ASSERT(tmpkey->getCacheable() != NULLPTR, + ASSERT(tmpkey->getCacheable() != nullptr, "tmpkey->getCacheable() is NULL"); char logmsg[KEYSIZE * 4 + 100] = {0}; @@ -624,8 +622,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2) RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); for (int i = 2000; i < 3000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i, @@ -741,8 +738,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2) LOG("CheckPrSingleHopForIntKeysTask2 put completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i, @@ -808,8 +804,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2) keys.push_back(CacheableInt32::create(j)); } - HashMapOfCacheablePtr values(new HashMapOfCacheable()); - HashMapOfExceptionPtr exceptions(new HashMapOfException()); + auto values = std::make_shared<HashMapOfCacheable>(); + auto exceptions = std::make_shared<HashMapOfException>(); try { // LOGINFO("CPPTEST: getting key %d with hashcode %d", i, @@ -864,18 +860,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForGetAllTask) { RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); VectorOfCacheableKey keys; - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); for (int i = 0; i < 100; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); dataReg->put(keyPtr, keyPtr->hashcode()); keys.push_back(keyPtr); } - dataReg->getAll(keys, valuesMap, NULLPTR, true); + dataReg->getAll(keys, valuesMap, nullptr, true); ASSERT(valuesMap->size() == 100, "GetAll returns wrong number of values"); - dataReg->getAll(keys, valuesMap, NULLPTR, true, + dataReg->getAll(keys, valuesMap, nullptr, true, CacheableInt32::create(1000)); ASSERT(valuesMap->size() == 100, "GetAllWithCallBack returns wrong number of values"); @@ -891,8 +886,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask) RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); for (int i = 2000; i < 3000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i, @@ -995,8 +989,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask) LOG("CheckPrSingleHopForIntKeysTask put completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i, @@ -1054,8 +1047,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask) keys.push_back(CacheableInt32::create(j)); } - HashMapOfCacheablePtr values(new HashMapOfCacheable()); - HashMapOfExceptionPtr exceptions(new HashMapOfException()); + auto values = std::make_shared<HashMapOfCacheable>(); + auto exceptions = std::make_shared<HashMapOfException>(); try { // LOGINFO("CPPTEST: getting key %d with hashcode %d", i, @@ -1241,23 +1234,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckGetAllTask) { RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); VectorOfCacheableKey keys; - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); for (int i = 0; i < 100000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); dataReg->put(keyPtr, keyPtr->hashcode()); keys.push_back(keyPtr); } ACE_Time_Value startTime = ACE_OS::gettimeofday(); - dataReg->getAll(keys, valuesMap, NULLPTR, true); + dataReg->getAll(keys, valuesMap, nullptr, true); ACE_Time_Value interval = ACE_OS::gettimeofday() - startTime; LOGDEBUG("NILKANTH: Time taken to execute getALL sec = %d and MSec = %d ", interval.sec(), interval.usec()); ASSERT(valuesMap->size() == 100000, "GetAll returns wrong number of values"); - dataReg->getAll(keys, valuesMap, NULLPTR, true, + dataReg->getAll(keys, valuesMap, nullptr, true, CacheableInt32::create(10000)); ASSERT(valuesMap->size() == 100000, "GetAllWithCallBack returns wrong number of values"); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp b/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp index 8dbcc89..469bed4 100644 --- a/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp +++ b/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp @@ -97,8 +97,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1) RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: Putting key %d with hashcode %d", i, @@ -160,8 +159,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1) LOG("CheckPrSingleHopForIntKeysTask_CLIENT1 put completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: getting key %d with hashcode %d", i, @@ -208,8 +206,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1) keys.push_back(CacheableInt32::create(j)); } - HashMapOfCacheablePtr values(new HashMapOfCacheable()); - HashMapOfExceptionPtr exceptions(new HashMapOfException()); + auto values = std::make_shared<HashMapOfCacheable>(); + auto exceptions = std::make_shared<HashMapOfException>(); try { dataReg->getAll(keys, values, exceptions, false); @@ -249,8 +247,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1) LOG("CheckPrSingleHopForIntKeysTask_CLIENT1 getAll completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: destroying key %d with hashcode %d", i, @@ -302,8 +299,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2) RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: Putting key %d with hashcode %d", i, @@ -364,8 +360,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2) LOG("CheckPrSingleHopForIntKeysTask_CLIENT2 put completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: getting key %d with hashcode %d", i, @@ -407,8 +402,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2) keys.push_back(CacheableInt32::create(j)); } - HashMapOfCacheablePtr values(new HashMapOfCacheable()); - HashMapOfExceptionPtr exceptions(new HashMapOfException()); + auto values = std::make_shared<HashMapOfCacheable>(); + auto exceptions = std::make_shared<HashMapOfException>(); try { dataReg->getAll(keys, values, exceptions, false); @@ -446,8 +441,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2) LOG("CheckPrSingleHopForIntKeysTask_CLIENT2 getAll completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: destroying key %d with hashcode %d", i, @@ -494,8 +488,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3) RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: Putting key %d with hashcode %d", i, @@ -556,8 +549,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3) LOG("CheckPrSingleHopForIntKeysTask_CLIENT3 put completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: getting key %d with hashcode %d", i, @@ -599,8 +591,8 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3) keys.push_back(CacheableInt32::create(j)); } - HashMapOfCacheablePtr values(new HashMapOfCacheable()); - HashMapOfExceptionPtr exceptions(new HashMapOfException()); + auto values = std::make_shared<HashMapOfCacheable>(); + auto exceptions = std::make_shared<HashMapOfException>(); try { dataReg->getAll(keys, values, exceptions, false); @@ -635,8 +627,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3) LOG("CheckPrSingleHopForIntKeysTask_CLIENT3 getAll completed."); for (int i = 0; i < 1000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: destroying key %d with hashcode %d", i, http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPartitionResolver.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPartitionResolver.cpp b/src/cppcache/integration-test/testThinClientPartitionResolver.cpp index cf89b10..d31a244 100644 --- a/src/cppcache/integration-test/testThinClientPartitionResolver.cpp +++ b/src/cppcache/integration-test/testThinClientPartitionResolver.cpp @@ -121,8 +121,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutThroughPartitionResolver) for (int i = 0; i < 100; i++) { // RegionPtr dataReg = getHelper()->getRegion("LocalRegion"); RegionPtr dataReg = getHelper()->getRegion(regionNames[0]); - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); dataReg->put(keyPtr, keyPtr->hashcode()); } SLEEP(5000); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp b/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp index 925a978..56f56ef 100644 --- a/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp +++ b/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp @@ -85,7 +85,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators, RegionPtr regPtr = getHelper()->createPooledRegion(name, ackMode, locators, poolname, cachingEnable, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Pooled Region created."); } @@ -114,9 +114,9 @@ void createRegion(const char* name, bool ackMode, fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); // ack, caching - 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."); } @@ -223,7 +223,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1_PdxPut) { CacheableKeyPtr keyPtr = createKey(keys[0]); PdxDeltaEx* ptr = new PdxDeltaEx(); - // CacheablePtr pdxobj(new PdxDeltaEx()); + // auto pdxobj = std::make_shared<PdxDeltaEx>(); CacheablePtr valPtr(ptr); RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); regPtr->put(keyPtr, valPtr); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPdxEnum.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPdxEnum.cpp b/src/cppcache/integration-test/testThinClientPdxEnum.cpp index 48ebe87..8e957c2 100644 --- a/src/cppcache/integration-test/testThinClientPdxEnum.cpp +++ b/src/cppcache/integration-test/testThinClientPdxEnum.cpp @@ -80,9 +80,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithEnum) LOG("putPdxWithEnum started "); // Creating objects of type PdxEnumTestClass - PdxEnumTestClassPtr pdxobj1(new PdxEnumTestClass(0)); - PdxEnumTestClassPtr pdxobj2(new PdxEnumTestClass(1)); - PdxEnumTestClassPtr pdxobj3(new PdxEnumTestClass(2)); + auto pdxobj1 = std::make_shared<PdxEnumTestClass>(0); + auto pdxobj2 = std::make_shared<PdxEnumTestClass>(1); + auto pdxobj3 = std::make_shared<PdxEnumTestClass>(2); RegionPtr rptr = getHelper()->getRegion("DistRegionAck"); @@ -114,25 +114,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxEnumQuery) RegionPtr rptr = getHelper()->getRegion("DistRegionAck"); SelectResultsPtr results = rptr->query("m_enumid.name = 'id2'"); ASSERT(results->size() == 1, "query result should have one item"); - ResultSetPtr rsptr = dynCast<ResultSetPtr>(results); + auto rsptr = std::dynamic_pointer_cast<ResultSet>(results); SelectResultsIterator iter = rsptr->getIterator(); while (iter.moveNext()) { - PdxEnumTestClassPtr re = dynCast<PdxEnumTestClassPtr>(iter.current()); + auto re = std::dynamic_pointer_cast<PdxEnumTestClass>(iter.current()); ASSERT(re->getID() == 1, "query should have return id 1"); } QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; PoolPtr pool1 = findPool("__TEST_POOL1__"); qs = pool1->getQueryService(); QueryPtr qry = qs->newQuery( "select distinct * from /DistRegionAck this where m_enumid.name = " "'id3'"); results = qry->execute(); - rsptr = dynCast<ResultSetPtr>(results); + rsptr = std::dynamic_pointer_cast<ResultSet>(results); SelectResultsIterator iter1 = rsptr->getIterator(); while (iter1.moveNext()) { - PdxEnumTestClassPtr re = dynCast<PdxEnumTestClassPtr>(iter1.current()); + auto re = std::dynamic_pointer_cast<PdxEnumTestClass>(iter1.current()); ASSERT(re->getID() == 2, "query should have return id 0"); }
