geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [15/46] geode-native git commit: GEODE-2741: Remove custom shared pointer from cppcache
Date Wed, 17 May 2017 17:49:57 GMT
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
index 8eb0b07..c0a5333 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
@@ -53,42 +53,48 @@ char* FEOnRegionPrSHOP_OptimizeForWrite =
     (char*)"FEOnRegionPrSHOP_OptimizeForWrite";
 char* FETimeOut = (char*)"FunctionExecutionTimeOut";
 
-#define verifyGetResults()                                                    \
-  bool found = false;                                                         \
-  for (int j = 0; j < 34; j++) {                                              \
-    if (j % 2 == 0) continue;                                                 \
-    sprintf(buf, "VALUE--%d", j);                                             \
-    if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i))    \
-                        ->asChar()) == 0) {                                   \
-      LOGINFO(                                                                \
-          "buf = %s "                                                         \
-          "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
-          "= %s ",                                                            \
-          buf,                                                                \
-          dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());  \
-      found = true;                                                           \
-      break;                                                                  \
-    }                                                                         \
-  }                                                                           \
+#define verifyGetResults()                                                     \
+  bool found = false;                                                          \
+  for (int j = 0; j < 34; j++) {                                               \
+    if (j % 2 == 0) continue;                                                  \
+    sprintf(buf, "VALUE--%d", j);                                              \
+    if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>(                \
+                        resultList->operator[](i))                             \
+                        ->asChar()) == 0) {                                    \
+      LOGINFO(                                                                 \
+          "buf = %s "                                                          \
+          "std::dynamic_pointer_cast<CacheableString>(resultList->operator[](" \
+          "i))->asChar() "                                                     \
+          "= %s ",                                                             \
+          buf, std::dynamic_pointer_cast<CacheableString>(                     \
+                   resultList->operator[](i))                                  \
+                   ->asChar());                                                \
+      found = true;                                                            \
+      break;                                                                   \
+    }                                                                          \
+  }                                                                            \
   ASSERT(found, "this returned value is invalid");
 
-#define verifyGetKeyResults()                                                 \
-  bool found = false;                                                         \
-  for (int j = 0; j < 34; j++) {                                              \
-    if (j % 2 == 0) continue;                                                 \
-    sprintf(buf, "KEY--%d", j);                                               \
-    if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i))    \
-                        ->asChar()) == 0) {                                   \
-      LOGINFO(                                                                \
-          "buf = %s "                                                         \
-          "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
-          "= %s ",                                                            \
-          buf,                                                                \
-          dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());  \
-      found = true;                                                           \
-      break;                                                                  \
-    }                                                                         \
-  }                                                                           \
+#define verifyGetKeyResults()                                                  \
+  bool found = false;                                                          \
+  for (int j = 0; j < 34; j++) {                                               \
+    if (j % 2 == 0) continue;                                                  \
+    sprintf(buf, "KEY--%d", j);                                                \
+    if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>(                \
+                        resultList->operator[](i))                             \
+                        ->asChar()) == 0) {                                    \
+      LOGINFO(                                                                 \
+          "buf = %s "                                                          \
+          "std::dynamic_pointer_cast<CacheableString>(resultList->operator[](" \
+          "i))->asChar() "                                                     \
+          "= %s ",                                                             \
+          buf, std::dynamic_pointer_cast<CacheableString>(                     \
+                   resultList->operator[](i))                                  \
+                   ->asChar());                                                \
+      found = true;                                                            \
+      break;                                                                   \
+    }                                                                          \
+  }                                                                            \
   ASSERT(found, "this returned KEY is invalid");
 
 #define verifyPutResults()                   \
