You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2021/10/22 13:58:12 UTC
[geode-native] branch develop updated: GEODE-9553: remove all
remaining printf variations from C++ code (#885)
This is an automated email from the ASF dual-hosted git repository.
bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new 91ee46a GEODE-9553: remove all remaining printf variations from C++ code (#885)
91ee46a is described below
commit 91ee46a3781858956f0b6bcaa835ba4e0ec9b991
Author: Blake Bender <bb...@pivotal.io>
AuthorDate: Fri Oct 22 06:57:24 2021 -0700
GEODE-9553: remove all remaining printf variations from C++ code (#885)
---
.../integration-test/BuiltinCacheableWrappers.hpp | 17 ++-
cppcache/integration-test/CacheHelper.cpp | 63 ++++-----
cppcache/integration-test/InitSmartHeap.cpp | 2 +-
cppcache/integration-test/QueryHelper.hpp | 30 ++---
cppcache/integration-test/ThinClientDistOps.hpp | 61 ++++-----
cppcache/integration-test/ThinClientFailover.hpp | 40 +++---
cppcache/integration-test/ThinClientFailover2.hpp | 39 +++---
cppcache/integration-test/ThinClientFailover3.hpp | 28 ++--
.../ThinClientFailoverInterest.hpp | 31 ++---
.../ThinClientFailoverInterest2.hpp | 33 +++--
.../integration-test/ThinClientFailoverRegex.hpp | 33 +++--
cppcache/integration-test/ThinClientHeapLRU.hpp | 10 +-
cppcache/integration-test/ThinClientHelper.hpp | 44 +++---
.../integration-test/ThinClientInterestList.hpp | 28 ++--
.../integration-test/ThinClientInterestList2.hpp | 28 ++--
.../integration-test/ThinClientNotification.hpp | 34 +++--
cppcache/integration-test/ThinClientPutAll.hpp | 39 +++---
.../integration-test/ThinClientPutAllTimeout.hpp | 12 +-
.../ThinClientPutAllWithCallBack.hpp | 39 +++---
cppcache/integration-test/ThinClientPutGetAll.hpp | 6 +-
.../ThinClientRIwithlocalRegionDestroy.hpp | 6 +-
cppcache/integration-test/ThinClientRegex.hpp | 28 ++--
cppcache/integration-test/ThinClientRegex2.hpp | 35 +++--
cppcache/integration-test/ThinClientRegex3.hpp | 33 +++--
cppcache/integration-test/ThinClientRemoveAll.hpp | 21 +--
cppcache/integration-test/ThinClientSecurity.hpp | 2 +-
.../integration-test/ThinClientSecurityHelper.hpp | 36 ++---
cppcache/integration-test/ThinClientTXFailover.hpp | 51 ++++---
.../integration-test/ThinClientTransactions.hpp | 65 +++++----
.../integration-test/ThinClientTransactionsXA.hpp | 65 +++++----
cppcache/integration-test/TimeBomb.hpp | 10 +-
cppcache/integration-test/fw_dunit.cpp | 89 ++++++------
cppcache/integration-test/fw_dunit.hpp | 7 +-
cppcache/integration-test/fw_helper.hpp | 37 ++---
cppcache/integration-test/testExpiration.cpp | 2 +-
.../integration-test/testOverflowPutGetSqLite.cpp | 32 ++---
cppcache/integration-test/testSerialization.cpp | 16 ++-
.../testThinClientCacheableStringArray.cpp | 15 ++-
.../integration-test/testThinClientCacheables.cpp | 28 ++--
.../testThinClientCacheablesLimits.cpp | 5 +-
.../integration-test/testThinClientCqDelta.cpp | 11 +-
.../testThinClientCqHAFailover.cpp | 15 ++-
cppcache/integration-test/testThinClientCqIR.cpp | 16 +--
.../testThinClientDeltaWithNotification.cpp | 10 +-
.../integration-test/testThinClientHADistOps.cpp | 48 ++++---
.../testThinClientHAEventIDMap.cpp | 17 +--
.../integration-test/testThinClientHAFailover.cpp | 28 ++--
.../testThinClientHAFailoverRegex.cpp | 28 ++--
.../testThinClientHAMixedRedundancy.cpp | 28 ++--
.../testThinClientHAPeriodicAck.cpp | 17 +--
.../testThinClientHAQueryFailover.cpp | 27 +---
.../testThinClientIntResPolKeysInv.cpp | 28 ++--
.../testThinClientInterest1_Bug1001.cpp | 18 ++-
.../testThinClientLRUExpiration.cpp | 70 +++++-----
.../testThinClientListenerEvents.cpp | 5 -
...ThinClientNotificationWithDeltaWithoutcache.cpp | 11 +-
.../testThinClientPdxDeltaWithNotification.cpp | 12 +-
.../integration-test/testThinClientPdxInstance.cpp | 6 +-
.../testThinClientPutWithDelta.cpp | 11 +-
...ThinClientRegionQueryDifferentServerConfigs.cpp | 6 +-
.../testThinClientRemoteQueryFailover.cpp | 3 +-
.../testThinClientRemoteQueryFailoverPdx.cpp | 3 +-
.../testThinClientRemoteQueryRS.cpp | 150 ++++++++++-----------
.../testThinClientRemoteQuerySS.cpp | 106 ++++++++-------
.../integration-test/testThinClientRemoveOps.cpp | 54 ++++----
...ientSecurityAuthenticationSetAuthInitialize.cpp | 2 +-
.../testThinClientSecurityPostAuthorization.cpp | 11 +-
cppcache/src/CppCacheLibrary.cpp | 9 +-
cppcache/src/Log.cpp | 14 +-
examples/cpp/sslputget/main.cpp | 29 ++--
tests/cpp/testobject/Position.cpp | 11 +-
tests/cpp/testobject/Position.hpp | 3 +-
72 files changed, 970 insertions(+), 1037 deletions(-)
diff --git a/cppcache/integration-test/BuiltinCacheableWrappers.hpp b/cppcache/integration-test/BuiltinCacheableWrappers.hpp
index 4ced31e..4659e04 100644
--- a/cppcache/integration-test/BuiltinCacheableWrappers.hpp
+++ b/cppcache/integration-test/BuiltinCacheableWrappers.hpp
@@ -24,6 +24,8 @@
#include <cstdlib>
#include <wchar.h>
#include <random>
+#include <sstream>
+#include <iomanip>
#include <ace/Date_Time.h>
@@ -616,15 +618,15 @@ class CacheableHugeUnicodeStringWrapper : public CacheableWrapper {
int32_t maxKeys() const override { return INT_MAX; }
void initKey(int32_t keyIndex, int32_t maxSize) override {
+ std::wostringstream strm;
+
if (maxSize <= 0xFFFF) // ensure its larger than 64k
{
maxSize += (0xFFFF + 1);
}
std::wstring baseStr(maxSize - 10, L'\x0905');
- wchar_t indexStr[15];
- swprintf(indexStr, 14, L"%10d", keyIndex);
- baseStr.append(indexStr);
- m_cacheableObject = CacheableString::create(baseStr);
+ strm << baseStr << std::setw(10) << std::setfill(L'0') << keyIndex;
+ m_cacheableObject = CacheableString::create(strm.str());
}
void initRandomValue(int32_t maxSize) override {
@@ -661,15 +663,16 @@ class CacheableUnicodeStringWrapper : public CacheableWrapper {
int32_t maxKeys() const override { return INT_MAX; }
void initKey(int32_t keyIndex, int32_t maxSize) override {
+ std::wostringstream strm;
+
maxSize %= 21800; // so that encoded length is within 64k
if (maxSize < 11) {
maxSize = 11;
}
std::wstring baseStr(maxSize - 10, L'\x0905');
wchar_t indexStr[15];
- swprintf(indexStr, 14, L"%10d", keyIndex);
- baseStr.append(indexStr);
- m_cacheableObject = CacheableString::create(baseStr);
+ strm << baseStr << std::setw(10) << std::setfill(L'0') << keyIndex;
+ m_cacheableObject = CacheableString::create(strm.str());
}
void initRandomValue(int32_t maxSize) override {
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index f45fa54..c1d17be 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -16,6 +16,7 @@
*/
#include <fstream>
+#include <iostream>
#include <list>
#include <ace/INET_Addr.h>
@@ -224,8 +225,9 @@ CacheHelper::CacheHelper(const bool, const char *poolName,
poolFactory.setPRSingleHopEnabled(prSingleHop);
poolFactory.setThreadLocalConnections(threadLocal);
- printf(" Setting pr-single-hop to prSingleHop = %d ", prSingleHop);
- printf("Setting threadLocal to %d ", threadLocal);
+ std::cout << " Setting pr-single-hop to prSingleHop = " << prSingleHop
+ << "\n";
+ std::cout << "Setting threadLocal to " << threadLocal << "\n";
if (!locators.empty()) {
addServerLocatorEPs(locators, poolFactory);
if (serverGroup) {
@@ -239,7 +241,7 @@ CacheHelper::CacheHelper(const bool, const char *poolName,
poolFactory.setLoadConditioningInterval(
std::chrono::milliseconds(loadConditioningInterval));
}
- printf("Setting connections to %d ", connections);
+ std::cout << "Setting connections to " << connections << "\n";
if (connections >= 0) {
poolFactory.setMinConnections(connections);
poolFactory.setMaxConnections(connections);
@@ -405,7 +407,6 @@ std::shared_ptr<Pool> CacheHelper::createPool(
const std::string &serverGroup, int redundancy, bool clientNotification,
std::chrono::milliseconds subscriptionAckInterval, int connections,
int loadConditioningInterval, bool isMultiuserMode) {
- // printf(" in createPool isMultiuserMode = %d \n", isMultiuserMode);
auto poolFac = getCache()->getPoolManager().createFactory();
addServerLocatorEPs(locators, poolFac);
@@ -502,7 +503,8 @@ void CacheHelper::createPoolWithLocators(
std::chrono::milliseconds subscriptionAckInterval, int connections,
bool isMultiuserMode, const std::string &serverGroup) {
LOG("createPool() entered.");
- printf(" in createPoolWithLocators isMultiuserMode = %d\n", isMultiuserMode);
+ std::cout << " in createPoolWithLocators isMultiuserMode = "
+ << isMultiuserMode << "\n";
auto poolPtr = createPool(name, locators, serverGroup, subscriptionRedundancy,
clientNotificationEnabled, subscriptionAckInterval,
connections, -1, isMultiuserMode);
@@ -841,26 +843,27 @@ std::shared_ptr<CacheableString> CacheHelper::createCacheable(
void CacheHelper::showKeys(
std::vector<std::shared_ptr<CacheableKey>> &vecKeys) {
- fprintf(stdout, "vecKeys.size() = %zd\n", vecKeys.size());
+ std::cout << "vecKeys.size() = " << vecKeys.size() << "\n";
for (size_t i = 0; i < vecKeys.size(); i++) {
- fprintf(stdout, "key[%zd] - %s\n", i, vecKeys.at(i)->toString().c_str());
+ std::cout << "key[" << i << "] -" << vecKeys.at(i)->toString() << "\n";
}
- fflush(stdout);
+ std::cout << std::flush;
}
void CacheHelper::showRegionAttributes(RegionAttributes attributes) {
- printf("caching=%s\n", attributes.getCachingEnabled() ? "true" : "false");
- printf("Entry Time To Live = %s\n",
- to_string(attributes.getEntryTimeToLive()).c_str());
- printf("Entry Idle Timeout = %s\n",
- to_string(attributes.getEntryIdleTimeout()).c_str());
- printf("Region Time To Live = %s\n",
- to_string(attributes.getRegionTimeToLive()).c_str());
- printf("Region Idle Timeout = %s\n",
- to_string(attributes.getRegionIdleTimeout()).c_str());
- printf("Initial Capacity = %d\n", attributes.getInitialCapacity());
- printf("Load Factor = %f\n", attributes.getLoadFactor());
- printf("End Points = %s\n", attributes.getEndpoints().c_str());
+ std::cout << "caching=" << (attributes.getCachingEnabled() ? "true" : "false")
+ << "\n";
+ std::cout << "Entry Time To Live = "
+ << to_string(attributes.getEntryTimeToLive()) << "\n";
+ std::cout << "Entry Idle Timeout = "
+ << to_string(attributes.getEntryIdleTimeout()) << "\n";
+ std::cout << "Region Time To Live = "
+ << to_string(attributes.getRegionTimeToLive()) << "\n";
+ std::cout << "Region Idle Timeout = "
+ << to_string(attributes.getRegionIdleTimeout()) << "\n";
+ std::cout << "Initial Capacity = " << attributes.getInitialCapacity() << "\n";
+ std::cout << "Load Factor = " << attributes.getLoadFactor() << "\n";
+ std::cout << "End Points = " << attributes.getEndpoints() << "\n";
}
std::shared_ptr<QueryService> CacheHelper::getQueryService() {
@@ -928,7 +931,7 @@ const std::string CacheHelper::getTcrEndpoints(bool &isLocalServer,
}
isLocalServer = gflocalserver;
- printf("getHostPort :: %s \n", gfendpoints.c_str());
+ std::cout << "getHostPort :: " << gfendpoints << "\n";
return gfendpoints;
}
@@ -992,7 +995,7 @@ std::string CacheHelper::getLocatorHostPort(bool &isLocator,
isLocator = gflocator;
isLocalServer = gflocalserver;
- printf("getLocatorHostPort :: %s \n", gflchostport.c_str());
+ std::cout << "getLocatorHostPort :: " << gflchostport << "\n";
return gflchostport;
}
@@ -1016,9 +1019,9 @@ void CacheHelper::initServer(int instance, const std::string &xml,
if (!isServerCleanupCallbackRegistered &&
gClientCleanup.registerCallback(&CacheHelper::cleanupServerInstances)) {
isServerCleanupCallbackRegistered = true;
- printf("TimeBomb registered server cleanupcallback \n");
+ std::cout << "TimeBomb registered server cleanupcallback \n";
}
- printf("Inside initServer added\n");
+ std::cout << "Inside initServer added\n";
static const auto gfjavaenv = Utils::getEnv("GFJAVA");
static auto gfLogLevel = Utils::getEnv("GFE_LOGLEVEL");
@@ -1087,10 +1090,10 @@ void CacheHelper::initServer(int instance, const std::string &xml,
}
std::string xmlFile_new;
- printf(" xml file name = %s \n", xmlFile.c_str());
+ std::cout << " xml file name = " << xmlFile << "\n";
xmlFile = CacheHelper::createDuplicateXMLFile(xmlFile);
- printf(" creating dir = %s \n", sname.c_str());
+ std::cout << " creating dir = " << sname << "\n";
boost::filesystem::create_directory(sname);
int64_t defaultTombstone_timeout = 600000;
@@ -1141,7 +1144,7 @@ void CacheHelper::initServer(int instance, const std::string &xml,
server.execute();
staticServerInstanceList.push_back(instance);
- printf("added server instance %d\n", instance);
+ std::cout << "added server instance " << instance << "\n";
}
std::string CacheHelper::createDuplicateXMLFile(const std::string &source,
@@ -1165,8 +1168,8 @@ std::string CacheHelper::createDuplicateXMLFile(const std::string &source,
dest);
CacheHelper::staticConfigFileList.push_back(dest);
- printf("createDuplicateXMLFile added file %s %zd", dest.c_str(),
- CacheHelper::staticConfigFileList.size());
+ std::cout << "createDuplicateXMLFile added file " << dest.c_str() << " "
+ << CacheHelper::staticConfigFileList.size() << "\n";
return dest;
}
@@ -1497,7 +1500,7 @@ bool CacheHelper::setSeed() {
"Environment variable TESTNAME for test name is not set.");
int seed = std::hash<std::string>{}(testnameenv);
- printf("seed for process %d\n", seed);
+ std::cout << "seed for process " << seed << "\n";
// The integration tests rely on the pseudo-random
// number generator being seeded with a very particular
// value specific to the test by way of the test name.
diff --git a/cppcache/integration-test/InitSmartHeap.cpp b/cppcache/integration-test/InitSmartHeap.cpp
index 326d2d1..aed8315 100644
--- a/cppcache/integration-test/InitSmartHeap.cpp
+++ b/cppcache/integration-test/InitSmartHeap.cpp
@@ -24,4 +24,4 @@ class InitSmartHeap {
InitSmartHeap() {}
} doInit;
-}
+} // namespace geode_smartheap
diff --git a/cppcache/integration-test/QueryHelper.hpp b/cppcache/integration-test/QueryHelper.hpp
index bf14e2b..6a23b89 100644
--- a/cppcache/integration-test/QueryHelper.hpp
+++ b/cppcache/integration-test/QueryHelper.hpp
@@ -120,8 +120,7 @@ class QueryHelper {
for (int i = (sizeof(constantExpectedRowsRS) / sizeof(int)) - 1; i > -1;
i--) {
if (constantExpectedRowsRS[i] == queryindex) {
- printf("index %d is having constant rows \n",
- constantExpectedRowsRS[i]);
+ std::cout << "index " << constantExpectedRowsRS[i] << " is having constant rows \n";
return true;
}
}
@@ -133,8 +132,7 @@ class QueryHelper {
for (int i = (sizeof(constantExpectedRowsPQRS) / sizeof(int)) - 1; i > -1;
i--) {
if (constantExpectedRowsPQRS[i] == queryindex) {
- printf("index %d is having constant rows \n",
- constantExpectedRowsPQRS[i]);
+ std::cout << "index " << constantExpectedRowsPQRS[i] << " is having constant rows \n";
return true;
}
}
@@ -146,8 +144,7 @@ class QueryHelper {
for (int i = (sizeof(constantExpectedRowsSS) / sizeof(int)) - 1; i > -1;
i--) {
if (constantExpectedRowsSS[i] == queryindex) {
- printf("index %d is having constant rows \n",
- constantExpectedRowsSS[i]);
+ std::cout << "index " << constantExpectedRowsSS[i] << " is having constant rows \n";
return true;
}
}
@@ -159,8 +156,7 @@ class QueryHelper {
for (int i = (sizeof(constantExpectedRowsSSPQ) / sizeof(int)) - 1; i > -1;
i--) {
if (constantExpectedRowsSSPQ[i] == queryindex) {
- printf("index %d is having constant rows \n",
- constantExpectedRowsSSPQ[i]);
+ std::cout << "index " << constantExpectedRowsSSPQ[i] << " is having constant rows \n";
return true;
}
}
@@ -192,15 +188,11 @@ void QueryHelper::populatePortfolioData(
std::string key =
"port" + std::to_string(set) + '-' + std::to_string(current);
auto keyport = CacheableKey::create(key);
- // printf(" QueryHelper::populatePortfolioData creating key = %s and
- // puting data \n",portname);
rptr->put(keyport, port);
}
}
- // portfolioSetSize = setSize; portfolioNumSets = numSets; objectSize =
- // objSize;
- printf("all puts done \n");
+ std::cout << "all puts done \n";
}
const char* secIds[] = {"SUN", "IBM", "YHOO", "GOOG", "MSFT",
@@ -244,10 +236,8 @@ void QueryHelper::populatePortfolioPdxData(std::shared_ptr<Region>& rptr,
current);
}
}
- // portfolioSetSize = setSize; portfolioNumSets = numSets; objectSize =
- // objSize;
- printf("all puts done \n");
+ std::cout << "all puts done \n";
}
void QueryHelper::populatePositionPdxData(std::shared_ptr<Region>& rptr,
@@ -337,8 +327,10 @@ bool QueryHelper::verifyRS(std::shared_ptr<SelectResults>& resultSet,
foundRows++;
}
- printf("found rows %zd, expected %zd \n", foundRows, expectedRows);
- if (foundRows == expectedRows) return true;
+ std::cout << "found rows " << foundRows << ", expected " << expectedRows << "\n";
+ if (foundRows == expectedRows) {
+ return true;
+ }
}
return false;
}
@@ -353,7 +345,7 @@ bool QueryHelper::verifySS(std::shared_ptr<SelectResults>& structSet,
auto siptr = std::dynamic_pointer_cast<Struct>(ser);
if (siptr == nullptr) {
- printf("siptr is nullptr \n\n");
+ std::cout << "siptr is nullptr \n\n";
return false;
}
diff --git a/cppcache/integration-test/ThinClientDistOps.hpp b/cppcache/integration-test/ThinClientDistOps.hpp
index 91e7d88..2fb256c 100644
--- a/cppcache/integration-test/ThinClientDistOps.hpp
+++ b/cppcache/integration-test/ThinClientDistOps.hpp
@@ -174,8 +174,9 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -187,9 +188,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -203,9 +204,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
@@ -215,9 +216,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -391,9 +392,9 @@ void createEntryTwice(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -414,16 +415,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doGetAgain(const char* name, const char* key, const char* value) {
LOG("doGetAgain() entered.");
- fprintf(stdout,
- "get for entry -- key: %s expecting value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "get for entry -- key: " << key << " expecting value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "get region name%s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "get region name " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
@@ -431,7 +430,6 @@ void doGetAgain(const char* name, const char* key, const char* value) {
if (checkPtr != nullptr) {
LOG("checkPtr is not null");
- char buf[1024];
LOG(std::string("In doGetAgain, get returned ") + checkPtr->value() +
" for key " + key);
} else {
@@ -443,18 +441,15 @@ void doGetAgain(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
static int count = 0;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
@@ -499,10 +494,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateNonexistentServerRegion_Pooled_Locator)
FAIL(
"Expected exception when doing operations on a non-existent region.");
} catch (const CacheServerException& ex) {
- printf(
- "Got expected CacheServerException when performing operation "
- "on a non-existent region: %s\n",
- ex.what());
+ std::cout << "Got expected CacheServerException when performing operation on a non-existent region: " << ex.what() << "\n";
}
}
END_TASK_DEFINITION
@@ -517,10 +509,7 @@ DUNIT_TASK_DEFINITION(CLIENT1,
FAIL(
"Expected exception when doing operations on a non-existent region.");
} catch (const CacheServerException& ex) {
- printf(
- "Got expected CacheServerException when performing operation "
- "on a non-existent region: %s\n",
- ex.what());
+ std::cout << "Got expected CacheServerException when performing operation on a non-existent region: " << ex.what() << "\n";
}
}
END_TASK_DEFINITION
diff --git a/cppcache/integration-test/ThinClientFailover.hpp b/cppcache/integration-test/ThinClientFailover.hpp
index 7368a73..52337f4 100644
--- a/cppcache/integration-test/ThinClientFailover.hpp
+++ b/cppcache/integration-test/ThinClientFailover.hpp
@@ -150,8 +150,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -164,9 +165,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -180,9 +181,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
@@ -192,9 +193,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -217,9 +218,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -240,17 +241,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
diff --git a/cppcache/integration-test/ThinClientFailover2.hpp b/cppcache/integration-test/ThinClientFailover2.hpp
index d63afae..35f8aa6 100644
--- a/cppcache/integration-test/ThinClientFailover2.hpp
+++ b/cppcache/integration-test/ThinClientFailover2.hpp
@@ -170,8 +170,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -184,9 +185,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -195,9 +196,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
}
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -220,9 +221,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -243,16 +244,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
@@ -280,8 +279,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
void invalidateEntry(const char* name, const char* key) {
LOG("invalidateEntry() entered.");
- fprintf(stdout, "Invalidating entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Invalidating entry -- key: " << key << " in region " << name << "\n" << std::flush;
// Invalidate entry, verify entry is invalidated
auto keyPtr = CacheableKey::create(key);
@@ -301,8 +299,7 @@ void invalidateEntry(const char* name, const char* key) {
void destroyEntry(const char* name, const char* key) {
LOG("destroyEntry() entered.");
- fprintf(stdout, "Destroying entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Destroying entry -- key: " << key << " in region " << name << "\n" << std::flush;
// Destroy entry, verify entry is destroyed
auto keyPtr = CacheableKey::create(key);
diff --git a/cppcache/integration-test/ThinClientFailover3.hpp b/cppcache/integration-test/ThinClientFailover3.hpp
index cbd0062..e989caa 100644
--- a/cppcache/integration-test/ThinClientFailover3.hpp
+++ b/cppcache/integration-test/ThinClientFailover3.hpp
@@ -152,9 +152,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -163,9 +163,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
}
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -188,9 +188,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -209,16 +209,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientFailoverInterest.hpp b/cppcache/integration-test/ThinClientFailoverInterest.hpp
index fccf168..9b16643 100644
--- a/cppcache/integration-test/ThinClientFailoverInterest.hpp
+++ b/cppcache/integration-test/ThinClientFailoverInterest.hpp
@@ -174,8 +174,7 @@ void _verifyCreated(const char* name, const char* key, int line) {
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode << "\n";
// ack, not a mirror, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -188,9 +187,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -199,9 +198,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
}
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -224,9 +223,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -247,16 +246,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientFailoverInterest2.hpp b/cppcache/integration-test/ThinClientFailoverInterest2.hpp
index c34067c..1bd1cd4 100644
--- a/cppcache/integration-test/ThinClientFailoverInterest2.hpp
+++ b/cppcache/integration-test/ThinClientFailoverInterest2.hpp
@@ -173,8 +173,9 @@ void _verifyCreated(const char* name, const char* key, int line) {
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -187,9 +188,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -198,9 +199,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
}
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -223,9 +224,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -246,16 +247,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientFailoverRegex.hpp b/cppcache/integration-test/ThinClientFailoverRegex.hpp
index 2e4cbf2..6400c23 100644
--- a/cppcache/integration-test/ThinClientFailoverRegex.hpp
+++ b/cppcache/integration-test/ThinClientFailoverRegex.hpp
@@ -174,8 +174,9 @@ void _verifyCreated(const char* name, const char* key, int line) {
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -188,9 +189,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -199,9 +200,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
}
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -224,9 +225,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -247,16 +248,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientHeapLRU.hpp b/cppcache/integration-test/ThinClientHeapLRU.hpp
index b7e428e..de5989d 100644
--- a/cppcache/integration-test/ThinClientHeapLRU.hpp
+++ b/cppcache/integration-test/ThinClientHeapLRU.hpp
@@ -89,8 +89,9 @@ CacheHelper* getHelper() {
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -102,8 +103,9 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
diff --git a/cppcache/integration-test/ThinClientHelper.hpp b/cppcache/integration-test/ThinClientHelper.hpp
index 3e6b73e..8fc9566 100644
--- a/cppcache/integration-test/ThinClientHelper.hpp
+++ b/cppcache/integration-test/ThinClientHelper.hpp
@@ -341,8 +341,9 @@ void createRegion(const char* name, bool ackMode,
const std::shared_ptr<CacheListener>& listener = nullptr,
bool caching = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, caching, listener,
clientNotificationEnabled);
@@ -380,8 +381,9 @@ std::shared_ptr<Region> createPooledRegion(
const std::shared_ptr<CacheListener>& listener = nullptr,
bool caching = true) {
LOG("createPooledRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
if (cacheHelper == nullptr) {
cacheHelper = new CacheHelper(true, poolname, locators, nullptr);
@@ -469,9 +471,9 @@ std::shared_ptr<Region> createRegionAndAttachPool(
void createEntry(const std::string& name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name.c_str());
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -495,9 +497,9 @@ void createEntry(const std::string& name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value,
bool checkVal = true, bool checkKey = true) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -524,16 +526,14 @@ void updateEntry(const char* name, const char* key, const char* value,
void doNetsearch(const char* name, const char* key, const char* value,
bool checkVal = true) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
@@ -561,9 +561,9 @@ void doNetsearch(const char* name, const char* key, const char* value,
void createIntEntry(const char* name, const char* key, const int value,
bool onlyCreate = false) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %d in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
@@ -588,8 +588,7 @@ void createIntEntry(const char* name, const char* key, const int value,
void invalidateEntry(const char* name, const char* key) {
LOG("invalidateEntry() entered.");
- fprintf(stdout, "Invalidating entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Invalidating entry -- key: " << key << " in region " << name << "\n" << std::flush;
// Invalidate entry, verify entry is invalidated
auto keyPtr = CacheableKey::create(key);
@@ -609,8 +608,7 @@ void invalidateEntry(const char* name, const char* key) {
void destroyEntry(const char* name, const char* key) {
LOG("destroyEntry() entered.");
- fprintf(stdout, "Destroying entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Destroying entry -- key: " << key << " in region " << name << "\n" << std::flush;
// Destroy entry, verify entry is destroyed
auto keyPtr = CacheableKey::create(key);
diff --git a/cppcache/integration-test/ThinClientInterestList.hpp b/cppcache/integration-test/ThinClientInterestList.hpp
index 28dca93..73a0262 100644
--- a/cppcache/integration-test/ThinClientInterestList.hpp
+++ b/cppcache/integration-test/ThinClientInterestList.hpp
@@ -183,9 +183,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -195,9 +195,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -223,9 +223,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -246,16 +246,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientInterestList2.hpp b/cppcache/integration-test/ThinClientInterestList2.hpp
index d2f8fae..b33e701 100644
--- a/cppcache/integration-test/ThinClientInterestList2.hpp
+++ b/cppcache/integration-test/ThinClientInterestList2.hpp
@@ -183,9 +183,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locatorsG, poolname,
cachingEnable, clientNotificationEnabled);
@@ -195,9 +195,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -223,9 +223,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -246,16 +246,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientNotification.hpp b/cppcache/integration-test/ThinClientNotification.hpp
index 7d9dac3..857770a 100644
--- a/cppcache/integration-test/ThinClientNotification.hpp
+++ b/cppcache/integration-test/ThinClientNotification.hpp
@@ -169,9 +169,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -181,9 +181,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -206,9 +206,9 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -229,16 +229,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
/*NIL: Changed the asserion due to the change in invalidate.
@@ -266,8 +264,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
void invalidateEntry(const char* name, const char* key) {
LOG("invalidateEntry() entered.");
- fprintf(stdout, "Invalidating entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Invalidating entry -- key: " << key << " in region " << name << "\n" << std::flush;
// Invalidate entry, verify entry is invalidated
auto keyPtr = CacheableKey::create(key);
@@ -287,8 +284,7 @@ void invalidateEntry(const char* name, const char* key) {
void destroyEntry(const char* name, const char* key) {
LOG("destroyEntry() entered.");
- fprintf(stdout, "Destroying entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Destroying entry -- key: " << key << " in region " << name << "\n" << std::flush;
// Destroy entry, verify entry is destroyed
auto keyPtr = CacheableKey::create(key);
diff --git a/cppcache/integration-test/ThinClientPutAll.hpp b/cppcache/integration-test/ThinClientPutAll.hpp
index efeaec5..027df1b 100644
--- a/cppcache/integration-test/ThinClientPutAll.hpp
+++ b/cppcache/integration-test/ThinClientPutAll.hpp
@@ -191,8 +191,9 @@ void _verifyCreated(const char* name, const char* key, int line) {
void createRegion(const char* name, bool ackMode, bool isCacheEnabled,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, isCacheEnabled,
nullptr, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -204,9 +205,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -219,9 +220,9 @@ void createPooledRegionConcurrencyCheckDisabled(
const std::string& poolname, bool clientNotificationEnabled = false,
bool cachingEnable = true, bool concurrencyCheckEnabled = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionConcurrencyCheckDisabled(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled, concurrencyCheckEnabled);
@@ -232,9 +233,9 @@ void createPooledRegionConcurrencyCheckDisabled(
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -260,9 +261,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -283,16 +284,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientPutAllTimeout.hpp b/cppcache/integration-test/ThinClientPutAllTimeout.hpp
index 6d37674..10a221a 100644
--- a/cppcache/integration-test/ThinClientPutAllTimeout.hpp
+++ b/cppcache/integration-test/ThinClientPutAllTimeout.hpp
@@ -159,7 +159,7 @@ void putAllWithOneEntryTimeoutWithCallBackArg(
DUNIT_TASK_DEFINITION(CLIENT1, testTimeoutException)
{
- printf("start task testTimeoutException\n");
+ std::cout << "start task testTimeoutException\n";
auto regPtr = getHelper()->getRegion(regionNames[0]);
regPtr->registerAllKeys();
@@ -198,7 +198,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, testWithoutTimeoutException)
{
- printf("start task testWithoutTimeoutException\n");
+ std::cout << "start task testWithoutTimeoutException\n";
auto regPtr = getHelper()->getRegion(regionNames[0]);
// regPtr->registerAllKeys();
@@ -216,8 +216,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testWithoutTimeoutException)
logmsg += excp.what();
LOG(logmsg.c_str());
} catch (const Exception& ex) {
- printf("Exception while putALL :: %s : %s\n", ex.getName().c_str(),
- ex.what());
+ std::cout << "Exception while putAll :: " << ex.getName() << " : " << ex.what() << "\n";
}
FAIL("Something is wrong while putAll");
}
@@ -238,10 +237,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testWithoutTimeoutWithCallBackArgException)
logmsg += excp.what();
LOG(logmsg.c_str());
} catch (const Exception& ex) {
- printf(
- "Exception while putAllWithOneEntryTimeoutWithCallBackArg :: %s : "
- "%s\n",
- ex.getName().c_str(), ex.what());
+ std::cout << "Exception while putAllWithOneEntryTimeoutWithCallBackArg :: " << ex.getName() << " : " << ex.what() << "\n";
}
FAIL("Something is wrong while putAllWithOneEntryTimeoutWithCallBackArg");
}
diff --git a/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp b/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
index 040fa2e..5e08384 100644
--- a/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
+++ b/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
@@ -188,8 +188,9 @@ void _verifyCreated(const char* name, const char* key, int line) {
void createRegion(const char* name, bool ackMode, bool isCacheEnabled,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, isCacheEnabled,
nullptr, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -201,9 +202,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -216,9 +217,9 @@ void createPooledRegionConcurrencyCheckDisabled(
const std::string& poolname, bool clientNotificationEnabled = false,
bool cachingEnable = true, bool concurrencyCheckEnabled = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionConcurrencyCheckDisabled(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled, concurrencyCheckEnabled);
@@ -229,9 +230,9 @@ void createPooledRegionConcurrencyCheckDisabled(
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -257,9 +258,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -280,16 +281,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientPutGetAll.hpp b/cppcache/integration-test/ThinClientPutGetAll.hpp
index 3c0dbdb..cda143f 100644
--- a/cppcache/integration-test/ThinClientPutGetAll.hpp
+++ b/cppcache/integration-test/ThinClientPutGetAll.hpp
@@ -117,9 +117,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
diff --git a/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp b/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
index 5f25d8b..94037b5 100644
--- a/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
+++ b/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
@@ -126,9 +126,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
diff --git a/cppcache/integration-test/ThinClientRegex.hpp b/cppcache/integration-test/ThinClientRegex.hpp
index 2ebc971..099157f 100644
--- a/cppcache/integration-test/ThinClientRegex.hpp
+++ b/cppcache/integration-test/ThinClientRegex.hpp
@@ -165,9 +165,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -177,9 +177,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -205,9 +205,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -228,16 +228,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientRegex2.hpp b/cppcache/integration-test/ThinClientRegex2.hpp
index 3ec2219..daca6e4 100644
--- a/cppcache/integration-test/ThinClientRegex2.hpp
+++ b/cppcache/integration-test/ThinClientRegex2.hpp
@@ -163,8 +163,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
void createRegion(const char* name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -176,9 +177,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -188,9 +189,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -216,9 +217,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -239,17 +240,15 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
+
ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
diff --git a/cppcache/integration-test/ThinClientRegex3.hpp b/cppcache/integration-test/ThinClientRegex3.hpp
index 3c396cb..65cdf48 100644
--- a/cppcache/integration-test/ThinClientRegex3.hpp
+++ b/cppcache/integration-test/ThinClientRegex3.hpp
@@ -171,8 +171,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -184,9 +185,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -196,9 +197,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -224,9 +225,9 @@ void createEntry(const char* name, const char* key,
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -247,16 +248,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
fflush(stdout);
ASSERT(regPtr != nullptr, "Region not found.");
diff --git a/cppcache/integration-test/ThinClientRemoveAll.hpp b/cppcache/integration-test/ThinClientRemoveAll.hpp
index 980f00b..c786e32 100644
--- a/cppcache/integration-test/ThinClientRemoveAll.hpp
+++ b/cppcache/integration-test/ThinClientRemoveAll.hpp
@@ -93,8 +93,9 @@ const bool NO_ACK = false;
void createRegion(const char* name, bool ackMode, const char*,
bool isCacheEnabled, bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, isCacheEnabled,
nullptr, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -105,8 +106,9 @@ void createRegionLocal(const char* name, bool ackMode, const char*,
bool isCacheEnabled,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(
name, ackMode, isCacheEnabled, nullptr, clientNotificationEnabled, true);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -119,9 +121,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -134,8 +136,9 @@ void createPooledRegionConcurrencyCheckDisabled(
const char* poolname, bool clientNotificationEnabled = false,
bool cachingEnable = true, bool concurrencyCheckEnabled = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionConcurrencyCheckDisabled(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled, concurrencyCheckEnabled);
diff --git a/cppcache/integration-test/ThinClientSecurity.hpp b/cppcache/integration-test/ThinClientSecurity.hpp
index e112b08..d68d64d 100644
--- a/cppcache/integration-test/ThinClientSecurity.hpp
+++ b/cppcache/integration-test/ThinClientSecurity.hpp
@@ -62,7 +62,7 @@ void createRegionForSecurity(
poolName += "_" + std::to_string(index++);
}
- printf("createRegionForSecurity poolname = %s \n", poolName.c_str());
+ std::cout << "createRegionForSecurity poolname = " << poolName << "\n";
getHelper()->createPoolWithLocators(
poolName, locatorsG, clientNotificationEnabled, subscriptionRedundancy,
diff --git a/cppcache/integration-test/ThinClientSecurityHelper.hpp b/cppcache/integration-test/ThinClientSecurityHelper.hpp
index a56112b..c8ef291 100644
--- a/cppcache/integration-test/ThinClientSecurityHelper.hpp
+++ b/cppcache/integration-test/ThinClientSecurityHelper.hpp
@@ -132,29 +132,32 @@ void initClientAuth(char UserType) {
case 'W':
credentialGeneratorHandler->getAllowedCredentialsForOps(wr, config,
nullptr);
- printf("User is %s Pass is %s ",
- config->find("security-username")->value().c_str(),
- (config->find("security-password") != nullptr
- ? config->find("security-password")->value().c_str()
- : " not set"));
+ std::cout << "User is " << config->find("security-username")->value()
+ << " Pass is "
+ << (config->find("security-password") != nullptr
+ ? config->find("security-password")->value()
+ : " not set")
+ << "\n";
break;
case 'R':
credentialGeneratorHandler->getAllowedCredentialsForOps(rt, config,
nullptr);
- printf("User is %s Pass is %s ",
- config->find("security-username")->value().c_str(),
- (config->find("security-password") != nullptr
- ? config->find("security-password")->value().c_str()
- : " not set"));
+ std::cout << "User is " << config->find("security-username")->value()
+ << " Pass is "
+ << (config->find("security-password") != nullptr
+ ? config->find("security-password")->value()
+ : " not set")
+ << "\n";
break;
case 'A':
credentialGeneratorHandler->getAllowedCredentialsForOps(ad, config,
nullptr);
- printf("User is %s Pass is %s ",
- config->find("security-username")->value().c_str(),
- (config->find("security-password") != nullptr
- ? config->find("security-password")->value().c_str()
- : " not set"));
+ std::cout << "User is " << config->find("security-username")->value()
+ << " Pass is "
+ << (config->find("security-password") != nullptr
+ ? config->find("security-password")->value()
+ : " not set")
+ << "\n";
break;
default:
break;
@@ -261,8 +264,7 @@ class putThread : public ACE_Task_Base {
} catch (Exception& ex) {
auto tid =
boost::lexical_cast<std::string>(std::this_thread::get_id());
- printf("%d: %s exception got and exception message = %s\n", pid,
- tid.c_str(), ex.what());
+ std::cout << pid << ": " << tid << " exception got and exception message = " << ex.what() << "\n";
}
}
}
diff --git a/cppcache/integration-test/ThinClientTXFailover.hpp b/cppcache/integration-test/ThinClientTXFailover.hpp
index 6eb392e..40ad312 100644
--- a/cppcache/integration-test/ThinClientTXFailover.hpp
+++ b/cppcache/integration-test/ThinClientTXFailover.hpp
@@ -152,8 +152,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -166,9 +167,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -182,9 +183,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
@@ -194,9 +195,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -219,9 +220,10 @@ void createEntry(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
+
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -243,17 +245,16 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
+
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
+
ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
@@ -379,11 +380,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
FAIL("Expected exception when transaction delegate has gone away.");
} catch (const TransactionDataNodeHasDepartedException& ex) {
getHelper()->getCache()->getCacheTransactionManager()->rollback();
- printf(
- "Got expected TransactionDataNodeHasDepartedException when "
- "transaction "
- "delegate has gone away: %s\n",
- ex.what());
+ std::cout << "Got expected TransactionDataNodeHasDepartedException when "
+ "transaction delegate has gone away: "
+ << ex.what() << "\n";
}
LOG("StepSix complete.");
diff --git a/cppcache/integration-test/ThinClientTransactions.hpp b/cppcache/integration-test/ThinClientTransactions.hpp
index abaf177..d1f24a4 100644
--- a/cppcache/integration-test/ThinClientTransactions.hpp
+++ b/cppcache/integration-test/ThinClientTransactions.hpp
@@ -169,8 +169,9 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -182,9 +183,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -198,9 +199,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
@@ -210,9 +211,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -255,9 +256,10 @@ void createEntryTwice(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
+
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -278,16 +280,16 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doGetAgain(const char* name, const char* key, const char* value) {
LOG("doGetAgain() entered.");
- fprintf(stdout,
- "get for entry -- key: %s expecting value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
+
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "get region name%s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
+
ASSERT(regPtr != nullptr, "Region not found.");
auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
@@ -306,18 +308,17 @@ void doGetAgain(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
+
static int count = 0;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
+
ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
@@ -849,10 +850,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateNonexistentServerRegion_Pooled_Locator)
FAIL(
"Expected exception when doing operations on a non-existent region.");
} catch (const CacheServerException& ex) {
- printf(
- "Got expected CacheServerException when performing operation "
- "on a non-existent region: %s\n",
- ex.what());
+ std::cout << "Got expected CacheServerException when performing operation on a non-existent region: " << ex.what() << "\n";
}
}
END_TASK_DEFINITION
@@ -867,10 +865,7 @@ DUNIT_TASK_DEFINITION(CLIENT1,
FAIL(
"Expected exception when doing operations on a non-existent region.");
} catch (const CacheServerException& ex) {
- printf(
- "Got expected CacheServerException when performing operation "
- "on a non-existent region: %s\n",
- ex.what());
+ std::cout << "Got expected CacheServerException when performing operation on a non-existent region: " << ex.what() << "\n";
}
}
END_TASK_DEFINITION
diff --git a/cppcache/integration-test/ThinClientTransactionsXA.hpp b/cppcache/integration-test/ThinClientTransactionsXA.hpp
index d720d6e..faf335e 100644
--- a/cppcache/integration-test/ThinClientTransactionsXA.hpp
+++ b/cppcache/integration-test/ThinClientTransactionsXA.hpp
@@ -170,8 +170,9 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -183,9 +184,9 @@ void createPooledRegion(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -199,9 +200,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
@@ -211,9 +212,9 @@ void createPooledRegionSticky(const std::string& name, bool ackMode,
void createEntry(const char* name, const char* key, const char* value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -256,9 +257,9 @@ void createEntryTwice(const char* name, const char* key, const char* value) {
void updateEntry(const char* name, const char* key, const char* value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -279,16 +280,14 @@ void updateEntry(const char* name, const char* key, const char* value) {
void doGetAgain(const char* name, const char* key, const char* value) {
LOG("doGetAgain() entered.");
- fprintf(stdout,
- "get for entry -- key: %s expecting value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "get for entry -- key: " << key << " expecting value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "get region name%s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "get region name " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
@@ -307,18 +306,16 @@ void doGetAgain(const char* name, const char* key, const char* value) {
void doNetsearch(const char* name, const char* key, const char* value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
static int count = 0;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
+
ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
@@ -762,10 +759,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateNonexistentServerRegion_Pooled_Locator)
FAIL(
"Expected exception when doing operations on a non-existent region.");
} catch (const CacheServerException& ex) {
- printf(
- "Got expected CacheServerException when performing operation "
- "on a non-existent region: %s\n",
- ex.what());
+ std::cout << "Got expected CacheServerException when performing "
+ "operation on a non-existent region: "
+ << ex.what() << "\n";
}
}
END_TASK_DEFINITION
@@ -780,10 +776,9 @@ DUNIT_TASK_DEFINITION(CLIENT1,
FAIL(
"Expected exception when doing operations on a non-existent region.");
} catch (const CacheServerException& ex) {
- printf(
- "Got expected CacheServerException when performing operation "
- "on a non-existent region: %s\n",
- ex.what());
+ std::cout << "Got expected CacheServerException when performing "
+ "operation on a non-existent region: "
+ << ex.what() << "\n";
}
}
END_TASK_DEFINITION
diff --git a/cppcache/integration-test/TimeBomb.hpp b/cppcache/integration-test/TimeBomb.hpp
index ccb3b15..ae466f9 100644
--- a/cppcache/integration-test/TimeBomb.hpp
+++ b/cppcache/integration-test/TimeBomb.hpp
@@ -20,10 +20,12 @@
#ifndef GEODE_INTEGRATION_TEST_TIMEBOMB_H_
#define GEODE_INTEGRATION_TEST_TIMEBOMB_H_
+#include <iostream>
+#include <thread>
+
#include <ace/Task.h>
#include <assert.h>
-#include <thread>
#include "Utils.hpp"
@@ -38,7 +40,7 @@ class ClientCleanup {
ClientCleanup() : m_numberOfClient(0) {}
void callClientCleanup() {
- printf("callClientCleanup ... %d \n", m_numberOfClient);
+ std::cout << "callClientCleanup ... " << m_numberOfClient << "\n";
for (int i = 0; i < m_numberOfClient; i++) {
try {
m_cleanupCallback[i]();
@@ -92,7 +94,7 @@ class TimeBomb : public ACE_Task_Base {
int svc() override {
if (m_sleep == std::chrono::seconds{}) {
- printf("###### TIMEBOMB Disabled. ######\n");
+ std::cout << "###### TIMEBOMB Disabled. ######\n";
fflush(stdout);
return 0;
}
@@ -105,7 +107,7 @@ class TimeBomb : public ACE_Task_Base {
now = std::chrono::steady_clock::now();
} while ((now - start) < m_sleep);
- printf("####### ERROR: TIMEBOMB WENT OFF, TEST TIMED OUT ########\n");
+ std::cout << "####### ERROR: TIMEBOMB WENT OFF, TEST TIMED OUT ########\n";
fflush(stdout);
callClientCleanup();
diff --git a/cppcache/integration-test/fw_dunit.cpp b/cppcache/integration-test/fw_dunit.cpp
index e0353f3..aa2ac4d 100644
--- a/cppcache/integration-test/fw_dunit.cpp
+++ b/cppcache/integration-test/fw_dunit.cpp
@@ -380,15 +380,15 @@ class TestDriver {
public:
TestDriver() {
dunit::Dunit::init(true);
- fprintf(stdout, "Coordinator starting workers.\n");
+ std::cout << "Coordinator starting workers.\n";
for (uint32_t i = 1; i < 5; i++) {
std::string cmdline;
cmdline = g_programName + " -s" + std::to_string(i) + " -m" +
std::to_string(g_coordinatorPid);
- fprintf(stdout, "%s\n", cmdline.c_str());
+ std::cout << cmdline.c_str() << "\n";
m_workers[i - 1] = new TestProcess(cmdline, i);
}
- fflush(stdout);
+ std::cout << std::flush;
// start each of the workers...
for (uint32_t j = 1; j < 5; j++) {
m_workers[j - 1]->doWork();
@@ -410,9 +410,9 @@ class TestDriver {
}
int begin() {
- fprintf(stdout, "Coordinator started with pid %d\n",
- boost::this_process::get_id());
- fflush(stdout);
+ std::cout << "Coordinator started with pid "
+ << boost::this_process::get_id() << "\n"
+ << std::flush;
waitForReady();
// dispatch task...
@@ -421,8 +421,8 @@ class TestDriver {
while ((nextWorker = TaskQueues::getWorkerId()) != 0) {
WorkerId sId(nextWorker);
state->setWorkerState(nextWorker, WORKER_STATE_SCHEDULED);
- fprintf(stdout, "Set next process to %s\n", sId.getIdName());
- fflush(stdout);
+ std::cout << "Set next process to " << sId.getIdName() << "\n"
+ << std::flush;
state->setNextWorker(nextWorker);
waitForCompletion(sId);
@@ -451,9 +451,9 @@ class TestDriver {
secs = TASK_TIMEOUT;
}
- fprintf(stdout, "Waiting %d seconds for %s to finish task.\n", secs,
- sId.getIdName());
- fflush(stdout);
+ std::cout << "Waiting " << secs << " seconds for " << sId.getIdName()
+ << " to finish task.\n"
+ << std::flush;
auto end = std::chrono::steady_clock::now() + std::chrono::seconds{secs};
while (state->getWorkerState(id) != WORKER_STATE_TASK_COMPLETE) {
// sleep a bit..
@@ -472,8 +472,8 @@ class TestDriver {
}
void handleTimeout() {
- fprintf(stdout, "Error: Timed out waiting for all workers to be ready.\n");
- fflush(stdout);
+ std::cout << "Error: Timed out waiting for all workers to be ready.\n"
+ << std::flush;
auto state = DUNIT->getState();
state->terminate();
@@ -481,9 +481,9 @@ class TestDriver {
}
void handleTimeout(WorkerId &sId) {
- fprintf(stdout, "Error: Timed out waiting for %s to finish task.\n",
- sId.getIdName());
- fflush(stdout);
+ std::cout << "Error: Timed out waiting for " << sId.getIdName()
+ << " to finish task.\n"
+ << std::flush;
auto state = DUNIT->getState();
state->terminate();
@@ -494,17 +494,16 @@ class TestDriver {
* to be done initializing. */
void waitForReady() {
auto state = DUNIT->getState();
- fprintf(stdout, "Waiting %d seconds for all workers to be ready.\n",
- TASK_TIMEOUT);
- fflush(stdout);
+ std::cout << "Waiting " << TASK_TIMEOUT
+ << " seconds for all workers to be ready.\n"
+ << std::flush;
auto end =
std::chrono::steady_clock::now() + std::chrono::seconds{TASK_TIMEOUT};
uint32_t readyCount = 0;
while (readyCount < TestState::WORKER_COUNT) {
- fprintf(stdout, "Ready Count: %d\n", readyCount);
- fflush(stdout);
+ std::cout << "Ready Count: " << readyCount << "\n" << std::flush;
if (state->failed()) {
return;
@@ -532,9 +531,9 @@ class TestDriver {
/** wait for all workers to be destroyed. */
void waitForDone() {
auto state = DUNIT->getState();
- fprintf(stdout, "Waiting %d seconds for all workers to complete.\n",
- TASK_TIMEOUT);
- fflush(stdout);
+ std::cout << "Waiting " << TASK_TIMEOUT
+ << " seconds for all workers to complete.\n"
+ << std::flush;
uint32_t doneCount = 0;
auto end =
@@ -599,9 +598,9 @@ class TestWorker {
void begin() {
auto state = DUNIT->getState();
- fprintf(stdout, "Worker %s started with pid %d\n", m_sId.getIdName(),
- boost::this_process::get_id());
- fflush(stdout);
+ std::cout << "Worker " << m_sId.getIdName() << " started with pid "
+ << boost::this_process::get_id() << "\n"
+ << std::flush;
// consume tasks of this workers queue, only when it is his turn..
while (!state->terminated()) {
@@ -743,18 +742,17 @@ int dmain(int argc, char *argv[]) {
switch (option) {
case 's':
workerId = std::stoul(cmd_opts.opt_arg());
- fprintf(stdout, "Using process id: %d\n", workerId);
- fflush(stdout);
+ std::cout << "Using process id: " << workerId << "\n" << std::flush;
break;
case 'm':
g_coordinatorPid = std::stoul(cmd_opts.opt_arg());
- fprintf(stdout, "Using coordinator id: %d\n", g_coordinatorPid);
- fflush(stdout);
+ std::cout << "Using coordinator id: " << g_coordinatorPid << "\n"
+ << std::flush;
break;
default:
- fprintf(stdout, "ignoring option: %s with value %s\n",
- cmd_opts.last_option(), cmd_opts.opt_arg());
- fflush(stdout);
+ std::cout << "ignoring option: " << cmd_opts.last_option()
+ << " with value " << cmd_opts.opt_arg() << "\n"
+ << std::flush;
}
}
@@ -769,30 +767,31 @@ int dmain(int argc, char *argv[]) {
dunit::TestDriver tdriver;
result = tdriver.begin();
if (result == 0) {
- printf("#### All Tasks completed successfully. ####\n");
+ std::cout << "#### All Tasks completed successfully. ####\n";
} else {
- printf("#### FAILED. ####\n");
+ std::cout << "#### FAILED. ####\n";
}
fflush(stdout);
}
- printf("final worker id %d, result %d\n", workerId, result);
- printf("before calling cleanup %d \n", workerId);
+ std::cout << "final worker id " << workerId << ", result " << result
+ << "\n";
+ std::cout << "before calling cleanup " << workerId << "\n";
gClientCleanup.callClientCleanup();
- printf("after calling cleanup\n");
+ std::cout << "after calling cleanup\n";
return result;
} catch (dunit::TestException &te) {
te.print();
} catch (apache::geode::client::testframework::FwkException &fe) {
- printf("Exception: %s\n", fe.what());
- fflush(stdout);
+ std::cout << "Exception: " << fe.what() << "\n" << std::flush;
} catch (std::exception &ex) {
- printf("Exception: system exception reached main: %s.\n", ex.what());
- fflush(stdout);
+ std::cout << "Exception: system exception reached main: " << ex.what()
+ << ".\n"
+ << std::flush;
} catch (...) {
- printf("Exception: unhandled/unidentified exception reached main.\n");
- fflush(stdout);
+ std::cout << "Exception: unhandled/unidentified exception reached main.\n"
+ << std::flush;
}
gClientCleanup.callClientCleanup();
diff --git a/cppcache/integration-test/fw_dunit.hpp b/cppcache/integration-test/fw_dunit.hpp
index 9263707..eb9e486 100644
--- a/cppcache/integration-test/fw_dunit.hpp
+++ b/cppcache/integration-test/fw_dunit.hpp
@@ -115,6 +115,7 @@ END_TASK(validate)
#endif
#endif
+#include <iostream>
#include <string>
#include <boost/interprocess/managed_shared_memory.hpp>
@@ -311,9 +312,9 @@ class TestException {
: m_message(msg), m_lineno(lineno), m_filename(filename) {}
void print() {
- fprintf(stdout, "#### TestException: %s in %s at line %d\n",
- m_message.c_str(), m_filename.c_str(), m_lineno);
- fflush(stdout);
+ std::cout << "#### TestException: " << m_message << " in " << m_filename
+ << " at line " << m_lineno << "\n"
+ << std::flush;
}
std::string m_message;
int m_lineno;
diff --git a/cppcache/integration-test/fw_helper.hpp b/cppcache/integration-test/fw_helper.hpp
index 2f526dc..dedd4b4 100644
--- a/cppcache/integration-test/fw_helper.hpp
+++ b/cppcache/integration-test/fw_helper.hpp
@@ -82,11 +82,12 @@ BEGIN_TEST.
#endif
#endif
-#include <typeinfo>
+#include <cstdio>
+#include <iostream>
#include <list>
-#include <string>
#include <sstream>
-#include <cstdio>
+#include <string>
+#include <typeinfo>
#include <ace/ACE.h>
#include <ace/OS.h>
@@ -129,11 +130,11 @@ class TestException {
: m_message(msg), m_lineno(lineno), m_filename(filename) {}
void print() {
- fprintf(stdout, "--->%sTestException: %s in %s at line %d<---\n",
- apache::geode::client::Log::formatLogLine(
- apache::geode::client::LogLevel::Error)
- .c_str(),
- m_message.c_str(), m_filename.c_str(), m_lineno);
+ std::cout << "--->"
+ << apache::geode::client::Log::formatLogLine(
+ apache::geode::client::LogLevel::Error)
+ << "TestException: " << m_message << " in " << m_filename
+ << " at line " << m_lineno << "<---\n";
}
std::string m_message;
int m_lineno;
@@ -149,9 +150,9 @@ class TestOp {
virtual ~TestOp() {}
virtual void setup() {
- fprintf(stdout, "## running test - %s ##\n", m_name.c_str());
+ std::cout << "## running test - " << m_name << " ##\n";
}
- virtual void doTest() { fprintf(stdout, "do something useful.\n"); }
+ virtual void doTest() { std::cout << "do something useful.\n"; }
void run() {
try {
this->setup();
@@ -160,7 +161,7 @@ class TestOp {
e.print();
failed.push_back(m_name);
} catch (apache::geode::client::Exception& ge) {
- fprintf(stdout, "%s\n", ge.getStackTrace().c_str());
+ std::cout << ge.getStackTrace() << "\n";
failed.push_back(m_name);
}
}
@@ -181,7 +182,7 @@ std::list<SuiteMember> tests;
void TestOp::init() {
m_name = this->typeName();
tests.push_back(SuiteMember(this));
- fprintf(stdout, "Queued test[%s].\n", m_name.c_str());
+ std::cout << "Queued test[" << m_name << "].\n";
}
// main - suite trigger
@@ -201,7 +202,7 @@ int main(int /*argc*/, char** /*argv*/)
try {
int testsRun = 0;
int failures = 0;
- fprintf(stdout, "Beginning test Suite.\n");
+ std::cout << "Beginning test Suite.\n";
while (!tests.empty()) {
SuiteMember aTest = tests.front();
aTest.m_test->run();
@@ -210,19 +211,19 @@ int main(int /*argc*/, char** /*argv*/)
}
while (!failed.empty()) {
std::string name = failed.front();
- fprintf(stdout, "test named \"%s\" failed.\n", name.c_str());
+ std::cout << "test named \"" << name << "\" failed.\n";
failures++;
failed.pop_front();
}
if (failures != 0) {
- fprintf(stdout, "%d tests failed.\n", failures);
+ std::cout << failures << " tests failed.\n";
}
- fprintf(stdout, "%d tests passed.\n", (testsRun - failures));
+ std::cout << (testsRun - failures) << " tests passed.\n";
apache::geode::client::CppCacheLibrary::closeLib();
return failures;
} catch (...) {
- printf("Exception: unhandled/unidentified exception reached main.\n");
- fflush(stdout);
+ std::cout << "Exception: unhandled/unidentified exception reached main.\n"
+ << std::flush;
}
return 1;
}
diff --git a/cppcache/integration-test/testExpiration.cpp b/cppcache/integration-test/testExpiration.cpp
index 08b374c..76834b2 100644
--- a/cppcache/integration-test/testExpiration.cpp
+++ b/cppcache/integration-test/testExpiration.cpp
@@ -198,7 +198,7 @@ BEGIN_TEST(TEST_EXPIRATION)
n = getNumOfEntries(R5);
- printf("n == %zd\n", n);
+ std::cout << "n == " << n << "\n";
ASSERT(n == 1, "Expected 1 entry");
// std::this_thread::sleep_for(std::chrono::seconds(3));
diff --git a/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 0fde336..c019a8a 100644
--- a/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -61,8 +61,8 @@ static constexpr char const *kPersistenceDirStr = "PersistenceDirectory";
void getNumOfEntries(std::shared_ptr<Region> ®ionPtr, uint32_t num) {
auto v = regionPtr->keys();
auto vecValues = regionPtr->values();
- printf("Values vector size is %zd\n", vecValues.size());
- printf("Num is %d\n", num);
+ std::cout << "Values vector size is " << vecValues.size() << "\n";
+ std::cout << "Num is " << num << "\n";
ASSERT(vecValues.size() == num, "size of value vec and num not equal");
}
@@ -138,7 +138,7 @@ void checkOverflowToken(std::shared_ptr<Region> ®ionPtr, uint32_t lruLimit) {
int normalCount = 0;
int overflowCount = 0;
int invalidCount = 0;
- int destoyedCount = 0;
+ int destroyedCount = 0;
int tombstoneCount = 0;
for (uint32_t i = 0; i < static_cast<uint32_t>(v.size()); i++) {
keyPtr = v.at(i);
@@ -151,19 +151,19 @@ void checkOverflowToken(std::shared_ptr<Region> ®ionPtr, uint32_t lruLimit) {
} else if (CacheableToken::isInvalid(valuePtr)) {
invalidCount++;
} else if (CacheableToken::isDestroyed(valuePtr)) {
- destoyedCount++;
+ destroyedCount++;
} else if (valuePtr != nullptr) {
normalCount++;
}
valuePtr = nullptr;
}
- printf("Keys vector size is %zd\n", v.size());
- printf("Normal entries count is %d\n", normalCount);
- printf("Overflow entries count is %d\n", overflowCount);
- printf("Invalid entries count is %d\n", invalidCount);
- printf("Destoyed entries count is %d\n", destoyedCount);
- printf("Tombstone entries count is %d\n", tombstoneCount);
- printf("LRU entries limit is %d\n", lruLimit);
+ std::cout << "Keys vector size is " << v.size() << "\n";
+ std::cout << "Normal entries count is " << normalCount << "\n";
+ std::cout << "Overflow entries count is " << overflowCount << "\n";
+ std::cout << "Invalid entries count is " << invalidCount << "\n";
+ std::cout << "Destoyed entries count is " << destroyedCount << "\n";
+ std::cout << "Tombstone entries count is " << tombstoneCount << "\n";
+ std::cout << "LRU entries limit is " << lruLimit << "\n";
ASSERT(normalCount <= static_cast<int>(lruLimit),
"Normal entries count should not exceed LRU entries limit.");
}
@@ -180,7 +180,7 @@ void doNput(std::shared_ptr<Region> ®ionPtr, uint32_t num,
for (uint32_t i = start; i < num; i++) {
auto keyname = std::string("key-") + std::to_string(i);
auto key = CacheableKey::create(keyname);
- printf("Putting key = %s\n", keyname.c_str());
+ std::cout << "Putting key = " << keyname << "\n";
regionPtr->put(key, valuePtr);
}
}
@@ -195,16 +195,16 @@ uint32_t doNget(std::shared_ptr<Region> ®ionPtr, uint32_t num,
auto keyname = std::string("key-") + std::to_string(i);
auto valuePtr =
std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keyname));
- printf("Getting key = %s\n", keyname.c_str());
+ std::cout << "Getting key = " << keyname << "\n";
if (valuePtr == nullptr) {
countNotFound++;
} else {
countFound++;
}
}
- printf("completed doNget");
- printf("count found %d", countFound);
- printf("num found %d", num);
+ std::cout << "completed doNget";
+ std::cout << "count found " << countFound;
+ std::cout << "num found " << num;
ASSERT(countFound == (num - start),
"Number of entries found and put should match");
LOGINFO("found:%d and Not found: %d", countFound, countNotFound);
diff --git a/cppcache/integration-test/testSerialization.cpp b/cppcache/integration-test/testSerialization.cpp
index 3bd4b1a..6925b52 100644
--- a/cppcache/integration-test/testSerialization.cpp
+++ b/cppcache/integration-test/testSerialization.cpp
@@ -101,10 +101,12 @@ class OtherType : public DataSerializable {
ot->m_struct.d = ((2.0) * static_cast<double>(i));
ot->m_struct.e = (static_cast<uint64_t>(i) << 32) + i;
- printf("Created OtherType: %d, %s, %c, %e\n", ot->m_struct.a,
- ot->m_struct.b ? "true" : "false", ot->m_struct.c, ot->m_struct.d);
+ std::cout << "Created OtherType: " << ot->m_struct.a << ", "
+ << (ot->m_struct.b ? "true" : "false") << ", " << ot->m_struct.c
+ << ", " << ot->m_struct.d << "\n";
- printf("double hex 0x%016" PRIX64 "\n", ot->m_struct.e);
+ std::cout << "double hex 0x" << std::setw(16) << std::setfill('0')
+ << ot->m_struct.e << "\n";
return std::move(ot);
}
@@ -115,10 +117,12 @@ class OtherType : public DataSerializable {
auto ot = std::dynamic_pointer_cast<OtherType>(otPtr);
XASSERT(ot != nullptr);
- printf("Validating OtherType: %d, %s, %c, %e\n", ot->m_struct.a,
- ot->m_struct.b ? "true" : "false", ot->m_struct.c, ot->m_struct.d);
+ std::cout << "Validating OtherType: " << ot->m_struct.a << ", "
+ << (ot->m_struct.b ? "true" : "false") << ", " << ot->m_struct.c
+ << ", " << ot->m_struct.d << "\n";
- printf("double hex 0x%016" PRIX64 "\n", ot->m_struct.e);
+ std::cout << "double hex 0x" << std::setw(16) << std::setfill('0')
+ << ot->m_struct.e << "\n";
XASSERT(ot->m_struct.a == static_cast<int>(i));
XASSERT(ot->m_struct.b == ((i % 2 == 0) ? true : false));
diff --git a/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
index bc23847..bd58a14 100644
--- a/cppcache/integration-test/testThinClientCacheableStringArray.cpp
+++ b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
@@ -106,16 +106,17 @@ DUNIT_TASK(CLIENT1, StepThree)
count--;
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(ser)) {
- printf(" query pulled portfolio object ID %d, pkid %s\n",
- portfolio->getID(), portfolio->getPkid()->value().c_str());
+ std::cout << " query pulled portfolio object ID "
+ << portfolio->getID() << ", pkid "
+ << portfolio->getPkid()->value() << "\n";
} else if (auto position = std::dynamic_pointer_cast<Position>(ser)) {
- printf(" query pulled position object secId %s, shares %d\n",
- position->getSecId()->value().c_str(),
- position->getSharesOutstanding());
+ std::cout << " query pulled position object secId "
+ << position->getSecId()->value() << ", shares "
+ << position->getSharesOutstanding() << "\n";
} else if (ser) {
- printf(" query pulled object %s\n", ser->toString().c_str());
+ std::cout << " query pulled object " << ser->toString() << "\n";
} else {
- printf(" query pulled nullptr object\n");
+ std::cout << " query pulled nullptr object\n";
}
}
LOG(std::string("results last count=") + std::to_string(count));
diff --git a/cppcache/integration-test/testThinClientCacheables.cpp b/cppcache/integration-test/testThinClientCacheables.cpp
index f4912b9..8aa1f22 100644
--- a/cppcache/integration-test/testThinClientCacheables.cpp
+++ b/cppcache/integration-test/testThinClientCacheables.cpp
@@ -25,6 +25,7 @@
#include <ace/OS.h>
#include <ace/High_Res_Timer.h>
+#include <iostream>
#include <string>
#include "CacheHelper.hpp"
@@ -78,8 +79,9 @@ CacheHelper *getHelper() {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -107,8 +109,8 @@ void checkGets(int maxKeys, DSCode keyTypeId, DSCode valTypeId,
auto int32val = std::dynamic_pointer_cast<CacheableInt32>(
verifyReg->get(static_cast<int32_t>(keychksum)));
if (int32val == nullptr) {
- printf("GetsTask::keychksum: %u, key: %s\n", keychksum,
- Utils::nullSafeToString(key).c_str());
+ std::cout << "GetsTask::keychksum: " << keychksum
+ << ", key: " << Utils::nullSafeToString(key) << "\n";
FAIL("Could not find the checksum for the given key.");
}
uint32_t valchksum = static_cast<uint32_t>(int32val->value());
@@ -168,10 +170,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
DSCode keyTypeId = keyTypes[keyTypeIndex];
DSCode valTypeId = valueTypes[valueTypeIndex];
- printf("PutsTask::keyType = %s and valType = %s and taskIndexPut = %d\n",
- CacheableWrapperFactory::getTypeForId(keyTypeId).c_str(),
- CacheableWrapperFactory::getTypeForId(valTypeId).c_str(),
- taskIndexPut);
+ std::cout << "PutsTask::keyType = "
+ << CacheableWrapperFactory::getTypeForId(keyTypeId)
+ << " and valType = "
+ << CacheableWrapperFactory::getTypeForId(valTypeId)
+ << " and taskIndexPut = " << taskIndexPut << "\n";
CacheableWrapper *key = CacheableWrapperFactory::createInstance(keyTypeId);
int maxKeys =
@@ -241,10 +244,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetsTask)
DSCode keyTypeId = keyTypes[keyTypeIndex];
DSCode valTypeId = valueTypes[valueTypeIndex];
- printf("GetsTask::keyType = %s and valType = %s and taskIndexGet = %d\n",
- CacheableWrapperFactory::getTypeForId(keyTypeId).c_str(),
- CacheableWrapperFactory::getTypeForId(valTypeId).c_str(),
- taskIndexGet);
+ std::cout << "GetsTask::keyType = "
+ << CacheableWrapperFactory::getTypeForId(keyTypeId)
+ << " and valType = "
+ << CacheableWrapperFactory::getTypeForId(valTypeId)
+ << " and taskIndexGet = " << taskIndexGet << "\n";
CacheableWrapper *key = CacheableWrapperFactory::createInstance(keyTypeId);
int maxKeys =
diff --git a/cppcache/integration-test/testThinClientCacheablesLimits.cpp b/cppcache/integration-test/testThinClientCacheablesLimits.cpp
index b6cf0d3..4d13e04 100644
--- a/cppcache/integration-test/testThinClientCacheablesLimits.cpp
+++ b/cppcache/integration-test/testThinClientCacheablesLimits.cpp
@@ -59,8 +59,9 @@ static char charArray[] = {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, false, nullptr,
clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
diff --git a/cppcache/integration-test/testThinClientCqDelta.cpp b/cppcache/integration-test/testThinClientCqDelta.cpp
index 7eb6b1a..ff52730 100644
--- a/cppcache/integration-test/testThinClientCqDelta.cpp
+++ b/cppcache/integration-test/testThinClientCqDelta.cpp
@@ -112,9 +112,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name.c_str() << " ackMode is "
+ << ackMode << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -138,8 +138,9 @@ void createPooledLRURegion(const char *name, bool ackMode, const char *locators,
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
diff --git a/cppcache/integration-test/testThinClientCqHAFailover.cpp b/cppcache/integration-test/testThinClientCqHAFailover.cpp
index 3a638fa..7016a7e 100644
--- a/cppcache/integration-test/testThinClientCqHAFailover.cpp
+++ b/cppcache/integration-test/testThinClientCqHAFailover.cpp
@@ -230,16 +230,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
for (auto &&ser : hacks::range(*results)) {
count--;
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(ser)) {
- printf(" query pulled portfolio object ID %d, pkid %s\n",
- portfolio->getID(), portfolio->getPkid()->value().c_str());
+ std::cout << " query pulled portfolio object ID "
+ << portfolio->getID() << ", pkid "
+ << portfolio->getPkid()->value() << "\n";
} else if (auto position = std::dynamic_pointer_cast<Position>(ser)) {
- printf(" query pulled position object secId %s, shares %d\n",
- position->getSecId()->value().c_str(),
- position->getSharesOutstanding());
+ std::cout << " query pulled position object secId "
+ << position->getSecId()->value() << ", shares "
+ << position->getSharesOutstanding() << "\n";
} else if (ser) {
- printf(" query pulled object %s\n", ser->toString().c_str());
+ std::cout << " query pulled object " << ser->toString() << "\n";
} else {
- printf(" query pulled nullptr object\n");
+ std::cout << " query pulled nullptr object\n";
}
}
LOG(std::string("results last count=") + std::to_string(count));
diff --git a/cppcache/integration-test/testThinClientCqIR.cpp b/cppcache/integration-test/testThinClientCqIR.cpp
index 3d3c7d2..a0c724e 100644
--- a/cppcache/integration-test/testThinClientCqIR.cpp
+++ b/cppcache/integration-test/testThinClientCqIR.cpp
@@ -192,7 +192,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
count--;
if (ser) {
- printf(" query pulled object '%s'\n", ser->toString().c_str());
+ std::cout << " query pulled object '" << ser->toString() << "'\n";
auto stPtr = std::dynamic_pointer_cast<Struct>(ser);
ASSERT(stPtr != nullptr, "Failed to get struct in CQ result.");
@@ -202,7 +202,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
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().c_str());
+ std::cout << " got struct key '" << serKey->toString() << "'\n";
}
auto serVal = (*stPtr)["value"];
@@ -210,10 +210,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
if (serVal != nullptr) {
LOG("got struct value ");
- printf(" got struct value '%s'\n", serVal->toString().c_str());
+ std::cout << " got struct value '" << serVal->toString() << "'\n";
}
} else {
- printf(" query pulled bad object\n");
+ std::cout << " query pulled bad object\n";
}
}
LOG(std::string("results last count=") + std::to_string(count));
@@ -231,7 +231,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
count--;
if (ser) {
- printf(" query pulled object '%s'\n", ser->toString().c_str());
+ std::cout << " query pulled object '" << ser->toString() << "'\n";
auto stPtr = std::dynamic_pointer_cast<Struct>(ser);
ASSERT(stPtr != nullptr, "Failed to get struct in CQ result.");
@@ -241,7 +241,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
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().c_str());
+ std::cout << " got struct key '" << serKey->toString() << "'\n";
}
auto serVal = (*stPtr)["value"];
@@ -249,10 +249,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
if (serVal != nullptr) {
LOG("got struct value ");
- printf(" got struct value '%s'\n", serVal->toString().c_str());
+ std::cout << " got struct value '" << serVal->toString() << "'\n";
}
} else {
- printf(" query pulled bad object\n");
+ std::cout << " query pulled bad object\n";
}
}
LOG(std::string("results last count=") + std::to_string(count));
diff --git a/cppcache/integration-test/testThinClientDeltaWithNotification.cpp b/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
index db61c81..5c28221 100644
--- a/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
+++ b/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
@@ -84,9 +84,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -120,7 +120,9 @@ void createPooledLRURegion(const std::string &name, bool ackMode,
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
fflush(stdout);
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
diff --git a/cppcache/integration-test/testThinClientHADistOps.cpp b/cppcache/integration-test/testThinClientHADistOps.cpp
index c74e6f7..29b0f49 100644
--- a/cppcache/integration-test/testThinClientHADistOps.cpp
+++ b/cppcache/integration-test/testThinClientHADistOps.cpp
@@ -187,8 +187,9 @@ void _verifyEntry(const char *name, const char *key, const char *val,
void destroyEntry(const char *name, const char *key) {
LOG("destroyEntry() entered.");
- fprintf(stdout, "Destroying entry -- key: %s in region %s\n", key, name);
- fflush(stdout);
+ std::cout << "Destroying entry -- key: " << key << " in region " << name
+ << "\n"
+ << std::flush;
// Destroy entry, verify entry is destroyed
auto keyPtr = CacheableKey::create(key);
@@ -207,8 +208,9 @@ void destroyEntry(const char *name, const char *key) {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
char *endpoints = nullptr;
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
@@ -221,8 +223,9 @@ void createPooledRegion(const char *name, bool ackMode, const char *locators,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto poolPtr = getHelper()->createPool(
poolname, locators, nullptr, reduendency, clientNotificationEnabled);
auto regPtr = getHelper()->createRegionAndAttachPool(name, ackMode, poolname,
@@ -232,9 +235,9 @@ void createPooledRegion(const char *name, bool ackMode, const char *locators,
}
void createEntry(const char *name, const char *key, const char *value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -257,9 +260,9 @@ void createEntry(const char *name, const char *key, const char *value) {
void updateEntry(const char *name, const char *key, const char *value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -280,16 +283,14 @@ void updateEntry(const char *name, const char *key, const char *value) {
void doGetAgain(const char *name, const char *key, const char *value) {
LOG("doGetAgain() entered.");
- fprintf(stdout,
- "get for entry -- key: %s expecting value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "get for entry -- key: " << key << " expecting value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "get region name%s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "get region name " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
@@ -308,18 +309,15 @@ void doGetAgain(const char *name, const char *key, const char *value) {
void doNetsearch(const char *name, const char *key, const char *value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
static int count = 0;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
diff --git a/cppcache/integration-test/testThinClientHAEventIDMap.cpp b/cppcache/integration-test/testThinClientHAEventIDMap.cpp
index 035c15f..d3e3740 100644
--- a/cppcache/integration-test/testThinClientHAEventIDMap.cpp
+++ b/cppcache/integration-test/testThinClientHAEventIDMap.cpp
@@ -328,8 +328,9 @@ void _verifyCreated(const char *name, const char *key, int line) {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
char *endpoints = nullptr;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
@@ -340,9 +341,9 @@ void createRegion(const char *name, bool ackMode,
void createEntry(const char *name, const char *key, const char *value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -365,9 +366,9 @@ void createEntry(const char *name, const char *key, const char *value) {
void createIntEntry(const char *name, const char *key, const int value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %d in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableInt32::create(value);
diff --git a/cppcache/integration-test/testThinClientHAFailover.cpp b/cppcache/integration-test/testThinClientHAFailover.cpp
index b9038c4..8274317 100644
--- a/cppcache/integration-test/testThinClientHAFailover.cpp
+++ b/cppcache/integration-test/testThinClientHAFailover.cpp
@@ -195,8 +195,9 @@ void _verifyCreated(const char *name, const char *key, int line) {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
char *endpoints = nullptr;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
@@ -206,9 +207,9 @@ void createRegion(const char *name, bool ackMode,
}
void createEntry(const char *name, const char *key, const char *value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -231,9 +232,9 @@ void createEntry(const char *name, const char *key, const char *value) {
void updateEntry(const char *name, const char *key, const char *value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -254,17 +255,14 @@ void updateEntry(const char *name, const char *key, const char *value) {
void doNetsearch(const char *name, const char *key, const char *value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
diff --git a/cppcache/integration-test/testThinClientHAFailoverRegex.cpp b/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
index 513758a..253bbac 100644
--- a/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
+++ b/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
@@ -173,8 +173,9 @@ void _verifyCreated(const char *name, const char *key, int line) {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
@@ -184,9 +185,9 @@ void createRegion(const char *name, bool ackMode,
void createEntry(const char *name, const char *key, const char *value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -209,9 +210,9 @@ void createEntry(const char *name, const char *key, const char *value) {
void updateEntry(const char *name, const char *key, const char *value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -232,17 +233,14 @@ void updateEntry(const char *name, const char *key, const char *value) {
void doNetsearch(const char *name, const char *key, const char *value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
diff --git a/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp b/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
index 7084f6d..355df76 100644
--- a/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
+++ b/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
@@ -176,8 +176,9 @@ void _verifyCreated(const char *name, const char *key, int line) {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
char *endpoints = nullptr;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
@@ -188,9 +189,9 @@ void createRegion(const char *name, bool ackMode,
void createEntry(const char *name, const char *key, const char *value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -213,9 +214,9 @@ void createEntry(const char *name, const char *key, const char *value) {
void updateEntry(const char *name, const char *key, const char *value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -236,17 +237,14 @@ void updateEntry(const char *name, const char *key, const char *value) {
void doNetsearch(const char *name, const char *key, const char *value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
diff --git a/cppcache/integration-test/testThinClientHAPeriodicAck.cpp b/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
index 2e8c32c..964f5d0 100644
--- a/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
+++ b/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
@@ -344,8 +344,9 @@ void _verifyCreated(const char *name, const char *key, int line) {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
char *endpoints = nullptr;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
@@ -356,9 +357,9 @@ void createRegion(const char *name, bool ackMode,
void createEntry(const char *name, const char *key, const char *value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -381,9 +382,9 @@ void createEntry(const char *name, const char *key, const char *value) {
void createIntEntry(const char *name, const char *key, const int value) {
LOG("createEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %d in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableInt32::create(value);
diff --git a/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/cppcache/integration-test/testThinClientHAQueryFailover.cpp
index c53a48b..d31d57c 100644
--- a/cppcache/integration-test/testThinClientHAQueryFailover.cpp
+++ b/cppcache/integration-test/testThinClientHAQueryFailover.cpp
@@ -129,8 +129,9 @@ CacheHelper *getHelper() {
void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
char *endpoints = nullptr;
auto regPtr = getHelper()->createRegion(name, ackMode, false, nullptr,
endpoints, clientNotificationEnabled);
@@ -216,24 +217,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
std::shared_ptr<SelectResults> results;
- // try
- //{
results = qry->execute();
- //}
- /*
- catch(IllegalStateException &)
- {
- printf("IllegalStateException occurred at iteration %d\n", i);
- //SLEEP(1000);
- continue;
- }
- catch(Exception &)
- {
- printf("Exception occurred at iteration %d\n", i);
- //SLEEP(1000);
- continue;
- }
- */
if (i == 10) {
kst->start();
@@ -243,11 +227,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
auto resultsize = results->size();
if (i % 100 == 0) {
- printf("Iteration upto %d done, result size is %zd\n", i, resultsize);
+ std::cout << "Iteration upto " << i << " done, result size is "
+ << resultsize << "\n";
}
- // ASSERT(resultsize==4, "Failed verification");
-
if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2
// entries respectively
{
diff --git a/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp b/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
index 72df9a3..d918856 100644
--- a/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
+++ b/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
@@ -178,8 +178,9 @@ void _verifyCreated(const char *name, const char *key, int line) {
void createRegion(const char *name, bool ackMode, const char *endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -188,9 +189,9 @@ void createRegion(const char *name, bool ackMode, const char *endpoints,
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);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Create entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
if (value == nullptr) {
@@ -216,9 +217,9 @@ void createEntry(const char *name, const char *key,
void updateEntry(const char *name, const char *key, const char *value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -239,17 +240,14 @@ void updateEntry(const char *name, const char *key, const char *value) {
void doNetsearch(const char *name, const char *key, const char *value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
diff --git a/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp b/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
index 88e1c13..7697fb3 100644
--- a/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
+++ b/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
@@ -31,18 +31,16 @@ using apache::geode::client::CacheableKey;
using apache::geode::client::Exception;
std::shared_ptr<CacheableString> getUString(int index) {
+ std::wostringstream strm;
std::wstring baseStr(40, L'\x20AC');
- wchar_t indexStr[15];
- swprintf(indexStr, 14, L"%10d", index);
- baseStr.append(indexStr);
- return CacheableString::create(baseStr);
+ strm << baseStr << std::setw(10) << std::setfill(L'0') << index;
+ return CacheableString::create(strm.str());
}
std::shared_ptr<CacheableString> getUAString(int index) {
+ std::wostringstream strm;
std::wstring baseStr(40, L'A');
- wchar_t indexStr[15];
- swprintf(indexStr, 14, L"%10d", index);
- baseStr.append(indexStr);
- return CacheableString::create(baseStr);
+ strm << baseStr << std::setw(10) << std::setfill(L'0') << index;
+ return CacheableString::create(strm.str());
}
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1)
@@ -238,7 +236,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckUpdateBug1001)
auto lCStringP = CacheableString::create(str);
lCStringP->value();
} catch (const Exception &geodeExcp) {
- printf("%s: %s", geodeExcp.getName().c_str(), geodeExcp.what());
+ std::cout << geodeExcp.getName() << " : " << geodeExcp.what();
FAIL("Should not have got exception.");
}
@@ -250,7 +248,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckUpdateBug1001)
auto lCStringP = CacheableString::create(str);
lCStringP->value();
} catch (const Exception &geodeExcp) {
- printf("%s: %s", geodeExcp.getName().c_str(), geodeExcp.what());
+ std::cout << geodeExcp.getName() << " : " << geodeExcp.what();
FAIL("Should not have got exception.");
}
diff --git a/cppcache/integration-test/testThinClientLRUExpiration.cpp b/cppcache/integration-test/testThinClientLRUExpiration.cpp
index b7e973d..7fdb66b 100644
--- a/cppcache/integration-test/testThinClientLRUExpiration.cpp
+++ b/cppcache/integration-test/testThinClientLRUExpiration.cpp
@@ -82,32 +82,32 @@ CacheHelper *getHelper() {
void printAttribute(RegionAttributes attr) {
using apache::geode::internal::chrono::duration::to_string;
- printf("CachingEnable: %s\n",
- attr.getCachingEnabled() ? "enabled" : "disabled");
- printf("InitialCapacity: %d\n", attr.getInitialCapacity());
- printf("LoadFactor: %f\n", attr.getLoadFactor());
- printf("ConcurencyLevel: %d\n", attr.getConcurrencyLevel());
- printf("RegionTimeToLive: %s\n",
- to_string(attr.getRegionTimeToLive()).c_str());
- printf("RegionIdleTimeout: %s\n",
- to_string(attr.getRegionIdleTimeout()).c_str());
- printf("EntryTimeToLive: %s\n", to_string(attr.getEntryTimeToLive()).c_str());
- printf("EntryIdleTimeout: %s\n",
- to_string(attr.getEntryIdleTimeout()).c_str());
- printf("getLruEntriesLimit: %d\n", attr.getLruEntriesLimit());
- printf("RegionTimeToLiveAction: %d\n",
- static_cast<int>(attr.getRegionTimeToLiveAction()));
- printf("RegionIdleTimeoutAction: %d\n",
- static_cast<int>(attr.getRegionIdleTimeoutAction()));
- printf("EntryTimeToLiveAction: %d\n",
- static_cast<int>(attr.getEntryTimeToLiveAction()));
- printf("EntryIdleTimeoutAction: %d\n",
- static_cast<int>(attr.getEntryIdleTimeoutAction()));
- printf("LruEvictionAction: %d\n",
- static_cast<int>(attr.getLruEvictionAction()));
- printf("ClientNotification: %s\n",
- attr.getClientNotificationEnabled() ? "true" : "false");
- // printf("getEndPoint: %s\n",attr.getEndpoints());
+ std::cout << "CachingEnable: "
+ << (attr.getCachingEnabled() ? "enabled" : "disabled") << "\n";
+ std::cout << "InitialCapacity: " << attr.getInitialCapacity() << "\n";
+ std::cout << "LoadFactor: " << attr.getLoadFactor() << "\n";
+ std::cout << "ConcurencyLevel: " << attr.getConcurrencyLevel() << "\n";
+ std::cout << "RegionTimeToLive: " << to_string(attr.getRegionTimeToLive())
+ << "\n";
+ std::cout << "RegionIdleTimeout: " << to_string(attr.getRegionIdleTimeout())
+ << "\n";
+ std::cout << "EntryTimeToLive: " << to_string(attr.getEntryTimeToLive())
+ << "\n";
+ std::cout << "EntryIdleTimeout: " << to_string(attr.getEntryIdleTimeout())
+ << "\n";
+ std::cout << "getLruEntriesLimit: " << attr.getLruEntriesLimit() << "\n";
+ std::cout << "RegionTimeToLiveAction: "
+ << static_cast<int>(attr.getRegionTimeToLiveAction()) << "\n";
+ std::cout << "RegionIdleTimeoutAction: "
+ << static_cast<int>(attr.getRegionIdleTimeoutAction()) << "\n";
+ std::cout << "EntryTimeToLiveAction: "
+ << static_cast<int>(attr.getEntryTimeToLiveAction()) << "\n";
+ std::cout << "EntryIdleTimeoutAction: "
+ << static_cast<int>(attr.getEntryIdleTimeoutAction()) << "\n";
+ std::cout << "LruEvictionAction: "
+ << static_cast<int>(attr.getLruEvictionAction()) << "\n";
+ std::cout << "ClientNotification: "
+ << (attr.getClientNotificationEnabled() ? "true" : "false") << "\n";
}
void setCacheListener(const char *regName,
@@ -153,8 +153,9 @@ void createRegion(const char *name, bool ackMode,
const std::chrono::seconds &rttl,
const std::chrono::seconds &rit, int lel,
ExpirationAction action = ExpirationAction::DESTROY) {
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto
regPtr = // getHelper()->createRegion( name, ackMode, true,
// ettl,eit,rttl,rit,lel,action,endpoints,clientNotificationEnabled
@@ -202,11 +203,12 @@ void doRgnOperations(const char *name, int n, int rgnOpt = 0) {
void dumpCounters(const char *regName) {
auto rptr = getHelper()->getRegion(regName);
- printf("Region size: %d\n", rptr->size());
+ std::cout << "Region size: " << rptr->size() << "\n";
if (regListener != nullptr) {
- printf("counts:: creates: %d, updates: %d, invalidates: %d, destroys: %d\n",
- regListener->getCreates(), regListener->getUpdates(),
- regListener->getInvalidates(), regListener->getDestroys());
+ std::cout << "counts:: creates: " << regListener->getCreates()
+ << ", updates: " << regListener->getUpdates()
+ << ", invalidates: " << regListener->getInvalidates()
+ << ", destroys: " << regListener->getDestroys() << "\n";
}
}
@@ -218,11 +220,11 @@ size_t getNumOfEntries(const char *regName, bool isValue = false) {
auto rptr = getHelper()->getRegion(regName);
if (isValue) {
auto v = rptr->values();
- printf("Region value size: %zd\n", v.size());
+ std::cout << "Region value size: " << v.size() << "\n";
return v.size();
} else if (!useRegionSize) {
auto v = rptr->keys();
- printf("Region key size: %zd\n", v.size());
+ std::cout << "Region key size: " << v.size() << "\n";
return v.size();
} else {
return rptr->size();
diff --git a/cppcache/integration-test/testThinClientListenerEvents.cpp b/cppcache/integration-test/testThinClientListenerEvents.cpp
index a102f13..4406ca8 100644
--- a/cppcache/integration-test/testThinClientListenerEvents.cpp
+++ b/cppcache/integration-test/testThinClientListenerEvents.cpp
@@ -104,11 +104,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, doRemoteGet)
int toalFunCall = regListener1->getCount();
ASSERT(4 == toalFunCall,
"afterCreate() did not call expected number of times");
- // printf("[NIL_DEBUG_DUnitTest:149] Total Function Call =
- // %d.............\n",
- // toalFunCall);
- // printf("\n[NIL_DEBUG_DUnitTest:150:Remote get ended.
- // ..................\n");
}
END_TASK_DEFINITION
diff --git a/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp b/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
index c70c89c..1c2a847 100644
--- a/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
+++ b/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
@@ -87,9 +87,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -100,8 +100,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
void createRegionCachingDisabled(const char *name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, false, nullptr,
clientNotificationEnabled);
diff --git a/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp b/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
index 382457d..317e83f 100644
--- a/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
+++ b/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
@@ -84,9 +84,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -121,9 +121,9 @@ void createPooledLRURegion(const std::string &name, bool ackMode,
void createRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
diff --git a/cppcache/integration-test/testThinClientPdxInstance.cpp b/cppcache/integration-test/testThinClientPdxInstance.cpp
index 7376650..58904f3 100644
--- a/cppcache/integration-test/testThinClientPdxInstance.cpp
+++ b/cppcache/integration-test/testThinClientPdxInstance.cpp
@@ -157,9 +157,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
diff --git a/cppcache/integration-test/testThinClientPutWithDelta.cpp b/cppcache/integration-test/testThinClientPutWithDelta.cpp
index aae7eb8..2921a92 100644
--- a/cppcache/integration-test/testThinClientPutWithDelta.cpp
+++ b/cppcache/integration-test/testThinClientPutWithDelta.cpp
@@ -82,9 +82,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -95,8 +95,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
void createRegion(const char *name, bool ackMode, const char *endpoints,
bool clientNotificationEnabled = false) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
// ack, caching
auto regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
endpoints, clientNotificationEnabled);
diff --git a/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp b/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
index abcffb2..22908e2 100644
--- a/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
+++ b/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
@@ -119,7 +119,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, InitClientCreateRegionAndRunQueries)
results = qry->execute();
FAIL("Expected a QueryException");
} catch (const QueryException &ex) {
- printf("Good expected exception: %s\n", ex.what());
+ std::cout << "Good expected exception : " << ex.what() << "\n";
}
// now region queries
@@ -131,7 +131,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, InitClientCreateRegionAndRunQueries)
results = reg->query(qry2Str.c_str());
FAIL("Expected a QueryException");
} catch (const QueryException &ex) {
- printf("Good expected exception: %s\n", ex.what());
+ std::cout << "Good expected exception : " << ex.what() << "\n";
}
LOG("StepOne complete.");
@@ -177,7 +177,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegionAndRunQueries)
results = reg->query(qry1Str.c_str());
FAIL("Expected a QueryException");
} catch (const QueryException &ex) {
- printf("Good expected exception: %s\n", ex.what());
+ std::cout << "Good expected exception : " << ex.what() << "\n";
}
results = reg->query(qry2Str.c_str());
ASSERT(results->size() == static_cast<size_t>(qh.getPositionSetSize() *
diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
index dc5052b..daa08fb 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
@@ -184,7 +184,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
auto resultsize = results->size();
if (i % 100 == 0) {
- printf("Iteration upto %d done, result size is %zd\n", i, resultsize);
+ std::cout << "Iteration upto " << i << " done, result size is "
+ << resultsize << "\n";
}
if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2
diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
index dab4bb8..dbc456a 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
@@ -180,7 +180,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
auto resultsize = results->size();
if (i % 100 == 0) {
- printf("Iteration upto %d done, result size is %zd\n", i, resultsize);
+ std::cout << "Iteration upto " << i << " done, result size is "
+ << resultsize << "\n";
}
if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2
diff --git a/cppcache/integration-test/testThinClientRemoteQueryRS.cpp b/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
index eee561b..43ccb31 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
@@ -213,21 +213,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
if (!m_isPdx) {
auto ser = (*rsptr)[rows];
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(ser)) {
- printf(
- " query idx %d pulled portfolio object ID %d, pkid :: %s\n",
- i, portfolio->getID(), portfolio->getPkid()->value().c_str());
+ std::cout << " query idx " << i << " pulled portfolio object ID "
+ << portfolio->getID()
+ << ", pkid :: " << portfolio->getPkid()->value() << "\n";
} else if (auto position = std::dynamic_pointer_cast<Position>(ser)) {
- printf(
- " query idx %d pulled position object secId %s, shares :: "
- "%d\n",
- i, position->getSecId()->value().c_str(),
- position->getSharesOutstanding());
+ std::cout << " query idx " << i
+ << " pulled position object secId "
+ << position->getSecId()->value()
+ << ", shares :: " << position->getSharesOutstanding()
+ << "\n";
} else {
if (ser != nullptr) {
- printf(" query idx %d pulled object %s \n", i,
- ser->toString().c_str());
+ std::cout << " query idx " << i << " pulled object "
+ << ser->toString() << " \n";
} else {
- printf(" query idx %d pulled bad object \n", i);
+ std::cout << " query idx " << i << " pulled bad object \n";
FAIL("Unexpected object received in query");
}
}
@@ -235,24 +235,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
auto pdxser = (*rsptr)[rows];
if (auto portfoliopdx =
std::dynamic_pointer_cast<PortfolioPdx>(pdxser)) {
- printf(
- " query idx %d pulled portfolioPdx object ID %d, pkid %s :: "
- "\n",
- i, portfoliopdx->getID(), portfoliopdx->getPkid().c_str());
+ std::cout << " query idx " << i
+ << " pulled portfolioPdx object ID "
+ << portfoliopdx->getID() << ", pkid "
+ << portfoliopdx->getPkid() << "\n";
} else if (auto positionpdx =
std::dynamic_pointer_cast<PositionPdx>(pdxser)) {
- printf(
- " query idx %d pulled positionPdx object secId %s, shares %d "
- " "
- ":: \n",
- i, positionpdx->getSecId().c_str(),
- positionpdx->getSharesOutstanding());
+ std::cout << " query idx " << i
+ << " pulled positionPdx object secId "
+ << positionpdx->getSecId() << ", shares "
+ << positionpdx->getSharesOutstanding() << " :: \n";
} else {
if (pdxser != nullptr) {
- printf(" query idx %d pulled object %s :: \n", i,
- pdxser->toString().c_str());
+ std::cout << " query idx " << i << " pulled object "
+ << pdxser->toString() << " :: \n";
} else {
- printf(" query idx %d pulled bad object :: \n", i);
+ std::cout << " query idx " << i << " pulled bad object :: \n";
FAIL("Unexpected object received in query");
}
}
@@ -261,7 +259,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
}
if (!doAnyErrorOccured) {
- printf("HURRAY !! StepFour PASSED \n\n");
+ std::cout << "HURRAY !! StepFour PASSED \n\n";
} else {
FAIL("Failed in StepFour verification");
}
@@ -314,23 +312,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
if (!m_isPdx) {
auto ser = (*rsptr)[rows];
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(ser)) {
- printf(
- " query idx %d pulled portfolio object ID %d, pkid :: "
- "%s\n",
- i, portfolio->getID(), portfolio->getPkid()->value().c_str());
+ std::cout << " query idx " << i
+ << " pulled portfolio object ID " << portfolio->getID()
+ << ", pkid :: " << portfolio->getPkid()->value()
+ << "\n";
} else if (auto position =
std::dynamic_pointer_cast<Position>(ser)) {
- printf(
- " query idx %d pulled position object secId %s, shares :: "
- "%d\n",
- i, position->getSecId()->value().c_str(),
- position->getSharesOutstanding());
+ std::cout << " query idx " << i
+ << " pulled position object secId "
+ << position->getSecId()->value()
+ << ", shares :: " << position->getSharesOutstanding()
+ << "\n";
} else {
if (ser != nullptr) {
- printf(" query idx %d pulled object %s \n", i,
- ser->toString().c_str());
+ std::cout << " query idx " << i << " pulled object "
+ << ser->toString() << "\n";
} else {
- printf(" query idx %d pulled bad object \n", i);
+ std::cout << " query idx " << i << " pulled bad object \n";
FAIL("Unexpected object received in query");
}
}
@@ -338,25 +336,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
auto pdxser = (*rsptr)[rows];
if (auto portfoliopdx =
std::dynamic_pointer_cast<PortfolioPdx>(pdxser)) {
- printf(
- " query idx %d pulled portfolioPdx object ID %d, pkid %s "
- ":: "
- "\n",
- i, portfoliopdx->getID(), portfoliopdx->getPkid().c_str());
+ std::cout << " query idx " << i
+ << " pulled portfoliopdx object ID "
+ << portfoliopdx->getID()
+ << ", pkid :: " << portfoliopdx->getPkid() << "\n";
} else if (auto positionpdx =
std::dynamic_pointer_cast<PositionPdx>(pdxser)) {
- printf(
- " query idx %d pulled positionPdx object secId %s, shares "
- "%d "
- " :: \n",
- i, positionpdx->getSecId().c_str(),
- positionpdx->getSharesOutstanding());
+ std::cout << " query idx " << i
+ << " pulled positionpdx object secId "
+ << positionpdx->getSecId() << ", shares :: "
+ << positionpdx->getSharesOutstanding() << "\n";
} else {
if (pdxser != nullptr) {
- printf(" query idx %d pulled object %s :: \n", i,
- pdxser->toString().c_str());
+ std::cout << " query idx " << i << " pulled object "
+ << pdxser->toString() << "\n";
} else {
- printf(" query idx %d pulled bad object :: \n", i);
+ std::cout << " query idx " << i << " pulled bad object \n";
FAIL("Unexpected object received in query");
}
}
@@ -366,7 +361,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
if (!doAnyErrorOccured) {
- printf("HURRAY !! We PASSED \n\n");
+ std::cout << "HURRAY !! We PASSED \n\n";
} else {
FAIL("Failed in StepFive verification");
}
@@ -425,23 +420,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
if (!m_isPdx) {
auto ser = (*rsptr)[rows];
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(ser)) {
- printf(
- " query idx %d pulled portfolio object ID %d, pkid %s : \n",
- i, portfolio->getID(), portfolio->getPkid()->value().c_str());
+ std::cout << " query idx " << i
+ << " pulled portfolio object ID " << portfolio->getID()
+ << ", pkid :: " << portfolio->getPkid()->value()
+ << "\n";
} else if (auto position =
std::dynamic_pointer_cast<Position>(ser)) {
- printf(
- " query idx %d pulled position object secId %s, shares %d "
- ": "
- "\n",
- i, position->getSecId()->value().c_str(),
- position->getSharesOutstanding());
+ std::cout << " query idx " << i
+ << " pulled position object secId "
+ << position->getSecId()->value()
+ << ", shares :: " << position->getSharesOutstanding()
+ << "\n";
} else {
if (ser != nullptr) {
- printf(" query idx %d pulled object %s : \n", i,
- ser->toString().c_str());
+ std::cout << " query idx " << i << " pulled object "
+ << ser->toString() << " : \n";
} else {
- printf(" query idx %d pulled bad object \n", i);
+ std::cout << " query idx " << i << " pulled bad object \n";
FAIL("Unexpected object received in query");
}
}
@@ -449,25 +444,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
auto ser = (*rsptr)[rows];
if (auto portfoliopdx =
std::dynamic_pointer_cast<PortfolioPdx>(ser)) {
- printf(
- " query idx %d pulled portfolioPdx object ID %d, pkid %s "
- ": "
- "\n",
- i, portfoliopdx->getID(), portfoliopdx->getPkid().c_str());
+ std::cout << " query idx " << i
+ << " pulled portfoliopdx object ID "
+ << portfoliopdx->getID()
+ << ", pkid :: " << portfoliopdx->getPkid() << "\n";
} else if (auto positionpdx =
std::dynamic_pointer_cast<PositionPdx>(ser)) {
- printf(
- " query idx %d pulled positionPdx object secId %s, shares "
- "%d "
- " : \n",
- i, positionpdx->getSecId().c_str(),
- positionpdx->getSharesOutstanding());
+ std::cout << " query idx " << i
+ << " pulled positionPdx object secId "
+ << positionpdx->getSecId() << ", shares "
+ << positionpdx->getSharesOutstanding() << " :: \n";
} else {
if (ser != nullptr) {
- printf(" query idx %d pulled object %s : \n", i,
- ser->toString().c_str());
+ std::cout << " query idx " << i << " pulled object "
+ << ser->toString() << " \n";
} else {
- printf(" query idx %d pulled bad object\n", i);
+ std::cout << " query idx " << i << " pulled bad object\n";
FAIL("Unexpected object received in query");
}
}
@@ -477,7 +469,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
}
if (!doAnyErrorOccured) {
- printf("HURRAY !! We PASSED \n\n");
+ std::cout << "HURRAY !! We PASSED \n\n";
} else {
FAIL("Failed in StepSix verification");
}
diff --git a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
index 1d50e14..67cb462 100644
--- a/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
@@ -82,91 +82,88 @@ std::string checkNullString(const std::string *str) {
return ((str == nullptr) ? "(null)" : *str);
}
-void _printFields(std::shared_ptr<Cacheable> field, Struct *ssptr,
- int32_t &fields) {
+void _printAllFields(std::shared_ptr<Cacheable> field, Struct *ssptr,
+ int32_t &fields) {
try {
if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(field)) {
- printf(" pulled %s :- ID %d, pkid %s\n",
- ssptr->getFieldName(fields).c_str(), portfolio->getID(),
- checkNullString(portfolio->getPkid()->value().c_str()));
- printf(" pulled %s :- ID %d, pkid %s\n",
- ssptr->getFieldName(fields).c_str(), portfolio->getID(),
- checkNullString(portfolio->getPkid()->value().c_str()));
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- ID "
+ << portfolio->getID() << ", pkid "
+ << (portfolio->getPkid()->value()) << "\n";
} else if (auto position = std::dynamic_pointer_cast<Position>(field)) {
- printf(" pulled %s :- secId %s, shares %d\n",
- ssptr->getFieldName(fields).c_str(),
- checkNullString(position->getSecId()->value().c_str()),
- position->getSharesOutstanding());
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- secId "
+ << position->getSecId()->value() << ", shares "
+ << position->getSharesOutstanding() << "\n";
} else if (auto portfolioPdx =
std::dynamic_pointer_cast<PortfolioPdx>(field)) {
- printf(" pulled %s :- ID %d, pkid %s\n",
- ssptr->getFieldName(fields).c_str(), portfolioPdx->getID(),
- portfolioPdx->getPkid().c_str());
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- ID "
+ << portfolioPdx->getID() << ", pkid " << portfolioPdx->getPkid()
+ << "\n";
} else if (auto positionPdx =
std::dynamic_pointer_cast<PositionPdx>(field)) {
- printf(" pulled %s :- secId %s, shares %d\n",
- ssptr->getFieldName(fields).c_str(),
- positionPdx->getSecId().c_str(),
- positionPdx->getSharesOutstanding());
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- secId "
+ << positionPdx->getSecId() << ", shares "
+ << positionPdx->getSharesOutstanding() << "\n";
} else {
if (auto str = std::dynamic_pointer_cast<CacheableString>(field)) {
- printf(" pulled %s :- %s\n", ssptr->getFieldName(fields).c_str(),
- checkNullString(str->value().c_str()));
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- "
+ << str->value() << "\n";
} else if (auto boolptr =
std::dynamic_pointer_cast<CacheableBoolean>(field)) {
- printf(" pulled %s :- %s\n", ssptr->getFieldName(fields).c_str(),
- boolptr->toString().c_str());
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- "
+ << boolptr->toString() << "\n";
} else {
if (auto ptr = std::dynamic_pointer_cast<CacheableKey>(field)) {
- printf(" pulled %s :- %s \n", ssptr->getFieldName(fields).c_str(),
- ptr->toString().c_str());
+ std::cout << " pulled " << ssptr->getFieldName(fields) << " :- "
+ << ptr->toString() << " \n";
} else if (auto strArr =
std::dynamic_pointer_cast<CacheableStringArray>(field)) {
- printf(" string array object printing \n\n");
+ std::cout << " string array object printing \n\n";
for (int stri = 0; stri < strArr->length(); stri++) {
- printf(" pulled %s(%d) - %s \n",
- ssptr->getFieldName(fields).c_str(), stri,
- strArr->operator[](stri)->value().c_str());
+ std::cout << " pulled " << ssptr->getFieldName(fields) << "("
+ << stri << ") - " << strArr->operator[](stri)->value()
+ << " \n";
}
} else if (auto map =
std::dynamic_pointer_cast<CacheableHashMap>(field)) {
int index = 0;
for (const auto &iter : *map) {
- printf(" hashMap %d of %zd ... \n", ++index, map->size());
- _printFields(iter.first, ssptr, fields);
- _printFields(iter.second, ssptr, fields);
+ std::cout << " hashMap " << ++index << " of " << map->size()
+ << " ... \n";
+ _printAllFields(iter.first, ssptr, fields);
+ _printAllFields(iter.second, ssptr, fields);
}
- printf(" end of map \n");
+ std::cout << " end of map \n";
} else if (auto structimpl = std::dynamic_pointer_cast<Struct>(field)) {
- printf(" structImpl %s {\n", ssptr->getFieldName(fields).c_str());
+ std::cout << " structImpl " << ssptr->getFieldName(fields)
+ << " {\n";
for (int32_t inner_fields = 0; inner_fields < structimpl->size();
inner_fields++) {
auto innerField = (*structimpl)[inner_fields];
if (innerField == nullptr) {
- printf(
- "we got null fields here, probably we have nullptr data\n");
+ std::cout
+ << "we got null fields here, probably we have nullptr data\n";
continue;
}
- _printFields(innerField, structimpl.get(), inner_fields);
+ _printAllFields(innerField, structimpl.get(), inner_fields);
} // end of field iterations
- printf(" } //end of %s\n", ssptr->getFieldName(fields).c_str());
+ std::cout << " } //end of " << ssptr->getFieldName(fields) << "\n";
} else {
- printf(
- "unknown field data.. couldn't even convert it to Cacheable "
- "variants\n");
+ std::cout << "unknown field data.. couldn't even convert it to "
+ "Cacheable variants\n";
}
}
} // end of else
} catch (const std::out_of_range &e) {
- printf("Caught a non-fatal out_of_range exception: %s", e.what());
+ std::cout << "Caught a non-fatal out_of_range exception: " << e.what();
}
}
-void _verifyStructSet(std::shared_ptr<StructSet> &ssptr, int i) {
- printf("query idx %d \n", i);
+void _verifyStructSet(std::shared_ptr<StructSet> &ssptr, int) {
+ std::cout << "query idx "
+ << " \n";
for (size_t rows = 0; rows < ssptr->size(); rows++) {
if (rows > QueryHelper::getHelper().getPortfolioSetSize()) {
continue;
@@ -174,19 +171,19 @@ void _verifyStructSet(std::shared_ptr<StructSet> &ssptr, int i) {
Struct *siptr = dynamic_cast<Struct *>(((*ssptr)[rows]).get());
if (siptr == nullptr) {
- printf("siptr is nullptr \n\n");
+ std::cout << "siptr is nullptr \n\n";
continue;
}
- printf(" Row : %zd \n", rows);
+ std::cout << " Row : " << rows << " \n";
for (int32_t fields = 0; fields < siptr->size(); fields++) {
auto field = (*siptr)[fields];
if (field == nullptr) {
- printf("we got null fields here, probably we have nullptr data\n");
+ std::cout << "we got null fields here, probably we have nullptr data\n";
continue;
}
- _printFields(field, siptr, fields);
+ _printAllFields(field, siptr, fields);
} // end of field iterations
} // end of row iterations
@@ -361,7 +358,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
_verifyStructSet(ssptr, i);
}
- if (!doAnyErrorOccured) printf("HURRAY !! StepFour PASSED \n\n");
+ if (!doAnyErrorOccured) {
+ std::cout << "HOORAY !! StepFour PASSED \n\n";
+ }
LOG("StepFour complete.");
}
@@ -410,7 +409,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
}
- printf("HURRAY !! We PASSED \n\n");
+ std::cout << "HOORAY !! We PASSED \n\n";
LOG("StepFive complete.");
}
END_TASK_DEFINITION
@@ -470,7 +469,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
_verifyStructSet(ssptr, i);
}
}
- if (!doAnyErrorOccured) printf("HURRAY !! We PASSED \n\n");
+ if (!doAnyErrorOccured) {
+ std::cout << "HOORAY !! We PASSED \n\n";
+ }
+
LOG("StepSix complete.");
}
END_TASK_DEFINITION
@@ -585,7 +587,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, DoQuerySSError)
FAIL(failmsg);
} catch (apache::geode::client::QueryException &ex) {
// ok, expecting an exception, do nothing
- fprintf(stdout, "Got expected exception: %s", ex.what());
+ std::cout << "Got expected exception: " << ex.what();
} catch (...) {
ASSERT(false, "Got unexpected exception");
}
diff --git a/cppcache/integration-test/testThinClientRemoveOps.cpp b/cppcache/integration-test/testThinClientRemoveOps.cpp
index f30e5c1..59d9118 100644
--- a/cppcache/integration-test/testThinClientRemoveOps.cpp
+++ b/cppcache/integration-test/testThinClientRemoveOps.cpp
@@ -169,8 +169,9 @@ void createRegion(const char *name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr = getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
clientNotificationEnabled);
ASSERT(regPtr != nullptr, "Failed to create region.");
@@ -183,9 +184,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
bool clientNotificationEnabled = false,
bool cachingEnable = true) {
LOG("createRegion_Pool() entered.");
- fprintf(stdout, "Creating region -- %s ackMode is %d\n", name.c_str(),
- ackMode);
- fflush(stdout);
+ std::cout << "Creating region -- " << name << " ackMode is " << ackMode
+ << "\n"
+ << std::flush;
auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
@@ -195,9 +196,9 @@ void createPooledRegion(const std::string &name, bool ackMode,
void putEntry(const char *name, const char *key, const char *value) {
LOG("putEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Put entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -219,9 +220,9 @@ void putEntry(const char *name, const char *key, const char *value) {
void localPutEntry(const char *name, const char *key, const char *value) {
LOG("putEntry() entered.");
- fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Put entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -238,8 +239,8 @@ void localPutEntry(const char *name, const char *key, const char *value) {
void createEntryTwice(const char *name, const char *key, const char *value) {
LOG("createEntryTwice() entered.");
- LOG(std::string("Creating entry -- key: ") + key + " value : " + value +
- " in region " + name);
+ std::cout << "Creating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n";
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
auto regPtr = getHelper()->getRegion(name);
@@ -258,9 +259,9 @@ void createEntryTwice(const char *name, const char *key, const char *value) {
void updateEntry(const char *name, const char *key, const char *value) {
LOG("updateEntry() entered.");
- fprintf(stdout, "Updating entry -- key: %s value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "Updating entry -- key: " << key << " value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Update entry, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto valPtr = CacheableString::create(value);
@@ -281,16 +282,14 @@ void updateEntry(const char *name, const char *key, const char *value) {
void doGetAgain(const char *name, const char *key, const char *value) {
LOG("doGetAgain() entered.");
- fprintf(stdout,
- "get for entry -- key: %s expecting value: %s in region %s\n", key,
- value, name);
- fflush(stdout);
+ std::cout << "get for entry -- key: " << key << " expecting value: " << value
+ << " in region " << name << "\n"
+ << std::flush;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "get region name%s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "get region name " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
@@ -309,18 +308,15 @@ void doGetAgain(const char *name, const char *key, const char *value) {
void doNetsearch(const char *name, const char *key, const char *value) {
LOG("doNetsearch() entered.");
- fprintf(
- stdout,
- "Netsearching for entry -- key: %s expecting value: %s in region %s\n",
- key, value, name);
- fflush(stdout);
+ std::cout << "Netsearching for entry -- key: " << key
+ << " expecting value: " << value << " in region " << name << "\n"
+ << std::flush;
static int count = 0;
// Get entry created in Process A, verify entry is correct
auto keyPtr = CacheableKey::create(key);
auto regPtr = getHelper()->getRegion(name);
- fprintf(stdout, "netsearch region %s\n", regPtr->getName().c_str());
- fflush(stdout);
+ std::cout << "netsearch region " << regPtr->getName() << "\n" << std::flush;
ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
diff --git a/cppcache/integration-test/testThinClientSecurityAuthenticationSetAuthInitialize.cpp b/cppcache/integration-test/testThinClientSecurityAuthenticationSetAuthInitialize.cpp
index 031c1fe..eb443ea 100644
--- a/cppcache/integration-test/testThinClientSecurityAuthenticationSetAuthInitialize.cpp
+++ b/cppcache/integration-test/testThinClientSecurityAuthenticationSetAuthInitialize.cpp
@@ -106,7 +106,7 @@ DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer1)
LOG("Server1 started");
}
} catch (...) {
- printf("this is some exception");
+ std::cout << "this is some exception";
}
}
END_TASK_DEFINITION
diff --git a/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp b/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
index 4f80dc6..a54ffd5 100644
--- a/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
+++ b/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
@@ -147,8 +147,8 @@ void checkValuesMap(HashMapOfCacheable &values, int clientNum, int numKeys) {
expectedVal = CacheableString::create(nvals[index]);
ASSERT(*val == *expectedVal, "unexpected value in values map");
}
- printf("Expected number of values: %zd; got values: %zd", expectedNum,
- values.size());
+ std::cout << "Expected number of values: " << expectedNum
+ << "; got values: " << values.size() << "\n";
ASSERT(values.size() == expectedNum, "unexpected number of values");
}
@@ -165,11 +165,12 @@ void checkExceptionsMap(HashMapOfException &exceptions, int clientNum,
ASSERT(std::dynamic_pointer_cast<std::shared_ptr<NotAuthorizedException>>(
iter->second),
"unexpected exception type in exception map");
- printf("Got expected NotAuthorizedException: %s", iter->second->what());
+ std::cout << "Got expected NotAuthorizedException: "
+ << iter->second->what() << "\n";
}
}
- printf("Expected number of exceptions: %zd; got exceptions: %zd", expectedNum,
- exceptions.size());
+ std::cout << "Expected number of exceptions: " << expectedNum
+ << "; got exceptions: " << exceptions.size() << "\n";
ASSERT(exceptions.size() == expectedNum, "unexpected number of exceptions");
}
diff --git a/cppcache/src/CppCacheLibrary.cpp b/cppcache/src/CppCacheLibrary.cpp
index 23ec0eb..45e101b 100644
--- a/cppcache/src/CppCacheLibrary.cpp
+++ b/cppcache/src/CppCacheLibrary.cpp
@@ -17,6 +17,8 @@
#include "CppCacheLibrary.hpp"
+#include <iostream>
+
#include <ace/ACE.h>
#include <ace/Init_ACE.h>
@@ -76,10 +78,9 @@ std::string CppCacheLibrary::initProductDir() {
// otherwise... get the DLL path, and work backwards from it.
auto productLibraryDirectoryName = getProductLibDir();
if (productLibraryDirectoryName.empty()) {
- fprintf(stderr,
- "Cannot determine location of product directory.\n"
- "Please set GEODE_NATIVE_HOME environment variable.\n");
- fflush(stderr);
+ std::cerr << "Cannot determine location of product directory.\n"
+ << "Please set GEODE_NATIVE_HOME environment variable.\n"
+ << std::flush;
throw apache::geode::client::IllegalStateException(
"Product installation directory not found. Please set "
"GEODE_NATIVE_HOME environment variable.");
diff --git a/cppcache/src/Log.cpp b/cppcache/src/Log.cpp
index 971dc32..819ea82 100644
--- a/cppcache/src/Log.cpp
+++ b/cppcache/src/Log.cpp
@@ -22,6 +22,7 @@
#include <chrono>
#include <cstdio>
#include <ctime>
+#include <iostream>
#include <map>
#include <mutex>
#include <sstream>
@@ -277,15 +278,15 @@ void Log::writeBanner() {
// fullpath empty --> we're logging to stdout
if (g_fullpath.string().empty()) {
- fprintf(stdout, "%s", bannertext.c_str());
- fflush(stdout);
+ std::cout << bannertext << std::flush;
} else {
if (boost::filesystem::exists(
g_fullpath.parent_path().string().c_str()) ||
boost::filesystem::create_directories(g_fullpath.parent_path())) {
g_log = fopen(g_fullpath.string().c_str(), "a");
if (g_log) {
- if (fprintf(g_log, "%s", bannertext.c_str())) {
+ if (fwrite(bannertext.c_str(), sizeof(char), bannertext.length(),
+ g_log) == bannertext.length()) {
g_bytesWritten += static_cast<int32_t>(bannertext.length());
fflush(g_log);
}
@@ -398,8 +399,7 @@ void Log::logInternal(LogLevel level, const std::string& msg) {
char fullpath[512] = {0};
if (g_fullpath.string().empty()) {
- fprintf(stdout, "%s%s\n", formatLogLine(level).c_str(), msg.c_str());
- fflush(stdout);
+ std::cout << formatLogLine(level) << msg << "\n" << std::flush;
} else {
if (!g_log) {
g_log = fopen(g_fullpath.string().c_str(), "a");
@@ -424,7 +424,9 @@ void Log::logInternal(LogLevel level, const std::string& msg) {
removeOldestRolledLogFile();
}
- if (fprintf(g_log, "%s%s\n", buf.c_str(), msg.c_str()) == 0 ||
+ auto logLine = buf + msg + "\n";
+ if (fwrite(logLine.c_str(), sizeof(char), logLine.length(), g_log) !=
+ logLine.length() ||
ferror(g_log)) {
// Let's continue without throwing the exception. It should not cause
// process to terminate
diff --git a/examples/cpp/sslputget/main.cpp b/examples/cpp/sslputget/main.cpp
index 7487a2d..5ed8b7f 100644
--- a/examples/cpp/sslputget/main.cpp
+++ b/examples/cpp/sslputget/main.cpp
@@ -29,9 +29,9 @@ using apache::geode::client::CacheFactory;
using apache::geode::client::RegionShortcut;
void print_usage() {
- printf("Usage: cpp-sslputget <<path>>\n");
- printf("Where <<path>> is the absolute path to the location of your SSL "
- "client keystore and truststore\n");
+ std::cout << "Usage: cpp-sslputget <<path>>\n";
+ std::cout << "Where <<path>> is the absolute path to the location of your "
+ "SSL client keystore and truststore\n";
}
int main(int argc, char** argv) {
@@ -42,24 +42,23 @@ int main(int argc, char** argv) {
auto sslKeyPath = std::string(argv[1]);
- auto cache =
- CacheFactory()
- .set("log-level", "none")
- .set("ssl-enabled", "true")
- .set("ssl-keystore",
+ auto cache = CacheFactory()
+ .set("log-level", "none")
+ .set("ssl-enabled", "true")
+ .set("ssl-keystore",
#ifdef WIN32
- (sslKeyPath + "\\client_keystore.pem").c_str())
+ (sslKeyPath + "\\client_keystore.pem").c_str())
#else
- (sslKeyPath + "/client_keystore.pem").c_str())
+ (sslKeyPath + "/client_keystore.pem").c_str())
#endif
- .set("ssl-keystore-password", "apachegeode")
- .set("ssl-truststore",
+ .set("ssl-keystore-password", "apachegeode")
+ .set("ssl-truststore",
#ifdef WIN32
- (sslKeyPath + "\\client_truststore.pem").c_str())
+ (sslKeyPath + "\\client_truststore.pem").c_str())
#else
- (sslKeyPath + "/client_truststore.pem").c_str())
+ (sslKeyPath + "/client_truststore.pem").c_str())
#endif
- .create();
+ .create();
const auto pool = cache.getPoolManager()
.createFactory()
diff --git a/tests/cpp/testobject/Position.cpp b/tests/cpp/testobject/Position.cpp
index 8b491db..fc99531 100644
--- a/tests/cpp/testobject/Position.cpp
+++ b/tests/cpp/testobject/Position.cpp
@@ -37,7 +37,7 @@ Position::Position(const char* id, int32_t out) {
qty = out - (cnt % 2 == 0 ? 1000 : 100);
mktValue = qty * 1.2345998;
sharesOutstanding = out;
- secType = L"a";
+ secType = "a";
pid = cnt++;
}
@@ -54,7 +54,7 @@ Position::Position(int32_t iForExactVal) {
qty = (iForExactVal % 2 == 0 ? 1000 : 100);
mktValue = qty * 2;
sharesOutstanding = iForExactVal;
- secType = L"a";
+ secType = "a";
pid = iForExactVal;
}
@@ -70,7 +70,7 @@ void Position::init() {
qty = 0.0;
secId = nullptr;
secLinks = nullptr;
- secType = L"";
+ secType = "";
sharesOutstanding = 0;
underlyer = nullptr;
volatility = 0;
@@ -108,7 +108,7 @@ void Position::fromData(apache::geode::client::DataInput& input) {
qty = input.readDouble();
secId = std::dynamic_pointer_cast<CacheableString>(input.readObject());
secLinks = std::dynamic_pointer_cast<CacheableString>(input.readObject());
- secType = input.readUTF<wchar_t>();
+ secType = input.readUTF<char>();
sharesOutstanding = input.readInt32();
underlyer = std::dynamic_pointer_cast<CacheableString>(input.readObject());
volatility = input.readInt64();
@@ -117,8 +117,7 @@ void Position::fromData(apache::geode::client::DataInput& input) {
std::string Position::toString() const {
std::stringstream strm;
- strm << "Position Object:[ secId=" << secId->toString()
- << " type=" << std::string(secType.begin(), secType.end())
+ strm << "Position Object:[ secId=" << secId->toString() << " type=" << secType
<< " sharesOutstanding=" << sharesOutstanding << " id=" << pid << " ]";
return strm.str();
}
diff --git a/tests/cpp/testobject/Position.hpp b/tests/cpp/testobject/Position.hpp
index 7256e55..9115c2a 100644
--- a/tests/cpp/testobject/Position.hpp
+++ b/tests/cpp/testobject/Position.hpp
@@ -51,8 +51,7 @@ class TESTOBJECT_EXPORT Position : public DataSerializable {
double qty;
std::shared_ptr<CacheableString> secId;
std::shared_ptr<CacheableString> secLinks;
- // wchar_t* secType;
- std::wstring secType;
+ std::string secType;
int32_t sharesOutstanding;
std::shared_ptr<CacheableString> underlyer;
int64_t volatility;