http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp index 0fbef1b..3c86261 100644 --- a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp +++ b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp @@ -40,17 +40,18 @@ char* OnServerHAExceptionFunction = (char*)"OnServerHAExceptionFunction"; char* OnServerHAShutdownFunction = (char*)"OnServerHAShutdownFunction"; char* RegionOperationsHAFunction = (char*)"RegionOperationsHAFunction"; -#define verifyGetResults() \ - bool found = false; \ - for (int j = 0; j < 34; j++) { \ - if (j % 2 == 0) continue; \ - sprintf(buf, "VALUE--%d", j); \ - if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \ - ->asChar()) == 0) { \ - found = true; \ - break; \ - } \ - } \ +#define verifyGetResults() \ + bool found = false; \ + for (int j = 0; j < 34; j++) { \ + if (j % 2 == 0) continue; \ + sprintf(buf, "VALUE--%d", j); \ + if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \ + resultList->operator[](i)) \ + ->asChar()) == 0) { \ + found = true; \ + break; \ + } \ + } \ ASSERT(found, "this returned value is invalid"); #define verifyPutResults() \ @@ -90,8 +91,8 @@ class MyResultCollector : public ResultCollector { void addResult(CacheablePtr& resultItem) { m_addResultCount++; - if (resultItem == NULLPTR) return; - CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem); + if (resultItem == nullptr) return; + auto result = std::dynamic_pointer_cast<CacheableArrayList>(resultItem); for (int32_t i = 0; i < result->size(); i++) { m_resultList->push_back(result->operator[](i)); } @@ -152,7 +153,7 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StartC1) { - initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true, + initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true, -1, 5, 60000); // createPool(poolName, locHostPort,serverGroup, NULL, 0, true ); // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName); @@ -181,39 +182,36 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) { - RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]); + auto regPtr0 = getHelper()->getRegion(poolRegNames[0]); char buf[128]; for (int i = 0; i < 34; i++) { sprintf(buf, "VALUE--%d", i); - CacheablePtr value(CacheableString::create(buf)); + auto value = CacheableString::create(buf); sprintf(buf, "KEY--%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); regPtr0->put(key, value); } SLEEP(10000); // let the put finish try { - CacheablePtr args = CacheableBoolean::create(1); - CacheableVectorPtr routingObj = CacheableVector::create(); + auto routingObj = CacheableVector::create(); for (int i = 0; i < 34; i++) { if (i % 2 == 0) continue; sprintf(buf, "KEY--%d", i); CacheableKeyPtr key = CacheableKey::create(buf); routingObj->push_back(key); } - args = routingObj; // UNUSED bool getResult = true; - ExecutionPtr exc = FunctionService::onRegion(regPtr0); - ASSERT(exc != NULLPTR, "onRegion Returned NULL"); - CacheableVectorPtr resultList = CacheableVector::create(); + auto exc = FunctionService::onRegion(regPtr0); + ASSERT(exc != nullptr, "onRegion Returned NULL"); + auto resultList = CacheableVector::create(); - CacheableVectorPtr executeFunctionResult = - exc->withArgs(args) - ->execute(RegionOperationsHAFunction, 15) - ->getResult(); + auto executeFunctionResult = exc->withArgs(routingObj) + ->execute(RegionOperationsHAFunction, 15) + ->getResult(); - if (executeFunctionResult == NULLPTR) { + if (executeFunctionResult == nullptr) { ASSERT(false, "get executeFunctionResult is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -224,7 +222,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -237,10 +235,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) "get executeFunctionResult count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() } @@ -248,15 +247,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) /*-------------------------------onRegion with single filter * key---------------------------------------*/ - CacheableVectorPtr filter = CacheableVector::create(); + auto filter = CacheableVector::create(); const char* key = "KEY--10"; filter->push_back(CacheableString::create(key)); - executeFunctionResult = exc->withArgs(args) + executeFunctionResult = exc->withArgs(routingObj) ->withFilter(filter) ->execute(RegionOperationsHAFunction, 15) ->getResult(); - if (executeFunctionResult == NULLPTR) { + if (executeFunctionResult == nullptr) { ASSERT(false, "get executeFunctionResult is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -267,7 +266,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -280,10 +279,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) "get executeFunctionResult count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() } @@ -305,43 +305,41 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) { - RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]); + auto regPtr0 = getHelper()->getRegion(poolRegNames[0]); char buf[128]; for (int i = 0; i < 34; i++) { sprintf(buf, "VALUE--%d", i); - CacheablePtr value(CacheableString::create(buf)); + auto value = CacheableString::create(buf); sprintf(buf, "KEY--%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); regPtr0->put(key, value); } SLEEP(10000); // let the put finish try { - CacheablePtr args = CacheableBoolean::create(1); - CacheableVectorPtr routingObj = CacheableVector::create(); + auto routingObj = CacheableVector::create(); for (int i = 0; i < 34; i++) { if (i % 2 == 0) continue; sprintf(buf, "KEY--%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); routingObj->push_back(key); } // UNUSED bool getResult = true; - PoolPtr pool = apache::geode::client::PoolManager::find("__TEST_POOL1__"); - ExecutionPtr exc = FunctionService::onServer(pool); - ASSERT(exc != NULLPTR, "onServer Returned NULL"); + auto pool = apache::geode::client::PoolManager::find("__TEST_POOL1__"); + auto exc = FunctionService::onServer(pool); + ASSERT(exc != nullptr, "onServer Returned NULL"); - args = routingObj; - CacheableVectorPtr resultList = CacheableVector::create(); + auto resultList = CacheableVector::create(); // Test with HA exception - CacheableVectorPtr executeFunctionResult = - exc->withArgs(args) + auto executeFunctionResult = + exc->withArgs(routingObj) ->execute(OnServerHAExceptionFunction, 15) ->getResult(); - if (executeFunctionResult == NULLPTR) { + if (executeFunctionResult == nullptr) { ASSERT(false, "get executeFunctionResult is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -351,7 +349,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -364,22 +362,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) "get executeFunctionResult count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() } } // Test with HA server shutdown - CacheableVectorPtr executeFunctionResult1 = - exc->withArgs(args) + auto executeFunctionResult1 = + exc->withArgs(routingObj) ->execute(OnServerHAShutdownFunction, 15) ->getResult(); - if (executeFunctionResult1 == NULLPTR) { + if (executeFunctionResult1 == nullptr) { ASSERT(false, "get executeFunctionResult1 is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -389,7 +388,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult1->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult1->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -402,10 +401,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) "get executeFunctionResult1 count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp index bb6aa4d..a453738 100644 --- a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp +++ b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp @@ -40,17 +40,18 @@ char* OnServerHAShutdownFunction = (char*)"OnServerHAShutdownFunction"; char* RegionOperationsHAFunction = (char*)"RegionOperationsHAFunction"; char* RegionOperationsHAFunctionPrSHOP = (char*)"RegionOperationsHAFunctionPrSHOP"; -#define verifyGetResults() \ - bool found = false; \ - for (int j = 0; j < 34; j++) { \ - if (j % 2 == 0) continue; \ - sprintf(buf, "VALUE--%d", j); \ - if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \ - ->asChar()) == 0) { \ - found = true; \ - break; \ - } \ - } \ +#define verifyGetResults() \ + bool found = false; \ + for (int j = 0; j < 34; j++) { \ + if (j % 2 == 0) continue; \ + sprintf(buf, "VALUE--%d", j); \ + if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \ + resultList->operator[](i)) \ + ->asChar()) == 0) { \ + found = true; \ + break; \ + } \ + } \ ASSERT(found, "this returned value is invalid"); #define verifyPutResults() \ @@ -90,8 +91,8 @@ class MyResultCollector : public ResultCollector { void addResult(CacheablePtr& resultItem) { m_addResultCount++; - if (resultItem == NULLPTR) return; - CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem); + if (resultItem == nullptr) return; + auto result = std::dynamic_pointer_cast<CacheableArrayList>(resultItem); for (int32_t i = 0; i < result->size(); i++) { m_resultList->push_back(result->operator[](i)); } @@ -149,7 +150,7 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StartC1) { // initClient(true); - initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 1, true, + initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 1, true, -1, 5, 60000, /*singlehop*/ true, /*threadLocal*/ true); // createPool(poolName, locHostPort,serverGroup, NULL, 0, true ); @@ -179,39 +180,37 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) { - RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]); + auto regPtr0 = getHelper()->getRegion(poolRegNames[0]); char buf[128]; for (int i = 0; i < 350; i++) { sprintf(buf, "VALUE--%d", i); - CacheablePtr value(CacheableString::create(buf)); + auto value = CacheableString::create(buf); sprintf(buf, "KEY--%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); regPtr0->put(key, value); } SLEEP(10000); // let the put finish try { - CacheablePtr args = CacheableBoolean::create(1); - CacheableVectorPtr routingObj = CacheableVector::create(); + auto routingObj = CacheableVector::create(); for (int i = 0; i < 34; i++) { if (i % 2 == 0) continue; sprintf(buf, "KEY--%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); routingObj->push_back(key); } - args = routingObj; // UNUSED bool getResult = true; ExecutionPtr exc = FunctionService::onRegion(regPtr0); - ASSERT(exc != NULLPTR, "onRegion Returned NULL"); - CacheableVectorPtr resultList = CacheableVector::create(); + ASSERT(exc != nullptr, "onRegion Returned NULL"); + auto resultList = CacheableVector::create(); - CacheableVectorPtr executeFunctionResult = - exc->withArgs(args) + auto executeFunctionResult = + exc->withArgs(routingObj) ->execute(RegionOperationsHAFunctionPrSHOP, 15) ->getResult(); - if (executeFunctionResult == NULLPTR) { + if (executeFunctionResult == nullptr) { ASSERT(false, "get executeFunctionResult is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -222,7 +221,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -235,10 +234,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest) "get executeFunctionResult count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() } @@ -257,21 +257,20 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) { - RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]); + auto regPtr0 = getHelper()->getRegion(poolRegNames[0]); char buf[128]; for (int i = 0; i < 34; i++) { sprintf(buf, "VALUE--%d", i); - CacheablePtr value(CacheableString::create(buf)); + auto value = CacheableString::create(buf); sprintf(buf, "KEY--%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); regPtr0->put(key, value); } SLEEP(10000); // let the put finish try { - CacheablePtr args = CacheableBoolean::create(1); - CacheableVectorPtr routingObj = CacheableVector::create(); + auto routingObj = CacheableVector::create(); for (int i = 0; i < 34; i++) { if (i % 2 == 0) continue; sprintf(buf, "KEY--%d", i); @@ -280,20 +279,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) } // UNUSED bool getResult = true; - PoolPtr pool = apache::geode::client::PoolManager::find("__TEST_POOL1__"); - ExecutionPtr exc = FunctionService::onServer(pool); - ASSERT(exc != NULLPTR, "onServer Returned NULL"); + auto pool = apache::geode::client::PoolManager::find("__TEST_POOL1__"); + auto exc = FunctionService::onServer(pool); + ASSERT(exc != nullptr, "onServer Returned NULL"); - args = routingObj; - CacheableVectorPtr resultList = CacheableVector::create(); + auto resultList = CacheableVector::create(); // Test with HA exception - CacheableVectorPtr executeFunctionResult = - exc->withArgs(args) + auto executeFunctionResult = + exc->withArgs(routingObj) ->execute(OnServerHAExceptionFunction, 15) ->getResult(); - if (executeFunctionResult == NULLPTR) { + if (executeFunctionResult == nullptr) { ASSERT(false, "get executeFunctionResult is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -303,7 +301,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -316,22 +314,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) "get executeFunctionResult count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() } } // Test with HA server shutdown - CacheableVectorPtr executeFunctionResult1 = - exc->withArgs(args) + auto executeFunctionResult1 = + exc->withArgs(routingObj) ->execute(OnServerHAShutdownFunction, 15) ->getResult(); - if (executeFunctionResult1 == NULLPTR) { + if (executeFunctionResult1 == nullptr) { ASSERT(false, "get executeFunctionResult1 is NULL"); } else { sprintf(buf, "echo String : result count = %d", @@ -341,7 +340,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) for (unsigned item = 0; item < static_cast<uint32_t>(executeFunctionResult1->size()); item++) { - CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>( + auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>( executeFunctionResult1->operator[](item)); for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size()); pos++) { @@ -354,10 +353,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest) "get executeFunctionResult1 count is not 17"); for (int32_t i = 0; i < resultList->size(); i++) { sprintf(buf, "result[%d] is null\n", i); - ASSERT(resultList->operator[](i) != NULLPTR, buf); - sprintf( - buf, "get result[%d]=%s", i, - dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); + ASSERT(resultList->operator[](i) != nullptr, buf); + sprintf(buf, "get result[%d]=%s", i, + std::dynamic_pointer_cast<CacheableString>( + resultList->operator[](i)) + ->asChar()); LOG(buf); verifyGetResults() } http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolLocator.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPoolLocator.cpp b/src/cppcache/integration-test/testThinClientPoolLocator.cpp index 6c8533d..6bb4db9 100644 --- a/src/cppcache/integration-test/testThinClientPoolLocator.cpp +++ b/src/cppcache/integration-test/testThinClientPoolLocator.cpp @@ -37,14 +37,11 @@ DUNIT_TASK(CLIENT1, SetupClient1_NoLocators_At_Init) try { createEntry(regionNames[0], keys[0], vals[0]); } catch (NotConnectedException& ex) { - try { - ExceptionPtr exCause = - dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause()); - } catch (ClassCastException&) { - FAIL( - "NotconnectedException with cause NoAvailableLocatorsException was " - "not thrown."); - } + ASSERT( + std::dynamic_pointer_cast<NoAvailableLocatorsException>( + ex.getCause()), + "NotconnectedException with cause NoAvailableLocatorsException was " + "not thrown."); } LOG("SetupClient1 complete."); } @@ -197,12 +194,8 @@ DUNIT_TASK(CLIENT2, AgainFailoverC2) updateEntry(regionNames[0], keys[1], vals[1]); FAIL("Client Failover Should Fail"); } catch (const NotConnectedException& ex) { - try { - ExceptionPtr exCause = - dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause()); - LOG("Expected exception " - "NoAvailableLocatorsException got"); - } catch (ClassCastException&) { + if (!std::dynamic_pointer_cast<NoAvailableLocatorsException>( + ex.getCause())) { LOG(ex.getName()); LOG(ex.getMessage()); FAIL( http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp b/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp index 3423286..c442451 100644 --- a/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp +++ b/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp @@ -117,9 +117,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1_1) RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]); RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]); - regPtr0->registerAllKeys(false, NULLPTR, true); - regPtr1->registerAllKeys(false, NULLPTR, true); - regPtr2->registerAllKeys(false, NULLPTR, true); + regPtr0->registerAllKeys(false, nullptr, true); + regPtr1->registerAllKeys(false, nullptr, true); + regPtr2->registerAllKeys(false, nullptr, true); LOG("CreateClient1 complete."); } @@ -145,9 +145,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_1) RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]); RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]); - regPtr0->registerAllKeys(false, NULLPTR, true); - regPtr1->registerAllKeys(false, NULLPTR, true); - regPtr2->registerAllKeys(false, NULLPTR, true); + regPtr0->registerAllKeys(false, nullptr, true); + regPtr1->registerAllKeys(false, nullptr, true); + regPtr2->registerAllKeys(false, nullptr, true); LOG("CreateClient2 verify starts."); verifyEntries(0); @@ -176,9 +176,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1_2) RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]); RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]); - regPtr0->registerAllKeys(false, NULLPTR, true); - regPtr1->registerAllKeys(false, NULLPTR, true); - regPtr2->registerAllKeys(false, NULLPTR, true); + regPtr0->registerAllKeys(false, nullptr, true); + regPtr1->registerAllKeys(false, nullptr, true); + regPtr2->registerAllKeys(false, nullptr, true); LOG("CreateClient1 complete."); } @@ -204,9 +204,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_2) RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]); RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]); - regPtr0->registerAllKeys(false, NULLPTR, true); - regPtr1->registerAllKeys(false, NULLPTR, true); - regPtr2->registerAllKeys(false, NULLPTR, true); + regPtr0->registerAllKeys(false, nullptr, true); + regPtr1->registerAllKeys(false, nullptr, true); + regPtr2->registerAllKeys(false, nullptr, true); verifyEntries(0); @@ -272,10 +272,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyK1C1New2) CacheableKeyPtr keyPtr = createKey(keys[1]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "get returned %s for key %s", checkPtr->asChar(), keys[1]); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp b/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp index a47c7b2..83faa8a 100644 --- a/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp +++ b/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp @@ -108,10 +108,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_EndpointTL) RegionPtr regPtr = getHelper()->createPooledRegionStickySingleHop( regionNames[0], USE_ACK, NULL, "__TEST_POOL1__", false, false); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); regPtr = getHelper()->createPooledRegionStickySingleHop( regionNames[1], NO_ACK, NULL, "__TEST_POOL1__", false, false); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("StepOne_Pooled_EndPointTL complete."); } @@ -126,8 +126,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask) // This is to get MetaDataService going. for (int i = 3000; i < 8000; i++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(i)); + auto keyPtr = + std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i)); try { LOGINFO("CPPTEST: put item %d", i); dataReg->put(keyPtr, keyPtr->hashcode()); @@ -208,10 +208,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask) HashMapOfCacheable valMap; for (int j = 1000; j < 25000; j++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(j)); - CacheablePtr valPtr = - dynCast<CacheablePtr>(CacheableInt32::create(keyPtr->hashcode())); + auto keyPtr = std::dynamic_pointer_cast<CacheableKey>( + CacheableInt32::create(j)); + auto valPtr = std::dynamic_pointer_cast<Cacheable>( + CacheableInt32::create(keyPtr->hashcode())); LOGINFO("CPPTEST: putALL CASE:: getting key %d with hashcode %d", j, keyPtr->hashcode()); valMap.insert(keyPtr, valPtr); @@ -270,10 +270,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopRemoveAllForIntKeysTask) HashMapOfCacheable valMap; VectorOfCacheableKey keys; for (int j = 1000; j < 25000; j++) { - CacheableKeyPtr keyPtr = - dynCast<CacheableKeyPtr>(CacheableInt32::create(j)); - CacheablePtr valPtr = - dynCast<CacheablePtr>(CacheableInt32::create(keyPtr->hashcode())); + auto keyPtr = CacheableInt32::create(j); + auto valPtr = CacheableInt32::create(keyPtr->hashcode()); LOGINFO("CPPTEST: removeall CASE:: getting key %d with hashcode %d", j, keyPtr->hashcode()); valMap.insert(keyPtr, valPtr); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPutWithDelta.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientPutWithDelta.cpp b/src/cppcache/integration-test/testThinClientPutWithDelta.cpp index 94d68df..e4588ec 100644 --- a/src/cppcache/integration-test/testThinClientPutWithDelta.cpp +++ b/src/cppcache/integration-test/testThinClientPutWithDelta.cpp @@ -72,7 +72,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators, RegionPtr regPtr = getHelper()->createPooledRegion(name, ackMode, locators, poolname, cachingEnable, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Pooled Region created."); } @@ -83,8 +83,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints, fflush(stdout); // ack, caching RegionPtr regPtr = getHelper()->createRegion( - name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + name, ackMode, true, nullptr, endpoints, clientNotificationEnabled); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } @@ -116,22 +116,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne) DeltaEx::toDataCount = 0; CacheableKeyPtr keyPtr = createKey(keys[0]); - DeltaEx* ptr = new DeltaEx(); - CacheablePtr valPtr(ptr); + auto valPtr = std::make_shared<DeltaEx>(); RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); regPtr->put(keyPtr, valPtr); - ptr->setDelta(true); + valPtr->setDelta(true); regPtr->put(keyPtr, valPtr); // Test create with delta - toData() should be invoked instead of toDelta() regPtr->destroy(keyPtr); - ptr->setDelta(true); + valPtr->setDelta(true); regPtr->create(keyPtr, valPtr); - DeltaEx* ptr1 = new DeltaEx(0); - CacheablePtr valPtr1(ptr1); + auto valPtr1 = std::make_shared<DeltaEx>(0); regPtr->put(keyPtr, valPtr1); - ptr1->setDelta(true); + valPtr1->setDelta(true); regPtr->put(keyPtr, valPtr1); ASSERT(DeltaEx::toDeltaCount == 2, " Delta count should have been 2 "); ASSERT(DeltaEx::toDataCount == 4, " Data count should have been 3 "); @@ -149,12 +147,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_DisableDelta) } catch (IllegalStateException&) { // Ignore the exception caused by re-registration of DeltaEx. } - CacheableKeyPtr keyPtr = createKey(keys[0]); - DeltaEx* ptr = new DeltaEx(); - CacheablePtr valPtr(ptr); - RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); + auto keyPtr = createKey(keys[0]); + auto valPtr = std::make_shared<DeltaEx>(); + auto regPtr = getHelper()->getRegion(regionNames[0]); regPtr->put(keyPtr, valPtr); - ptr->setDelta(true); + valPtr->setDelta(true); regPtr->put(keyPtr, valPtr); ASSERT(DeltaEx::toDeltaCount == 0, " Delta count should have been 0 "); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp b/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp index 84228aa..a6e5570 100644 --- a/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp +++ b/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp @@ -85,7 +85,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, InitClientCreateRegionAndRunQueries) { LOG("Starting Step One with Pool + Locator lists"); initClient(); - PoolPtr pool1 = NULLPTR; + PoolPtr pool1 = nullptr; pool1 = createPool(poolNames[0], locHostPort, sGNames[0], 0, true); createRegionAndAttachPool(qRegionNames[0], USE_ACK, poolNames[0]); @@ -98,7 +98,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, InitClientCreateRegionAndRunQueries) std::string qry1Str = (std::string) "select * from /" + qRegionNames[0]; std::string qry2Str = (std::string) "select * from /" + qRegionNames[1]; - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; qs = pool1->getQueryService(); SelectResultsPtr results; @@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegionAndRunQueries) { LOG("Starting Step Two with Pool + Locator list"); // Create pool2 - PoolPtr pool2 = NULLPTR; + PoolPtr pool2 = nullptr; pool2 = createPool(poolNames[1], locHostPort, sGNames[1], 0, true); createRegionAndAttachPool(qRegionNames[1], USE_ACK, poolNames[1]); @@ -160,7 +160,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegionAndRunQueries) std::string qry1Str = (std::string) "select * from /" + qRegionNames[0]; std::string qry2Str = (std::string) "select * from /" + qRegionNames[1]; - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; qs = pool2->getQueryService(); SelectResultsPtr results; QueryPtr qry; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp b/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp index 7f05959..5dc3456 100644 --- a/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp +++ b/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp @@ -61,7 +61,7 @@ void clientOperations() { initClient(true); try { - QueryServicePtr qs = NULLPTR; // getHelper()->cachePtr->getQueryService(); + QueryServicePtr qs = nullptr; // getHelper()->cachePtr->getQueryService(); qs = createPool2("_TESTFAILPOOL_", NULL, NULL)->getQueryService(); @@ -75,22 +75,22 @@ void clientOperations() { LOG(err_msg); } - PoolPtr pool1 = NULLPTR; + PoolPtr pool1 = nullptr; pool1 = createPool(poolNames[0], locHostPort, NULL, 0, true); createRegionAndAttachPool(qRegionNames[0], USE_ACK, poolNames[0]); RegionPtr rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]); - PortfolioPtr p1(new Portfolio(1, 100)); - PortfolioPtr p2(new Portfolio(2, 100)); - PortfolioPtr p3(new Portfolio(3, 100)); - PortfolioPtr p4(new Portfolio(4, 100)); + auto p1 = std::make_shared<Portfolio>(1, 100); + auto p2 = std::make_shared<Portfolio>(2, 100); + auto p3 = std::make_shared<Portfolio>(3, 100); + auto p4 = std::make_shared<Portfolio>(4, 100); rptr->put("1", p1); rptr->put("2", p2); rptr->put("3", p3); rptr->put("4", p4); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; qs = pool1->getQueryService(); QueryPtr qry1 = qs->newQuery("select distinct * from /Portfolios"); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp index 2befb52..560312d 100644 --- a/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp +++ b/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp @@ -127,10 +127,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterTypesAndCreatePoolAndRegion) RegionPtr rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]); - CacheablePtr port1(new Portfolio(1, 100)); - CacheablePtr port2(new Portfolio(2, 200)); - CacheablePtr port3(new Portfolio(3, 300)); - CacheablePtr port4(new Portfolio(4, 400)); + auto port1 = std::make_shared<Portfolio>(1, 100); + auto port2 = std::make_shared<Portfolio>(2, 200); + auto port3 = std::make_shared<Portfolio>(3, 300); + auto port4 = std::make_shared<Portfolio>(4, 400); rptr->put("1", port1); rptr->put("2", port2); @@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure) try { kst = new KillServerThread(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp index a6221ee..15cdc47 100644 --- a/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp +++ b/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp @@ -127,10 +127,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterTypesAndCreatePoolAndRegion) RegionPtr rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]); - CacheablePtr port1(new PortfolioPdx(1, 100)); - CacheablePtr port2(new PortfolioPdx(2, 200)); - CacheablePtr port3(new PortfolioPdx(3, 300)); - CacheablePtr port4(new PortfolioPdx(4, 400)); + auto port1 = std::make_shared<PortfolioPdx>(1, 100); + auto port2 = std::make_shared<PortfolioPdx>(2, 200); + auto port3 = std::make_shared<PortfolioPdx>(3, 300); + auto port4 = std::make_shared<PortfolioPdx>(4, 400); rptr->put("1", port1); rptr->put("2", port2); @@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure) try { kst = new KillServerThread(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp index f324036..1500531 100644 --- a/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp +++ b/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp @@ -169,7 +169,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) bool doAnyErrorOccured = false; QueryHelper* qh = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -188,7 +188,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) continue; } - ResultSetPtr rsptr = dynCast<ResultSetPtr>(results); + auto rsptr = std::dynamic_pointer_cast<ResultSet>(results); SelectResultsIterator iter = rsptr->getIterator(); for (int32_t rows = 0; rows < rsptr->size(); rows++) { if (rows > (int32_t)QueryHelper::getHelper().getPortfolioSetSize()) { @@ -197,20 +197,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) if (!m_isPdx) { SerializablePtr ser = (*rsptr)[rows]; - if (instanceOf<PortfolioPtr>(ser)) { - PortfolioPtr portfolio = staticCast<PortfolioPtr>(ser); + if (std::dynamic_pointer_cast<Portfolio>(ser)) { + PortfolioPtr portfolio = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPtr)>(ser); printf( " query idx %d pulled portfolio object ID %d, pkid :: %s\n", i, portfolio->getID(), portfolio->getPkid()->asChar()); - } else if (instanceOf<PositionPtr>(ser)) { - PositionPtr position = staticCast<PositionPtr>(ser); + } else if (std::dynamic_pointer_cast<Position>(ser)) { + PositionPtr position = std::static_pointer_cast<GF_UNWRAP_SP(PositionPtr)>(ser); printf( " query idx %d pulled position object secId %s, shares :: " "%d\n", i, position->getSecId()->asChar(), position->getSharesOutstanding()); } else { - if (ser != NULLPTR) { + if (ser != nullptr) { printf(" query idx %d pulled object %s \n", i, ser->toString()->asChar()); } else { @@ -220,14 +220,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) } } else { SerializablePtr pdxser = (*rsptr)[rows]; - if (instanceOf<PortfolioPdxPtr>(pdxser)) { - PortfolioPdxPtr portfoliopdx = staticCast<PortfolioPdxPtr>(pdxser); + if (std::dynamic_pointer_cast<PortfolioPdx>(pdxser)) { + PortfolioPdxPtr portfoliopdx = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPdxPtr)>(pdxser); printf( " query idx %d pulled portfolioPdx object ID %d, pkid %s :: " "\n", i, portfoliopdx->getID(), portfoliopdx->getPkid()); - } else if (instanceOf<PositionPdxPtr>(pdxser)) { - PositionPdxPtr positionpdx = staticCast<PositionPdxPtr>(pdxser); + } else if (std::dynamic_pointer_cast<PositionPdx>(pdxser)) { + PositionPdxPtr positionpdx = std::static_pointer_cast<GF_UNWRAP_SP(PositionPdxPtr)>(pdxser); printf( " query idx %d pulled positionPdx object secId %s, shares %d " " " @@ -235,7 +235,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) i, positionpdx->getSecId(), positionpdx->getSharesOutstanding()); } else { - if (pdxser != NULLPTR) { + if (pdxser != nullptr) { if (pdxser->toString()->isWideString()) { printf(" query idx %d pulled object %S :: \n", i, pdxser->toString()->asWChar()); @@ -268,7 +268,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) bool doAnyErrorOccured = false; QueryHelper* qh = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -300,7 +300,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) continue; } - ResultSetPtr rsptr = dynCast<ResultSetPtr>(results); + auto rsptr = std::dynamic_pointer_cast<ResultSet>(results); SelectResultsIterator iter = rsptr->getIterator(); for (int32_t rows = 0; rows < rsptr->size(); rows++) { if (rows > (int32_t)QueryHelper::getHelper().getPortfolioSetSize()) { @@ -309,21 +309,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) if (!m_isPdx) { SerializablePtr ser = (*rsptr)[rows]; - if (instanceOf<PortfolioPtr>(ser)) { - PortfolioPtr portfolio = staticCast<PortfolioPtr>(ser); + if (std::dynamic_pointer_cast<Portfolio>(ser)) { + PortfolioPtr portfolio = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPtr)>(ser); printf( " query idx %d pulled portfolio object ID %d, pkid :: " "%s\n", i, portfolio->getID(), portfolio->getPkid()->asChar()); - } else if (instanceOf<PositionPtr>(ser)) { - PositionPtr position = staticCast<PositionPtr>(ser); + } else if (std::dynamic_pointer_cast<Position>(ser)) { + PositionPtr position = std::static_pointer_cast<GF_UNWRAP_SP(PositionPtr)>(ser); printf( " query idx %d pulled position object secId %s, shares :: " "%d\n", i, position->getSecId()->asChar(), position->getSharesOutstanding()); } else { - if (ser != NULLPTR) { + if (ser != nullptr) { printf(" query idx %d pulled object %s \n", i, ser->toString()->asChar()); } else { @@ -333,16 +333,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) } } else { SerializablePtr pdxser = (*rsptr)[rows]; - if (instanceOf<PortfolioPdxPtr>(pdxser)) { + if (std::dynamic_pointer_cast<PortfolioPdx>(pdxser)) { PortfolioPdxPtr portfoliopdx = - staticCast<PortfolioPdxPtr>(pdxser); + std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPdxPtr)>(pdxser); printf( " query idx %d pulled portfolioPdx object ID %d, pkid %s " ":: " "\n", i, portfoliopdx->getID(), portfoliopdx->getPkid()); - } else if (instanceOf<PositionPdxPtr>(pdxser)) { - PositionPdxPtr positionpdx = staticCast<PositionPdxPtr>(pdxser); + } else if (std::dynamic_pointer_cast<PositionPdx>(pdxser)) { + PositionPdxPtr positionpdx = std::static_pointer_cast<GF_UNWRAP_SP(PositionPdxPtr)>(pdxser); printf( " query idx %d pulled positionPdx object secId %s, shares " "%d " @@ -350,7 +350,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) i, positionpdx->getSecId(), positionpdx->getSharesOutstanding()); } else { - if (pdxser != NULLPTR) { + if (pdxser != nullptr) { if (pdxser->toString()->isWideString()) { printf(" query idx %d pulled object %S :: \n", i, pdxser->toString()->asWChar()); @@ -384,7 +384,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) bool doAnyErrorOccured = false; QueryHelper* qh = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -422,7 +422,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) continue; } - ResultSetPtr rsptr = dynCast<ResultSetPtr>(results); + auto rsptr = std::dynamic_pointer_cast<ResultSet>(results); SelectResultsIterator iter = rsptr->getIterator(); for (int32_t rows = 0; rows < rsptr->size(); rows++) { if (rows > (int32_t)QueryHelper::getHelper().getPortfolioSetSize()) { @@ -431,13 +431,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) if (!m_isPdx) { SerializablePtr ser = (*rsptr)[rows]; - if (instanceOf<PortfolioPtr>(ser)) { - PortfolioPtr portfolio = staticCast<PortfolioPtr>(ser); + if (std::dynamic_pointer_cast<Portfolio>(ser)) { + PortfolioPtr portfolio = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPtr)>(ser); printf( " query idx %d pulled portfolio object ID %d, pkid %s : \n", i, portfolio->getID(), portfolio->getPkid()->asChar()); - } else if (instanceOf<PositionPtr>(ser)) { - PositionPtr position = staticCast<PositionPtr>(ser); + } else if (std::dynamic_pointer_cast<Position>(ser)) { + PositionPtr position = std::static_pointer_cast<GF_UNWRAP_SP(PositionPtr)>(ser); printf( " query idx %d pulled position object secId %s, shares %d " ": " @@ -445,7 +445,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) i, position->getSecId()->asChar(), position->getSharesOutstanding()); } else { - if (ser != NULLPTR) { + if (ser != nullptr) { printf(" query idx %d pulled object %s : \n", i, ser->toString()->asChar()); } else { @@ -455,15 +455,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) } } else { SerializablePtr ser = (*rsptr)[rows]; - if (instanceOf<PortfolioPdxPtr>(ser)) { - PortfolioPdxPtr portfoliopdx = staticCast<PortfolioPdxPtr>(ser); + if (std::dynamic_pointer_cast<PortfolioPdx>(ser)) { + PortfolioPdxPtr portfoliopdx = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPdxPtr)>(ser); printf( " query idx %d pulled portfolioPdx object ID %d, pkid %s " ": " "\n", i, portfoliopdx->getID(), portfoliopdx->getPkid()); - } else if (instanceOf<PositionPdxPtr>(ser)) { - PositionPdxPtr positionpdx = staticCast<PositionPdxPtr>(ser); + } else if (std::dynamic_pointer_cast<PositionPdx>(ser)) { + PositionPdxPtr positionpdx = std::static_pointer_cast<GF_UNWRAP_SP(PositionPdxPtr)>(ser); printf( " query idx %d pulled positionPdx object secId %s, shares " "%d " @@ -471,7 +471,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) i, positionpdx->getSecId(), positionpdx->getSharesOutstanding()); } else { - if (ser != NULLPTR) { + if (ser != nullptr) { printf(" query idx %d pulled object %s : \n", i, ser->toString()->asChar()); } else { @@ -496,7 +496,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, DoQueryRSError) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp b/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp index 773793c..254db9e 100644 --- a/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp +++ b/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp @@ -57,35 +57,28 @@ const wchar_t* checkNullString(const wchar_t* str) { } void _printFields(CacheablePtr field, Struct* ssptr, int32_t& fields) { - PortfolioPtr portfolio = NULLPTR; - PositionPtr position = NULLPTR; - PortfolioPdxPtr portfolioPdx = NULLPTR; - PositionPdxPtr positionPdx = NULLPTR; - CacheableStringPtr str = NULLPTR; - CacheableBooleanPtr boolptr = NULLPTR; - - if ((portfolio = dynamic_cast<Portfolio*>(field.ptr())) != NULLPTR) { + + if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(field)) { printf(" pulled %s :- ID %d, pkid %s\n", checkNullString(ssptr->getFieldName(fields)), portfolio->getID(), checkNullString(portfolio->getPkid()->asChar())); - } else if ((position = dynamic_cast<Position*>(field.ptr())) != NULLPTR) { + } else if (auto position = std::dynamic_pointer_cast<Position>(field)) { printf(" pulled %s :- secId %s, shares %d\n", checkNullString(ssptr->getFieldName(fields)), checkNullString(position->getSecId()->asChar()), position->getSharesOutstanding()); - } else if ((portfolioPdx = dynamic_cast<PortfolioPdx*>(field.ptr())) != - NULLPTR) { + } else if (auto portfolioPdx = + std::dynamic_pointer_cast<PortfolioPdx>(field)) { printf(" pulled %s :- ID %d, pkid %s\n", checkNullString(ssptr->getFieldName(fields)), portfolioPdx->getID(), checkNullString(portfolioPdx->getPkid())); - } else if ((positionPdx = dynamic_cast<PositionPdx*>(field.ptr())) != - NULLPTR) { + } else if (auto positionPdx = std::dynamic_pointer_cast<PositionPdx>(field)) { printf(" pulled %s :- secId %s, shares %d\n", checkNullString(ssptr->getFieldName(fields)), checkNullString(positionPdx->getSecId()), positionPdx->getSharesOutstanding()); } else { - if ((str = dynamic_cast<CacheableString*>(field.ptr())) != NULLPTR) { + if (auto str = std::dynamic_pointer_cast<CacheableString>(field)) { if (str->isWideString()) { printf(" pulled %s :- %S\n", checkNullString(ssptr->getFieldName(fields)), @@ -95,24 +88,19 @@ void _printFields(CacheablePtr field, Struct* ssptr, int32_t& fields) { checkNullString(ssptr->getFieldName(fields)), checkNullString(str->asChar())); } - } else if ((boolptr = dynamic_cast<CacheableBoolean*>(field.ptr())) != - NULLPTR) { + } else if (auto boolptr = + std::dynamic_pointer_cast<CacheableBoolean>(field)) { printf(" pulled %s :- %s\n", checkNullString(ssptr->getFieldName(fields)), boolptr->toString()->asChar()); } else { - CacheableKeyPtr ptr = NULLPTR; - CacheableStringArrayPtr strArr = NULLPTR; - CacheableHashMapPtr map = NULLPTR; - StructPtr structimpl = NULLPTR; - - if ((ptr = dynamic_cast<CacheableKey*>(field.ptr())) != NULLPTR) { + if (auto ptr = std::dynamic_pointer_cast<CacheableKey>(field)) { char buff[1024] = {'\0'}; ptr->logString(&buff[0], 1024); printf(" pulled %s :- %s \n", checkNullString(ssptr->getFieldName(fields)), buff); - } else if ((strArr = dynamic_cast<CacheableStringArray*>(field.ptr())) != - NULLPTR) { + } else if (auto strArr = + std::dynamic_pointer_cast<CacheableStringArray>(field)) { printf(" string array object printing \n\n"); for (int stri = 0; stri < strArr->length(); stri++) { if (strArr->operator[](stri)->isWideString()) { @@ -125,28 +113,27 @@ void _printFields(CacheablePtr field, Struct* ssptr, int32_t& fields) { checkNullString(strArr->operator[](stri)->asChar())); } } - } else if ((map = dynamic_cast<CacheableHashMap*>(field.ptr())) != - NULLPTR) { + } else if (auto map = + std::dynamic_pointer_cast<CacheableHashMap>(field)) { int index = 0; - for (CacheableHashMap::Iterator iter = map->begin(); iter != map->end(); - iter++) { + for (auto iter = map->begin(); iter != map->end(); iter++) { printf(" hashMap %d of %d ... \n", ++index, map->size()); _printFields(iter.first(), ssptr, fields); _printFields(iter.second(), ssptr, fields); } printf(" end of map \n"); - } else if ((structimpl = dynamic_cast<Struct*>(field.ptr())) != NULLPTR) { + } else if (auto structimpl = std::dynamic_pointer_cast<Struct>(field)) { printf(" structImpl %s {\n", checkNullString(ssptr->getFieldName(fields))); for (int32_t inner_fields = 0; inner_fields < structimpl->length(); inner_fields++) { SerializablePtr field = (*structimpl)[inner_fields]; - if (field == NULLPTR) { + if (field == nullptr) { printf("we got null fields here, probably we have NULL data\n"); continue; } - _printFields(field, structimpl.ptr(), inner_fields); + _printFields(field, structimpl.get(), inner_fields); } // end of field iterations printf(" } //end of %s\n", @@ -168,7 +155,7 @@ void _verifyStructSet(StructSetPtr& ssptr, int i) { continue; } - Struct* siptr = dynamic_cast<Struct*>(((*ssptr)[rows]).ptr()); + Struct* siptr = dynamic_cast<Struct*>(((*ssptr)[rows]).get()); if (siptr == NULL) { printf("siptr is NULL \n\n"); continue; @@ -177,7 +164,7 @@ void _verifyStructSet(StructSetPtr& ssptr, int i) { printf(" Row : %d \n", rows); for (int32_t fields = 0; fields < siptr->length(); fields++) { SerializablePtr field = (*siptr)[fields]; - if (field == NULLPTR) { + if (field == nullptr) { printf("we got null fields here, probably we have NULL data\n"); continue; } @@ -202,19 +189,21 @@ void compareMaps(HashMapOfCacheable& map, HashMapOfCacheable& expectedMap) { } const CacheablePtr& expectedVal = expectedIter.second(); - if (instanceOf<PositionPdxPtr>(expectedVal)) { - const PositionPdxPtr& posVal = dynCast<PositionPdxPtr>(val); + if (std::dynamic_pointer_cast<PositionPdx>(expectedVal)) { + const PositionPdxPtr& posVal = + std::dynamic_pointer_cast<PositionPdx>(val); const PositionPdxPtr& expectedPosVal = - staticCast<PositionPdxPtr>(expectedVal); + std::static_pointer_cast<PositionPdx>(expectedVal); ASSERT(*expectedPosVal->getSecId() == *posVal->getSecId(), "Expected the secIDs to be equal in PositionPdx"); ASSERT(expectedPosVal->getSharesOutstanding() == posVal->getSharesOutstanding(), "Expected the sharesOutstanding to be equal in PositionPdx"); } else { - const PortfolioPdxPtr& portVal = dynCast<PortfolioPdxPtr>(val); + const PortfolioPdxPtr& portVal = + std::dynamic_pointer_cast<PortfolioPdx>(val); const PortfolioPdxPtr& expectedPortVal = - dynCast<PortfolioPdxPtr>(expectedVal); + std::dynamic_pointer_cast<PortfolioPdx>(expectedVal); ASSERT(expectedPortVal->getID() == portVal->getID(), "Expected the IDs to be equal in PortfolioPdx"); ASSERT(expectedPortVal->getNewValSize() == portVal->getNewValSize(), @@ -289,14 +278,14 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepThree) { - RegionPtr regPtr0 = getHelper()->getRegion(qRegionNames[0]); - RegionPtr regPtr1 = regPtr0->getSubregion("Positions"); - RegionPtr regPtr2 = getHelper()->getRegion(qRegionNames[1]); + auto regPtr0 = getHelper()->getRegion(qRegionNames[0]); + auto regPtr1 = regPtr0->getSubregion("Positions"); + auto regPtr2 = getHelper()->getRegion(qRegionNames[1]); - RegionPtr regPtr3 = getHelper()->getRegion(qRegionNames[2]); - RegionPtr regPtr4 = getHelper()->getRegion(qRegionNames[3]); + auto regPtr3 = getHelper()->getRegion(qRegionNames[2]); + auto regPtr4 = getHelper()->getRegion(qRegionNames[3]); - QueryHelper* qh = &QueryHelper::getHelper(); + auto* qh = &QueryHelper::getHelper(); qh->populatePortfolioPdxData(regPtr0, qh->getPortfolioSetSize(), qh->getPortfolioNumSets()); @@ -323,20 +312,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) { SLEEP(100); bool doAnyErrorOccured = false; - QueryHelper* qh = &QueryHelper::getHelper(); + auto* qh = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { - PoolPtr pool1 = findPool(poolNames[0]); + auto pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); } else { qs = getHelper()->cachePtr->getQueryService(); } for (int i = 0; i < QueryStrings::SSOPLsize(); i++) { - QueryPtr qry = - qs->newQuery(const_cast<char*>(structsetQueriesOPL[i].query())); - SelectResultsPtr results = qry->execute(); + auto qry = qs->newQuery(structsetQueriesOPL[i].query()); + auto results = qry->execute(); if (!qh->verifySS(results, structsetRowCountsOPL[i], structsetFieldCountsOPL[i])) { char failmsg[100] = {0}; @@ -345,9 +333,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) continue; } - StructSetPtr ssptr = - StructSetPtr(dynamic_cast<StructSet*>(results.ptr())); - if ((ssptr) == NULLPTR) { + auto ssptr = std::dynamic_pointer_cast<StructSet>(results); + if ((ssptr) == nullptr) { LOG("Zero records were expected and found. Moving onto next. "); continue; } @@ -365,11 +352,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) { SLEEP(100); bool doAnyErrorOccured = false; - QueryHelper* qh = &QueryHelper::getHelper(); + auto qh = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { - PoolPtr pool1 = findPool(poolNames[0]); + auto pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); } else { qs = getHelper()->cachePtr->getQueryService(); @@ -382,9 +369,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) } if (structsetQueries[i].category != unsupported) { - QueryPtr qry = - qs->newQuery(const_cast<char*>(structsetQueries[i].query())); - SelectResultsPtr results = qry->execute(); + auto qry = qs->newQuery(structsetQueries[i].query()); + auto results = qry->execute(); if (!qh->verifySS(results, (qh->isExpectedRowsConstantSS(i) ? structsetRowCounts[i] : structsetRowCounts[i] * @@ -396,9 +382,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) continue; } - StructSetPtr ssptr = - StructSetPtr(dynamic_cast<StructSet*>(results.ptr())); - if ((ssptr) == NULLPTR) { + auto ssptr = std::dynamic_pointer_cast<StructSet>(results); + if ((ssptr) == nullptr) { LOG("Zero records were expected and found. Moving onto next. "); continue; } @@ -417,11 +402,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) { SLEEP(100); bool doAnyErrorOccured = false; - QueryHelper* qh = &QueryHelper::getHelper(); + auto* qh = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { - PoolPtr pool1 = findPool(poolNames[0]); + auto pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); } else { qs = getHelper()->cachePtr->getQueryService(); @@ -434,9 +419,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) } if (structsetParamQueries[i].category != unsupported) { - QueryPtr qry = - qs->newQuery(const_cast<char*>(structsetParamQueries[i].query())); - CacheableVectorPtr paramList = CacheableVector::create(); + auto qry = qs->newQuery(structsetParamQueries[i].query()); + auto paramList = CacheableVector::create(); for (int j = 0; j < numSSQueryParam[i]; j++) { // LOGINFO("NIL::SSPQ::328: queryparamSetSS[%d][%d] = %s", i, j, @@ -449,7 +433,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) } } - SelectResultsPtr results = qry->execute(paramList); + auto results = qry->execute(paramList); if (!qh->verifySS(results, (qh->isExpectedRowsConstantSSPQ(i) ? structsetRowCountsPQ[i] : structsetRowCountsPQ[i] * @@ -461,9 +445,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) continue; } - StructSetPtr ssptr = - StructSetPtr(dynamic_cast<StructSet*>(results.ptr())); - if ((ssptr) == NULLPTR) { + auto ssptr = std::dynamic_pointer_cast<StructSet>(results); + if ((ssptr) == nullptr) { LOG("Zero records were expected and found. Moving onto next. "); continue; } @@ -479,11 +462,11 @@ END_TASK_DEFINITION // on the server DUNIT_TASK_DEFINITION(CLIENT1, GetAll) { - RegionPtr regPtr0 = getHelper()->getRegion(qRegionNames[0]); - RegionPtr regPtr1 = regPtr0->getSubregion("Positions"); - RegionPtr regPtr2 = getHelper()->getRegion(qRegionNames[1]); - RegionPtr regPtr3 = getHelper()->getRegion(qRegionNames[2]); - RegionPtr regPtr4 = getHelper()->getRegion(qRegionNames[3]); + auto regPtr0 = getHelper()->getRegion(qRegionNames[0]); + auto regPtr1 = regPtr0->getSubregion("Positions"); + auto regPtr2 = getHelper()->getRegion(qRegionNames[1]); + auto regPtr3 = getHelper()->getRegion(qRegionNames[2]); + auto regPtr4 = getHelper()->getRegion(qRegionNames[3]); // reset the counter for uniform population of position objects PositionPdx::resetCounter(); @@ -495,7 +478,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetAll) HashMapOfCacheable expectedPosMap; HashMapOfCacheable expectedPortMap; - QueryHelper& qh = QueryHelper::getHelper(); + auto& qh = QueryHelper::getHelper(); int setSize = qh.getPositionSetSize(); int numSets = qh.getPositionNumSets(); @@ -504,10 +487,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetAll) char posname[100] = {0}; ACE_OS::sprintf(posname, "pos%d-%d", set, current); - CacheableKeyPtr posKey(CacheableKey::create(posname)); - CacheablePtr pos = NULLPTR; - pos = CacheablePtr( - new PositionPdx(secIds[current % numSecIds], current * 100)); + auto posKey(CacheableKey::create(posname)); + auto pos = std::make_shared<PositionPdx>(secIds[current % numSecIds], + current * 100); posKeys.push_back(posKey); expectedPosMap.insert(posKey, pos); @@ -524,17 +506,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetAll) char portname[100] = {0}; ACE_OS::sprintf(portname, "port%d-%d", set, current); - CacheableKeyPtr portKey(CacheableKey::create(portname)); - CacheablePtr port = NULLPTR; - port = CacheablePtr(new PortfolioPdx(current, 1)); + auto portKey = CacheableKey::create(portname); + auto port = std::make_shared<PortfolioPdx>(current, 1); portKeys.push_back(portKey); expectedPortMap.insert(portKey, port); } } - HashMapOfCacheablePtr resMap(new HashMapOfCacheable()); - HashMapOfExceptionPtr exMap(new HashMapOfException()); + auto resMap = std::make_shared<HashMapOfCacheable>(); + auto exMap = std::make_shared<HashMapOfException>(); // execute getAll for different regions and verify results regPtr0->getAll(portKeys, resMap, exMap); @@ -566,11 +547,11 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, DoQuerySSError) { - QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); + auto* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { - PoolPtr pool1 = findPool(poolNames[0]); + auto pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); } else { qs = getHelper()->cachePtr->getQueryService(); @@ -578,11 +559,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, DoQuerySSError) for (int i = 0; i < QueryStrings::SSsize(); i++) { if (structsetQueries[i].category == unsupported) { - QueryPtr qry = - qs->newQuery(const_cast<char*>(structsetQueries[i].query())); + auto qry = qs->newQuery(structsetQueries[i].query()); try { - SelectResultsPtr results = qry->execute(); + auto results = qry->execute(); char failmsg[100] = {0}; ACE_OS::sprintf(failmsg, "Query exception didnt occur for index %d", http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp index ccd016b..538cb27 100644 --- a/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp +++ b/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp @@ -134,7 +134,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -178,7 +178,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -218,7 +218,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -262,7 +262,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -302,7 +302,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -355,7 +355,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -405,7 +405,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyNegativeValueTimeout) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); @@ -451,7 +451,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyLargeValueTimeout) { QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); - QueryServicePtr qs = NULLPTR; + QueryServicePtr qs = nullptr; if (isPoolConfig) { PoolPtr pool1 = findPool(poolNames[0]); qs = pool1->getQueryService(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp b/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp index 422685e..e8a7ab0 100644 --- a/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp +++ b/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp @@ -328,7 +328,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) region->selectValue(const_cast<char*>(regionQueries[i].query())); /* - if (result == NULLPTR) + if (result == nullptr) { char logmsg[100] = {0}; ACE_OS::sprintf(logmsg, "Query # %d query selectValue result is @@ -370,7 +370,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) } try { - SelectResultsPtr results = region->selectValue(""); + auto results = + std::dynamic_pointer_cast<SelectResults>(region->selectValue("")); FAIL("Expected IllegalArgumentException exception for empty predicate"); } catch (apache::geode::client::IllegalArgumentException ex) { LOG("got expected IllegalArgumentException exception for empty " @@ -379,8 +380,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) } try { - SelectResultsPtr results = region->selectValue( - const_cast<char*>(regionQueries[0].query()), 2200000); + auto results = + std::dynamic_pointer_cast<SelectResults>(region->selectValue( + const_cast<char*>(regionQueries[0].query()), 2200000)); FAIL("Expected IllegalArgumentException exception for invalid timeout"); } catch (apache::geode::client::IllegalArgumentException ex) { LOG("got expected IllegalArgumentException exception for invalid " @@ -389,8 +391,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) } try { - SelectResultsPtr results = - region->selectValue(const_cast<char*>(regionQueries[0].query()), -1); + auto results = std::dynamic_pointer_cast<SelectResults>( + region->selectValue(const_cast<char*>(regionQueries[0].query()), -1)); FAIL("Expected IllegalArgumentException exception for invalid timeout"); } catch (apache::geode::client::IllegalArgumentException ex) { LOG("got expected IllegalArgumentException exception for invalid " @@ -398,7 +400,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive) LOG(ex.getMessage()); } try { - SelectResultsPtr results = region->selectValue("bad predicate"); + auto results = std::dynamic_pointer_cast<SelectResults>( + region->selectValue("bad predicate")); FAIL("Expected IllegalArgumentException exception for wrong predicate"); } catch (QueryException ex) { LOG("got expected QueryException for wrong predicate:");
