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

commit 5f72f671d0b1cf6e407c0fb0c0a35d16ddb37512
Author: Martin Zink <[email protected]>
AuthorDate: Fri May 3 10:36:46 2024 +0200

    MINIFICPP-2338 Move out ExecuteProcess from standard processors
    
    Signed-off-by: Gabor Gyimesi <[email protected]>
    
    This closes #1788
---
 .github/workflows/ci.yml                           |  1 +
 README.md                                          | 63 +++++++++++-----------
 cmake/MiNiFiOptions.cmake                          |  1 +
 extensions/execute-process/CMakeLists.txt          | 38 +++++++++++++
 .../ExecuteProcess.cpp                             | 13 +++--
 .../ExecuteProcess.h                               | 18 +++----
 extensions/execute-process/test/CMakeLists.txt     | 30 +++++++++++
 .../test}/ExecuteProcessTests.cpp                  |  6 +--
 .../test}/resource_apps/EchoParameters.cpp         |  0
 .../standard-processors/tests/CMakeLists.txt       |  9 ----
 10 files changed, 119 insertions(+), 60 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 951643f27..2dda2d61a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -369,6 +369,7 @@ jobs:
         -DENABLE_ELASTICSEARCH=ON
         -DENABLE_ENCRYPT_CONFIG=ON
         -DENABLE_EXPRESSION_LANGUAGE=ON
+        -DENABLE_EXECUTE_PROCESS=ON
         -DENABLE_GCP=ON
         -DENABLE_GPS=ON
         -DENABLE_GRAFANA_LOKI=ON
diff --git a/README.md b/README.md
index c3c703fa8..996678533 100644
--- a/README.md
+++ b/README.md
@@ -72,37 +72,38 @@ The next table outlines CMAKE flags that correspond with 
MiNiFi extensions. Exte
 Through JNI extensions you can run NiFi processors using NARs. The JNI 
