This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch feature/GEODE-4946-msvc-warn in repository https://gitbox.apache.org/repos/asf/geode-native.git
commit f08f90918d0eac58193ce0803c25d819bea508ea Author: Jacob Barrett <jbarr...@pivotal.io> AuthorDate: Tue Mar 27 19:12:36 2018 +0000 cpp integration tests warning free on Windows. --- cppcache/integration-test/CMakeLists.txt | 3 + cppcache/integration-test/ThinClientDistOps.hpp | 4 +- cppcache/integration-test/testDataOutput.cpp | 12 +-- .../testThinClientCacheableStringArray.cpp | 12 +-- .../integration-test/testThinClientCqDurable.cpp | 21 ++-- .../testThinClientCqHAFailover.cpp | 15 +-- cppcache/integration-test/testThinClientCqIR.cpp | 16 +-- .../testThinClientHAQueryFailover.cpp | 7 +- .../testThinClientLocatorFailover.cpp | 13 +-- .../integration-test/testThinClientPdxInstance.cpp | 111 +++++++++++++-------- .../integration-test/testThinClientPoolLocator.cpp | 2 +- .../testThinClientRemoteQueryFailover.cpp | 7 +- .../testThinClientRemoteQueryFailoverPdx.cpp | 7 +- .../testThinClientSecurityMultiUserTest.cpp | 30 +++--- .../testXmlCacheCreationWithOverFlow.cpp | 65 ++++++------ tests/cpp/testobject/NonPdxType.hpp | 2 +- 16 files changed, 187 insertions(+), 140 deletions(-) diff --git a/cppcache/integration-test/CMakeLists.txt b/cppcache/integration-test/CMakeLists.txt index 226d07d..37cfd37 100644 --- a/cppcache/integration-test/CMakeLists.txt +++ b/cppcache/integration-test/CMakeLists.txt @@ -21,6 +21,7 @@ add_library(${TEST_UTILS_LIB} STATIC fw_dunit.cpp BBNamingContext.cpp CacheHelpe target_link_libraries(${TEST_UTILS_LIB} PRIVATE ACE + _WarningsAsError PUBLIC apache-geode fwk @@ -38,6 +39,7 @@ add_library(unit_test_callbacks SHARED LibraryCallbacks.cpp) target_link_libraries(unit_test_callbacks PRIVATE ACE + _WarningsAsError PUBLIC apache-geode ) @@ -79,6 +81,7 @@ foreach(FILE ${SOURCES}) PRIVATE ACE ${TEST_UTILS_LIB} + _WarningsAsError PUBLIC apache-geode testobject diff --git a/cppcache/integration-test/ThinClientDistOps.hpp b/cppcache/integration-test/ThinClientDistOps.hpp index b4eca6e..0322f31 100644 --- a/cppcache/integration-test/ThinClientDistOps.hpp +++ b/cppcache/integration-test/ThinClientDistOps.hpp @@ -598,13 +598,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyUpdateLocatorListThread) dunit::sleep(sleepSeconds * 1000); auto pptr = getHelper()->getCache()->getPoolManager().find("__TESTPOOL1_"); - int updateIntervalSeconds = + auto updateIntervalSeconds = pptr->getUpdateLocatorListInterval().count() / 1000; int numLocatorListUpdates = CacheHelper::getNumLocatorListUpdates("Querying locator list at:"); - int numExpectedLocatorListUpdates = 0; + decltype(updateIntervalSeconds) numExpectedLocatorListUpdates = 0; if (updateIntervalSeconds > 0) { numExpectedLocatorListUpdates = sleepSeconds / updateIntervalSeconds; } diff --git a/cppcache/integration-test/testDataOutput.cpp b/cppcache/integration-test/testDataOutput.cpp index 11e6acf..ef617b9 100644 --- a/cppcache/integration-test/testDataOutput.cpp +++ b/cppcache/integration-test/testDataOutput.cpp @@ -31,21 +31,21 @@ using namespace apache::geode::client; -void dumpnbytes(const uint8_t* buf, uint32_t length) { - for (uint32_t i = 0; i < length; i++) { +void dumpnbytes(const uint8_t* buf, size_t length) { + for (size_t i = 0; i < length; i++) { std::cout << "buf[" << i << "] = " << std::setfill('0') << std::setw(2) << std::hex << (static_cast<int16_t>(buf[i]) & 0xff) << std::dec << " " << static_cast<char>(buf[i]) << std::endl; } } -void dumpnshorts(const uint16_t* buf, uint32_t length) { - for (uint32_t i = 0; i < length; i++) { +void dumpnshorts(const uint16_t* buf, size_t length) { + for (size_t i = 0; i < length; i++) { std::cout << "buf[" << i << "] = " << std::hex << static_cast<uint16_t>(buf[i]) << std::dec << std::endl; } } -void dumpnwords(const uint32_t* buf, uint32_t length) { - for (uint32_t i = 0; i < length; i++) { +void dumpnwords(const uint32_t* buf, size_t length) { + for (size_t i = 0; i < length; i++) { std::cout << "buf[" << i << "] = " << std::hex << static_cast<uint32_t>(buf[i]) << std::dec << std::endl; } diff --git a/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/cppcache/integration-test/testThinClientCacheableStringArray.cpp index 62eaed2..725ac55 100644 --- a/cppcache/integration-test/testThinClientCacheableStringArray.cpp +++ b/cppcache/integration-test/testThinClientCacheableStringArray.cpp @@ -77,7 +77,8 @@ DUNIT_TASK(CLIENT1, StepOne) auto regptr = getHelper()->createPooledRegion( _regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true); - auto subregPtr = regptr->createSubregion(_regionNames[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(_regionNames[1], regptr->getAttributes()); auto&& qh = &QueryHelper::getHelper(); std::vector<std::shared_ptr<CacheableString>> cstr{ @@ -103,8 +104,8 @@ DUNIT_TASK(CLIENT1, StepThree) SelectResultsIterator iter = results->getIterator(); char buf[100]; - int count = results->size(); - sprintf(buf, "results size=%d", count); + auto count = results->size(); + sprintf(buf, "results size=%zd", count); LOG(buf); while (iter.hasNext()) { count--; @@ -131,12 +132,11 @@ DUNIT_TASK(CLIENT1, StepThree) } } } - sprintf(buf, "results last count=%d", count); + sprintf(buf, "results last count=%zd", count); LOG(buf); } catch (IllegalStateException& ise) { char isemsg[500] = {0}; - ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", - ise.what()); + ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what()); LOG(isemsg); FAIL(isemsg); } catch (Exception& excp) { diff --git a/cppcache/integration-test/testThinClientCqDurable.cpp b/cppcache/integration-test/testThinClientCqDurable.cpp index c4528ba..0c437a1 100644 --- a/cppcache/integration-test/testThinClientCqDurable.cpp +++ b/cppcache/integration-test/testThinClientCqDurable.cpp @@ -177,7 +177,8 @@ void stepOne() { initClientWithId(0); createRegionForCQ(regionNamesCq[0], USE_ACK, true); auto regptr = getHelper()->getRegion(regionNamesCq[0]); - auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); LOG("StepOne complete."); } @@ -199,7 +200,8 @@ void RunDurableCqClient() { LOGINFO("Created the Geode Cache Programmatically"); - auto regionFactory = cachePtr->createRegionFactory(RegionShortcut::CACHING_PROXY); + auto regionFactory = + cachePtr->createRegionFactory(RegionShortcut::CACHING_PROXY); // Create the Region Programmatically. auto regionPtr = regionFactory.create("DistRegionAck"); @@ -339,7 +341,8 @@ void stepOne2() { initClientWithId(1); createRegionForCQ(regionNamesCq[0], USE_ACK, true); auto regptr = getHelper()->getRegion(regionNamesCq[0]); - auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); LOG("StepOne2 complete."); } @@ -395,8 +398,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) LOG("EXECUTE 1 STOP"); SelectResultsIterator iter = results->getIterator(); char buf[100]; - int count = results->size(); - sprintf(buf, "results size=%d", count); + auto count = results->size(); + sprintf(buf, "results size=%zd", count); LOG(buf); } catch (const Exception& excp) { std::string logmsg = ""; @@ -460,10 +463,10 @@ void client1Up() { QueryHelper::getHelper(); std::shared_ptr<QueryService> qs = getHelper() - ->getCache() - ->getPoolManager() - .find(regionNamesCq[0]) - ->getQueryService(); + ->getCache() + ->getPoolManager() + .find(regionNamesCq[0]) + ->getQueryService(); CqAttributesFactory cqFac; auto cqLstner = std::make_shared<MyCqListener>(); cqFac.addCqListener(cqLstner); diff --git a/cppcache/integration-test/testThinClientCqHAFailover.cpp b/cppcache/integration-test/testThinClientCqHAFailover.cpp index f3addff..5dd9c32 100644 --- a/cppcache/integration-test/testThinClientCqHAFailover.cpp +++ b/cppcache/integration-test/testThinClientCqHAFailover.cpp @@ -168,7 +168,8 @@ void stepOne() { createRegionForCQ(regionNamesCq[0], USE_ACK, true, 1); auto regptr = getHelper()->getRegion(regionNamesCq[0]); - auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); QueryHelper* qh = &QueryHelper::getHelper(); @@ -186,7 +187,8 @@ void stepOne2() { initClientCq(1); createRegionForCQ(regionNamesCq[0], USE_ACK, true, 1); auto regptr = getHelper()->getRegion(regionNamesCq[0]); - auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); LOG("StepOne2 complete."); } @@ -220,8 +222,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) SelectResultsIterator iter = results->getIterator(); char buf[100]; - int count = results->size(); - sprintf(buf, "results size=%d", count); + auto count = results->size(); + sprintf(buf, "results size=%zd", count); LOG(buf); while (iter.hasNext()) { count--; @@ -249,14 +251,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) } } } - sprintf(buf, "results last count=%d", count); + sprintf(buf, "results last count=%zd", count); LOG(buf); // ASSERT( count==0, "results traversal count incorrect!" ); SLEEP(15000); } catch (IllegalStateException& ise) { char isemsg[500] = {0}; - ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", - ise.what()); + ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what()); LOG(isemsg); FAIL(isemsg); } catch (Exception& excp) { diff --git a/cppcache/integration-test/testThinClientCqIR.cpp b/cppcache/integration-test/testThinClientCqIR.cpp index 25fdd60..f7199d6 100644 --- a/cppcache/integration-test/testThinClientCqIR.cpp +++ b/cppcache/integration-test/testThinClientCqIR.cpp @@ -97,7 +97,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1Regions) createRegionForCQ(regionNamesCq[0], USE_ACK, true); createRegionForCQ(regionNamesCq[2], USE_ACK, true); auto regptr = getHelper()->getRegion(regionNamesCq[0]); - auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); LOG("CreateClient1Regions complete."); } @@ -108,7 +109,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2Regions) initClientCq(true); createRegionForCQ(regionNamesCq[0], USE_ACK, true); auto regptr = getHelper()->getRegion(regionNamesCq[0]); - auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); + auto subregPtr = + regptr->createSubregion(regionNamesCq[1], regptr->getAttributes()); LOG("CreateClient2Regions complete."); } @@ -181,8 +183,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData) auto iter = results->getIterator(); char buf[100]; - int count = results->size(); - sprintf(buf, "results size=%d", count); + auto count = results->size(); + sprintf(buf, "results size=%zd", count); LOG(buf); ASSERT(count > 0, "count should be > 0"); while (iter.hasNext()) { @@ -216,7 +218,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData) printf(" query pulled bad object\n"); } } - sprintf(buf, "results last count=%d", count); + sprintf(buf, "results last count=%zd", count); LOG(buf); qry = qs->newCq("MyCq2", "select * from /Portfolios2", cqAttr); @@ -228,7 +230,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData) auto iter2 = results->getIterator(); count = results->size(); - sprintf(buf, "results2 size=%d", count); + sprintf(buf, "results2 size=%zd", count); LOG(buf); ASSERT(count > 0, "count should be > 0"); while (iter2.hasNext()) { @@ -262,7 +264,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData) printf(" query pulled bad object\n"); } } - sprintf(buf, "results last count=%d", count); + sprintf(buf, "results last count=%zd", count); LOG(buf); { diff --git a/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/cppcache/integration-test/testThinClientHAQueryFailover.cpp index 6c4a82c..d5e61b8 100644 --- a/cppcache/integration-test/testThinClientHAQueryFailover.cpp +++ b/cppcache/integration-test/testThinClientHAQueryFailover.cpp @@ -234,10 +234,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) // SLEEP(15000); } - int resultsize = results->size(); + auto resultsize = results->size(); if (i % 100 == 0) { - printf("Iteration upto %d done, result size is %d\n", i, resultsize); + printf("Iteration upto %d done, result size is %zd\n", i, resultsize); } // ASSERT(resultsize==4, "Failed verification"); @@ -253,8 +253,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree) kst->stop(); } catch (IllegalStateException& ise) { char isemsg[500] = {0}; - ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", - ise.what()); + ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what()); LOG(isemsg); FAIL(isemsg); } catch (Exception& excp) { diff --git a/cppcache/integration-test/testThinClientLocatorFailover.cpp b/cppcache/integration-test/testThinClientLocatorFailover.cpp index a60d8cd..8179398 100644 --- a/cppcache/integration-test/testThinClientLocatorFailover.cpp +++ b/cppcache/integration-test/testThinClientLocatorFailover.cpp @@ -213,14 +213,15 @@ DUNIT_TASK(CLIENT1, AgainAgainFailoverC1_All) FAIL( "No locator exception should " "have been raised"); - } catch (const NoAvailableLocatorsException& ex) { + } catch (const NoAvailableLocatorsException&) { LOG("Caught expected NoAvailableLocatorsException."); } catch (...) { - FAIL("NotConnectedException " - "with cause " - "NoAvailableLocatorsExcepti" - "on should have been " - "raised"); + FAIL( + "NotConnectedException " + "with cause " + "NoAvailableLocatorsExcepti" + "on should have been " + "raised"); } } END_TASK(AgainAgainFailoverC1_All) diff --git a/cppcache/integration-test/testThinClientPdxInstance.cpp b/cppcache/integration-test/testThinClientPdxInstance.cpp index 77dba6f..c4699e5 100644 --- a/cppcache/integration-test/testThinClientPdxInstance.cpp +++ b/cppcache/integration-test/testThinClientPdxInstance.cpp @@ -64,10 +64,11 @@ bool genericValCompare(T1 value1, T2 value2) /*const*/ return true; } -template <typename T1, typename T2> -bool genericCompare(std::vector<T1> value1, std::vector<T2> value2, int length) /*const*/ +template <typename T1, typename T2, typename L> +bool genericCompare(std::vector<T1> value1, std::vector<T2> value2, + L length) /*const*/ { - int i = 0; + L i = 0; while (i < length) { if (value1[i] != value2[i]) { return false; @@ -232,7 +233,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithIdentityField) LOG("putPdxWithIdentityField started "); try { - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); serializationRegistry->addPdxType(SerializePdx::createDeserializable); LOG("SerializePdx Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { @@ -256,7 +259,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCacheableObjectArrayWithPdxFields) LOG("putCacheableObjectArrayWithPdxFields started "); try { - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); serializationRegistry->addPdxType(Address::createDeserializable); LOG("Address Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { @@ -280,10 +285,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCacheableObjectArrayWithPdxFields) std::shared_ptr<Address>(new Address(5, "street4", "city4"))); objectArray->push_back( std::shared_ptr<Address>(new Address(6, "street5", "city5"))); - objectArray->push_back(std::shared_ptr<Address>(new Address(7, "street6", "city6"))); - objectArray->push_back(std::shared_ptr<Address>(new Address(8, "street7", "city7"))); - objectArray->push_back(std::shared_ptr<Address>(new Address(9, "street8", "city8"))); - objectArray->push_back(std::shared_ptr<Address>(new Address(10, "street9", "city9"))); + objectArray->push_back( + std::shared_ptr<Address>(new Address(7, "street6", "city6"))); + objectArray->push_back( + std::shared_ptr<Address>(new Address(8, "street7", "city7"))); + objectArray->push_back( + std::shared_ptr<Address>(new Address(9, "street8", "city8"))); + objectArray->push_back( + std::shared_ptr<Address>(new Address(10, "street9", "city9"))); // PUT Operation rptr->put(CacheableInt32::create(100), objectArray); @@ -298,7 +307,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField) LOG("verifyPdxIdentityField started "); try { - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); serializationRegistry->addPdxType(SerializePdx::createDeserializable); LOG("SerializePdx Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { @@ -357,7 +368,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField) ASSERT(pi->hasField("i3") == false, "There is no field i3 in SerializePdx1's PdxInstance stream"); - std::shared_ptr<CacheableKey> javaPdxHCKey = CacheableKey::create("javaPdxHC"); + std::shared_ptr<CacheableKey> javaPdxHCKey = + CacheableKey::create("javaPdxHC"); auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey)); LOG("javaPdxHCKey get done"); CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get()); @@ -417,7 +429,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyCacheableObjectArrayWithPdxField) LOG("verifyCacheableObjectArrayWithPdxField started "); try { - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); serializationRegistry->addPdxType(Address::createDeserializable); LOG("Address Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { @@ -492,7 +506,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxNullIdentityFieldHC) rptr->get(CacheableInt32::create(2))); LOG("PdxInstancePtr get complete"); - std::shared_ptr<CacheableKey> javaPdxHCKey = CacheableKey::create("javaPdxHC"); + std::shared_ptr<CacheableKey> javaPdxHCKey = + CacheableKey::create("javaPdxHC"); auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey)); LOG("javaPdxHCKey get done"); CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get()); @@ -531,7 +546,9 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, pdxPut) { LOG("pdxPut started "); - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); try { serializationRegistry->addPdxType( PdxTests::PdxType::createDeserializable); @@ -543,9 +560,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut) // Creating object of type PdxObject auto pdxobj = std::make_shared<PdxTests::PdxType>(); - auto keyport = CacheableKey::create("pdxput"); - auto keyport1 = CacheableKey::create("pdxput2"); - auto rptr = getHelper()->getRegion(regionNames[0]); + auto keyport = CacheableKey::create("pdxput"); + auto keyport1 = CacheableKey::create("pdxput2"); + auto rptr = getHelper()->getRegion(regionNames[0]); // PUT Operation rptr->put(keyport, pdxobj); @@ -615,9 +632,12 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT2, getObject) { LOG("getObject started "); - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); try { - serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable); + serializationRegistry->addPdxType( + PdxTests::PdxType::createDeserializable); LOG("PdxObject Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { LOG("PdxObject IllegalStateException"); @@ -747,8 +767,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxInstanceEquals) LOG("Task verifyPdxInstanceEquals started."); try { - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); - serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); + serializationRegistry->addPdxType( + PdxTests::PdxType::createDeserializable); LOG("PdxObject Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { LOG("PdxObject IllegalStateException"); @@ -810,9 +833,12 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) { LOG("accessPdxInstance started "); - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); try { - serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable); + serializationRegistry->addPdxType( + PdxTests::PdxType::createDeserializable); LOG("PdxObject Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { LOG("PdxObject IllegalStateException"); @@ -936,7 +962,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) "Type Value BYTE_ARRAY Mismatch"); auto boolArray = pIPtr->getBooleanArrayField("m_boolArray"); - int32_t boolArrayLength = boolArray.size(); + auto boolArrayLength = boolArray.size(); ASSERT(genericValCompare(pdxobjPtr->getBoolArrayLength(), boolArrayLength) == true, "boolArrayLength should be equal"); @@ -947,7 +973,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) "Type Value BOOLEAN_ARRAY Mismatch"); auto shortArray = pIPtr->getShortArrayField("m_int16Array"); - int32_t shortArrayLength = shortArray.size(); + auto shortArrayLength = shortArray.size(); ASSERT(genericValCompare(pdxobjPtr->getShortArrayLength(), shortArrayLength) == true, "shortArrayLength should be equal"); @@ -969,7 +995,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) "Type Value SHORT_ARRAY Mismatch"); auto intArray = pIPtr->getIntArrayField("m_int32Array"); - int32_t intArrayLength = intArray.size(); + auto intArrayLength = intArray.size(); ASSERT(genericValCompare(pdxobjPtr->getIntArrayLength(), intArrayLength) == true, "intArrayLength should be equal"); @@ -990,7 +1016,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) "Type Value INT_ARRAY Mismatch"); auto longArray = pIPtr->getLongArrayField("m_longArray"); - int32_t longArrayLength = longArray.size(); + auto longArrayLength = longArray.size(); ASSERT(genericValCompare(pdxobjPtr->getLongArrayLength(), longArrayLength) == true, "longArrayLength should be equal"); @@ -1012,7 +1038,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) "Type Value LONG_ARRAY Mismatch"); auto doubleArray = pIPtr->getDoubleArrayField("m_doubleArray"); - int32_t doubleArrayLength = doubleArray.size(); + auto doubleArrayLength = doubleArray.size(); ASSERT(genericValCompare(pdxobjPtr->getDoubleArrayLength(), doubleArrayLength) == true, "doubleArrayLength should be equal"); @@ -1023,7 +1049,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance) "Type Value DOUBLE_ARRAY Mismatch"); auto floatArray = pIPtr->getFloatArrayField("m_floatArray"); - int32_t floatArrayLength = floatArray.size(); + auto floatArrayLength = floatArray.size(); ASSERT(genericValCompare(pdxobjPtr->getFloatArrayLength(), floatArrayLength) == true, "floatArrayLength should be equal"); @@ -1375,9 +1401,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance) "IllegalStateException"); } - - std::vector<bool> setBoolArray{true, false, true, false, true, true, false, true}; - int arrayLen = setBoolArray.size(); + std::vector<bool> setBoolArray{true, false, true, false, + true, true, false, true}; + auto arrayLen = setBoolArray.size(); wpiPtr->setField("m_boolArray", setBoolArray); rptr->put(keyport, wpiPtr); newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport)); @@ -1812,7 +1838,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance) wpiPtr = pIPtr->createWriter(); try { - wpiPtr->setField("m_byteByteArray", (std::shared_ptr<Cacheable>)linkedhashset); + wpiPtr->setField("m_byteByteArray", + (std::shared_ptr<Cacheable>)linkedhashset); FAIL( "setField on m_byteByteArray with linkedhashset value should throw " "expected IllegalStateException"); @@ -1956,8 +1983,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally) ASSERT((*pIPtr.get() == *newPiPtr.get()) == false, "PdxInstance should not be equal"); - std::vector<bool> setBoolArray{true, false, true, false, true, true, false, true}; - int arrayLen = setBoolArray.size(); + std::vector<bool> setBoolArray{true, false, true, false, + true, true, false, true}; + auto arrayLen = setBoolArray.size(); wpiPtr->setField("m_boolArray", setBoolArray); rptr->put(keyport, wpiPtr); newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport)); @@ -2194,7 +2222,6 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally) ASSERT((*pIPtr.get() == *newPiPtr.get()) == false, "PdxInstance should not be equal"); - LOG("modifyPdxInstanceAndCheckLocally complete."); } END_TASK_DEFINITION @@ -2202,7 +2229,9 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest) { LOG("pdxIFPutGetTest started "); - auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry(); + auto serializationRegistry = + CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get()) + ->getSerializationRegistry(); try { serializationRegistry->addPdxType(Address::createDeserializable); LOG("Address Registered Successfully...."); @@ -2211,7 +2240,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest) } try { - serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable); + serializationRegistry->addPdxType( + PdxTests::PdxType::createDeserializable); LOG("PdxObject Registered Successfully...."); } catch (apache::geode::client::IllegalStateException& /* ex*/) { LOG("PdxObject IllegalStateException"); @@ -2443,9 +2473,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest) "Pdxhashcode hashcode not matched with java pdx hash code."); auto pp = std::make_shared<ParentPdx>(10); - auto if2 = - cacheHelper->getCache()->createPdxInstanceFactory( - "testobject::ParentPdx"); + auto if2 = cacheHelper->getCache()->createPdxInstanceFactory( + "testobject::ParentPdx"); if2->writeInt("m_parentId", pp->getParentId()); if2->writeObject("m_enum", pp->getEnum()); if2->writeString("m_parentName", pp->getParentName()); diff --git a/cppcache/integration-test/testThinClientPoolLocator.cpp b/cppcache/integration-test/testThinClientPoolLocator.cpp index 018093a..f0901bf 100644 --- a/cppcache/integration-test/testThinClientPoolLocator.cpp +++ b/cppcache/integration-test/testThinClientPoolLocator.cpp @@ -36,7 +36,7 @@ DUNIT_TASK(CLIENT1, SetupClient1_NoLocators_At_Init) try { createEntry(regionNames[0], keys[0], vals[0]); - } catch (NoAvailableLocatorsException& ex) { + } catch (NoAvailableLocatorsException&) { LOG("Caught expected exception."); } catch (...) { FAIL("NoAvailableLocatorsException was not thrown."); diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp index 001aa4e..e59d876 100644 --- a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp +++ b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp @@ -171,10 +171,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure) kst->start(); } - int resultsize = results->size(); + auto resultsize = results->size(); if (i % 100 == 0) { - printf("Iteration upto %d done, result size is %d\n", i, resultsize); + printf("Iteration upto %d done, result size is %zd\n", i, resultsize); } if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2 @@ -188,8 +188,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure) kst->stop(); } catch (IllegalStateException& ise) { char isemsg[500] = {0}; - ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", - ise.what()); + ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what()); LOG(isemsg); FAIL(isemsg); } catch (Exception& excp) { diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp index 6a4f034..6045f33 100644 --- a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp +++ b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp @@ -167,10 +167,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure) kst->start(); } - int resultsize = results->size(); + auto resultsize = results->size(); if (i % 100 == 0) { - printf("Iteration upto %d done, result size is %d\n", i, resultsize); + printf("Iteration upto %d done, result size is %zd\n", i, resultsize); } if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2 @@ -184,8 +184,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure) kst->stop(); } catch (IllegalStateException& ise) { char isemsg[500] = {0}; - ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", - ise.what()); + ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what()); LOG(isemsg); FAIL(isemsg); } catch (Exception& excp) { diff --git a/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp b/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp index 2a50337..dd8af43 100644 --- a/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp +++ b/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp @@ -36,10 +36,10 @@ END_TASK_DEFINITION DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer) { CacheHelper::initServer( - 1, "cacheserver_notify_subscription2.xml", - CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1), - "--J=-Dsecurity-manager=javaobject.SimpleSecurityManager", - false, true, false, false, false, true); + 1, "cacheserver_notify_subscription2.xml", + CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1), + "--J=-Dsecurity-manager=javaobject.SimpleSecurityManager", false, true, + false, false, false, true); LOG("Server started"); } END_TASK_DEFINITION @@ -60,18 +60,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, PerformSecureOperationsWithUserCredentials) config1->insert("security-username", "root"); config1->insert("security-password", "root-password"); - cache.createAuthenticatedView(config1, "mypool")->getRegion("DistRegionAck") - ->put("akey", "avalue"); + cache.createAuthenticatedView(config1, "mypool") + ->getRegion("DistRegionAck") + ->put("akey", "avalue"); auto config2 = Properties::create(); config2->insert("security-username", "reader"); config2->insert("security-password", "reader-password"); try { - cache.createAuthenticatedView(config2, "mypool")->getRegion("DistRegionAck") - ->put("akey", "avalue"); + cache.createAuthenticatedView(config2, "mypool") + ->getRegion("DistRegionAck") + ->put("akey", "avalue"); FAIL("Didn't throw expected AuthenticationFailedException."); - } catch (const apache::geode::client::NotAuthorizedException& other) { + } catch (const apache::geode::client::NotAuthorizedException&) { LOG("Caught expected AuthenticationFailedException."); } } @@ -93,10 +95,10 @@ END_TASK_DEFINITION DUNIT_MAIN { - CALL_TASK(CreateLocator); - CALL_TASK(CreateServer); - CALL_TASK(PerformSecureOperationsWithUserCredentials); - CALL_TASK(CloseServer); - CALL_TASK(CloseLocator); + CALL_TASK(CreateLocator); + CALL_TASK(CreateServer); + CALL_TASK(PerformSecureOperationsWithUserCredentials); + CALL_TASK(CloseServer); + CALL_TASK(CloseLocator); } END_MAIN diff --git a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp index b436a2b..89c3df5 100644 --- a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp +++ b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp @@ -38,8 +38,8 @@ int testXmlCacheCreationWithOverflow() { std::cout << "create DistributedSytem with name=" << host_name << std::endl; std::cout << "Create cache with the configurations provided in " - "valid_overflowAttr.xml" - << std::endl; + "valid_overflowAttr.xml" + << std::endl; try { std::string filePath = directory + "/resources/non-existent.xml"; @@ -93,9 +93,10 @@ int testXmlCacheCreationWithOverflow() { } auto regPtr1 = vrp.at(0); - std::cout << "Test if the number of sub regions with the root region Root1 are " - "correct" - << std::endl; + std::cout + << "Test if the number of sub regions with the root region Root1 are " + "correct" + << std::endl; std::vector<std::shared_ptr<Region>> vr = regPtr1->subregions(true); std::cout << " vr.size=" << vr.size() << std::endl; if (vr.size() != totalSubRegionsRoot1) { @@ -104,7 +105,7 @@ int testXmlCacheCreationWithOverflow() { } std::cout << "get subregions from the root region :" << vrp.at(0)->getName() - << std::endl; + << std::endl; for (int32_t i = 0; i < vr.size(); i++) { std::cout << "vc[" << i << "].m_reaPtr=" << vr.at(i).get() << std::endl; std::cout << "vc[" << i << "]=" << vr.at(i)->getName() << std::endl; @@ -118,13 +119,15 @@ int testXmlCacheCreationWithOverflow() { auto&& parentName = regPtr->getParentRegion()->getName(); if (childName == "SubSubRegion221") { if (parentName != "SubRegion22") { - std::cout << "Incorrect parent: tree structure not formed correctly" << std::endl; + std::cout << "Incorrect parent: tree structure not formed correctly" + << std::endl; return -1; } } } - std::cout << "****Correct region tree structure created from valid_cache.xml****" - << std::endl; + std::cout + << "****Correct region tree structure created from valid_cache.xml****" + << std::endl; vr.clear(); vrp.clear(); @@ -154,7 +157,7 @@ int testXmlCacheCreationWithOverflow() { if (initialCapacity != 25) { return -1; } - int regionIdleTO = regionAttributes.getRegionIdleTimeout().count(); + auto regionIdleTO = regionAttributes.getRegionIdleTimeout().count(); std::cout << "RegionIdleTimeout:20 " << std::endl; if (regionIdleTO != 20) { return -1; @@ -172,8 +175,10 @@ int testXmlCacheCreationWithOverflow() { return -1; } - std::cout << "persistence library = " << regionAttributes.getPersistenceLibrary() << std::endl; - std::cout << "persistence function = " << regionAttributes.getPersistenceFactory() << std::endl; + std::cout << "persistence library = " + << regionAttributes.getPersistenceLibrary() << std::endl; + std::cout << "persistence function = " + << regionAttributes.getPersistenceFactory() << std::endl; auto pconfig = regionAttributes.getPersistenceProperties(); if (pconfig != nullptr) { std::cout << " persistence property is not null" << std::endl; @@ -188,8 +193,10 @@ int testXmlCacheCreationWithOverflow() { std::cout << "****Attributes of Root1 are correctly set****" << std::endl; auto regionAttributes2 = regPtr2->getAttributes(); - std::cout << "persistence library = " << regionAttributes2.getPersistenceLibrary() << std::endl; - std::cout << "persistence function = " << regionAttributes2.getPersistenceFactory() << std::endl; + std::cout << "persistence library = " + << regionAttributes2.getPersistenceLibrary() << std::endl; + std::cout << "persistence function = " + << regionAttributes2.getPersistenceFactory() << std::endl; auto pconfig2 = regionAttributes2.getPersistenceProperties(); if (pconfig2 != nullptr) { std::cout << " persistence property is not null for Root2" << std::endl; @@ -221,11 +228,11 @@ int testXmlCacheCreationWithOverflow() { ////////////////////////////testing of cache.xml completed/////////////////// std::cout << "Create cache with the configurations provided in the " - "invalid_overflowAttr1.xml." - << std::endl; + "invalid_overflowAttr1.xml." + << std::endl; std::cout << "This is a well-formed xml....attributes not provided for " - "persistence manager. exception should be thrown" - << std::endl; + "persistence manager. exception should be thrown" + << std::endl; try { const auto filePath = directory + "/invalid_overflowAttr1.xml"; @@ -241,11 +248,12 @@ int testXmlCacheCreationWithOverflow() { ///////////////testing of invalid_cache1.xml completed/////////////////// std::cout << "Create cache with the configurations provided in the " - "invalid_overflowAttr2.xml." - << std::endl; - std::cout << " This is a well-formed xml....attribute values is not provided for " - "persistence library name......should throw an exception" - << std::endl; + "invalid_overflowAttr2.xml." + << std::endl; + std::cout + << " This is a well-formed xml....attribute values is not provided for " + "persistence library name......should throw an exception" + << std::endl; try { const auto filePath = directory + "/invalid_overflowAttr2.xml"; @@ -261,12 +269,13 @@ int testXmlCacheCreationWithOverflow() { ///////////////testing of invalid_cache2.xml completed/////////////////// std::cout << "Create cache with the configurations provided in the " - "invalid_overflowAttr3.xml." - << std::endl; + "invalid_overflowAttr3.xml." + << std::endl; - std::cout << "This is a well-formed xml....but region-attributes for persistence " - "invalid......should throw an exception" - << std::endl; + std::cout + << "This is a well-formed xml....but region-attributes for persistence " + "invalid......should throw an exception" + << std::endl; try { const auto filePath = directory + "/invalid_overflowAttr3.xml"; diff --git a/tests/cpp/testobject/NonPdxType.hpp b/tests/cpp/testobject/NonPdxType.hpp index d35a901..5867a2f 100644 --- a/tests/cpp/testobject/NonPdxType.hpp +++ b/tests/cpp/testobject/NonPdxType.hpp @@ -88,7 +88,7 @@ enum pdxEnumTest { pdx1, pdx2, pdx3 }; class TESTOBJECT_EXPORT NonPdxType { public: - char m_char; + char16_t m_char; bool m_bool; int8_t m_byte; int8_t m_sbyte; // -- To stop receiving notification emails like this one, please contact jbarr...@apache.org.