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:02 UTC
[20/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/testThinClientCq.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCq.cpp b/src/cppcache/integration-test/testThinClientCq.cpp
index 4ac6da0..8b06484 100644
--- a/src/cppcache/integration-test/testThinClientCq.cpp
+++ b/src/cppcache/integration-test/testThinClientCq.cpp
@@ -381,7 +381,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
@@ -389,7 +389,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
}
CqAttributesFactory cqFac;
for (i = 0; i < MAX_LISTNER; i++) {
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
CqQueryPtr qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
@@ -459,7 +459,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePositionPdxData(subregPtr0, 3, 2);
}
- CacheablePtr port = NULLPTR;
+ CacheablePtr port = nullptr;
for (int i = 1; i < 3; i++) {
if (!m_isPdx) {
port = CacheablePtr(new Portfolio(i, 2));
@@ -483,7 +483,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
@@ -524,16 +524,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
events[j] += cqStats->numEvents();
}
CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i],
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
vl.size());
LOG(buf);
ASSERT(vl.size() == i + 1, "incorrect number of listeners");
if (i == (MAX_LISTNER - 1)) {
MyCqListener* myLl[MAX_LISTNER];
for (int k = 0; k < MAX_LISTNER; k++) {
- MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].ptr());
+ MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].get());
myLl[ml->getId()] = ml;
}
for (j = 0; j < MAX_LISTNER; j++) {
@@ -563,7 +563,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
CqListenerPtr ptr = vl[0];
cqAttrMtor->removeCqListener(ptr);
cqAttr->getCqListeners(vl);
- sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i],
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
vl.size());
LOG(buf);
ASSERT(vl.size() == i, "incorrect number of listeners");
@@ -604,7 +604,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
cqy = qs->getCq(cqNames[2]);
sprintf(buf, "cq[%s] should have been removed after close!", cqNames[2]);
- ASSERT(cqy == NULLPTR, buf);
+ ASSERT(cqy == nullptr, buf);
} catch (Exception& excp) {
std::string failmsg = "";
failmsg += excp.getName();
@@ -615,7 +615,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
excp.printStackTrace();
}
CqServiceStatisticsPtr serviceStats = qs->getCqServiceStatistics();
- ASSERT(serviceStats != NULLPTR, "serviceStats is NULL");
+ ASSERT(serviceStats != nullptr, "serviceStats is NULL");
sprintf(buf,
"numCqsActive=%d, numCqsCreated=%d, "
"numCqsClosed=%d,numCqsStopped=%d, numCqsOnClient=%d",
@@ -689,7 +689,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
ASSERT(serviceStats->numCqsOnClient() == 0, "cq count incorrect!");
i = 0;
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
try {
@@ -794,7 +794,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ)
PoolPtr pool = PoolManager::find(regionName);
QueryServicePtr qs = pool->getQueryService();
CqAttributesFactory cqFac;
- CqStatusListenerPtr cqLstner(new MyCqStatusListener(100));
+ auto cqLstner = std::make_shared<MyCqStatusListener>(100);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
CqQueryPtr cq =
@@ -804,10 +804,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ)
SLEEP(20000);
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
ASSERT(myStatusCq->getCqsConnectedCount() == 1,
"incorrect number of CqStatus Connected count.");
@@ -820,7 +820,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
PoolPtr pool = PoolManager::find("__TEST_POOL1__");
QueryServicePtr qs = pool->getQueryService();
CqAttributesFactory cqFac;
- CqStatusListenerPtr cqLstner(new MyCqStatusListener(100));
+ auto cqLstner = std::make_shared<MyCqStatusListener>(100);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -830,10 +830,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
SLEEP(20000);
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
ASSERT(myStatusCq->getCqsConnectedCount() == 1,
"incorrect number of CqStatus Connected count.");
@@ -841,7 +841,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
PoolPtr pool2 = PoolManager::find("__TEST_POOL2__");
QueryServicePtr qs2 = pool2->getQueryService();
CqAttributesFactory cqFac1;
- CqStatusListenerPtr cqLstner1(new MyCqStatusListener(101));
+ auto cqLstner1 = std::make_shared<MyCqStatusListener>(101);
cqFac1.addCqListener(cqLstner1);
CqAttributesPtr cqAttr1 = cqFac1.create();
CqQueryPtr cq2 =
@@ -850,10 +850,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
SLEEP(20000);
cqAttr1 = cq2->getCqAttributes();
- VectorOfCqListener vl2;
+ std::vector<CqListenerPtr> vl2;
cqAttr1->getCqListeners(vl2);
MyCqStatusListener* myStatusCq2 =
- dynamic_cast<MyCqStatusListener*>(vl2[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl2[0].get());
LOGINFO("checkCQStatusOnConnect = %d ",
myStatusCq2->getCqsConnectedCount());
ASSERT(myStatusCq2->getCqsConnectedCount() == 1,
@@ -861,7 +861,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
RegionPtr regPtr0 = getHelper()->getRegion(regionName);
RegionPtr regPtr1 = getHelper()->getRegion(regionName1);
- CacheablePtr val = NULLPTR;
+ CacheablePtr val = nullptr;
char KeyStr[256] = {0};
char valStr[256] = {0};
for (int i = 1; i <= 5; i++) {
@@ -890,7 +890,7 @@ END_TASK_DEFINITION
void executeCq(const char* poolName, const char* name) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(name));
@@ -910,15 +910,15 @@ void checkCQStatusOnConnect(const char* poolName, const char* name,
int connect) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(name));
CqAttributesPtr cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
ASSERT(myStatusCq->getCqsConnectedCount() == connect,
"incorrect number of CqStatus Connected count.");
@@ -954,15 +954,15 @@ void checkCQStatusOnDisConnect(const char* poolName, const char* cqName,
int disconnect) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(cqName));
CqAttributesPtr cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnDisConnect = %d ",
myStatusCq->getCqsDisConnectedCount());
ASSERT(myStatusCq->getCqsDisConnectedCount() == disconnect,
@@ -1006,7 +1006,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putEntries)
{
RegionPtr regPtr0 = getHelper()->getRegion(regionName);
RegionPtr regPtr1 = getHelper()->getRegion(regionName1);
- CacheablePtr val = NULLPTR;
+ CacheablePtr val = nullptr;
char KeyStr[256] = {0};
char valStr[256] = {0};
for (int i = 1; i <= 5; i++) {
@@ -1026,15 +1026,15 @@ void checkCQStatusOnPutEvent(const char* poolName, const char* cqName,
int count) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(cqName));
CqAttributesPtr cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnPutEvent = %d ", myStatusCq->getNumInserts());
ASSERT(myStatusCq->getNumInserts() == count,
"incorrect number of CqStatus Updates count.");
@@ -1062,8 +1062,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
PoolPtr pool = PoolManager::find(regionName);
QueryServicePtr qs = pool->getQueryService();
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener(1));
- CqStatusListenerPtr cqStatusLstner(new MyCqStatusListener(100));
+ auto cqLstner = std::make_shared<MyCqListener>(1);
+ auto cqStatusLstner = std::make_shared<MyCqStatusListener>(100);
cqFac.addCqListener(cqLstner);
cqFac.addCqListener(cqStatusLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -1075,7 +1075,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
LOG("ProcessCQ Query executed.");
RegionPtr regPtr0 = getHelper()->getRegion(regionName);
- CacheablePtr val = NULLPTR;
+ CacheablePtr val = nullptr;
char KeyStr[256] = {0};
char valStr[256] = {0};
for (int i = 1; i <= 5; i++) {
@@ -1089,11 +1089,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
LOGINFO("putEntries complete");
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
ASSERT(vl.size() == 2, "incorrect number of CqListeners count.");
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[1].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[1].get());
LOGINFO("No of insert events = %d ", myStatusCq->getNumInserts());
LOGINFO("No of OnCqConnected events = %d ",
myStatusCq->getCqsConnectedCount());
@@ -1102,7 +1102,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
ASSERT(myStatusCq->getCqsConnectedCount() == 1,
"incorrect number of CqStatus Connected count.");
- MyCqListener* myCq = dynamic_cast<MyCqListener*>(vl[0].ptr());
+ MyCqListener* myCq = dynamic_cast<MyCqListener*>(vl[0].get());
LOGINFO("No of insert events = %d ", myCq->getNumInserts());
ASSERT(myCq->getNumInserts() == 5,
"incorrect number of CqStatus Updates count.");
@@ -1122,19 +1122,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
ASSERT(vl.size() == 0, "incorrect number of listeners");
- VectorOfCqListener v2;
+ std::vector<CqListenerPtr> v2;
v2.push_back(cqStatusLstner);
v2.push_back(cqLstner);
cqAttrMtor->setCqListeners(v2);
LOG("ProcessCQ setCqListeneres done.");
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl3;
+ std::vector<CqListenerPtr> vl3;
cqAttr->getCqListeners(vl3);
ASSERT(vl3.size() == 2, "incorrect number of CqListeners count.");
MyCqStatusListener* myStatusCq2 =
- dynamic_cast<MyCqStatusListener*>(vl3[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl3[0].get());
myStatusCq2->clear();
for (int i = 1; i <= 5; i++) {
@@ -1147,17 +1147,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
}
LOGINFO("putEntries complete again");
- VectorOfCqListener vl21;
+ std::vector<CqListenerPtr> vl21;
vl21.push_back(cqStatusLstner);
vl21.push_back(cqLstner);
cqFac.initCqListeners(vl21);
LOGINFO("initCqListeners complete.");
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl2;
+ std::vector<CqListenerPtr> vl2;
cqAttr->getCqListeners(vl2);
ASSERT(vl2.size() == 2, "incorrect number of CqListeners count.");
- myStatusCq2 = dynamic_cast<MyCqStatusListener*>(vl2[0].ptr());
+ myStatusCq2 = dynamic_cast<MyCqStatusListener*>(vl2[0].get());
LOGINFO("No of insert events = %d ", myStatusCq2->getNumUpdates());
LOGINFO("No of OnCqConnected events = %d ",
myStatusCq2->getCqsConnectedCount());
@@ -1166,7 +1166,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
ASSERT(myStatusCq2->getCqsConnectedCount() == 0,
"incorrect number of CqStatus Connected count.");
- MyCqListener* myCq2 = dynamic_cast<MyCqListener*>(vl2[1].ptr());
+ MyCqListener* myCq2 = dynamic_cast<MyCqListener*>(vl2[1].get());
LOGINFO("No of insert events = %d ", myCq2->getNumInserts());
ASSERT(myCq2->getNumUpdates() == 5,
"incorrect number of CqStatus Updates count.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqDelta.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqDelta.cpp b/src/cppcache/integration-test/testThinClientCqDelta.cpp
index 2d91fc7..c591fd0 100644
--- a/src/cppcache/integration-test/testThinClientCqDelta.cpp
+++ b/src/cppcache/integration-test/testThinClientCqDelta.cpp
@@ -57,7 +57,7 @@ class CqDeltaListener : public CqListener {
m_deltaCount++;
}
DeltaTestImplPtr dptr =
- staticCast<DeltaTestImplPtr>(aCqEvent.getNewValue());
+ std::static_pointer_cast<GF_UNWRAP_SP(DeltaTestImplPtr)>(aCqEvent.getNewValue());
if (dptr->getIntVar() == 5) {
m_valueCount++;
}
@@ -107,7 +107,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.");
}
@@ -128,9 +128,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.");
}
const char* keys[] = {"Key-1", "Key-2", "Key-3", "Key-4"};
@@ -169,7 +169,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2)
QueryServicePtr qs;
qs = pool->getQueryService();
CqAttributesFactory cqFac;
- g_CqListener = new CqDeltaListener();
+ g_CqListener = std::make_shared<CqDeltaListener>();
CqListenerPtr cqListener = g_CqListener;
cqFac.addCqListener(cqListener);
CqAttributesPtr cqAttr = cqFac.create();
@@ -206,7 +206,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_NoPools)
QueryServicePtr qs;
qs = getHelper()->getQueryService();
CqAttributesFactory cqFac;
- g_CqListener = new CqDeltaListener();
+ g_CqListener = std::make_shared<CqDeltaListener>();
CqListenerPtr cqListener = g_CqListener;
cqFac.addCqListener(cqListener);
CqAttributesPtr cqAttr = cqFac.create();
@@ -220,7 +220,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1_Put)
{
CacheableKeyPtr keyPtr = createKey(keys[0]);
- DeltaTestImplPtr dptr(new DeltaTestImpl());
+ auto dptr = std::make_shared<DeltaTestImpl>();
CacheablePtr valPtr(dptr);
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/testThinClientCqDurable.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqDurable.cpp b/src/cppcache/integration-test/testThinClientCqDurable.cpp
index 862795a..143f90f 100644
--- a/src/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/src/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -84,8 +84,8 @@ class MyCqListener1 : public CqListener {
void onEvent(const CqEvent& cqe) {
m_cntEvents++;
char* opStr = (char*)"Default";
- CacheableInt32Ptr value(dynCast<CacheableInt32Ptr>(cqe.getNewValue()));
- CacheableInt32Ptr key(dynCast<CacheableInt32Ptr>(cqe.getKey()));
+ CacheableInt32Ptr value(std::dynamic_pointer_cast<CacheableInt32>(cqe.getNewValue()));
+ CacheableInt32Ptr key(std::dynamic_pointer_cast<CacheableInt32>(cqe.getKey()));
switch (cqe.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE: {
opStr = (char*)"CREATE";
@@ -202,7 +202,7 @@ void RunDurableCqClient() {
// Create CqAttributes and Install Listener
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener1());
+ auto cqLstner = std::make_shared<MyCqListener1>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -257,8 +257,7 @@ void RunFeederClient() {
LOGINFO("Created the Region Programmatically.");
for (int i = 0; i < 10; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
CacheableInt32Ptr valPtr = CacheableInt32::create(i);
regionPtr->put(keyPtr, valPtr);
@@ -290,8 +289,7 @@ void RunFeederClient1() {
LOGINFO("Created the Region Programmatically.");
for (int i = 10; i < 20; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
CacheableInt32Ptr valPtr = CacheableInt32::create(i);
regionPtr->put(keyPtr, valPtr);
@@ -366,13 +364,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -412,7 +410,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePortfolioData(regPtr0, 140, 30, 20);
qh->populatePositionData(subregPtr0, 140, 30);
- CacheablePtr port = NULLPTR;
+ CacheablePtr port = nullptr;
for (int i = 1; i < 140; i++) {
if (!m_isPdx) {
port = CacheablePtr(new Portfolio(i, 20));
@@ -456,7 +454,7 @@ void client1Up() {
qs = PoolManager::find(regionNamesCq[0])->getQueryService();
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -519,7 +517,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -531,10 +529,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
"CLIENT-1 StepFour: verifying getCq() behaviour for the invalid CQ "
"Name");
CqQueryPtr invalidCqptr = qs->getCq("InValidCQ");
- ASSERT(invalidCqptr == NULLPTR,
+ ASSERT(invalidCqptr == nullptr,
"Cqptr must be NULL, as it getCq() is invoked on invalid CQ name");
- /*if(invalidCqptr == NULLPTR){
- LOGINFO("Testing getCq(InvalidName) :: invalidCqptr is NULLPTR");
+ /*if(invalidCqptr == nullptr){
+ LOGINFO("Testing getCq(InvalidName) :: invalidCqptr is nullptr");
}else{
LOGINFO("Testing getCq(InvalidName) :: invalidCqptr is NOT NULL");
}*/
@@ -665,7 +663,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterCqs1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -692,7 +690,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterCqsAfterClientup1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -719,7 +717,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, RegisterCqs2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -746,7 +744,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, RegisterCqsAfterClientup2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -773,7 +771,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyCqs1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -781,7 +779,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyCqs1)
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 2,
"Durable CQ List lenght should be 2");
ASSERT(isDurableCQName(durableCqListPtr->at(0)->toString()->asChar(), 1,
@@ -797,14 +795,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyCqsAfterClientup1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 4,
"Durable CQ List length should be 4");
ASSERT(
@@ -826,13 +824,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyCqs2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 4,
"Durable CQ List lenght should be 4");
ASSERT(isDurableCQName(durableCqListPtr->at(0)->toString()->asChar(), 2,
@@ -854,13 +852,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyCqsAfterClientup2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 8,
"Durable CQ List lenght should be 8");
ASSERT(
@@ -893,14 +891,14 @@ END_TASK_DEFINITION
void verifyEmptyDurableCQList() {
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr == NULLPTR, "Durable CQ List should be null");
+ ASSERT(durableCqListPtr == nullptr, "Durable CQ List should be null");
}
DUNIT_TASK_DEFINITION(CLIENT1, VerifyEmptyDurableCQList1)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqFailover.cpp b/src/cppcache/integration-test/testThinClientCqFailover.cpp
index eb6b252..5b42786 100644
--- a/src/cppcache/integration-test/testThinClientCqFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientCqFailover.cpp
@@ -198,14 +198,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -244,7 +244,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree2)
qh->populatePortfolioData(regPtr0, 150, 40, 150);
qh->populatePositionData(subregPtr0, 150, 40);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 150));
+ auto port = std::make_shared<Portfolio>(i, 150);
CacheableKeyPtr keyport = CacheableKey::create((char*)"port1-1");
regPtr0->put(keyport, port);
@@ -258,21 +258,21 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
{
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
- CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
- CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ auto qry = qs->getCq(cqName);
+ ASSERT(qry != nullptr, "failed to get CqQuery");
+ auto cqAttr = qry->getCqAttributes();
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -281,8 +281,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ auto myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
kst = new KillServerThread(myListener);
char buf[1024];
@@ -302,7 +302,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
RegionPtr subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
for(int i=1; i < 1500; i++)
{
- CacheablePtr port(new Portfolio(i, 15));
+ auto port = std::make_shared<Portfolio>(i, 15);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
try {
@@ -324,17 +324,17 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, StepThree4)
{
- RegionPtr regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- RegionPtr subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
+ auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
+ auto subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
- QueryHelper* qh = &QueryHelper::getHelper();
+ auto qh = &QueryHelper::getHelper();
qh->populatePortfolioData(regPtr0, 10, 40, 10);
qh->populatePositionData(subregPtr0, 10, 4);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 10));
+ auto port = std::make_shared<Portfolio>(i, 10);
- CacheableKeyPtr keyport = CacheableKey::create("port1-1");
+ auto keyport = CacheableKey::create("port1-1");
regPtr0->put(keyport, port);
SLEEP(100); // sleep a while to allow server query to complete
}
@@ -345,21 +345,21 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
{
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
- CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
- CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ auto qry = qs->getCq(cqName);
+ ASSERT(qry != nullptr, "failed to get CqQuery");
+ auto cqAttr = qry->getCqAttributes();
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -368,8 +368,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ auto myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
char buf[1024];
sprintf(buf, "after failed over: before=%d, after=%d",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqHAFailover.cpp b/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
index 1b9fbda..914eafb 100644
--- a/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
@@ -199,13 +199,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -224,22 +224,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
while (iter.hasNext()) {
count--;
SerializablePtr ser = iter.next();
- PortfolioPtr portfolio(dynamic_cast<Portfolio*>(ser.ptr()));
- PositionPtr position(dynamic_cast<Position*>(ser.ptr()));
+ PortfolioPtr portfolio(dynamic_cast<Portfolio*>(ser.get()));
+ PositionPtr position(dynamic_cast<Position*>(ser.get()));
- if (portfolio != NULLPTR) {
+ if (portfolio != nullptr) {
printf(" query pulled portfolio object ID %d, pkid %s\n",
portfolio->getID(), portfolio->getPkid()->asChar());
}
- else if (position != NULLPTR) {
+ else if (position != nullptr) {
printf(" query pulled position object secId %s, shares %d\n",
position->getSecId()->asChar(),
position->getSharesOutstanding());
}
else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
} else {
printf(" query pulled bad object\n");
@@ -280,7 +280,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree2)
qh->populatePortfolioData(regPtr0, 150, 40, 10);
qh->populatePositionData(subregPtr0, 150, 40);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 20));
+ auto port = std::make_shared<Portfolio>(i, 20);
CacheableKeyPtr keyport = CacheableKey::create((char*)"port1-1");
regPtr0->put(keyport, port);
@@ -297,18 +297,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
// using region name as pool name
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
+ ASSERT(qry != nullptr, "failed to get CqQuery");
CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -317,8 +317,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
kst = new KillServerThread(myListener);
char buf[1024];
@@ -338,7 +338,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
RegionPtr subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
for(int i=1; i < 150; i++)
{
- CacheablePtr port(new Portfolio(i, 20));
+ auto port = std::make_shared<Portfolio>(i, 20);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
try {
@@ -367,7 +367,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree4)
qh->populatePortfolioData(regPtr0, 150, 40, 10);
qh->populatePositionData(subregPtr0, 150, 40);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 20));
+ auto port = std::make_shared<Portfolio>(i, 20);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
regPtr0->put(keyport, port);
@@ -384,18 +384,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
// using region name as pool name
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
+ ASSERT(qry != nullptr, "failed to get CqQuery");
CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -404,8 +404,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
char buf[1024];
sprintf(buf, "after failed over: before=%d, after=%d",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqIR.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqIR.cpp b/src/cppcache/integration-test/testThinClientCqIR.cpp
index fbfc91b..90a8b01 100644
--- a/src/cppcache/integration-test/testThinClientCqIR.cpp
+++ b/src/cppcache/integration-test/testThinClientCqIR.cpp
@@ -137,7 +137,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, PutData)
qh->populatePortfolioPdxData(regPtr0, 150, 40, 150);
qh->populatePositionPdxData(subregPtr0, 150, 40);
- CacheablePtr port = NULLPTR;
+ CacheablePtr port = nullptr;
for (int i = 1; i < 150; i++) {
port = CacheablePtr(new PortfolioPdx(i, 150));
@@ -153,40 +153,31 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
{
- QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
+ auto& qh ATTR_UNUSED = QueryHelper::getHelper();
// using region name as pool name
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
- CqAttributesFactory cqFac;
- // CqListenerPtr cqLstner(new MyCqListener());
- // cqFac.addCqListener(cqLstner);
- CqAttributesPtr cqAttr = cqFac.create();
+ auto cqAttr = CqAttributesFactory().create();
// char* qryStr = (char*)"select * from /Portfolios p where p.ID != 2";
// qry->execute();
- const char* qryStr = "select * from /Portfolios where ID != 2";
- // const char* qryStr = "select * from /Portfolios p where p.ID < 3";
- // this will cause exception since distinct is not supported:
- // const char* qryStr = "select distinct * from /Portfolios where ID != 2";
- CqQueryPtr qry = qs->newCq(cqName, qryStr, cqAttr);
- // QueryPtr qry = qs->newQuery(qryStr);
+ auto qryStr = "select * from /Portfolios where ID != 2";
+ auto qry = qs->newCq(cqName, qryStr, cqAttr);
- CqResultsPtr results;
try {
LOG("before executing executeWithInitialResults.");
- results = qry->executeWithInitialResults();
+ auto results = qry->executeWithInitialResults();
LOG("before executing executeWithInitialResults done.");
- // results = qry->execute();
- SelectResultsIterator iter = results->getIterator();
+ auto iter = results->getIterator();
char buf[100];
int count = results->size();
sprintf(buf, "results size=%d", count);
@@ -194,41 +185,27 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
ASSERT(count > 0, "count should be > 0");
while (iter.hasNext()) {
count--;
- SerializablePtr ser = iter.next();
- /*PortfolioPtr portfolio( dynamic_cast<Portfolio*> (ser.ptr() ));
- PositionPtr position(dynamic_cast<Position*> (ser.ptr() ));
-
- if (portfolio != NULLPTR) {
- printf(" query pulled portfolio object ID %d, pkid %s\n",
- portfolio->getID(), portfolio->getPkid()->asChar());
- }
+ auto ser = iter.next();
- else if (position != NULLPTR) {
- printf(" query pulled position object secId %s, shares %d\n",
- position->getSecId()->asChar(), position->getSharesOutstanding());
- }
- */
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
- StructPtr stPtr(dynamic_cast<Struct*>(ser.ptr()));
-
- ASSERT(stPtr != NULLPTR, "Failed to get struct in CQ result.");
+ auto stPtr = std::dynamic_pointer_cast<Struct>(ser);
+ ASSERT(stPtr != nullptr, "Failed to get struct in CQ result.");
- if (stPtr != NULLPTR) {
+ if (stPtr != nullptr) {
LOG(" got struct ptr ");
- SerializablePtr serKey = (*(stPtr.ptr()))["key"];
- ASSERT(serKey != NULLPTR, "Failed to get KEY in CQ result.");
- if (serKey != NULLPTR) {
+ auto serKey = (*stPtr)["key"];
+ ASSERT(serKey != nullptr, "Failed to get KEY in CQ result.");
+ if (serKey != nullptr) {
LOG("got struct key ");
printf(" got struct key %s\n", serKey->toString()->asChar());
}
- SerializablePtr serVal = (*(stPtr.ptr()))["value"];
+ auto serVal = (*stPtr)["value"];
+ ASSERT(serVal != nullptr, "Failed to get VALUE in CQ result.");
- ASSERT(serVal != NULLPTR, "Failed to get VALUE in CQ result.");
-
- if (serVal != NULLPTR) {
+ if (serVal != nullptr) {
LOG("got struct value ");
printf(" got struct value %s\n", serVal->toString()->asChar());
}
@@ -246,7 +223,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
results = qry->executeWithInitialResults();
LOG("before executing executeWithInitialResults2 done.");
- SelectResultsIterator iter2 = results->getIterator();
+ auto iter2 = results->getIterator();
count = results->size();
sprintf(buf, "results2 size=%d", count);
@@ -254,29 +231,27 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
ASSERT(count > 0, "count should be > 0");
while (iter2.hasNext()) {
count--;
- SerializablePtr ser = iter2.next();
+ auto ser = iter2.next();
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
- StructPtr stPtr(dynamic_cast<Struct*>(ser.ptr()));
-
- ASSERT(stPtr != NULLPTR, "Failed to get struct in CQ result.");
+ auto stPtr = std::dynamic_pointer_cast<Struct>(ser);
+ ASSERT(stPtr != nullptr, "Failed to get struct in CQ result.");
- if (stPtr != NULLPTR) {
+ if (stPtr != nullptr) {
LOG(" got struct ptr ");
- SerializablePtr serKey = (*(stPtr.ptr()))["key"];
- ASSERT(serKey != NULLPTR, "Failed to get KEY in CQ result.");
- if (serKey != NULLPTR) {
+ auto serKey = (*stPtr)["key"];
+ ASSERT(serKey != nullptr, "Failed to get KEY in CQ result.");
+ if (serKey != nullptr) {
LOG("got struct key ");
printf(" got struct key %s\n", serKey->toString()->asChar());
}
- SerializablePtr serVal = (*(stPtr.ptr()))["value"];
-
- ASSERT(serVal != NULLPTR, "Failed to get VALUE in CQ result.");
+ auto serVal = (*stPtr)["value"];
+ ASSERT(serVal != nullptr, "Failed to get VALUE in CQ result.");
- if (serVal != NULLPTR) {
+ if (serVal != nullptr) {
LOG("got struct value ");
printf(" got struct value %s\n", serVal->toString()->asChar());
}
@@ -288,12 +263,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
sprintf(buf, "results last count=%d", count);
LOG(buf);
- RegionPtr regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- regPtr0->destroyRegion();
+ {
+ auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
+ regPtr0->destroyRegion();
+ }
SLEEP(20000);
qry = qs->getCq(cqName);
sprintf(buf, "cq[%s] should have been removed after close!", cqName);
- ASSERT(qry == NULLPTR, buf);
+ ASSERT(qry == nullptr, buf);
} catch (const Exception& excp) {
std::string logmsg = "";
logmsg += excp.getName();
@@ -313,10 +290,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckRegionDestroy)
LOG("check region destory");
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- if (regPtr0 == NULLPTR) {
- LOG("regPtr0==NULLPTR");
+ if (regPtr0 == nullptr) {
+ LOG("regPtr0==nullptr");
} else {
- LOG("regPtr0!=NULLPTR");
+ LOG("regPtr0!=nullptr");
ASSERT(regPtr0->isDestroyed(), "should have been distroyed");
}
} catch (...) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp b/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
index c3c30df..de9b3d3 100644
--- a/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
+++ b/src/cppcache/integration-test/testThinClientDeltaWithNotification.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.");
}
@@ -224,7 +224,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1_Put)
{
CacheableKeyPtr keyPtr = createKey(keys[0]);
DeltaEx* ptr = new DeltaEx();
- 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/testThinClientDisconnectionListioner.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp b/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
index 3a9154a..7a3e94c 100644
--- a/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
+++ b/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
@@ -39,7 +39,7 @@ class DisconnectCacheListioner : public CacheListener {
isDisconnected = true;
}
};
-CacheListenerPtr cptr(new DisconnectCacheListioner());
+auto cptr = std::make_shared<DisconnectCacheListioner>();
#include "LocatorHelper.hpp"
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp b/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
index 73ced17..1e6c45e 100644
--- a/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
+++ b/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
@@ -73,17 +73,16 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
try {
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ auto result = std::dynamic_pointer_cast<CacheableArrayList>(resultItem);
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
} catch (ClassCastException) {
- UserFunctionExecutionExceptionPtr result =
- dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
+ auto result = std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
m_resultList->push_back(result);
}
}
@@ -129,10 +128,10 @@ class MyResultCollector2 : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
- CacheableBooleanPtr result = dynCast<CacheableBooleanPtr>(resultItem);
+ auto result = std::dynamic_pointer_cast<CacheableBoolean>(resultItem);
m_resultList->push_back(result);
}
void endResults() {
@@ -178,7 +177,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
-1, -1, 60000, /*singlehop*/ true,
/*threadLocal*/ true);
@@ -211,13 +210,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
}
LOGINFO("routingObj size = %d ", routingObj->size());
ExecutionPtr exe = FunctionService::onRegion(regPtr0);
- ASSERT(exe != NULLPTR, "onRegion Returned NULL");
+ ASSERT(exe != nullptr, "onRegion Returned NULL");
CacheableVectorPtr resultList = CacheableVector::create();
LOG("Executing getFuncName function");
CacheableVectorPtr executeFunctionResult =
exe->withFilter(routingObj)->execute(getFuncName, 15)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "executeFunctionResult is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult->size());
@@ -226,7 +225,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0;
pos < static_cast<uint32_t>(arrayList->size()); pos++) {
@@ -239,15 +238,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"get executeFunctionResult count is not 40");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
+ ASSERT(resultList->operator[](i) != nullptr, buf);
sprintf(buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))
->asChar());
LOGINFO(buf);
}
}
LOGINFO("getFuncName done");
- MyResultCollectorPtr myRC(new MyResultCollector());
+ auto myRC = std::make_shared<MyResultCollector>();
CacheableVectorPtr executeFunctionResult1 =
exe->withFilter(routingObj)
->withCollector(myRC)
@@ -259,7 +258,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(4 == myRC->getAddResultCount(), "add result count is not 4");
ASSERT(1 == myRC->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "region get new collector: result is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult->size());
@@ -268,7 +267,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0;
pos < static_cast<uint32_t>(arrayList->size()); pos++) {
@@ -281,9 +280,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"get executeFunctionResult count is not 40");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
+ ASSERT(resultList->operator[](i) != nullptr, buf);
sprintf(buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))
->asChar());
LOGINFO(buf);
}
@@ -292,7 +291,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
CacheableVectorPtr executeFunctionResult2 =
exe->withFilter(routingObj)->execute(FEOnRegionPrSHOP)->getResult();
- if (executeFunctionResult2 == NULLPTR) {
+ if (executeFunctionResult2 == nullptr) {
ASSERT(false, "executeFunctionResult2 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult2->size());
@@ -300,7 +299,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult2->size(),
"executeFunctionResult2 size is not 2");
for (int i = 0; i < executeFunctionResult2->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult2->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -324,7 +323,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == myRC2->getAddResultCount(), "add result count is not 2");
ASSERT(1 == myRC2->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC2->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult21 == NULLPTR) {
+ if (executeFunctionResult21 == nullptr) {
ASSERT(false, "executeFunctionResult21 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult21->size());
@@ -332,7 +331,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult21->size(),
"executeFunctionResult21 size is not 2");
for (int i = 0; i < executeFunctionResult21->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult21->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -348,7 +347,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
exe->withFilter(routingObj)
->execute(FEOnRegionPrSHOP_OptimizeForWrite)
->getResult();
- if (executeFunctionResult3 == NULLPTR) {
+ if (executeFunctionResult3 == nullptr) {
ASSERT(false, "executeFunctionResult3 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult3->size());
@@ -356,7 +355,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == executeFunctionResult3->size(),
"executeFunctionResult3->size() is not 3");
for (int i = 0; i < executeFunctionResult3->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult3->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -379,7 +378,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == myRC3->getAddResultCount(), "add result count is not 3");
ASSERT(1 == myRC3->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC3->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult31 == NULLPTR) {
+ if (executeFunctionResult31 == nullptr) {
ASSERT(false, "executeFunctionResult31 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult31->size());
@@ -387,7 +386,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == executeFunctionResult31->size(),
"executeFunctionResult31->size() is not 3");
for (int i = 0; i < executeFunctionResult31->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult31->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -400,11 +399,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
}
ExecutionPtr exc = FunctionService::onRegion(regPtr0);
- ASSERT(exc != NULLPTR, "onRegion Returned NULL");
+ ASSERT(exc != nullptr, "onRegion Returned NULL");
// Now w/o filter, chk for singlehop
CacheableVectorPtr executeFunctionResult2 =
exc->execute(FEOnRegionPrSHOP)->getResult();
- if (executeFunctionResult2 == NULLPTR) {
+ if (executeFunctionResult2 == nullptr) {
ASSERT(false, "executeFunctionResult2 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult2->size());
@@ -412,7 +411,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult2->size(),
"executeFunctionResult2 size is not 2");
for (int i = 0; i < executeFunctionResult2->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult2->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -437,7 +436,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"end result count is not 1");
ASSERT(1 == resultCollector->getGetResultCount(),
"get result count is not 1");
- if (executeFunctionResult21 == NULLPTR) {
+ if (executeFunctionResult21 == nullptr) {
ASSERT(false, "executeFunctionResult21 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult21->size());
@@ -445,7 +444,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult21->size(),
"executeFunctionResult21 size is not 2");
for (int i = 0; i < executeFunctionResult21->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult21->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -466,7 +465,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == rC->getAddResultCount(), "add result count is not 3");
ASSERT(1 == rC->getEndResultCount(), "end result count is not 1");
ASSERT(1 == rC->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult31 == NULLPTR) {
+ if (executeFunctionResult31 == nullptr) {
ASSERT(false, "executeFunctionResult31 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult31->size());
@@ -474,7 +473,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == executeFunctionResult31->size(),
"executeFunctionResult31->size() is not 3");
for (int i = 0; i < executeFunctionResult31->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult31->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -488,14 +487,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
// Now w/o filter chk for singleHop
CacheableVectorPtr functionResult =
exc->execute(FEOnRegionPrSHOP_OptimizeForWrite)->getResult();
- if (functionResult == NULLPTR) {
+ if (functionResult == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", functionResult->size());
LOG(buf);
ASSERT(3 == functionResult->size(), "FunctionResult->size() is not 3");
for (int i = 0; i < functionResult->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(functionResult->operator[](i))
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(functionResult->operator[](i))
->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
@@ -527,8 +526,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"arrList "
"arguement done.");
for (int i = 0; i < fil->size(); i++) {
- CacheableStringPtr str = fil->at(i);
- CacheableStringPtr val = dynCast<CacheableStringPtr>(regPtr0->get(str));
+ auto str = std::dynamic_pointer_cast<CacheableString>(fil->at(i));
+ auto val = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(str));
LOGINFO("Filter Key = %s , get Value = %s ", str->asChar(),
val->asChar());
if (strcmp(str->asChar(), val->asChar()) != 0) {
@@ -550,8 +549,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"arguement done.");
SLEEP(4000);
for (int i = 0; i < arrList->size(); i++) {
- CacheableStringPtr str = arrList->at(i);
- CacheableStringPtr val = dynCast<CacheableStringPtr>(regPtr0->get(str));
+ auto str = std::dynamic_pointer_cast<CacheableString>(arrList->at(i));
+ auto val = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(str));
LOGINFO("Filter Key = %s ", str->asChar());
LOGINFO("get Value = %s ", val->asChar());
if (strcmp(str->asChar(), val->asChar()) != 0) {
@@ -566,14 +565,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
->execute(FETimeOut, 5000)
->getResult();
- if (fe == NULLPTR) {
+ if (fe == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", fe->size());
LOG(buf);
ASSERT(2 == fe->size(), "FunctionResult->size() is not 2");
for (int i = 0; i < fe->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(fe->operator[](i))->value();
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(fe->operator[](i))->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp b/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
index b274898..bfede81 100644
--- a/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
+++ b/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
@@ -73,7 +73,7 @@ class CustomFixedPartitionResolver1 : public FixedPartitionResolver {
}
}
};
-FixedPartitionResolverPtr cptr1(new CustomFixedPartitionResolver1());
+auto cptr1 = std::make_shared<CustomFixedPartitionResolver1>();
class CustomFixedPartitionResolver2 : public FixedPartitionResolver {
public:
@@ -112,7 +112,7 @@ class CustomFixedPartitionResolver2 : public FixedPartitionResolver {
}
}
};
-FixedPartitionResolverPtr cptr2(new CustomFixedPartitionResolver2());
+auto cptr2 = std::make_shared<CustomFixedPartitionResolver2>();
class CustomFixedPartitionResolver3 : public FixedPartitionResolver {
public:
@@ -145,7 +145,7 @@ class CustomFixedPartitionResolver3 : public FixedPartitionResolver {
}
}
};
-FixedPartitionResolverPtr cptr3(new CustomFixedPartitionResolver3());
+auto cptr3 = std::make_shared<CustomFixedPartitionResolver3>();
#define CLIENT1 s1p1
#define SERVER1 s2p1
@@ -231,8 +231,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
RegionPtr dataReg = getHelper()->getRegion(partitionRegionName);
for (int i = 0; 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,
@@ -278,8 +277,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
LOG("CheckPrSingleHopForIntKeysTask_REGION 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,
@@ -326,8 +324,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
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);
@@ -405,8 +403,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
LOG("CheckPrSingleHopForIntKeysTask_REGION 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 {
LOGDEBUG("CPPTEST: destroying key %d with hashcode %d", i,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientGetInterests.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientGetInterests.cpp b/src/cppcache/integration-test/testThinClientGetInterests.cpp
index 51c8558..d227dbb 100644
--- a/src/cppcache/integration-test/testThinClientGetInterests.cpp
+++ b/src/cppcache/integration-test/testThinClientGetInterests.cpp
@@ -55,11 +55,11 @@ DUNIT_TASK(CLIENT1, SetupClient1)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
VectorOfCacheableKey keys0;
keys0.push_back(keyPtr0);
- regPtr0->registerKeys(keys0, NULLPTR);
+ regPtr0->registerKeys(keys0);
CacheableKeyPtr keyPtr1 = CacheableString::create(keys[1]);
VectorOfCacheableKey keys1;
keys1.push_back(keyPtr1);
- regPtr0->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys1);
regPtr0->registerRegex(testregex[0]);
regPtr0->registerRegex(testregex[1]);
CacheableKeyPtr keyPtr2 = CacheableString::create(keys[2]);
@@ -68,7 +68,7 @@ DUNIT_TASK(CLIENT1, SetupClient1)
keyPtr2 = CacheableString::create(keys[3]);
keys2.push_back(keyPtr2);
// durable
- regPtr0->registerKeys(keys2, NULLPTR, true);
+ regPtr0->registerKeys(keys2, false, true);
regPtr0->registerRegex(testregex[2], true);
VectorOfCacheableKey vkey;
@@ -77,7 +77,7 @@ DUNIT_TASK(CLIENT1, SetupClient1)
regPtr0->getInterestListRegex(vreg);
for (int32_t i = 0; i < vkey.length(); i++) {
char buf[1024];
- const char* key = dynCast<CacheableStringPtr>(vkey[i])->asChar();
+ const char* key = std::dynamic_pointer_cast<CacheableString>(vkey[i])->asChar();
sprintf(buf, "key[%d]=%s", i, key);
LOG(buf);
bool found = false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHADistOps.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHADistOps.cpp b/src/cppcache/integration-test/testThinClientHADistOps.cpp
index e592c7d..316df4c 100644
--- a/src/cppcache/integration-test/testThinClientHADistOps.cpp
+++ b/src/cppcache/integration-test/testThinClientHADistOps.cpp
@@ -106,7 +106,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);
@@ -144,10 +144,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);
@@ -202,7 +201,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.");
@@ -220,8 +219,8 @@ void createRegion(const char* name, bool ackMode,
fflush(stdout);
char* endpoints = NULL;
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.");
}
@@ -236,7 +235,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
poolname, locators, NULL, reduendency, clientNotificationEnabled);
RegionPtr regPtr = getHelper()->createRegionAndAttachPool(
name, ackMode, poolname, cachingEnable);
- 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) {
@@ -249,7 +248,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.");
@@ -274,7 +273,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),
@@ -299,12 +298,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",
@@ -331,7 +329,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),
@@ -340,10 +338,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",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp b/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
index 449a95a..43d2a92 100644
--- a/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
+++ b/src/cppcache/integration-test/testThinClientHAEventIDMap.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");
}
}
@@ -138,7 +138,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);
@@ -188,10 +188,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);
@@ -229,7 +228,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);
@@ -279,10 +278,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);
@@ -340,8 +338,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.");
}
@@ -355,7 +353,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.");
@@ -380,7 +378,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." );
@@ -452,8 +450,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitClient2)
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/testThinClientHAFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAFailover.cpp b/src/cppcache/integration-test/testThinClientHAFailover.cpp
index 265ed5b..6ed19ac 100644
--- a/src/cppcache/integration-test/testThinClientHAFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientHAFailover.cpp
@@ -107,7 +107,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);
@@ -157,10 +157,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);
@@ -206,8 +205,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.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -220,7 +219,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.");
@@ -245,7 +244,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
@@ -271,17 +270,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",