You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sz...@apache.org on 2023/01/05 21:57:17 UTC
[nifi-minifi-cpp] branch main updated (48c4b4964 -> 04da95a7f)
This is an automated email from the ASF dual-hosted git repository.
szaszm pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
from 48c4b4964 MINIFICPP-2023 Fix MacOS and Docker test github environment issues
new a8821be0d MINIFICPP-1940 Remove unused constructor param from FlowConfiguration
new 04da95a7f MINIFICPP-1697 Give a better error message on unsupported algorithms in HashContent
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
controller/Controller.h | 9 ++---
extensions/coap/tests/CoapC2VerifyHeartbeat.cpp | 1 -
extensions/coap/tests/CoapIntegrationBase.h | 4 +--
extensions/http-curl/tests/C2PauseResumeTest.cpp | 4 +--
.../tests/ControllerServiceIntegrationTests.cpp | 4 +--
extensions/http-curl/tests/VerifyInvokeHTTP.h | 2 +-
extensions/sftp/tests/ListSFTPTests.cpp | 1 -
extensions/sftp/tests/ListThenFetchSFTPTests.cpp | 1 -
extensions/sftp/tests/PutSFTPTests.cpp | 1 -
.../standard-processors/processors/HashContent.cpp | 35 +++++++++---------
.../standard-processors/processors/HashContent.h | 2 +-
.../tests/integration/SecureSocketGetTCPTest.cpp | 1 -
.../tests/unit/ControllerServiceTests.cpp | 5 ++-
.../tests/unit/HashContentTest.cpp | 18 ++++++----
.../tests/unit/ProcessGroupTestUtils.h | 1 -
.../tests/unit/YamlConfigurationTests.cpp | 42 ++++++++--------------
.../tests/unit/YamlProcessGroupParserTests.cpp | 2 +-
libminifi/include/core/ConfigurationFactory.h | 17 ++-------
libminifi/include/core/FlowConfiguration.h | 1 -
libminifi/include/core/yaml/YamlConfiguration.h | 1 -
libminifi/test/TestBase.cpp | 1 -
libminifi/test/flow-tests/CustomProcessors.h | 1 -
libminifi/test/flow-tests/FlowControllerTests.cpp | 1 -
libminifi/test/flow-tests/TestControllerWithFlow.h | 5 +--
libminifi/test/integration/IntegrationBase.h | 2 +-
.../test/integration/ProvenanceReportingTest.cpp | 4 +--
.../PersistableKeyValueStoreServiceTest.cpp | 2 +-
.../UnorderedMapKeyValueStoreServiceTest.cpp | 2 +-
libminifi/test/nodefs/NoRocksDB.cpp | 33 -----------------
libminifi/test/nodefs/NoYamlConfiguration.cpp | 36 -------------------
.../test/persistence-tests/PersistenceTests.cpp | 4 +--
libminifi/test/rocksdb-tests/RepoTests.cpp | 2 +-
libminifi/test/sensors-tests/SensorTests.cpp | 1 -
libminifi/test/unit/FileTriggerTests.cpp | 1 -
minifi_main/MiNiFiMain.cpp | 1 -
minifi_main/MiNiFiWindowsService.cpp | 3 +-
nanofi/include/cxx/Instance.h | 15 ++------
37 files changed, 74 insertions(+), 192 deletions(-)
delete mode 100644 libminifi/test/nodefs/NoRocksDB.cpp
delete mode 100644 libminifi/test/nodefs/NoYamlConfiguration.cpp
[nifi-minifi-cpp] 01/02: MINIFICPP-1940 Remove unused constructor param from FlowConfiguration
Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit a8821be0d85d27b87356055f2dc3ab0f32a29af9
Author: Gabor Gyimesi <ga...@gmail.com>
AuthorDate: Thu Jan 5 19:41:33 2023 +0100
MINIFICPP-1940 Remove unused constructor param from FlowConfiguration
Closes #1421
Signed-off-by: Marton Szasz <sz...@apache.org>
---
controller/Controller.h | 9 ++---
extensions/coap/tests/CoapC2VerifyHeartbeat.cpp | 1 -
extensions/coap/tests/CoapIntegrationBase.h | 4 +--
extensions/http-curl/tests/C2PauseResumeTest.cpp | 4 +--
.../tests/ControllerServiceIntegrationTests.cpp | 4 +--
extensions/http-curl/tests/VerifyInvokeHTTP.h | 2 +-
extensions/sftp/tests/ListSFTPTests.cpp | 1 -
extensions/sftp/tests/ListThenFetchSFTPTests.cpp | 1 -
extensions/sftp/tests/PutSFTPTests.cpp | 1 -
.../tests/integration/SecureSocketGetTCPTest.cpp | 1 -
.../tests/unit/ControllerServiceTests.cpp | 5 ++-
.../tests/unit/ProcessGroupTestUtils.h | 1 -
.../tests/unit/YamlConfigurationTests.cpp | 42 ++++++++--------------
.../tests/unit/YamlProcessGroupParserTests.cpp | 2 +-
libminifi/include/core/ConfigurationFactory.h | 17 ++-------
libminifi/include/core/FlowConfiguration.h | 1 -
libminifi/include/core/yaml/YamlConfiguration.h | 1 -
libminifi/test/TestBase.cpp | 1 -
libminifi/test/flow-tests/CustomProcessors.h | 1 -
libminifi/test/flow-tests/FlowControllerTests.cpp | 1 -
libminifi/test/flow-tests/TestControllerWithFlow.h | 5 +--
libminifi/test/integration/IntegrationBase.h | 2 +-
.../test/integration/ProvenanceReportingTest.cpp | 4 +--
.../PersistableKeyValueStoreServiceTest.cpp | 2 +-
.../UnorderedMapKeyValueStoreServiceTest.cpp | 2 +-
libminifi/test/nodefs/NoRocksDB.cpp | 33 -----------------
libminifi/test/nodefs/NoYamlConfiguration.cpp | 36 -------------------
.../test/persistence-tests/PersistenceTests.cpp | 4 +--
libminifi/test/rocksdb-tests/RepoTests.cpp | 2 +-
libminifi/test/sensors-tests/SensorTests.cpp | 1 -
libminifi/test/unit/FileTriggerTests.cpp | 1 -
minifi_main/MiNiFiMain.cpp | 1 -
minifi_main/MiNiFiWindowsService.cpp | 3 +-
nanofi/include/cxx/Instance.h | 15 ++------
34 files changed, 45 insertions(+), 166 deletions(-)
diff --git a/controller/Controller.h b/controller/Controller.h
index dd5c4119c..8a7caf4a5 100644
--- a/controller/Controller.h
+++ b/controller/Controller.h
@@ -15,8 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef CONTROLLER_CONTROLLER_H_
-#define CONTROLLER_CONTROLLER_H_
+#pragma once
#include <memory>
@@ -280,7 +279,7 @@ std::shared_ptr<org::apache::nifi::minifi::core::controller::ControllerService>
const auto stream_factory = org::apache::nifi::minifi::io::StreamFactory::getInstance(configuration);
auto flow_configuration = org::apache::nifi::minifi::core::createFlowConfiguration(
- org::apache::nifi::minifi::core::ConfigurationContext{prov_repo, flow_repo, content_repo, stream_factory, configuration}, nifi_configuration_class_name);
+ org::apache::nifi::minifi::core::ConfigurationContext{flow_repo, content_repo, stream_factory, configuration}, nifi_configuration_class_name);
const auto controller = std::make_unique<org::apache::nifi::minifi::FlowController>(prov_repo, flow_repo, configuration, std::move(flow_configuration), content_repo);
controller->load();
@@ -341,7 +340,7 @@ void printManifest(const std::shared_ptr<org::apache::nifi::minifi::Configure> &
const auto stream_factory = org::apache::nifi::minifi::io::StreamFactory::getInstance(configuration);
auto flow_configuration = org::apache::nifi::minifi::core::createFlowConfiguration(
- org::apache::nifi::minifi::core::ConfigurationContext{prov_repo, flow_repo, content_repo, stream_factory, configuration}, nifi_configuration_class_name);
+ org::apache::nifi::minifi::core::ConfigurationContext{flow_repo, content_repo, stream_factory, configuration}, nifi_configuration_class_name);
const auto controller = std::make_unique<org::apache::nifi::minifi::FlowController>(prov_repo, flow_repo, configuration, std::move(flow_configuration), content_repo, "manifest");
controller->load();
@@ -349,5 +348,3 @@ void printManifest(const std::shared_ptr<org::apache::nifi::minifi::Configure> &
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
controller->stop();
}
-
-#endif /* CONTROLLER_CONTROLLER_H_ */
diff --git a/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp b/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp
index 703f5cff3..23007e233 100644
--- a/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp
+++ b/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp
@@ -37,7 +37,6 @@
#include "core/Core.h"
#include "core/logging/Logger.h"
#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
#include "FlowController.h"
#include "properties/Configure.h"
#include "unit/ProvenanceTestHelper.h"
diff --git a/extensions/coap/tests/CoapIntegrationBase.h b/extensions/coap/tests/CoapIntegrationBase.h
index 755e6fc7d..10ef89fd8 100644
--- a/extensions/coap/tests/CoapIntegrationBase.h
+++ b/extensions/coap/tests/CoapIntegrationBase.h
@@ -64,9 +64,9 @@ class CoapIntegrationBase : public IntegrationBase {
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
content_repo->initialize(configuration);
std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration);
- auto yaml_ptr = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location});
+ auto yaml_ptr = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, test_file_location});
- core::YamlConfiguration yaml_config({test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location});
+ core::YamlConfiguration yaml_config({test_repo, content_repo, stream_factory, configuration, test_file_location});
std::shared_ptr<core::ProcessGroup> pg{ yaml_config.getRoot() };
diff --git a/extensions/http-curl/tests/C2PauseResumeTest.cpp b/extensions/http-curl/tests/C2PauseResumeTest.cpp
index 147bbdf05..6f0bfbc81 100644
--- a/extensions/http-curl/tests/C2PauseResumeTest.cpp
+++ b/extensions/http-curl/tests/C2PauseResumeTest.cpp
@@ -134,13 +134,13 @@ int main(int argc, char **argv) {
content_repo->initialize(configuration);
std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::make_unique<core::YamlConfiguration>(
- core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, args.test_file});
+ core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, args.test_file});
std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(
test_repo, test_flow_repo, configuration, std::move(yaml_ptr), content_repo, DEFAULT_ROOT_GROUP_NAME,
std::make_shared<utils::file::FileSystem>(), []{});
- core::YamlConfiguration yaml_config({test_repo, test_repo, content_repo, stream_factory, configuration, args.test_file});
+ core::YamlConfiguration yaml_config({test_repo, content_repo, stream_factory, configuration, args.test_file});
auto root = yaml_config.getRoot();
const auto proc = root->findProcessorByName("invoke");
diff --git a/extensions/http-curl/tests/ControllerServiceIntegrationTests.cpp b/extensions/http-curl/tests/ControllerServiceIntegrationTests.cpp
index 59a408552..ccd910b1b 100644
--- a/extensions/http-curl/tests/ControllerServiceIntegrationTests.cpp
+++ b/extensions/http-curl/tests/ControllerServiceIntegrationTests.cpp
@@ -68,7 +68,7 @@ int main(int argc, char **argv) {
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
content_repo->initialize(configuration);
std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::make_unique<core::YamlConfiguration>(
- core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, args.test_file});
+ core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, args.test_file});
const auto controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
content_repo,
@@ -79,7 +79,7 @@ int main(int argc, char **argv) {
disabled = false;
std::shared_ptr<core::controller::ControllerServiceMap> map = std::make_shared<core::controller::ControllerServiceMap>();
- core::YamlConfiguration yaml_config({test_repo, test_repo, content_repo, stream_factory, configuration, args.test_file});
+ core::YamlConfiguration yaml_config({test_repo, content_repo, stream_factory, configuration, args.test_file});
auto pg = yaml_config.getRoot();
diff --git a/extensions/http-curl/tests/VerifyInvokeHTTP.h b/extensions/http-curl/tests/VerifyInvokeHTTP.h
index 5b917ddb5..31b83e207 100644
--- a/extensions/http-curl/tests/VerifyInvokeHTTP.h
+++ b/extensions/http-curl/tests/VerifyInvokeHTTP.h
@@ -91,7 +91,7 @@ class VerifyInvokeHTTP : public HTTPIntegrationBase {
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
content_repo->initialize(configuration);
std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration);
- auto yaml_ptr = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, flow_yml_path});
+ auto yaml_ptr = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, flow_yml_path});
flowController_ = std::make_unique<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr), content_repo, DEFAULT_ROOT_GROUP_NAME);
flowController_->load();
diff --git a/extensions/sftp/tests/ListSFTPTests.cpp b/extensions/sftp/tests/ListSFTPTests.cpp
index f95e5e494..68faaab04 100644
--- a/extensions/sftp/tests/ListSFTPTests.cpp
+++ b/extensions/sftp/tests/ListSFTPTests.cpp
@@ -44,7 +44,6 @@
#include "core/Core.h"
#include "core/logging/Logger.h"
#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
#include "FlowController.h"
#include "properties/Configure.h"
#include "unit/ProvenanceTestHelper.h"
diff --git a/extensions/sftp/tests/ListThenFetchSFTPTests.cpp b/extensions/sftp/tests/ListThenFetchSFTPTests.cpp
index b721bced7..3732d12bd 100644
--- a/extensions/sftp/tests/ListThenFetchSFTPTests.cpp
+++ b/extensions/sftp/tests/ListThenFetchSFTPTests.cpp
@@ -41,7 +41,6 @@
#include "core/Core.h"
#include "core/logging/Logger.h"
#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
#include "FlowController.h"
#include "properties/Configure.h"
#include "unit/ProvenanceTestHelper.h"
diff --git a/extensions/sftp/tests/PutSFTPTests.cpp b/extensions/sftp/tests/PutSFTPTests.cpp
index 8ce63f386..2eceb6fca 100644
--- a/extensions/sftp/tests/PutSFTPTests.cpp
+++ b/extensions/sftp/tests/PutSFTPTests.cpp
@@ -46,7 +46,6 @@
#include "core/Core.h"
#include "core/logging/Logger.h"
#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
#include "FlowController.h"
#include "properties/Configure.h"
#include "unit/ProvenanceTestHelper.h"
diff --git a/extensions/standard-processors/tests/integration/SecureSocketGetTCPTest.cpp b/extensions/standard-processors/tests/integration/SecureSocketGetTCPTest.cpp
index dc28b261b..4dc638c5b 100644
--- a/extensions/standard-processors/tests/integration/SecureSocketGetTCPTest.cpp
+++ b/extensions/standard-processors/tests/integration/SecureSocketGetTCPTest.cpp
@@ -37,7 +37,6 @@
#include "core/Core.h"
#include "core/logging/Logger.h"
#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
#include "FlowController.h"
#include "properties/Configure.h"
#include "unit/ProvenanceTestHelper.h"
diff --git a/extensions/standard-processors/tests/unit/ControllerServiceTests.cpp b/extensions/standard-processors/tests/unit/ControllerServiceTests.cpp
index 144be64f6..d0dd87b33 100644
--- a/extensions/standard-processors/tests/unit/ControllerServiceTests.cpp
+++ b/extensions/standard-processors/tests/unit/ControllerServiceTests.cpp
@@ -28,7 +28,6 @@
#include "core/FlowFile.h"
#include "unit/MockClasses.h"
#include "unit/ProvenanceTestHelper.h"
-#include "core/yaml/YamlConfiguration.h"
#include "core/Processor.h"
#include "core/controller/ControllerServiceMap.h"
#include "core/controller/StandardControllerServiceNode.h"
@@ -37,7 +36,7 @@ namespace ControllerServiceTests {
TEST_CASE("Test ControllerServicesMap", "[cs1]") {
core::controller::ControllerServiceMap map;
- REQUIRE(0 == map.getAllControllerServices().size());
+ REQUIRE(map.getAllControllerServices().empty());
std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, "ID", std::make_shared<minifi::Configure>());
@@ -67,7 +66,7 @@ TEST_CASE("Test StandardControllerServiceNode nullPtr", "[cs1]") {
FAIL("Should have encountered exception");
}
-std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(const std::string id) {
+std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(const std::string& id) {
std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, id, std::make_shared<minifi::Configure>());
diff --git a/extensions/standard-processors/tests/unit/ProcessGroupTestUtils.h b/extensions/standard-processors/tests/unit/ProcessGroupTestUtils.h
index bb9d1673b..39694e812 100644
--- a/extensions/standard-processors/tests/unit/ProcessGroupTestUtils.h
+++ b/extensions/standard-processors/tests/unit/ProcessGroupTestUtils.h
@@ -25,7 +25,6 @@
#include "TestBase.h"
#include "Catch.h"
-#include "YamlConfiguration.h"
#include "Utils.h"
struct Lines {
diff --git a/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp b/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
index e9c9fd4bf..b14ee1f83 100644
--- a/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
+++ b/extensions/standard-processors/tests/unit/YamlConfigurationTests.cpp
@@ -34,12 +34,11 @@ using namespace std::literals::chrono_literals;
TEST_CASE("Test YAML Config Processing", "[YamlConfiguration]") {
TestController test_controller;
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
SECTION("loading YAML without optional component IDs works") {
static const std::string CONFIG_YAML_WITHOUT_IDS =
@@ -225,12 +224,11 @@ Provenance Reporting:
TEST_CASE("Test YAML v3 Invalid Type", "[YamlConfiguration3]") {
TestController test_controller;
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
static const std::string TEST_CONFIG_YAML =
R"(
@@ -351,12 +349,11 @@ NiFi Properties Overrides: {}
TEST_CASE("Test YAML v3 Config Processing", "[YamlConfiguration3]") {
TestController test_controller;
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
static const std::string TEST_CONFIG_YAML =
R"(
@@ -505,12 +502,11 @@ TEST_CASE("Test Dynamic Unsupported", "[YamlConfigurationDynamicUnsupported]") {
logTestController.setDebug<TestPlan>();
logTestController.setTrace<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
static const std::string TEST_CONFIG_YAML = R"(
Flow Controller:
@@ -541,12 +537,11 @@ TEST_CASE("Test Required Property", "[YamlConfigurationRequiredProperty]") {
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
static const std::string TEST_CONFIG_YAML = R"(
Flow Controller:
@@ -586,12 +581,11 @@ TEST_CASE("Test Required Property 2", "[YamlConfigurationRequiredProperty2]") {
logTestController.setDebug<core::YamlConfiguration>();
logTestController.setDebug<core::Processor>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
static const std::string TEST_CONFIG_YAML = R"(
Flow Controller:
@@ -635,12 +629,11 @@ TEST_CASE("Test Dependent Property", "[YamlConfigurationDependentProperty]") {
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
const auto component = std::make_shared<DummyComponent>();
component->setSupportedProperties(std::array{
core::Property("Prop A", "Prop A desc", "val A", true, "", { }, { }),
@@ -657,12 +650,11 @@ TEST_CASE("Test Dependent Property 2", "[YamlConfigurationDependentProperty2]")
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
const auto component = std::make_shared<DummyComponent>();
component->setSupportedProperties(std::array{
core::Property("Prop A", "Prop A desc", "", false, "", { }, { }),
@@ -686,12 +678,11 @@ TEST_CASE("Test Exclusive Property", "[YamlConfigurationExclusiveProperty]") {
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
const auto component = std::make_shared<DummyComponent>();
component->setSupportedProperties(std::array{
core::Property("Prop A", "Prop A desc", "val A", true, "", { }, { }),
@@ -706,12 +697,11 @@ TEST_CASE("Test Regex Property", "[YamlConfigurationRegexProperty]") {
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
const auto component = std::make_shared<DummyComponent>();
component->setSupportedProperties(std::array{
core::Property("Prop A", "Prop A desc", "val A", true, "", { }, { }),
@@ -727,12 +717,11 @@ TEST_CASE("Test Exclusive Property 2", "[YamlConfigurationExclusiveProperty2]")
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
const auto component = std::make_shared<DummyComponent>();
component->setSupportedProperties(std::array{
core::Property("Prop A", "Prop A desc", "val A", true, "", { }, { }),
@@ -755,12 +744,11 @@ TEST_CASE("Test Regex Property 2", "[YamlConfigurationRegexProperty2]") {
LogTestController &logTestController = LogTestController::getInstance();
logTestController.setDebug<TestPlan>();
logTestController.setDebug<core::YamlConfiguration>();
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
const auto component = std::make_shared<DummyComponent>();
component->setSupportedProperties(std::array{
core::Property("Prop A", "Prop A desc", "val A", true, "", { }, { }),
@@ -781,12 +769,11 @@ TEST_CASE("Test Regex Property 2", "[YamlConfigurationRegexProperty2]") {
TEST_CASE("Test YAML Config With Funnel", "[YamlConfiguration]") {
TestController test_controller;
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> streamFactory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yamlConfig({testProvRepo, testFlowFileRepo, content_repo, streamFactory, configuration});
+ core::YamlConfiguration yamlConfig({testFlowFileRepo, content_repo, streamFactory, configuration});
static const std::string CONFIG_YAML_WITH_FUNNEL =
R"(
@@ -872,12 +859,11 @@ Remote Process Groups: []
TEST_CASE("Test UUID duplication checks", "[YamlConfiguration]") {
TestController test_controller;
- std::shared_ptr<core::Repository> test_prov_repo = core::createRepository("provenancerepository");
std::shared_ptr<core::Repository> test_flow_file_repo = core::createRepository("flowfilerepository");
std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
- core::YamlConfiguration yaml_config({test_prov_repo, test_flow_file_repo, content_repo, stream_factory, configuration});
+ core::YamlConfiguration yaml_config({test_flow_file_repo, content_repo, stream_factory, configuration});
for (char i = '1'; i <= '8'; ++i) {
DYNAMIC_SECTION("Changing UUID 00000000-0000-0000-0000-00000000000" << i << " to be a duplicate") {
diff --git a/extensions/standard-processors/tests/unit/YamlProcessGroupParserTests.cpp b/extensions/standard-processors/tests/unit/YamlProcessGroupParserTests.cpp
index 4ad98d747..d60a97671 100644
--- a/extensions/standard-processors/tests/unit/YamlProcessGroupParserTests.cpp
+++ b/extensions/standard-processors/tests/unit/YamlProcessGroupParserTests.cpp
@@ -22,7 +22,7 @@
#include "IntegrationTestUtils.h"
#include "ProcessGroupTestUtils.h"
-static core::YamlConfiguration config({nullptr, nullptr, nullptr, nullptr, std::make_shared<minifi::Configure>()});
+static core::YamlConfiguration config({nullptr, nullptr, nullptr, std::make_shared<minifi::Configure>()});
TEST_CASE("Root process group is correctly parsed", "[YamlProcessGroupParser]") {
auto pattern = Group("root")
diff --git a/libminifi/include/core/ConfigurationFactory.h b/libminifi/include/core/ConfigurationFactory.h
index c3efee5e1..2e86bfb32 100644
--- a/libminifi/include/core/ConfigurationFactory.h
+++ b/libminifi/include/core/ConfigurationFactory.h
@@ -16,8 +16,7 @@
* limitations under the License.
*/
-#ifndef LIBMINIFI_INCLUDE_CORE_CONFIGURATIONFACTORY_H_
-#define LIBMINIFI_INCLUDE_CORE_CONFIGURATIONFACTORY_H_
+#pragma once
#include <memory>
#include <optional>
@@ -27,11 +26,7 @@
#include "FlowConfiguration.h"
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
-namespace core {
+namespace org::apache::nifi::minifi::core {
template<typename T>
T* instantiate(ConfigurationContext ctx) {
@@ -44,10 +39,4 @@ T* instantiate(ConfigurationContext ctx) {
*/
std::unique_ptr<core::FlowConfiguration> createFlowConfiguration(const ConfigurationContext& ctx, const std::optional<std::string>& configuration_class_name, bool fail_safe = false);
-} // namespace core
-} // namespace minifi
-} // namespace nifi
-} // namespace apache
-} // namespace org
-
-#endif // LIBMINIFI_INCLUDE_CORE_CONFIGURATIONFACTORY_H_
+} // namespace org::apache::nifi::minifi::core
diff --git a/libminifi/include/core/FlowConfiguration.h b/libminifi/include/core/FlowConfiguration.h
index 4039d7224..f58aea588 100644
--- a/libminifi/include/core/FlowConfiguration.h
+++ b/libminifi/include/core/FlowConfiguration.h
@@ -53,7 +53,6 @@ class static_initializers {
extern static_initializers &get_static_functions();
struct ConfigurationContext {
- std::shared_ptr<core::Repository> repo;
std::shared_ptr<core::Repository> flow_file_repo;
std::shared_ptr<core::ContentRepository> content_repo;
std::shared_ptr<io::StreamFactory> stream_factory;
diff --git a/libminifi/include/core/yaml/YamlConfiguration.h b/libminifi/include/core/yaml/YamlConfiguration.h
index 996608dcf..2b4a9d7d4 100644
--- a/libminifi/include/core/yaml/YamlConfiguration.h
+++ b/libminifi/include/core/yaml/YamlConfiguration.h
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#pragma once
#include <memory>
diff --git a/libminifi/test/TestBase.cpp b/libminifi/test/TestBase.cpp
index 50517b3ac..715378dd0 100644
--- a/libminifi/test/TestBase.cpp
+++ b/libminifi/test/TestBase.cpp
@@ -24,7 +24,6 @@
#include <sstream>
#include <utility>
-#include "core/FlowConfiguration.h"
#include "core/Processor.h"
#include "core/ProcessContextBuilder.h"
#include "core/logging/LoggerConfiguration.h"
diff --git a/libminifi/test/flow-tests/CustomProcessors.h b/libminifi/test/flow-tests/CustomProcessors.h
index 803d39350..a08d8931b 100644
--- a/libminifi/test/flow-tests/CustomProcessors.h
+++ b/libminifi/test/flow-tests/CustomProcessors.h
@@ -24,7 +24,6 @@
#include <unordered_map>
#include <utility>
-#include <YamlConfiguration.h>
#include "core/Processor.h"
#include "TestBase.h"
#include "Catch.h"
diff --git a/libminifi/test/flow-tests/FlowControllerTests.cpp b/libminifi/test/flow-tests/FlowControllerTests.cpp
index 8087da65c..464b12d2f 100644
--- a/libminifi/test/flow-tests/FlowControllerTests.cpp
+++ b/libminifi/test/flow-tests/FlowControllerTests.cpp
@@ -32,7 +32,6 @@
#include "../unit/ProvenanceTestHelper.h"
#include "../TestBase.h"
#include "../Catch.h"
-#include "YamlConfiguration.h"
#include "CustomProcessors.h"
#include "TestControllerWithFlow.h"
#include "EmptyFlow.h"
diff --git a/libminifi/test/flow-tests/TestControllerWithFlow.h b/libminifi/test/flow-tests/TestControllerWithFlow.h
index 684d71988..7cd5d3e23 100644
--- a/libminifi/test/flow-tests/TestControllerWithFlow.h
+++ b/libminifi/test/flow-tests/TestControllerWithFlow.h
@@ -24,10 +24,11 @@
#include "FlowController.h"
#include "unit/ProvenanceTestHelper.h"
+#include "core/yaml/YamlConfiguration.h"
#include "repository/VolatileContentRepository.h"
#include "CustomProcessors.h"
-class TestControllerWithFlow: public TestController{
+class TestControllerWithFlow: public TestController {
public:
explicit TestControllerWithFlow(const char* yamlConfigContent, bool setup_flow = true) {
LogTestController::getInstance().setTrace<minifi::processors::TestProcessor>();
@@ -63,7 +64,7 @@ class TestControllerWithFlow: public TestController{
REQUIRE(content_repo->initialize(configuration_));
std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration_);
- auto flow = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{prov_repo, ff_repo, content_repo, stream_factory, configuration_, yaml_path_.string()});
+ auto flow = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{ff_repo, content_repo, stream_factory, configuration_, yaml_path_.string()});
auto root = flow->getRoot();
root_ = root.get();
controller_ = std::make_shared<minifi::FlowController>(
diff --git a/libminifi/test/integration/IntegrationBase.h b/libminifi/test/integration/IntegrationBase.h
index 90b20e627..2b674546b 100644
--- a/libminifi/test/integration/IntegrationBase.h
+++ b/libminifi/test/integration/IntegrationBase.h
@@ -174,7 +174,7 @@ void IntegrationBase::run(const std::optional<std::filesystem::path>& test_file_
filesystem = std::make_shared<utils::file::FileSystem>();
}
- auto flow_config = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location, filesystem});
+ auto flow_config = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, test_file_location, filesystem});
auto controller_service_provider = flow_config->getControllerServiceProvider();
char state_dir_name_template[] = "/var/tmp/integrationstate.XXXXXX";
diff --git a/libminifi/test/integration/ProvenanceReportingTest.cpp b/libminifi/test/integration/ProvenanceReportingTest.cpp
index 5344722ff..8457c5146 100644
--- a/libminifi/test/integration/ProvenanceReportingTest.cpp
+++ b/libminifi/test/integration/ProvenanceReportingTest.cpp
@@ -57,13 +57,13 @@ int main(int argc, char **argv) {
std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration);
std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::make_unique<core::YamlConfiguration>(
- core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location});
+ core::ConfigurationContext{ test_repo, content_repo, stream_factory, configuration, test_file_location});
const auto controller = std::make_shared<minifi::FlowController>(
test_repo, test_flow_repo, configuration, std::move(yaml_ptr), content_repo, DEFAULT_ROOT_GROUP_NAME,
std::make_shared<utils::file::FileSystem>(), []{});
- core::YamlConfiguration yaml_config({test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location});
+ core::YamlConfiguration yaml_config({test_repo, content_repo, stream_factory, configuration, test_file_location});
std::shared_ptr<core::ProcessGroup> pg = yaml_config.getRoot();
std::shared_ptr<org::apache::nifi::minifi::io::SocketContext> socket_context = std::make_shared<org::apache::nifi::minifi::io::SocketContext>(std::make_shared<minifi::Configure>());
diff --git a/libminifi/test/keyvalue-tests/PersistableKeyValueStoreServiceTest.cpp b/libminifi/test/keyvalue-tests/PersistableKeyValueStoreServiceTest.cpp
index e3797479c..33e02d913 100644
--- a/libminifi/test/keyvalue-tests/PersistableKeyValueStoreServiceTest.cpp
+++ b/libminifi/test/keyvalue-tests/PersistableKeyValueStoreServiceTest.cpp
@@ -95,7 +95,7 @@ class PersistableKeyValueStoreServiceTestsFixture {
content_repo->initialize(configuration);
stream_factory = minifi::io::StreamFactory::getInstance(configuration);
- yaml_config = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, config_yaml});
+ yaml_config = std::make_unique<core::YamlConfiguration>(core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, config_yaml});
process_group = yaml_config->getRoot();
persistable_key_value_store_service_node = process_group->findControllerService("testcontroller");
diff --git a/libminifi/test/keyvalue-tests/UnorderedMapKeyValueStoreServiceTest.cpp b/libminifi/test/keyvalue-tests/UnorderedMapKeyValueStoreServiceTest.cpp
index 5058ebebc..6f0dc9f45 100644
--- a/libminifi/test/keyvalue-tests/UnorderedMapKeyValueStoreServiceTest.cpp
+++ b/libminifi/test/keyvalue-tests/UnorderedMapKeyValueStoreServiceTest.cpp
@@ -89,7 +89,7 @@ class UnorderedMapKeyValueStoreServiceTestFixture {
std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration);
std::unique_ptr<core::YamlConfiguration> yaml_config = std::make_unique<core::YamlConfiguration>(
- core::ConfigurationContext{test_repo, test_repo, content_repo, stream_factory, configuration, config_yaml});
+ core::ConfigurationContext{test_repo, content_repo, stream_factory, configuration, config_yaml});
std::unique_ptr<core::ProcessGroup> process_group;
std::shared_ptr<core::controller::ControllerServiceNode> key_value_store_service_node;
diff --git a/libminifi/test/nodefs/NoRocksDB.cpp b/libminifi/test/nodefs/NoRocksDB.cpp
deleted file mode 100644
index 7990ce0c5..000000000
--- a/libminifi/test/nodefs/NoRocksDB.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <memory>
-
-#include "core/Core.h"
-#include "core/RepositoryFactory.h"
-#include "../TestBase.h"
-
-TEST_CASE("NoRocksDBTest1", "[NoRocksDBTest]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository("provenancerepository", true);
- REQUIRE(nullptr != prov_repo);
-}
-
-TEST_CASE("NoRocksDBTest2", "[NoRocksDBTest]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository("flowfilerepository", true);
- REQUIRE(nullptr != prov_repo);
-}
diff --git a/libminifi/test/nodefs/NoYamlConfiguration.cpp b/libminifi/test/nodefs/NoYamlConfiguration.cpp
deleted file mode 100644
index bf3a24124..000000000
--- a/libminifi/test/nodefs/NoYamlConfiguration.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <memory>
-
-#include "core/ConfigurationFactory.h"
-#include "core/Core.h"
-#include "core/RepositoryFactory.h"
-
-TEST_CASE("NoYamlSupport1", "[NoYamlSupport1]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository(
- "provenancerepository", true);
- REQUIRE(nullptr != prov_repo);
- std::unique_ptr<core::FlowConfiguration> flow_configuration = std::move(
- core::createFlowConfiguration(
- prov_repo, prov_repo, std::make_shared<minifi::Configure>(), std::make_shared<minifi::io::StreamFactory>(false),
- "yamlconfiguration"));
-
- REQUIRE(nullptr != flow_configuration);
-}
-
diff --git a/libminifi/test/persistence-tests/PersistenceTests.cpp b/libminifi/test/persistence-tests/PersistenceTests.cpp
index 0dcbb4c40..ef24382fa 100644
--- a/libminifi/test/persistence-tests/PersistenceTests.cpp
+++ b/libminifi/test/persistence-tests/PersistenceTests.cpp
@@ -184,7 +184,7 @@ TEST_CASE("Processors Can Store FlowFiles", "[TestP1]") {
ff_repository->initialize(config);
content_repo->initialize(config);
- auto flowConfig = std::make_unique<core::FlowConfiguration>(core::ConfigurationContext{prov_repo, ff_repository, content_repo, nullptr, config, ""});
+ auto flowConfig = std::make_unique<core::FlowConfiguration>(core::ConfigurationContext{ff_repository, content_repo, nullptr, config, ""});
auto flowController = std::make_shared<minifi::FlowController>(
prov_repo, ff_repository, config, std::move(flowConfig), content_repo, "", std::make_shared<utils::file::FileSystem>(), []{});
@@ -304,7 +304,7 @@ TEST_CASE("Persisted flowFiles are updated on modification", "[TestP1]") {
ff_repository->initialize(config);
content_repo->initialize(config);
- auto flowConfig = std::make_unique<core::FlowConfiguration>(core::ConfigurationContext{prov_repo, ff_repository, content_repo, nullptr, config, ""});
+ auto flowConfig = std::make_unique<core::FlowConfiguration>(core::ConfigurationContext{ff_repository, content_repo, nullptr, config, ""});
auto flowController = std::make_shared<minifi::FlowController>(
prov_repo, ff_repository, config, std::move(flowConfig), content_repo, "", std::make_shared<utils::file::FileSystem>(), []{});
diff --git a/libminifi/test/rocksdb-tests/RepoTests.cpp b/libminifi/test/rocksdb-tests/RepoTests.cpp
index 520c0629d..7b9048616 100644
--- a/libminifi/test/rocksdb-tests/RepoTests.cpp
+++ b/libminifi/test/rocksdb-tests/RepoTests.cpp
@@ -297,7 +297,7 @@ TEST_CASE("Test FlowFile Restore", "[TestFFR6]") {
auto inputPtr = input.get();
root->addConnection(std::move(input));
- auto flowConfig = std::make_unique<core::FlowConfiguration>(core::ConfigurationContext{prov_repo, ff_repository, content_repo, nullptr, config, ""});
+ auto flowConfig = std::make_unique<core::FlowConfiguration>(core::ConfigurationContext{ff_repository, content_repo, nullptr, config, ""});
auto flowController = std::make_shared<minifi::FlowController>(
prov_repo, ff_repository, config, std::move(flowConfig), content_repo, "", std::make_shared<utils::file::FileSystem>(), []{});
diff --git a/libminifi/test/sensors-tests/SensorTests.cpp b/libminifi/test/sensors-tests/SensorTests.cpp
index d4432b26e..94d34b390 100644
--- a/libminifi/test/sensors-tests/SensorTests.cpp
+++ b/libminifi/test/sensors-tests/SensorTests.cpp
@@ -34,7 +34,6 @@
#include "core/Core.h"
#include "core/logging/Logger.h"
#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
#include "FlowController.h"
#include "properties/Configure.h"
#include "../unit/ProvenanceTestHelper.h"
diff --git a/libminifi/test/unit/FileTriggerTests.cpp b/libminifi/test/unit/FileTriggerTests.cpp
index 1486d10aa..f73a87575 100644
--- a/libminifi/test/unit/FileTriggerTests.cpp
+++ b/libminifi/test/unit/FileTriggerTests.cpp
@@ -25,7 +25,6 @@
#include "io/ClientSocket.h"
#include "core/Processor.h"
#include "core/ClassLoader.h"
-#include "core/yaml/YamlConfiguration.h"
TEST_CASE("Empty file", "[t1]") {
minifi::c2::FileUpdateTrigger trigger("test");
diff --git a/minifi_main/MiNiFiMain.cpp b/minifi_main/MiNiFiMain.cpp
index a9ef41bab..2070b8a06 100644
--- a/minifi_main/MiNiFiMain.cpp
+++ b/minifi_main/MiNiFiMain.cpp
@@ -357,7 +357,6 @@ int main(int argc, char **argv) {
std::unique_ptr<core::FlowConfiguration> flow_configuration = core::createFlowConfiguration(
core::ConfigurationContext{
- .repo = prov_repo,
.flow_file_repo = flow_repo,
.content_repo = content_repo,
.stream_factory = stream_factory,
diff --git a/minifi_main/MiNiFiWindowsService.cpp b/minifi_main/MiNiFiWindowsService.cpp
index e11e0abda..42b4b6d39 100644
--- a/minifi_main/MiNiFiWindowsService.cpp
+++ b/minifi_main/MiNiFiWindowsService.cpp
@@ -25,7 +25,6 @@
#include <tlhelp32.h>
#include "MainHelper.h"
-#include "core/FlowConfiguration.h"
namespace minifi = org::apache::nifi::minifi;
@@ -226,7 +225,7 @@ void RunAsServiceIfNeeded() {
if (!SetServiceStatus(s_statusHandle, &s_serviceStatus)) {
Log()->log_error("!SetServiceStatus SERVICE_STOPPED lastError %x", GetLastError());
}
- }
+ }
},
{0, 0}
};
diff --git a/nanofi/include/cxx/Instance.h b/nanofi/include/cxx/Instance.h
index 40d0f039f..f9e42bd9a 100644
--- a/nanofi/include/cxx/Instance.h
+++ b/nanofi/include/cxx/Instance.h
@@ -15,8 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef LIBMINIFI_INCLUDE_CAPI_INSTANCE_H_
-#define LIBMINIFI_INCLUDE_CAPI_INSTANCE_H_
+#pragma once
#include <memory>
#include <type_traits>
@@ -38,17 +37,13 @@
#include "core/ProcessSession.h"
#include "core/ProcessSessionFactory.h"
#include "core/controller/ControllerServiceProvider.h"
-#include "core/FlowConfiguration.h"
#include "ReflexiveSession.h"
#include "utils/ThreadPool.h"
#include "core/state/UpdateController.h"
#include "core/file_utils.h"
#include "core/extension/ExtensionManager.h"
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
+namespace org::apache::nifi::minifi {
class ProcessorLink {
public:
@@ -177,8 +172,4 @@ class Instance {
utils::ThreadPool<utils::TaskRescheduleInfo> listener_thread_pool_;
};
-} /* namespace minifi */
-} /* namespace nifi */
-} /* namespace apache */
-} /* namespace org */
-#endif /* LIBMINIFI_INCLUDE_CAPI_INSTANCE_H_ */
+} // namespace org::apache::nifi::minifi
[nifi-minifi-cpp] 02/02: MINIFICPP-1697 Give a better error message on unsupported algorithms in HashContent
Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 04da95a7f24ea698fcb8d17bb0e08dd777aff774
Author: Martin Zink <ma...@apache.org>
AuthorDate: Thu Jan 5 19:42:18 2023 +0100
MINIFICPP-1697 Give a better error message on unsupported algorithms in HashContent
Closes #1479
Signed-off-by: Marton Szasz <sz...@apache.org>
---
.../standard-processors/processors/HashContent.cpp | 35 ++++++++++------------
.../standard-processors/processors/HashContent.h | 2 +-
.../tests/unit/HashContentTest.cpp | 18 +++++++----
3 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/extensions/standard-processors/processors/HashContent.cpp b/extensions/standard-processors/processors/HashContent.cpp
index 3c6ecfb79..3852ff542 100644
--- a/extensions/standard-processors/processors/HashContent.cpp
+++ b/extensions/standard-processors/processors/HashContent.cpp
@@ -32,6 +32,8 @@
#include "core/FlowFile.h"
#include "core/Resource.h"
+#include "range/v3/view.hpp"
+
namespace org::apache::nifi::minifi::processors {
const core::Property HashContent::HashAttribute("Hash Attribute", "Attribute to store checksum to", "Checksum");
@@ -47,21 +49,20 @@ void HashContent::initialize() {
}
void HashContent::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory* /*sessionFactory*/) {
- std::string value;
-
- attrKey_ = (context->getProperty(HashAttribute.getName(), value)) ? value : "Checksum";
- algoName_ = (context->getProperty(HashAlgorithm.getName(), value)) ? value : "SHA256";
-
- if (context->getProperty(FailOnEmpty.getName(), value)) {
- failOnEmpty_ = utils::StringUtils::toBool(value).value_or(false);
- } else {
- failOnEmpty_ = false;
+ context->getProperty(HashAttribute.getName(), attrKey_);
+ context->getProperty(FailOnEmpty.getName(), failOnEmpty_);
+
+ {
+ std::string algo_name;
+ context->getProperty(HashAlgorithm.getName(), algo_name);
+ std::transform(algo_name.begin(), algo_name.end(), algo_name.begin(), ::toupper);
+ std::erase(algo_name, '-');
+ if (!HashAlgos.contains(algo_name)) {
+ const auto supported_algorithms = ranges::views::keys(HashAlgos) | ranges::views::join(std::string_view(", ")) | ranges::to<std::string>();
+ throw Exception(PROCESS_SCHEDULE_EXCEPTION, algo_name + " is not supported, supported algorithms are: " + supported_algorithms);
+ }
+ algorithm_ = HashAlgos.at(algo_name);
}
-
- std::transform(algoName_.begin(), algoName_.end(), algoName_.begin(), ::toupper);
-
- // Erase '-' to make sha-256 and sha-1 work, too
- algoName_.erase(std::remove(algoName_.begin(), algoName_.end(), '-'), algoName_.end());
}
void HashContent::onTrigger(core::ProcessContext *, core::ProcessSession *session) {
@@ -80,11 +81,7 @@ void HashContent::onTrigger(core::ProcessContext *, core::ProcessSession *sessio
logger_->log_trace("attempting read");
session->read(flowFile, [&flowFile, this](const std::shared_ptr<io::InputStream>& stream) {
- // This throws in case algo is not found, but that's fine
- logger_->log_trace("Searching for %s", algoName_);
- auto algo = HashAlgos.at(algoName_);
-
- const auto& ret_val = algo(stream);
+ const auto& ret_val = algorithm_(stream);
flowFile->setAttribute(attrKey_, ret_val.first);
diff --git a/extensions/standard-processors/processors/HashContent.h b/extensions/standard-processors/processors/HashContent.h
index b7818e6a4..7dbdd56c5 100644
--- a/extensions/standard-processors/processors/HashContent.h
+++ b/extensions/standard-processors/processors/HashContent.h
@@ -161,7 +161,7 @@ class HashContent : public core::Processor {
private:
std::shared_ptr<core::logging::Logger> logger_ = core::logging::LoggerFactory<HashContent>::getLogger();
- std::string algoName_;
+ std::function<HashReturnType(const std::shared_ptr<io::InputStream>&)> algorithm_ = SHA256Hash;
std::string attrKey_;
bool failOnEmpty_{};
};
diff --git a/extensions/standard-processors/tests/unit/HashContentTest.cpp b/extensions/standard-processors/tests/unit/HashContentTest.cpp
index d9408a9b5..d0a1f6e4d 100644
--- a/extensions/standard-processors/tests/unit/HashContentTest.cpp
+++ b/extensions/standard-processors/tests/unit/HashContentTest.cpp
@@ -19,23 +19,18 @@
#ifdef OPENSSL_SUPPORT
#include <array>
-#include <fstream>
-#include <map>
#include <memory>
#include <utility>
#include <string>
-#include <set>
#include <iostream>
#include "TestBase.h"
#include "Catch.h"
+#include "SingleProcessorTestController.h"
#include "TestUtils.h"
-#include "core/Core.h"
#include "unit/ProvenanceTestHelper.h"
-#include "core/FlowFile.h"
#include "core/Processor.h"
-#include "core/ProcessContext.h"
#include "core/ProcessSession.h"
#include "core/ProcessorNode.h"
@@ -54,6 +49,8 @@ const char* MD5_CHECKSUM = "4FE8A693C64F93F65C5FAF42DC49AB23";
const char* SHA1_CHECKSUM = "03840DEB949D6CF0C0A624FA7EBA87FBDBCB7783";
const char* SHA256_CHECKSUM = "66D5B2CC06203137F8A0E9714638DC1085C57A3F1FA26C8823AE5CF89AB26488";
+namespace org::apache::nifi::minifi::processors::test {
+
TEST_CASE("Test Creation of HashContent", "[HashContentCreate]") {
TestController testController;
std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::HashContent>("processorname");
@@ -172,4 +169,13 @@ TEST_CASE("TestingFailOnEmptyProperty", "[HashContentPropertiesCheck]") {
REQUIRE(LogTestController::getInstance().contains("Failure as flow file is empty"));
}
}
+
+TEST_CASE("Invalid hash algorithm throws in onSchedule", "[HashContent]") {
+ auto hash_content = std::make_shared<HashContent>("HashContent");
+ minifi::test::SingleProcessorTestController controller{hash_content};
+ hash_content->setProperty(HashContent::HashAlgorithm, "My-Algo");
+ REQUIRE_THROWS_WITH(controller.plan->scheduleProcessor(hash_content), "Process Schedule Operation: MYALGO is not supported, supported algorithms are: MD5, SHA1, SHA256");
+}
+
+} // namespace org::apache::nifi::minifi::processors::test
#endif // OPENSSL_SUPPORT