http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoveOps.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientRemoveOps.cpp b/src/cppcache/integration-test/testThinClientRemoveOps.cpp index a79162c..5f6e3b9 100644 --- a/src/cppcache/integration-test/testThinClientRemoveOps.cpp +++ b/src/cppcache/integration-test/testThinClientRemoveOps.cpp @@ -99,7 +99,7 @@ void _verifyEntry(const char* name, const char* key, const char* val, free(buf); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); CacheableKeyPtr keyPtr = createKey(key); @@ -137,10 +137,10 @@ void _verifyEntry(const char* name, const char* key, const char* val, } if (val != NULL) { - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); + auto checkPtr = + std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null."); + ASSERT(checkPtr != nullptr, "Value Ptr should not be null."); char buf[1024]; sprintf(buf, "In verify loop, get returned %s for key %s", checkPtr->asChar(), key); @@ -194,8 +194,8 @@ void createRegion(const char* name, bool ackMode, fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); RegionPtr regPtr = getHelper()->createRegion( - name, ackMode, cachingEnable, NULLPTR, clientNotificationEnabled); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + name, ackMode, cachingEnable, nullptr, clientNotificationEnabled); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } @@ -209,7 +209,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."); } @@ -223,7 +223,7 @@ void putEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -247,7 +247,7 @@ void localPutEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); regPtr->localPut(keyPtr, valPtr); LOG("LocalPut entry done."); @@ -289,7 +289,7 @@ void updateEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region."); ASSERT(regPtr->containsValueForKey(keyPtr), @@ -314,12 +314,12 @@ void doGetAgain(const char* name, const char* key, const char* value) { RegionPtr regPtr = getHelper()->getRegion(name); fprintf(stdout, "get region name%s\n", regPtr->getName()); fflush(stdout); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch + auto checkPtr = std::dynamic_pointer_cast<CacheableString>( + regPtr->get(keyPtr)); // force a netsearch - if (checkPtr != NULLPTR) { + if (checkPtr != nullptr) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In doGetAgain, get returned %s for key %s", @@ -346,7 +346,7 @@ void doNetsearch(const char* name, const char* key, const char* value) { RegionPtr regPtr = getHelper()->getRegion(name); fprintf(stdout, "netsearch region %s\n", regPtr->getName()); fflush(stdout); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); if (count == 0) { ASSERT(!regPtr->containsKey(keyPtr), @@ -355,10 +355,10 @@ void doNetsearch(const char* name, const char* key, const char* value) { "Value should not have been found in region."); count++; } - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch + auto checkPtr = std::dynamic_pointer_cast<CacheableString>( + regPtr->get(keyPtr)); // force a netsearch - if (checkPtr != NULLPTR) { + if (checkPtr != nullptr) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", @@ -637,10 +637,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix) putEntry(regionNames[1], keys[3], vals[3]); reg0->localInvalidate(keys[1]); reg1->localInvalidate(keys[3]); - ASSERT(reg0->remove(keys[1], (CacheablePtr)NULLPTR) == false, + ASSERT(reg0->remove(keys[1], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value is not present " "locally, but present only on server."); - ASSERT(reg1->remove(keys[3], (CacheablePtr)NULLPTR) == false, + ASSERT(reg1->remove(keys[3], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value is not present " "locally, but present only on server."); ASSERT(reg0->containsKey(keys[1]) == true, "containsKey should be true"); @@ -673,10 +673,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix) // Try removing a entry with a null value, which is not present on client as // well as server, result should be false. - ASSERT(reg0->remove("NewKey1", (CacheablePtr)NULLPTR) == false, + ASSERT(reg0->remove("NewKey1", (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value is not present " "locally, and not present on server."); - ASSERT(reg1->remove("NewKey3", (CacheablePtr)NULLPTR) == false, + ASSERT(reg1->remove("NewKey3", (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value is not present " "locally, and not present on server."); ASSERT(reg0->containsKey("NewKey1") == false, @@ -715,10 +715,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix) putEntry(regionNames[1], keys[3], nvals[3]); reg0->destroy(keys[1]); reg1->destroy(keys[3]); - ASSERT(reg0->remove(keys[1], (CacheablePtr)NULLPTR) == false, + ASSERT(reg0->remove(keys[1], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value does not exist " "locally, but exists on server."); - ASSERT(reg1->remove(keys[3], (CacheablePtr)NULLPTR) == false, + ASSERT(reg1->remove(keys[3], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value does not exist " "locally, but exists on server."); ASSERT(reg0->containsKey(keys[1]) == false, "containsKey should be false"); @@ -840,10 +840,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix) reg1->localPut(keys[3], vals[3]); reg0->invalidate(keys[1]); reg1->invalidate(keys[3]); - ASSERT(reg0->localRemove(keys[1], (CacheablePtr)NULLPTR) == true, + ASSERT(reg0->localRemove(keys[1], (CacheablePtr)nullptr) == true, "Result of remove should be true, as this value does not exists " "locally."); - ASSERT(reg1->localRemove(keys[3], (CacheablePtr)NULLPTR) == true, + ASSERT(reg1->localRemove(keys[3], (CacheablePtr)nullptr) == true, "Result of remove should be true, as this value does not exists " "locally."); ASSERT(reg0->containsKey(keys[1]) == false, "containsKey should be false"); @@ -853,10 +853,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix) // Try locally removing an entry (value) with a NULL. reg0->localPut(keys[1], vals[1]); reg1->localPut(keys[3], vals[3]); - ASSERT(reg0->localRemove(keys[1], (CacheablePtr)NULLPTR) == false, + ASSERT(reg0->localRemove(keys[1], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value does not exists " "locally."); - ASSERT(reg1->localRemove(keys[3], (CacheablePtr)NULLPTR) == false, + ASSERT(reg1->localRemove(keys[3], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value does not exists " "locally."); ASSERT(reg0->containsKey(keys[1]) == true, "containsKey should be true"); @@ -883,10 +883,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix) reg1->localPut(keys[3], vals[3]); reg0->localDestroy(keys[1]); reg1->localDestroy(keys[3]); - ASSERT(reg0->localRemove(keys[1], (CacheablePtr)NULLPTR) == false, + ASSERT(reg0->localRemove(keys[1], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value does not exists " "locally."); - ASSERT(reg1->localRemove(keys[3], (CacheablePtr)NULLPTR) == false, + ASSERT(reg1->localRemove(keys[3], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value does not exists " "locally."); ASSERT(reg0->containsKey(keys[1]) == false, "containsKey should be false"); @@ -973,10 +973,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) reg->localDestroy(keys[0]); reg->localDestroy(keys[1]); SLEEP(10000); // This is for expiration on server to execute. - ASSERT(reg->remove(keys[0], (CacheablePtr)NULLPTR) == true, + ASSERT(reg->remove(keys[0], (CacheablePtr)nullptr) == true, "Result of remove should be true, as this value is not present " "locally, & not present on server."); - ASSERT(reg->remove(keys[1], (CacheablePtr)NULLPTR) == true, + ASSERT(reg->remove(keys[1], (CacheablePtr)nullptr) == true, "Result of remove should be true, as this value is not present " "locally, & not present on server."); ASSERT(reg->containsKeyOnServer(keyPtr) == false, @@ -1012,11 +1012,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) putEntry(regionNames[2], keys[1], nvals[1]); SLEEP(10000); // This is for expiration on server to execute. ASSERT( - reg->remove(keys[0], (CacheablePtr)NULLPTR) == false, + reg->remove(keys[0], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value is present locally, " "& not present on server."); ASSERT( - reg->remove(keys[1], (CacheablePtr)NULLPTR) == false, + reg->remove(keys[1], (CacheablePtr)nullptr) == false, "Result of remove should be false, as this value is present locally, " "& not present on server."); ASSERT(reg->containsKey(keys[0]) == true, "containsKey should be true"); @@ -1037,10 +1037,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) reg->invalidate(keys[0]); reg->invalidate(keys[1]); SLEEP(10000); // This is for expiration on server to execute. - ASSERT(reg->remove(keys[0], (CacheablePtr)NULLPTR) == true, + ASSERT(reg->remove(keys[0], (CacheablePtr)nullptr) == true, "Result of remove should be true, as this value is not present " "locally, & not present on server."); - ASSERT(reg->remove(keys[1], (CacheablePtr)NULLPTR) == true, + ASSERT(reg->remove(keys[1], (CacheablePtr)nullptr) == true, "Result of remove should be true, as this value is not present " "locally, & not present on server."); ASSERT(reg->containsKey(keys[0]) == false, "containsKey should be false"); @@ -1179,17 +1179,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) int intKey = 1; int intVal = 1; regPtr0->localCreate(intKey, CacheableInt32::create(intVal)); - CacheableInt32Ptr vInt = dynCast<CacheableInt32Ptr>(regPtr0->get(intKey)); + auto vInt = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(intKey)); ASSERT(vInt->value() == 1, "Int Key Int Val Mismatch."); regPtr0->localInvalidate(intKey); - vInt = dynCast<CacheableInt32Ptr>(regPtr0->get(intKey)); - ASSERT(vInt == NULLPTR, "valueshould not be found from sever"); + vInt = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(intKey)); + ASSERT(vInt == nullptr, "valueshould not be found from sever"); intKey = 2; const char* strVal = "IntKeyStringValue"; regPtr0->localCreate(intKey, strVal); - CacheableStringPtr vString = - dynCast<CacheableStringPtr>(regPtr0->get(intKey)); + auto vString = + std::dynamic_pointer_cast<CacheableString>(regPtr0->get(intKey)); ASSERT(strcmp(vString->asChar(), strVal) == 0, "Int Key and String Value Mismatch"); @@ -1198,7 +1198,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) try { regPtr0->localCreate(CacheableInt32::create(key1), CacheableInt32::create(val1)); - CacheableInt32Ptr vall = dynCast<CacheableInt32Ptr>(regPtr0->get(key1)); + auto vall = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(key1)); FAIL("Expected EntryExistException here"); } catch (EntryExistsException e) { LOG(" Expected EntryExistsException exception thrown by localCreate"); @@ -1208,21 +1208,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) int64_t longVal = 200; regPtr0->localCreate(CacheableInt64::create(longKey), CacheableInt64::create(longVal)); - CacheableInt64Ptr vLong = dynCast<CacheableInt64Ptr>( + auto vLong = std::dynamic_pointer_cast<CacheableInt64>( regPtr0->get(CacheableInt64::create(longKey))); ASSERT(vLong->value() == 200, "Long Key Long Val Mismatch."); const char* strKey = "StrKeyIntValueKey"; intVal = 1234; regPtr0->localCreate(strKey, CacheableInt32::create(intVal)); - CacheableInt32Ptr vIntPtr = - dynCast<CacheableInt32Ptr>(regPtr0->get(strKey)); + auto vIntPtr = + std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(strKey)); ASSERT(vIntPtr->value() == 1234, "String Key Int Val Mismatch."); longKey = 1111; strVal = "LongKeyStringValue"; regPtr0->localCreate(CacheableInt64::create(longKey), strVal); - CacheableStringPtr vStr = dynCast<CacheableStringPtr>( + auto vStr = std::dynamic_pointer_cast<CacheableString>( regPtr0->get(CacheableInt64::create(longKey))); ASSERT(strcmp(vStr->asChar(), strVal) == 0, "Long Key and String Value Mismatch"); @@ -1230,21 +1230,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) strKey = "StringKey1"; strVal = "StringKeyStringValue"; regPtr0->localCreate(strKey, strVal); - CacheableStringPtr v = dynCast<CacheableStringPtr>(regPtr0->get(strKey)); + auto v = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(strKey)); ASSERT(strcmp(v->asChar(), strVal) == 0, "String Key and String Value Mismatch"); int i = 1234; regPtr0->localCreate(CacheableInt32::create(i), CacheableInt32::create(i)); - CacheableInt32Ptr result = - dynCast<CacheableInt32Ptr>(regPtr0->get(CacheableInt32::create(i))); + auto result = std::dynamic_pointer_cast<CacheableInt32>( + regPtr0->get(CacheableInt32::create(i))); ASSERT(result->value() == i, "localcreate new entry with cacheableInt key and cacheableInt value " "Fail"); regPtr0->localCreate(CacheableInt32::create(12345), CacheableString::create("abced")); - CacheableStringPtr resultString = dynCast<CacheableStringPtr>( + auto resultString = std::dynamic_pointer_cast<CacheableString>( regPtr0->get(CacheableInt32::create(12345))); ASSERT(strcmp(resultString->asChar(), "abced") == 0, "localcreate new with entry cacheableInt key and cacheablestring " @@ -1252,8 +1252,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) regPtr0->localCreate(CacheableString::create("X"), CacheableString::create("Y")); - CacheableStringPtr resultStringY = - dynCast<CacheableStringPtr>(regPtr0->get(CacheableString::create("X"))); + auto resultStringY = std::dynamic_pointer_cast<CacheableString>( + regPtr0->get(CacheableString::create("X"))); ASSERT(strcmp(resultStringY->asChar(), "Y") == 0, "localcreate new with entry cacheablestring key and cacheablestring " "value"); @@ -1270,8 +1270,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) } regPtr0->localDestroy(CacheableString::create("X")); - if (dynCast<CacheableStringPtr>( - regPtr0->get(CacheableString::create("X"))) != NULLPTR) { + if (std::dynamic_pointer_cast<CacheableString>( + regPtr0->get(CacheableString::create("X"))) != nullptr) { LOG("Expected : localDestroy should have failed."); } @@ -1321,13 +1321,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) LOGINFO("Expected IllegalArgumentException : %s", ex.getMessage()); } - CacheableKeyPtr keyObject1(new PdxTests::PdxType()); + auto keyObject1 = std::make_shared<PdxTests::PdxType>(); regPtr0->localCreate(keyObject1, x); CacheablePtr retVal = regPtr0->get(keyObject1); ASSERT(retVal == x, "retVal and x should match."); regPtr0->localInvalidate(keyObject1); retVal = regPtr0->get(keyObject1); - ASSERT(retVal == NULLPTR, "value should not be found"); + ASSERT(retVal == nullptr, "value should not be found"); ASSERT(regPtr0->localRemove(keyObject1, x) == true, "Result of remove should be true, as this value nullptr exists " "locally."); @@ -1346,7 +1346,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) try { // retVal = regPtr0->get(keyObject1); retVal = regPtr0->get(x); - ASSERT(retVal == NULLPTR, "value should not be found"); + ASSERT(retVal == nullptr, "value should not be found"); FAIL("Expected IllegalArgumentException here for get"); } catch (Exception) { LOG(" Expected exception thrown by get"); @@ -1362,7 +1362,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) regPtr0->localPut(keyObject1, 1); regPtr0->localInvalidate(keyObject1); retVal = regPtr0->get(keyObject1); - ASSERT(retVal == NULLPTR, "value should not be found"); + ASSERT(retVal == nullptr, "value should not be found"); ASSERT(regPtr0->localRemove(keyObject1, 1) == false, "Result of remove should be false, as this value does not exists " "locally."); @@ -1373,15 +1373,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) "Result of remove should be true, as this value exists locally."); ASSERT(regPtr0->containsKey(keyObject1) == false, "containsKey should be false"); - CacheableKeyPtr keyObject2(new PdxTests::PdxType()); + auto keyObject2 = std::make_shared<PdxTests::PdxType>(); regPtr0->localCreate(keyObject2, 1); - CacheableInt32Ptr intVal1 = regPtr0->get(keyObject2); + auto intVal1 = + std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyObject2)); ASSERT(intVal1->value() == 1, "intVal should be 1."); regPtr0->invalidate(keyObject2); - intVal1 = dynCast<CacheableInt32Ptr>(regPtr0->get(keyObject2)); - ASSERT(intVal1 == NULLPTR, "intVal should be null."); + intVal1 = + std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyObject2)); + ASSERT(intVal1 == nullptr, "intVal should be null."); - CacheableKeyPtr keyObject3(new PdxTests::PdxType()); + auto keyObject3 = std::make_shared<PdxTests::PdxType>(); regPtr0->localCreate(keyObject3, "testString"); if (regPtr0->containsKey(keyObject3)) { CacheablePtr strVal1 = regPtr0->get(keyObject3); @@ -1397,15 +1399,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) LOG(" Expected EntryExistsException exception thrown by localCreate"); } - CacheableKeyPtr keyObject4(new PdxTests::PdxType()); - PdxTests::PdxTypePtr valObject1(new PdxTests::PdxType()); + auto keyObject4 = std::make_shared<PdxTests::PdxType>(); + auto valObject1 = std::make_shared<PdxTests::PdxType>(); regPtr0->localCreate(keyObject4, valObject1); PdxTests::PdxTypePtr objVal1 = - dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyObject4)); + std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyObject4)); ASSERT(valObject1 == objVal1, "valObject and objVal should match."); regPtr0->localInvalidate(keyObject4); - objVal1 = dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyObject4)); - ASSERT(objVal1 == NULLPTR, "valueshould not be found"); + objVal1 = + std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyObject4)); + ASSERT(objVal1 == nullptr, "valueshould not be found"); ASSERT(regPtr0->localRemove(keyObject4, valObject1) == false, "Result of remove should be false, as this value does not exists " "locally."); @@ -1424,7 +1427,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve) regPtr0->localPut(keyObject4, valObject1); regPtr0->localDestroy(keyObject4); /*try { - objVal1 = dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyObject4));;// + objVal1 = std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyObject4));;// need to verify that if entry is deleted then some exception should be thrown FAIL("Expected EntryExistException here for get"); }catch (Exception)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp b/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp index 3920f6f..867ac80 100644 --- a/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp +++ b/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp @@ -72,10 +72,10 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators, LOG("createRegion_Pool() entered."); fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); - RegionPtr regPtr = + auto 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."); } @@ -85,11 +85,11 @@ void createEntry(const char* name, const char* key, const char* value) { value, name); fflush(stdout); // Create entry, verify entry is correct - CacheableKeyPtr keyPtr = createKey(key); - CacheableStringPtr valPtr = CacheableString::create(value); + auto keyPtr = createKey(key); + auto valPtr = CacheableString::create(value); - RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + auto regPtr = getHelper()->getRegion(name); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -144,7 +144,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators) createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true); RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); try { - regPtr->registerAllKeys(false, NULLPTR, false, false); + regPtr->registerAllKeys(false, nullptr, false, false); FAIL("Should have got NotConnectedException during registerAllKeys"); } catch (NotConnectedException exp) { http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp b/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp index e6282f4..53ebc9f 100644 --- a/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp +++ b/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp @@ -75,7 +75,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."); } @@ -89,7 +89,7 @@ void createEntry(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -144,7 +144,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators) createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true); RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); try { - regPtr->registerAllKeys(false, NULLPTR, false, false); + regPtr->registerAllKeys(false, nullptr, false, false); FAIL("Should have got NotConnectedException during registerAllKeys"); } catch (NotConnectedException exp) { http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp b/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp index 26214d9..402c5e3 100644 --- a/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp +++ b/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp @@ -73,10 +73,10 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators, LOG("createRegion_Pool() entered."); fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode); fflush(stdout); - RegionPtr regPtr = + auto 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."); } @@ -86,11 +86,11 @@ void createEntry(const char* name, const char* key, const char* value) { value, name); fflush(stdout); // Create entry, verify entry is correct - CacheableKeyPtr keyPtr = createKey(key); - CacheableStringPtr valPtr = CacheableString::create(value); + auto keyPtr = createKey(key); + auto valPtr = CacheableString::create(value); - RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + auto regPtr = getHelper()->getRegion(name); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(!regPtr->containsKey(keyPtr), "Key should not have been found in region."); @@ -145,7 +145,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators) createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true); RegionPtr regPtr = getHelper()->getRegion(regionNames[0]); try { - regPtr->registerAllKeys(false, NULLPTR, false, false); + regPtr->registerAllKeys(false, nullptr, false, false); FAIL("Should have got NotConnectedException during registerAllKeys"); } catch (NotConnectedException exp) { http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp b/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp index ac01544..e91ddbf 100644 --- a/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp +++ b/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp @@ -64,7 +64,7 @@ void initCredentialGenerator() { } } - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -137,20 +137,20 @@ void initClientAuth(char UserType) { break; } - CacheableStringPtr alias(config->find("security-alias")); - CacheableStringPtr uname(config->find("security-username")); - CacheableStringPtr passwd(config->find("security-password")); + auto alias = config->find("security-alias"); + auto uname = config->find("security-username"); + auto passwd = config->find("security-password"); char msgAlias[100]; char msgUname[100]; char msgPasswd[100]; sprintf(msgAlias, "PKCS alias is %s", - alias == NULLPTR ? "null" : alias->asChar()); + alias == nullptr ? "null" : alias->asChar()); sprintf(msgUname, "username is %s", - uname == NULLPTR ? "null" : uname->asChar()); + uname == nullptr ? "null" : uname->asChar()); sprintf(msgPasswd, "password is %s", - passwd == NULLPTR ? "null" : passwd->asChar()); + passwd == nullptr ? "null" : passwd->asChar()); LOG(msgAlias); LOG(msgUname); @@ -239,9 +239,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regPtr->getAll(entrykeys, valuesMap, NULLPTR, false); + regPtr->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { LOG("GetAll completed successfully"); } else { @@ -251,7 +251,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) LOG("Query completed successfully"); PoolPtr pool = PoolManager::find(regionNamesAuth[0]); QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { @@ -260,11 +260,11 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); LOG("CQ completed successfully"); - if (pool != NULLPTR) { + if (pool != nullptr) { FunctionService::onServer(pool) ->execute("securityTest", true) ->getResult(); @@ -288,7 +288,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) createEntry(regionNamesAuth[0], keys[2], vals[2]); LOG("Entry created successfully"); RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); - if (regPtr0 != NULLPTR) { + if (regPtr0 != nullptr) { LOG("Going to do registerAllKeys"); regPtr0->registerAllKeys(); LOG("Going to do unregisterAllKeys"); @@ -338,9 +338,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) try { RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - if (checkPtr != NULLPTR) { + auto checkPtr = + std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + if (checkPtr != nullptr) { char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", checkPtr->asChar(), keys[2]); @@ -367,9 +367,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false); + regPtr0->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { FAIL("GetAll should not have completed successfully"); } @@ -386,7 +386,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) try { QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { @@ -395,7 +395,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); FAIL("CQ should not have completed successfully"); @@ -403,7 +403,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) HANDLE_NOT_AUTHORIZED_EXCEPTION try { - if (pool != NULLPTR) { + if (pool != nullptr) { FunctionService::onServer(pool) ->execute("securityTest", true) ->getResult(); @@ -467,9 +467,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) try { RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - if (checkPtr != NULLPTR) { + auto checkPtr = + std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + if (checkPtr != nullptr) { char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", checkPtr->asChar(), keys[2]); @@ -481,7 +481,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NO_NOT_AUTHORIZED_EXCEPTION RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); - if (regPtr0 != NULLPTR) { + if (regPtr0 != nullptr) { try { LOG("Going to do registerAllKeys"); regPtr0->registerAllKeys(); @@ -507,9 +507,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false); + regPtr0->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { LOG("GetAll completed successfully"); } else { @@ -528,7 +528,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) try { QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { @@ -537,7 +537,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); // FAIL("CQ should not have completed successfully"); @@ -545,7 +545,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NOT_AUTHORIZED_EXCEPTION try { - if (pool != NULLPTR) { + if (pool != nullptr) { FunctionService::onServer(pool) ->execute("securityTest", true) ->getResult(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp index a5b4285..3de9f27 100644 --- a/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp +++ b/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp @@ -63,7 +63,7 @@ void initCredentialGenerator() { } } - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -73,7 +73,7 @@ void initCredentialGenerator() { void initClientAuth(char credentialsType) { PropertiesPtr config = Properties::create(); - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } bool insertAuthInit = true; @@ -128,7 +128,7 @@ DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer1) { initCredentialGenerator(); std::string cmdServerAuthenticator; - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -257,9 +257,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFive) createRegionForSecurity(regionNamesAuth[1], USE_ACK, true); RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - if (checkPtr != NULLPTR && !strcmp(nvals[0], checkPtr->asChar())) { + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + if (checkPtr != nullptr && !strcmp(nvals[0], checkPtr->asChar())) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", @@ -306,7 +305,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSeven) CacheHelper::setJavaConnectionPoolSize(0); SLEEP(500); try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, NULLPTR, true, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, nullptr, true, 0); FAIL("Should have thrown AuthenticationFailedException."); } catch ( @@ -332,7 +331,7 @@ void createEntryTx(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); // ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in // region." ); @@ -357,7 +356,7 @@ void updateEntryTx(const char* name, const char* key, const char* value) { CacheableStringPtr valPtr = CacheableString::create(value); RegionPtr regPtr = getHelper()->getRegion(name); - ASSERT(regPtr != NULLPTR, "Region not found."); + ASSERT(regPtr != nullptr, "Region not found."); ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region."); ASSERT(regPtr->containsValueForKey(keyPtr), @@ -387,12 +386,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) LOG("txManager commit done"); CacheableKeyPtr keyPtr = CacheableKey::create("TxKey"); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value not found."); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + ASSERT(checkPtr != nullptr, "Value not found."); LOGINFO("checkPtr->asChar() = %s ", checkPtr->asChar()); ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct."); - if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) { + if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", @@ -409,10 +407,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) txManager->rollback(); LOG("txManager rollback done"); - checkPtr = dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - ASSERT(checkPtr != NULLPTR, "Value not found."); + checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + ASSERT(checkPtr != nullptr, "Value not found."); ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct."); - if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) { + if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp index 1604efc..ea2c85e 100644 --- a/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp +++ b/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp @@ -66,7 +66,7 @@ void initCredentialGenerator() { } } - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -78,7 +78,7 @@ void initClientAuth(char credentialsType) { printf(" in initclientAuth 0 = %c ", credentialsType); userCreds = Properties::create(); PropertiesPtr config = Properties::create(); - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } bool insertAuthInit = true; @@ -135,7 +135,7 @@ DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer1) { initCredentialGenerator(); std::string cmdServerAuthenticator; - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -185,13 +185,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne) try { LOG(" 4"); - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); LOG(" 5"); // need to insure pool name PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); RegionServicePtr virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -218,12 +218,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo) { initClientAuth(CORRECT_CREDENTIALS); try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); char buff[128] = {'\0'}; sprintf(buff, "%s_0", regionNamesAuth[0]); PoolPtr pool = getPool(regionNamesAuth[0]); - if (pool != NULLPTR) { + if (pool != nullptr) { RegionServicePtr virtualCache = getVirtualCache(userCreds, pool); RegionPtr virtualRegion = virtualCache->getRegion(regionNamesAuth[0]); virtualRegion->create(keys[0], vals[0]); @@ -248,11 +248,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree) initCredentialGenerator(); initClientAuth(CORRECT_CREDENTIALS); try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); // need to insure pool name PoolPtr pool = getPool(regionNamesAuth[0]); - if (pool != NULLPTR) { + if (pool != nullptr) { RegionServicePtr virtualCache = getVirtualCache(userCreds, pool); virtualCache->getRegion(regionNamesAuth[0])->put(keys[0], vals[0]); } else { @@ -279,11 +279,11 @@ DUNIT_TASK_DEFINITION(CLIENT3, StepFour) } try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); // need to insure pool name PoolPtr pool = getPool(regionNamesAuth[0]); - if (pool != NULLPTR) { + if (pool != nullptr) { RegionServicePtr virtualCache = getVirtualCache(userCreds, pool); virtualCache->getRegion(regionNamesAuth[0])->put(keys[0], vals[0]); } else { @@ -311,13 +311,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFive) { SLEEP(80); try { - createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, nullptr, false, -1, true, 0); // need to insure pool name PoolPtr pool = getPool(regionNamesAuth[1]); RegionServicePtr virtualCache; RegionPtr virtualRegion; - if (pool != NULLPTR) { + if (pool != nullptr) { virtualCache = getVirtualCache(userCreds, pool); virtualRegion = virtualCache->getRegion(regionNamesAuth[1]); } else { @@ -325,9 +325,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFive) } CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]); LOG("before get"); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(virtualRegion->get(keyPtr)); - if (checkPtr != NULLPTR && !strcmp(nvals[0], checkPtr->asChar())) { + auto checkPtr = std::dynamic_pointer_cast<CacheableString>( + virtualRegion->get(keyPtr)); + if (checkPtr != nullptr && !strcmp(nvals[0], checkPtr->asChar())) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", @@ -349,12 +349,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix) { initClientAuth(CORRECT_CREDENTIALS); try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); char buff[128] = {'\0'}; sprintf(buff, "%s_1", regionNamesAuth[0]); PoolPtr pool = getPool(regionNamesAuth[0]); - if (pool != NULLPTR) { + if (pool != nullptr) { RegionServicePtr virtualCache = getVirtualCache(userCreds, pool); RegionPtr virtualRegion = virtualCache->getRegion(regionNamesAuth[0]); virtualRegion->create(keys[0], vals[0]); @@ -385,12 +385,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSeven) CacheHelper::setJavaConnectionPoolSize(0); SLEEP(500); try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); char buff[128] = {'\0'}; sprintf(buff, "%s_0", regionNamesAuth[0]); PoolPtr pool = getPool(regionNamesAuth[0]); - if (pool != NULLPTR) { + if (pool != nullptr) { RegionServicePtr virtualCache = getVirtualCache(userCreds, pool); RegionPtr virtualRegion = virtualCache->getRegion(regionNamesAuth[0]); virtualRegion->create(keys[0], vals[0]); @@ -417,13 +417,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) { initClientAuth(CORRECT_CREDENTIALS); try { - createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, nullptr, false, -1, true, 0); // need to insure pool name PoolPtr pool = getPool(regionNamesAuth[1]); RegionServicePtr virtualCache; RegionPtr virtualRegion; - if (pool != NULLPTR) { + if (pool != nullptr) { virtualCache = getVirtualCache(userCreds, pool); virtualRegion = virtualCache->getRegion(regionNamesAuth[1]); } else { @@ -440,12 +440,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) txManager->commit(); LOG("txManager commit done"); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(virtualRegion->get("TxKey")); - ASSERT(checkPtr != NULLPTR, "Value not found."); + auto checkPtr = std::dynamic_pointer_cast<CacheableString>( + virtualRegion->get("TxKey")); + ASSERT(checkPtr != nullptr, "Value not found."); LOGINFO("checkPtr->asChar() = %s ", checkPtr->asChar()); ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct."); - if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) { + if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", @@ -462,10 +462,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight) txManager->rollback(); LOG("txManager rollback done"); - checkPtr = dynCast<CacheableStringPtr>(virtualRegion->get("TxKey")); - ASSERT(checkPtr != NULLPTR, "Value not found."); + checkPtr = std::dynamic_pointer_cast<CacheableString>( + virtualRegion->get("TxKey")); + ASSERT(checkPtr != nullptr, "Value not found."); ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct."); - if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) { + if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) { LOG("checkPtr is not null"); char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp index bba4893..6049dec 100644 --- a/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp +++ b/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp @@ -62,7 +62,7 @@ void initCredentialGenerator() { } } - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -135,20 +135,20 @@ void initClientAuth(char UserType) { break; } - CacheableStringPtr alias(config->find("security-alias")); - CacheableStringPtr uname(config->find("security-username")); - CacheableStringPtr passwd(config->find("security-password")); + auto alias = config->find("security-alias"); + auto uname = config->find("security-username"); + auto passwd = config->find("security-password"); char msgAlias[100]; char msgUname[100]; char msgPasswd[100]; sprintf(msgAlias, "PKCS alias is %s", - alias == NULLPTR ? "null" : alias->asChar()); + alias == nullptr ? "null" : alias->asChar()); sprintf(msgUname, "username is %s", - uname == NULLPTR ? "null" : uname->asChar()); + uname == nullptr ? "null" : uname->asChar()); sprintf(msgPasswd, "password is %s", - passwd == NULLPTR ? "null" : passwd->asChar()); + passwd == nullptr ? "null" : passwd->asChar()); LOG(msgAlias); LOG(msgUname); @@ -218,7 +218,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) regPtr->clear(); CacheablePtr getVal = regPtr->get(1); - if (getVal == NULLPTR) { + if (getVal == nullptr) { LOG("Get completed after region.clear successfully"); } else { FAIL("Get did not complete successfully"); @@ -245,9 +245,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regPtr->getAll(entrykeys, valuesMap, NULLPTR, false); + regPtr->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { LOG("GetAll completed successfully"); } else { @@ -263,7 +263,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) LOG("Query completed successfully"); PoolPtr pool = PoolManager::find(regionNamesAuth[0]); QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { @@ -272,12 +272,12 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); qs->closeCqs(); LOG("CQ completed successfully"); - if (pool != NULLPTR) { + if (pool != nullptr) { // TODO: FunctionService::onServer(pool) ->execute("securityTest", true) @@ -312,7 +312,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) createEntry(regionNamesAuth[0], keys[2], vals[2]); LOG("Entry created successfully"); RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); - if (regPtr0 != NULLPTR) { + if (regPtr0 != nullptr) { LOG("Going to do registerAllKeys"); regPtr0->registerAllKeys(); LOG("Going to do unregisterAllKeys"); @@ -371,9 +371,8 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) try { RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - if (checkPtr != NULLPTR) { + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + if (checkPtr != nullptr) { char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", checkPtr->asChar(), keys[2]); @@ -400,9 +399,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false); + regPtr0->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { FAIL("GetAll should not have completed successfully"); } @@ -419,7 +418,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) try { QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { @@ -428,7 +427,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); FAIL("CQ should not have completed successfully"); @@ -503,9 +502,8 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) try { RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regPtr0->get(keyPtr)); - if (checkPtr != NULLPTR) { + auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr)); + if (checkPtr != nullptr) { char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", checkPtr->asChar(), keys[2]); @@ -525,7 +523,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NOT_AUTHORIZED_EXCEPTION RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); - if (regPtr0 != NULLPTR) { + if (regPtr0 != nullptr) { try { LOG("Going to do registerAllKeys"); regPtr0->registerAllKeys(); @@ -559,9 +557,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false); + regPtr0->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { LOG("GetAll completed successfully"); } else { @@ -580,7 +578,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) try { QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { @@ -589,7 +587,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); // FAIL("CQ should not have completed successfully"); @@ -599,7 +597,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) pool = PoolManager::find(regionNamesAuth[0]); try { - if (pool != NULLPTR) { + if (pool != nullptr) { FunctionService::onServer(pool) ->execute("securityTest", true) ->getResult(); @@ -611,7 +609,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NOT_AUTHORIZED_EXCEPTION try { - if (pool != NULLPTR) { + if (pool != nullptr) { FunctionService::onServer(pool) ->execute("securityTest", true) ->getResult(); @@ -623,7 +621,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NOT_AUTHORIZED_EXCEPTION try { - if (pool != NULLPTR) { + if (pool != nullptr) { FunctionService::onServers(pool) ->execute("securityTest", true) ->getResult(); @@ -635,7 +633,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NOT_AUTHORIZED_EXCEPTION try { - if (pool != NULLPTR) { + if (pool != nullptr) { RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); FunctionService::onRegion(regPtr0) ->execute("securityTest", true) http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp index 67fbf0b..e4ab9d6 100644 --- a/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp +++ b/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp @@ -65,7 +65,7 @@ void initCredentialGenerator() { } } - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } @@ -143,20 +143,20 @@ void initClientAuth(char UserType) { break; } - CacheableStringPtr alias(userCreds->find("security-alias")); - CacheableStringPtr uname(userCreds->find("security-username")); - CacheableStringPtr passwd(userCreds->find("security-password")); + auto alias = userCreds->find("security-alias"); + auto uname = userCreds->find("security-username"); + auto passwd = userCreds->find("security-password"); char msgAlias[100]; char msgUname[100]; char msgPasswd[100]; sprintf(msgAlias, "PKCS alias is %s", - alias == NULLPTR ? "null" : alias->asChar()); + alias == nullptr ? "null" : alias->asChar()); sprintf(msgUname, "username is %s", - uname == NULLPTR ? "null" : uname->asChar()); + uname == nullptr ? "null" : uname->asChar()); sprintf(msgPasswd, "password is %s", - passwd == NULLPTR ? "null" : passwd->asChar()); + passwd == nullptr ? "null" : passwd->asChar()); LOG(msgAlias); LOG(msgUname); @@ -216,7 +216,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) initClientAuth('A'); try { LOG("Tying Region creation"); - createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, NULLPTR, false, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, nullptr, false, -1, true, 0); LOG("Region created successfully"); LOG("Tying Entry creation"); @@ -224,7 +224,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -239,7 +239,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) regionPtr->clear(); CacheablePtr getVal = regionPtr->get(1); - if (getVal == NULLPTR) { + if (getVal == nullptr) { LOG("Get completed after region.clear successfully"); } else { FAIL("Get did not complete successfully"); @@ -274,9 +274,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regionPtr->getAll(entrykeys, valuesMap, NULLPTR, false); + regionPtr->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { LOG("GetAll completed successfully"); } else { @@ -312,13 +312,13 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr cqQry = qs->newCq("cq_security", queryString, cqAttrs); cqQry->execute(); cqQry->close(); LOG("CQ completed successfully"); - if (pool != NULLPTR) { + if (pool != nullptr) { // TODO: // FunctionService::onServer(pool)->execute("securityTest", // true)->getResult(); @@ -345,7 +345,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) LOG("Function execution with sendException"); char buf[128]; for (int i = 1; i <= 200; i++) { - CacheablePtr value(CacheableInt32::create(i)); + auto value = CacheableInt32::create(i); sprintf(buf, "execKey-%d", i); CacheableKeyPtr key = CacheableKey::create(buf); @@ -357,14 +357,14 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) CacheableArrayListPtr arrList = CacheableArrayList::create(); for (int i = 100; i < 120; i++) { sprintf(buf, "execKey-%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); arrList->push_back(key); } CacheableVectorPtr filter = CacheableVector::create(); for (int i = 100; i < 120; i++) { sprintf(buf, "execKey-%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); filter->push_back(key); } LOG("Adding filter done."); @@ -373,24 +373,24 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) // UNUSED bool getResult = true; ExecutionPtr funcExec = FunctionService::onRegion(regionPtr); - ASSERT(funcExec != NULLPTR, "onRegion Returned NULL"); + ASSERT(funcExec != nullptr, "onRegion Returned NULL"); ResultCollectorPtr collector = funcExec->withArgs(args)->withFilter(filter)->execute( exFuncNameSendException, 15); - ASSERT(collector != NULLPTR, "onRegion collector NULL"); + ASSERT(collector != nullptr, "onRegion collector NULL"); CacheableVectorPtr result = collector->getResult(); - if (result == NULLPTR) { + if (result == nullptr) { ASSERT(false, "echo String : result is NULL"); } else { try { for (int i = 0; i < result->size(); i++) { - UserFunctionExecutionExceptionPtr uFEPtr = - dynCast<UserFunctionExecutionExceptionPtr>( + auto uFEPtr = + std::dynamic_pointer_cast<UserFunctionExecutionException>( result->operator[](i)); - ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL"); + ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL"); LOGINFO("Done casting to uFEPtr"); LOGINFO("Read expected uFEPtr exception %s ", uFEPtr->getMessage()->asChar()); @@ -416,7 +416,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) collector = funcExec->withArgs(arrList)->withFilter(filter)->execute( exFuncNameSendException, 15); - ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL"); + ASSERT(collector != nullptr, "onRegion collector for arrList NULL"); result = collector->getResult(); ASSERT(result->size() == arrList->size() + 1, @@ -425,9 +425,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) for (int i = 0; i < result->size(); i++) { try { - CacheableInt32Ptr intValue = - dynCast<CacheableInt32Ptr>(result->operator[](i)); - ASSERT(intValue != NULLPTR, "int value is NULL"); + auto intValue = std::dynamic_pointer_cast<CacheableInt32>( + result->operator[](i)); + ASSERT(intValue != nullptr, "int value is NULL"); LOGINFO("intValue is %d ", intValue->value()); } catch (ClassCastException& ex) { LOG("exFuncNameSendException casting to int for arrayList " @@ -439,10 +439,10 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) logmsg += ex.getMessage(); LOG(logmsg.c_str()); ex.printStackTrace(); - UserFunctionExecutionExceptionPtr uFEPtr = - dynCast<UserFunctionExecutionExceptionPtr>( + auto uFEPtr = + std::dynamic_pointer_cast<UserFunctionExecutionException>( result->operator[](i)); - ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL"); + ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL"); LOGINFO("Done casting to uFEPtr"); LOGINFO("Read expected uFEPtr exception %s ", uFEPtr->getMessage()->asChar()); @@ -474,14 +474,14 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) destroyRegion(regionNamesAuth[0]); LOG("Region destroy successfully"); LOG("Tying Region creation"); - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); char buf[100] = {'\0'}; static int indexForPool = 0; sprintf(buf, "%s_%d", regionNamesAuth[0], indexForPool++); pool = getPool(buf); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -498,7 +498,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne) virtualCache->close(); LOG("Cache close successfully"); // RegionPtr regPtr0 = getHelper()->getRegion( regionNamesAuth[0] ); - /*if (regPtr != NULLPTR ) { + /*if (regPtr != nullptr ) { LOG("Going to do registerAllKeys"); // regPtr->registerAllKeys(); LOG("Going to do unregisterAllKeys"); @@ -523,14 +523,14 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) initCredentialGenerator(); initClientAuth('W'); try { - createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, NULLPTR, false, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, nullptr, false, -1, true, 0); LOG("Region created successfully"); RegionServicePtr virtualCache; RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -578,7 +578,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) RegionServicePtr virtualCache; RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); - if (pool != NULLPTR) { + if (pool != nullptr) { virtualCache = getVirtualCache(userCreds, pool); regionPtr = virtualCache->getRegion(regionNamesAuth[0]); } else { @@ -598,7 +598,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -608,9 +608,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) LOG("Pool is NULL"); } CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(regionPtr->get(keyPtr)); - if (checkPtr != NULLPTR) { + auto checkPtr = + std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keyPtr)); + if (checkPtr != nullptr) { char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", checkPtr->asChar(), keys[2]); @@ -635,7 +635,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -652,9 +652,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - regionPtr->getAll(entrykeys, valuesMap, NULLPTR, false); + regionPtr->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { FAIL("GetAll should not have completed successfully"); } @@ -666,7 +666,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -691,7 +691,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) char queryString[100]; sprintf(queryString, "select * from /%s", regionNamesAuth[0]); CqAttributesFactory cqFac; - CqAttributesPtr cqAttrs(cqFac.create()); + auto cqAttrs = cqFac.create(); CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs); qs->executeCqs(); FAIL("CQ should not have completed successfully"); @@ -741,7 +741,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) "exception"); char buf[128]; for (int i = 1; i <= 200; i++) { - CacheablePtr value(CacheableInt32::create(i)); + auto value = CacheableInt32::create(i); sprintf(buf, "execKey-%d", i); CacheableKeyPtr key = CacheableKey::create(buf); @@ -753,14 +753,14 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) CacheableArrayListPtr arrList = CacheableArrayList::create(); for (int i = 100; i < 120; i++) { sprintf(buf, "execKey-%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); arrList->push_back(key); } CacheableVectorPtr filter = CacheableVector::create(); for (int i = 100; i < 120; i++) { sprintf(buf, "execKey-%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); filter->push_back(key); } LOG("Adding filter done."); @@ -808,7 +808,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) "exception with onRegion"); char buf[128]; for (int i = 1; i <= 200; i++) { - CacheablePtr value(CacheableInt32::create(i)); + auto value = CacheableInt32::create(i); sprintf(buf, "execKey-%d", i); CacheableKeyPtr key = CacheableKey::create(buf); @@ -820,14 +820,14 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) CacheableArrayListPtr arrList = CacheableArrayList::create(); for (int i = 100; i < 120; i++) { sprintf(buf, "execKey-%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); arrList->push_back(key); } CacheableVectorPtr filter = CacheableVector::create(); for (int i = 100; i < 120; i++) { sprintf(buf, "execKey-%d", i); - CacheableKeyPtr key = CacheableKey::create(buf); + auto key = CacheableKey::create(buf); filter->push_back(key); } LOG("Adding filter done."); @@ -857,7 +857,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo) RegionPtr regionPtr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -882,13 +882,13 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) char buf[100]; int i = 102; - createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, false, + createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false, -1, true, 0); RegionServicePtr virtualCache; RegionPtr rptr; PoolPtr pool = getPool(regionNamesAuth[0]); LOG(" 6"); - if (pool != NULLPTR) { + if (pool != nullptr) { LOG(" 7"); virtualCache = getVirtualCache(userCreds, pool); LOG(" 8"); @@ -944,9 +944,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) try { // RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]); CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]); - CacheableStringPtr checkPtr = - dynCast<CacheableStringPtr>(rptr->get(keyPtr)); - if (checkPtr != NULLPTR) { + auto checkPtr = + std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr)); + if (checkPtr != nullptr) { char buf[1024]; sprintf(buf, "In net search, get returned %s for key %s", checkPtr->asChar(), keys[2]); @@ -958,7 +958,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) HANDLE_NO_NOT_AUTHORIZED_EXCEPTION // RegionPtr regPtr0 = getHelper()->getRegion( regionNamesAuth[0] ); - if (rptr != NULLPTR) { + if (rptr != nullptr) { try { LOG("Going to do registerAllKeys"); // rptr->registerAllKeys(); @@ -992,9 +992,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) for (int i = 0; i < 5; i++) { entrykeys.push_back(CacheableKey::create(i)); } - HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable()); + auto valuesMap = std::make_shared<HashMapOfCacheable>(); valuesMap->clear(); - rptr->getAll(entrykeys, valuesMap, NULLPTR, false); + rptr->getAll(entrykeys, valuesMap, nullptr, false); if (valuesMap->size() > 0) { LOG("GetAll completed successfully"); } else { @@ -1014,7 +1014,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree) try { /*QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name qs = pool->getQueryService(); } else { http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp b/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp index 3bf7b8b..14cccc9 100644 --- a/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp +++ b/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp @@ -140,7 +140,7 @@ std::string getXmlPath() { void initCredentialGenerator() { credentialGeneratorHandler = CredentialGenerator::create("DUMMY3"); - if (credentialGeneratorHandler == NULLPTR) { + if (credentialGeneratorHandler == nullptr) { FAIL("credentialGeneratorHandler is NULL"); } } @@ -239,7 +239,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) PoolPtr pool = PoolManager::find(regionNamesCq[0]); QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name as in ThinClientCq.hpp qs = pool->getQueryService(); } else { @@ -247,7 +247,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) } CqAttributesFactory cqFac; for (i = 0; i < MAX_LISTNER; i++) { - CqListenerPtr cqLstner(new MyCqListener(i)); + auto cqLstner = std::make_shared<MyCqListener>(i); cqFac.addCqListener(cqLstner); CqAttributesPtr cqAttr = cqFac.create(); CqQueryPtr qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr); @@ -282,7 +282,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2) qh->populatePortfolioData(regPtr0, 3, 2, 1); qh->populatePositionData(subregPtr0, 3, 2); for (int i = 1; i < 3; i++) { - CacheablePtr port(new Portfolio(i, 2)); + auto port = std::make_shared<Portfolio>(i, 2); CacheableKeyPtr keyport = CacheableKey::create("port1-1"); regPtr0->put(keyport, port); @@ -296,11 +296,11 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepFour) { - QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper(); + auto qh ATTR_UNUSED = &QueryHelper::getHelper(); - PoolPtr pool = PoolManager::find(regionNamesCq[0]); + auto pool = PoolManager::find(regionNamesCq[0]); QueryServicePtr qs; - if (pool != NULLPTR) { + if (pool != nullptr) { // Using region name as pool name as in ThinClientCq.hpp qs = pool->getQueryService(); } else { @@ -326,8 +326,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) for (i = 0; i < MAX_LISTNER; i++) { sprintf(buf, "get info for cq[%s]:", cqNames[i]); LOG(buf); - CqQueryPtr cqy = qs->getCq(cqNames[i]); - CqStatisticsPtr cqStats = cqy->getStatistics(); + auto cqy = qs->getCq(cqNames[i]); + auto cqStats = cqy->getStatistics(); sprintf(buf, "Cq[%s]From CqStatistics: numInserts[%d], numDeletes[%d], " "numUpdates[%d], numEvents[%d]", @@ -340,21 +340,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) deletes[j] += cqStats->numDeletes(); events[j] += cqStats->numEvents(); } - CqAttributesPtr cqAttr = cqy->getCqAttributes(); - VectorOfCqListener vl; + auto cqAttr = cqy->getCqAttributes(); + std::vector<CqListenerPtr> vl; cqAttr->getCqListeners(vl); - sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i], + sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i], vl.size()); LOG(buf); ASSERT(vl.size() == i + 1, "incorrect number of listeners"); if (i == (MAX_LISTNER - 1)) { MyCqListener* myLl[MAX_LISTNER]; for (int k = 0; k < MAX_LISTNER; k++) { - MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].ptr()); + MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].get()); myLl[ml->getId()] = ml; } for (j = 0; j < MAX_LISTNER; j++) { - MyCqListener* ml = myLl[j]; + auto ml = myLl[j]; sprintf(buf, "MyCount for Listener[%d]: numInserts[%d], numDeletes[%d], " "numUpdates[%d], numEvents[%d]", @@ -376,18 +376,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) "accumulative events count incorrect"); } LOG("removing listener"); - CqAttributesMutatorPtr cqAttrMtor = cqy->getCqAttributesMutator(); - CqListenerPtr ptr = vl[0]; + auto cqAttrMtor = cqy->getCqAttributesMutator(); + auto ptr = vl[0]; cqAttrMtor->removeCqListener(ptr); cqAttr->getCqListeners(vl); - sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i], + sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i], vl.size()); LOG(buf); ASSERT(vl.size() == i, "incorrect number of listeners"); } } try { - CqQueryPtr cqy = qs->getCq(cqNames[1]); + auto cqy = qs->getCq(cqNames[1]); cqy->stop(); cqy = qs->getCq(cqNames[6]); @@ -421,7 +421,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) cqy = qs->getCq(cqNames[2]); sprintf(buf, "cq[%s] should have been removed after close!", cqNames[2]); - ASSERT(cqy == NULLPTR, buf); + ASSERT(cqy == nullptr, buf); } catch (Exception& excp) { std::string failmsg = ""; failmsg += excp.getName(); @@ -431,8 +431,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) FAIL(failmsg.c_str()); excp.printStackTrace(); } - CqServiceStatisticsPtr serviceStats = qs->getCqServiceStatistics(); - ASSERT(serviceStats != NULLPTR, "serviceStats is NULL"); + auto serviceStats = qs->getCqServiceStatistics(); + ASSERT(serviceStats != nullptr, "serviceStats is NULL"); sprintf(buf, "numCqsActive=%d, numCqsCreated=%d, " "numCqsClosed=%d,numCqsStopped=%d, numCqsOnClient=%d", @@ -504,7 +504,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour) ASSERT(serviceStats->numCqsOnClient() == 0, "cq count incorrect!"); i = 0; - CqListenerPtr cqLstner(new MyCqListener(i)); + auto cqLstner = std::make_shared<MyCqListener>(i); cqFac.addCqListener(cqLstner); CqAttributesPtr cqAttr = cqFac.create(); try {