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/06/06 17:56:43 UTC
[17/23] geode-native git commit: GEODE-2741: Code cleanup to move to
std::shared_ptr
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp b/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
index 1fbaf57..ddbfa50 100644
--- a/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
+++ b/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
@@ -31,7 +31,7 @@ using namespace test;
bool isLocalServer = false;
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
volatile int g_redundancyLevel = 0;
#define CLIENT1 s1p1
@@ -45,21 +45,21 @@ const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, numberOfLocators);
void initClient() {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
@@ -94,7 +94,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
if (noKey == false) { // need to find the key!
ASSERT(regPtr->containsKey(keyPtr), "Key not found in region.");
}
- if (val != NULL) { // need to have a value!
+ if (val != nullptr) { // need to have a value!
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value not found in
// region." );
}
@@ -125,7 +125,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
ASSERT(containsKeyCnt < MAX, "Key found in region.");
}
- if (val == NULL) {
+ if (val == nullptr) {
if (regPtr->containsValueForKey(keyPtr)) {
containsValueCnt++;
} else {
@@ -134,8 +134,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
ASSERT(containsValueCnt < MAX, "Value found in region.");
}
- if (val != NULL) {
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ if (val != nullptr) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
@@ -171,7 +172,7 @@ void _verifyCreated(const char* name, const char* key, int line) {
char logmsg[1024];
sprintf(logmsg, "verifyCreated() called from %d.\n", line);
LOG(logmsg);
- _verifyEntry(name, key, NULL, false, true);
+ _verifyEntry(name, key, nullptr, false, true);
LOG("Entry created.");
}
@@ -255,7 +256,8 @@ void doNetsearch(const char* name, const char* key, const char* value) {
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
if (checkPtr != nullptr) {
LOG("checkPtr is not null");
@@ -264,7 +266,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
checkPtr->asChar(), key);
LOG(buf);
} else {
- LOG("checkPtr is NULL");
+ LOG("checkPtr is nullptr");
}
verifyEntry(name, key, value);
LOG("Netsearch complete.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp b/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
index 3f7e36b..7fd15ee 100644
--- a/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
+++ b/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
@@ -31,7 +31,7 @@ using namespace test;
bool isLocalServer = false;
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
#define CLIENT1 s1p1
#define CLIENT2 s1p2
@@ -44,27 +44,27 @@ const char* locatorsG =
bool g_poolConfig = false;
bool g_poolLocators = false;
void initClient(int redundancyLevel) {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(redundancyLevel);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void initClient() {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
@@ -99,7 +99,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
if (noKey == false) { // need to find the key!
ASSERT(regPtr->containsKey(keyPtr), "Key not found in region.");
}
- if (val != NULL) { // need to have a value!
+ if (val != nullptr) { // need to have a value!
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value not found in
// region." );
}
@@ -130,7 +130,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
ASSERT(containsKeyCnt < MAX, "Key found in region.");
}
- if (val == NULL) {
+ if (val == nullptr) {
if (regPtr->containsValueForKey(keyPtr)) {
containsValueCnt++;
} else {
@@ -139,8 +139,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
ASSERT(containsValueCnt < MAX, "Value found in region.");
}
- if (val != NULL) {
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ if (val != nullptr) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
@@ -176,7 +177,7 @@ void _verifyCreated(const char* name, const char* key, int line) {
char logmsg[1024];
sprintf(logmsg, "verifyCreated() called from %d.\n", line);
LOG(logmsg);
- _verifyEntry(name, key, NULL, false, true);
+ _verifyEntry(name, key, nullptr, false, true);
LOG("Entry created.");
}
@@ -185,7 +186,7 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- char* endpoints = NULL;
+ char* endpoints = nullptr;
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
@@ -261,7 +262,8 @@ void doNetsearch(const char* name, const char* key, const char* value) {
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
if (checkPtr != nullptr) {
LOG("checkPtr is not null");
@@ -270,7 +272,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
checkPtr->asChar(), key);
LOG(buf);
} else {
- LOG("checkPtr is NULL");
+ LOG("checkPtr is nullptr");
}
verifyEntry(name, key, value);
LOG("Netsearch complete.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp b/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
index 103fbac..f2960fd 100644
--- a/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
+++ b/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
@@ -39,15 +39,15 @@ class DupChecker : public CacheListener {
CacheableKeyPtr key = event.getKey();
auto value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
- HashMapOfCacheable::Iterator item = m_map.find(key);
+ const auto& item = m_map.find(key);
if (item != m_map.end()) {
- auto check = std::dynamic_pointer_cast<CacheableInt32>(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);
+ m_map[key] = value;
} else {
- m_map.insert(key, value);
+ m_map.emplace(key, value);
}
}
@@ -60,9 +60,8 @@ class DupChecker : public CacheListener {
ASSERT(m_map.size() == 4, "Expected 4 keys for the region");
ASSERT(m_ops == 400, "Expected 400 events (100 per key) for the region");
- for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
- item++) {
- auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second());
+ for (const auto& item : m_map) {
+ auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second);
ASSERT(check->value() == 100, "Expected final value to be 100");
}
}
@@ -84,7 +83,7 @@ typedef SharedPtr<DupChecker> DupCheckerPtr;
#define SERVER1 s2p1
#define SERVER2 s2p2
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
static bool isLocator = false;
static bool isLocalServer = false;
static int numberOfLocators = 1;
@@ -99,7 +98,7 @@ void initClient(int redundancyLevel) {
props->insert("notify-ack-interval", 1);
props->insert("notify-dupcheck-life", 30);
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(redundancyLevel, props);
}
g_redundancyLevel = redundancyLevel;
@@ -111,21 +110,21 @@ void initClient() {
props->insert("notify-ack-interval", 1);
props->insert("notify-dupcheck-life", 30);
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(true, props);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
@@ -160,7 +159,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
if (noKey == false) { // need to find the key!
ASSERT(regPtr->containsKey(keyPtr), "Key not found in region.");
}
- if (val != NULL) { // need to have a value!
+ if (val != nullptr) { // need to have a value!
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value not found in
// region." );
}
@@ -191,7 +190,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
ASSERT(containsKeyCnt < MAX, "Key found in region.");
}
- if (val == NULL) {
+ if (val == nullptr) {
if (regPtr->containsValueForKey(keyPtr)) {
containsValueCnt++;
} else {
@@ -200,8 +199,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
ASSERT(containsValueCnt < MAX, "Value found in region.");
}
- if (val != NULL) {
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ if (val != nullptr) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
@@ -291,7 +291,8 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
}
if (val != 0) {
- auto checkPtr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
@@ -339,7 +340,7 @@ void _verifyCreated(const char* name, const char* key, int line) {
char logmsg[1024];
sprintf(logmsg, "verifyCreated() called from %d.\n", line);
LOG(logmsg);
- _verifyEntry(name, key, NULL, false, true);
+ _verifyEntry(name, key, nullptr, false, true);
LOG("Entry created.");
}
@@ -348,7 +349,7 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- char* endpoints = NULL;
+ char* endpoints = nullptr;
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
index b1ac86f..9f71ab5 100644
--- a/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
@@ -45,7 +45,7 @@ using namespace testobject;
#define SERVER1 s2p1
#define SERVER2 s2p2
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
static bool isLocalServer = false;
static bool isLocator = false;
static int numberOfLocators = 1;
@@ -84,7 +84,7 @@ void initClient() {
} catch (const IllegalStateException&) {
// ignore reregistration exception
}
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
@@ -96,7 +96,7 @@ void initClient( const bool isthinClient )
Serializable::registerType( Portfolio::createDeserializable);
Serializable::registerType( Position::createDeserializable);
- if ( cacheHelper == NULL ) {
+ if ( cacheHelper == nullptr ) {
cacheHelper = new CacheHelper(isthinClient);
}
ASSERT( cacheHelper, "Failed to create a CacheHelper client instance." );
@@ -104,14 +104,14 @@ void initClient( const bool isthinClient )
*/
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
@@ -120,7 +120,7 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- char* endpoints = NULL;
+ char* endpoints = nullptr;
RegionPtr regPtr = getHelper()->createRegion(
name, ackMode, false, nullptr, endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -132,7 +132,7 @@ const char* regionNames[] = {"Portfolios", "Positions"};
const bool USE_ACK = true;
const bool NO_ACK ATTR_UNUSED = false;
-KillServerThread* kst = NULL;
+KillServerThread* kst = nullptr;
void initClientAndRegion(int redundancy) {
// PropertiesPtr pp = Properties::create();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientHeapLRU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHeapLRU.cpp b/src/cppcache/integration-test/testThinClientHeapLRU.cpp
index d14f882..d2f2343 100644
--- a/src/cppcache/integration-test/testThinClientHeapLRU.cpp
+++ b/src/cppcache/integration-test/testThinClientHeapLRU.cpp
@@ -49,10 +49,13 @@ 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(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
- tmpval->getCacheable());
+ ASSERT(tmpkey->getCacheable() != nullptr,
+ "tmpkey->getCacheable() is nullptr");
+ ASSERT(tmpval->getCacheable() != nullptr,
+ "tmpval->getCacheable() is nullptr");
+ dataReg->put(
+ std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
+ tmpval->getCacheable());
// delete tmpkey;
// delete tmpval;
}
@@ -61,7 +64,7 @@ void createOnekEntries() {
dataReg->entries(me, false);
LOG("Verifying size outside loop");
char buf[1024];
- sprintf(buf, "region size is %d", me.size());
+ sprintf(buf, "region size is %zd", me.size());
LOG(buf);
ASSERT(me.size() <= 1024, "Should have evicted anything over 1024 entries");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp b/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
index 8a8af97..f25c5c8 100644
--- a/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
+++ b/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
@@ -32,27 +32,27 @@ using namespace test;
#define CLIENT2 s1p2
#define SERVER1 s2p1
-CacheHelper *cacheHelper = NULL;
+CacheHelper *cacheHelper = nullptr;
#include "locator_globals.hpp"
#include "LocatorHelper.hpp"
void initClient(const bool isthinClient) {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(isthinClient, "__TEST_POOL1__", locatorsG,
"ServerGroup1", nullptr, 0, true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper *getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
@@ -87,7 +87,7 @@ void _verifyEntry(const char *name, const char *key, const char *val,
if (noKey == false) { // need to find the key!
ASSERT(regPtr->containsKey(keyPtr), "Key not found in region.");
}
- if (val != NULL) { // need to have a value!
+ if (val != nullptr) { // need to have a value!
ASSERT(regPtr->containsValueForKey(keyPtr), "Value not found in region.");
}
}
@@ -117,7 +117,7 @@ void _verifyEntry(const char *name, const char *key, const char *val,
}
ASSERT(containsKeyCnt < MAX, "Key found in region.");
}
- if (val == NULL) {
+ if (val == nullptr) {
if (regPtr->containsValueForKey(keyPtr)) {
containsValueCnt++;
} else {
@@ -126,8 +126,9 @@ void _verifyEntry(const char *name, const char *key, const char *val,
ASSERT(containsValueCnt < MAX, "Value found in region.");
}
- if (val != NULL) {
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ if (val != nullptr) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
@@ -183,7 +184,7 @@ void _verifyCreated(const char *name, const char *key, int line) {
char logmsg[1024];
sprintf(logmsg, "verifyCreated() called from %d.\n", line);
LOG(logmsg);
- _verifyEntry(name, key, NULL, false, true);
+ _verifyEntry(name, key, nullptr, false, true);
LOG("Entry created.");
}
@@ -197,14 +198,15 @@ void createRegion(const char *name, bool ackMode, const char *endpoints,
ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
-void createEntry(const char *name, const char *key, const char *value = NULL) {
+void createEntry(const char *name, const char *key,
+ const char *value = nullptr) {
LOG("createEntry() entered.");
fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
value, name);
fflush(stdout);
// Create entry, verify entry is correct
CacheableKeyPtr keyPtr = createKey(key);
- if (value == NULL) {
+ if (value == nullptr) {
value = "";
}
CacheableStringPtr valPtr = CacheableString::create(value);
@@ -268,7 +270,8 @@ void doNetsearch(const char *name, const char *key, const char *value) {
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
if (checkPtr != nullptr) {
LOG("checkPtr is not null");
@@ -277,7 +280,7 @@ void doNetsearch(const char *name, const char *key, const char *value) {
checkPtr->asChar(), key);
LOG(buf);
} else {
- LOG("checkPtr is NULL");
+ LOG("checkPtr is nullptr");
}
verifyEntry(name, key, value);
LOG("Netsearch complete.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientLRUExpiration.cpp b/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
index 63371d0..0de53fe 100644
--- a/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
+++ b/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
@@ -35,7 +35,7 @@ using namespace test;
#define CLIENT2 s1p2
#define SERVER1 s2p1
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
bool isLocalServer = false;
static bool isLocator = false;
@@ -52,20 +52,20 @@ TallyListenerPtr regListener;
TallyWriterPtr regWriter;
bool registerKey = true;
void initClient(const bool isthinClient) {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(isthinClient);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
void printAttribute(RegionAttributesPtr& attr) {
@@ -133,9 +133,10 @@ void createRegion(const char* name, bool ackMode, int ettl, int eit, int rttl,
ExpirationAction::Action action = ExpirationAction::DESTROY) {
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr = // getHelper()->createRegion( name, ackMode, true,
- // ettl,eit,rttl,rit,lel,action,endpoints,clientNotificationEnabled
- // );
+ RegionPtr
+ regPtr = // getHelper()->createRegion( name, ackMode, true,
+ // ettl,eit,rttl,rit,lel,action,endpoints,clientNotificationEnabled
+ // );
getHelper()->createRegionAndAttachPool(name, ackMode, "LRUPool", true,
ettl, eit, rttl, rit, lel, action);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -191,7 +192,7 @@ void dumpCounters(const char* regName) {
}
}
-int getNumOfEntries(const char* regName, bool isValue = false) {
+size_t getNumOfEntries(const char* regName, bool isValue = false) {
static bool useRegionSize = false;
useRegionSize = !useRegionSize;
@@ -205,7 +206,7 @@ int getNumOfEntries(const char* regName, bool isValue = false) {
} else if (!useRegionSize) {
VectorOfCacheableKey v;
rptr->keys(v);
- printf("Region key size: %d\n", v.size());
+ printf("Region key size: %zd\n", v.size());
return v.size();
} else {
return rptr->size();
@@ -275,7 +276,7 @@ DUNIT_TASK(CLIENT1, StepThreeCase1)
{
doRgnOperations(regionNames[0], 100);
ACE_OS::sleep(1);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 100, "Expected 100 entries");
LOG("StepThree complete.");
}
@@ -283,7 +284,7 @@ END_TASK(StepThreeCase1)
DUNIT_TASK(CLIENT2, StepFourCase1)
{
doRgnOperations(regionNames[0], 100, 5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 100, "Expected 100 entries");
LOG("StepFour complete.");
}
@@ -292,7 +293,7 @@ DUNIT_TASK(CLIENT1, StepFiveCase1)
{
// wair 5 sec so all enteries gone
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 0, "Expected 0 entries");
LOG("StepFive complete.");
}
@@ -302,7 +303,7 @@ DUNIT_TASK(CLIENT2, StepSixCase1)
ACE_OS::sleep(5);
// all enteris has been deleted
// int n = getNumOfEntries(regionNames[0],true);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 0, "Expected 0 entries");
LOG("StepSix complete.");
}
@@ -335,7 +336,7 @@ DUNIT_TASK(CLIENT1, StepThreeCase2)
{
doRgnOperations(regionNames[0], 100);
// 100 entry with invalidate
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 100, "Expected 100 entries");
LOG("StepThreeCase2 complete.");
}
@@ -344,7 +345,7 @@ DUNIT_TASK(CLIENT2, StepFourCase2)
{
doRgnOperations(regionNames[0], 100, 5);
// should have 100
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 100, "Expected 100 entries");
LOG("StepFourCase2 complete.");
}
@@ -352,7 +353,7 @@ END_TASK(StepFourCase2)
DUNIT_TASK(CLIENT1, StepFiveCase2)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 100, "Expected 100 entries");
ACE_OS::sleep(5);
// value should be invalidate as passing true
@@ -364,7 +365,7 @@ END_TASK(StepFiveCase2)
DUNIT_TASK(CLIENT2, StepSixCase2)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0], true);
+ auto n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 100, "Expected 100 entries");
LOG("StepSixCase2 complete.");
}
@@ -394,7 +395,7 @@ END_TASK(StepTwoCase3)
DUNIT_TASK(CLIENT1, StepThreeCase3)
{
doRgnOperations(regionNames[0], 10);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5, "Expected 5 entries");
LOG("StepThreeCase3 complete.");
}
@@ -402,14 +403,14 @@ END_TASK(StepThreeCase3)
DUNIT_TASK(CLIENT2, StepFourCase3)
{
doRgnOperations(regionNames[0], 10, 5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepFourCase3 complete.");
}
END_TASK(StepFourCase3)
DUNIT_TASK(CLIENT1, StepFiveCase3)
{
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5, "Expected 5 entries");
n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 5, "Expected 5 entries");
@@ -419,7 +420,7 @@ END_TASK(StepFiveCase3)
DUNIT_TASK(CLIENT2, StepSixCase3)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 10, "Expected 10 entries");
@@ -456,7 +457,7 @@ END_TASK(StepTwoCase4)
DUNIT_TASK(CLIENT1, StepThreeCase4)
{
doRgnOperations(regionNames[0], 10);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5, "Expected 5 entries");
LOG("StepThreeCase4 complete.");
}
@@ -464,7 +465,7 @@ END_TASK(StepThreeCase4)
DUNIT_TASK(CLIENT2, StepFourCase4)
{
doRgnOperations(regionNames[0], 10, 5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepFourCase4 complete.");
}
@@ -472,7 +473,7 @@ END_TASK(StepFourCase4)
DUNIT_TASK(CLIENT1, StepFiveCase4)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5, "Expected 5 entries");
n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 5, "Expected 5 entries");
@@ -486,7 +487,7 @@ END_TASK(StepFiveCase4)
DUNIT_TASK(CLIENT2, StepSixCase4)
{
ACE_OS::sleep(1);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 10, "Expected 10 entries");
@@ -529,7 +530,7 @@ END_TASK(StepTwoCase5)
DUNIT_TASK(CLIENT1, StepThreeCase5)
{
doRgnOperations(regionNames[0], 10);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5,
"Expected 5 "
"entries");
@@ -540,7 +541,7 @@ END_TASK(StepThreeCase5)
DUNIT_TASK(CLIENT2, StepFourCase5)
{
doRgnOperations(regionNames[0], 10, 5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10,
"Expected "
"10 "
@@ -552,7 +553,7 @@ END_TASK(StepFourCase5)
DUNIT_TASK(CLIENT1, StepFiveCase5)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5,
"Expected "
"5 "
@@ -576,7 +577,7 @@ END_TASK(StepFiveCase5)
DUNIT_TASK(CLIENT2, StepSixCase5)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5,
"Expecte"
"d 5 "
@@ -635,7 +636,7 @@ END_TASK(StepTwoCase6)
DUNIT_TASK(CLIENT1, StepThreeCase6)
{
doRgnOperations(regionNames[0], 10);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5,
"Expe"
"cted"
@@ -655,7 +656,7 @@ END_TASK(StepThreeCase6)
DUNIT_TASK(CLIENT2, StepFourCase6)
{
doRgnOperations(regionNames[0], 10, 5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10,
"Ex"
"pe"
@@ -684,7 +685,7 @@ END_TASK(StepFourCase6)
DUNIT_TASK(CLIENT1, StepFiveCase6)
{
ACE_OS::sleep(2);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 5, "Expected 5 entries");
n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 5, "Expected 5 entries");
@@ -697,7 +698,7 @@ END_TASK(StepFiveCase6)
DUNIT_TASK(CLIENT2, StepSixCase6)
{
ACE_OS::sleep(1);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
n = getNumOfEntries(regionNames[0], true);
ASSERT(n == 10, "Expected 10 entries");
@@ -724,7 +725,7 @@ END_TASK(StepTwoCase7)
DUNIT_TASK(CLIENT1, StepThreeCase7)
{
doRgnOperations(regionNames[0], 10);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepThreeCase7 complete.");
}
@@ -732,7 +733,7 @@ END_TASK(StepThreeCase7)
DUNIT_TASK(CLIENT2, StepFourCase7)
{
doRgnOperations(regionNames[0], 10, 5);
- int n = getNumOfEntries(regionNames[0]);
+ auto n = getNumOfEntries(regionNames[0]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepFourCase7 complete.");
}
@@ -772,7 +773,7 @@ END_TASK(StepTwoCase8)
DUNIT_TASK(CLIENT1, StepThreeCase8)
{
doRgnOperations(regionNames[1], 10);
- int n = getNumOfEntries(regionNames[1]);
+ auto n = getNumOfEntries(regionNames[1]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepThreeCase8 complete.");
}
@@ -780,7 +781,7 @@ END_TASK(StepThreeCase8)
DUNIT_TASK(CLIENT2, StepFourCase8)
{
doRgnOperations(regionNames[1], 10, 5);
- int n = getNumOfEntries(regionNames[1]);
+ auto n = getNumOfEntries(regionNames[1]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepFourCase8 complete.");
}
@@ -788,7 +789,7 @@ END_TASK(StepFourCase8)
DUNIT_TASK(CLIENT1, StepFiveCase8)
{
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[1]);
+ auto n = getNumOfEntries(regionNames[1]);
ASSERT(n == 10, "Expected 0 entries");
ACE_OS::sleep(10);
ValidateDestroyRegion(regionNames[1]);
@@ -823,7 +824,7 @@ DUNIT_TASK(CLIENT1, StepThreeCase9)
{
ACE_OS::sleep(2);
doRgnOperations(regionNames[2], 10);
- int n = getNumOfEntries(regionNames[2]);
+ auto n = getNumOfEntries(regionNames[2]);
ASSERT(n == 5, "Expected 5 entries");
LOG("StepThreeCase9 complete.");
}
@@ -831,7 +832,7 @@ END_TASK(StepThreeCase9)
DUNIT_TASK(CLIENT2, StepFourCase9)
{
doRgnOperations(regionNames[2], 10, 5);
- int n = getNumOfEntries(regionNames[2]);
+ auto n = getNumOfEntries(regionNames[2]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepFourCase9 complete.");
}
@@ -839,7 +840,7 @@ END_TASK(StepFourCase9)
DUNIT_TASK(CLIENT1, StepFiveCase9)
{
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[2]);
+ auto n = getNumOfEntries(regionNames[2]);
ASSERT(n == 0, "Expected 0 entries");
ACE_OS::sleep(8);
ValidateDestroyRegion(regionNames[2]);
@@ -873,7 +874,7 @@ END_TASK(StepTwoCase10)
DUNIT_TASK(CLIENT1, StepThreeCase10)
{
doRgnOperations(regionNames[3], 10);
- int n = getNumOfEntries(regionNames[3]);
+ auto n = getNumOfEntries(regionNames[3]);
ASSERT(n == 5, "Expected 5 entries");
LOG("StepThreeCase10 complete.");
}
@@ -881,7 +882,7 @@ END_TASK(StepThreeCase10)
DUNIT_TASK(CLIENT2, StepFourCase10)
{
doRgnOperations(regionNames[3], 10, 5);
- int n = getNumOfEntries(regionNames[3]);
+ auto n = getNumOfEntries(regionNames[3]);
ASSERT(n == 10, "Expected 10 entries");
LOG("StepFourCase10 complete.");
}
@@ -889,7 +890,7 @@ END_TASK(StepFourCase10)
DUNIT_TASK(CLIENT1, StepFiveCase10)
{
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[3]);
+ auto n = getNumOfEntries(regionNames[3]);
ASSERT(n == 0, "Expected 0 entries");
ACE_OS::sleep(10);
ValidateDestroyRegion(regionNames[3]);
@@ -933,7 +934,7 @@ END_TASK(StepTwoCase11)
DUNIT_TASK(CLIENT1, StepThreeCase11)
{
doRgnOperations(regionNames[4], 10);
- int n = getNumOfEntries(regionNames[4]);
+ auto n = getNumOfEntries(regionNames[4]);
regListener->showTallies();
ASSERT(regWriter->isWriterInvoked() == true, "Writer Should be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -949,7 +950,7 @@ DUNIT_TASK(CLIENT1, StepThreeCase11)
END_TASK(StepThreeCase11)
DUNIT_TASK(CLIENT2, StepFourCase11)
{
- int n = getNumOfEntries(regionNames[4]);
+ auto n = getNumOfEntries(regionNames[4]);
regListener->showTallies();
ASSERT(regWriter->isWriterInvoked() == false,
"Writer Should not be invoked");
@@ -974,7 +975,7 @@ END_TASK(StepFourCase11)
DUNIT_TASK(CLIENT1, StepFiveCase11)
{
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[4]);
+ auto n = getNumOfEntries(regionNames[4]);
ASSERT(regWriter->isWriterInvoked() == true, "Writer Should be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -991,7 +992,7 @@ DUNIT_TASK(CLIENT1, StepFiveCase11)
END_TASK(StepFiveCase11)
DUNIT_TASK(CLIENT2, StepSixCase11)
{
- int n = getNumOfEntries(regionNames[4]);
+ auto n = getNumOfEntries(regionNames[4]);
ASSERT(regWriter->isWriterInvoked() == false,
"Writer Should not be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -1068,7 +1069,7 @@ END_TASK(StepTwoCase12)
DUNIT_TASK(CLIENT1, StepThreeCase12)
{
doRgnOperations(regionNames[5], 10);
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
regListener->showTallies();
ASSERT(regWriter->isWriterInvoked() == true, "Writer Should be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -1085,7 +1086,7 @@ DUNIT_TASK(CLIENT1, StepThreeCase12)
END_TASK(StepThreeCase12)
DUNIT_TASK(CLIENT2, StepFourCase12)
{
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
ASSERT(regWriter->isWriterInvoked() == false,
"Writer Should not be invoked");
ASSERT(regListener->isListenerInvoked() == false,
@@ -1098,7 +1099,7 @@ END_TASK(StepFourCase12)
DUNIT_TASK(CLIENT1, StepFiveCase12)
{
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
ASSERT(regWriter->isWriterInvoked() == true, "Writer Should be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -1117,7 +1118,7 @@ END_TASK(StepFiveCase12)
DUNIT_TASK(CLIENT2, StepSixCase12)
{
ACE_OS::sleep(3);
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
ASSERT(regWriter->isWriterInvoked() == false,
"Writer Should not be invoked");
ASSERT(regListener->isListenerInvoked() == false,
@@ -1169,7 +1170,7 @@ END_TASK(StepTwoCase13)
DUNIT_TASK(CLIENT1, StepThreeCase13)
{
doRgnOperations(regionNames[5], 10);
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
regListener->showTallies();
ASSERT(regWriter->isWriterInvoked() == true, "Writer Should be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -1186,7 +1187,7 @@ DUNIT_TASK(CLIENT1, StepThreeCase13)
END_TASK(StepThreeCase13)
DUNIT_TASK(CLIENT2, StepFourCase13)
{
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
ASSERT(regWriter->isWriterInvoked() == false,
"Writer Should not be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -1207,7 +1208,7 @@ END_TASK(StepFourCase13)
DUNIT_TASK(CLIENT1, StepFiveCase13)
{
ACE_OS::sleep(5);
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
ASSERT(regWriter->isWriterInvoked() == true, "Writer Should be invoked");
ASSERT(regListener->isListenerInvoked() == true,
@@ -1226,7 +1227,7 @@ END_TASK(StepFiveCase13)
DUNIT_TASK(CLIENT2, StepSixCase13)
{
ACE_OS::sleep(3);
- int n = getNumOfEntries(regionNames[5]);
+ auto n = getNumOfEntries(regionNames[5]);
ASSERT(regWriter->isWriterInvoked() == false,
"Writer Should not be invoked");
ASSERT(regListener->isListenerInvoked() == true,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientLocator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientLocator.cpp b/src/cppcache/integration-test/testThinClientLocator.cpp
index ee5f879..4e73d3f 100644
--- a/src/cppcache/integration-test/testThinClientLocator.cpp
+++ b/src/cppcache/integration-test/testThinClientLocator.cpp
@@ -37,8 +37,8 @@ END_TASK(CreateLocator1)
DUNIT_TASK(SERVER12, CreateServer12)
{
// starting servers
- if (isLocalServer) CacheHelper::initServer(1, NULL, locHostPort);
- if (isLocalServer) CacheHelper::initServer(2, NULL, locHostPort);
+ if (isLocalServer) CacheHelper::initServer(1, nullptr, locHostPort);
+ if (isLocalServer) CacheHelper::initServer(2, nullptr, locHostPort);
LOG("Server12 started");
}
END_TASK(CreateServer12)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientLocatorFailover.cpp b/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
index c746d39..0d1bb3c 100644
--- a/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
@@ -39,7 +39,7 @@ END_TASK(CreateLocator_All)
DUNIT_TASK(SERVERS, CreateServer1_All)
{
// starting servers
- if (isLocalServer) CacheHelper::initServer(1, NULL, locatorsG);
+ if (isLocalServer) CacheHelper::initServer(1, nullptr, locatorsG);
LOG("Server One started");
}
END_TASK(CreateServer1_All)
@@ -80,7 +80,7 @@ END_TASK(ConnectC2_All)
DUNIT_TASK(SERVERS, CreateServer2_All)
{
if (isLocalServer) {
- CacheHelper::initServer(2, NULL, locatorsG);
+ CacheHelper::initServer(2, nullptr, locatorsG);
LOG("Server 2 started");
}
}
@@ -133,7 +133,7 @@ END_TASK(SwapLocators)
DUNIT_TASK(SERVERS, Re_CreateServer1_All)
{
if (isLocalServer) {
- CacheHelper::initServer(1, NULL, locatorsG);
+ CacheHelper::initServer(1, nullptr, locatorsG);
LOG("Server 1 started");
SLEEP(30000);
}
@@ -197,7 +197,7 @@ END_TASK(Re_Close1_All_All)
DUNIT_TASK(SERVERS, StartServer2_All)
{
if (isLocalServer) {
- CacheHelper::initServer(2, NULL, NULL);
+ CacheHelper::initServer(2, nullptr, nullptr);
LOG("SERVER2 Started");
SLEEP(30000);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientMultiDS.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientMultiDS.cpp b/src/cppcache/integration-test/testThinClientMultiDS.cpp
index 0951f59..06ff8da 100644
--- a/src/cppcache/integration-test/testThinClientMultiDS.cpp
+++ b/src/cppcache/integration-test/testThinClientMultiDS.cpp
@@ -34,7 +34,7 @@
#ifdef __disabled_test__
static int clientWithNothing = 0;
void initClient() {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
PropertiesPtr config = Properties::create();
if (clientWithNothing > 1) config->insert("grid-client", "true");
clientWithNothing += 1;
@@ -62,20 +62,20 @@ void startServer(int instance, const char* xmlfile, const char* lochostport) {
DUNIT_TASK_DEFINITION(SERVER1, CreateServer1)
{
- CacheHelper::initServer(1, "cacheserver_notify_subscription.xml", NULL,
- NULL, false, true, true);
- CacheHelper::initServer(2, "cacheserver_notify_subscription2.xml", NULL,
- NULL, false, true, true);
+ CacheHelper::initServer(1, "cacheserver_notify_subscription.xml", nullptr,
+ nullptr, false, true, true);
+ CacheHelper::initServer(2, "cacheserver_notify_subscription2.xml", nullptr,
+ nullptr, false, true, true);
LOG("SERVER1 and server2 started");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER2, CreateServer2)
{
- CacheHelper::initServer(3, "cacheserver_notify_subscription3.xml", NULL,
- NULL, false, true, true);
- CacheHelper::initServer(4, "cacheserver_notify_subscription4.xml", NULL,
- NULL, false, true, true);
+ CacheHelper::initServer(3, "cacheserver_notify_subscription3.xml", nullptr,
+ nullptr, false, true, true);
+ CacheHelper::initServer(4, "cacheserver_notify_subscription4.xml", nullptr,
+ nullptr, false, true, true);
LOG("SERVER2 started");
}
END_TASK_DEFINITION
@@ -170,9 +170,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_1)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2]));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2]));
ASSERT(checkPtr == nullptr, "checkPtr should be null");
- auto checkPtr1 = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0]));
+ auto checkPtr1 =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0]));
ASSERT(checkPtr1 != nullptr, "checkPtr1 should not be null");
} catch (Exception& excp) {
LOG(excp.getMessage());
@@ -339,9 +341,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_secureclient1)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2]));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2]));
ASSERT(checkPtr == nullptr, "checkPtr should be null");
- auto checkPtr1 = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0]));
+ auto checkPtr1 =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0]));
ASSERT(checkPtr1 != nullptr, "checkPtr1 should not be null");
} catch (Exception& excp) {
LOG(excp.getMessage());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp b/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
index c27b24e..a206a29 100644
--- a/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
+++ b/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
@@ -29,7 +29,7 @@
using namespace apache::geode::client;
using namespace test;
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
#include "locator_globals.hpp"
@@ -43,7 +43,7 @@ int DeltaEx::fromDeltaCount = 0;
int DeltaEx::fromDataCount = 0;
int DeltaEx::cloneCount = 0;
void initClient(const bool isthinClient) {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(isthinClient);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
@@ -55,14 +55,14 @@ void initClientNoPools() {
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp b/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
index 4ee95b1..1093191 100644
--- a/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
@@ -126,8 +126,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAllOneTask)
for (int32_t item = 0; item < 1000; item++) {
sprintf(key, "key-%d", item);
sprintf(value, "%d", item);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
LOGDEBUG(
"CPPTEST:PutAllOneTask Doing PutAll on key using key: = %s: & value: "
"= "
@@ -165,8 +165,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAllTwoTask)
"= "
"%s",
key, value);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
}
try {
dataReg->putAll(entryMap);
@@ -199,8 +199,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAllThreeTask)
"value: "
"= %s",
key, value);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
}
try {
dataReg->putAll(entryMap);
@@ -233,8 +233,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAllFourTask)
"value: "
"= %s",
key, value);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
}
try {
dataReg->putAll(entryMap);
@@ -270,7 +270,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllPutAllTask)
sprintf(value, "%d", item);
LOGDEBUG("CPPTEST:VerifyAllPutAllTask Doing get on key using: = %s: ",
key);
- auto checkPtr = std::dynamic_pointer_cast<CacheableString>(dataReg->get(CacheableKey::create(key)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ dataReg->get(CacheableKey::create(key)));
ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
LOGDEBUG("CPPTEST:VerifyAllPutAllTask value is: = %s: ",
checkPtr->asChar());
@@ -292,8 +293,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, RemoveAllOneTask)
for (int32_t item = 0; item < 1000; item++) {
sprintf(key, "key-%d", item);
sprintf(value, "%d", item);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
keys.push_back(CacheableKey::create(key));
LOGDEBUG(
"CPPTEST:RemoveAllOneTask Doing PutAll on key using key: = %s: & "
@@ -328,8 +329,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, RemoveAllTwoTask)
for (int32_t item = 1000; item < 2000; item++) {
sprintf(key, "key-%d", item);
sprintf(value, "%d", item);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
keys.push_back(CacheableKey::create(key));
LOGDEBUG(
"CPPTEST:RemoveAllTwoTask Doing RemoveAll on key using key: = %s: & "
@@ -364,8 +365,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, RemoveAllThreeTask)
for (int32_t item = 2000; item < 3000; item++) {
sprintf(key, "key-%d", item);
sprintf(value, "%d", item);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
keys.push_back(CacheableKey::create(key));
LOGDEBUG(
"CPPTEST:RemoveAllThreeTask Doing RemoveAll on key using key: = %s: "
@@ -402,8 +403,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, RemoveAllFourTask)
for (int32_t item = 3000; item < 4000; item++) {
sprintf(key, "key-%d", item);
sprintf(value, "%d", item);
- entryMap.insert(CacheableKey::create(key),
- CacheableString::create(value));
+ entryMap.emplace(CacheableKey::create(key),
+ CacheableString::create(value));
keys.push_back(CacheableKey::create(key));
LOGDEBUG(
"CPPTEST:RemoveAllFourTask Doing RemoveAll on key using key: = %s: & "
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPRSingleHop.cpp b/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
index b71aa0a..afcec63 100644
--- a/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
+++ b/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
@@ -53,7 +53,7 @@ const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1);
std::string convertHostToCanonicalForm(const char* endpoints) {
- if (endpoints == NULL) return NULL;
+ if (endpoints == nullptr) return nullptr;
std::string hostString("");
uint16_t port = 0;
std::string endpointsStr(endpoints);
@@ -119,10 +119,12 @@ class putThread : public ACE_Task_Base {
if (!m_isWarmUpTask) {
unsigned int seed = i;
rand = ACE_OS::rand_r(&seed);
- keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(rand));
+ keyPtr = std::dynamic_pointer_cast<CacheableKey>(
+ CacheableInt32::create(rand));
LOGDEBUG("svc: putting key %d ", rand);
} else {
- keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
LOGDEBUG("svc: putting key %d ", i);
}
try {
@@ -190,12 +192,12 @@ class putThread : public ACE_Task_Base {
std::vector<char*> storeEndPoints(const char* points) {
std::vector<char*> endpointNames;
- if (points != NULL) {
+ if (points != nullptr) {
char* ep = strdup(points);
char* token = strtok(ep, ",");
while (token) {
endpointNames.push_back(token);
- token = strtok(NULL, ",");
+ token = strtok(nullptr, ",");
}
}
ASSERT(endpointNames.size() == 3, "There should be 3 end points");
@@ -268,11 +270,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_LocatorTL)
initClient(true);
RegionPtr regPtr = getHelper()->createPooledRegionStickySingleHop(
- regionNames[0], USE_ACK, NULL, locatorsG, "__TEST_POOL1__", false,
+ regionNames[0], USE_ACK, nullptr, locatorsG, "__TEST_POOL1__", false,
false);
ASSERT(regPtr != nullptr, "Failed to create region.");
regPtr = getHelper()->createPooledRegionStickySingleHop(
- regionNames[1], NO_ACK, NULL, locatorsG, "__TEST_POOL1__", false,
+ regionNames[1], NO_ACK, nullptr, locatorsG, "__TEST_POOL1__", false,
false);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -289,7 +291,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask)
// This is to get MetaDataService going.
for (int i = 0; i < 2000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: put item %d", i);
dataReg->put(keyPtr, keyPtr->hashcode());
@@ -311,7 +314,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask)
LOGINFO(
"WarmUpTask: & metadatarefreshCount is %d "
"failureCount = %d",
- metadatarefreshCount, failureCount);
+ metadatarefreshCount, failureCount);
LOGINFO("CPPTEST: put success ");
} catch (CacheServerException&) {
// This is actually a success situation!
@@ -369,7 +372,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask3)
// This is to get MetaDataService going.
for (int i = 0; i < 2000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: put item %d", i);
dataReg->put(keyPtr, keyPtr->hashcode());
@@ -502,10 +506,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForAllKeysTask)
CacheableWrapper* tmpkey =
CacheableWrapperFactory::createInstance(keyTypeId);
tmpkey->initKey(i, KEYSIZE);
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable());
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable());
ASSERT(tmpkey->getCacheable() != nullptr,
- "tmpkey->getCacheable() is NULL");
+ "tmpkey->getCacheable() is nullptr");
char logmsg[KEYSIZE * 4 + 100] = {0};
keyPtr->toString()->logString(logmsg, KEYSIZE * 4);
@@ -622,7 +627,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 2000; i < 3000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i,
@@ -738,7 +744,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2)
LOG("CheckPrSingleHopForIntKeysTask2 put completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i,
@@ -862,7 +869,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForGetAllTask)
VectorOfCacheableKey keys;
auto valuesMap = std::make_shared<HashMapOfCacheable>();
for (int i = 0; i < 100; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
dataReg->put(keyPtr, keyPtr->hashcode());
keys.push_back(keyPtr);
}
@@ -886,7 +894,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 2000; i < 3000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i,
@@ -989,7 +998,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask)
LOG("CheckPrSingleHopForIntKeysTask put completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i,
@@ -1236,7 +1246,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckGetAllTask)
VectorOfCacheableKey keys;
auto valuesMap = std::make_shared<HashMapOfCacheable>();
for (int i = 0; i < 100000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
dataReg->put(keyPtr, keyPtr->hashcode());
keys.push_back(keyPtr);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp b/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
index 469bed4..8e21576 100644
--- a/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
+++ b/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
@@ -97,24 +97,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: Putting key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->put(keyPtr, keyPtr->hashcode());
bool networkhop = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getAndResetNetworkHopFlag();
- LOGINFO("CheckPrSingleHopForIntKeysTask_CLIENT1: networkhop %d ",
- networkhop);
if (networkhop) {
failureCount++;
}
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT1: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
@@ -127,10 +121,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
rStats->getInt((char*)"metaDataRefreshCount");
}
}
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT1: "
- "metadatarefreshCount is %d failureCount = %d",
- metadatarefreshCount, failureCount);
} catch (CacheServerException&) {
LOGERROR("CPPTEST: Put caused extra hop.");
FAIL("Put caused extra hop.");
@@ -159,22 +149,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT1 put completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->get(keyPtr);
bool networkhop = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getAndResetNetworkHopFlag();
- LOGINFO("CheckPrSingleHopForIntKeysTask_CLIENT1: networkhop %d ",
- networkhop);
ASSERT(!networkhop, "It is networkhop operation.");
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT1: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -213,14 +197,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
dataReg->getAll(keys, values, exceptions, false);
bool networkhop = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getAndResetNetworkHopFlag();
- LOGINFO("CheckPrSingleHopForIntKeysTask_CLIENT1: networkhop %d ",
- networkhop);
ASSERT(!networkhop, "It is networkhop operation.");
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT1: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -247,22 +226,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT1 getAll completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: destroying key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->destroy(keyPtr);
bool networkhop = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getAndResetNetworkHopFlag();
- LOGINFO("CheckPrSingleHopForIntKeysTask_CLIENT1: networkhop %d ",
- networkhop);
ASSERT(!networkhop, "It is networkhop operation.");
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT1: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -299,24 +272,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: Putting key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->put(keyPtr, keyPtr->hashcode());
bool networkhop = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getAndResetNetworkHopFlag();
- LOGINFO("CheckPrSingleHopForIntKeysTask_CLIENT2: networkhop %d ",
- networkhop);
if (networkhop) {
failureCount++;
}
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT2: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
@@ -329,10 +296,6 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
rStats->getInt((char*)"metaDataRefreshCount");
}
}
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT2: "
- "metadatarefreshCount is %d ",
- metadatarefreshCount);
} catch (CacheServerException&) {
LOGERROR("CPPTEST: Put caused extra hop.");
FAIL("Put caused extra hop.");
@@ -360,17 +323,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT2 put completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->get(keyPtr);
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT2: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -408,12 +367,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
try {
dataReg->getAll(keys, values, exceptions, false);
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOG("after gatall ");
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT2: serverGroupFlag is %d "
- "getall size = %d",
- serverGroupFlag, values->size());
+ ->getAndResetServerGroupFlag();
ASSERT(values->size() == 5, "getall size should be 5 ");
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
@@ -441,17 +395,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT2 getAll completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: destroying key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->destroy(keyPtr);
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT2: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -488,24 +438,18 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: Putting key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->put(keyPtr, keyPtr->hashcode());
bool networkhop = TestUtils::getCacheImpl(getHelper()->cachePtr)
->getAndResetNetworkHopFlag();
- LOGINFO("CheckPrSingleHopForIntKeysTask_CLIENT3: networkhop %d ",
- networkhop);
if (networkhop) {
failureCount++;
}
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT3: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
@@ -518,10 +462,6 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
rStats->getInt((char*)"metaDataRefreshCount");
}
}
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT3: "
- "metadatarefreshCount is %d ",
- metadatarefreshCount);
} catch (CacheServerException&) {
LOGERROR("CPPTEST: Put caused extra hop.");
FAIL("Put caused extra hop.");
@@ -549,17 +489,13 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT3 put completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->get(keyPtr);
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT3: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -597,10 +533,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
try {
dataReg->getAll(keys, values, exceptions, false);
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT3: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
@@ -627,17 +560,13 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT3 getAll completed.");
for (int i = 0; i < 1000; i++) {
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
- LOGINFO("CPPTEST: destroying key %d with hashcode %d", i,
- keyPtr->hashcode());
dataReg->destroy(keyPtr);
int8_t serverGroupFlag = TestUtils::getCacheImpl(getHelper()->cachePtr)
- ->getAndResetServerGroupFlag();
- LOGINFO(
- "CheckPrSingleHopForIntKeysTask_CLIENT3: serverGroupFlag is %d ",
- serverGroupFlag);
+ ->getAndResetServerGroupFlag();
ASSERT(serverGroupFlag != 2,
"serverGroupFlag should not be equal to 2");
} catch (CacheServerException&) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPartitionResolver.cpp b/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
index d31a244..53cc40e 100644
--- a/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
+++ b/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
@@ -68,12 +68,12 @@ const char *endPoints = CacheHelper::getTcrEndpoints(isLocalServer, 3);
std::vector<char *> storeEndPoints(const char *points) {
std::vector<char *> endpointNames;
- if (points != NULL) {
+ if (points != nullptr) {
char *ep = strdup(points);
char *token = strtok(ep, ",");
while (token) {
endpointNames.push_back(token);
- token = strtok(NULL, ",");
+ token = strtok(nullptr, ",");
}
}
ASSERT(endpointNames.size() == 3, "There should be 3 end points");
@@ -104,7 +104,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreatePoolAndRegions)
sprintf(endpoints, "%s,%s,%s", endpointNames.at(0), endpointNames.at(1),
endpointNames.at(2));
- getHelper()->createPoolWithLocators("__TEST_POOL1__", NULL);
+ getHelper()->createPoolWithLocators("__TEST_POOL1__", nullptr);
getHelper()->createRegionAndAttachPool2(regionNames[0], USE_ACK,
"__TEST_POOL1__", cptr);
// getHelper()->createRegionAndAttachPool2(regionNames[1], NO_ACK,
@@ -121,7 +121,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutThroughPartitionResolver)
for (int i = 0; i < 100; i++) {
// RegionPtr dataReg = getHelper()->getRegion("LocalRegion");
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
- auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
dataReg->put(keyPtr, keyPtr->hashcode());
}
SLEEP(5000);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp b/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
index 56f56ef..c498e5f 100644
--- a/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
+++ b/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
@@ -29,7 +29,7 @@
using namespace apache::geode::client;
using namespace test;
-CacheHelper* cacheHelper = NULL;
+CacheHelper* cacheHelper = nullptr;
bool isLocalServer = false;
static bool isLocator = false;
@@ -52,7 +52,7 @@ int PdxDeltaEx::m_fromDataCount = 0;
int PdxDeltaEx::m_cloneCount = 0;
void initClient(const bool isthinClient) {
- if (cacheHelper == NULL) {
+ if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(isthinClient);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
@@ -64,14 +64,14 @@ void initClientNoPools() {
}
void cleanProc() {
- if (cacheHelper != NULL) {
+ if (cacheHelper != nullptr) {
delete cacheHelper;
- cacheHelper = NULL;
+ cacheHelper = nullptr;
}
}
CacheHelper* getHelper() {
- ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ ASSERT(cacheHelper != nullptr, "No cacheHelper initialized.");
return cacheHelper;
}
@@ -93,7 +93,7 @@ void createPooledExpirationRegion(const char* name, const char* poolname) {
LOG("createPooledExpirationRegion() entered.");
// Entry time-to-live = 1 second.
RegionPtr regPtr = getHelper()->createPooledRegionDiscOverFlow(
- name, true, locatorsG, poolname, true, true, 1, 0, 0, 0, 0, NULL,
+ name, true, locatorsG, poolname, true, true, 1, 0, 0, 0, 0, nullptr,
ExpirationAction::LOCAL_INVALIDATE);
}
@@ -151,7 +151,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1)
initClient(true);
createPooledRegion(regionNames[0], USE_ACK, locatorsG, "__TESTPOOL1_",
true); // without LRU
- createPooledLRURegion(regionNames[1], USE_ACK, NULL, locatorsG,
+ createPooledLRURegion(regionNames[1], USE_ACK, nullptr, locatorsG,
"__TESTPOOL1_", true); // with LRU
createPooledExpirationRegion(regionNames[2], "__TESTPOOL1_");
}
@@ -171,7 +171,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2)
initClient(true);
createPooledRegion(regionNames[0], USE_ACK, locatorsG, "__TESTPOOL1_",
true);
- createPooledLRURegion(regionNames[1], USE_ACK, NULL, locatorsG,
+ createPooledLRURegion(regionNames[1], USE_ACK, nullptr, locatorsG,
"__TESTPOOL1_", true); // with LRU
createPooledExpirationRegion(regionNames[2], "__TESTPOOL1_");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/integration-test/testThinClientPdxEnum.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPdxEnum.cpp b/src/cppcache/integration-test/testThinClientPdxEnum.cpp
index 8e957c2..17ecb1d 100644
--- a/src/cppcache/integration-test/testThinClientPdxEnum.cpp
+++ b/src/cppcache/integration-test/testThinClientPdxEnum.cpp
@@ -42,7 +42,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClientPoolLoc)
LOG("Starting Step One with Pool + Locator lists");
initClient(true);
- createPool("__TEST_POOL1__", locatorsG, NULL, 0, true);
+ createPool("__TEST_POOL1__", locatorsG, nullptr, 0, true);
createRegionAndAttachPool("DistRegionAck", USE_ACK, "__TEST_POOL1__");
LOG("SetupClient complete.");
@@ -160,17 +160,11 @@ DUNIT_TASK_DEFINITION(SERVER1, CloseLocator1)
END_TASK_DEFINITION
DUNIT_MAIN
- {
- CALL_TASK(CreateLocator1)
- CALL_TASK(CreateServer1_With_Locator)
+{CALL_TASK(CreateLocator1) CALL_TASK(CreateServer1_With_Locator)
- CALL_TASK(SetupClientPoolLoc)
- CALL_TASK(putPdxWithEnum)
- CALL_TASK(pdxEnumQuery)
+ CALL_TASK(SetupClientPoolLoc) CALL_TASK(putPdxWithEnum)
+ CALL_TASK(pdxEnumQuery)
- CALL_TASK(CloseCache1)
- CALL_TASK(CloseServer1)
+ CALL_TASK(CloseCache1) CALL_TASK(CloseServer1)
- CALL_TASK(CloseLocator1)
- }
-END_MAIN
+ CALL_TASK(CloseLocator1)} END_MAIN