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:07 UTC
[25/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/ThinClientCQ.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientCQ.hpp b/src/cppcache/integration-test/ThinClientCQ.hpp
index 4067e6d..b0533f0 100644
--- a/src/cppcache/integration-test/ThinClientCQ.hpp
+++ b/src/cppcache/integration-test/ThinClientCQ.hpp
@@ -40,7 +40,7 @@ const char* locatorsG =
void createRegionForCQ(const char* name, bool ackMode,
bool clientNotificationEnabled = false,
int redundancyLevel = 0,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true) {
// Use region name as pool name to avoid recreating pools with the same name.
getHelper()->createPoolWithLocators(
@@ -51,7 +51,7 @@ void createRegionForCQ(const char* name, bool ackMode,
void createRegionForCQMU(const char* name, bool ackMode,
bool clientNotificationEnabled = false,
int redundancyLevel = 0,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true,
bool poolIsInMultiuserMode = false) {
// Use region name as pool name to avoid recreating pools with the same name.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientCallbackArg.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientCallbackArg.hpp b/src/cppcache/integration-test/ThinClientCallbackArg.hpp
index 0eb79b6..f1f3823 100644
--- a/src/cppcache/integration-test/ThinClientCallbackArg.hpp
+++ b/src/cppcache/integration-test/ThinClientCallbackArg.hpp
@@ -67,9 +67,9 @@ void createClientPooledLocatorRegion() {
"writer");
createPooledRegion(regionNames[0], false, locatorsG, poolName, true,
regListener, true);
- regWriter = new TallyWriter();
+ regWriter = std::make_shared<TallyWriter>();
setCacheWriter(regionNames[0], regWriter);
- regListener = new TallyListener();
+ regListener = std::make_shared<TallyListener>();
setCacheListener(regionNames[0], regListener);
regWriter->setCallBackArg(key0);
regListener->setCallBackArg(key0);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDistOps.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDistOps.hpp b/src/cppcache/integration-test/ThinClientDistOps.hpp
index 028b463..eb3c0e0 100644
--- a/src/cppcache/integration-test/ThinClientDistOps.hpp
+++ b/src/cppcache/integration-test/ThinClientDistOps.hpp
@@ -110,7 +110,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);
@@ -148,10 +148,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);
@@ -205,9 +204,9 @@ 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, cachingEnable, NULLPTR,
+ getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -220,7 +219,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.");
}
@@ -234,7 +233,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -248,7 +247,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.");
@@ -265,31 +264,30 @@ void createEntry(const char* name, const char* key, const char* value) {
void createAndVerifyEntry(const char* name) {
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
/*1. create new entry with long key and long value */
int64_t int64Key = 9223372036854775807LL; // INT64_MAX
int64_t in64Value = 9223372036854775807LL; // INT64_MAX
regPtr->create(int64Key, in64Value);
- CacheableInt64Ptr longRetValue =
- dynCast<CacheableInt64Ptr>(regPtr->get(int64Key));
+ auto longRetValue = std::dynamic_pointer_cast<CacheableInt64>(regPtr->get(int64Key));
ASSERT(in64Value == longRetValue->value(),
"longRetValue and longvalue should match");
int64_t int64Key1 = 9223372036854775807LL;
try {
regPtr->create(int64Key1, in64Value);
- CacheableInt64Ptr longRetValue =
- dynCast<CacheableInt64Ptr>(regPtr->get(int64Key));
+ auto longRetValue = std::dynamic_pointer_cast<CacheableInt64>(regPtr->get(int64Key));
FAIL("Expected EntryExistException here");
- } catch (EntryExistsException e) {
+ } catch (EntryExistsException& e) {
LOG(" Expected EntryExistsException exception thrown by localCreate");
}
/*2.create new entry with long key and string value*/
int64_t int64KeyMin = -9223372036854775807LL - 1LL; // INT64_MIN
regPtr->create(int64KeyMin, "testvalue");
- CacheableStringPtr strRetValue = regPtr->get(int64KeyMin);
+ auto strRetValue =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(int64KeyMin));
ASSERT(strcmp(strRetValue->asChar(), "testvalue") == 0,
"strRetValue and 'testvalue' should match");
@@ -300,7 +298,7 @@ void createAndVerifyEntry(const char* name) {
regPtr->create(x, 1);
LOG("Entry with null key and value created successfully");
FAIL("Expected IllegalArgumentException here");
- } catch (IllegalArgumentException ex) {
+ } catch (IllegalArgumentException& ex) {
LOGINFO("Expected IllegalArgumentException : %s", ex.getMessage());
}
@@ -308,7 +306,7 @@ void createAndVerifyEntry(const char* name) {
try {
regPtr->create(x, "testvalue");
FAIL("Expected IllegalArgumentException here");
- } catch (IllegalArgumentException ex) {
+ } catch (IllegalArgumentException& ex) {
LOGINFO("Expected IllegalArgumentException : %s", ex.getMessage());
}
@@ -316,7 +314,7 @@ void createAndVerifyEntry(const char* name) {
* cacheableInt,CacheableDouble, CacheableString,CacheableHashMap etc) key and
* null value*/
// Serializable::registerPdxType(PdxTests::PdxType::createDeserializable);
- CacheableKeyPtr keyObject1(new PdxTests::PdxType());
+ auto keyObject1 = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject1, x);
CacheablePtr retVal = regPtr->get(keyObject1);
ASSERT(retVal == x, "retVal and x should match.");
@@ -324,27 +322,28 @@ void createAndVerifyEntry(const char* name) {
/*6.create new with entry userobject cantain all cacheable type ( like
* cacheableInt,CacheableDouble, CacheableString,CacheableHashMap etc) key and
* int value*/
- CacheableKeyPtr keyObject2(new PdxTests::PdxType());
+ auto keyObject2 = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject2, 1);
- CacheableInt32Ptr intVal = regPtr->get(keyObject2);
+ auto intVal =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyObject2));
ASSERT(intVal->value() == 1, "intVal should be 1.");
regPtr->invalidate(keyObject2);
- intVal = dynCast<CacheableInt32Ptr>(regPtr->get(keyObject2));
- ASSERT(intVal == NULLPTR, "intVal should be null.");
+ intVal = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyObject2));
+ ASSERT(intVal == nullptr, "intVal should be null.");
try {
if (regPtr->containsKey(keyObject2)) {
regPtr->create(keyObject2, in64Value);
FAIL("Expected EntryExistException here");
}
- } catch (EntryExistsException e) {
+ } catch (EntryExistsException& e) {
LOG(" Expected EntryExistsException exception thrown by localCreate");
}
/*7.create new with entry userobject cantain all cacheable type ( like
* cacheableInt,CacheableDouble, CacheableString,CacheableHashMap etc) key and
* string value*/
- CacheableKeyPtr keyObject3(new PdxTests::PdxType());
+ auto keyObject3 = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject3, "testString");
CacheablePtr strVal = regPtr->get(keyObject3);
ASSERT(strcmp(strVal->toString()->asChar(), "testString") == 0,
@@ -355,11 +354,11 @@ void createAndVerifyEntry(const char* name) {
* userobject
* cantain all cacheable type ( like cacheableInt,CacheableDouble,
* CacheableString,CacheableHashMap etc) value*/
- CacheableKeyPtr keyObject4(new PdxTests::PdxType());
- PdxTests::PdxTypePtr valObject(new PdxTests::PdxType());
+ auto keyObject4 = std::make_shared<PdxTests::PdxType>();
+ auto valObject = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject4, valObject);
PdxTests::PdxTypePtr objVal =
- dynCast<PdxTests::PdxTypePtr>(regPtr->get(keyObject4));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr->get(keyObject4));
ASSERT(valObject == objVal, "valObject and objVal should match.");
/*9.create new entry witn non serialize object. IllegalArgumentException
@@ -424,7 +423,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),
@@ -449,12 +448,11 @@ void doGetAgain(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "get region name%s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- 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 doGetAgain, get returned %s for key %s",
@@ -481,7 +479,7 @@ 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.");
if (count == 0) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -490,10 +488,9 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
count++;
}
- 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",
@@ -783,7 +780,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight_Pool_Sticky)
reg0->localInvalidate(createKey(keys[1]));
reg1->localInvalidate(createKey(keys[3]));
PoolPtr pool = PoolManager::find("__TESTPOOL1_");
- ASSERT(pool != NULLPTR, "Pool Should have been found");
+ ASSERT(pool != nullptr, "Pool Should have been found");
doNetsearch(regionNames[0], keys[1], nvals[1]);
doNetsearch(regionNames[1], keys[3], nvals[3]);
pool->releaseThreadLocalConnection();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDistOps2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDistOps2.hpp b/src/cppcache/integration-test/ThinClientDistOps2.hpp
index f8dfbf1..6e1f851 100644
--- a/src/cppcache/integration-test/ThinClientDistOps2.hpp
+++ b/src/cppcache/integration-test/ThinClientDistOps2.hpp
@@ -94,7 +94,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1Regions_Pooled_Locator)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName);
createPooledRegion(_regionNames[1], NO_ACK, locatorsG, poolName);
LOG("CreateClient1Regions complete.");
@@ -104,7 +104,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2Regions_Pooled_Locator)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName);
createPooledRegion(_regionNames[1], NO_ACK, locatorsG, poolName);
LOG("CreateClient1Regions complete.");
@@ -160,27 +160,27 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
// test invalid combination with caching disabled for getAll
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createPooledRegion(regionNames[0], USE_ACK, 0,
"__TEST_POOL1__", false, false);
reg0 = getHelper()->getRegion(_regionNames[0]);
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, true);
+ reg0->getAll(keys0, nullptr, nullptr, true);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
// re-create region with caching enabled
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createPooledRegion(regionNames[0], USE_ACK, 0,
"__TEST_POOL1__", true, true);
reg0 = getHelper()->getRegion(_regionNames[0]);
// check for IllegalArgumentException for empty key list
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
keys0.clear();
try {
reg0->getAll(keys0, values, exceptions);
@@ -191,7 +191,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, false);
+ reg0->getAll(keys0, nullptr, nullptr, false);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
@@ -200,10 +200,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
reg0->getAll(keys0, values, exceptions);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val0 =
- dynCast<CacheableStringPtr>(values->operator[](key0));
- CacheableStringPtr val1 =
- dynCast<CacheableStringPtr>(values->operator[](key1));
+ auto val0 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key0));
+ auto val1 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key1));
ASSERT(strcmp(_nvals[0], val0->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_nvals[1], val1->asChar()) == 0, "Got unexpected value");
@@ -222,10 +220,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
reg1->getAll(keys1, values, exceptions, true);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val2 =
- dynCast<CacheableStringPtr>(values->operator[](key2));
- CacheableStringPtr val3 =
- dynCast<CacheableStringPtr>(values->operator[](key3));
+ auto val2 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key2));
+ auto val3 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key3));
ASSERT(strcmp(_nvals[2], val2->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_vals[3], val3->asChar()) == 0, "Got unexpected value");
@@ -239,7 +235,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
// also check with NULL values that region is properly populated
reg1->localInvalidate(key3);
- values = NULLPTR;
+ values = nullptr;
exceptions->clear();
reg1->getAll(keys1, values, exceptions, true);
// now check that the region is properly populated
@@ -262,26 +258,26 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
// test invalid combination with caching disabled for getAll
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createRegionAndAttachPool(_regionNames[0], USE_ACK, poolName,
false);
reg0 = getHelper()->getRegion(_regionNames[0]);
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, true);
+ reg0->getAll(keys0, nullptr, nullptr, true);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
// re-create region with caching enabled
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createRegionAndAttachPool(_regionNames[0], USE_ACK, poolName);
reg0 = getHelper()->getRegion(_regionNames[0]);
// check for IllegalArgumentException for empty key list
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
keys0.clear();
try {
reg0->getAll(keys0, values, exceptions);
@@ -292,7 +288,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, false);
+ reg0->getAll(keys0, nullptr, nullptr, false);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
@@ -301,10 +297,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
reg0->getAll(keys0, values, exceptions);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val0 =
- dynCast<CacheableStringPtr>(values->operator[](key0));
- CacheableStringPtr val1 =
- dynCast<CacheableStringPtr>(values->operator[](key1));
+ auto val0 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key0));
+ auto val1 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key1));
ASSERT(strcmp(_nvals[0], val0->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_nvals[1], val1->asChar()) == 0, "Got unexpected value");
@@ -323,10 +317,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
reg1->getAll(keys1, values, exceptions, true);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val2 =
- dynCast<CacheableStringPtr>(values->operator[](key2));
- CacheableStringPtr val3 =
- dynCast<CacheableStringPtr>(values->operator[](key3));
+ auto val2 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key2));
+ auto val3 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key3));
ASSERT(strcmp(_nvals[2], val2->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_vals[3], val3->asChar()) == 0, "Got unexpected value");
@@ -340,7 +332,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
// also check with NULL values that region is properly populated
reg1->localInvalidate(key3);
- values = NULLPTR;
+ values = nullptr;
exceptions->clear();
reg1->getAll(keys1, values, exceptions, true);
// now check that the region is properly populated
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurable.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurable.hpp b/src/cppcache/integration-test/ThinClientDurable.hpp
index 4b08cbc..06f154a 100644
--- a/src/cppcache/integration-test/ThinClientDurable.hpp
+++ b/src/cppcache/integration-test/ThinClientDurable.hpp
@@ -58,16 +58,16 @@ class OperMonitor : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = NULLPTR;
+ CacheableInt32Ptr value = nullptr;
try {
- value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
} catch (Exception) {
// do nothing.
}
char buff[128] = {'\0'};
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(key);
- if (value != NULLPTR) {
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(key);
+ if (value != nullptr) {
sprintf(buff, "Event [%s, %d] called for %s:%s", keyPtr->toString(),
value->value(), m_clientName.c_str(), m_regionName.c_str());
@@ -105,8 +105,8 @@ class OperMonitor : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(item.first());
- CacheableInt32Ptr valuePtr = dynCast<CacheableInt32Ptr>(item.second());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(item.first());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(item.second());
if (strchr(keyPtr->toString(), 'D') == NULL) { /*Non Durable Key */
sprintf(buf,
@@ -147,11 +147,11 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1C1 = NULLPTR;
-OperMonitorPtr mon2C1 = NULLPTR;
+OperMonitorPtr mon1C1 = nullptr;
+OperMonitorPtr mon2C1 = nullptr;
-OperMonitorPtr mon1C2 = NULLPTR;
-OperMonitorPtr mon2C2 = NULLPTR;
+OperMonitorPtr mon1C2 = nullptr;
+OperMonitorPtr mon2C2 = nullptr;
/* Total 10 Keys , alternate durable and non-durable */
const char* mixKeys[] = {"Key-1", "D-Key-1", "L-Key", "LD-Key"};
@@ -225,7 +225,7 @@ void feederUpdate(int value, int ignoreR2 = false) {
DUNIT_TASK_DEFINITION(FEEDER, FeederInit)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regionNames[1], USE_ACK, locatorsG,
@@ -236,11 +236,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClient1Timeout300)
{
- if (mon1C1 == NULLPTR) {
- mon1C1 = new OperMonitor(durableIds[0], regionNames[0]);
+ if (mon1C1 == nullptr) {
+ mon1C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[0]);
}
- if (mon2C1 == NULLPTR) {
- mon2C1 = new OperMonitor(durableIds[0], regionNames[1]);
+ if (mon2C1 == nullptr) {
+ mon2C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[1]);
}
initClientCache(0, 0 /* Redundancy */, 300 /* D Timeout */, mon1C1, mon2C1);
}
@@ -248,11 +248,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClient1Timeout30)
{
- if (mon1C1 == NULLPTR) {
- mon1C1 = new OperMonitor(durableIds[0], regionNames[0]);
+ if (mon1C1 == nullptr) {
+ mon1C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[0]);
}
- if (mon2C1 == NULLPTR) {
- mon2C1 = new OperMonitor(durableIds[0], regionNames[1]);
+ if (mon2C1 == nullptr) {
+ mon2C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[1]);
}
initClientCache(0, 0 /* Redundancy */, 30 /* D Timeout */, mon1C1, mon2C1);
}
@@ -260,11 +260,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClient1DelayedStart)
{
- if (mon1C1 == NULLPTR) {
- mon1C1 = new OperMonitor(durableIds[0], regionNames[0]);
+ if (mon1C1 == nullptr) {
+ mon1C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[0]);
}
- if (mon2C1 == NULLPTR) {
- mon2C1 = new OperMonitor(durableIds[0], regionNames[1]);
+ if (mon2C1 == nullptr) {
+ mon2C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[1]);
}
initClientCache(0, 0 /* Redundancy */, 30 /* D Timeout */, mon1C1, mon2C1,
35000 /* Sleep before starting */);
@@ -273,11 +273,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, InitClient2Timeout300)
{
- if (mon1C2 == NULLPTR) {
- mon1C2 = new OperMonitor(durableIds[1], regionNames[0]);
+ if (mon1C2 == nullptr) {
+ mon1C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[0]);
}
- if (mon2C2 == NULLPTR) {
- mon2C2 = new OperMonitor(durableIds[1], regionNames[1]);
+ if (mon2C2 == nullptr) {
+ mon2C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[1]);
}
initClientCache(1, 1 /* Redundancy */, 300 /* D Timeout */, mon1C2, mon2C2);
}
@@ -286,11 +286,11 @@ END_TASK_DEFINITION
// Client 2 don't need to sleep for timeout as C1 does before it
DUNIT_TASK_DEFINITION(CLIENT2, InitClient2Timeout30)
{
- if (mon1C2 == NULLPTR) {
- mon1C2 = new OperMonitor(durableIds[1], regionNames[0]);
+ if (mon1C2 == nullptr) {
+ mon1C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[0]);
}
- if (mon2C2 == NULLPTR) {
- mon2C2 = new OperMonitor(durableIds[1], regionNames[1]);
+ if (mon2C2 == nullptr) {
+ mon2C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[1]);
}
initClientCache(1, 1 /* Redundancy */, 30 /* D Timeout */, mon1C2, mon2C2);
}
@@ -469,8 +469,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient1)
{
- mon1C1 = NULLPTR;
- mon2C1 = NULLPTR;
+ mon1C1 = nullptr;
+ mon2C1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
@@ -478,8 +478,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CloseClient2)
{
- mon1C2 = NULLPTR;
- mon2C2 = NULLPTR;
+ mon1C2 = nullptr;
+ mon2C2 = nullptr;
cleanProc();
LOG("CLIENT2 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurableFailover.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurableFailover.hpp b/src/cppcache/integration-test/ThinClientDurableFailover.hpp
index f06510e..3085c6b 100644
--- a/src/cppcache/integration-test/ThinClientDurableFailover.hpp
+++ b/src/cppcache/integration-test/ThinClientDurableFailover.hpp
@@ -56,22 +56,22 @@ class OperMonitor : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = NULLPTR;
+ CacheableInt32Ptr value = nullptr;
try {
- value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
} catch (Exception) {
// do nothing.
}
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(key);
- if (keyPtr != NULLPTR && value != NULLPTR) {
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(key);
+ if (keyPtr != nullptr && value != nullptr) {
char buf[256] = {'\0'};
sprintf(buf, " Got Key: %s, Value: %d", keyPtr->toString(),
value->value());
LOG(buf);
}
- if (value != NULLPTR) {
+ if (value != nullptr) {
HashMapOfCacheable::Iterator item = m_map.find(key);
if (item != m_map.end()) {
@@ -102,8 +102,8 @@ class OperMonitor : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(item.first());
- CacheableInt32Ptr valuePtr = dynCast<CacheableInt32Ptr>(item.second());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(item.first());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(item.second());
if (strchr(keyPtr->toString(), 'D') == NULL) { /*Non Durable Key */
sprintf(buf,
@@ -144,8 +144,8 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1 = NULLPTR;
-OperMonitorPtr mon2 = NULLPTR;
+OperMonitorPtr mon1 = nullptr;
+OperMonitorPtr mon2 = nullptr;
#include "ThinClientDurableInit.hpp"
#include "ThinClientTasks_C2S2.hpp"
@@ -158,8 +158,8 @@ void initClientCache(int redundancy, int durableTimeout, OperMonitorPtr& mon,
int sleepDuration = 0, int durableIdx = 0) {
if (sleepDuration) SLEEP(sleepDuration);
- if (mon == NULLPTR) {
- mon = new OperMonitor();
+ if (mon == nullptr) {
+ mon = std::make_shared<OperMonitor>();
}
// 35 sec ack interval to ensure primary clears its Q only
@@ -177,12 +177,12 @@ void initClientCache(int redundancy, int durableTimeout, OperMonitorPtr& mon,
// for R =1 it will get a redundancy error
try {
regPtr0->registerRegex(testRegex[0], true);
- } catch (Exception) {
+ } catch (Exception&) {
// do nothing.
}
try {
regPtr0->registerRegex(testRegex[1], false);
- } catch (Exception) {
+ } catch (Exception&) {
// do nothing.
}
}
@@ -234,7 +234,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(FEEDER, FeederInit)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
LOG("FeederInit complete.");
@@ -304,7 +304,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient1)
{
- mon1 = NULLPTR;
+ mon1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurableInterest.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurableInterest.hpp b/src/cppcache/integration-test/ThinClientDurableInterest.hpp
index 24c75e4..b137013 100644
--- a/src/cppcache/integration-test/ThinClientDurableInterest.hpp
+++ b/src/cppcache/integration-test/ThinClientDurableInterest.hpp
@@ -50,7 +50,7 @@ class OperMonitor : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
char buf[256];
sprintf(buf,
@@ -91,8 +91,8 @@ class OperMonitor : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(item.first());
- CacheableInt32Ptr valuePtr = dynCast<CacheableInt32Ptr>(item.second());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(item.first());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(item.second());
if (strchr(keyPtr->toString(), 'D') == NULL) { /*Non Durable Key */
sprintf(buf,
@@ -133,8 +133,8 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
}
void initClientWithIntrest(int ClientIdx, OperMonitorPtr& mon) {
- if (mon == NULLPTR) {
- mon = new OperMonitor;
+ if (mon == nullptr) {
+ mon = std::make_shared<OperMonitor>();
}
initClientAndRegion(0, ClientIdx);
@@ -155,11 +155,11 @@ void initClientWithIntrest(int ClientIdx, OperMonitorPtr& mon) {
void initClientWithIntrest2(int ClientIdx, OperMonitorPtr& monitor1,
OperMonitorPtr& monitor2) {
initClientAndTwoRegionsAndTwoPools(0, ClientIdx, 60);
- if (monitor1 == NULLPTR) {
- monitor1 = new OperMonitor(1);
+ if (monitor1 == nullptr) {
+ monitor1 = std::make_shared<OperMonitor>(1);
}
- if (monitor2 == NULLPTR) {
- monitor2 = new OperMonitor(2);
+ if (monitor2 == nullptr) {
+ monitor2 = std::make_shared<OperMonitor>(2);
}
setCacheListener(regionNames[0], monitor1);
setCacheListener(regionNames[1], monitor2);
@@ -206,7 +206,7 @@ void feederUpdate1(int value) {
DUNIT_TASK_DEFINITION(FEEDER, FeederInit)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regionNames[1], NO_ACK, locatorsG,
@@ -324,7 +324,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient1)
{
- mon1 = NULLPTR;
+ mon1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
@@ -332,8 +332,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient12)
{
- mon1 = NULLPTR;
- mon2 = NULLPTR;
+ mon1 = nullptr;
+ mon2 = nullptr;
cleanProc();
LOG("CLIENT12 closed");
}
@@ -341,7 +341,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CloseClient2)
{
- mon2 = NULLPTR;
+ mon2 = nullptr;
cleanProc();
LOG("CLIENT2 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurableReconnect.hpp b/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
index f68474e..935dfaa 100644
--- a/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
+++ b/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
@@ -72,7 +72,7 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1 = NULLPTR;
+OperMonitorPtr mon1 = nullptr;
const char* mixKeys[] = {"D-Key-1"};
@@ -82,8 +82,8 @@ const char* mixKeys[] = {"D-Key-1"};
void initClientCache(int redundancy, OperMonitorPtr& mon) {
initClientAndRegion(redundancy, 0, 60000, 1, 300);
- if (mon == NULLPTR) {
- mon = new OperMonitor();
+ if (mon == nullptr) {
+ mon = std::make_shared<OperMonitor>();
}
setCacheListener(regionNames[0], mon);
@@ -138,7 +138,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient)
{
- mon1 = NULLPTR;
+ mon1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailover.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailover.hpp b/src/cppcache/integration-test/ThinClientFailover.hpp
index ddc2a72..22d0639 100644
--- a/src/cppcache/integration-test/ThinClientFailover.hpp
+++ b/src/cppcache/integration-test/ThinClientFailover.hpp
@@ -86,7 +86,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
RegionPtr regPtr = getHelper()->getRegion(name);
LOG("_verifyEntry =================");
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -120,10 +120,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);
@@ -157,8 +156,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// 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.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -171,7 +170,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.");
}
@@ -185,7 +184,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -199,7 +198,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.");
@@ -224,7 +223,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
@@ -250,17 +249,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/ThinClientFailover2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailover2.hpp b/src/cppcache/integration-test/ThinClientFailover2.hpp
index e973542..6bffa38 100644
--- a/src/cppcache/integration-test/ThinClientFailover2.hpp
+++ b/src/cppcache/integration-test/ThinClientFailover2.hpp
@@ -88,7 +88,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);
@@ -122,10 +122,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);
@@ -179,8 +178,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// 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.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -193,7 +192,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.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -206,7 +205,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.");
@@ -231,7 +230,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
@@ -257,7 +256,7 @@ 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.");
/*NIL: Changed the asserion due to the change in invalidate.
Now we create new entery for every invalidate event received or
@@ -267,10 +266,9 @@ void doNetsearch(const char* name, const char* key, const char* value) {
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",
@@ -291,7 +289,7 @@ void invalidateEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
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
@@ -312,7 +310,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
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.");
@@ -358,9 +356,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pool_Locator)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TEST_POOL1__",
true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("StepOne complete.");
}
END_TASK_DEFINITION
@@ -376,9 +374,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TEST_POOL1__",
true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("StepTwo complete.");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailover3.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailover3.hpp b/src/cppcache/integration-test/ThinClientFailover3.hpp
index c117f0c..140bf65 100644
--- a/src/cppcache/integration-test/ThinClientFailover3.hpp
+++ b/src/cppcache/integration-test/ThinClientFailover3.hpp
@@ -86,7 +86,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);
@@ -120,10 +120,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);
@@ -160,7 +159,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.");
}
void createEntry(const char *name, const char *key, const char *value) {
@@ -173,7 +172,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.");
@@ -198,7 +197,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.");
@@ -222,12 +221,11 @@ 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.");
- 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/ThinClientFailoverInterest.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverInterest.hpp b/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
index 687467f..479079f 100644
--- a/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
@@ -87,7 +87,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);
@@ -137,10 +137,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);
@@ -185,8 +184,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, not a mirror, 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.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -199,7 +198,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.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -212,7 +211,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.");
@@ -237,7 +236,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
@@ -263,17 +262,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",
@@ -333,8 +331,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
VectorOfCacheableKey keys0, keys1;
keys0.push_back(keyPtr0);
keys1.push_back(keyPtr2);
- regPtr0->registerKeys(keys0, NULLPTR);
- regPtr1->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys0);
+ regPtr1->registerKeys(keys1);
LOG("StepTwo complete.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp b/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
index d84de3e..4e50c5f 100644
--- a/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
@@ -86,7 +86,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);
@@ -136,10 +136,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);
@@ -184,8 +183,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// 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.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -198,7 +197,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.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -211,7 +210,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.");
@@ -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 ), "Value should have been
@@ -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/ThinClientFailoverInterestAllWithCache.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp b/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
index a479dc3..4b70787 100644
--- a/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
@@ -52,7 +52,7 @@ const char* locatorsG =
void initClient(const bool isthinClient) {
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, "__TEST_POOL1__", NULL,
- "ServerGroup1", NULLPTR, 0, true);
+ "ServerGroup1", nullptr, 0, true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
@@ -91,7 +91,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);
@@ -141,10 +141,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);
@@ -188,8 +187,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
LOGINFO("Creating region -- %s ackMode is %d", name, ackMode);
// 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.");
}
@@ -202,7 +201,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.");
@@ -226,7 +225,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),
@@ -248,17 +247,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
LOGINFO("netsearch region %s", regPtr->getName());
- 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",
@@ -317,18 +315,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitializeClient2)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- VectorOfCacheableKeyPtr resultKeys(new VectorOfCacheableKey());
+ auto resultKeys = std::make_shared<VectorOfCacheableKey>();
// create a local entry to check for no change after register interest
createEntry(regionNames[0], keys[1], nvals[1]);
regPtr0->registerAllKeys(false, resultKeys, true);
- regPtr1->registerAllKeys(false, NULLPTR, true);
+ regPtr1->registerAllKeys(false, nullptr, true);
// check that initial entries are created properly
ASSERT(regPtr0->size() == 1, "Expected one entry in region");
ASSERT(regPtr1->size() == 1, "Expected one entry in region");
ASSERT(resultKeys->size() == 1, "Expected one key from registerAllKeys");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[1]) == 0,
"Unexpected key from registerAllKeys");
@@ -345,18 +343,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitializeClient2Regex)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- VectorOfCacheableKeyPtr resultKeys(new VectorOfCacheableKey());
+ auto resultKeys = std::make_shared<VectorOfCacheableKey>();
// create a local entry to check for no change after register interest
createEntry(regionNames[0], keys[1], nvals[1]);
regPtr0->registerRegex(".*", false, resultKeys, true);
- regPtr1->registerRegex(".*", false, NULLPTR, true);
+ regPtr1->registerRegex(".*", false, nullptr, true);
// check that initial entries are created properly
ASSERT(regPtr0->size() == 1, "Expected one entry in region");
ASSERT(regPtr1->size() == 1, "Expected one entry in region");
ASSERT(resultKeys->size() == 1, "Expected one key from registerAllKeys");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[1]) == 0,
"Unexpected key from registerAllKeys");
@@ -373,7 +371,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyClient1)
{
// check the combination of (resultKeys != NULL) and
// (getValues == false) in registerAllKeys
- VectorOfCacheableKeyPtr resultKeys(new VectorOfCacheableKey());
+ auto resultKeys = std::make_shared<VectorOfCacheableKey>();
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
regPtr0->registerAllKeys(false, resultKeys, false);
@@ -383,7 +381,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyClient1)
"Expected region to not contain the value");
ASSERT(resultKeys->size() == 1, "Expected one key from registerAllKeys");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[1]) == 0,
"Unexpected key from registerAllKeys");
@@ -398,7 +396,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyClient1)
"Expected region to not contain the value");
ASSERT(resultKeys->size() == 1, "Expected one key from registerRegex");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[3]) == 0,
"Unexpected key from registerRegex");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverRegex.hpp b/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
index a281bf7..37d8149 100644
--- a/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
@@ -87,7 +87,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);
@@ -137,10 +137,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);
@@ -185,8 +184,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// 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.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -199,7 +198,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.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -212,7 +211,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.");
@@ -237,7 +236,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
@@ -263,17 +262,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",
@@ -340,8 +338,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
VectorOfCacheableKey keys0,keys1;
keys0.push_back(keyPtr0);
keys1.push_back(keyPtr2);
- regPtr0->registerKeys(keys0, NULLPTR);
- regPtr1->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys0, nullptr);
+ regPtr1->registerKeys(keys1, nullptr);
*/
regPtr0->registerRegex(regkeys[0]);
@@ -356,12 +354,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
createEntry(regionNames[0], keys[0], vals[0]);
createEntry(regionNames[1], keys[2], vals[2]);
- VectorOfCacheableKeyPtr vec(new VectorOfCacheableKey());
+ auto vec = std::make_shared<VectorOfCacheableKey>();
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
regPtr1->registerRegex(regkeys[1], false, vec);
ASSERT(vec->size() == 1, "Expected one key after registerRegex");
- CacheableStringPtr key1 = dynCast<CacheableStringPtr>(vec->operator[](0));
+ auto key1 = std::dynamic_pointer_cast<CacheableString>(vec->operator[](0));
ASSERT(strcmp(keys[1], key1->asChar()) == 0,
"Expected key to match in registerRegex");
@@ -392,7 +390,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
CacheableKeyPtr keyPtr2 = CacheableKey::create(keys[2]);
VectorOfCacheableKey keys2;
keys2.push_back(keyPtr2);
- regPtr1->unregisterKeys(keys2, NULLPTR);
+ regPtr1->unregisterKeys(keys2, nullptr);
*/
LOG("StepFour complete.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientGatewayTest.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientGatewayTest.hpp b/src/cppcache/integration-test/ThinClientGatewayTest.hpp
index 7ecd39c..5b8c7c4 100644
--- a/src/cppcache/integration-test/ThinClientGatewayTest.hpp
+++ b/src/cppcache/integration-test/ThinClientGatewayTest.hpp
@@ -102,12 +102,12 @@ DUNIT_TASK_DEFINITION(SERVER2, StartServer2)
}
END_TASK_DEFINITION
-MyListenerPtr reg1Listener1 = NULLPTR;
+MyListenerPtr reg1Listener1 = nullptr;
DUNIT_TASK_DEFINITION(SERVER2, SetupClient2)
{
// CacheHelper ch = getHelper();
- reg1Listener1 = new MyListener();
+ reg1Listener1 = std::make_shared<MyListener>();
RegionPtr regPtr = createPooledRegion("exampleRegion", false, locHostPort2,
"poolName", true, reg1Listener1);
regPtr->registerAllKeys();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientHeapLRU.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientHeapLRU.hpp b/src/cppcache/integration-test/ThinClientHeapLRU.hpp
index ce4ec99..946ccb7 100644
--- a/src/cppcache/integration-test/ThinClientHeapLRU.hpp
+++ b/src/cppcache/integration-test/ThinClientHeapLRU.hpp
@@ -96,8 +96,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.");
}
@@ -111,7 +111,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.");
}
@@ -125,9 +125,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;