adam-markovics commented on a change in pull request #1165:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1165#discussion_r724725817



##########
File path: extensions/standard-processors/processors/TailFile.cpp
##########
@@ -561,7 +559,7 @@ bool TailFile::getStateFromLegacyStateFile(const 
std::shared_ptr<core::ProcessCo
 void TailFile::logState() {
   logger_->log_info("State of the TailFile processor %s:", name_);
   for (const auto& key_value_pair : tail_states_) {
-    logging::LOG_INFO(logger_) << key_value_pair.first << " => { " << 
key_value_pair.second << " }";
+    core::logging::LOG_INFO(logger_) << key_value_pair.first << " => { " << 
key_value_pair.second << " }";

Review comment:
       I think it could be cleaner and shorter to use structured bindings for 
iterating over keys and values of a map. Like:
   
   for (const auto& [key, value] : tail_states) { // ...

##########
File path: libminifi/test/TestBase.cpp
##########
@@ -447,3 +591,38 @@ void TestPlan::validateAnnotations() const {
     processor->validateAnnotations();
   }
 }
+
+std::string TestPlan::getContent(const 
std::shared_ptr<minifi::core::FlowFile>& file) {
+  auto content_claim = file->getResourceClaim();
+  auto content_stream = content_repo_->read(*content_claim);
+  auto output_stream = std::make_shared<minifi::io::BufferStream>();
+  minifi::InputStreamPipe{output_stream}.process(content_stream);
+  return {reinterpret_cast<const char*>(output_stream->getBuffer()), 
output_stream->size()};
+}
+
+TestController::TestController()
+    : log(LogTestController::getInstance()) {
+  minifi::setDefaultDirectory("./");
+  log.reset();
+  
minifi::utils::IdGenerator::getIdGenerator()->initialize(std::make_shared<minifi::Properties>());
+  flow_version_ = 
std::make_shared<minifi::state::response::FlowVersion>("test", "test", "test");
+}
+
+std::shared_ptr<TestPlan> 
TestController::createPlan(std::shared_ptr<minifi::Configure> configuration, 
const char* state_dir) {
+  if (configuration == nullptr) {
+    configuration = std::make_shared<minifi::Configure>();
+    
configuration->set(minifi::Configure::nifi_state_management_provider_local_class_name,
 "UnorderedMapKeyValueStoreService");
+  }
+
+  auto content_repo = 
std::make_shared<minifi::core::repository::VolatileContentRepository>();
+  content_repo->initialize(configuration);
+
+  return std::make_shared<TestPlan>(std::move(content_repo), 
std::make_shared<TestRepository>(), std::make_shared<TestRepository>(), 
flow_version_, configuration, state_dir);
+}
+
+std::string TestController::createTempDirectory() {
+  char format[] = "/var/tmp/nifi-minifi-cpp.test.XXXXXX";

Review comment:
       This could be static and const.

##########
File path: extensions/standard-processors/processors/PutFile.h
##########
@@ -50,8 +50,7 @@ class PutFile : public core::Processor {
    * Create a new processor
    */
   PutFile(const std::string& name,  const utils::Identifier& uuid = {}) // 
NOLINT
-      : core::Processor(std::move(name), uuid),
-        logger_(logging::LoggerFactory<PutFile>::getLogger()) {
+      : core::Processor(std::move(name), uuid) {

Review comment:
       std::move on a const & is not effective

##########
File path: extensions/standard-processors/processors/TailFile.h
##########
@@ -82,8 +82,7 @@ SMART_ENUM(InitialStartPositions,
 class TailFile : public core::Processor {
  public:
   explicit TailFile(const std::string& name, const utils::Identifier& uuid = 
{})
-      : core::Processor(std::move(name), uuid),
-        logger_(logging::LoggerFactory<TailFile>::getLogger()) {
+      : core::Processor(std::move(name), uuid) {

Review comment:
       std::move on a const & is not effective

##########
File path: libminifi/include/controllers/UpdatePolicyControllerService.h
##########
@@ -44,8 +44,7 @@ class UpdatePolicyControllerService : public 
core::controller::ControllerService
   explicit UpdatePolicyControllerService(const std::string &name, const 
utils::Identifier &uuid = {})
       : ControllerService(name, uuid),
         persist_updates_(false),
-        policy_(new state::UpdatePolicy(false)),
-        
logger_(logging::LoggerFactory<UpdatePolicyControllerService>::getLogger()) {
+        policy_(new state::UpdatePolicy(false)) {

Review comment:
       please convert to make_unique




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

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

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


Reply via email to