@@ -128,18 +134,18 @@ class MyResultCollector : public ResultCollector {
 
   void addResult(CacheablePtr& resultItem) {
     m_addResultCount++;
-    if (resultItem == NULLPTR) {
+    if (resultItem == nullptr) {
       return;
     }
-    try {
-      CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+    if (auto result =
+            std::dynamic_pointer_cast<CacheableArrayList>(resultItem)) {
       for (int32_t i = 0; i < result->size(); i++) {
         m_resultList->push_back(result->operator[](i));
       }
-    } catch (ClassCastException) {
-      UserFunctionExecutionExceptionPtr result =
-          dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
-      m_resultList->push_back(result);
+    } else {
+      auto ex =
+          std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
+      m_resultList->push_back(ex);
     }
   }
   void endResults() {
@@ -157,7 +163,50 @@ class MyResultCollector : public ResultCollector {
   uint32_t m_addResultCount;
   uint32_t m_getResultCount;
 };
-typedef SharedPtr<MyResultCollector> MyResultCollectorPtr;
+_GF_PTR_DEF_(MyResultCollector, MyResultCollectorPtr)
+
+template <class _T>
+bool validateResultTypeAndAllowUserFunctionExecutionException(
+    const int32_t index, const CacheablePtr& result) {
+  if (auto intValue = std::dynamic_pointer_cast<_T>(result)) {
+    LOGINFO("%s is %d ", typeid(_T).name(), intValue->value());
+    return true;
+  } else {
+    if (auto uFEPtr =
+            std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
+      LOGINFO("Done casting to uFEPtr");
+      LOGINFO("Read expected uFEPtr exception %s ",
+              uFEPtr->getMessage()->asChar());
+      return true;
+    } else {
+      LOGINFO("Unexpected result type %s for index %d.",
+              result->toString()->asChar(), index);
+    }
+  }
+
+  return false;
+}
+
+bool validateResultTypeIsUserFunctionExecutionException(
+    const int32_t index, const CacheablePtr& result) {
+  if (auto uFEPtr =
+          std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
+    LOGINFO("Done casting to uFEPtr");
+    LOGINFO("Read expected uFEPtr exception %s ",
+            uFEPtr->getMessage()->asChar());
+    return true;
+  } else {
+    LOGINFO("Unexpected result type %s for index %d.",
+            result->toString()->asChar(), index);
+  }
+
+  return false;
+}
+
+template <class _T>
+bool validateResultType(const int32_t index, const CacheablePtr& result) {
+  return false;
+}
 
 DUNIT_TASK_DEFINITION(LOCATOR1, StartLocator1)
   {
@@ -184,16 +233,11 @@ END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
   {
-    // initClient(true);
-    initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
+    initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
                        -1, -1, 60000, /*singlehop*/ true,
                        /*threadLocal*/ true);
-    // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
-    // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
 
-    RegionPtr regPtr0 =
-        createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
-    ;  // getHelper()->createRegion( poolRegNames[0], USE_ACK);
+    auto regPtr0 = createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
     regPtr0->registerAllKeys();
 
     LOG("Clnt1Init complete.");
@@ -202,65 +246,53 @@ END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
   {
-    RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+    auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
     char buf[128];
 
     for (int i = 0; i < 34; i++) {
       sprintf(buf, "VALUE--%d", i);
-      CacheablePtr value(CacheableString::create(buf));
+      auto value = CacheableString::create(buf);
 
       sprintf(buf, "KEY--%d", i);
-      CacheableKeyPtr key = CacheableKey::create(buf);
+      auto key = CacheableKey::create(buf);
       regPtr0->put(key, value);
     }
     SLEEP(10000);  // let the put finish
     try {
       CacheablePtr args = CacheableBoolean::create(1);
       bool getResult = true;
-      CacheableVectorPtr routingObj = CacheableVector::create();
+      auto routingObj = CacheableVector::create();
       for (int i = 0; i < 34; i++) {
         if (i % 2 == 0) continue;
         sprintf(buf, "KEY--%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         routingObj->push_back(key);
       }
 
       // test data dependant function
       //     test get function with result
-      ExecutionPtr exc = FunctionService::onRegion(regPtr0);
-      ASSERT(exc != NULLPTR, "onRegion Returned NULL");
+      auto exc = FunctionService::onRegion(regPtr0);
+      ASSERT(exc != nullptr, "onRegion Returned NULL");
       args = CacheableKey::create("echoString");
       CacheablePtr args1 = CacheableKey::create("echoBoolean");
-      ExecutionPtr exe1 = exc->withArgs(args);
-      ExecutionPtr exe2 = exe1->withArgs(args1);
+      auto exe1 = exc->withArgs(args);
+      auto exe2 = exe1->withArgs(args1);
 
-      CacheableVectorPtr resultList = CacheableVector::create();
-      CacheableVectorPtr executeFunctionResult =
-          exe1->execute(rjFuncName, 15)->getResult();
-      if (executeFunctionResult == NULLPTR) {
+      auto resultList = CacheableVector::create();
+      auto executeFunctionResult = exe1->execute(rjFuncName, 15)->getResult();
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "echo String : executeFunctionResult is NULL");
       } else {
         sprintf(buf, "echo String : result count = %d",
                 executeFunctionResult->size());
         LOG(buf);
-        try {
-          CacheableStringPtr csp =
-              dynCast<CacheableStringPtr>(executeFunctionResult->operator[](0));
+        if (auto csp = std::dynamic_pointer_cast<CacheableString>(
+                executeFunctionResult->operator[](0))) {
           sprintf(buf, "echo String : cast successful, echoed string= %s",
                   csp->asChar());
           LOG(buf);
-        } catch (ClassCastException& ex) {
-          std::string logmsg = "";
-          logmsg += ex.getName();
-          logmsg += ": ";
-          logmsg += ex.getMessage();
-          LOG(logmsg.c_str());
-          ex.printStackTrace();
-          LOG("cast to string failed, now cast to boolean:");
-          bool b ATTR_UNUSED =
-              dynCast<CacheableBooleanPtr>(executeFunctionResult->operator[](0))
-                  ->value();
-          ASSERT(false, "echo String : wrong argument type");
+        } else {
+          FAIL("echo String : wrong argument type");
         }
       }
       executeFunctionResult = exc->withFilter(routingObj)
@@ -272,15 +304,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                                   ->withArgs(args)
                                   ->execute(rjFuncName, 15)
                                   ->getResult();
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "echo String : executeFunctionResult is NULL");
       } else {
         sprintf(buf, "echo String : result count = %d",
                 executeFunctionResult->size());
         LOG(buf);
-        const char* str =
-            dynCast<CacheableStringPtr>(executeFunctionResult->operator[](0))
-                ->asChar();
+        const char* str = std::dynamic_pointer_cast<CacheableString>(
+                              executeFunctionResult->operator[](0))
+                              ->asChar();
         LOG(str);
         ASSERT(strcmp("echoString", str) == 0, "echoString is not eched back");
       }
@@ -289,15 +321,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                                   ->withArgs(args)
                                   ->execute(rjFuncName, 15)
                                   ->getResult();
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "echo Boolean: executeFunctionResult is NULL");
       } else {
         sprintf(buf, "echo Boolean: result count = %d",
                 executeFunctionResult->size());
         LOG(buf);
-        bool b =
-            dynCast<CacheableBooleanPtr>(executeFunctionResult->operator[](0))
-                ->value();
+        bool b = std::dynamic_pointer_cast<CacheableBoolean>(
+                     executeFunctionResult->operator[](0))
+                     ->value();
         LOG(b == true ? "true" : "false");
         ASSERT(b == true, "true is not eched back");
       }
@@ -309,20 +341,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       /****
        **decomposed from above long expression:
       exc =  exc->withFilter(routingObj);
-      ASSERT(exc!=NULLPTR, "withFilter Returned NULL");
+      ASSERT(exc!=nullptr, "withFilter Returned NULL");
       exc = exc->withArgs(args);
-      ASSERT(exc!=NULLPTR, "withArgs Returned NULL");
+      ASSERT(exc!=nullptr, "withArgs Returned NULL");
       ResultCollectorPtr rc = exc->execute(getFuncName, getResult);
-      ASSERT(rc!=NULLPTR, "execute Returned NULL");
+      ASSERT(rc!=nullptr, "execute Returned NULL");
       CacheableVectorPtr executeFunctionResult = rc->getResult();
       */
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "region get: executeFunctionResult is NULL");
       } else {
         for (unsigned item = 0;
              item < static_cast<uint32_t>(executeFunctionResult->size());
              item++) {
-          CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+          auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
               executeFunctionResult->operator[](item));
           for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
                pos++) {
@@ -334,18 +366,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         ASSERT(resultList->size() == 34,
                "region get: resultList count is not 34");
         for (int32_t i = 0; i < resultList->size(); i++) {
-          CacheableStringPtr csPtr =
-              dynCast<CacheableStringPtr>(resultList->operator[](i));
+          auto csPtr = std::dynamic_pointer_cast<CacheableString>(
+              resultList->operator[](i));
           //  printf(" in csPtr = %u \n",csPtr);
-          if (csPtr != NULLPTR) {
+          if (csPtr != nullptr) {
             sprintf(buf, "Region get: result[%d]=%s", i,
-                    dynCast<CacheableStringPtr>(resultList->operator[](i))
+                    std::dynamic_pointer_cast<CacheableString>(
+                        resultList->operator[](i))
                         ->asChar());
             LOG(buf);
             verifyGetResults()
           } else {
             CacheablePtr tmp = resultList->operator[](i);
-            if (tmp != NULLPTR) {
+            if (tmp != nullptr) {
               printf(" in typeid = %d  \n", tmp->typeId());
 
             } else {
@@ -355,7 +388,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         }
       }
       //     test get function with customer collector
-      MyResultCollectorPtr myRC(new MyResultCollector());
+      auto myRC = std::make_shared<MyResultCollector>();
       executeFunctionResult = exc->withFilter(routingObj)
                                   ->withArgs(args)
                                   ->withCollector(myRC)
@@ -367,7 +400,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       LOG(buf);
       sprintf(buf, "get result count = %d", myRC->getGetResultCount());
       LOG(buf);
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false,
                "region get new collector: executeFunctionResult is NULL");
       } else {
@@ -387,25 +420,24 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
             executeFunctionResult->size() == resultList->size(),
             "region get new collector: executeFunctionResult count is not 34");
         for (int32_t i = 0; i < executeFunctionResult->size(); i++) {
-          sprintf(
-              buf, "Region get new collector: result[%d]=%s", i,
-              dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+          sprintf(buf, "Region get new collector: result[%d]=%s", i,
+                  std::dynamic_pointer_cast<CacheableString>(
+                      resultList->operator[](i))
+                      ->asChar());
           LOG(buf);
           verifyGetResults()
         }
       }
-      LOG("Done.................");
       //     test put function without result
       getResult = false;
       exc->withFilter(routingObj)->withArgs(args)->execute(putFuncName, 15);
-      LOG("Done.................2");
       SLEEP(10000);  // let the put finish
       for (int i = 0; i < 34; i++) {
         if (i % 2 == 0) continue;
         sprintf(buf, "KEY--%d", i);
         CacheableKeyPtr key = CacheableKey::create(buf);
-        CacheableStringPtr value =
-            dynCast<CacheableStringPtr>(regPtr0->get(key));
+        auto value =
+            std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
         sprintf(buf, "Region put: result[%d]=%s", i, value->asChar());
         LOG(buf);
         verifyPutResults()
@@ -418,7 +450,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                                   ->execute(getFuncName, 15)
                                   ->getResult();
 
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "get executeFunctionResult is NULL");
       } else {
         sprintf(buf, "echo String : result count = %d",
@@ -429,7 +461,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         for (unsigned item = 0;
              item < static_cast<uint32_t>(executeFunctionResult->size());
              item++) {
-          CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+          auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
               executeFunctionResult->operator[](item));
           for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
                pos++) {
@@ -442,10 +474,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                "get executeFunctionResult count is not 34");
         for (int32_t i = 0; i < resultList->size(); i++) {
           sprintf(buf, "result[%d] is null\n", i);
-          ASSERT(resultList->operator[](i) != NULLPTR, buf);
-          sprintf(
-              buf, "get result[%d]=%s", i,
-              dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+          ASSERT(resultList->operator[](i) != nullptr, buf);
+          sprintf(buf, "get result[%d]=%s", i,
+                  std::dynamic_pointer_cast<CacheableString>(
+                      resultList->operator[](i))
+                      ->asChar());
           LOGINFO(buf);
           verifyGetKeyResults()
         }
@@ -454,26 +487,26 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       //-----------------------Test with sendException
       // onRegion-------------------------------//
       for (int i = 1; i <= 200; i++) {
-        CacheablePtr value(CacheableInt32::create(i));
+        auto value = CacheableInt32::create(i);
 
         sprintf(buf, "execKey-%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         regPtr0->put(key, value);
       }
       LOG("Put for execKey's on region complete.");
 
       LOG("Adding filter");
-      CacheableArrayListPtr arrList = CacheableArrayList::create();
+      auto arrList = CacheableArrayList::create();
       for (int i = 100; i < 120; i++) {
         sprintf(buf, "execKey-%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         arrList->push_back(key);
       }
 
-      CacheableVectorPtr filter = CacheableVector::create();
+      auto filter = CacheableVector::create();
       for (int i = 100; i < 120; i++) {
         sprintf(buf, "execKey-%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         filter->push_back(key);
       }
       LOG("Adding filter done.");
@@ -481,51 +514,30 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       args = CacheableBoolean::create(1);
       getResult = true;
 
-      ExecutionPtr funcExec = FunctionService::onRegion(regPtr0);
-      ASSERT(funcExec != NULLPTR, "onRegion Returned NULL");
+      auto funcExec = FunctionService::onRegion(regPtr0);
+      ASSERT(funcExec != nullptr, "onRegion Returned NULL");
 
-      ResultCollectorPtr collector =
-          funcExec->withArgs(args)->withFilter(filter)->execute(
-              exFuncNameSendException, 15);
-      ASSERT(collector != NULLPTR, "onRegion collector NULL");
+      auto collector = funcExec->withArgs(args)->withFilter(filter)->execute(
+          exFuncNameSendException, 15);
+      ASSERT(collector != nullptr, "onRegion collector NULL");
 
-      CacheableVectorPtr result = collector->getResult();
+      auto result = collector->getResult();
 
-      if (result == NULLPTR) {
+      if (result == nullptr) {
         ASSERT(false, "echo String : result is NULL");
       } else {
-        try {
-          for (int i = 0; i < result->size(); i++) {
-            UserFunctionExecutionExceptionPtr uFEPtr =
-                dynCast<UserFunctionExecutionExceptionPtr>(
-                    result->operator[](i));
-            ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-            LOGINFO("Done casting to uFEPtr");
-            LOGINFO("Read expected uFEPtr exception %s ",
-                    uFEPtr->getMessage()->asChar());
-          }
-        } catch (ClassCastException& ex) {
-          std::string logmsg = "";
-          logmsg += ex.getName();
-          logmsg += ": ";
-          logmsg += ex.getMessage();
-          LOG(logmsg.c_str());
-          ex.printStackTrace();
-          FAIL(
-              "exFuncNameSendException casting to string for bool arguement "
-              "exception.");
-        } catch (...) {
-          FAIL(
-              "exFuncNameSendException casting to string for bool arguement "
-              "Unknown exception.");
+        for (int i = 0; i < result->size(); i++) {
+          ASSERT(validateResultTypeIsUserFunctionExecutionException(
+                     i, result->operator[](i)),
+                 "exFuncNameSendException casting to string for bool "
+                 "arguement exception.");
         }
       }
-
       LOG("exFuncNameSendException done for bool arguement.");
 
       collector = funcExec->withArgs(arrList)->withFilter(filter)->execute(
           exFuncNameSendException, 15);
-      ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL");
+      ASSERT(collector != nullptr, "onRegion collector for arrList NULL");
 
       result = collector->getResult();
       LOGINFO("result->size() = %d & arrList->size()  = %d ", result->size(),
@@ -535,34 +547,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
           "region get: resultList count is not as arrayList count + exception");
 
       for (int i = 0; i < result->size(); i++) {
-        try {
-          CacheableInt32Ptr intValue =
-              dynCast<CacheableInt32Ptr>(result->operator[](i));
-          ASSERT(intValue != NULLPTR, "int value is NULL");
-          LOGINFO("intValue is %d ", intValue->value());
-        } catch (ClassCastException& ex) {
-          LOG("exFuncNameSendException casting to int for arrayList arguement "
-              "exception.");
-          std::string logmsg = "";
-          logmsg += ex.getName();
-          logmsg += ": ";
-          logmsg += ex.getMessage();
-          LOG(logmsg.c_str());
-          ex.printStackTrace();
-          LOG("exFuncNameSendException now casting to "
-              "UserFunctionExecutionExceptionPtr for arrayList arguement "
-              "exception.");
-          UserFunctionExecutionExceptionPtr uFEPtr =
-              dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
-          ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-          LOGINFO("Done casting to uFEPtr");
-          LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->asChar());
-        } catch (...) {
-          FAIL(
-              "exFuncNameSendException casting to string for bool arguement "
-              "Unknown exception.");
-        }
+        ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+                   CacheableInt32>(i, result->operator[](i)),
+               "Unexpected result type.");
       }
 
       LOG("exFuncNameSendException done for arrayList arguement.");
@@ -572,38 +559,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       args = CacheableString::create("Multiple");
       collector = funcExec->withArgs(args)->withFilter(filter)->execute(
           exFuncNameSendException, 15);
-      ASSERT(collector != NULLPTR, "onRegion collector for string NULL");
+      ASSERT(collector != nullptr, "onRegion collector for string NULL");
       result = collector->getResult();
       LOGINFO("result->size() for Multiple String = %d ", result->size());
       ASSERT(result->size() == 1,
              "region get: resultList count is not as string exception");
 
-      try {
-        for (int i = 0; i < result->size(); i++) {
-          LOG("exFuncNameSendException now casting to "
-              "UserFunctionExecutionExceptionPtr for arrayList arguement "
-              "exception.");
-          UserFunctionExecutionExceptionPtr uFEPtr =
-              dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
-          ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-          LOGINFO("Done casting to uFEPtr");
-          LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->asChar());
-        }
-      } catch (ClassCastException& ex) {
-        std::string logmsg = "";
-        logmsg += ex.getName();
-        logmsg += ": ";
-        logmsg += ex.getMessage();
-        LOG(logmsg.c_str());
-        ex.printStackTrace();
-        FAIL(
-            "exFuncNameSendException casting to string for string arguement "
+      for (int i = 0; i < result->size(); i++) {
+        LOG("exFuncNameSendException now casting to "
+            "UserFunctionExecutionExceptionPtr for arrayList arguement "
             "exception.");
-      } catch (...) {
-        FAIL(
-            "exFuncNameSendException casting to string for string arguement "
-            "Unknown exception.");
+        ASSERT(validateResultTypeIsUserFunctionExecutionException(
+                   i, result->operator[](i)),
+               "exFuncNameSendException casting to string for string "
+               "arguement exception.");
       }
 
       LOG("exFuncNameSendException for string arguement done.");
@@ -612,7 +581,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
           "test exFuncNameSendException function with customer collector with "
           "bool as arguement using onRegion.");
 
-      MyResultCollectorPtr myRC1(new MyResultCollector());
+      auto myRC1 = std::make_shared<MyResultCollector>();
       result = funcExec->withArgs(args)
                    ->withFilter(filter)
                    ->withCollector(myRC1)
@@ -624,7 +593,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       ASSERT(1 == myRC1->getAddResultCount(), "add result count is not 1");
       ASSERT(1 == myRC1->getEndResultCount(), "end result count is not 1");
       ASSERT(1 == myRC1->getGetResultCount(), "get result count is not 1");
-      if (result == NULLPTR) {
+      if (result == nullptr) {
         ASSERT(false, "region get new collector: result is NULL");
       } else {
         LOGINFO("Region get new collector: result count = %d", result->size());
@@ -642,10 +611,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       // restore the data set
       for (int i = 0; i < 34; i++) {
         sprintf(buf, "VALUE--%d", i);
-        CacheablePtr value(CacheableString::create(buf));
+        auto value = CacheableString::create(buf);
 
         sprintf(buf, "KEY--%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         regPtr0->put(key, value);
       }
 
@@ -654,21 +623,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       getResult = true;
       //    PoolPtr pptr = PoolManager::find(poolName);
       args = routingObj;
-      // ExecutionPtr exc=NULLPTR;
-      // CacheableVectorPtr executeFunctionResult = NULLPTR;
+      // ExecutionPtr exc=nullptr;
+      // CacheableVectorPtr executeFunctionResult = nullptr;
       // test data independant function on one server
       LOG("test data independant get function on one server");
       exc = FunctionService::onServer(getHelper()->cachePtr);
       executeFunctionResult =
           exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "get executeFunctionResult is NULL");
       } else {
         resultList->clear();
         for (unsigned item = 0;
              item < static_cast<uint32_t>(executeFunctionResult->size());
              item++) {
-          CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+          auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
               executeFunctionResult->operator[](item));
           for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
                pos++) {
@@ -681,10 +650,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                "get executeFunctionResult count is not 17");
         for (int32_t i = 0; i < resultList->size(); i++) {
           sprintf(buf, "result[%d] is null\n", i);
-          ASSERT(resultList->operator[](i) != NULLPTR, buf);
-          sprintf(
-              buf, "get result[%d]=%s", i,
-              dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+          ASSERT(resultList->operator[](i) != nullptr, buf);
+          sprintf(buf, "get result[%d]=%s", i,
+                  std::dynamic_pointer_cast<CacheableString>(
+                      resultList->operator[](i))
+                      ->asChar());
           LOG(buf);
           verifyGetResults()
         }
@@ -697,9 +667,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       for (int i = 0; i < 34; i++) {
         if (i % 2 == 0) continue;
         sprintf(buf, "KEY--%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
-        CacheableStringPtr value =
-            dynCast<CacheableStringPtr>(regPtr0->get(key));
+        auto key = CacheableKey::create(buf);
+        auto value =
+            std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
         sprintf(buf, "put: result[%d]=%s", i, value->asChar());
         LOG(buf);
         verifyPutResults()
@@ -719,40 +689,40 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         // ignore exception
       }
 
-      PdxTypes8Ptr pdxobj(new PdxTests::PdxTypes8());
+      auto pdxobj = std::make_shared<PdxTests::PdxTypes8>();
       for (int i = 0; i < 34; i++) {
         sprintf(buf, "KEY--pdx%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         regPtr0->put(key, pdxobj);
       }
       LOGINFO("put on pdxObject done");
 
-      CacheableVectorPtr pdxRoutingObj = CacheableVector::create();
+      auto pdxRoutingObj = CacheableVector::create();
       for (int i = 0; i < 34; i++) {
         if (i % 2 == 0) continue;
         sprintf(buf, "KEY--pdx%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         pdxRoutingObj->push_back(key);
       }
 
-      ExecutionPtr pdxExc = FunctionService::onServers(getHelper()->cachePtr);
-      CacheableVectorPtr executeFunctionResultPdx =
+      auto pdxExc = FunctionService::onServers(getHelper()->cachePtr);
+      auto executeFunctionResultPdx =
           pdxExc->withArgs(pdxRoutingObj)
               ->execute(exFuncNamePdxType, getResult)
               ->getResult();
       LOGINFO("FE on pdxObject done");
-      if (executeFunctionResultPdx == NULLPTR) {
+      if (executeFunctionResultPdx == nullptr) {
         ASSERT(false, "get executeFunctionResultPdx is NULL");
       } else {
         LOGINFO("executeFunctionResultPdx size for PdxObject = %d ",
                 executeFunctionResultPdx->size());
         ASSERT(2 == executeFunctionResultPdx->size(),
                "executeFunctionResultPdx->size() is not 2");
-        CacheableVectorPtr resultListPdx = CacheableVector::create();
+        auto resultListPdx = CacheableVector::create();
         for (unsigned item = 0;
              item < static_cast<uint32_t>(executeFunctionResultPdx->size());
              item++) {
-          CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+          auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
               executeFunctionResultPdx->operator[](item));
           for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
                pos++) {
@@ -762,23 +732,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         LOGINFO("resultlistPdx size: %d", resultListPdx->size());
         for (int32_t i = 0; i < resultListPdx->size(); i++) {
           sprintf(buf, "result[%d] is null\n", i);
-          ASSERT(resultListPdx->operator[](i) != NULLPTR, buf);
+          ASSERT(resultListPdx->operator[](i) != nullptr, buf);
           LOG("resultPdx item is not null");
-          LOGINFO("get result[%d]=%s", i,
-                  dynCast<PdxTypes8Ptr>(resultListPdx->operator[](i))
-                      ->toString()
-                      ->asChar());
-          PdxTypes8Ptr pdxObj2 =
-              dynCast<PdxTypes8Ptr>(resultListPdx->operator[](i));
+          LOGINFO("get result[%d]=%s", i, std::dynamic_pointer_cast<PdxTypes8>(
+                                              resultListPdx->operator[](i))
+                                              ->toString()
+                                              ->asChar());
+          auto pdxObj2 = std::dynamic_pointer_cast<PdxTypes8>(
+              resultListPdx->operator[](i));
           ASSERT(pdxobj->equals(pdxObj2) == true,
                  "Pdx Object not equals original object.");
         }
       }
       LOG("test pdx data function on all servers done");
 
-      PdxInstanceFactoryPtr pifPtr =
-          cacheHelper->getCache()->createPdxInstanceFactory(
-              "PdxTests.PdxTypes8");
+      auto pifPtr = cacheHelper->getCache()->createPdxInstanceFactory(
+          "PdxTests.PdxTypes8");
       LOG("PdxInstanceFactoryPtr created....");
 
       pifPtr->writeInt("i1", 1);
@@ -788,7 +757,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       pifPtr->writeInt("i3", 3);
       pifPtr->writeInt("i4", 4);
 
-      PdxInstancePtr ret = pifPtr->create();
+      auto ret = pifPtr->create();
       LOG("PdxInstancePtr created");
 
       for (int i = 0; i < 34; i++) {
@@ -798,7 +767,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       }
       LOGINFO("put on pdxObject done");
 
-      CacheableVectorPtr pdxInstanceRoutingObj = CacheableVector::create();
+      auto pdxInstanceRoutingObj = CacheableVector::create();
       for (int i = 0; i < 34; i++) {
         if (i % 2 == 0) continue;
         sprintf(buf, "KEY--pdx%d", i);
@@ -806,26 +775,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         pdxInstanceRoutingObj->push_back(key);
       }
 
-      ExecutionPtr pdxInstanceExc =
-          FunctionService::onServers(getHelper()->cachePtr);
-      CacheableVectorPtr executeFunctionResultPdxInstance =
+      auto pdxInstanceExc = FunctionService::onServers(getHelper()->cachePtr);
+      auto executeFunctionResultPdxInstance =
           pdxInstanceExc->withArgs(pdxInstanceRoutingObj)
               ->execute(exFuncNamePdxType, getResult)
               ->getResult();
       LOGINFO("FE on pdxObject done");
-      if (executeFunctionResultPdxInstance == NULLPTR) {
+      if (executeFunctionResultPdxInstance == nullptr) {
         ASSERT(false, "get executeFunctionResultPdxInstance is NULL");
       } else {
         LOGINFO("executeFunctionResultPdxInstance size for PdxObject = %d ",
                 executeFunctionResultPdxInstance->size());
         ASSERT(2 == executeFunctionResultPdx->size(),
                "executeFunctionResultPdxInstance->size() is not 2");
-        CacheableVectorPtr resultListPdxInstance = CacheableVector::create();
+        auto resultListPdxInstance = CacheableVector::create();
         for (unsigned item = 0;
              item <
              static_cast<uint32_t>(executeFunctionResultPdxInstance->size());
              item++) {
-          CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+          auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
               executeFunctionResultPdxInstance->operator[](item));
           for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
                pos++) {
@@ -836,14 +804,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                 resultListPdxInstance->size());
         for (int32_t i = 0; i < resultListPdxInstance->size(); i++) {
           sprintf(buf, "result[%d] is null\n", i);
-          ASSERT(resultListPdxInstance->operator[](i) != NULLPTR, buf);
+          ASSERT(resultListPdxInstance->operator[](i) != nullptr, buf);
           LOG("resultPdx item is not null");
           LOGINFO("get result[%d]=%s", i,
-                  dynCast<PdxTypes8Ptr>(resultListPdxInstance->operator[](i))
+                  std::dynamic_pointer_cast<PdxTypes8>(
+                      resultListPdxInstance->operator[](i))
                       ->toString()
                       ->asChar());
-          PdxTypes8Ptr pdxObj2 =
-              dynCast<PdxTypes8Ptr>(resultListPdxInstance->operator[](i));
+          auto pdxObj2 = std::dynamic_pointer_cast<PdxTypes8>(
+              resultListPdxInstance->operator[](i));
 
           ASSERT(pdxobj->equals(pdxObj2) == true,
                  "Pdx Object not equals original object.");
@@ -857,10 +826,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       // repopulate with the original values
       for (int i = 0; i < 34; i++) {
         sprintf(buf, "VALUE--%d", i);
-        CacheablePtr value(CacheableString::create(buf));
+        auto value = CacheableString::create(buf);
 
         sprintf(buf, "KEY--%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
+        auto key = CacheableKey::create(buf);
         regPtr0->put(key, value);
       }
       SLEEP(10000);  // let the put finish
@@ -874,6 +843,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       if (isLocalServer) {
         CacheHelper::initServer(3, "func_cacheserver3_pool.xml", lhp);
       }
+      LOGINFO("Sleeping for 60s...");
       SLEEP(60000);  // let this servers gets all the data
 
       //---------------------------------------------------------------------
@@ -881,14 +851,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       exc = FunctionService::onServers(getHelper()->cachePtr);
       executeFunctionResult =
           exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
-      if (executeFunctionResult == NULLPTR) {
+      if (executeFunctionResult == nullptr) {
         ASSERT(false, "get executeFunctionResult is NULL");
       } else {
         resultList->clear();
         for (unsigned item = 0;
              item < static_cast<uint32_t>(executeFunctionResult->size());
              item++) {
-          CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+          auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
               executeFunctionResult->operator[](item));
           for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
                pos++) {
@@ -902,10 +872,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                "get executeFunctionResult on all servers count is not 51");
         for (int32_t i = 0; i < resultList->size(); i++) {
           sprintf(buf, "result[%d] is null\n", i);
-          ASSERT(resultList->operator[](i) != NULLPTR, buf);
-          sprintf(
-              buf, "get result[%d]=%s", i,
-              dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+          ASSERT(resultList->operator[](i) != nullptr, buf);
+          sprintf(buf, "get result[%d]=%s", i,
+                  std::dynamic_pointer_cast<CacheableString>(
+                      resultList->operator[](i))
+                      ->asChar());
           LOG(buf);
           verifyGetResults()
         }
@@ -919,9 +890,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       for (int i = 0; i < 34; i++) {
         if (i % 2 == 0) continue;
         sprintf(buf, "KEY--%d", i);
-        CacheableKeyPtr key = CacheableKey::create(buf);
-        CacheableStringPtr value =
-            dynCast<CacheableStringPtr>(regPtr0->get(key));
+        auto key = CacheableKey::create(buf);
+        auto value =
+            std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
         sprintf(buf, "put: result[%d]=%s", i, value->asChar());
         LOG(buf);
         verifyPutResults()
@@ -935,44 +906,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
 
       collector =
           funcExec->withArgs(args)->execute(exFuncNameSendException, 15);
-      ASSERT(collector != NULLPTR, "onServers collector for bool NULL");
+      ASSERT(collector != nullptr, "onServers collector for bool NULL");
 
       result = collector->getResult();
       ASSERT(result->size() == 3,
              "Should have got 3 exception strings for sendException.");
-      if (result == NULLPTR) {
+      if (result == nullptr) {
         ASSERT(false, "echo String : result is NULL");
       } else {
-        try {
-          for (int i = 0; i < result->size(); i++) {
-            UserFunctionExecutionExceptionPtr uFEPtr =
-                dynCast<UserFunctionExecutionExceptionPtr>(
-                    result->operator[](i));
-            ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-            LOGINFO("Done casting to uFEPtr");
-            LOGINFO("Read expected uFEPtr exception %s ",
-                    uFEPtr->getMessage()->asChar());
-          }
-        } catch (ClassCastException& ex) {
-          std::string logmsg = "";
-          logmsg += ex.getName();
-          logmsg += ": ";
-          logmsg += ex.getMessage();
-          LOG(logmsg.c_str());
-          ex.printStackTrace();
-          FAIL(
-              "exFuncNameSendException casting to string for bool arguement "
-              "exception.");
-        } catch (...) {
-          FAIL(
-              "exFuncNameSendException casting to string for bool arguement "
-              "Unknown exception.");
+        for (int i = 0; i < result->size(); i++) {
+          ASSERT(validateResultTypeIsUserFunctionExecutionException(
+                     i, result->operator[](i)),
+                 "exFuncNameSendException casting to string for bool arguement "
+                 "Unknown exception.");
         }
       }
 
       collector =
           funcExec->withArgs(arrList)->execute(exFuncNameSendException, 15);
-      ASSERT(collector != NULLPTR, "onServers collector for arrList NULL");
+      ASSERT(collector != nullptr, "onServers collector for arrList NULL");
 
       result = collector->getResult();
       ASSERT(result->size() == (arrList->size() + 1) * 3,
@@ -982,60 +934,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       LOG("Printing only string exception results for onServers with "
           "sendException");
       for (int i = 0; i < result->size(); i++) {
-        try {
-          CacheableInt32Ptr intValue =
-              dynCast<CacheableInt32Ptr>(result->operator[](i));
-          ASSERT(intValue != NULLPTR, "int value is NULL");
-          LOGINFO("intValue is %d ", intValue->value());
-        } catch (ClassCastException& ex) {
-          std::string logmsg = "";
-          logmsg += ex.getName();
-          logmsg += ": ";
-          logmsg += ex.getMessage();
-          LOG(logmsg.c_str());
-          ex.printStackTrace();
-          UserFunctionExecutionExceptionPtr uFEPtr =
-              dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
-          ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-          LOGINFO("Done casting to uFEPtr");
-          LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->asChar());
-        } catch (...) {
-          FAIL(
-              "exFuncNameSendException casting to string for arrList arguement "
-              "for onServers Unknown exception.");
-        }
+        ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+                   CacheableInt32>(i, result->operator[](i)),
+               "Unexpected result type.");
       }
 
       LOG("Printing all results for onServers with sendException");
       for (int i = 0; i < result->size(); i++) {
-        try {
-          CacheableInt32Ptr intValue =
-              dynCast<CacheableInt32Ptr>(result->operator[](i));
-          ASSERT(intValue != NULLPTR, "int value is NULL");
-          LOGINFO("intValue is %d ", intValue->value());
-        } catch (ClassCastException& ex) {
-          LOG("exFuncNameSendException casting to int for arrayList arguement "
-              "exception.");
-          std::string logmsg = "";
-          logmsg += ex.getName();
-          logmsg += ": ";
-          logmsg += ex.getMessage();
-          LOG(logmsg.c_str());
-          ex.printStackTrace();
-          LOG("exFuncNameSendException now casting to string for arrayList "
-              "arguement exception.");
-          UserFunctionExecutionExceptionPtr uFEPtr =
-              dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
-          ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-          LOGINFO("Done casting to uFEPtr");
-          LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->asChar());
-        } catch (...) {
-          FAIL(
-              "exFuncNameSendException casting to string for bool arguement "
-              "Unknown exception.");
-        }
+        ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+                   CacheableInt32>(i, result->operator[](i)),
+               "Unexpected result type.");
       }
 
       LOG("exFuncNameSendException for string arguement.");
@@ -1043,35 +951,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       args = CacheableString::create("Multiple");
       collector =
           funcExec->withArgs(args)->execute(exFuncNameSendException, 15);
-      ASSERT(collector != NULLPTR, "onServers collector for string NULL");
+      ASSERT(collector != nullptr, "onServers collector for string NULL");
 
       result = collector->getResult();
       ASSERT(result->size() == 3,
              "region get: resultList count is not as string exception");
 
-      try {
-        for (int i = 0; i < result->size(); i++) {
-          UserFunctionExecutionExceptionPtr uFEPtr =
-              dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
-          ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
-          LOGINFO("Done casting to uFEPtr");
-          LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->asChar());
-        }
-      } catch (ClassCastException& ex) {
-        std::string logmsg = "";
-        logmsg += ex.getName();
-        logmsg += ": ";
-        logmsg += ex.getMessage();
-        LOG(logmsg.c_str());
-        ex.printStackTrace();
-        FAIL(
-            "exFuncNameSendException casting to string for string arguement "
-            "exception.");
-      } catch (...) {
-        FAIL(
-            "exFuncNameSendException casting to string for string arguement "
-            "Unknown exception.");
+      for (int i = 0; i < result->size(); i++) {
+        ASSERT(validateResultTypeIsUserFunctionExecutionException(
+                   i, result->operator[](i)),
+               "exFuncNameSendException casting to string for string arguement "
+               "exception.");
       }
 
       LOG("exFuncNameSendException for string arguement done.");
@@ -1080,7 +970,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
           "test exFuncNameSendException function with customer collector with "
           "bool as arguement using onServers.");
 
-      MyResultCollectorPtr myRC2(new MyResultCollector());
+      auto myRC2 = std::make_shared<MyResultCollector>();
       result = funcExec->withArgs(args)
                    ->withCollector(myRC2)
                    ->execute(exFuncNameSendException, getResult)
@@ -1091,7 +981,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       LOGINFO("add result count = %d", myRC2->getAddResultCount());
       LOGINFO("end result count = %d", myRC2->getEndResultCount());
       LOGINFO("get result count = %d", myRC2->getGetResultCount());
-      if (result == NULLPTR) {
+      if (result == nullptr) {
         ASSERT(false, "region get new collector: result is NULL");
       } else {
         LOGINFO("Region get new collector: result count = %d", result->size());
@@ -1112,20 +1002,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       // onRegion-------------------------------//
       for (int i = 0; i < 230; i++) {
         sprintf(buf, "VALUE--%d", i);
-        CacheablePtr value(CacheableString::create(buf));
+        auto value = CacheableString::create(buf);
         regPtr0->put(i, value);
       }
       LOGINFO("Put done.");
 
       getResult = true;
       for (int i = 0; i < 230; i++) {
-        CacheableVectorPtr fil = CacheableVector::create();
+        auto fil = CacheableVector::create();
         fil->push_back(CacheableInt32::create(i));
-        ExecutionPtr exe = FunctionService::onRegion(regPtr0);
-        CacheableVectorPtr executeFunctionResult2 =
+        auto exe = FunctionService::onRegion(regPtr0);
+        auto executeFunctionResult2 =
             exe->withFilter(fil)->execute(FEOnRegionPrSHOP, 15)->getResult();
-        if (executeFunctionResult2 == NULLPTR) {
-          ASSERT(false, "executeFunctionResult2 is NULLPTR");
+        if (executeFunctionResult2 == nullptr) {
+          ASSERT(false, "executeFunctionResult2 is nullptr");
         } else {
           sprintf(buf, "executeFunctionResult2 count = %d",
                   executeFunctionResult2->size());
@@ -1133,7 +1023,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
           ASSERT(1 == executeFunctionResult2->size(),
                  "executeFunctionResult2->size() is not 1");
           for (int i = 0; i < executeFunctionResult2->size(); i++) {
-            bool b = dynCast<CacheableBooleanPtr>(
+            bool b = std::dynamic_pointer_cast<CacheableBoolean>(
                          executeFunctionResult2->operator[](i))
                          ->value();
             LOGINFO(b == true ? "true" : "false");
@@ -1143,19 +1033,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
         executeFunctionResult2->clear();
         LOGINFO("FEOnRegionPrSHOP without Filter done");
 
-        CacheableVectorPtr functionResult =
+        auto functionResult =
             exe->withFilter(fil)
                 ->execute(FEOnRegionPrSHOP_OptimizeForWrite, 15)
                 ->getResult();
-        if (functionResult == NULLPTR) {
-          ASSERT(false, "functionResult is NULLPTR");
+        if (functionResult == nullptr) {
+          ASSERT(false, "functionResult is nullptr");
         } else {
           sprintf(buf, "result count = %d", functionResult->size());
           LOGINFO(buf);
           ASSERT(1 == functionResult->size(),
                  "functionResult->size() is not 1");
           for (int i = 0; i < functionResult->size(); i++) {
-            bool b = dynCast<CacheableBooleanPtr>(functionResult->operator[](i))
+            bool b = std::dynamic_pointer_cast<CacheableBoolean>(
+                         functionResult->operator[](i))
                          ->value();
             LOGINFO(b == true ? "true" : "false");
             ASSERT(b == true, "true is not eched back");
@@ -1168,19 +1059,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
 
       //////////////////////OnRegion TimeOut ///////////////////////////
       LOGINFO("FETimeOut begin onRegion");
-      ExecutionPtr RexecutionPtr = FunctionService::onRegion(regPtr0);
-      CacheableVectorPtr fe =
-          RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
-              ->execute(FETimeOut, 5000)
-              ->getResult();
-      if (fe == NULLPTR) {
+      auto RexecutionPtr = FunctionService::onRegion(regPtr0);
+      auto fe = RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
+                    ->execute(FETimeOut, 5000)
+                    ->getResult();
+      if (fe == nullptr) {
         ASSERT(false, "functionResult is NULL");
       } else {
         sprintf(buf, "result count = %d", fe->size());
         LOG(buf);
         // ASSERT(2  == fe->size(), "FunctionResult->size() is not 2");
         for (int i = 0; i < fe->size(); i++) {
-          bool b = dynCast<CacheableBooleanPtr>(fe->operator[](i))->value();
+          bool b =
+              std::dynamic_pointer_cast<CacheableBoolean>(fe->operator[](i))
+                  ->value();
           LOG(b == true ? "true" : "false");
           ASSERT(b == true, "true is not eched back");
         }
@@ -1189,19 +1081,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       //////////////////////OnRegion TimeOut Done///////////////////////////
 
       LOGINFO("FETimeOut begin onServer");
-      ExecutionPtr serverExc = FunctionService::onServer(getHelper()->cachePtr);
-      CacheableVectorPtr vec =
-          serverExc->withArgs(CacheableInt32::create(5000 * 1000))
-              ->execute(FETimeOut, 5000)
-              ->getResult();
-      if (vec == NULLPTR) {
+      auto serverExc = FunctionService::onServer(getHelper()->cachePtr);
+      auto vec = serverExc->withArgs(CacheableInt32::create(5000 * 1000))
+                     ->execute(FETimeOut, 5000)
+                     ->getResult();
+      if (vec == nullptr) {
         ASSERT(false, "functionResult is NULL");
       } else {
         sprintf(buf, "result count = %d", vec->size());
         LOG(buf);
         ASSERT(1 == vec->size(), "FunctionResult->size() is not 1");
         for (int i = 0; i < vec->size(); i++) {
-          bool b = dynCast<CacheableBooleanPtr>(vec->operator[](i))->value();
+          bool b =
+              std::dynamic_pointer_cast<CacheableBoolean>(vec->operator[](i))
+                  ->value();
           LOG(b == true ? "true" : "false");
           ASSERT(b == true, "true is not eched back");
         }
@@ -1209,20 +1102,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
       LOGINFO("FETimeOut done onServer");
 
       LOGINFO("FETimeOut begin onServers");
-      ExecutionPtr serversExc =
-          FunctionService::onServers(getHelper()->cachePtr);
-      CacheableVectorPtr vecs =
-          serversExc->withArgs(CacheableInt32::create(5000 * 1000))
-              ->execute(FETimeOut, 5000)
-              ->getResult();
-      if (vecs == NULLPTR) {
+      auto serversExc = FunctionService::onServers(getHelper()->cachePtr);
+      auto vecs = serversExc->withArgs(CacheableInt32::create(5000 * 1000))
+                      ->execute(FETimeOut, 5000)
+                      ->getResult();
+      if (vecs == nullptr) {
         ASSERT(false, "functionResult is NULL");
       } else {
         sprintf(buf, "result count = %d", vecs->size());
         LOG(buf);
         ASSERT(3 == vecs->size(), "FunctionResult->size() is not 3");
         for (int i = 0; i < vecs->size(); i++) {
-          bool b = dynCast<CacheableBooleanPtr>(vecs->operator[](i))->value();
+          bool b =
+              std::dynamic_pointer_cast<CacheableBoolean>(vecs->operator[](i))
+                  ->value();
           LOG(b == true ? "true" : "false");
           ASSERT(b == true, "true is not eched back");
         }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
index 177da82..6220c9e 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
@@ -57,62 +57,62 @@ char* FEOnRegionPrSHOP_OptimizeForWrite =
 char* FETimeOut = (char*)"FunctionExecutionTimeOut";
 
 #define verifyGetResults()                                                    \
-    bool found = false;                                                         \
-    for (int j = 0; j < 34; j++) {                                              \
-      if (j % 2 == 0) continue;                                                 \
-      sprintf(buf, "VALUE--%d", j);                                             \
-      if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i))    \
-                 ->asChar()) == 0) {                                   \
-        LOGINFO(                                                                \
-                                                                                "buf = %s "                                                         \
-                                                                                "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
-                                                                                "= %s ",                                                            \
-                                                                                buf,                                                                \
-                                                                                dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());  \
-                                                                                found = true;                                                           \
-                                                                                break;                                                                  \
-      }                                                                         \
-    }                                                                           \
-    ASSERT(found, "this returned value is invalid");
+  bool found = false;                                                         \
+  for (int j = 0; j < 34; j++) {                                              \
+    if (j % 2 == 0) continue;                                                 \
+    sprintf(buf, "VALUE--%d", j);                                             \
+    if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i))    \
+                        ->asChar()) == 0) {                                   \
+      LOGINFO(                                                                \
+          "buf = %s "                                                         \
+          "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
+          "= %s ",                                                            \
+          buf,                                                                \
+          dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());  \
+      found = true;                                                           \
+      break;                                                                  \
+    }                                                                         \
+  }                                                                           \
+  ASSERT(found, "this returned value is invalid");
 
 #define verifyGetKeyResults()                                                 \
-    bool found = false;                                                         \
-    for (int j = 0; j < 34; j++) {                                              \
-      if (j % 2 == 0) continue;                                                 \
-      sprintf(buf, "KEY--%d", j);                                               \
-      if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i))    \
-                 ->asChar()) == 0) {                                   \
-        LOGINFO(                                                                \
-                                                                                "buf = %s "                                                         \
-                                                                                "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
-                                                                                "= %s ",                                                            \
-                                                                                buf,                                                                \
-                                                                                dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());  \
-                                                                                found = true;                                                           \
-                                                                                break;                                                                  \
-      }                                                                         \
-    }                                                                           \
-    ASSERT(found, "this returned KEY is invalid");
+  bool found = false;                                                         \
+  for (int j = 0; j < 34; j++) {                                              \
+    if (j % 2 == 0) continue;                                                 \
+    sprintf(buf, "KEY--%d", j);                                               \
+    if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i))    \
+                        ->asChar()) == 0) {                                   \
+      LOGINFO(                                                                \
+          "buf = %s "                                                         \
+          "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
+          "= %s ",                                                            \
+          buf,                                                                \
+          dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());  \
+      found = true;                                                           \
+      break;                                                                  \
+    }                                                                         \
+  }                                                                           \
+  ASSERT(found, "this returned KEY is invalid");
 
 #define verifyPutResults()                   \
-    bool found = false;                        \
-    for (int j = 0; j < 34; j++) {             \
-      if (j % 2 == 0) continue;                \
-      sprintf(buf, "KEY--%d", j);              \
-      if (strcmp(buf, value->asChar()) == 0) { \
-        found = true;                          \
-        break;                                 \
-      }                                        \
-    }                                          \
-    ASSERT(found, "this returned value is invalid");
+  bool found = false;                        \
+  for (int j = 0; j < 34; j++) {             \
+    if (j % 2 == 0) continue;                \
+    sprintf(buf, "KEY--%d", j);              \
+    if (strcmp(buf, value->asChar()) == 0) { \
+      found = true;                          \
+      break;                                 \
+    }                                        \
+  }                                          \
+  ASSERT(found, "this returned value is invalid");
 class MyResultCollector : public ResultCollector {
  public:
   MyResultCollector()
- : m_resultList(CacheableVector::create()),
-   m_isResultReady(false),
-   m_endResultCount(0),
-   m_addResultCount(0),
-   m_getResultCount(0) {}
+      : m_resultList(CacheableVector::create()),
+        m_isResultReady(false),
+        m_endResultCount(0),
+        m_addResultCount(0),
+        m_getResultCount(0) {}
   ~MyResultCollector() {}
   CacheableVectorPtr getResult(uint32_t timeout) {
     m_getResultCount++;
@@ -131,18 +131,18 @@ class MyResultCollector : public ResultCollector {
 
   void addResult(CacheablePtr& resultItem) {
     m_addResultCount++;
-    if (resultItem == NULLPTR) {
+    if (resultItem == nullptr) {
       return;
     }
-    try {
-      CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+    if (auto result =
+            std::dynamic_pointer_cast<CacheableArrayList>(resultItem)) {
       for (int32_t i = 0; i < result->size(); i++) {
         m_resultList->push_back(result->operator[](i));
       }
-    } catch (ClassCastException) {
-      UserFunctionExecutionExceptionPtr result =
-          dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
-      m_resultList->push_back(result);
+    } else {
+      auto ex =
+          std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
+      m_resultList->push_back(ex);
     }
   }
   void endResults() {
@@ -163,60 +163,61 @@ class MyResultCollector : public ResultCollector {
 typedef SharedPtr<MyResultCollector> MyResultCollectorPtr;
 
 DUNIT_TASK_DEFINITION(LOCATOR1, StartLocator1)
-{
-  // starting locator
-  if (isLocator) {
-    CacheHelper::initLocator(1);
-    LOG("Locator1 started");
+  {
+    // starting locator
+    if (isLocator) {
+      CacheHelper::initLocator(1);
+      LOG("Locator1 started");
+    }
   }
-}
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(SERVER, StartS12)
-{
-  const char* lhp = NULL;
-  if (!isPoolWithEndpoint) lhp = locHostPort;
-  if (isLocalServer) {
-    CacheHelper::initServer(1, "func_cacheserver1_pool.xml", lhp);
-  }
-  if (isLocalServer) {
-    CacheHelper::initServer(2, "func_cacheserver2_pool.xml", lhp);
+  {
+    const char* lhp = NULL;
+    if (!isPoolWithEndpoint) lhp = locHostPort;
+    if (isLocalServer) {
+      CacheHelper::initServer(1, "func_cacheserver1_pool.xml", lhp);
+    }
+    if (isLocalServer) {
+      CacheHelper::initServer(2, "func_cacheserver2_pool.xml", lhp);
+    }
   }
-}
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
-{
-  // initClient(true);
-  initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
-                     -1, -1, 60000, /*singlehop*/ true,
-                     /*threadLocal*/ true);
-  // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
-  // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
-
-  RegionPtr regPtr0 =
-      createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
-  ;  // getHelper()->createRegion( poolRegNames[0], USE_ACK);
-  regPtr0->registerAllKeys();
-
-  LOG("Clnt1Init complete.");
-}
+  {
+    // initClient(true);
+    initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
+                       -1, -1, 60000, /*singlehop*/ true,
+                       /*threadLocal*/ true);
+    // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
+    // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
+
+    RegionPtr regPtr0 =
+        createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
+    ;  // getHelper()->createRegion( poolRegNames[0], USE_ACK);
+    regPtr0->registerAllKeys();
+
+    LOG("Clnt1Init complete.");
+  }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
-{
-  RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
-  char buf[128];
+  {
+    RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+    char buf[128];
 
-  for (int i = 0; i < 34; i++) {
-    sprintf(buf, "VALUE--%d", i);
-    CacheablePtr value(CacheableString::create(buf));
+    for (int i = 0; i < 34; i++) {
+      sprintf(buf, "VALUE--%d", i);
+      CacheablePtr value(CacheableString::create(buf));
 
-    sprintf(buf, "KEY--%d", i);
-    CacheableKeyPtr key = CacheableKey::create(buf);
-    regPtr0->put(key, value);
-  }
-  std::this_thread::sleep_for(std::chrono::seconds(10)); // let the put finish
+      sprintf(buf, "KEY--%d", i);
+      CacheableKeyPtr key = CacheableKey::create(buf);
+      regPtr0->put(key, value);
+    }
+    std::this_thread::sleep_for(
+        std::chrono::seconds(10));  // let the put finish
 
     //-----------------------Test with sendException
     // onRegion-------------------------------//
@@ -249,42 +250,30 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
     CacheablePtr args = CacheableBoolean::create(1);
 
     ExecutionPtr funcExec = FunctionService::onRegion(regPtr0);
-    ASSERT(funcExec != NULLPTR, "onRegion Returned NULL");
+    ASSERT(funcExec != nullptr, "onRegion Returned NULL");
 
     ResultCollectorPtr collector =
         funcExec->withArgs(args)->withFilter(filter)->execute(
             exFuncNameSendException, 15);
-    ASSERT(collector != NULLPTR, "onRegion collector NULL");
+    ASSERT(collector != nullptr, "onRegion collector NULL");
 
     CacheableVectorPtr result = collector->getResult();
 
-    if (result == NULLPTR) {
+    if (result == nullptr) {
       ASSERT(false, "echo String : result is NULL");
     } else {
-      try {
-        for (int i = 0; i < result->size(); i++) {
-          UserFunctionExecutionExceptionPtr uFEPtr =
-              dynCast<UserFunctionExecutionExceptionPtr>(
-                  result->operator[](i));
-          ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+      for (int i = 0; i < result->size(); i++) {
+        if (auto uFEPtr =
+                std::dynamic_pointer_cast<UserFunctionExecutionException>(
+                    result->operator[](i))) {
           LOGINFO("Done casting to uFEPtr");
           LOGINFO("Read expected uFEPtr exception %s ",
                   uFEPtr->getMessage()->asChar());
+        } else {
+          FAIL(
+              "exFuncNameSendException casting to string for bool argument "
+              "exception.");
         }
-      } catch (ClassCastException& ex) {
-        std::string logmsg = "";
-        logmsg += ex.getName();
-        logmsg += ": ";
-        logmsg += ex.getMessage();
-        LOG(logmsg.c_str());
-        ex.printStackTrace();
-        FAIL(
-            "exFuncNameSendException casting to string for bool argument "
-            "exception.");
-      } catch (...) {
-        FAIL(
-            "exFuncNameSendException casting to string for bool argument "
-            "Unknown exception.");
       }
     }
 
@@ -292,60 +281,61 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
 
     collector = funcExec->withArgs(arrList)->withFilter(filter)->execute(
         exFuncNameSendException, 15);
-    ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL");
+    ASSERT(collector != nullptr, "onRegion collector for arrList NULL");
     std::this_thread::sleep_for(std::chrono::seconds(2));
-    
+
     try {
-        CacheableVectorPtr fil = CacheableVector::create();
-        fil->push_back(CacheableInt32::create(1));
-        ExecutionPtr exe = FunctionService::onRegion(regPtr0);
-        
-        LOGINFO("Executing the exception test it is expected to throw.");
-        CacheableVectorPtr executeFunctionResult3 =
-        funcExec->withArgs(arrList)->withFilter(filter)->execute("ThinClientRegionExceptionTest", 15)->getResult();
-        FAIL("Failed to throw expected exception.");
+      CacheableVectorPtr fil = CacheableVector::create();
+      fil->push_back(CacheableInt32::create(1));
+      ExecutionPtr exe = FunctionService::onRegion(regPtr0);
+
+      LOGINFO("Executing the exception test it is expected to throw.");
+      CacheableVectorPtr executeFunctionResult3 =
+          funcExec->withArgs(arrList)
+              ->withFilter(filter)
+              ->execute("ThinClientRegionExceptionTest", 15)
+              ->getResult();
+      FAIL("Failed to throw expected exception.");
     } catch (...) {
-        LOGINFO("Finished Executing the exception test Successfully");
-        
+      LOGINFO("Finished Executing the exception test Successfully");
     }
-
-}
+  }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(CLIENT1, StopC1)
-{
-  cleanProc();
-  LOG("Clnt1Down complete: Keepalive = True");
-}
+  {
+    cleanProc();
+    LOG("Clnt1Down complete: Keepalive = True");
+  }
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(SERVER, CloseServers)
-{
-  // stop servers
-  if (isLocalServer) {
-    CacheHelper::closeServer(1);
-    LOG("SERVER1 stopped");
-  }
-  if (isLocalServer) {
-    CacheHelper::closeServer(2);
-    LOG("SERVER2 stopped");
-  }
-  if (isLocalServer) {
-    CacheHelper::closeServer(3);
-    LOG("SERVER3 stopped");
+  {
+    // stop servers
+    if (isLocalServer) {
+      CacheHelper::closeServer(1);
+      LOG("SERVER1 stopped");
+    }
+    if (isLocalServer) {
+      CacheHelper::closeServer(2);
+      LOG("SERVER2 stopped");
+    }
+    if (isLocalServer) {
+      CacheHelper::closeServer(3);
+      LOG("SERVER3 stopped");
+    }
+    isPoolWithEndpoint = true;
   }
-  isPoolWithEndpoint = true;
-}
 END_TASK_DEFINITION
 
 DUNIT_TASK_DEFINITION(LOCATOR1, CloseLocator1)
-{
-  // stop locator
-  if (isLocator) {
-    CacheHelper::closeLocator(1);
-    LOG("Locator1 stopped");
+  {
+    // stop locator
+    if (isLocator) {
+      CacheHelper::closeLocator(1);
+      LOG("Locator1 stopped");
+    }
   }
-}
 END_TASK_DEFINITION
 
 void runFunctionExecution() {
@@ -359,5 +349,5 @@ void runFunctionExecution() {
 }
 
 DUNIT_MAIN
-{ runFunctionExecution(); }
+  { runFunctionExecution(); }
 END_MAIN


Mime
View raw message