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 2020/06/30 09:28:55 UTC

[GitHub] [nifi-minifi-cpp] adamdebreceni opened a new pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

adamdebreceni opened a new pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827


   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the LICENSE file?
   - [ ] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
   


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



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450075979



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       I'm not sure about the above implication (`\n` before EOF -> is text file), but its contrary (no `\n` before EOF -> is not a text file) seems to be true to me.




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450073786



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       `text file` is a file format that has the magic number `\n` at the end of the file 🤯 




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r448154480



##########
File path: libminifi/src/core/ProcessGroup.cpp
##########
@@ -92,13 +92,12 @@ ProcessGroup::~ProcessGroup() {
     onScheduleTimer_->stop();
   }
 
-  for (auto &&connection : connections_) {
+  for (auto&& connection : connections_) {

Review comment:
       I am torn between always use `auto&&` in range-based for loops and never, it is really only useful when the iteration yields a temporary proxy object like with `std::vector<bool>`, `auto&` could be used, I wouldn't use `const auto&` as it makes me think that the connection is const whereas only the `std::shared_ptr<...>` is




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450097829



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       this is a response to a deleted comment:
    `text file` is a file format that has the magic number `\n` at the end of the file 🤯
   
   (I don't know how to resurrect the comment)
   (although I didn't mean to imply that `\n` before EOF -> is text file, e.g. having a file with only the magic number won't make a file a zip file)




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



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r447924329



##########
File path: libminifi/src/core/ProcessGroup.cpp
##########
@@ -92,13 +92,12 @@ ProcessGroup::~ProcessGroup() {
     onScheduleTimer_->stop();
   }
 
-  for (auto &&connection : connections_) {
+  for (auto&& connection : connections_) {

Review comment:
       That's a forwarding reference, because `auto` uses template deduction rules. In other words, "I don't care what it is, bind a reference to it" reference.
   In this case it will be a const lvalue reference, because:
   1. `auto&&`
   2. `const std::shared_ptr<Connection>& &&` after deducing `auto` (note: `connections_` is a `std::set`, which only has const iterators)
   3. `const std::shared_ptr<Connection>&` after reference-collapsing
   
   Normally I point out that `const auto&` or `auto&` would be more explicit and readable, but since this is old code with just a space change, I didn't want to bother @adamdebreceni with this.




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450014693



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       (some more bikeshedding questions about the POSIX "line")
   
   <img width="170" alt="Screenshot 2020-07-06 at 8 32 31" src="https://user-images.githubusercontent.com/64783590/86563354-85c2ea80-bf64-11ea-8f3a-a5c2ac5f66f8.png">
   
   what does POSIX say about where the cursor would be? it cannot be on "line 2" as there is no "line 2" 
   
   or take the error message:
   
   <img width="599" alt="Screenshot 2020-07-06 at 8 33 49" src="https://user-images.githubusercontent.com/64783590/86563648-097cd700-bf65-11ea-87cb-d8d9ebf12ddd.png">
   
   what is the `2` in `test.cpp:2:8`?




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450073786



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       `text-file` is a file format that has the magic number `\n` at the end of the file 🤯 




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



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r447555750



##########
File path: libminifi/src/core/ProcessGroup.cpp
##########
@@ -403,6 +403,16 @@ void ProcessGroup::removeConnection(std::shared_ptr<Connection> connection) {
   }
 }
 
+void ProcessGroup::drainConnections() {
+  for (auto &&connection : connections_) {
+    connection->drain();
+  }
+
+  for (std::set<ProcessGroup *>::iterator it = child_process_groups_.begin(); it != child_process_groups_.end(); ++it) {
+    (*it)->drainConnections();
+  }

Review comment:
       This could become a range-based for loop.

##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       The file should end with a newline character




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r447574816



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       done

##########
File path: libminifi/src/core/ProcessGroup.cpp
##########
@@ -403,6 +403,16 @@ void ProcessGroup::removeConnection(std::shared_ptr<Connection> connection) {
   }
 }
 
+void ProcessGroup::drainConnections() {
+  for (auto &&connection : connections_) {
+    connection->drain();
+  }
+
+  for (std::set<ProcessGroup *>::iterator it = child_process_groups_.begin(); it != child_process_groups_.end(); ++it) {
+    (*it)->drainConnections();
+  }

Review comment:
       done




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450014693



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       (some more bikeshedding questions about the POSIX "line")
   
   <img width="170" alt="Screenshot 2020-07-06 at 8 32 31" src="https://user-images.githubusercontent.com/64783590/86563354-85c2ea80-bf64-11ea-8f3a-a5c2ac5f66f8.png">
   
   what does POSIX say about where the cursor would be? it cannot be on `line 2` as there is no `line 2`
   
   or take the error message:
   
   <img width="599" alt="Screenshot 2020-07-06 at 8 33 49" src="https://user-images.githubusercontent.com/64783590/86563648-097cd700-bf65-11ea-87cb-d8d9ebf12ddd.png">
   
   what is the `2` in `test.cpp:2:8`?




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450097829



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       this is a response to a deleted comment:
    `text file` is a file format that has the magic number `\n` at the end of the file 🤯
   
   (I don't know how to resurrect the comment)
   (although I didn't mean to imply that '\n' before EOF -> is text file, e.g. having a file with only the magic number won't make a file a zip file)




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r447575841



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       (it seems like the Enter puts too much stress on my pinky)




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450097829



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       this is a response to a deleted comment about how `text file` is a file format with the magic number `\n` at the end of the file (I don't know how to resurrect the comment)




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450014693



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       (some more bikeshedding questions about the POSIX "line")
   
   <img width="170" alt="Screenshot 2020-07-06 at 8 32 31" src="https://user-images.githubusercontent.com/64783590/86563354-85c2ea80-bf64-11ea-8f3a-a5c2ac5f66f8.png">
   
   what does POSIX say about where the cursor would be? it cannot be on `line 2` as there is no `line 2`
   
   or take the error message:
   
   <img width="599" alt="Screenshot 2020-07-06 at 8 33 49" src="https://user-images.githubusercontent.com/64783590/86563648-097cd700-bf65-11ea-87cb-d8d9ebf12ddd.png">
   
   what is the `2` in `test.cpp:2:8`?
   
   we could have "the line `n`" mean the set of characters after the `(n-1)th line` up to the next `\n`, but that seems like a huge stretch




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r448156824



##########
File path: libminifi/test/flow-tests/FlowControllerTests.cpp
##########
@@ -0,0 +1,125 @@
+/**
+ *
+ * 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.
+ */
+
+#undef NDEBUG
+#include <chrono>
+#include <map>
+#include <memory>
+#include <string>
+#include <thread>
+
+#include "core/Core.h"
+#include "core/repository/AtomicRepoEntries.h"
+#include "core/RepositoryFactory.h"
+#include "FlowFileRecord.h"
+#include "provenance/Provenance.h"
+#include "properties/Configure.h"
+#include "../unit/ProvenanceTestHelper.h"
+#include "../TestBase.h"
+#include "YamlConfiguration.h"
+
+const char* yamlConfig =

Review comment:
       I saw that a number of tests store their config files there, but the fact that I have to search for the test by name then check the `CMakeLists.txt` to find out what the command line arguments are going to be, and then manually navigate to the file, makes me think that it is not the best approach 




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



[GitHub] [nifi-minifi-cpp] arpadboda closed pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
arpadboda closed pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827


   


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



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r447557059



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       The file should end with a newline character.
   
   https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450014693



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       (some more bikeshedding questions about the POSIX "line")
   
   <img width="170" alt="Screenshot 2020-07-06 at 8 32 31" src="https://user-images.githubusercontent.com/64783590/86563354-85c2ea80-bf64-11ea-8f3a-a5c2ac5f66f8.png">
   
   what does POSIX say about where the cursor would be? it cannot be on "line 2" as there is no "line 2" 
   
   or take the error message:
   
   <img width="599" alt="Screenshot 2020-07-06 at 8 33 49" src="https://user-images.githubusercontent.com/64783590/86563648-097cd700-bf65-11ea-87cb-d8d9ebf12ddd.png">
   
   what is the `2` in `test.cpp:**2**:8`?




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



[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r448156824



##########
File path: libminifi/test/flow-tests/FlowControllerTests.cpp
##########
@@ -0,0 +1,125 @@
+/**
+ *
+ * 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.
+ */
+
+#undef NDEBUG
+#include <chrono>
+#include <map>
+#include <memory>
+#include <string>
+#include <thread>
+
+#include "core/Core.h"
+#include "core/repository/AtomicRepoEntries.h"
+#include "core/RepositoryFactory.h"
+#include "FlowFileRecord.h"
+#include "provenance/Provenance.h"
+#include "properties/Configure.h"
+#include "../unit/ProvenanceTestHelper.h"
+#include "../TestBase.h"
+#include "YamlConfiguration.h"
+
+const char* yamlConfig =

Review comment:
       I saw that a number of tests store their config files there, but the fact that I have to search for the test by name then check the CMakeLists.txt what the command line arguments are going to be, and then manually navigate to the file, makes me think that it is not the best approach 




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



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #827: MINIFICPP-1273 - Drain connections on flow shutdown

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #827:
URL: https://github.com/apache/nifi-minifi-cpp/pull/827#discussion_r450048892



##########
File path: libminifi/test/flow-tests/CMakeLists.txt
##########
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+file(GLOB FLOW_TESTS  "*.cpp")
+SET(FLOW_TEST_COUNT 0)
+FOREACH(testfile ${FLOW_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    createTests("${testfilename}")
+    target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
+    target_wholearchive_library(${testfilename} minifi-standard-processors)
+    MATH(EXPR FLOW_TEST_COUNT "${FLOW_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${FLOW_TEST_COUNT} flow related test file(s)...")

Review comment:
       The tools were written to behave decently with non-text files and consider the line number to be the encountered `\n`s + 1. Historical posix text processing utilities may ignore the contents after the last `\n`, but I haven't seen modern tools do so. [1]
   
   Please note that I'm by no means a POSIX lawyer, and the part about handling is mostly speculation.
   
   [1] https://unix.stackexchange.com/a/18789/366131




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