extension set allows you to run these Java processors. MiNiFi C++ will favor 
C++ implementations over Java implements. In the case where a processor is 
implemented in either language, the one in C++ will be selected; however, will 
remain transparent to the consumer.
 
 
-| Extension Set               | Processors and Controller Services             
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-|-----------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
-| Archive Extensions          | 
[ApplyTemplate](PROCESSORS.md#applytemplate)<br/>[BinFiles](PROCESSORS.md#binfiles)<br/>[CompressContent](PROCESSORS.md#compresscontent)<br/>[ManipulateArchive](PROCESSORS.md#manipulatearchive)<br/>[MergeContent](PROCESSORS.md#mergecontent)<br/>[FocusArchiveEntry](PROCESSORS.md#focusarchiveentry)<br/>[UnfocusArchiveEntry](PROCESSORS.md#unfocusarchiveentry)
                                                                                
                       [...]
-| AWS                         | 
[AWSCredentialsService](CONTROLLERS.md#awscredentialsservice)<br/>[PutS3Object](PROCESSORS.md#puts3object)<br/>[DeleteS3Object](PROCESSORS.md#deletes3object)<br/>[FetchS3Object](PROCESSORS.md#fetchs3object)<br/>[ListS3](PROCESSORS.md#lists3)
                                                                                
                                                                                
                                                            [...]
-| Azure                       | 
[AzureStorageCredentialsService](CONTROLLERS.md#azurestoragecredentialsservice)<br/>[PutAzureBlobStorage](PROCESSORS.md#putazureblobstorage)<br/>[DeleteAzureBlobStorage](PROCESSORS.md#deleteazureblobstorage)<br/>[FetchAzureBlobStorage](PROCESSORS.md#fetchazureblobstorage)<br/>[ListAzureBlobStorage](PROCESSORS.md#listazureblobstorage)<br/>[PutAzureDataLakeStorage](PROCESSORS.md#putazuredatalakestorage)<br/>[DeleteAzureDataLakeStorage](PROCESSORS.md#deleteaz
 [...]
-| CivetWeb                    | [ListenHTTP](PROCESSORS.md#listenhttp)         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| CURL                        | [InvokeHTTP](PROCESSORS.md#invokehttp)         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| Elasticsearch               | 
[ElasticsearchCredentialsControllerService](CONTROLLERS.md#elasticsearchcredentialscontrollerservice)<br/>[PostElasticsearch](PROCESSORS.md#postelasticsearch)
                                                                                
                                                                                
                                                                                
                                                               [...]
-| GPS (Linux and macOS)       | [GetGPS](PROCESSORS.md#getgps)                 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| Google Cloud Platform       | 
[DeleteGCSObject](PROCESSORS.md#deletegcsobject)<br>[FetchGCSObject](PROCESSORS.md#fetchgcsobject)<br>[GCPCredentialsControllerService](CONTROLLERS.md#gcpcredentialscontrollerservice)<br>[ListGCSBucket](PROCESSORS.md#listgcsbucket)<br>[PutGCSObject](PROCESSORS.md#putgcsobject)
                                                                                
                                                                                
                        [...]
-| Grafana Loki                | 
[PushGrafanaLokiREST](PROCESSORS.md#pushgrafanalokirest)<br>[PushGrafanaLokiGrpc](PROCESSORS.md#pushgrafanalokigrpc)
                                                                                
                                                                                
                                                                                
                                                                                
                         [...]
-| Kafka                       | 
[PublishKafka](PROCESSORS.md#publishkafka)<br>[ConsumeKafka](PROCESSORS.md#consumekafka)
                                                                                
                                                                                
                                                                                
                                                                                
                                                     [...]
-| Kubernetes (Linux)          | 
[KubernetesControllerService](CONTROLLERS.md#kubernetescontrollerservice)       
                                                                                
                                                                                
                                                                                
                                                                                
                                                             [...]
-| JNI                         | **NiFi Processors**                            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| Lua Scripting               | [ExecuteScript](PROCESSORS.md#executescript)   
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| MQTT                        | 
[ConsumeMQTT](PROCESSORS.md#consumemqtt)<br/>[PublishMQTT](PROCESSORS.md#publishmqtt)
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
-| OPC                         | 
[FetchOPCProcessor](PROCESSORS.md#fetchopcprocessor)<br/>[PutOPCProcessor](PROCESSORS.md#putopcprocessor)
                                                                                
                                                                                
                                                                                
                                                                                
                                    [...]
-| OpenCV                      | 
[CaptureRTSPFrame](PROCESSORS.md#capturertspframe)<br/>[MotionDetector](PROCESSORS.md#motiondetector)
                                                                                
                                                                                
                                                                                
                                                                                
                                        [...]
-| OpenWSMAN                   | SourceInitiatedSubscriptionListener            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| PCAP                        | [CapturePacket](PROCESSORS.md#capturepacket)   
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| PDH (Windows)               | 
[PerformanceDataMonitor](PROCESSORS.md#performancedatamonitor)                  
                                                                                
                                                                                
                                                                                
                                                                                
                                                             [...]
-| ProcFs (Linux)              | [ProcFsMonitor](PROCESSORS.md#procfsmonitor)   
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| Python Scripting            | 
[ExecuteScript](PROCESSORS.md#executescript)<br>[ExecutePythonProcessor](PROCESSORS.md#executepythonprocessor)<br/>**Custom
 Python Processors**                                                            
                                                                                
                                                                                
                                                                                
                  [...]
-| Sensors                     | GetEnvironmentalSensors<br/>GetMovementSensors 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| SMB (Windows)               | 
[FetchSmb](PROCESSORS.md#fetchsmb)<br/>[ListSmb](PROCESSORS.md#listsmb)<br/>[PutSmb](PROCESSORS.md#putsmb)
                                                                                
                                                                                
                                                                                
                                                                                
                                   [...]
-| SFTP                        | 
[FetchSFTP](PROCESSORS.md#fetchsftp)<br/>[ListSFTP](PROCESSORS.md#listsftp)<br/>[PutSFTP](PROCESSORS.md#putsftp)
                                                                                
                                                                                
                                                                                
                                                                                
                             [...]
-| SQL                         | 
[ExecuteSQL](PROCESSORS.md#executesql)<br/>[PutSQL](PROCESSORS.md#putsql)<br/>[QueryDatabaseTable](PROCESSORS.md#querydatabasetable)<br/>
                                                                                
                                                                                
                                                                                
                                                                                
    [...]
-| Splunk                      | 
[PutSplunkHTTP](PROCESSORS.md#putsplunkhttp)<br/>[QuerySplunkIndexingStatus](PROCESSORS.md#querysplunkindexingstatus)
                                                                                
                                                                                
                                                                                
                                                                                
                        [...]
-| Systemd (Linux)             | 
[ConsumeJournald](PROCESSORS.md#consumejournald)                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                             [...]
-| USB Camera                  | [GetUSBCamera](PROCESSORS.md#getusbcamera)     
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
-| Windows Event Log (Windows) | 
[CollectorInitiatedSubscription](PROCESSORS.md#collectorinitiatedsubscription)<br/>[ConsumeWindowsEventLog](PROCESSORS.md#consumewindowseventlog)<br/>[TailEventLog](PROCESSORS.md#taileventlog)
                                                                                
                                                                                
                                                                                
                             [...]
+| Extension Set                    | Processors and Controller Services        
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
+|----------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
+| Archive Extensions               | 
[ApplyTemplate](PROCESSORS.md#applytemplate)<br/>[BinFiles](PROCESSORS.md#binfiles)<br/>[CompressContent](PROCESSORS.md#compresscontent)<br/>[ManipulateArchive](PROCESSORS.md#manipulatearchive)<br/>[MergeContent](PROCESSORS.md#mergecontent)<br/>[FocusArchiveEntry](PROCESSORS.md#focusarchiveentry)<br/>[UnfocusArchiveEntry](PROCESSORS.md#unfocusarchiveentry)
                                                                                
                  [...]
+| AWS                              | 
[AWSCredentialsService](CONTROLLERS.md#awscredentialsservice)<br/>[PutS3Object](PROCESSORS.md#puts3object)<br/>[DeleteS3Object](PROCESSORS.md#deletes3object)<br/>[FetchS3Object](PROCESSORS.md#fetchs3object)<br/>[ListS3](PROCESSORS.md#lists3)
                                                                                
                                                                                
                                                       [...]
+| Azure                            | 
[AzureStorageCredentialsService](CONTROLLERS.md#azurestoragecredentialsservice)<br/>[PutAzureBlobStorage](PROCESSORS.md#putazureblobstorage)<br/>[DeleteAzureBlobStorage](PROCESSORS.md#deleteazureblobstorage)<br/>[FetchAzureBlobStorage](PROCESSORS.md#fetchazureblobstorage)<br/>[ListAzureBlobStorage](PROCESSORS.md#listazureblobstorage)<br/>[PutAzureDataLakeStorage](PROCESSORS.md#putazuredatalakestorage)<br/>[DeleteAzureDataLakeStorage](PROCESSORS.md#del
 [...]
+| CivetWeb                         | [ListenHTTP](PROCESSORS.md#listenhttp)    
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
+| CURL                             | [InvokeHTTP](PROCESSORS.md#invokehttp)    
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
+| Elasticsearch                    | 
[ElasticsearchCredentialsControllerService](CONTROLLERS.md#elasticsearchcredentialscontrollerservice)<br/>[PostElasticsearch](PROCESSORS.md#postelasticsearch)
                                                                                
                                                                                
                                                                                
                                                          [...]
+| ExecuteProcess (Linux and macOS) | 
[ExecuteProcess](PROCESSORS.md#executeprocess)                                  
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| GPS (Linux and macOS)            | [GetGPS](PROCESSORS.md#getgps)            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
+| Google Cloud Platform            | 
[DeleteGCSObject](PROCESSORS.md#deletegcsobject)<br>[FetchGCSObject](PROCESSORS.md#fetchgcsobject)<br>[GCPCredentialsControllerService](CONTROLLERS.md#gcpcredentialscontrollerservice)<br>[ListGCSBucket](PROCESSORS.md#listgcsbucket)<br>[PutGCSObject](PROCESSORS.md#putgcsobject)
                                                                                
                                                                                
                   [...]
+| Grafana Loki                     | 
[PushGrafanaLokiREST](PROCESSORS.md#pushgrafanalokirest)<br>[PushGrafanaLokiGrpc](PROCESSORS.md#pushgrafanalokigrpc)
                                                                                
                                                                                
                                                                                
                                                                                
                    [...]
+| Kafka                            | 
[PublishKafka](PROCESSORS.md#publishkafka)<br>[ConsumeKafka](PROCESSORS.md#consumekafka)
                                                                                
                                                                                
                                                                                
                                                                                
                                                [...]
+| Kubernetes (Linux)               | 
[KubernetesControllerService](CONTROLLERS.md#kubernetescontrollerservice)       
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| JNI                              | **NiFi Processors**                       
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
+| Lua Scripting                    | 
[ExecuteScript](PROCESSORS.md#executescript)                                    
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| MQTT                             | 
[ConsumeMQTT](PROCESSORS.md#consumemqtt)<br/>[PublishMQTT](PROCESSORS.md#publishmqtt)
                                                                                
                                                                                
                                                                                
                                                                                
                                                   [...]
+| OPC                              | 
[FetchOPCProcessor](PROCESSORS.md#fetchopcprocessor)<br/>[PutOPCProcessor](PROCESSORS.md#putopcprocessor)
                                                                                
                                                                                
                                                                                
                                                                                
                               [...]
+| OpenCV                           | 
[CaptureRTSPFrame](PROCESSORS.md#capturertspframe)<br/>[MotionDetector](PROCESSORS.md#motiondetector)
                                                                                
                                                                                
                                                                                
                                                                                
                                   [...]
+| OpenWSMAN                        | SourceInitiatedSubscriptionListener       
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
+| PCAP                             | 
[CapturePacket](PROCESSORS.md#capturepacket)                                    
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| PDH (Windows)                    | 
[PerformanceDataMonitor](PROCESSORS.md#performancedatamonitor)                  
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| ProcFs (Linux)                   | 
[ProcFsMonitor](PROCESSORS.md#procfsmonitor)                                    
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| Python Scripting                 | 
[ExecuteScript](PROCESSORS.md#executescript)<br>[ExecutePythonProcessor](PROCESSORS.md#executepythonprocessor)<br/>**Custom
 Python Processors**                                                            
                                                                                
                                                                                
                                                                                
             [...]
+| Sensors                          | 
GetEnvironmentalSensors<br/>GetMovementSensors                                  
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| SMB (Windows)                    | 
[FetchSmb](PROCESSORS.md#fetchsmb)<br/>[ListSmb](PROCESSORS.md#listsmb)<br/>[PutSmb](PROCESSORS.md#putsmb)
                                                                                
                                                                                
                                                                                
                                                                                
                              [...]
+| SFTP                             | 
[FetchSFTP](PROCESSORS.md#fetchsftp)<br/>[ListSFTP](PROCESSORS.md#listsftp)<br/>[PutSFTP](PROCESSORS.md#putsftp)
                                                                                
                                                                                
                                                                                
                                                                                
                        [...]
+| SQL                              | 
[ExecuteSQL](PROCESSORS.md#executesql)<br/>[PutSQL](PROCESSORS.md#putsql)<br/>[QueryDatabaseTable](PROCESSORS.md#querydatabasetable)<br/>
                                                                                
                                                                                
                                                                                
                                                                               
[...]
+| Splunk                           | 
[PutSplunkHTTP](PROCESSORS.md#putsplunkhttp)<br/>[QuerySplunkIndexingStatus](PROCESSORS.md#querysplunkindexingstatus)
                                                                                
                                                                                
                                                                                
                                                                                
                   [...]
+| Systemd (Linux)                  | 
[ConsumeJournald](PROCESSORS.md#consumejournald)                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| USB Camera                       | 
[GetUSBCamera](PROCESSORS.md#getusbcamera)                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                        [...]
+| Windows Event Log (Windows)      | 
[CollectorInitiatedSubscription](PROCESSORS.md#collectorinitiatedsubscription)<br/>[ConsumeWindowsEventLog](PROCESSORS.md#consumewindowseventlog)<br/>[TailEventLog](PROCESSORS.md#taileventlog)
                                                                                
                                                                                
                                                                                
                        [...]
 
  Please see our [Python guide](extensions/python/PYTHON.md) on how to write 
Python processors and use them within MiNiFi C++.
 
diff --git a/cmake/MiNiFiOptions.cmake b/cmake/MiNiFiOptions.cmake
index de2b264ed..4fda00c60 100644
--- a/cmake/MiNiFiOptions.cmake
+++ b/cmake/MiNiFiOptions.cmake
@@ -123,6 +123,7 @@ add_minifi_option(ENABLE_TEST_PROCESSORS "Enables test 
processors" OFF)
 add_minifi_option(ENABLE_PROMETHEUS "Enables Prometheus support." ON)
 add_minifi_option(ENABLE_GRAFANA_LOKI "Enable Grafana Loki support" OFF)
 add_minifi_option(ENABLE_GRPC_FOR_LOKI "Enable gRPC for Grafana Loki 
extension" ON)
+add_minifi_option(ENABLE_EXECUTE_PROCESS "Enable ExecuteProcess processor" OFF)
 add_minifi_dependent_option(ENABLE_CONTROLLER "Enables the build of MiNiFi 
controller binary." ON "ENABLE_CURL" OFF)
 
 set_minifi_cache_variable(CUSTOM_MALLOC OFF "Overwrite malloc implementation.")
diff --git a/extensions/execute-process/CMakeLists.txt 
b/extensions/execute-process/CMakeLists.txt
new file mode 100644
index 000000000..db798cc00
--- /dev/null
+++ b/extensions/execute-process/CMakeLists.txt
@@ -0,0 +1,38 @@
+#
+# 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.
+#
+
+if (WIN32)
+    return()
+endif()
+
+if (NOT (ENABLE_ALL OR ENABLE_EXECUTE_PROCESS))
+    return()
+endif()
+
+include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt)
+
+file(GLOB SOURCES  "*.cpp")
+
+add_minifi_library(minifi-execute-process SHARED ${SOURCES})
+
+target_link_libraries(minifi-execute-process ${LIBMINIFI})
+
+register_extension(minifi-execute-process "EXECUTE PROCESS EXTENSION" 
EXECUTE-PROCESS-EXTENSION "This enables execute process support" 
"extensions/execute-process/test")
+
+register_extension_linter(minifi-execute-process-extensions-linter)
diff --git a/extensions/standard-processors/processors/ExecuteProcess.cpp 
b/extensions/execute-process/ExecuteProcess.cpp
similarity index 97%
rename from extensions/standard-processors/processors/ExecuteProcess.cpp
rename to extensions/execute-process/ExecuteProcess.cpp
index 0618507c5..5c93279e6 100644
--- a/extensions/standard-processors/processors/ExecuteProcess.cpp
+++ b/extensions/execute-process/ExecuteProcess.cpp
@@ -17,9 +17,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef WIN32
 #include "ExecuteProcess.h"
+
 #include <array>
+
 #include <memory>
 #include <string>
 #include <iomanip>
@@ -27,7 +28,6 @@
 #include "core/ProcessSession.h"
 #include "core/Resource.h"
 #include "utils/StringUtils.h"
-#include "utils/TimeUtil.h"
 #include "core/TypedValues.h"
 #include "utils/gsl.h"
 #include "utils/Environment.h"
@@ -83,7 +83,7 @@ void ExecuteProcess::executeProcessForkFailed() {
   yield();
 }
 
-void ExecuteProcess::executeChildProcess() {
+void ExecuteProcess::executeChildProcess() const {
   std::vector<char*> argv;
   auto args = readArgs();
   argv.reserve(args.size() + 1);
@@ -110,7 +110,7 @@ void ExecuteProcess::executeChildProcess() {
   exit(0);
 }
 
-void ExecuteProcess::readOutputInBatches(core::ProcessSession& session) {
+void ExecuteProcess::readOutputInBatches(core::ProcessSession& session) const {
   while (true) {
     std::this_thread::sleep_for(batch_duration_);
     std::array<char, 4096> buffer;  // 
NOLINT(cppcoreguidelines-pro-type-member-init)
@@ -148,7 +148,7 @@ bool ExecuteProcess::writeToFlowFile(core::ProcessSession& 
session, std::shared_
   return true;
 }
 
-void ExecuteProcess::readOutput(core::ProcessSession& session) {
+void ExecuteProcess::readOutput(core::ProcessSession& session) const {
   std::array<char, 4096> buffer;  // 
NOLINT(cppcoreguidelines-pro-type-member-init)
   char *buf_ptr = buffer.data();
   size_t read_to_buffer = 0;
@@ -206,7 +206,7 @@ void 
ExecuteProcess::collectChildProcessOutput(core::ProcessSession& session) {
 }
 
 void ExecuteProcess::onTrigger(core::ProcessContext&, core::ProcessSession& 
session) {
-  if (full_command_.length() == 0) {
+  if (full_command_.empty()) {
     yield();
     return;
   }
@@ -238,4 +238,3 @@ void ExecuteProcess::onTrigger(core::ProcessContext&, 
core::ProcessSession& sess
 REGISTER_RESOURCE(ExecuteProcess, Processor);
 
 }  // namespace org::apache::nifi::minifi::processors
-#endif
diff --git a/extensions/standard-processors/processors/ExecuteProcess.h 
b/extensions/execute-process/ExecuteProcess.h
similarity index 94%
rename from extensions/standard-processors/processors/ExecuteProcess.h
rename to extensions/execute-process/ExecuteProcess.h
index 4d1cd4f5c..b5b606a29 100644
--- a/extensions/standard-processors/processors/ExecuteProcess.h
+++ b/extensions/execute-process/ExecuteProcess.h
@@ -17,15 +17,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef WIN32
 #pragma once
 
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <cerrno>
+#include <csignal>
+#include <cstdio>
+
 #include <chrono>
 #include <iostream>
 #include <memory>
@@ -43,13 +43,12 @@
 #include "core/PropertyType.h"
 #include "core/RelationshipDefinition.h"
 #include "FlowFileRecord.h"
-#include "utils/gsl.h"
 
 namespace org::apache::nifi::minifi::processors {
 
 class ExecuteProcess : public core::Processor {
  public:
-  explicit ExecuteProcess(std::string_view name, const utils::Identifier& uuid 
= {})
+  explicit ExecuteProcess(const std::string_view name, const 
utils::Identifier& uuid = {})
       : Processor(name, uuid),
         working_dir_(".") {
   }
@@ -108,10 +107,10 @@ class ExecuteProcess : public core::Processor {
  private:
   std::vector<std::string> readArgs() const;
   void executeProcessForkFailed();
-  void executeChildProcess();
+  void executeChildProcess() const;
   void collectChildProcessOutput(core::ProcessSession& session);
-  void readOutputInBatches(core::ProcessSession& session);
-  void readOutput(core::ProcessSession& session);
+  void readOutputInBatches(core::ProcessSession& session) const;
+  void readOutput(core::ProcessSession& session) const;
   bool writeToFlowFile(core::ProcessSession& session, 
std::shared_ptr<core::FlowFile>& flow_file, std::span<const char> buffer) const;
 
   std::shared_ptr<core::logging::Logger> logger_ = 
core::logging::LoggerFactory<ExecuteProcess>::getLogger(uuid_);
@@ -126,4 +125,3 @@ class ExecuteProcess : public core::Processor {
 };
 
 }  // namespace org::apache::nifi::minifi::processors
-#endif
diff --git a/extensions/execute-process/test/CMakeLists.txt 
b/extensions/execute-process/test/CMakeLists.txt
new file mode 100644
index 000000000..05d5f9348
--- /dev/null
+++ b/extensions/execute-process/test/CMakeLists.txt
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+add_minifi_executable(EchoParameters resource_apps/EchoParameters.cpp)
+set_target_properties(EchoParameters PROPERTIES RUNTIME_OUTPUT_DIRECTORY 
"${CMAKE_BINARY_DIR}/bin")
+
+add_minifi_executable(ExecuteProcessTests ExecuteProcessTests.cpp)
+
+target_link_libraries(ExecuteProcessTests minifi-execute-process 
minifi-standard-processors Catch2WithMain)
+target_include_directories(ExecuteProcessTests PRIVATE BEFORE 
"${CMAKE_SOURCE_DIR}/libminifi/test")
+add_test(NAME ExecuteProcessTests COMMAND ExecuteProcessTests 
WORKING_DIRECTORY ${TEST_DIR})
+createTests(ExecuteProcessTests)
+
+add_dependencies(ExecuteProcessTests EchoParameters)
diff --git a/extensions/standard-processors/tests/unit/ExecuteProcessTests.cpp 
b/extensions/execute-process/test/ExecuteProcessTests.cpp
similarity index 98%
rename from extensions/standard-processors/tests/unit/ExecuteProcessTests.cpp
rename to extensions/execute-process/test/ExecuteProcessTests.cpp
index b6784cbdc..d04b3ef35 100644
--- a/extensions/standard-processors/tests/unit/ExecuteProcessTests.cpp
+++ b/extensions/execute-process/test/ExecuteProcessTests.cpp
@@ -16,9 +16,9 @@
  */
 #include <string>
 
-#include "Catch.h"
-#include "processors/ExecuteProcess.h"
-#include "SingleProcessorTestController.h"
+#include "../test/Catch.h"
+#include "../ExecuteProcess.h"
+#include "../test/SingleProcessorTestController.h"
 #include "utils/file/FileUtils.h"
 
 using namespace std::literals::chrono_literals;
diff --git 
a/extensions/standard-processors/tests/resource_apps/EchoParameters.cpp 
b/extensions/execute-process/test/resource_apps/EchoParameters.cpp
similarity index 100%
rename from 
extensions/standard-processors/tests/resource_apps/EchoParameters.cpp
rename to extensions/execute-process/test/resource_apps/EchoParameters.cpp
diff --git a/extensions/standard-processors/tests/CMakeLists.txt 
b/extensions/standard-processors/tests/CMakeLists.txt
index 6defa1a98..88e5c0dbf 100644
--- a/extensions/standard-processors/tests/CMakeLists.txt
+++ b/extensions/standard-processors/tests/CMakeLists.txt
@@ -23,11 +23,7 @@ enable_coroutines()
 
 file(GLOB PROCESSOR_UNIT_TESTS  "unit/*.cpp")
 file(GLOB PROCESSOR_INTEGRATION_TESTS "integration/*.cpp")
-file(GLOB RESOURCE_APPS "resource_apps/*.cpp")
 
-if (WIN32)
-    list(REMOVE_ITEM PROCESSOR_UNIT_TESTS 
"${CMAKE_CURRENT_SOURCE_DIR}/unit/ExecuteProcessTests.cpp")
-endif()
 SET(PROCESSOR_INT_TEST_COUNT 0)
 
 FOREACH(testfile ${PROCESSOR_UNIT_TESTS})
@@ -81,10 +77,5 @@ add_test(NAME TailFileTest COMMAND TailFileTest 
"${TEST_RESOURCES}/TestTailFile.
 add_test(NAME TailFileCronTest COMMAND TailFileTest 
"${TEST_RESOURCES}/TestTailFileCron.yml"  "${TEST_RESOURCES}/")
 add_test(NAME ProcessGroupTest COMMAND ProcessGroupTest 
"${TEST_RESOURCES}/TestProcessGroup.yml")
 
-FOREACH(resourcefile ${RESOURCE_APPS})
-    get_filename_component(resourcefilename "${resourcefile}" NAME_WE)
-    add_minifi_executable("${resourcefilename}" "${resourcefile}")
-    set_target_properties(${resourcefilename} PROPERTIES 
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
-ENDFOREACH()
 
 copyTestResources(${CMAKE_SOURCE_DIR}/libminifi/test/resources/certs 
${CMAKE_BINARY_DIR}/bin/resources)


Reply via email to