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/07/19 15:12:14 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1132: MINIFICPP-1603 Support Funnels element in flow definition

szaszm commented on a change in pull request #1132:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1132#discussion_r672382612



##########
File path: docker/test/integration/steps/steps.py
##########
@@ -248,6 +262,27 @@ def step_impl(context, file_name, content, path):
     context.test.add_test_data(path, content, file_name)
 
 
+@given("a Funnel with the name \"{funnel_name}\" is set up in the flow")
+def step_impl(context, funnel_name):
+    funnel = Funnel()
+    funnel.set_name(funnel_name)
+    context.test.add_node(funnel)
+
+
+@given("in the flow the Funnel with the name \"{source_name}\" is connected to the {destination_name}")

Review comment:
       "in the flow" is implicit from the context, I don't think we need it explicitly written
   ```suggestion
   @given("a Funnel with the name \"{funnel_name}\" is set up")
   def step_impl(context, funnel_name):
       funnel = Funnel()
       funnel.set_name(funnel_name)
       context.test.add_node(funnel)
   
   
   @given("the Funnel with the name \"{source_name}\" is connected to the {destination_name}")
   ```

##########
File path: extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
##########
@@ -747,3 +747,93 @@ TEST_CASE("Test Regex Property 2", "[YamlConfigurationRegexProperty2]") {
 }
 
 #endif  // YAML_CONFIGURATION_USE_REGEX
+
+TEST_CASE("Test YAML Config With Funnel", "[YamlConfiguration]") {
+  TestController test_controller;
+
+  std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository", true);
+  std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository", true);
+  std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
+  std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
+  std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
+  core::YamlConfiguration yamlConfig(testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration);
+
+  static const std::string CONFIG_YAML_WITH_FUNNEL = ""
+      "MiNiFi Config Version: 3\n"
+      "Flow Controller:\n"
+      "  name: root\n"
+      "  comment: ''\n"
+      "Processors:\n"
+      "- id: 0eac51eb-d76c-4ba6-9f0c-351795b2d243\n"
+      "  name: GenerateFlowFile1\n"

Review comment:
       Please use a raw string literal for this. (6) at https://en.cppreference.com/w/cpp/language/string_literal

##########
File path: libminifi/src/core/yaml/YamlConfiguration.cpp
##########
@@ -805,6 +807,37 @@ void YamlConfiguration::parsePropertiesNodeYaml(const YAML::Node& propertiesNode
   validateComponentProperties(processor, component_name, yaml_section);
 }
 
+void YamlConfiguration::parseFunnelsYaml(const YAML::Node& node, core::ProcessGroup* parent) {
+  if (!parent) {
+    logger_->log_error("parseFunnelsYaml: no parent group was provided");
+    return;
+  }
+  if (!node || !node.IsSequence()) {
+    return;
+  }
+
+  for (YAML::const_iterator iter = node.begin(); iter != node.end(); ++iter) {

Review comment:
       Did you consider using a range-based for loop?




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

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