You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/01/05 12:36:16 UTC

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #957: MINIFICPP-1407 - Fetch flow configuration file from C2 if not found locally

arpadboda commented on a change in pull request #957:
URL: https://github.com/apache/nifi-minifi-cpp/pull/957#discussion_r551898202



##########
File path: extensions/http-curl/tests/HTTPHandlers.h
##########
@@ -499,8 +507,8 @@ class C2UpdateHandler : public ServerAwareHandler {
   }
 
   std::atomic<size_t> calls_{0};

Review comment:
       Does this have to be public? 

##########
File path: extensions/http-curl/tests/HTTPHandlers.h
##########
@@ -447,35 +447,43 @@ class HeartbeatHandler : public ServerAwareHandler {
   }
 };
 
-class C2UpdateHandler : public ServerAwareHandler {
+class C2FlowProvider : public ServerAwareHandler {
  public:
-  explicit C2UpdateHandler(const std::string& test_file_location)
-    : test_file_location_(test_file_location) {
+  explicit C2FlowProvider(const std::string& test_file_location)
+      : test_file_location_(test_file_location) {
   }
 
-  bool handlePost(CivetServer *server, struct mg_connection *conn) override {
-    calls_++;
-    if (!response_.empty()) {
+  bool handleGet(CivetServer *server, struct mg_connection *conn) override {
+    std::ifstream myfile(test_file_location_.c_str(), std::ios::in | std::ios::binary);
+    if (myfile.good()) {
+      std::string str((std::istreambuf_iterator<char>(myfile)), (std::istreambuf_iterator<char>()));
       mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: "
-                "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n",
-                response_.length());
-      mg_printf(conn, "%s", response_.c_str());
-      response_.clear();
+                      "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n",
+                str.length());
+      mg_printf(conn, "%s", str.c_str());
     } else {
       mg_printf(conn, "HTTP/1.1 500 Internal Server Error\r\n");
     }
 
     return true;
   }
 
-  bool handleGet(CivetServer *server, struct mg_connection *conn) override {
-    std::ifstream myfile(test_file_location_.c_str(), std::ios::in | std::ios::binary);
-    if (myfile.good()) {
-      std::string str((std::istreambuf_iterator<char>(myfile)), (std::istreambuf_iterator<char>()));
+ private:
+  std::string test_file_location_;

Review comment:
       nitpicking: can be const as only the ctor can set it. 

##########
File path: libminifi/include/properties/Properties.h
##########
@@ -51,13 +57,13 @@ class Properties {
   // Set the config value
   void set(const std::string &key, const std::string &value) {
     std::lock_guard<std::mutex> lock(mutex_);
-    properties_[key] = value;
+    properties_[key] = PropertyValue{value, true};
     dirty_ = true;
   }
   // Check whether the config value existed
-  bool has(std::string key) const {
+  bool has(const std::string& key) const {
     std::lock_guard<std::mutex> lock(mutex_);
-    return properties_.count(key) > 0;
+    return properties_.find(key) != properties_.end();

Review comment:
       This seems like a question of preference. As either way is correct, I think every author I free do decide which one to use, but I wouldn't change it. It just adds extra diffs to the code review without value. 

##########
File path: libminifi/include/core/controller/ForwardingControllerServiceProvider.h
##########
@@ -0,0 +1,136 @@
+/**
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <memory>
+#include <vector>
+#include <string>
+
+#include "ControllerServiceProvider.h"
+#include "ControllerServiceNode.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace core {
+namespace controller {
+
+class ForwardingControllerServiceProvider : public ControllerServiceProvider {

Review comment:
       Why do we need pimpl here?
   
   At first look I'm not sure I perfectly understand the reason of introducing this class. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org