You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by lo...@apache.org on 2022/08/24 16:56:21 UTC

[nifi-minifi-cpp] branch main updated: MINIFICPP-1918 - Windows test fix

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

lordgamez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new af4fef2c1 MINIFICPP-1918 - Windows test fix
af4fef2c1 is described below

commit af4fef2c184aced41c52bc54eaa2fb05ffccc7a1
Author: Adam Debreceni <ad...@apache.org>
AuthorDate: Wed Aug 24 10:34:01 2022 +0200

    MINIFICPP-1918 - Windows test fix
    
    Signed-off-by: Gabor Gyimesi <ga...@gmail.com>
    
    This closes #1404
---
 libminifi/CMakeLists.txt                    |  2 +-
 libminifi/include/agent/build_description.h | 38 +++---------------
 libminifi/src/agent/build_description.cpp   | 61 +++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 34 deletions(-)

diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt
index ca4b68f7d..8ec537140 100644
--- a/libminifi/CMakeLists.txt
+++ b/libminifi/CMakeLists.txt
@@ -57,7 +57,7 @@ if (NOT OPENSSL_OFF)
     set(TLS_SOURCES "src/utils/tls/*.cpp" "src/io/tls/*.cpp")
 endif()
 
-file(GLOB SOURCES "src/agent/agent_docs.cpp" "src/properties/*.cpp" "src/utils/file/*.cpp" "src/sitetosite/*.cpp"  "src/core/logging/*.cpp" "src/core/logging/internal/*.cpp" "src/core/state/*.cpp" "src/core/state/nodes/*.cpp" "src/c2/protocols/*.cpp" "src/c2/triggers/*.cpp" "src/c2/*.cpp" "src/io/*.cpp" ${SOCKET_SOURCES} ${TLS_SOURCES} "src/core/controller/*.cpp" "src/controllers/*.cpp" "src/controllers/keyvalue/*.cpp" "src/core/*.cpp"  "src/core/repository/*.cpp" "src/core/yaml/*.cpp" " [...]
+file(GLOB SOURCES "src/agent/agent_docs.cpp" "src/agent/build_description.cpp" "src/properties/*.cpp" "src/utils/file/*.cpp" "src/sitetosite/*.cpp"  "src/core/logging/*.cpp" "src/core/logging/internal/*.cpp" "src/core/state/*.cpp" "src/core/state/nodes/*.cpp" "src/c2/protocols/*.cpp" "src/c2/triggers/*.cpp" "src/c2/*.cpp" "src/io/*.cpp" ${SOCKET_SOURCES} ${TLS_SOURCES} "src/core/controller/*.cpp" "src/controllers/*.cpp" "src/controllers/keyvalue/*.cpp" "src/core/*.cpp"  "src/core/reposit [...]
 # manually add this as it might not yet be present when this executes
 list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/agent_version.cpp")
 
diff --git a/libminifi/include/agent/build_description.h b/libminifi/include/agent/build_description.h
index 282af0a2b..8c570eb47 100644
--- a/libminifi/include/agent/build_description.h
+++ b/libminifi/include/agent/build_description.h
@@ -42,44 +42,16 @@ struct BundleDetails {
 
 class ExternalBuildDescription {
  private:
-  static std::vector<struct BundleDetails> &getExternal() {
-    static std::vector<struct BundleDetails> external_groups;
-    return external_groups;
-  }
+  static std::vector<BundleDetails> &getExternal();
 
-  static std::map<std::string, struct Components> &getExternalMappings() {
-    static std::map<std::string, struct Components> external_mappings;
-    return external_mappings;
-  }
+  static std::map<std::string, Components> &getExternalMappings();
 
  public:
-  static void addExternalComponent(const BundleDetails& details, const ClassDescription& description) {
-    bool found = false;
-    for (const auto &d : getExternal()) {
-      if (d.artifact == details.artifact) {
-        found = true;
-        break;
-      }
-    }
-    if (!found) {
-      getExternal().push_back(details);
-    }
-    if (description.type_ == ResourceType::Processor) {
-      getExternalMappings()[details.artifact].processors_.push_back(description);
-    } else if (description.type_ == ResourceType::ControllerService) {
-      getExternalMappings()[details.artifact].controller_services_.push_back(description);
-    } else {
-      getExternalMappings()[details.artifact].other_components_.push_back(description);
-    }
-  }
+  static void addExternalComponent(const BundleDetails& details, const ClassDescription& description);
 
-  static struct Components getClassDescriptions(const std::string &group) {
-    return getExternalMappings()[group];
-  }
+  static Components getClassDescriptions(const std::string &group);
 
-  static std::vector<struct BundleDetails> getExternalGroups() {
-    return getExternal();
-  }
+  static std::vector<BundleDetails> getExternalGroups();
 };
 
 class BuildDescription {
diff --git a/libminifi/src/agent/build_description.cpp b/libminifi/src/agent/build_description.cpp
new file mode 100644
index 000000000..6e8aede38
--- /dev/null
+++ b/libminifi/src/agent/build_description.cpp
@@ -0,0 +1,61 @@
+/**
+ *
+ * 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.
+ */
+
+#include "agent/build_description.h"
+
+namespace org::apache::nifi::minifi {
+
+std::vector<BundleDetails>& ExternalBuildDescription::getExternal() {
+  static std::vector<BundleDetails> external_groups;
+  return external_groups;
+}
+
+std::map<std::string, Components>& ExternalBuildDescription::getExternalMappings() {
+  static std::map<std::string, Components> external_mappings;
+  return external_mappings;
+}
+
+void ExternalBuildDescription::addExternalComponent(const BundleDetails& details, const ClassDescription& description) {
+  bool found = false;
+  for (const auto &d : getExternal()) {
+    if (d.artifact == details.artifact) {
+      found = true;
+      break;
+    }
+  }
+  if (!found) {
+    getExternal().push_back(details);
+  }
+  if (description.type_ == ResourceType::Processor) {
+    getExternalMappings()[details.artifact].processors_.push_back(description);
+  } else if (description.type_ == ResourceType::ControllerService) {
+    getExternalMappings()[details.artifact].controller_services_.push_back(description);
+  } else {
+    getExternalMappings()[details.artifact].other_components_.push_back(description);
+  }
+}
+
+Components ExternalBuildDescription::getClassDescriptions(const std::string &group) {
+  return getExternalMappings()[group];
+}
+
+std::vector<BundleDetails> ExternalBuildDescription::getExternalGroups() {
+  return getExternal();
+}
+
+}  // namespace org::apache::nifi::minifi