http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/GetTCP.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/GetTCP.cpp b/libminifi/src/processors/GetTCP.cpp index 0932ebd..2b3b93c 100644 --- a/libminifi/src/processors/GetTCP.cpp +++ b/libminifi/src/processors/GetTCP.cpp @@ -16,15 +16,17 @@ * limitations under the License. */ #include "processors/GetTCP.h" -#include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #include <stdio.h> -#include <dirent.h> + #include <limits.h> +#ifndef WIN32 +#include <dirent.h> #include <unistd.h> #include <regex.h> +#endif #include <vector> #include <queue> #include <map>
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/ListenSyslog.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/ListenSyslog.cpp b/libminifi/src/processors/ListenSyslog.cpp index e820bd5..aab3c67 100644 --- a/libminifi/src/processors/ListenSyslog.cpp +++ b/libminifi/src/processors/ListenSyslog.cpp @@ -34,7 +34,7 @@ namespace apache { namespace nifi { namespace minifi { namespace processors { - +#ifndef WIN32 core::Property ListenSyslog::RecvBufSize("Receive Buffer Size", "The size of each buffer used to receive Syslog messages.", "65507 B"); core::Property ListenSyslog::MaxSocketBufSize("Max Size of Socket Buffer", "The maximum size of the socket buffer that should be used.", "1 MB"); core::Property ListenSyslog::MaxConnections("Max Number of TCP Connections", "The maximum number of concurrent connections to accept Syslog messages in TCP mode.", "2"); @@ -153,7 +153,7 @@ void ListenSyslog::runThread() { clilen = sizeof(cli_addr); int newsockfd = accept(_serverSocket, reinterpret_cast<struct sockaddr *>(&cli_addr), &clilen); if (newsockfd > 0) { - if (_clientSockets.size() < (uint64_t)_maxConnections) { + if (_clientSockets.size() < (uint64_t) _maxConnections) { _clientSockets.push_back(newsockfd); logger_->log_info("ListenSysLog new client socket %d connection", newsockfd); continue; @@ -166,7 +166,7 @@ void ListenSyslog::runThread() { struct sockaddr_in cli_addr; clilen = sizeof(cli_addr); int recvlen = recvfrom(_serverSocket, _buffer, sizeof(_buffer), 0, (struct sockaddr *) &cli_addr, &clilen); - if (recvlen > 0 && (uint64_t)(recvlen + getEventQueueByteSize()) <= _recvBufSize) { + if (recvlen > 0 && (uint64_t) (recvlen + getEventQueueByteSize()) <= _recvBufSize) { uint8_t *payload = new uint8_t[recvlen]; memcpy(payload, _buffer, recvlen); putEvent(payload, recvlen); @@ -183,7 +183,7 @@ void ListenSyslog::runThread() { logger_->log_debug("ListenSysLog client socket %d close", clientSocket); it = _clientSockets.erase(it); } else { - if ((uint64_t)(recvlen + getEventQueueByteSize()) <= _recvBufSize) { + if ((uint64_t) (recvlen + getEventQueueByteSize()) <= _recvBufSize) { uint8_t *payload = new uint8_t[recvlen]; memcpy(payload, _buffer, recvlen); putEvent(payload, recvlen); @@ -296,7 +296,7 @@ void ListenSyslog::onTrigger(core::ProcessContext *context, core::ProcessSession flowFile->addAttribute("syslog.port", std::to_string(_port)); session->transfer(flowFile, Success); } - +#endif } /* namespace processors */ } /* namespace minifi */ } /* namespace nifi */ http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/LogAttribute.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/LogAttribute.cpp b/libminifi/src/processors/LogAttribute.cpp index 65f45c6..cec9191 100644 --- a/libminifi/src/processors/LogAttribute.cpp +++ b/libminifi/src/processors/LogAttribute.cpp @@ -18,7 +18,6 @@ * limitations under the License. */ #include "processors/LogAttribute.h" -#include <sys/time.h> #include <time.h> #include <string.h> #include <memory> http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/PutFile.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/PutFile.cpp b/libminifi/src/processors/PutFile.cpp index 0a45c68..fa461d4 100644 --- a/libminifi/src/processors/PutFile.cpp +++ b/libminifi/src/processors/PutFile.cpp @@ -19,10 +19,8 @@ */ #include "processors/PutFile.h" - +#include "utils/file/FileUtils.h" #include <sys/stat.h> -#include <dirent.h> -#include <unistd.h> #include <uuid/uuid.h> #include <cstdint> #include <cstdio> @@ -30,6 +28,13 @@ #include <memory> #include <string> #include <set> +#ifdef WIN32 +#include <Windows.h> +#endif + +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif namespace org { namespace apache { @@ -40,33 +45,16 @@ namespace processors { std::shared_ptr<utils::IdGenerator> PutFile::id_generator_ = utils::IdGenerator::getIdGenerator(); core::Property PutFile::Directory( - "Directory", - "The output directory to which to put files", - "."); -core::Property PutFile::ConflictResolution( - "Conflict Resolution Strategy", - "Indicates what should happen when a file with the same name already exists in the output directory", - CONFLICT_RESOLUTION_STRATEGY_FAIL); -core::Property PutFile::CreateDirs( - "Create Missing Directories", - "If true, then missing destination directories will be created. " - "If false, flowfiles are penalized and sent to failure.", - "true", - true, - "", - {"Directory"}, - {}); -core::Property PutFile::MaxDestFiles( - "Maximum File Count", - "Specifies the maximum number of files that can exist in the output directory", - "-1"); - -core::Relationship PutFile::Success( - "success", - "All files are routed to success"); -core::Relationship PutFile::Failure( - "failure", - "Failed files (conflict, write failure, etc.) are transferred to failure"); + core::PropertyBuilder::createProperty("Directory")->withDescription("The output directory to which to put files")->supportsExpressionLanguage(true)->withDefaultValue(".")->build()); +core::Property PutFile::ConflictResolution("Conflict Resolution Strategy", "Indicates what should happen when a file with the same name already exists in the output directory", + CONFLICT_RESOLUTION_STRATEGY_FAIL); +core::Property PutFile::CreateDirs("Create Missing Directories", "If true, then missing destination directories will be created. " + "If false, flowfiles are penalized and sent to failure.", + "true", true, "", { "Directory" }, { }); +core::Property PutFile::MaxDestFiles("Maximum File Count", "Specifies the maximum number of files that can exist in the output directory", "-1"); + +core::Relationship PutFile::Success("success", "All files are routed to success"); +core::Relationship PutFile::Failure("failure", "Failed files (conflict, write failure, etc.) are transferred to failure"); void PutFile::initialize() { // Set the supported properties @@ -113,7 +101,7 @@ void PutFile::onTrigger(core::ProcessContext *context, core::ProcessSession *ses std::string directory; - if (!context->getProperty(Directory.getName(), directory, flowFile)) { + if (!context->getProperty(Directory, directory, flowFile)) { logger_->log_error("Directory attribute is missing or invalid"); } @@ -143,6 +131,8 @@ void PutFile::onTrigger(core::ProcessContext *context, core::ProcessSession *ses // something exists at directory path if (S_ISDIR(statResult.st_mode)) { // it's a directory, count the files + int64_t ct = 0; +#ifndef WIN32 DIR *myDir = opendir(directory.c_str()); if (!myDir) { logger_->log_warn("Could not open %s", directory); @@ -151,13 +141,13 @@ void PutFile::onTrigger(core::ProcessContext *context, core::ProcessSession *ses } struct dirent* entry = nullptr; - int64_t ct = 0; while ((entry = readdir(myDir)) != nullptr) { if ((strcmp(entry->d_name, ".") != 0) && (strcmp(entry->d_name, "..") != 0)) { ct++; if (ct >= max_dest_files_) { logger_->log_warn("Routing to failure because the output directory %s has at least %u files, which exceeds the " - "configured max number of files", directory, max_dest_files_); + "configured max number of files", + directory, max_dest_files_); session->transfer(flowFile, Failure); closedir(myDir); return; @@ -165,13 +155,31 @@ void PutFile::onTrigger(core::ProcessContext *context, core::ProcessSession *ses } } closedir(myDir); +#else + HANDLE hFind; + WIN32_FIND_DATA FindFileData; + + if ((hFind = FindFirstFile(directory.c_str(), &FindFileData)) != INVALID_HANDLE_VALUE) { + do { + if ((strcmp(FindFileData.cFileName, ".") != 0) && (strcmp(FindFileData.cFileName, "..") != 0)) { + ct++; + if (ct >= max_dest_files_) { + logger_->log_warn("Routing to failure because the output directory %s has at least %u files, which exceeds the " + "configured max number of files", directory, max_dest_files_); + session->transfer(flowFile, Failure); + FindClose(hFind); + return; + } + } + }while (FindNextFile(hFind, &FindFileData)); + FindClose(hFind); + } +#endif } } if (stat(destFile.c_str(), &statResult) == 0) { - logger_->log_warn("Destination file %s exists; applying Conflict Resolution Strategy: %s", - destFile, - conflict_resolution_); + logger_->log_warn("Destination file %s exists; applying Conflict Resolution Strategy: %s", destFile, conflict_resolution_); if (conflict_resolution_ == CONFLICT_RESOLUTION_STRATEGY_REPLACE) { putFile(session, flowFile, tmpFile, destFile, directory); @@ -186,10 +194,8 @@ void PutFile::onTrigger(core::ProcessContext *context, core::ProcessSession *ses } std::string PutFile::tmpWritePath(const std::string &filename, const std::string &directory) const { - char tmpFileUuidStr[37]; - uuid_t tmpFileUuid; + utils::Identifier tmpFileUuid; id_generator_->generate(tmpFileUuid); - uuid_unparse_lower(tmpFileUuid, tmpFileUuidStr); std::stringstream tmpFileSs; tmpFileSs << directory; auto lastSeparatorPos = filename.find_last_of("/"); @@ -197,22 +203,15 @@ std::string PutFile::tmpWritePath(const std::string &filename, const std::string if (lastSeparatorPos == std::string::npos) { tmpFileSs << "/." << filename; } else { - tmpFileSs << "/" - << filename.substr(0, lastSeparatorPos) - << "/." - << filename.substr(lastSeparatorPos + 1); + tmpFileSs << "/" << filename.substr(0, lastSeparatorPos) << "/." << filename.substr(lastSeparatorPos + 1); } - tmpFileSs << "." << tmpFileUuidStr; + tmpFileSs << "." << tmpFileUuid.to_string(); std::string tmpFile = tmpFileSs.str(); return tmpFile; } -bool PutFile::putFile(core::ProcessSession *session, - std::shared_ptr<FlowFileRecord> flowFile, - const std::string &tmpFile, - const std::string &destFile, - const std::string &destDir) { +bool PutFile::putFile(core::ProcessSession *session, std::shared_ptr<FlowFileRecord> flowFile, const std::string &tmpFile, const std::string &destFile, const std::string &destDir) { struct stat dir_stat; if (stat(destDir.c_str(), &dir_stat) && try_mkdirs_) { @@ -230,7 +229,7 @@ bool PutFile::putFile(core::ProcessSession *session, if (!dir_path_component.empty()) { logger_->log_debug("Attempting to create directory if it does not already exist: %s", dir_path); - mkdir(dir_path.c_str(), 0700); + utils::file::FileUtils::create_dir(dir_path); dir_path_stream << '/'; } else if (pos == 0) { // Support absolute paths @@ -255,8 +254,7 @@ bool PutFile::putFile(core::ProcessSession *session, return false; } -PutFile::ReadCallback::ReadCallback(const std::string &tmp_file, - const std::string &dest_file) +PutFile::ReadCallback::ReadCallback(const std::string &tmp_file, const std::string &dest_file) : tmp_file_(tmp_file), dest_file_(dest_file), logger_(logging::LoggerFactory<PutFile::ReadCallback>::getLogger()) { @@ -304,8 +302,7 @@ bool PutFile::ReadCallback::commit() { if (write_succeeded_) { if (rename(tmp_file_.c_str(), dest_file_.c_str())) { - logger_->log_info("PutFile commit put file operation to %s failed because rename() call failed", - dest_file_); + logger_->log_info("PutFile commit put file operation to %s failed because rename() call failed", dest_file_); } else { success = true; logger_->log_info("PutFile commit put file operation to %s succeeded", dest_file_); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/RouteOnAttribute.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/RouteOnAttribute.cpp b/libminifi/src/processors/RouteOnAttribute.cpp index 6e78b6f..3e2bf61 100644 --- a/libminifi/src/processors/RouteOnAttribute.cpp +++ b/libminifi/src/processors/RouteOnAttribute.cpp @@ -30,32 +30,25 @@ namespace nifi { namespace minifi { namespace processors { -core::Relationship RouteOnAttribute::Unmatched( - "unmatched", - "Files which do not match any expression are routed here"); -core::Relationship RouteOnAttribute::Failure( - "failure", - "Failed files are transferred to failure"); +core::Relationship RouteOnAttribute::Unmatched("unmatched", "Files which do not match any expression are routed here"); +core::Relationship RouteOnAttribute::Failure("failure", "Failed files are transferred to failure"); void RouteOnAttribute::initialize() { std::set<core::Property> properties; setSupportedProperties(properties); } -void RouteOnAttribute::onDynamicPropertyModified(const core::Property &orig_property, - const core::Property &new_property) { +void RouteOnAttribute::onDynamicPropertyModified(const core::Property &orig_property, const core::Property &new_property) { // Update the routing table when routes are added via dynamic properties. route_properties_[new_property.getName()] = new_property; std::set<core::Relationship> relationships; for (const auto &route : route_properties_) { - core::Relationship route_rel{route.first, "Dynamic route"}; + core::Relationship route_rel { route.first, "Dynamic route" }; route_rels_[route.first] = route_rel; relationships.insert(route_rel); - logger_->log_info("RouteOnAttribute registered route '%s' with expression '%s'", - route.first, - route.second.getValue()); + logger_->log_info("RouteOnAttribute registered route '%s' with expression '%s'", route.first, route.second.getValue()); } relationships.insert(Unmatched); @@ -63,8 +56,7 @@ void RouteOnAttribute::onDynamicPropertyModified(const core::Property &orig_prop setSupportedRelationships(relationships); } -void RouteOnAttribute::onTrigger(core::ProcessContext *context, - core::ProcessSession *session) { +void RouteOnAttribute::onTrigger(core::ProcessContext *context, core::ProcessSession *session) { auto flow_file = session->get(); // Do nothing if there are no incoming files @@ -78,7 +70,7 @@ void RouteOnAttribute::onTrigger(core::ProcessContext *context, // Perform dynamic routing logic for (const auto &route : route_properties_) { std::string do_route; - context->getDynamicProperty(route.second.getName(), do_route, flow_file); + context->getDynamicProperty(route.second, do_route, flow_file); if (do_route == "true") { did_match = true; http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/TailFile.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/TailFile.cpp b/libminifi/src/processors/TailFile.cpp index 61aa86b..df0afc4 100644 --- a/libminifi/src/processors/TailFile.cpp +++ b/libminifi/src/processors/TailFile.cpp @@ -17,14 +17,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #include <stdio.h> -#include <dirent.h> + #include <limits.h> +#ifndef WIN32 +#include <dirent.h> #include <unistd.h> +#endif #include <vector> #include <queue> #include <map> @@ -40,6 +42,10 @@ #include "core/ProcessContext.h" #include "core/ProcessSession.h" +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif + #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wsign-compare" @@ -173,6 +179,7 @@ void TailFile::checkRollOver(const std::string &fileLocation, const std::string std::size_t found = fileName.find_last_of("."); if (found != std::string::npos) pattern = fileName.substr(0, found); +#ifndef WIN32 DIR *d; d = opendir(fileLocation.c_str()); if (!d) @@ -197,6 +204,33 @@ void TailFile::checkRollOver(const std::string &fileLocation, const std::string } } closedir(d); +#else + + HANDLE hFind; + WIN32_FIND_DATA FindFileData; + + if ((hFind = FindFirstFile(fileLocation.c_str(), &FindFileData)) != INVALID_HANDLE_VALUE) { + do { + struct stat statbuf {}; + if (stat(FindFileData.cFileName, &statbuf) != 0) { + logger_->log_warn("Failed to stat %s", FindFileData.cFileName); + break; + } + + std::string fileFullName = fileLocation + "/" + FindFileData.cFileName; + + if (fileFullName.find(pattern) != std::string::npos && stat(fileFullName.c_str(), &statbuf) == 0) { + if (((uint64_t)(statbuf.st_mtime) * 1000) >= modifiedTimeCurrentTailFile) { + TailMatchedFileItem item; + item.fileName = fileName; + item.modifiedTime = ((uint64_t)(statbuf.st_mtime) * 1000); + matchedFiles.push_back(item); + } + } + }while (FindNextFile(hFind, &FindFileData)); + FindClose(hFind); + } +#endif // Sort the list based on modified time std::sort(matchedFiles.begin(), matchedFiles.end(), sortTailMatchedFileItem); @@ -244,7 +278,7 @@ void TailFile::onTrigger(core::ProcessContext *context, core::ProcessSession *se struct stat statbuf; if (stat(fullPath.c_str(), &statbuf) == 0) { - if ((uint64_t)statbuf.st_size <= this->_currentTailFilePosition) { + if ((uint64_t) statbuf.st_size <= this->_currentTailFilePosition) { // there are no new input for the current tail file context->yield(); return; http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/processors/UpdateAttribute.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/processors/UpdateAttribute.cpp b/libminifi/src/processors/UpdateAttribute.cpp index f431012..80b0215 100644 --- a/libminifi/src/processors/UpdateAttribute.cpp +++ b/libminifi/src/processors/UpdateAttribute.cpp @@ -30,12 +30,8 @@ namespace nifi { namespace minifi { namespace processors { -core::Relationship UpdateAttribute::Success( - "success", - "All files are routed to success"); -core::Relationship UpdateAttribute::Failure( - "failure", - "Failed files are transferred to failure"); +core::Relationship UpdateAttribute::Success("success", "All files are routed to success"); +core::Relationship UpdateAttribute::Failure("failure", "Failed files are transferred to failure"); void UpdateAttribute::initialize() { std::set<core::Property> properties; @@ -47,20 +43,18 @@ void UpdateAttribute::initialize() { setSupportedRelationships(relationships); } -void UpdateAttribute::onSchedule(core::ProcessContext *context, - core::ProcessSessionFactory *sessionFactory) { +void UpdateAttribute::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) { attributes_.clear(); const auto &dynamic_prop_keys = context->getDynamicPropertyKeys(); logger_->log_info("UpdateAttribute registering %d keys", dynamic_prop_keys.size()); for (const auto &key : dynamic_prop_keys) { - attributes_.emplace_back(key); + attributes_.emplace_back(core::PropertyBuilder::createProperty(key)->withDescription("auto generated")->supportsExpressionLanguage(true)->build()); logger_->log_info("UpdateAttribute registered attribute '%s'", key); } } -void UpdateAttribute::onTrigger(core::ProcessContext *context, - core::ProcessSession *session) { +void UpdateAttribute::onTrigger(core::ProcessContext *context, core::ProcessSession *session) { auto flow_file = session->get(); // Do nothing if there are no incoming files @@ -72,10 +66,8 @@ void UpdateAttribute::onTrigger(core::ProcessContext *context, for (const auto &attribute : attributes_) { std::string value; context->getDynamicProperty(attribute, value, flow_file); - flow_file->setAttribute(attribute, value); - logger_->log_info("Set attribute '%s' of flow file '%s' with value '%s'", - attribute, - flow_file->getUUIDStr(), value); + flow_file->setAttribute(attribute.getName(), value); + logger_->log_info("Set attribute '%s' of flow file '%s' with value '%s'", attribute.getName(), flow_file->getUUIDStr(), value); } session->transfer(flow_file, Success); } catch (const std::exception &e) { http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/provenance/Provenance.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/provenance/Provenance.cpp b/libminifi/src/provenance/Provenance.cpp index 1edb191..9c43361 100644 --- a/libminifi/src/provenance/Provenance.cpp +++ b/libminifi/src/provenance/Provenance.cpp @@ -17,7 +17,6 @@ */ #include "provenance/Provenance.h" -#include <arpa/inet.h> #include <cstdint> #include <memory> #include <string> http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/sitetosite/Peer.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/sitetosite/Peer.cpp b/libminifi/src/sitetosite/Peer.cpp index 385f991..5505b0c 100644 --- a/libminifi/src/sitetosite/Peer.cpp +++ b/libminifi/src/sitetosite/Peer.cpp @@ -17,9 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <sys/time.h> #include <stdio.h> -#include <time.h> #include <chrono> #include <thread> #include <random> http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/sitetosite/RawSocketProtocol.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/sitetosite/RawSocketProtocol.cpp b/libminifi/src/sitetosite/RawSocketProtocol.cpp index 2bccb0b..9b17db1 100644 --- a/libminifi/src/sitetosite/RawSocketProtocol.cpp +++ b/libminifi/src/sitetosite/RawSocketProtocol.cpp @@ -16,7 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <sys/time.h> #include <stdio.h> #include <time.h> #include <chrono> @@ -241,12 +240,10 @@ bool RawSiteToSiteClient::handShake() { return false; } logger_->log_debug("Site2Site Protocol Perform hand shake with destination port %s", port_id_str_); - uuid_t uuid; + utils::Identifier uuid; // Generate the global UUID for the com identify id_generator_->generate(uuid); - char uuidStr[37]; - uuid_unparse_lower(uuid, uuidStr); - _commsIdentifier = uuidStr; + _commsIdentifier = uuid.to_string(); int ret = peer_->writeUTF(_commsIdentifier); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/src/utils/Id.cpp ---------------------------------------------------------------------- diff --git a/libminifi/src/utils/Id.cpp b/libminifi/src/utils/Id.cpp index da0fea9..8994771 100644 --- a/libminifi/src/utils/Id.cpp +++ b/libminifi/src/utils/Id.cpp @@ -35,10 +35,92 @@ namespace nifi { namespace minifi { namespace utils { +Identifier::Identifier(UUID_FIELD u) + : IdentifierBase(u) { + build_string(); +} + +Identifier::Identifier() + : IdentifierBase() { +} + +Identifier::Identifier(const Identifier &other) { + if (!other.convert().empty()) { + copyInto(other); + build_string(); + } +} + +Identifier::Identifier(const IdentifierBase &other) { + if (!other.convert().empty()) { + copyInto(other); + build_string(); + } +} + +Identifier &Identifier::operator=(const Identifier &other) { + if (!other.convert().empty()) { + IdentifierBase::operator =(other); + build_string(); + } + return *this; +} + +Identifier &Identifier::operator=(const IdentifierBase &other) { + if (!other.convert().empty()) { + IdentifierBase::operator =(other); + build_string(); + } + return *this; +} + +Identifier &Identifier::operator=(UUID_FIELD o) { + IdentifierBase::operator=(o); + build_string(); + return *this; +} + +Identifier &Identifier::operator=(std::string id) { + uuid_parse(id.c_str(), id_); + converted_ = id; + return *this; +} + +bool Identifier::operator==(std::nullptr_t nullp) { + return converted_.empty(); +} + +bool Identifier::operator!=(std::nullptr_t nullp) { + return !converted_.empty(); +} + +bool Identifier::operator!=(const Identifier &other) { + return converted_ != other.converted_; +} + +bool Identifier::operator==(const Identifier &other) { + return converted_ == other.converted_; +} + +std::string Identifier::to_string() { + return convert(); +} + +unsigned char *Identifier::toArray() { + return id_; +} + +void Identifier::build_string() { + char uuidStr[37] = { 0 }; + uuid_unparse_lower(id_, uuidStr); + converted_ = uuidStr; +} + uint64_t timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(); NonRepeatingStringGenerator::NonRepeatingStringGenerator() - : prefix_((std::to_string(timestamp) + "-")), incrementor_(0) { + : prefix_((std::to_string(timestamp) + "-")), + incrementor_(0) { } IdGenerator::IdGenerator() @@ -69,7 +151,7 @@ uint64_t IdGenerator::getDeviceSegmentFromString(const std::string& str, int num uint64_t IdGenerator::getRandomDeviceSegment(int numBits) { uint64_t deviceSegment = 0; - uuid_t random_uuid; + UUID_FIELD random_uuid; for (int word = 0; word < 2; word++) { uuid_generate_random(random_uuid); for (int i = 0; i < 4; i++) { @@ -122,14 +204,21 @@ void IdGenerator::initialize(const std::shared_ptr<Properties> & properties) { } else if ("time" == implementation_str) { logging::LOG_DEBUG(logger_) << "Using uuid_generate_time implementation for uids."; } else { - logging::LOG_DEBUG(logger_) << "Invalid value for uid.implementation (" << implementation_str << "). Using uuid_generate_time implementation for uids."; + logging::LOG_DEBUG(logger_) << "Invalid value for uid.implementation (" << implementation_str << "). Using uuid_generate_time implementation for uids."; } } else { logging::LOG_DEBUG(logger_) << "Using uuid_generate_time implementation for uids."; } } -void IdGenerator::generate(uuid_t output) { +Identifier IdGenerator::generate() { + Identifier ident; + generate(ident); + return ident; +} + +void IdGenerator::generate(Identifier &ident) { + UUID_FIELD output; switch (implementation_) { case UUID_RANDOM_IMPL: uuid_generate_random(output); @@ -149,6 +238,7 @@ void IdGenerator::generate(uuid_t output) { uuid_generate_time(output); break; } + ident = output; } } /* namespace utils */ http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/TestBase.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/TestBase.cpp b/libminifi/test/TestBase.cpp index a97bc99..57ef71d 100644 --- a/libminifi/test/TestBase.cpp +++ b/libminifi/test/TestBase.cpp @@ -37,8 +37,9 @@ std::shared_ptr<core::Processor> TestPlan::addProcessor(const std::shared_ptr<co } std::lock_guard<std::recursive_mutex> guard(mutex); - uuid_t uuid; - uuid_generate(uuid); + utils::Identifier uuid; + + utils::IdGenerator::getIdGenerator()->generate(uuid); processor->setStreamFactory(stream_factory); // initialize the processor @@ -67,7 +68,7 @@ std::shared_ptr<core::Processor> TestPlan::addProcessor(const std::shared_ptr<co connection->setSource(last); connection->setDestination(processor); - uuid_t uuid_copy, uuid_copy_next; + utils::Identifier uuid_copy, uuid_copy_next; last->getUUID(uuid_copy); connection->setSourceUUID(uuid_copy); processor->getUUID(uuid_copy_next); @@ -97,8 +98,11 @@ std::shared_ptr<core::Processor> TestPlan::addProcessor(const std::string &proce } std::lock_guard<std::recursive_mutex> guard(mutex); - uuid_t uuid; - uuid_generate(uuid); + utils::Identifier uuid; + + utils::IdGenerator::getIdGenerator()->generate(uuid); + + std::cout << "generated " << uuid.to_string() << std::endl; auto ptr = core::ClassLoader::getDefaultClassLoader().instantiate(processor_name, uuid); if (nullptr == ptr) { @@ -194,7 +198,7 @@ std::shared_ptr<minifi::Connection> TestPlan::buildFinalConnection(std::shared_p if (setDest) connection->setDestination(processor); - uuid_t uuid_copy; + utils::Identifier uuid_copy; last->getUUID(uuid_copy); connection->setSourceUUID(uuid_copy); if (setDest) http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/archive-tests/CompressContentTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/archive-tests/CompressContentTests.cpp b/libminifi/test/archive-tests/CompressContentTests.cpp index 3c51277..2417cad 100644 --- a/libminifi/test/archive-tests/CompressContentTests.cpp +++ b/libminifi/test/archive-tests/CompressContentTests.cpp @@ -113,9 +113,9 @@ TEST_CASE("CompressFileGZip", "[compressfiletest1]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -214,9 +214,9 @@ TEST_CASE("DecompressFileGZip", "[compressfiletest2]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -316,9 +316,9 @@ TEST_CASE("CompressFileBZip", "[compressfiletest3]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -418,9 +418,9 @@ TEST_CASE("DecompressFileBZip", "[compressfiletest4]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -520,9 +520,9 @@ TEST_CASE("CompressFileLZMA", "[compressfiletest5]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -628,9 +628,9 @@ TEST_CASE("DecompressFileLZMA", "[compressfiletest6]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -737,9 +737,9 @@ TEST_CASE("CompressFileXYLZMA", "[compressfiletest7]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -845,9 +845,9 @@ TEST_CASE("DecompressFileXYLZMA", "[compressfiletest8]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::CompressContent>("compresscontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/archive-tests/FocusArchiveTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/archive-tests/FocusArchiveTests.cpp b/libminifi/test/archive-tests/FocusArchiveTests.cpp index 0934208..2d5cd84 100644 --- a/libminifi/test/archive-tests/FocusArchiveTests.cpp +++ b/libminifi/test/archive-tests/FocusArchiveTests.cpp @@ -55,7 +55,7 @@ TEST_CASE("Test Creation of UnfocusArchiveEntry", "[getfileCreate]") { TestController testController; std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::UnfocusArchiveEntry>("processorname"); REQUIRE(processor->getName() == "processorname"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/archive-tests/ManipulateArchiveTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/archive-tests/ManipulateArchiveTests.cpp b/libminifi/test/archive-tests/ManipulateArchiveTests.cpp index 3bc23b7..c254a39 100644 --- a/libminifi/test/archive-tests/ManipulateArchiveTests.cpp +++ b/libminifi/test/archive-tests/ManipulateArchiveTests.cpp @@ -111,7 +111,7 @@ TEST_CASE("Test creation of ManipulateArchive", "[manipulatearchiveCreate]") { TestController testController; std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ManipulateArchive>("processorname"); REQUIRE(processor->getName() == "processorname"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/archive-tests/MergeFileTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/archive-tests/MergeFileTests.cpp b/libminifi/test/archive-tests/MergeFileTests.cpp index d1b42c6..b919370 100644 --- a/libminifi/test/archive-tests/MergeFileTests.cpp +++ b/libminifi/test/archive-tests/MergeFileTests.cpp @@ -134,9 +134,9 @@ TEST_CASE("MergeFileDefragment", "[mergefiletest1]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::MergeContent>("mergecontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -306,9 +306,9 @@ TEST_CASE("MergeFileDefragmentDelimiter", "[mergefiletest2]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::MergeContent>("mergecontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -469,9 +469,9 @@ TEST_CASE("MergeFileDefragmentDropFlow", "[mergefiletest3]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::MergeContent>("mergecontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -634,9 +634,9 @@ TEST_CASE("MergeFileBinPack", "[mergefiletest4]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::MergeContent>("mergecontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -782,9 +782,9 @@ TEST_CASE("MergeFileTar", "[mergefiletest4]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::MergeContent>("mergecontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -939,9 +939,9 @@ TEST_CASE("MergeFileZip", "[mergefiletest5]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::MergeContent>("mergecontent"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/bustache-tests/ApplyTemplateTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/bustache-tests/ApplyTemplateTests.cpp b/libminifi/test/bustache-tests/ApplyTemplateTests.cpp index 02cc61a..e83167e 100644 --- a/libminifi/test/bustache-tests/ApplyTemplateTests.cpp +++ b/libminifi/test/bustache-tests/ApplyTemplateTests.cpp @@ -50,7 +50,7 @@ TEST_CASE("Test Creation of ApplyTemplate", "[ApplyTemplateCreate]") { TestController testController; std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ApplyTemplate>("processorname"); REQUIRE(processor->getName() == "processorname"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(processor->getUUID(processoruuid)); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/expression-language-tests/RouteOnAttributeTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/expression-language-tests/RouteOnAttributeTests.cpp b/libminifi/test/expression-language-tests/RouteOnAttributeTests.cpp index d8b4560..329ffe0 100644 --- a/libminifi/test/expression-language-tests/RouteOnAttributeTests.cpp +++ b/libminifi/test/expression-language-tests/RouteOnAttributeTests.cpp @@ -32,32 +32,19 @@ TEST_CASE("RouteOnAttributeMatchedTest", "[routeOnAttributeMatchedTest]") { std::shared_ptr<TestPlan> plan = testController.createPlan(); - const auto &generate_proc = plan->addProcessor("GenerateFlowFile", - "generate"); + const auto &generate_proc = plan->addProcessor("GenerateFlowFile", "generate"); - const auto &update_proc = plan->addProcessor("UpdateAttribute", - "update", - core::Relationship("success", "description"), - true); + const auto &update_proc = plan->addProcessor("UpdateAttribute", "update", core::Relationship("success", "description"), true); plan->setProperty(update_proc, "route_condition_attr", "true", true); - const auto &route_proc = plan->addProcessor("RouteOnAttribute", - "route", - core::Relationship("success", "description"), - true); - route_proc->setAutoTerminatedRelationships({{core::Relationship("unmatched", "description")}}); + const auto &route_proc = plan->addProcessor("RouteOnAttribute", "route", core::Relationship("success", "description"), true); + route_proc->setAutoTerminatedRelationships({ { core::Relationship("unmatched", "description") } }); plan->setProperty(route_proc, "route_matched", "${route_condition_attr}", true); - const auto &update_matched_proc = plan->addProcessor("UpdateAttribute", - "update_matched", - core::Relationship("route_matched", "description"), - true); + const auto &update_matched_proc = plan->addProcessor("UpdateAttribute", "update_matched", core::Relationship("route_matched", "description"), true); plan->setProperty(update_matched_proc, "route_check_attr", "good", true); - const auto &log_proc = plan->addProcessor("LogAttribute", - "log", - core::Relationship("success", "description"), - true); + const auto &log_proc = plan->addProcessor("LogAttribute", "log", core::Relationship("success", "description"), true); testController.runSession(plan, false); // generate testController.runSession(plan, false); // update @@ -80,31 +67,18 @@ TEST_CASE("RouteOnAttributeUnmatchedTest", "[routeOnAttributeUnmatchedTest]") { std::shared_ptr<TestPlan> plan = testController.createPlan(); - const auto &generate_proc = plan->addProcessor("GenerateFlowFile", - "generate"); + const auto &generate_proc = plan->addProcessor("GenerateFlowFile", "generate"); - const auto &update_proc = plan->addProcessor("UpdateAttribute", - "update", - core::Relationship("success", "description"), - true); + const auto &update_proc = plan->addProcessor("UpdateAttribute", "update", core::Relationship("success", "description"), true); plan->setProperty(update_proc, "route_condition_attr", "false", true); - const auto &route_proc = plan->addProcessor("RouteOnAttribute", - "route", - core::Relationship("success", "description"), - true); + const auto &route_proc = plan->addProcessor("RouteOnAttribute", "route", core::Relationship("success", "description"), true); plan->setProperty(route_proc, "route_matched", "${route_condition_attr}", true); - const auto &update_matched_proc = plan->addProcessor("UpdateAttribute", - "update_matched", - core::Relationship("unmatched", "description"), - true); + const auto &update_matched_proc = plan->addProcessor("UpdateAttribute", "update_matched", core::Relationship("unmatched", "description"), true); plan->setProperty(update_matched_proc, "route_check_attr", "good", true); - const auto &log_proc = plan->addProcessor("LogAttribute", - "log", - core::Relationship("success", "description"), - true); + const auto &log_proc = plan->addProcessor("LogAttribute", "log", core::Relationship("success", "description"), true); testController.runSession(plan, false); // generate testController.runSession(plan, false); // update http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/integration/TestExecuteProcess.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/integration/TestExecuteProcess.cpp b/libminifi/test/integration/TestExecuteProcess.cpp index 5f2c6e2..f4f28d9 100644 --- a/libminifi/test/integration/TestExecuteProcess.cpp +++ b/libminifi/test/integration/TestExecuteProcess.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) { std::shared_ptr<minifi::FlowController> controller = std::make_shared< TestFlowController>(test_repo, test_repo, content_repo); - uuid_t processoruuid; + utils::Identifier processoruuid; assert(true == processor->getUUID(processoruuid)); std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, content_repo, "executeProcessConnection"); connection->setRelationship(core::Relationship("success", "description")); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/rocksdb-tests/RepoTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/rocksdb-tests/RepoTests.cpp b/libminifi/test/rocksdb-tests/RepoTests.cpp index c92133a..bf9f51c 100644 --- a/libminifi/test/rocksdb-tests/RepoTests.cpp +++ b/libminifi/test/rocksdb-tests/RepoTests.cpp @@ -30,6 +30,9 @@ #include "properties/Configure.h" TEST_CASE("Test Repo Empty Value Attribute", "[TestFFR1]") { + LogTestController::getInstance().setDebug<core::ContentRepository>(); + LogTestController::getInstance().setDebug<core::repository::FileSystemRepository>(); + LogTestController::getInstance().setDebug<core::repository::FlowFileRepository>(); TestController testController; char format[] = "/tmp/testRepo.XXXXXX"; char *dir = testController.createTempDirectory(format); @@ -44,10 +47,15 @@ TEST_CASE("Test Repo Empty Value Attribute", "[TestFFR1]") { REQUIRE(true == record.Serialize()); + utils::file::FileUtils::delete_dir(FLOWFILE_CHECKPOINT_DIRECTORY, true); + repository->stop(); } TEST_CASE("Test Repo Empty Key Attribute ", "[TestFFR2]") { + LogTestController::getInstance().setDebug<core::ContentRepository>(); + LogTestController::getInstance().setDebug<core::repository::FileSystemRepository>(); + LogTestController::getInstance().setDebug<core::repository::FlowFileRepository>(); TestController testController; char format[] = "/tmp/testRepo.XXXXXX"; char *dir = testController.createTempDirectory(format); @@ -63,10 +71,15 @@ TEST_CASE("Test Repo Empty Key Attribute ", "[TestFFR2]") { REQUIRE(true == record.Serialize()); + utils::file::FileUtils::delete_dir(FLOWFILE_CHECKPOINT_DIRECTORY, true); + repository->stop(); } TEST_CASE("Test Repo Key Attribute Verify ", "[TestFFR3]") { + LogTestController::getInstance().setDebug<core::ContentRepository>(); + LogTestController::getInstance().setDebug<core::repository::FileSystemRepository>(); + LogTestController::getInstance().setDebug<core::repository::FlowFileRepository>(); TestController testController; char format[] = "/tmp/testRepo.XXXXXX"; char *dir = testController.createTempDirectory(format); @@ -108,6 +121,8 @@ TEST_CASE("Test Repo Key Attribute Verify ", "[TestFFR3]") { REQUIRE(true == record2.getAttribute("keyB", value)); REQUIRE("" == value); + + utils::file::FileUtils::delete_dir(FLOWFILE_CHECKPOINT_DIRECTORY, true); } TEST_CASE("Test Delete Content ", "[TestFFR4]") { @@ -159,16 +174,19 @@ TEST_CASE("Test Delete Content ", "[TestFFR4]") { std::ifstream fileopen(ss.str()); REQUIRE(false == fileopen.good()); + utils::file::FileUtils::delete_dir(FLOWFILE_CHECKPOINT_DIRECTORY, true); + LogTestController::getInstance().reset(); } - TEST_CASE("Test Validate Checkpoint ", "[TestFFR5]") { TestController testController; + utils::file::FileUtils::delete_dir(FLOWFILE_CHECKPOINT_DIRECTORY, true); char format[] = "/tmp/testRepo.XXXXXX"; LogTestController::getInstance().setDebug<core::ContentRepository>(); - LogTestController::getInstance().setDebug<core::repository::FileSystemRepository>(); - LogTestController::getInstance().setDebug<core::repository::FlowFileRepository>(); + LogTestController::getInstance().setTrace<core::repository::FileSystemRepository>(); + LogTestController::getInstance().setTrace<minifi::ResourceClaim>(); + LogTestController::getInstance().setTrace<minifi::FlowFileRecord>(); char *dir = testController.createTempDirectory(format); @@ -190,30 +208,37 @@ TEST_CASE("Test Validate Checkpoint ", "[TestFFR5]") { repository->loadComponent(content_repo); std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(ss.str(), content_repo); + { + minifi::FlowFileRecord record(repository, content_repo, attributes, claim); - minifi::FlowFileRecord record(repository, content_repo, attributes, claim); + record.addAttribute("keyA", "hasdgasdgjsdgasgdsgsadaskgasd"); - record.addAttribute("keyA", "hasdgasdgjsdgasgdsgsadaskgasd"); + record.addAttribute("", "hasdgasdgjsdgasgdsgsadaskgasd"); - record.addAttribute("", "hasdgasdgjsdgasgdsgsadaskgasd"); + REQUIRE(true == record.Serialize()); - REQUIRE(true == record.Serialize()); - - repository->flush(); + repository->flush(); - repository->stop(); + repository->stop(); - repository->loadComponent(content_repo); + repository->loadComponent(content_repo); - repository->start(); + repository->start(); - // sleep for 100 ms to let the delete work. - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + repository->stop(); + claim = nullptr; + // sleep for 100 ms to let the delete work. - repository->stop(); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } std::ifstream fileopen(ss.str()); - REQUIRE(false == fileopen.good()); + + REQUIRE(true == fileopen.fail()); + + utils::file::FileUtils::delete_dir(FLOWFILE_CHECKPOINT_DIRECTORY, true); LogTestController::getInstance().reset(); } + http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/C2MetricsTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/C2MetricsTests.cpp b/libminifi/test/unit/C2MetricsTests.cpp index 231e634..b21b3ee 100644 --- a/libminifi/test/unit/C2MetricsTests.cpp +++ b/libminifi/test/unit/C2MetricsTests.cpp @@ -46,8 +46,8 @@ TEST_CASE("TestSystemMetrics", "[c2m5]") { REQUIRE(2 == metrics.serialize().size()); - REQUIRE("identifier" == metrics.serialize().at(0).name); - REQUIRE("systemInfo" == metrics.serialize().at(1).name); + REQUIRE("systemInfo" == metrics.serialize().at(0).name); + REQUIRE("identifier" == metrics.serialize().at(1).name); } TEST_CASE("QueueMetricsTestNoConnections", "[c2m2]") { http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/ExtractTextTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/ExtractTextTests.cpp b/libminifi/test/unit/ExtractTextTests.cpp index 545996e..5931210 100644 --- a/libminifi/test/unit/ExtractTextTests.cpp +++ b/libminifi/test/unit/ExtractTextTests.cpp @@ -46,7 +46,7 @@ TEST_CASE("Test Creation of ExtractText", "[extracttextCreate]") { TestController testController; std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ExtractText>("processorname"); REQUIRE(processor->getName() == "processorname"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(processor->getUUID(processoruuid)); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/GetTCPTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/GetTCPTests.cpp b/libminifi/test/unit/GetTCPTests.cpp index 34765e7..777ffd5 100644 --- a/libminifi/test/unit/GetTCPTests.cpp +++ b/libminifi/test/unit/GetTCPTests.cpp @@ -36,6 +36,10 @@ #include "core/reporting/SiteToSiteProvenanceReportingTask.h" TEST_CASE("GetTCPWithoutEOM", "[GetTCP1]") { + utils::Identifier ident = utils::Identifier(); + + std::cout << (ident == nullptr) << std::endl; + std::cout << ident.to_string() << std::endl; TestController testController; std::vector<uint8_t> buffer; for (auto c : "Hello World\nHello Warld\nGoodByte Cruel world") { @@ -64,12 +68,14 @@ TEST_CASE("GetTCPWithoutEOM", "[GetTCP1]") { processor->setStreamFactory(stream_factory); processor->initialize(); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logattribute_uuid; + utils::Identifier logattribute_uuid; REQUIRE(true == logAttribute->getUUID(logattribute_uuid)); + REQUIRE(processoruuid.to_string() != logattribute_uuid.to_string()); + std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, content_repo, "gettcpexampleConnection"); connection->setRelationship(core::Relationship("success", "description")); @@ -176,10 +182,10 @@ TEST_CASE("GetTCPWithOEM", "[GetTCP2]") { processor->setStreamFactory(stream_factory); processor->initialize(); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logattribute_uuid; + utils::Identifier logattribute_uuid; REQUIRE(true == logAttribute->getUUID(logattribute_uuid)); std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, content_repo, "gettcpexampleConnection"); @@ -301,10 +307,10 @@ TEST_CASE("GetTCPWithOnlyOEM", "[GetTCP3]") { processor->setStreamFactory(stream_factory); processor->initialize(); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logattribute_uuid; + utils::Identifier logattribute_uuid; REQUIRE(true == logAttribute->getUUID(logattribute_uuid)); std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, content_repo, "gettcpexampleConnection"); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/IdTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/IdTests.cpp b/libminifi/test/unit/IdTests.cpp index c60aedb..90ddcd2 100644 --- a/libminifi/test/unit/IdTests.cpp +++ b/libminifi/test/unit/IdTests.cpp @@ -100,13 +100,15 @@ TEST_CASE("Test Hex Device Segment 16 bits correct digits", "[id]") { std::shared_ptr<utils::IdGenerator> generator = utils::IdGenerator::getIdGenerator(); generator->initialize(id_props); - uuid_t uid; - generator->generate(uid); + utils::Identifier uuid; + generator->generate(uuid); + auto uid = uuid.toArray(); REQUIRE(0x09 == uid[0]); REQUIRE(0xaf == uid[1]); REQUIRE(0 == uid[15]); - generator->generate(uid); + generator->generate(uuid); + uid = uuid.toArray(); REQUIRE(0x09 == uid[0]); REQUIRE(0xaf == uid[1]); REQUIRE(1 == uid[15]); @@ -126,14 +128,16 @@ TEST_CASE("Test Hex Device Segment 16 bits too many digits", "[id]") { std::shared_ptr<utils::IdGenerator> generator = utils::IdGenerator::getIdGenerator(); generator->initialize(id_props); - uuid_t uid; - generator->generate(uid); + utils::Identifier uuid; + generator->generate(uuid); + auto uid = uuid.toArray(); REQUIRE(0x09 == uid[0]); REQUIRE(0xaf == uid[1]); REQUIRE(0 == (uid[2] & 128)); REQUIRE(0 == uid[15]); - generator->generate(uid); + generator->generate(uuid); + uid = uuid.toArray(); REQUIRE(0x09 == uid[0]); REQUIRE(0xaf == uid[1]); REQUIRE(0 == (uid[2] & 128)); @@ -155,19 +159,27 @@ TEST_CASE("Test Hex Device Segment 18 bits", "[id]") { std::shared_ptr<utils::IdGenerator> generator = utils::IdGenerator::getIdGenerator(); generator->initialize(id_props); - uuid_t uid; - generator->generate(uid); + utils::Identifier uuid; + generator->generate(uuid); + auto uid = uuid.toArray(); REQUIRE(0x09 == uid[0]); REQUIRE(0xaf == uid[1]); REQUIRE(128 == (uid[2] & 192)); REQUIRE(0 == uid[15]); - generator->generate(uid); + generator->generate(uuid); + uid = uuid.toArray(); REQUIRE(0x09 == uid[0]); REQUIRE(0xaf == uid[1]); REQUIRE(128 == (uid[2] & 192)); REQUIRE(1 == uid[15]); + + utils::Identifier uuid2; + generator->generate(uuid2); + REQUIRE(uuid.to_string() != uuid2.to_string()); + REQUIRE(uuid != uuid2); + REQUIRE(true == LogTestController::getInstance().contains("Using minifi uid prefix: 9af8")); LogTestController::getInstance().reset(); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/ManifestTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/ManifestTests.cpp b/libminifi/test/unit/ManifestTests.cpp index 83811a2..7e463dd 100644 --- a/libminifi/test/unit/ManifestTests.cpp +++ b/libminifi/test/unit/ManifestTests.cpp @@ -59,8 +59,10 @@ TEST_CASE("Test Valid Regex", "[validRegex]") { const auto &prop_0 = prop_descriptors.children[0]; REQUIRE(prop_0.children.size() >= 3); const auto &df = prop_0.children[3]; - REQUIRE("defaultValue" == df.name); - const auto &prop_0_valid_regex = prop_0.children[4]; + REQUIRE("expressionLanguageScope" == df.name); + const auto &prop_0_defv = prop_0.children[4]; + REQUIRE("defaultValue" == prop_0_defv.name); + const auto &prop_0_valid_regex = prop_0.children[5]; REQUIRE("validRegex" == prop_0_valid_regex.name); } @@ -110,8 +112,8 @@ TEST_CASE("Test Dependent", "[dependent]") { REQUIRE(prop_descriptors.children.size() > 0); const auto &prop_0 = prop_descriptors.children[1]; REQUIRE(prop_0.children.size() >= 3); - REQUIRE("defaultValue" == prop_0.children[3].name); - REQUIRE("validRegex" == prop_0.children[4].name); + REQUIRE("expressionLanguageScope" == prop_0.children[3].name); + REQUIRE("defaultValue" == prop_0.children[4].name); const auto &prop_0_dependent_0 = prop_descriptors.children[2]; REQUIRE("Directory" == prop_0_dependent_0.name); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/MockClasses.h ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/MockClasses.h b/libminifi/test/unit/MockClasses.h index 00eaf82..7f0bd88 100644 --- a/libminifi/test/unit/MockClasses.h +++ b/libminifi/test/unit/MockClasses.h @@ -33,13 +33,13 @@ class MockControllerService : public core::controller::ControllerService { } - explicit MockControllerService(const std::string &name, uuid_t uuid) + explicit MockControllerService(const std::string &name, utils::Identifier & uuid) : ControllerService(name, uuid) { } explicit MockControllerService(const std::string &name) - : ControllerService(name, 0) { + : ControllerService(name) { } MockControllerService() { @@ -81,13 +81,13 @@ class MockControllerService : public core::controller::ControllerService { class MockProcessor : public core::Processor { public: - explicit MockProcessor(const std::string &name, uuid_t uuid) + explicit MockProcessor(const std::string &name, utils::Identifier uuid) : Processor(name, uuid) { setTriggerWhenEmpty(true); } explicit MockProcessor(const std::string &name) - : Processor(name, 0) { + : Processor(name) { setTriggerWhenEmpty(true); } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/ProcessorTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/ProcessorTests.cpp b/libminifi/test/unit/ProcessorTests.cpp index 8810763..32ba181 100644 --- a/libminifi/test/unit/ProcessorTests.cpp +++ b/libminifi/test/unit/ProcessorTests.cpp @@ -53,7 +53,7 @@ TEST_CASE("Test GetFileMultiple", "[getfileCreate3]") { char format[] = "/tmp/gt.XXXXXX"; char *dir = testController.createTempDirectory(format); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, content_repo, "getfileCreate2Connection"); @@ -137,7 +137,7 @@ TEST_CASE("Test GetFile Ignore", "[getfileCreate3]") { char format[] = "/tmp/gt.XXXXXX"; char *dir = testController.createTempDirectory(format); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, content_repo, "getfileCreate2Connection"); @@ -332,7 +332,7 @@ TEST_CASE("Test Find file", "[getfileCreate3]") { class TestProcessorNoContent : public minifi::core::Processor { public: - explicit TestProcessorNoContent(std::string name, uuid_t uuid = NULL) + explicit TestProcessorNoContent(std::string name, utils::Identifier uuid = NULL) : Processor(name, uuid), Success("success", "All files are routed to success") { } http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/ProvenanceTestHelper.h ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/ProvenanceTestHelper.h b/libminifi/test/unit/ProvenanceTestHelper.h index db7b35a..00547af 100644 --- a/libminifi/test/unit/ProvenanceTestHelper.h +++ b/libminifi/test/unit/ProvenanceTestHelper.h @@ -46,7 +46,7 @@ class TestRepository : public core::Repository { public: TestRepository() - : core::SerializableComponent("repo_name", 0), + : core::SerializableComponent("repo_name"), Repository("repo_name", "./dir", 1000, 100, 0) { } // initialize @@ -155,7 +155,7 @@ class TestRepository : public core::Repository { class TestFlowRepository : public core::Repository { public: TestFlowRepository() - : core::SerializableComponent("ff", 0), + : core::SerializableComponent("ff"), core::Repository("ff", "./dir", 1000, 100, 0) { } // initialize @@ -256,19 +256,19 @@ class TestFlowController : public minifi::FlowController { return true; } - std::shared_ptr<core::Processor> createProcessor(std::string name, uuid_t uuid) { + std::shared_ptr<core::Processor> createProcessor(std::string name, utils::Identifier & uuid) { return 0; } - core::ProcessGroup *createRootProcessGroup(std::string name, uuid_t uuid) { + core::ProcessGroup *createRootProcessGroup(std::string name, utils::Identifier & uuid) { return 0; } - core::ProcessGroup *createRemoteProcessGroup(std::string name, uuid_t uuid) { + core::ProcessGroup *createRemoteProcessGroup(std::string name, utils::Identifier & uuid) { return 0; } - std::shared_ptr<minifi::Connection> createConnection(std::string name, uuid_t uuid) { + std::shared_ptr<minifi::Connection> createConnection(std::string name, utils::Identifier & uuid) { return 0; } protected: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/Site2SiteTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/Site2SiteTests.cpp b/libminifi/test/unit/Site2SiteTests.cpp index ff2b44a..732df70 100644 --- a/libminifi/test/unit/Site2SiteTests.cpp +++ b/libminifi/test/unit/Site2SiteTests.cpp @@ -38,9 +38,9 @@ TEST_CASE("TestSetPortId", "[S2S1]") { std::string uuid_str = "c56a4180-65aa-42ec-a945-5fd21dec0538"; - uuid_t fakeUUID; + utils::Identifier fakeUUID; - uuid_parse(uuid_str.c_str(), fakeUUID); + fakeUUID = uuid_str; protocol.setPortId(fakeUUID); @@ -55,9 +55,9 @@ TEST_CASE("TestSetPortIdUppercase", "[S2S2]") { std::string uuid_str = "C56A4180-65AA-42EC-A945-5FD21DEC0538"; - uuid_t fakeUUID; + utils::Identifier fakeUUID; - uuid_parse(uuid_str.c_str(), fakeUUID); + fakeUUID = uuid_str; protocol.setPortId(fakeUUID); @@ -100,9 +100,9 @@ TEST_CASE("TestSiteToSiteVerifySend", "[S2S3]") { std::string uuid_str = "C56A4180-65AA-42EC-A945-5FD21DEC0538"; - uuid_t fakeUUID; + utils::Identifier fakeUUID; - uuid_parse(uuid_str.c_str(), fakeUUID); + fakeUUID = uuid_str; protocol.setPortId(fakeUUID); @@ -124,7 +124,7 @@ TEST_CASE("TestSiteToSiteVerifySend", "[S2S3]") { collector->get_next_client_response(); REQUIRE(collector->get_next_client_response() == "PORT_IDENTIFIER"); collector->get_next_client_response(); - REQUIRE(collector->get_next_client_response() == "c56a4180-65aa-42ec-a945-5fd21dec0538"); + REQUIRE(utils::StringUtils::equalsIgnoreCase(collector->get_next_client_response(), "c56a4180-65aa-42ec-a945-5fd21dec0538")); collector->get_next_client_response(); REQUIRE(collector->get_next_client_response() == "REQUEST_EXPIRATION_MILLIS"); collector->get_next_client_response(); @@ -169,9 +169,9 @@ TEST_CASE("TestSiteToSiteVerifyNegotiationFail", "[S2S4]") { std::string uuid_str = "C56A4180-65AA-42EC-A945-5FD21DEC0538"; - uuid_t fakeUUID; + utils::Identifier fakeUUID; - uuid_parse(uuid_str.c_str(), fakeUUID); + fakeUUID = uuid_str; protocol.setPortId(fakeUUID); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2b0a55e4/libminifi/test/unit/TailFileTests.cpp ---------------------------------------------------------------------- diff --git a/libminifi/test/unit/TailFileTests.cpp b/libminifi/test/unit/TailFileTests.cpp index 62cb0eb..379ee40 100644 --- a/libminifi/test/unit/TailFileTests.cpp +++ b/libminifi/test/unit/TailFileTests.cpp @@ -50,7 +50,7 @@ TEST_CASE("TailFileWithDelimiter", "[tailfiletest1]") { tmpfile.close(); TestController testController; - LogTestController::getInstance().setDebug<minifi::processors::TailFile>(); + LogTestController::getInstance().setTrace<minifi::processors::TailFile>(); LogTestController::getInstance().setDebug<core::ProcessSession>(); LogTestController::getInstance().setDebug<minifi::processors::LogAttribute>(); @@ -134,9 +134,9 @@ TEST_CASE("TailFileWithDelimiter", "[tailfiletest1]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::TailFile>("tailfile"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); @@ -203,9 +203,9 @@ TEST_CASE("TailFileWithoutDelimiter", "[tailfiletest2]") { std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::TailFile>("tailfile"); std::shared_ptr<core::Processor> logAttributeProcessor = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute"); - uuid_t processoruuid; + utils::Identifier processoruuid; REQUIRE(true == processor->getUUID(processoruuid)); - uuid_t logAttributeuuid; + utils::Identifier logAttributeuuid; REQUIRE(true == logAttributeProcessor->getUUID(logAttributeuuid)); std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();