You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mm...@apache.org on 2020/08/26 16:19:06 UTC

[geode-native] branch develop updated: GEODE-8398: Add sni unittest for dotnet (#641)

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

mmartell 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 5cf889d  GEODE-8398: Add sni unittest for dotnet (#641)
5cf889d is described below

commit 5cf889d03b2c6f63937d4efdea6916acf11fb734
Author: Michael Martell <mm...@pivotal.io>
AuthorDate: Wed Aug 26 09:18:57 2020 -0700

    GEODE-8398: Add sni unittest for dotnet (#641)
    
    * Add sniproxy accessors to pool
    
    * Add .NET unit test for SniProxy
    
    * Use builder pattern for new test.
    
    Also fix indentation error in class DummyPdxSerializer.
---
 clicache/src/Pool.cpp           | 26 ++++++++++++++++++++++++++
 clicache/src/Pool.hpp           | 16 ++++++++++++++++
 clicache/test2/Tests2.cs        | 18 +++++++++++++++++-
 cppcache/include/geode/Pool.hpp | 12 ++++++++++++
 cppcache/src/Pool.cpp           |  3 +++
 5 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/clicache/src/Pool.cpp b/clicache/src/Pool.cpp
index 33fc475..2a30503 100644
--- a/clicache/src/Pool.cpp
+++ b/clicache/src/Pool.cpp
@@ -105,6 +105,32 @@ namespace Apache
       }
 
 
+      String^ Pool::SniProxyHost::get()
+      {
+        try
+        {
+          return marshal_as<String^>( m_nativeptr->get()->getSniProxyHost() );
+        }
+        finally
+        {
+          GC::KeepAlive(m_nativeptr);
+        }
+
+      }
+
+      Int32 Pool::SniProxyPort::get()
+      {
+        try
+        {
+          return m_nativeptr->get()->getSniProxyPort();
+        }
+        finally
+        {
+          GC::KeepAlive(m_nativeptr);
+        }
+
+      }
+
       Int32 Pool::MinConnections::get()
       {
         try
diff --git a/clicache/src/Pool.hpp b/clicache/src/Pool.hpp
index a12b5ef..8606f6c 100644
--- a/clicache/src/Pool.hpp
+++ b/clicache/src/Pool.hpp
@@ -91,6 +91,22 @@ namespace Apache
         }
 
         /// <summary>
+        /// Get the host name for the pool's SniProxy.
+        /// </summary>
+        property String^ SniProxyHost
+        {
+          String^ get();
+        }
+
+        /// <summary>
+        /// Get the host port for the pool's SniProxy.
+        /// </summary>
+        property Int32 SniProxyPort
+        {
+          Int32 get();
+        }
+
+        /// <summary>
         /// Get the minimum connections for this pool.
         /// </summary>
         property Int32 MinConnections
diff --git a/clicache/test2/Tests2.cs b/clicache/test2/Tests2.cs
index 8eb1541..5cb449b 100644
--- a/clicache/test2/Tests2.cs
+++ b/clicache/test2/Tests2.cs
@@ -123,6 +123,22 @@ namespace Apache.Geode.Client.UnitTests
       Assert.False(_pdxDelegate2Called);
     }
 
+    [Fact]
+    public void SetSniProxy()
+    {
+        PoolFactory poolFactory = _cacheOne.GetPoolFactory()
+                .AddLocator("localhost", 10334)
+                .SetSniProxy("haproxy", 7777);
+
+        Pool pool = poolFactory.Create("testPool");
+
+        string sniProxyHost = pool.SniProxyHost;
+        int sniProxyPort = pool.SniProxyPort;
+
+        Assert.Equal(sniProxyHost, "haproxy");
+        Assert.Equal(sniProxyPort, 7777);
+    }
+
     private class DummyPdxSerializer : IPdxSerializer
     {
       public object FromData(string classname, IPdxReader reader)
@@ -342,4 +358,4 @@ namespace Apache.Geode.Client.UnitTests
       }
     }
   }
-}
\ No newline at end of file
+}
diff --git a/cppcache/include/geode/Pool.hpp b/cppcache/include/geode/Pool.hpp
index 85c11b0..5c82c29 100644
--- a/cppcache/include/geode/Pool.hpp
+++ b/cppcache/include/geode/Pool.hpp
@@ -95,6 +95,18 @@ class APACHE_GEODE_EXPORT Pool : public std::enable_shared_from_this<Pool> {
   std::chrono::milliseconds getReadTimeout() const;
 
   /**
+   * Gets the host name of the SniProxy.
+   * @see PoolFactory#setSniProxy(string, int)
+   */
+  std::string getSniProxyHost() const;
+
+  /**
+   * Gets the port of the SniProxy.
+   * @see PoolFactory#setSniProxy(string, int)
+   */
+  int getSniProxyPort() const;
+
+  /**
    * Gets the minimum connections for this pool.
    * @see PoolFactory#setMinConnections(int)
    */
diff --git a/cppcache/src/Pool.cpp b/cppcache/src/Pool.cpp
index 129bbc6..9983071 100644
--- a/cppcache/src/Pool.cpp
+++ b/cppcache/src/Pool.cpp
@@ -45,6 +45,9 @@ std::chrono::milliseconds Pool::getReadTimeout() const {
   return m_attrs->getReadTimeout();
 }
 
+std::string Pool::getSniProxyHost() const { return m_attrs->getSniProxyHost(); }
+int Pool::getSniProxyPort() const { return m_attrs->getSniProxyPort(); }
+
 int Pool::getMinConnections() const { return m_attrs->getMinConnections(); }
 
 int Pool::getMaxConnections() const { return m_attrs->getMaxConnections(); }