This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a commit to branch feature/GEODE-5957-onRegion in repository https://gitbox.apache.org/repos/asf/geode-native.git
commit 1c43eff43f41c3c6cebee3758baaa524e327c3b0 Author: Sai Boorlagadda <[email protected]> AuthorDate: Thu Dec 6 10:26:13 2018 -0800 GEODE-5957: Parse (previously) unknown server error messages - Handle request data error messages for function execution on a region. Signed-off-by: Ernest Burghardt <[email protected]> --- .../integration-test-2/FunctionExecutionTest.cpp | 38 ++++++++++++++++++++-- cppcache/src/ThinClientRegion.cpp | 5 +++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/cppcache/integration-test-2/FunctionExecutionTest.cpp b/cppcache/integration-test-2/FunctionExecutionTest.cpp index 8cdedcb..06b9e02 100644 --- a/cppcache/integration-test-2/FunctionExecutionTest.cpp +++ b/cppcache/integration-test-2/FunctionExecutionTest.cpp @@ -44,7 +44,7 @@ std::shared_ptr<Region> setupRegion(Cache &cache) { return region; } -TEST(FunctionExecutionTest, UnknownFunction) { +TEST(FunctionExecutionTest, UnknownFunctionOnServer) { Cluster cluster{LocatorCount{1}, ServerCount{1}}; cluster.getGfsh() .create() @@ -61,6 +61,22 @@ TEST(FunctionExecutionTest, UnknownFunction) { FunctionExecutionException); } +TEST(FunctionExecutionTest, UnknownFunctionOnRegion) { + Cluster cluster{LocatorCount{1}, ServerCount{1}}; + cluster.getGfsh() + .create() + .region() + .withName("region") + .withType("REPLICATE") + .execute(); + + auto cache = cluster.createCache(); + auto region = setupRegion(cache); + + ASSERT_THROW(FunctionService::onRegion(region).execute("I_Don_t_Exist"), + FunctionExecutionException); +} + class TestResultCollector : public ResultCollector { virtual std::shared_ptr<CacheableVector> getResult( std::chrono::milliseconds) override { @@ -74,7 +90,7 @@ class TestResultCollector : public ResultCollector { virtual void clearResults() override {} }; -TEST(FunctionExecutionTest, UnknownFunctionAsync) { +TEST(FunctionExecutionTest, UnknownFunctionAsyncOnServer) { Cluster cluster{LocatorCount{1}, ServerCount{1}}; cluster.getGfsh() .create() @@ -91,3 +107,21 @@ TEST(FunctionExecutionTest, UnknownFunctionAsync) { .execute("I_Don_t_Exist"), FunctionExecutionException); } + +TEST(FunctionExecutionTest, UnknownFunctionAsyncOnRegion) { + Cluster cluster{LocatorCount{1}, ServerCount{1}}; + cluster.getGfsh() + .create() + .region() + .withName("region") + .withType("REPLICATE") + .execute(); + + auto cache = cluster.createCache(); + auto region = setupRegion(cache); + + ASSERT_THROW(FunctionService::onRegion(region) + .withCollector(std::make_shared<TestResultCollector>()) + .execute("I_Don_t_Exist"), + FunctionExecutionException); +} diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp index 6d10ce9..f12f137 100644 --- a/cppcache/src/ThinClientRegion.cpp +++ b/cppcache/src/ThinClientRegion.cpp @@ -3263,10 +3263,15 @@ GfErrType ThinClientRegion::getFuncAttributes(const std::string& func, reply.getException()); break; } + case TcrMessage::REQUEST_DATA_ERROR: { + LOGERROR("Error message from server: " + reply.getValue()->toString()); + throw FunctionExecutionException(reply.getValue()->toString()); + } default: { LOGERROR("Unknown message type %d while getting function attributes.", reply.getMessageType()); err = GF_MSG; + break; } } return err;
