szaszm commented on a change in pull request #605: MINIFICPP-550 - Implement
RocksDB controller service and component st…
URL: https://github.com/apache/nifi-minifi-cpp/pull/605#discussion_r366350235
##########
File path: libminifi/test/TestBase.cpp
##########
@@ -30,6 +30,25 @@ TestPlan::TestPlan(std::shared_ptr<core::ContentRepository>
content_repo, std::s
flow_version_(flow_version),
logger_(logging::LoggerFactory<TestPlan>::getLogger()) {
stream_factory =
org::apache::nifi::minifi::io::StreamFactory::getInstance(std::make_shared<minifi::Configure>());
+ controller_services_ =
std::make_shared<core::controller::ControllerServiceMap>();
+ controller_services_provider_ =
std::make_shared<core::controller::StandardControllerServiceProvider>(controller_services_,
nullptr, configuration_);
+ /* Inject the default state provider ahead of ProcessContext to make sure we
have a unique state directory */
+ if (state_dir == nullptr) {
+ std::string state_dir_name_template = "/tmp/teststate.XXXXXX";
+ std::vector<char> state_dir_buf(state_dir_name_template.c_str(),
+ state_dir_name_template.c_str() +
state_dir_name_template.size() + 1);
Review comment:
Could be `std::cbegin(state_dir_name_template),
std::cend(state_dir_name_template)`.
I'd prefer to drop the temporary `std::string` and `std::vector` and use
`char[]` initialized with the string literal, then changed by `mkdtemp`.
Alternatively, we could hack a mutable data ptr out of `std::string`
(something ugly like `&*std::begin(string)`) and move assigning the buffer to
`state_dir_` later, avoiding the copy.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services