You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/04/09 21:16:46 UTC

[geode-native] branch develop updated: GEODE-5037: Disables logging of output from gfsh.

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

jbarrett 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 0f747fa  GEODE-5037: Disables logging of output from gfsh.
0f747fa is described below

commit 0f747fa59cc41a5e25c4caf212174fac60907405
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Mon Apr 9 21:16:31 2018 +0000

    GEODE-5037: Disables logging of output from gfsh.
    
    - Fixes naming of locator and server.
---
 cppcache/integration-test-2/framework/Cluster.cpp  |  8 +++++
 .../integration-test-2/framework/GfshExecute.cpp   | 35 +++++++++++++++++++
 .../integration-test-2/framework/GfshExecute.h     | 40 +++-------------------
 3 files changed, 48 insertions(+), 35 deletions(-)

diff --git a/cppcache/integration-test-2/framework/Cluster.cpp b/cppcache/integration-test-2/framework/Cluster.cpp
index 9a07846..3f131dd 100644
--- a/cppcache/integration-test-2/framework/Cluster.cpp
+++ b/cppcache/integration-test-2/framework/Cluster.cpp
@@ -20,10 +20,14 @@
 void Locator::start() {
   if (started_) return;
 
+  auto safeName = name_;
+  std::replace(safeName.begin(), safeName.end(), '/', '_');
+
   cluster_.getGfsh()
       .start()
       .locator()
       .withDir(name_)
+      .withName(safeName)
       .withBindAddress(locatorAddress_.address)
       .withPort(locatorAddress_.port)
       .withMaxHeap("256m")
@@ -45,10 +49,14 @@ void Locator::stop() {
 }
 
 void Server::start() {
+  auto safeName = name_;
+  std::replace(safeName.begin(), safeName.end(), '/', '_');
+
   cluster_.getGfsh()
       .start()
       .server()
       .withDir(name_)
+      .withName(safeName)
       .withBindAddress(serverAddress_.address)
       .withPort(serverAddress_.port)
       .withMaxHeap("1g")
diff --git a/cppcache/integration-test-2/framework/GfshExecute.cpp b/cppcache/integration-test-2/framework/GfshExecute.cpp
index b7114ba..4309e43 100644
--- a/cppcache/integration-test-2/framework/GfshExecute.cpp
+++ b/cppcache/integration-test-2/framework/GfshExecute.cpp
@@ -16,3 +16,38 @@
  */
 
 #include "GfshExecute.h"
+
+void GfshExecute::execute(const std::string &command) {
+  BOOST_LOG_TRIVIAL(info) << "Gfsh::execute: " << command;
+
+  using namespace boost::process;
+
+  std::vector<std::string> commands;
+  if (!connection_.empty()) {
+    commands.push_back("-e");
+    commands.push_back(connection_);
+  }
+  commands.push_back("-e");
+  commands.push_back(command);
+
+  auto env = boost::this_process::environment();
+  // broken on windows env["JAVA_ARGS"] = "-Xmx1g -client";
+
+  // pipes broken on windows.
+  // ipstream outStream;
+  // ipstream errStream;
+  child gfsh(GFSH_EXECUTABLE, args = commands, env, std_out > null,
+             std_err > null, std_in < null);
+
+  // std::string line;
+
+  // while (outStream && std::getline(outStream, line) && !line.empty())
+  //  BOOST_LOG_TRIVIAL(debug) << "Gfsh::execute: " << line;
+
+  // while (errStream && std::getline(errStream, line) && !line.empty())
+  //  BOOST_LOG_TRIVIAL(error) << "Gfsh::execute: " << line;
+
+  gfsh.wait();
+
+  extractConnectionCommand(command);
+}
diff --git a/cppcache/integration-test-2/framework/GfshExecute.h b/cppcache/integration-test-2/framework/GfshExecute.h
index 46d2f46..83144ca 100644
--- a/cppcache/integration-test-2/framework/GfshExecute.h
+++ b/cppcache/integration-test-2/framework/GfshExecute.h
@@ -25,9 +25,11 @@
 #include <algorithm>
 #include <regex>
 
-#pragma error_messages(off, oklambdaretmulti, wvarhidemem, w_constexprnonlitret, explctspectypename)
+#pragma error_messages(off, oklambdaretmulti, wvarhidemem, \
+                       w_constexprnonlitret, explctspectypename)
 #include <boost/process.hpp>
-#pragma error_messages(on, oklambdaretmulti, wvarhidemem, w_constexprnonlitret, explctspectypename)
+#pragma error_messages(on, oklambdaretmulti, wvarhidemem, \
+                       w_constexprnonlitret, explctspectypename)
 #include <boost/log/trivial.hpp>
 
 #include "Gfsh.h"
@@ -55,39 +57,7 @@ class GfshExecute : public Gfsh {
   };
 
  protected:
-  void execute(const std::string &command) override {
-    BOOST_LOG_TRIVIAL(info) << "Gfsh::execute: " << command;
-
-    using namespace boost::process;
-
-    std::vector<std::string> commands;
-    if (!connection_.empty()) {
-      commands.push_back("-e");
-      commands.push_back(connection_);
-    }
-    commands.push_back("-e");
-    commands.push_back(command);
-
-    auto env = boost::this_process::environment();
-    // broken on windows env["JAVA_ARGS"] = "-Xmx1g -client";
-
-    ipstream outStream;
-    ipstream errStream;
-    child gfsh(GFSH_EXECUTABLE, args = commands, env, std_out > outStream,
-               std_err > errStream);
-
-    std::string line;
-
-    while (outStream && std::getline(outStream, line) && !line.empty())
-      BOOST_LOG_TRIVIAL(debug) << "Gfsh::execute: " << line;
-
-    while (errStream && std::getline(errStream, line) && !line.empty())
-      BOOST_LOG_TRIVIAL(error) << "Gfsh::execute: " << line;
-
-    gfsh.wait();
-
-    extractConnectionCommand(command);
-  }
+  void execute(const std::string &command) override;
 
   void extractConnectionCommand(const std::string &command) {
     if (starts_with(command, std::string("connect"))) {

-- 
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.