http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testAttributesFactory.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testAttributesFactory.cpp b/src/cppcache/integration-test/testAttributesFactory.cpp index 9489f6f..2e4ffcf 100644 --- a/src/cppcache/integration-test/testAttributesFactory.cpp +++ b/src/cppcache/integration-test/testAttributesFactory.cpp @@ -23,22 +23,22 @@ using namespace apache::geode::client; -BEGIN_TEST(ATTRIBUTE_FACTORY) - { - AttributesFactory af; - RegionAttributesPtr ra; - RegionPtr region; - - CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(); - CachePtr cache = cacheFactoryPtr->create(); - ra = af.createRegionAttributes(); - - CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr()); - cacheImpl->createRegion("region1", ra, region); - LOG("local region created with HA cache specification."); - cache->close(); - } -END_TEST(ATTRIBUTE_FACTORY) +// BEGIN_TEST(ATTRIBUTE_FACTORY) +// { +// AttributesFactory af; +// RegionAttributesPtr ra; +// RegionPtr region; +// +// CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(); +// CachePtr cache = cacheFactoryPtr->create(); +// ra = af.createRegionAttributes(); +// +// CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get()); +// cacheImpl->createRegion("region1", ra, region); +// LOG("local region created with HA cache specification."); +// cache->close(); +// } +// END_TEST(ATTRIBUTE_FACTORY) /* testing attributes with invalid value */ /* testing with negative values */ /*see bug no #865 */ @@ -53,7 +53,7 @@ BEGIN_TEST(REGION_FACTORY) try { rf->setInitialCapacity(-1); FAIL("Should have got expected IllegalArgumentException"); - } catch (IllegalArgumentException) { + } catch (IllegalArgumentException&) { LOG("Got expected IllegalArgumentException"); } @@ -64,13 +64,13 @@ BEGIN_TEST(REGION_FACTORY) "Incorrect InitialCapacity"); m_region->put(1, 1); - CacheableInt32Ptr res = dynCast<CacheableInt32Ptr>(m_region->get(1)); + auto res = std::dynamic_pointer_cast<CacheableInt32>(m_region->get(1)); ASSERT(res->value() == 1, "Expected to find value 1."); m_region->destroyRegion(); m_cache->close(); - m_cache = NULLPTR; - m_region = NULLPTR; + m_cache = nullptr; + m_region = nullptr; CacheFactoryPtr cf1 = CacheFactory::createCacheFactory(); CachePtr m_cache1 = cf1->create(); @@ -80,7 +80,7 @@ BEGIN_TEST(REGION_FACTORY) try { rf1->setInitialCapacity(2147483648U); FAIL("Should have got expected IllegalArgumentException"); - } catch (IllegalArgumentException) { + } catch (IllegalArgumentException&) { LOG("Got expected IllegalArgumentException"); } RegionPtr m_region1 = rf1->create("Local_ETTL_LI"); @@ -90,12 +90,12 @@ BEGIN_TEST(REGION_FACTORY) "Incorrect InitialCapacity"); m_region1->put(1, 1); - CacheableInt32Ptr res1 = dynCast<CacheableInt32Ptr>(m_region1->get(1)); + auto res1 = std::dynamic_pointer_cast<CacheableInt32>(m_region1->get(1)); ASSERT(res1->value() == 1, "Expected to find value 1."); m_region1->destroyRegion(); m_cache1->close(); - m_cache1 = NULLPTR; - m_region1 = NULLPTR; + m_cache1 = nullptr; + m_region1 = nullptr; } END_TEST(REGION_FACTORY)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testAttributesMutator.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testAttributesMutator.cpp b/src/cppcache/integration-test/testAttributesMutator.cpp index 662bb33..16f8dbe 100644 --- a/src/cppcache/integration-test/testAttributesMutator.cpp +++ b/src/cppcache/integration-test/testAttributesMutator.cpp @@ -44,7 +44,7 @@ DUNIT_TASK(A, Init) af.setEntryTimeToLive(ExpirationAction::LOCAL_INVALIDATE, 5); RegionAttributesPtr attrs = af.createRegionAttributes(); - CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(Test.m_cache.ptr()); + CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(Test.m_cache.get()); cacheImpl->createRegion("Local_ETTL_LI", attrs, Test.m_region); } ENDTASK @@ -58,13 +58,12 @@ DUNIT_TASK(A, CreateAndVerifyExpiry) // countdown begins... it is ttl so access should not play into it.. SLEEP(3000); // sleep for a second, expect value to still be there. - CacheableInt32Ptr res = - dynCast<CacheableInt32Ptr>(Test.m_region->get("one")); + auto res = std::dynamic_pointer_cast<CacheableInt32>(Test.m_region->get("one")); ASSERT(res->value() == 1, "Expected to find value 1."); fflush(stdout); SLEEP(5000); // sleep for 5 more seconds, expect value to be invalid. fflush(stdout); - res = NULLPTR; + res = nullptr; ASSERT(Test.m_region->containsValueForKey("one") == false, "should not contain value."); } @@ -75,7 +74,7 @@ DUNIT_TASK(A, Close) { Test.m_region->destroyRegion(); Test.m_cache->close(); - Test.m_cache = NULLPTR; - Test.m_region = NULLPTR; + Test.m_cache = nullptr; + Test.m_region = nullptr; } ENDTASK http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testCache.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testCache.cpp b/src/cppcache/integration-test/testCache.cpp index 2937c93..e87530e 100644 --- a/src/cppcache/integration-test/testCache.cpp +++ b/src/cppcache/integration-test/testCache.cpp @@ -33,7 +33,7 @@ BEGIN_TEST(CacheFunction) char* subRegionName2 = (char*)"TESTCACHE_SUB_REGION2"; char* subRegionName21 = (char*)"TESTCACHE_SUB_REGION21"; CachePtr cptr; - if (cptr != NULLPTR) { + if (cptr != nullptr) { cout << "cptr is not null" << endl; } cout << "create Cache with name=" << host_name << " and unitialized system" @@ -49,16 +49,16 @@ BEGIN_TEST(CacheFunction) cout << ex.getMessage() << endl; ASSERT(false, "attribute create failed"); } - if (rAttr == NULLPTR) { + if (rAttr == nullptr) { cout << "Warnning! : AttributesFactory returned NULL" << endl; } RegionPtr rptr; - if (rptr != NULLPTR) { + if (rptr != nullptr) { cout << "rptr is not null" << endl; } cout << "create Region with name=" << regionName << endl; try { - CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cptr.ptr()); + CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cptr.get()); cacheImpl->createRegion(regionName, rAttr, rptr); } catch (Exception& ex) { cout << ex.getMessage() << endl; @@ -127,7 +127,7 @@ BEGIN_TEST(CacheFunction) cout << ex.getMessage() << endl; ASSERT(false, (char*)"getRegion"); } - if (region == NULLPTR) { + if (region == nullptr) { ASSERT(false, (char*)"did not find it"); } else { cout << "found :" << region->getName() << endl; @@ -139,7 +139,7 @@ BEGIN_TEST(CacheFunction) cout << ex.getMessage() << endl; ASSERT(false, (char*)"getRegion"); } - if (region == NULLPTR) { + if (region == nullptr) { ASSERT(false, (char*)"did not find it"); } else { cout << "found :" << region->getName() << endl; @@ -151,7 +151,7 @@ BEGIN_TEST(CacheFunction) cout << ex.getMessage() << endl; ASSERT(false, (char*)"getRegion"); } - if (region == NULLPTR) { + if (region == nullptr) { ASSERT(false, (char*)"did not find it"); } else { cout << "found :" << region->getName() << endl; @@ -164,7 +164,7 @@ BEGIN_TEST(CacheFunction) cout << ex.getMessage() << endl; ASSERT(false, (char*)"getRegion"); } - if (region == NULLPTR) { + if (region == nullptr) { ASSERT(false, (char*)"did not find it"); } else { cout << "found :" << region->getName() << endl; @@ -177,7 +177,7 @@ BEGIN_TEST(CacheFunction) cout << ex.getMessage() << endl; ASSERT(false, (char*)"getRegion"); } - if (region == NULLPTR) { + if (region == nullptr) { cout << "not found !" << endl; } else { ASSERT(false, (char*)"found it"); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testCacheless.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testCacheless.cpp b/src/cppcache/integration-test/testCacheless.cpp index 491d05b..7bd1964 100644 --- a/src/cppcache/integration-test/testCacheless.cpp +++ b/src/cppcache/integration-test/testCacheless.cpp @@ -61,8 +61,8 @@ class RegionWrapper { int tries = 0; int val = 0; do { - valPtr = dynCast<CacheableStringPtr>(m_regionPtr->get(keyPtr)); - ASSERT(valPtr != NULLPTR, "value should not be null."); + valPtr = std::dynamic_pointer_cast<CacheableString>(m_regionPtr->get(keyPtr)); + ASSERT(valPtr != nullptr, "value should not be null."); val = atoi(valPtr->asChar()); SLEEP(100); tries++; @@ -122,7 +122,7 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(s1p1, CreateRegionNoCache) { initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1", - NULLPTR, 0, true); + nullptr, 0, true); LOG("Creating region in s1p1-pusher, no-ack, no-cache, no-listener"); getHelper()->createPooledRegion(REGIONNAME, false, locHostPort, "__TEST_POOL1__", true, true); @@ -133,8 +133,8 @@ DUNIT_TASK_DEFINITION(s1p2, CreateNoCacheWListener) { LOG("Creating region in s1p2-listener, no-ack, no-cache, with-listener"); initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1", - NULLPTR, 0, true); - listener = new TallyListener(); + nullptr, 0, true); + listener = std::make_shared<TallyListener>(); getHelper()->createPooledRegion(REGIONNAME, false, locHostPort, "__TEST_POOL1__", true, true, 0, 0, 0, 0, 0, listener); @@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(s2p1, CreateRegionCacheMirror) LOG("Creating region in s2p1-storage, no-ack, cache, no-interestlist, " "no-listener"); initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1", - NULLPTR, 0, true); + nullptr, 0, true); getHelper()->createPooledRegion(REGIONNAME, false, locHostPort, "__TEST_POOL1__", true, true); } @@ -157,8 +157,8 @@ DUNIT_TASK_DEFINITION(s2p2, CreateRegionCache) LOG("Creating region in s2p2-subset, no-ack, no-mirror, cache, " "no-interestlist, with-listener"); initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1", - NULLPTR, 0, true); - listener = new TallyListener(); + nullptr, 0, true); + listener = std::make_shared<TallyListener>(); getHelper()->createPooledRegion(REGIONNAME, false, locHostPort, "__TEST_POOL1__", true, true, 0, 0, 0, 0, 0, listener); @@ -171,8 +171,8 @@ DUNIT_TASK_DEFINITION(s1p2, NoEvents) LOG("Verifying TallyListener has received nothing."); ASSERT(listener->getCreates() == 0, "Should be no creates"); ASSERT(listener->getUpdates() == 0, "Should be no updates"); - ASSERT(listener->getLastKey() == NULLPTR, "Should be no key"); - ASSERT(listener->getLastValue() == NULLPTR, "Should be no value"); + ASSERT(listener->getLastKey() == nullptr, "Should be no key"); + ASSERT(listener->getLastValue() == nullptr, "Should be no value"); } END_TASK_DEFINITION http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testEntriesMap.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testEntriesMap.cpp b/src/cppcache/integration-test/testEntriesMap.cpp index 4bc1a5b..68b71c6 100644 --- a/src/cppcache/integration-test/testEntriesMap.cpp +++ b/src/cppcache/integration-test/testEntriesMap.cpp @@ -33,6 +33,7 @@ END_TEST(NotOnWindows) #include <LRUMapEntry.hpp> #include <VersionTag.hpp> #include <cstdlib> +#include <LocalRegion.hpp> using namespace apache::geode::client; using namespace std; @@ -41,7 +42,7 @@ typedef std::vector<MapEntryImplPtr> VectorOfMapEntry; CacheableStringPtr createCacheable(const char* value) { CacheableStringPtr result = CacheableString::create(value); - ASSERT(result != NULLPTR, "expected result non-NULL"); + ASSERT(result != nullptr, "expected result non-NULL"); return result; } @@ -50,18 +51,19 @@ BEGIN_TEST(PutAndGet) CacheableStringPtr ccstr = createCacheable("100"); CacheablePtr ct = ccstr; EntryFactory* entryFactory = EntryFactory::singleton; + AttributesFactory af; EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, false); entries->open(); CacheableKeyPtr keyPtr = CacheableKey::create((char*)"foobar"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); MapEntryImplPtr me; VersionTagPtr versionTag; CacheablePtr oldValue; entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); CacheablePtr myValuePtr; entries->get(keyPtr, myValuePtr, me); - ASSERT(myValuePtr != NULLPTR, "expected non-NULL"); - CacheableStringPtr strValue = dynCast<CacheableStringPtr>(myValuePtr); + ASSERT(myValuePtr != nullptr, "expected non-NULL"); + auto strValue = std::dynamic_pointer_cast<CacheableString>(myValuePtr); ASSERT(ccstr->operator==(*strValue), "expected 100"); delete entries; } @@ -71,11 +73,11 @@ BEGIN_TEST(CheckMapEntryImplPtr) { char error[1000] ATTR_UNUSED; MapEntryImplPtr mePtr; - ASSERT(mePtr == NULLPTR, "expected mePtr to be NULL"); + ASSERT(mePtr == nullptr, "expected mePtr to be NULL"); CacheableKeyPtr keyPtr = CacheableKey::create(fwtest_Name); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); EntryFactory::singleton->newMapEntry(keyPtr, mePtr); - ASSERT(mePtr != NULLPTR, "expected to not be null."); + ASSERT(mePtr != nullptr, "expected to not be null."); } END_TEST(CheckMapEntryImplPtr) @@ -88,18 +90,18 @@ BEGIN_TEST(RemoveTest) entries->open(); CacheableKeyPtr keyPtr = CacheableKey::create(fwtest_Name); MapEntryImplPtr me; - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr oldValue; VersionTagPtr versionTag; entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); CacheablePtr myValuePtr; (void)entries->remove(keyPtr, myValuePtr, me, -1, versionTag, false); - CacheableStringPtr resPtr = dynCast<CacheableStringPtr>(myValuePtr); - ASSERT(myValuePtr != NULLPTR, "expected to not be null."); + auto resPtr = std::dynamic_pointer_cast<CacheableString>(myValuePtr); + ASSERT(myValuePtr != nullptr, "expected to not be null."); ASSERT(resPtr->operator==(*createCacheable("200")), "CustomerType with m_foobar 200."); (void)entries->remove(keyPtr, myValuePtr, me, -1, versionTag, false); - ASSERT(myValuePtr == NULLPTR, + ASSERT(myValuePtr == nullptr, "expected already removed, and null result should clear ptr."); } END_TEST(RemoveTest) @@ -114,15 +116,15 @@ BEGIN_TEST(GetEntryTest) CacheableKeyPtr keyPtr; MapEntryImplPtr me; keyPtr = CacheableKey::create(fwtest_Name); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr oldValue; VersionTagPtr versionTag; entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); MapEntryImplPtr mePtr; CacheablePtr ctPtr; entries->getEntry(keyPtr, mePtr, ctPtr); - ASSERT(mePtr != NULLPTR, "should not be null."); - CacheableStringPtr valPtr = dynCast<CacheableStringPtr>(ctPtr); + ASSERT(mePtr != nullptr, "should not be null."); + auto valPtr = std::dynamic_pointer_cast<CacheableString>(ctPtr); ASSERT(valPtr->operator==(*cst), "Entry should have a CustomerType Value of 200"); CacheableKeyPtr keyPtr1; @@ -135,7 +137,7 @@ BEGIN_TEST(MapEntryImplPtrRCTest) { // Test Reference Counting and destruction for MapEntry. CacheableKeyPtr keyPtr = CacheableKey::create("foobar"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); MapEntryImplPtr mePtr; EntryFactory ef; ef.newMapEntry(keyPtr, mePtr); @@ -181,7 +183,7 @@ BEGIN_TEST(EntriesTest) sprintf(keyBuf, "key_%d", i); sprintf(valBuf, "%d", i); CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr v = createCacheable(valBuf); CacheablePtr oldValue; entries->put(keyPtr, v, me, oldValue, -1, 0, versionTag); @@ -199,7 +201,7 @@ BEGIN_TEST(EntriesTest) CacheableStringPtr ctPtr; CacheablePtr ccPtr; ccPtr = rePtr->getValue(); - ctPtr = dynCast<CacheableStringPtr>(ccPtr); + ctPtr = std::dynamic_pointer_cast<CacheableString>(ccPtr); test::cout << "value is " << ctPtr->asChar() << test::endl; int val = atoi(ctPtr->asChar()); test::cout << "atoi returned " << val << test::endl; @@ -228,7 +230,7 @@ BEGIN_TEST(ValuesTest) sprintf(keyBuf, "key_%d", i); sprintf(valBuf, "%d", i); CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr v = createCacheable(valBuf); CacheablePtr oldValue; entries->put(keyPtr, v, me, oldValue, -1, 0, versionTag); @@ -242,8 +244,8 @@ BEGIN_TEST(ValuesTest) int expectedTotal = 0; for (int k = 0; k < 10; k++) { expectedTotal += k; - CacheableStringPtr valuePtr = - dynCast<CacheableStringPtr>(valuesVec->back()); + auto valuePtr = + std::dynamic_pointer_cast<CacheableString>(valuesVec->back()); total += atoi(valuePtr->asChar()); valuesVec->pop_back(); } @@ -267,7 +269,7 @@ BEGIN_TEST(KeysTest) sprintf(keyBuf, "key_%d", i); sprintf(valBuf, "%d", i); CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr v = createCacheable(valBuf); CacheablePtr oldValue; entries->put(keyPtr, v, me, oldValue, -1, 0, versionTag); @@ -284,7 +286,7 @@ BEGIN_TEST(KeysTest) CacheableKeyPtr keyPtr = keysVec.back(); CacheablePtr cvPtr; entries->get(keyPtr, cvPtr, me); - CacheableStringPtr valuePtr = dynCast<CacheableStringPtr>(cvPtr); + auto valuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr); total += atoi(valuePtr->asChar()); keysVec.pop_back(); } @@ -310,7 +312,7 @@ BEGIN_TEST(TestRehash) sprintf(keyBuf, "key_%d", i); sprintf(valBuf, "%d", i); CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr v = createCacheable(valBuf); CacheablePtr oldValue; VersionTagPtr versionTag; @@ -327,11 +329,11 @@ BEGIN_TEST(TestRehash) sprintf(keyBuf, "key_%d", j); CacheableStringPtr valuePtr; CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr cvPtr; entries->get(keyPtr, cvPtr, me); - valuePtr = dynCast<CacheableStringPtr>(cvPtr); - if (valuePtr == NULLPTR) { + valuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr); + if (valuePtr == nullptr) { test::cout << "error finding key: " << keyBuf << test::endl; FAIL("should have found value for all keys after rehash."); } @@ -348,7 +350,7 @@ BEGIN_TEST(LRUPutAndGet) MapEntryImplPtr me; EntryFactory* entryFactory = LRUEntryFactory::singleton; EntriesMap* entries = new LRUEntriesMap( - entryFactory, NULL, LRUAction::LOCAL_DESTROY, 20, false); + entryFactory, nullptr, LRUAction::LOCAL_DESTROY, 20, false); entries->open(); ASSERT(entries->size() == 0, "expected size 0."); CacheableKeyPtr keyPtr = CacheableKey::create("foobar"); @@ -358,10 +360,10 @@ BEGIN_TEST(LRUPutAndGet) ASSERT(entries->size() == 1, "expected size 1."); CacheableStringPtr myValuePtr; CacheablePtr cvPtr; - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); entries->get(keyPtr, cvPtr, me); - myValuePtr = dynCast<CacheableStringPtr>(cvPtr); - ASSERT(myValuePtr != NULLPTR, "expected non-NULL"); + myValuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr); + ASSERT(myValuePtr != nullptr, "expected non-NULL"); ASSERT(cst->operator==(*myValuePtr), "expected 100"); delete entries; } @@ -371,13 +373,13 @@ BEGIN_TEST(CheckLRUMapEntryImplPtr) { char error[1000] ATTR_UNUSED; MapEntryImplPtr mePtr; - ASSERT(mePtr == NULLPTR, "expected mePtr to be NULL"); + ASSERT(mePtr == nullptr, "expected mePtr to be NULL"); CacheableKeyPtr keyPtr = CacheableKey::create(fwtest_Name); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); LRUEntryFactory::singleton->newMapEntry(keyPtr, mePtr); - ASSERT(mePtr != NULLPTR, "expected to not be null."); - LRUMapEntryPtr lmePtr = dynCast<LRUMapEntryPtr>(mePtr); - ASSERT(lmePtr != NULLPTR, "expected to cast successfully to LRUMapEntry."); + ASSERT(mePtr != nullptr, "expected to not be null."); + auto lmePtr = std::dynamic_pointer_cast<LRUMapEntry>(mePtr); + ASSERT(lmePtr != nullptr, "expected to cast successfully to LRUMapEntry."); } END_TEST(LRUCheckMapEntryImplPtr) @@ -400,14 +402,14 @@ BEGIN_TEST(LRURemoveTest) CacheableStringPtr myValuePtr; CacheablePtr cvPtr; (void)entries->remove(keyPtr, cvPtr, me, -1, versionTag, false); - myValuePtr = dynCast<CacheableStringPtr>(cvPtr); + myValuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr); ASSERT(entries->size() == 0, "expected size 0."); - ASSERT(cvPtr != NULLPTR, "expected to not be null."); + ASSERT(cvPtr != nullptr, "expected to not be null."); ASSERT(myValuePtr->operator==(*createCacheable("200")), "CustomerType with m_foobar 200."); (void)entries->remove(keyPtr, cvPtr, me, -1, versionTag, false); - ASSERT(cvPtr == NULLPTR, + ASSERT(cvPtr == nullptr, "expected already removed, and null result should clear ptr."); } END_TEST(LRURemoveTest) @@ -423,7 +425,7 @@ BEGIN_TEST(LRUGetEntryTest) CacheableKeyPtr keyPtr; MapEntryImplPtr me; keyPtr = CacheableKey::create(fwtest_Name); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); CacheablePtr oldValue; VersionTagPtr versionTag; entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); @@ -431,9 +433,9 @@ BEGIN_TEST(LRUGetEntryTest) MapEntryImplPtr mePtr; CacheablePtr cvPtr; entries->getEntry(keyPtr, mePtr, cvPtr); - ASSERT(mePtr != NULLPTR, "should not be null."); + ASSERT(mePtr != nullptr, "should not be null."); CacheableStringPtr ctPtr; - ctPtr = dynCast<CacheableStringPtr>(cvPtr); + ctPtr = std::dynamic_pointer_cast<CacheableString>(cvPtr); ASSERT(ctPtr->operator==(*cst), "Entry should have a CustomerType Value of 200"); CacheableKeyPtr keyPtr1; @@ -452,29 +454,29 @@ BEGIN_TEST(LRULimitEvictTest) CacheablePtr ct = createCacheable("somevalue"); CacheablePtr oldValue; CacheableKeyPtr keyPtr = CacheableKey::create("1"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); VersionTagPtr versionTag; entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); ASSERT(entries->size() == 1, "expected size 1."); keyPtr = CacheableKey::create("2"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); ASSERT(entries->size() == 2, "expected size 2."); keyPtr = CacheableKey::create("3"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); ASSERT(entries->size() == 3, "expected size 3."); keyPtr = CacheableKey::create("4"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); ASSERT(entries->size() == 4, "expected size 4."); keyPtr = CacheableKey::create("5"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); ASSERT(entries->size() == 5, "expected size 5."); LOG("Map is now at the limit."); keyPtr = CacheableKey::create("6"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); LOG("About to spill over."); entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag); LOG("Spilled over."); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testEntriesMapForVersioning.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testEntriesMapForVersioning.cpp b/src/cppcache/integration-test/testEntriesMapForVersioning.cpp index b99fb9d..7e4e301 100644 --- a/src/cppcache/integration-test/testEntriesMapForVersioning.cpp +++ b/src/cppcache/integration-test/testEntriesMapForVersioning.cpp @@ -92,9 +92,9 @@ void createRegion(const char* name, bool ackMode, fflush(stdout); // ack, caching regPtr = - getHelper()->createRegion(name, ackMode, caching, NULLPTR, + getHelper()->createRegion(name, ackMode, caching, nullptr, clientNotificationEnabled, true, true, 5000); - ASSERT(regPtr != NULLPTR, "Failed to create region."); + ASSERT(regPtr != nullptr, "Failed to create region."); LOG("Region created."); } @@ -102,7 +102,7 @@ typedef std::vector<MapEntryImplPtr> VectorOfMapEntry; CacheableStringPtr createCacheable(const char* value) { CacheableStringPtr result = CacheableString::create(value); - ASSERT(result != NULLPTR, "expected result non-NULL"); + ASSERT(result != nullptr, "expected result non-NULL"); return result; } @@ -111,29 +111,29 @@ uint8_t addr2[6] = {0xff, 0xff, 0xff, 0xaa, 0xff, 0xbb}; uint8_t addr3[6] = {0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff}; uint8_t addr4[6] = {0xff, 0xff, 0xff, 0xff, 0xaa, 0xff}; -ClientProxyMembershipIDPtr member_host1( - new ClientProxyMembershipID(addr1, 6, 80, "", "myuniquetag", 0)); -ClientProxyMembershipIDPtr member_host12( - new ClientProxyMembershipID(addr1, 6, 80, "", "myuniquetah", 0)); -ClientProxyMembershipIDPtr member_host13( - new ClientProxyMembershipID(addr1, 6, 81, "", "myuniquetag", 0)); -ClientProxyMembershipIDPtr member_host14( - new ClientProxyMembershipID(addr1, 6, 88, "", "myuniquetag", 0)); -ClientProxyMembershipIDPtr member_host15( - new ClientProxyMembershipID(addr2, 6, 88, "", "myuniquetag", 0)); -ClientProxyMembershipIDPtr member_host16( - new ClientProxyMembershipID(addr3, 6, 88, "", "myuniquetag", 0)); -ClientProxyMembershipIDPtr member_host17( - new ClientProxyMembershipID(addr4, 6, 88, "", "myuniquetag", 0)); -DiskStoreId* diskStore17 = new DiskStoreId(1, 7); -DiskStoreId* diskStore18 = new DiskStoreId(1, 8); -DiskStoreId* diskStore27 = new DiskStoreId(2, 7); -ClientProxyMembershipIDPtr member_host_vmview5( - new ClientProxyMembershipID(addr4, 6, 88, "", "", 5)); -ClientProxyMembershipIDPtr member_host_vmview6( - new ClientProxyMembershipID(addr4, 6, 88, "", "", 6)); -ClientProxyMembershipIDPtr member_host_vmview7( - new ClientProxyMembershipID(addr4, 6, 88, "", "", 7)); +auto member_host1 = std::make_shared<ClientProxyMembershipID>(addr1, 6, 80, "", + "myuniquetag", 0); +auto member_host12 = std::make_shared<ClientProxyMembershipID>( + addr1, 6, 80, "", "myuniquetah", 0); +auto member_host13 = std::make_shared<ClientProxyMembershipID>( + addr1, 6, 81, "", "myuniquetag", 0); +auto member_host14 = std::make_shared<ClientProxyMembershipID>( + addr1, 6, 88, "", "myuniquetag", 0); +auto member_host15 = std::make_shared<ClientProxyMembershipID>( + addr2, 6, 88, "", "myuniquetag", 0); +auto member_host16 = std::make_shared<ClientProxyMembershipID>( + addr3, 6, 88, "", "myuniquetag", 0); +auto member_host17 = std::make_shared<ClientProxyMembershipID>( + addr4, 6, 88, "", "myuniquetag", 0); +auto diskStore17 = new DiskStoreId(1, 7); +auto diskStore18 = new DiskStoreId(1, 8); +auto diskStore27 = new DiskStoreId(2, 7); +auto member_host_vmview5 = + std::make_shared<ClientProxyMembershipID>(addr4, 6, 88, "", "", 5); +auto member_host_vmview6 = + std::make_shared<ClientProxyMembershipID>(addr4, 6, 88, "", "", 6); +auto member_host_vmview7 = + std::make_shared<ClientProxyMembershipID>(addr4, 6, 88, "", "", 7); uint16_t host1; uint16_t host12; @@ -155,6 +155,13 @@ int DeltaEx::fromDeltaCount = 0; int DeltaEx::fromDataCount = 0; int DeltaEx::cloneCount = 0; +//#undef DUNIT_TASK_DEFINITION +//#define DUNIT_TASK_DEFINITION(_X, _Y) void _Y() +//#undef END_TASK_DEFINITION +//#define END_TASK_DEFINITION +//#undef CALL_TASK +//#define CALL_TASK(_Y) _Y() + DUNIT_TASK_DEFINITION(CLIENT1, CREATECLIENT) { initClient(); @@ -169,7 +176,7 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepOne_AddHosts) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); host1 = lregPtr->getCacheImpl()->getMemberListForVersionStamp()->add( member_host1); host12 = lregPtr->getCacheImpl()->getMemberListForVersionStamp()->add( @@ -201,65 +208,63 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = EntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = EntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr); + EntriesMap* entries = + new ConcurrentEntriesMap(entryFactory, true, lregPtr.get()); entries->open(); - CacheableKeyPtr keyPtr = CacheableKey::create((char*)"key1"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + auto keyPtr = CacheableKey::create("key1"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); MapEntryImplPtr me; - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0)); - VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0)); - VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0)); - VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0)); - VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0)); + auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0); + auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0); + auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0); + auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0); + auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0); CacheablePtr oldValue; - entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); char log[256]; - GfErrType err = - entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag12); + auto err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag12); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag13); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag13); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); uint32_t conflatedEvents = lregPtr->getCacheImpl()->m_cacheStats->getConflatedEvents(); ASSERT(conflatedEvents == 2, "conflated events should be 2"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag14); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag14); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag15); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag15); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag16); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag16); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag17); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag17); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); MapEntryImplPtr result; CacheablePtr value; @@ -267,24 +272,24 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); ASSERT(me->getVersionStamp().getMemberId() == 7, "an exception"); - VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0)); + auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0); // version rollover, this will not be applied - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag18); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag18); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyPtr, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); ASSERT(me->getVersionStamp().getMemberId() == 7, "an exception"); - CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2"); - err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag18); + auto keyPtr2 = CacheableKey::create("Key2"); + err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag18); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(atoi(value->toString()->asChar()) == 100, "an exception"); ASSERT(me->getVersionStamp().getMemberId() == 1, "an exception"); // version rollover, this will be applied - err = entries->put(keyPtr2, ct1, me, oldValue, -1, 0, versionTag12); + err = entries->put(keyPtr2, ccstr1, me, oldValue, -1, 0, versionTag12); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -292,7 +297,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) // Null version tag, this will be applied VersionTagPtr versionTag19; - err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19); ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(atoi(value->toString()->asChar()) == 100, "an exception"); @@ -300,8 +305,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); // inserts a null tag - CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3"); - err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag19); + auto keyPtr3 = CacheableKey::create("Key3"); + err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag19); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr3, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -312,7 +317,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) // version // stamp, // should be allowed. - err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag12); + err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag12); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr3, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -329,9 +334,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) sprintf(log, "Some delta tests..."); LOG(log); - CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"Key4"); - DeltaEx* ptr = new DeltaEx(); - CacheablePtr valPtr(ptr); + auto keyPtr4 = CacheableKey::create("Key4"); + auto valPtr = std::make_shared<DeltaEx>(); err = entries->put(keyPtr4, valPtr, me, oldValue, -1, 0, versionTag12); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr4, result, value); @@ -339,17 +343,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); ASSERT(DeltaEx::fromDeltaCount == 0, " Delta count should have been 0 "); - DeltaEx* ptr1 = new DeltaEx(); - ptr1->setDelta(true); - CacheablePtr valPtr1(ptr1); + auto valPtr1 = std::make_shared<DeltaEx>(); + valPtr1->setDelta(true); DataOutput doutput; doutput.writeInt(1); - const uint8_t* buffer = doutput.getBuffer(); + const auto buffer = doutput.getBuffer(); DataInput datainput(buffer, doutput.getBufferLength()); bool isUpdate; - VersionTagPtr versionTag12plus(new VersionTag(6, 6, 7, host13, host12)); + auto versionTag12plus = + std::make_shared<VersionTag>(6, 6, 7, host13, host12); err = entries->put(keyPtr4, valPtr1, me, oldValue, -1, 0, versionTag12plus, isUpdate, &datainput); @@ -370,7 +374,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) // Delta update, Not allowed as delta based on a different host version // different - VersionTagPtr versionTag12pp(new VersionTag(7, 6, 7, host13, host12)); + auto versionTag12pp = std::make_shared<VersionTag>(7, 6, 7, host13, host12); err = entries->put(keyPtr4, valPtr1, me, oldValue, -1, 0, versionTag12plus, isUpdate, &datainput); ASSERT(err == GF_INVALID_DELTA, "an exception"); @@ -379,16 +383,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) ASSERT(result->getVersionStamp().getEntryVersion() == 6, "an exception"); ASSERT(DeltaEx::fromDeltaCount == 1, " Delta count should have been 1 "); - DeltaEx* ptr2 = new DeltaEx(); - ptr2->setDelta(true); - CacheablePtr valPtr2(ptr2); + auto valPtr2 = std::make_shared<DeltaEx>(); + valPtr2->setDelta(true); DataOutput doutput1; doutput1.writeInt(1); - const uint8_t* buffer1 = doutput1.getBuffer(); + const auto buffer1 = doutput1.getBuffer(); DataInput datainput1(buffer1, doutput1.getBufferLength()); DeltaEx::fromDeltaCount = 0; // Delta update, allowed as delta based on correct host version different - VersionTagPtr versionTag12pp1(new VersionTag(7, 6, 7, host14, host13)); + auto versionTag12pp1 = + std::make_shared<VersionTag>(7, 6, 7, host14, host13); err = entries->put(keyPtr4, valPtr2, me, oldValue, -1, 0, versionTag12pp1, isUpdate, &datainput1); ASSERT(err == GF_NOERR, "an exception"); @@ -398,19 +402,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) ASSERT(DeltaEx::fromDeltaCount == 1, " Delta count should have been 1 "); /******* Test disk version tags*****************/ - VersionTagPtr versiondiskTag17(new DiskVersionTag(5, 6, 7, disk17, 0)); - VersionTagPtr versiondiskTag18(new DiskVersionTag(5, 6, 7, disk18, 0)); - VersionTagPtr versiondiskTag27(new DiskVersionTag(5, 6, 7, disk27, 0)); - CacheableKeyPtr keydiskPtr = CacheableKey::create((char*)"keydisk1"); - err = entries->put(keydiskPtr, ct, me, oldValue, -1, 0, versiondiskTag17); - err = entries->put(keydiskPtr, ct1, me, oldValue, -1, 0, versiondiskTag27); + auto versiondiskTag17 = + std::make_shared<DiskVersionTag>(5, 6, 7, disk17, 0); + auto versiondiskTag18 = + std::make_shared<DiskVersionTag>(5, 6, 7, disk18, 0); + auto versiondiskTag27 = + std::make_shared<DiskVersionTag>(5, 6, 7, disk27, 0); + auto keydiskPtr = CacheableKey::create("keydisk1"); + err = + entries->put(keydiskPtr, ccstr, me, oldValue, -1, 0, versiondiskTag17); + err = + entries->put(keydiskPtr, ccstr1, me, oldValue, -1, 0, versiondiskTag27); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keydiskPtr, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); ASSERT(result->getVersionStamp().getMemberId() == disk27, "an exception"); ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); - err = entries->put(keydiskPtr, ct, me, oldValue, -1, 0, versiondiskTag18); + err = + entries->put(keydiskPtr, ccstr, me, oldValue, -1, 0, versiondiskTag18); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keydiskPtr, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -418,15 +428,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); /********* Test with vm view ids ****************/ - VersionTagPtr versionvmviewTag5(new VersionTag(5, 6, 7, hostVmview5, 0)); - VersionTagPtr versionvmviewTag6(new VersionTag(5, 6, 7, hostVmview6, 0)); - VersionTagPtr versionvmviewTag7(new VersionTag(5, 6, 7, hostVmview7, 0)); - CacheableKeyPtr keyvmviewPtr = CacheableKey::create((char*)"keyvm1"); - err = - entries->put(keyvmviewPtr, ct, me, oldValue, -1, 0, versionvmviewTag5); - - err = - entries->put(keyvmviewPtr, ct1, me, oldValue, -1, 0, versionvmviewTag7); + auto versionvmviewTag5 = + std::make_shared<VersionTag>(5, 6, 7, hostVmview5, 0); + auto versionvmviewTag6 = + std::make_shared<VersionTag>(5, 6, 7, hostVmview6, 0); + auto versionvmviewTag7 = + std::make_shared<VersionTag>(5, 6, 7, hostVmview7, 0); + auto keyvmviewPtr = CacheableKey::create("keyvm1"); + err = entries->put(keyvmviewPtr, ccstr, me, oldValue, -1, 0, + versionvmviewTag5); + + err = entries->put(keyvmviewPtr, ccstr1, me, oldValue, -1, 0, + versionvmviewTag7); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyvmviewPtr, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -434,8 +447,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) "an exception"); ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); - err = - entries->put(keyvmviewPtr, ct, me, oldValue, -1, 0, versionvmviewTag6); + err = entries->put(keyvmviewPtr, ccstr, me, oldValue, -1, 0, + versionvmviewTag6); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyvmviewPtr, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -451,17 +464,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut) END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepThree_TestCreate) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = EntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = EntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr); + EntriesMap* entries = + new ConcurrentEntriesMap(entryFactory, true, lregPtr.get()); entries->open(); - CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4"); - ASSERT(keyPtr4 != NULLPTR, "expected keyPtr non-NULL"); + auto keyPtr4 = CacheableKey::create("key4"); + ASSERT(keyPtr4 != nullptr, "expected keyPtr non-NULL"); MapEntryImplPtr me; MapEntryImplPtr result; CacheablePtr value; @@ -469,87 +481,87 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree_TestCreate) /*new VersionTag(int32_t entryVersion, int16_t regionVersionHighBytes, int32_t regionVersionLowBytes, uint16_t internalMemId, uint16_t previousMemId) */ - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0)); - VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0)); - VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0)); - VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0)); - VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0)); + auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0); + auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0); + auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0); + auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0); + auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0); CacheablePtr oldValue; - entries->create(keyPtr4, ct, me, oldValue, -1, 0, versionTag1); + entries->create(keyPtr4, ccstr, me, oldValue, -1, 0, versionTag1); entries->getEntry(keyPtr4, result, value); ASSERT(me->getVersionStamp().getEntryVersion() == 5, "an exception"); ASSERT(me->getVersionStamp().getMemberId() == 1, "an exception"); char log[256]; - CacheableKeyPtr keyPtr = CacheableKey::create((char*)"Key"); - GfErrType err = - entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag12); + auto keyPtr = CacheableKey::create("Key"); + auto err = + entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag12); ASSERT(err == GF_NOERR, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag13); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag13); ASSERT(err == GF_NOERR, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag14); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag14); ASSERT(err == GF_NOERR, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag15); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag15); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag16); + err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag16); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->create(keyPtr, ct1, me, oldValue, -1, 0, versionTag17); + err = entries->create(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag17); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr, result, value); ASSERT(result->getVersionStamp().getMemberId() == 7, "an exception"); ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); - VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0)); + auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0); - CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2"); - err = entries->create(keyPtr2, NULLPTR, me, oldValue, -1, 0, versionTag18); + auto keyPtr2 = CacheableKey::create("Key2"); + err = entries->create(keyPtr2, nullptr, me, oldValue, -1, 0, versionTag18); ASSERT(err == GF_NOERR, "an exception"); // version rollover, this will be applied - err = entries->create(keyPtr2, NULLPTR, me, oldValue, -1, 0, versionTag12); + err = entries->create(keyPtr2, nullptr, me, oldValue, -1, 0, versionTag12); ASSERT(err == GF_NOERR, "an exception"); // Null version tag, this will be applied VersionTagPtr versionTag19; - err = entries->create(keyPtr2, ct, me, oldValue, -1, 0, versionTag19); + err = entries->create(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception"); ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); // inserts a null tag - CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3"); - err = entries->create(keyPtr3, NULLPTR, me, oldValue, -1, 0, versionTag19); + auto keyPtr3 = CacheableKey::create("Key3"); + err = entries->create(keyPtr3, nullptr, me, oldValue, -1, 0, versionTag19); ASSERT(err == GF_NOERR, "an exception"); // inserts an entry with version stamp, the previous entry is without // version // stamp, // should be allowed. - err = entries->create(keyPtr3, ct1, me, oldValue, -1, 0, versionTag12); + err = entries->create(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag12); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr3, result, value); ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception"); @@ -564,46 +576,43 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepEight_TestLRUEntries) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = LRUExpEntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = LRUExpEntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new LRUEntriesMap(entryFactory, lregPtr, + EntriesMap* entries = new LRUEntriesMap(entryFactory, lregPtr.get(), LRUAction::DESTROY, 50000, true); entries->open(); - CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4"); - CacheableKeyPtr keyPtr5 = CacheableKey::create((char*)"key5"); - CacheableKeyPtr keyPtr6 = CacheableKey::create((char*)"key6"); + auto keyPtr4 = CacheableKey::create("key4"); + auto keyPtr5 = CacheableKey::create("key5"); + auto keyPtr6 = CacheableKey::create("key6"); MapEntryImplPtr me; MapEntryImplPtr result; CacheablePtr value; char log[256]; - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - entries->put(keyPtr4, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr4, ccstr, me, value, -1, 0, versionTag1); - GfErrType err = - entries->remove(keyPtr4, value, me, -1, versionTag12, false); + auto err = entries->remove(keyPtr4, value, me, -1, versionTag12, false); ASSERT(err == GF_NOERR, "an exception"); bool isTombstone; err = entries->isTombstone(keyPtr4, result, isTombstone); ASSERT(err == GF_NOERR, "an exception"); ASSERT(isTombstone == true, "an exception"); - entries->put(keyPtr5, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag1); err = entries->invalidate(keyPtr5, me, value, versionTag12); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr5, result, value); ASSERT(CacheableToken::isInvalid(value) == true, "an exception"); - entries->put(keyPtr6, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr6, ccstr, me, value, -1, 0, versionTag1); ASSERT(entries->get(keyPtr4, value, result) == false, "an exception"); ASSERT(entries->get(keyPtr6, value, result) == true, "an exception"); @@ -617,38 +626,36 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepFive_TestTombstoneExpiry) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = EntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = EntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr); + EntriesMap* entries = + new ConcurrentEntriesMap(entryFactory, true, lregPtr.get()); entries->open(); - CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4"); - CacheableKeyPtr keyPtr5 = CacheableKey::create((char*)"key5"); - CacheableKeyPtr keyPtr6 = CacheableKey::create((char*)"key6"); + auto keyPtr4 = CacheableKey::create("key4"); + auto keyPtr5 = CacheableKey::create("key5"); + auto keyPtr6 = CacheableKey::create("key6"); MapEntryImplPtr me; MapEntryImplPtr result; CacheablePtr value; char log[256]; - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - entries->put(keyPtr4, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr4, ccstr, me, value, -1, 0, versionTag1); - GfErrType err = - entries->remove(keyPtr4, value, me, -1, versionTag12, false); + auto err = entries->remove(keyPtr4, value, me, -1, versionTag12, false); ASSERT(err == GF_NOERR, "an exception"); bool isTombstone; err = entries->isTombstone(keyPtr4, result, isTombstone); ASSERT(err == GF_NOERR, "an exception"); ASSERT(isTombstone == true, "an exception"); - entries->put(keyPtr5, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag1); err = entries->remove(keyPtr5, value, me, -1, versionTag12, false); ASSERT(err == GF_NOERR, "an exception"); @@ -656,10 +663,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive_TestTombstoneExpiry) ASSERT(err == GF_NOERR, "an exception"); ASSERT(isTombstone == true, "an exception"); - entries->put(keyPtr6, ct, me, value, -1, 0, versionTag1); - uint32_t tombstone_count = + entries->put(keyPtr6, ccstr, me, value, -1, 0, versionTag1); + auto tombstone_count = lregPtr->getCacheImpl()->m_cacheStats->getTombstoneCount(); - uint64_t tombstone_size = + auto tombstone_size = lregPtr->getCacheImpl()->m_cacheStats->getTombstoneSize(); sprintf(log, @@ -682,9 +689,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive_TestTombstoneExpiry) ASSERT(isTombstone == false, "an exception"); ASSERT(entries->get(keyPtr4, value, result) == false, "an exception"); - uint32_t tombstone_count_after = + auto tombstone_count_after = lregPtr->getCacheImpl()->m_cacheStats->getTombstoneCount(); - uint64_t tombstone_size_after = + auto tombstone_size_after = lregPtr->getCacheImpl()->m_cacheStats->getTombstoneSize(); sprintf(log, @@ -706,48 +713,47 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = EntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = EntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr); + EntriesMap* entries = + new ConcurrentEntriesMap(entryFactory, true, lregPtr.get()); entries->open(); - CacheableKeyPtr keyPtr = CacheableKey::create((char*)"key1"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + CacheableKeyPtr keyPtr = CacheableKey::create("key1"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); MapEntryImplPtr me; MapEntryImplPtr result; CacheablePtr value; - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0)); - VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0)); - VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0)); - VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0)); - VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0)); - VersionTagPtr versionTag22(new VersionTag(9, 10, 10, host12, 0)); + auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0); + auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0); + auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0); + auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0); + auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0); + auto versionTag22 = std::make_shared<VersionTag>(9, 10, 10, host12, 0); CacheablePtr oldValue; - entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); char log[256]; - GfErrType err = entries->invalidate(keyPtr, me, oldValue, versionTag12); + auto err = entries->invalidate(keyPtr, me, oldValue, versionTag12); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr, result, value); ASSERT(CacheableToken::isInvalid(value) == true, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyPtr, result, value); ASSERT(CacheableToken::isInvalid(value) == true, "an exception"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag13); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag13); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr, result, value); ASSERT(CacheableToken::isInvalid(value) != true, "an exception"); @@ -776,18 +782,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate) ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception"); ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception"); - VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0)); + auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0); // version rollover, this will not be applied - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag18); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag18); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); entries->getEntry(keyPtr, result, value); ASSERT(CacheableToken::isInvalid(value) == true, "an exception"); ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception"); ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception"); - CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2"); - err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag18); + auto keyPtr2 = CacheableKey::create("Key2"); + err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag18); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(atoi(value->toString()->asChar()) == 100, "an exception"); @@ -803,7 +809,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate) // Null version tag, this will be applied VersionTagPtr versionTag19; - err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19); entries->getEntry(keyPtr2, result, value); ASSERT(CacheableToken::isInvalid(value) != true, "an exception"); ASSERT(atoi(value->toString()->asChar()) == 100, "an exception"); @@ -811,8 +817,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate) ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception"); // inserts a null tag - CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3"); - err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag19); + auto keyPtr3 = CacheableKey::create("Key3"); + err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag19); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr3, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -836,40 +842,38 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = EntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = EntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr); + EntriesMap* entries = + new ConcurrentEntriesMap(entryFactory, true, lregPtr.get()); entries->open(); - CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4"); - CacheableKeyPtr keyPtr5 = CacheableKey::create((char*)"key5"); - CacheableKeyPtr keyPtr6 = CacheableKey::create((char*)"key6"); + auto keyPtr4 = CacheableKey::create("key4"); + auto keyPtr5 = CacheableKey::create("key5"); + auto keyPtr6 = CacheableKey::create("key6"); MapEntryImplPtr me; MapEntryImplPtr result; CacheablePtr value; char log[256]; - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - VersionTagPtr versionTag22(new VersionTag(6, 6, 7, host12, 0)); + auto versionTag22 = std::make_shared<VersionTag>(6, 6, 7, host12, 0); - entries->put(keyPtr4, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr4, ccstr, me, value, -1, 0, versionTag1); - GfErrType err = - entries->remove(keyPtr4, value, me, -1, versionTag12, false); + auto err = entries->remove(keyPtr4, value, me, -1, versionTag12, false); ASSERT(err == GF_NOERR, "an exception"); bool isTombstone; err = entries->isTombstone(keyPtr4, result, isTombstone); ASSERT(err == GF_NOERR, "an exception"); ASSERT(isTombstone == true, "an exception"); - entries->put(keyPtr5, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag1); err = entries->remove(keyPtr5, value, me, -1, versionTag12, false); ASSERT(err == GF_NOERR, "an exception"); @@ -877,7 +881,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove) ASSERT(err == GF_NOERR, "an exception"); ASSERT(isTombstone == true, "an exception"); - entries->put(keyPtr6, ct, me, value, -1, 0, versionTag1); + entries->put(keyPtr6, ccstr, me, value, -1, 0, versionTag1); ASSERT(entries->containsKey(keyPtr6) == true, "an exception"); ASSERT(entries->containsKey(keyPtr5) == false, "an exception"); @@ -898,7 +902,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove) entries->entries(regionEntries); ASSERT(regionEntries.length() == 1, "an exception"); - entries->put(keyPtr5, ct, me, value, -1, 0, versionTag22); + entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag22); ASSERT(entries->containsKey(keyPtr6) == true, "an exception"); ASSERT(entries->containsKey(keyPtr5) == true, "an exception"); @@ -924,38 +928,36 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove) END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) { - LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr())); - CacheableStringPtr ccstr = createCacheable("100"); - CacheablePtr ct = ccstr; - CacheableStringPtr ccstr1 = createCacheable("500"); - CacheablePtr ct1 = ccstr1; - EntryFactory* entryFactory = EntryFactory::singleton; + auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr); + auto ccstr = createCacheable("100"); + auto ccstr1 = createCacheable("500"); + auto entryFactory = EntryFactory::singleton; entryFactory->setConcurrencyChecksEnabled(true); - EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr); + EntriesMap* entries = + new ConcurrentEntriesMap(entryFactory, true, lregPtr.get()); entries->open(); - CacheableKeyPtr keyPtr = CacheableKey::create((char*)"key1"); - ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL"); + auto keyPtr = CacheableKey::create("key1"); + ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL"); MapEntryImplPtr me; MapEntryImplPtr result; CacheablePtr value; - VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0)); + auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0); - VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0)); + auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0); - VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0)); - VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0)); - VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0)); - VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0)); - VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0)); - VersionTagPtr versionTag22(new VersionTag(9, 10, 10, host12, 0)); + auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0); + auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0); + auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0); + auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0); + auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0); + auto versionTag22 = std::make_shared<VersionTag>(9, 10, 10, host12, 0); CacheablePtr oldValue; - entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); char log[256]; - GfErrType err = - entries->remove(keyPtr, oldValue, me, -1, versionTag12, false); + auto err = entries->remove(keyPtr, oldValue, me, -1, versionTag12, false); ASSERT(err == GF_NOERR, "an exception"); bool isTombstone; @@ -964,15 +966,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) entries->getEntry(keyPtr, result, value); ASSERT(isTombstone == true, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); err = entries->isTombstone(keyPtr, result, isTombstone); ASSERT(err == GF_NOERR, "an exception"); ASSERT(isTombstone == true, "an exception"); - uint32_t tombstone_count = + auto tombstone_count = lregPtr->getCacheImpl()->m_cacheStats->getTombstoneCount(); - uint64_t tombstone_size = + auto tombstone_size = lregPtr->getCacheImpl()->m_cacheStats->getTombstoneSize(); sprintf(log, "After tombstone creation, Tombstone size: %" PRId64 @@ -984,7 +986,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) "Tombstone size should be greater than 70 bytes. 70 is an approx " "figure for tombstone overhead"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag13); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag13); ASSERT(err == GF_NOERR, "an exception"); err = entries->isTombstone(keyPtr, result, isTombstone); ASSERT(err == GF_NOERR, "an exception"); @@ -1018,13 +1020,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); ASSERT(entries->get(keyPtr, value, result) == false, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag15); + err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag15); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); err = entries->remove(keyPtr, oldValue, me, -1, versionTag16, false); @@ -1048,10 +1050,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception"); ASSERT(entries->get(keyPtr, value, result) == false, "an exception"); - VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0)); + auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0); // version rollover, this will not be applied - err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag18); + err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag18); ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception"); err = entries->isTombstone(keyPtr, result, isTombstone); ASSERT(err == GF_NOERR, "an exception"); @@ -1060,8 +1062,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception"); ASSERT(entries->get(keyPtr, value, result) == false, "an exception"); - CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2"); - err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag18); + auto keyPtr2 = CacheableKey::create("Key2"); + err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag18); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(atoi(value->toString()->asChar()) == 100, "an exception"); @@ -1079,7 +1081,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) // Null version tag, this will be applied VersionTagPtr versionTag19; - err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr2, result, value); ASSERT(atoi(value->toString()->asChar()) == 100, "an exception"); @@ -1087,8 +1089,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception"); // inserts a null tag - CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3"); - err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag19); + auto keyPtr3 = CacheableKey::create("Key3"); + err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag19); ASSERT(err == GF_NOERR, "an exception"); entries->getEntry(keyPtr3, result, value); ASSERT(atoi(value->toString()->asChar()) == 500, "an exception"); @@ -1107,36 +1109,36 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception"); ASSERT(entries->get(keyPtr3, value, result) == false, "an exception"); - CacheableKeyPtr keyPtrR2 = CacheableKey::create((char*)"keyPtrR2"); - CacheableKeyPtr keyPtrR3 = CacheableKey::create((char*)"keyPtrR3"); - CacheableKeyPtr keyPtrR4 = CacheableKey::create((char*)"keyPtrR4"); - CacheableKeyPtr keyPtrR5 = CacheableKey::create((char*)"keyPtrR5"); - CacheableKeyPtr keyPtrR6 = CacheableKey::create((char*)"keyPtrR6"); + auto keyPtrR2 = CacheableKey::create("keyPtrR2"); + auto keyPtrR3 = CacheableKey::create("keyPtrR3"); + auto keyPtrR4 = CacheableKey::create("keyPtrR4"); + auto keyPtrR5 = CacheableKey::create("keyPtrR5"); + auto keyPtrR6 = CacheableKey::create("keyPtrR6"); - CacheableKeyPtr keyPtrR21 = CacheableKey::create((char*)"keyPtrR21"); - CacheableKeyPtr keyPtrR31 = CacheableKey::create((char*)"keyPtrR31"); - CacheableKeyPtr keyPtrR41 = CacheableKey::create((char*)"keyPtrR41"); - CacheableKeyPtr keyPtrR51 = CacheableKey::create((char*)"keyPtrR51"); - CacheableKeyPtr keyPtrR61 = CacheableKey::create((char*)"keyPtrR61"); + auto keyPtrR21 = CacheableKey::create("keyPtrR21"); + auto keyPtrR31 = CacheableKey::create("keyPtrR31"); + auto keyPtrR41 = CacheableKey::create("keyPtrR41"); + auto keyPtrR51 = CacheableKey::create("keyPtrR51"); + auto keyPtrR61 = CacheableKey::create("keyPtrR61"); - VersionTagPtr versionTag23(new VersionTag(9, 10, 10, host13, 0)); - VersionTagPtr versionTag24(new VersionTag(9, 10, 10, host14, 0)); - VersionTagPtr versionTag25(new VersionTag(9, 10, 10, host15, 0)); - VersionTagPtr versionTag26(new VersionTag(9, 10, 10, host16, 0)); + auto versionTag23 = std::make_shared<VersionTag>(9, 10, 10, host13, 0); + auto versionTag24 = std::make_shared<VersionTag>(9, 10, 10, host14, 0); + auto versionTag25 = std::make_shared<VersionTag>(9, 10, 10, host15, 0); + auto versionTag26 = std::make_shared<VersionTag>(9, 10, 10, host16, 0); sprintf(log, "Test reaping of tombstones"); LOG(log); // add few entries with null version tags - err = entries->put(keyPtrR2, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR3, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR4, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR5, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR21, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR31, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR41, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR51, ct1, me, oldValue, -1, 0, versionTag19); - err = entries->put(keyPtrR61, ct1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR2, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR3, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR4, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR5, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR21, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR31, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR41, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR51, ccstr1, me, oldValue, -1, 0, versionTag19); + err = entries->put(keyPtrR61, ccstr1, me, oldValue, -1, 0, versionTag19); // remove those entries using non null version tags err = entries->remove(keyPtrR2, oldValue, me, -1, versionTag12, false); @@ -1236,8 +1238,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove) sprintf(log, "Remove test complete. %d", err); LOG(log); // reap using removedKeys API - CacheableKeyPtr keyPtrR71 = CacheableKey::create((char*)"keyPtrR71"); - CacheableHashSetPtr removedKeys = CacheableHashSet::create(); + auto keyPtrR71 = CacheableKey::create("keyPtrR71"); + auto removedKeys = CacheableHashSet::create(); removedKeys->insert(keyPtrR3); removedKeys->insert(keyPtrR71); removedKeys->insert(keyPtrR2); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testExpiration.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/integration-test/testExpiration.cpp b/src/cppcache/integration-test/testExpiration.cpp index 5aa2f3f..b214744 100644 --- a/src/cppcache/integration-test/testExpiration.cpp +++ b/src/cppcache/integration-test/testExpiration.cpp @@ -38,7 +38,7 @@ void startDSandCreateCache(CachePtr& cache) { PropertiesPtr pp = Properties::create(); CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(pp); cache = cacheFactoryPtr->create(); - ASSERT(cache != NULLPTR, "cache not equal to null expected"); + ASSERT(cache != nullptr, "cache not equal to null expected"); } void doNPuts(RegionPtr& rptr, int n) { @@ -48,7 +48,7 @@ void doNPuts(RegionPtr& rptr, int n) { buf[15] = '\0'; memcpy(buf, "Value - ", 8); value = CacheableString::create(buf); - ASSERT(value != NULLPTR, "Failed to create value."); + ASSERT(value != nullptr, "Failed to create value."); for (int i = 0; i < n; i++) { sprintf(buf, "KeyA - %d", i + 1); @@ -66,7 +66,7 @@ CacheableKeyPtr do1Put(RegionPtr& rptr) { buf[15] = '\0'; memcpy(buf, "Value - ", 8); value = CacheableString::create(buf); - ASSERT(value != NULLPTR, "Failed to create value."); + ASSERT(value != nullptr, "Failed to create value."); sprintf(buf, "KeyA - %d", 0 + 1); CacheableKeyPtr key = CacheableKey::create(buf); @@ -94,22 +94,24 @@ BEGIN_TEST(TEST_EXPIRATION) startDSandCreateCache(cache); - ASSERT(cache != NULLPTR, "Expected cache to be NON-NULL"); + ASSERT(cache != nullptr, "Expected cache to be NON-NULL"); + + CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get()); + + int n; RegionAttributesPtr attrs_1; // ettl = 0, eit = 0, rttl = 0, reit = 0 setExpTimes(attrs_1); - RegionPtr R1; - CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr()); cacheImpl->createRegion("R1", attrs_1, R1); - ASSERT(R1 != NULLPTR, "Expected R1 to be NON-NULL"); + ASSERT(R1 != nullptr, "Expected R1 to be NON-NULL"); doNPuts(R1, 100); ACE_OS::sleep(10); - int n = getNumOfEntries(R1); + n = getNumOfEntries(R1); ASSERT(n == 100, "Expected 100 entries"); ASSERT(R1->isDestroyed() == false, "Expected R1 to be alive"); @@ -120,7 +122,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R2; cacheImpl->createRegion("R2", attrs_2, R2); - ASSERT(R2 != NULLPTR, "Expected R2 to be NON-NULL"); + ASSERT(R2 != nullptr, "Expected R2 to be NON-NULL"); LOG("Region R2 created"); doNPuts(R2, 1); @@ -137,7 +139,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R3; cacheImpl->createRegion("R3", attrs_3, R3); - ASSERT(R3 != NULLPTR, "Expected R3 to be NON-NULL"); + ASSERT(R3 != nullptr, "Expected R3 to be NON-NULL"); ACE_OS::sleep(5); @@ -149,7 +151,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R4; cacheImpl->createRegion("R4", attrs_4, R4); - ASSERT(R4 != NULLPTR, "Expected R4 to be NON-NULL"); + ASSERT(R4 != nullptr, "Expected R4 to be NON-NULL"); doNPuts(R4, 1); // This will be same as updating the object @@ -167,7 +169,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R5; cacheImpl->createRegion("R5", attrs_5, R5); - ASSERT(R5 != NULLPTR, "Expected R5 to be NON-NULL"); + ASSERT(R5 != nullptr, "Expected R5 to be NON-NULL"); CacheableKeyPtr key_0 = do1Put(R5); @@ -194,7 +196,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R6; cacheImpl->createRegion("R6", attrs_6, R6); - ASSERT(R6 != NULLPTR, "Expected R6 to be NON-NULL"); + ASSERT(R6 != nullptr, "Expected R6 to be NON-NULL"); doNPuts(R6, 1); @@ -212,7 +214,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R7; cacheImpl->createRegion("R7", attrs_7, R7); - ASSERT(R7 != NULLPTR, "Expected R7 to be NON-NULL"); + ASSERT(R7 != nullptr, "Expected R7 to be NON-NULL"); doNPuts(R7, 1); @@ -230,7 +232,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R8; cacheImpl->createRegion("R8", attrs_8, R8); - ASSERT(R8 != NULLPTR, "Expected R8 to be NON-NULL"); + ASSERT(R8 != nullptr, "Expected R8 to be NON-NULL"); CacheableKeyPtr key = do1Put(R8); @@ -249,7 +251,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R9; cacheImpl->createRegion("R9", attrs_9, R9); - ASSERT(R9 != NULLPTR, "Expected R9 to be NON-NULL"); + ASSERT(R9 != nullptr, "Expected R9 to be NON-NULL"); CacheableKeyPtr key_1 = do1Put(R9); @@ -270,7 +272,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R10; cacheImpl->createRegion("R10", attrs_10, R10); - ASSERT(R10 != NULLPTR, "Expected R10 to be NON-NULL"); + ASSERT(R10 != nullptr, "Expected R10 to be NON-NULL"); doNPuts(R10, 1); @@ -290,7 +292,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R11; cacheImpl->createRegion("R11", attrs_11, R11); - ASSERT(R11 != NULLPTR, "Expected R11 to be NON-NULL"); + ASSERT(R11 != nullptr, "Expected R11 to be NON-NULL"); CacheableKeyPtr k11 = do1Put(R11); @@ -316,7 +318,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R12; cacheImpl->createRegion("R12", attrs_12, R12); - ASSERT(R12 != NULLPTR, "Expected R12 to be NON-NULL"); + ASSERT(R12 != nullptr, "Expected R12 to be NON-NULL"); CacheableKeyPtr key_3 = do1Put(R12); @@ -334,7 +336,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R14; cacheImpl->createRegion("R14", attrs_14, R14); - ASSERT(R14 != NULLPTR, "Expected R14 to be NON-NULL"); + ASSERT(R14 != nullptr, "Expected R14 to be NON-NULL"); doNPuts(R14, 1); @@ -348,7 +350,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R15; cacheImpl->createRegion("R15", attrs_15, R15); - ASSERT(R15 != NULLPTR, "Expected R15 to be NON-NULL"); + ASSERT(R15 != nullptr, "Expected R15 to be NON-NULL"); CacheableKeyPtr key_4 = do1Put(R15); @@ -367,7 +369,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R18; cacheImpl->createRegion("R18", attrs_18, R18); - ASSERT(R18 != NULLPTR, "Expected R18 to be NON-NULL"); + ASSERT(R18 != nullptr, "Expected R18 to be NON-NULL"); doNPuts(R18, 1); @@ -386,7 +388,7 @@ BEGIN_TEST(TEST_EXPIRATION) RegionPtr R19; cacheImpl->createRegion("R19x", attrs_19, R19); - ASSERT(R19 != NULLPTR, "Expected R19 to be NON-NULL"); + ASSERT(R19 != nullptr, "Expected R19 to be NON-NULL"); ACE_OS::sleep(4);