You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2020/03/25 15:49:32 UTC

[geode-native] branch develop updated: GEODE-7883: Add a test to verify native client handles pool with no name in cache XML (#583)

This is an automated email from the ASF dual-hosted git repository.

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new fbe0e3d  GEODE-7883: Add a test to verify native client handles pool with no name in cache XML (#583)
fbe0e3d is described below

commit fbe0e3dad44fd256edaf8ebe15e4170a5169762d
Author: Blake Bender <bb...@pivotal.io>
AuthorDate: Wed Mar 25 08:49:24 2020 -0700

    GEODE-7883: Add a test to verify native client handles pool with no name in cache XML (#583)
---
 .../integration-test/resources/unnamed_pool.xml    | 37 ++++++++++++++++++++++
 cppcache/integration/test/CacheXmlTest.cpp         | 17 ++++++++++
 2 files changed, 54 insertions(+)

diff --git a/cppcache/integration-test/resources/unnamed_pool.xml b/cppcache/integration-test/resources/unnamed_pool.xml
new file mode 100644
index 0000000..ccb5624
--- /dev/null
+++ b/cppcache/integration-test/resources/unnamed_pool.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+    xmlns="http://geode.apache.org/schema/cpp-cache"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://geode.apache.org/schema/cpp-cache
+                        http://geode.apache.org/schema/cpp-cache/cpp-cache-1.0.xsd"
+    version="1.0">
+
+  <pdx ignore-unread-fields="true" />
+  <region name = "test_region" >
+    <region-attributes caching-enabled="true" pool-name="test_pool" />
+  </region>
+  <pool>
+    <locator host="localhost" port="10334" />
+  </pool>
+
+</client-cache>
diff --git a/cppcache/integration/test/CacheXmlTest.cpp b/cppcache/integration/test/CacheXmlTest.cpp
index 16a5b00..c70c9f9 100644
--- a/cppcache/integration/test/CacheXmlTest.cpp
+++ b/cppcache/integration/test/CacheXmlTest.cpp
@@ -36,6 +36,7 @@
 namespace {
 
 using apache::geode::client::Cache;
+using apache::geode::client::CacheXmlException;
 
 apache::geode::client::Cache createCacheUsingXmlConfig(
     const std::string& xmlFile) {
@@ -74,4 +75,20 @@ TEST(CacheXmlTest, loadCacheXmlWithBadSchema) {
   EXPECT_NO_THROW(createCacheUsingXmlConfig(cacheXml));
 }
 
+TEST(CacheXmlTest, loadCacheWithUnnamedPool) {
+  Cluster cluster{LocatorCount{1}, ServerCount{2}};
+  auto cacheXml =
+      std::string(getFrameworkString(FrameworkVariable::TestCacheXmlDir)) +
+      "/unnamed_pool.xml";
+
+  cluster.start();
+
+  cluster.getGfsh()
+      .create()
+      .region()
+      .withName("region")
+      .withType("PARTITION")
+      .execute();
+  EXPECT_THROW(createCacheUsingXmlConfig(cacheXml), CacheXmlException);
+}
 }  // namespace