This is an automated email from the ASF dual-hosted git repository.
aldrin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new 2194662 MINIFICPP-756: Remove usage of setrelationship, deprecate it,
and support multiple relationships in connection class
2194662 is described below
commit 2194662075282e5e1c10e39ae571932f65a090f4
Author: Marc Parisi <[email protected]>
AuthorDate: Wed Mar 6 13:30:39 2019 -0500
MINIFICPP-756: Remove usage of setrelationship, deprecate it, and support
multiple relationships in connection class
This closes #501.
Signed-off-by: Aldrin Piri <[email protected]>
---
.../http-curl/tests/unit/InvokeHTTPTests.cpp | 16 +++---
libminifi/include/Connection.h | 21 +++++---
libminifi/src/core/Processor.cpp | 61 ++++++++++++----------
libminifi/src/core/yaml/YamlConfiguration.cpp | 24 +++++----
libminifi/test/TestBase.cpp | 4 +-
.../test/archive-tests/CompressContentTests.cpp | 16 +++---
libminifi/test/archive-tests/MergeFileTests.cpp | 12 ++---
libminifi/test/integration/TestExecuteProcess.cpp | 2 +-
libminifi/test/unit/GetTCPTests.cpp | 12 ++---
libminifi/test/unit/ProcessorTests.cpp | 4 +-
libminifi/test/unit/TailFileTests.cpp | 4 +-
nanofi/src/cxx/Plan.cpp | 2 +-
12 files changed, 97 insertions(+), 81 deletions(-)
diff --git a/extensions/http-curl/tests/unit/InvokeHTTPTests.cpp
b/extensions/http-curl/tests/unit/InvokeHTTPTests.cpp
index db12530..6b54bb7 100644
--- a/extensions/http-curl/tests/unit/InvokeHTTPTests.cpp
+++ b/extensions/http-curl/tests/unit/InvokeHTTPTests.cpp
@@ -65,17 +65,17 @@ TEST_CASE("HTTPTestsWithNoResourceClaimPOST",
"[httptest1]") {
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
std::shared_ptr<minifi::Connection> gcConnection =
std::make_shared<minifi::Connection>(repo, content_repo,
"getfileCreate2Connection");
- gcConnection->setRelationship(core::Relationship("success", "description"));
+ gcConnection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> laConnection =
std::make_shared<minifi::Connection>(repo, content_repo, "logattribute");
- laConnection->setRelationship(core::Relationship("success", "description"));
+ laConnection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"getfileCreate2Connection");
- connection->setRelationship(core::Relationship("success", "description"));
+ connection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> connection2 =
std::make_shared<minifi::Connection>(repo, content_repo, "listenhttp");
- connection2->setRelationship(core::Relationship("No Retry", "description"));
+ connection2->addRelationship(core::Relationship("No Retry", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(listenhttp);
@@ -184,17 +184,17 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST",
"[httptest1]") {
std::shared_ptr<core::ContentRepository> content_repo =
std::make_shared<core::repository::VolatileContentRepository>();
std::shared_ptr<minifi::Connection> gcConnection =
std::make_shared<minifi::Connection>(repo, content_repo,
"getfileCreate2Connection");
- gcConnection->setRelationship(core::Relationship("success", "description"));
+ gcConnection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> laConnection =
std::make_shared<minifi::Connection>(repo, content_repo, "logattribute");
- laConnection->setRelationship(core::Relationship("success", "description"));
+ laConnection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"getfileCreate2Connection");
- connection->setRelationship(core::Relationship("success", "description"));
+ connection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> connection2 =
std::make_shared<minifi::Connection>(repo, content_repo, "listenhttp");
- connection2->setRelationship(core::Relationship("No Retry", "description"));
+ connection2->addRelationship(core::Relationship("No Retry", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(listenhttp);
diff --git a/libminifi/include/Connection.h b/libminifi/include/Connection.h
index 046c0d2..fc511c0 100644
--- a/libminifi/include/Connection.h
+++ b/libminifi/include/Connection.h
@@ -50,7 +50,7 @@ class Connection : public core::Connectable, public
std::enable_shared_from_this
explicit Connection(const std::shared_ptr<core::Repository>
&flow_repository, const std::shared_ptr<core::ContentRepository> &content_repo,
std::string name);
explicit Connection(const std::shared_ptr<core::Repository>
&flow_repository, const std::shared_ptr<core::ContentRepository> &content_repo,
std::string name, utils::Identifier & uuid);
explicit Connection(const std::shared_ptr<core::Repository>
&flow_repository, const std::shared_ptr<core::ContentRepository> &content_repo,
std::string name, utils::Identifier & uuid,
- utils::Identifier & srcUUID);
+ utils::Identifier & srcUUID);
explicit Connection(const std::shared_ptr<core::Repository>
&flow_repository, const std::shared_ptr<core::ContentRepository> &content_repo,
std::string name, utils::Identifier & uuid,
utils::Identifier & srcUUID, utils::Identifier &
destUUID);
// Destructor
@@ -90,13 +90,22 @@ class Connection : public core::Connectable, public
std::enable_shared_from_this
std::shared_ptr<core::Connectable> getDestination() {
return dest_connectable_;
}
- // Set Connection relationship
+
+ /**
+ * Deprecated function
+ * Please use addRelationship.
+ */
void setRelationship(core::Relationship relationship) {
- relationship_ = relationship;
+ relationships_.insert(relationship);
+ }
+
+ // Set Connection relationship
+ void addRelationship(core::Relationship relationship) {
+ relationships_.insert(relationship);
}
// ! Get Connection relationship
- core::Relationship getRelationship() {
- return relationship_;
+ const std::set<core::Relationship> &getRelationships() const {
+ return relationships_;
}
// Set Max Queue Size
void setMaxQueueSize(uint64_t size) {
@@ -166,7 +175,7 @@ class Connection : public core::Connectable, public
std::enable_shared_from_this
// Destination Processor UUID
utils::Identifier dest_uuid_;
// Relationship for this connection
- core::Relationship relationship_;
+ std::set<core::Relationship> relationships_;
// Source Processor (ProcessNode/Port)
std::shared_ptr<core::Connectable> source_connectable_;
// Destination Processor (ProcessNode/Port)
diff --git a/libminifi/src/core/Processor.cpp b/libminifi/src/core/Processor.cpp
index 480ae58..939e9a9 100644
--- a/libminifi/src/core/Processor.cpp
+++ b/libminifi/src/core/Processor.cpp
@@ -126,31 +126,33 @@ bool
Processor::addConnection(std::shared_ptr<Connectable> conn) {
}
std::string source_uuid = srcUUID.to_string();
if (my_uuid == source_uuid) {
- std::string relationship = connection->getRelationship().getName();
- // Connection is source from the current processor
- auto &&it = out_going_connections_.find(relationship);
- if (it != out_going_connections_.end()) {
- // We already has connection for this relationship
- std::set<std::shared_ptr<Connectable>> existedConnection = it->second;
- if (existedConnection.find(connection) == existedConnection.end()) {
- // We do not have the same connection for this relationship yet
- existedConnection.insert(connection);
+ const auto &rels = connection->getRelationships();
+ for (auto i = rels.begin(); i != rels.end(); i++) {
+ const auto relationship = (*i).getName();
+ // Connection is source from the current processor
+ auto &&it = out_going_connections_.find(relationship);
+ if (it != out_going_connections_.end()) {
+ // We already has connection for this relationship
+ std::set<std::shared_ptr<Connectable>> existedConnection = it->second;
+ if (existedConnection.find(connection) == existedConnection.end()) {
+ // We do not have the same connection for this relationship yet
+ existedConnection.insert(connection);
+ connection->setSource(shared_from_this());
+ out_going_connections_[relationship] = existedConnection;
+ logger_->log_debug("Add connection %s into Processor %s outgoing
connection for relationship %s", connection->getName(), name_, relationship);
+ ret = true;
+ }
+ } else {
+ // We do not have any outgoing connection for this relationship yet
+ std::set<std::shared_ptr<Connectable>> newConnection;
+ newConnection.insert(connection);
connection->setSource(shared_from_this());
- out_going_connections_[relationship] = existedConnection;
+ out_going_connections_[relationship] = newConnection;
logger_->log_debug("Add connection %s into Processor %s outgoing
connection for relationship %s", connection->getName(), name_, relationship);
ret = true;
}
- } else {
- // We do not have any outgoing connection for this relationship yet
- std::set<std::shared_ptr<Connectable>> newConnection;
- newConnection.insert(connection);
- connection->setSource(shared_from_this());
- out_going_connections_[relationship] = newConnection;
- logger_->log_debug("Add connection %s into Processor %s outgoing
connection for relationship %s", connection->getName(), name_, relationship);
- ret = true;
}
}
-
return ret;
}
@@ -181,16 +183,17 @@ void
Processor::removeConnection(std::shared_ptr<Connectable> conn) {
}
if (uuid_ == srcUUID) {
- std::string relationship = connection->getRelationship().getName();
- // Connection is source from the current processor
- auto &&it = out_going_connections_.find(relationship);
- if (it == out_going_connections_.end()) {
- return;
- } else {
- if (out_going_connections_[relationship].find(connection) !=
out_going_connections_[relationship].end()) {
- out_going_connections_[relationship].erase(connection);
- connection->setSource(NULL);
- logger_->log_debug("Remove connection %s into Processor %s outgoing
connection for relationship %s", connection->getName(), name_, relationship);
+ const auto &rels = connection->getRelationships();
+ for (auto i = rels.begin(); i != rels.end(); i++) {
+ const auto relationship = (*i).getName();
+ // Connection is source from the current processor
+ auto &&it = out_going_connections_.find(relationship);
+ if (it != out_going_connections_.end()) {
+ if (out_going_connections_[relationship].find(connection) !=
out_going_connections_[relationship].end()) {
+ out_going_connections_[relationship].erase(connection);
+ connection->setSource(NULL);
+ logger_->log_debug("Remove connection %s into Processor %s outgoing
connection for relationship %s", connection->getName(), name_, relationship);
+ }
}
}
}
diff --git a/libminifi/src/core/yaml/YamlConfiguration.cpp
b/libminifi/src/core/yaml/YamlConfiguration.cpp
index b96bfcb..cbbc6e5 100644
--- a/libminifi/src/core/yaml/YamlConfiguration.cpp
+++ b/libminifi/src/core/yaml/YamlConfiguration.cpp
@@ -534,20 +534,24 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node
*connectionsNode, core::P
core::Relationship relationship(rawRelationship, "");
logger_->log_debug("parseConnection: relationship => [%s]",
rawRelationship);
if (connection) {
- connection->setRelationship(relationship);
+ connection->addRelationship(relationship);
}
} else if (connectionNode.as<YAML::Node>()["source relationship
names"]) {
auto relList = connectionNode["source relationship names"];
-
- if (relList.size() != 1) {
- throw std::invalid_argument("Only one element is supported for
'source relationship names'");
- }
-
- auto rawRelationship = relList[0].as<std::string>();
- core::Relationship relationship(rawRelationship, "");
- logger_->log_debug("parseConnection: relationship => [%s]",
rawRelationship);
if (connection) {
- connection->setRelationship(relationship);
+ if (relList.IsSequence()) {
+ for (const auto &rel : relList) {
+ auto rawRelationship = rel.as<std::string>();
+ core::Relationship relationship(rawRelationship, "");
+ logger_->log_debug("parseConnection: relationship => [%s]",
rawRelationship);
+ connection->addRelationship(relationship);
+ }
+ } else {
+ auto rawRelationship = relList.as<std::string>();
+ core::Relationship relationship(rawRelationship, "");
+ logger_->log_debug("parseConnection: relationship => [%s]",
rawRelationship);
+ connection->addRelationship(relationship);
+ }
}
}
diff --git a/libminifi/test/TestBase.cpp b/libminifi/test/TestBase.cpp
index 9b42a3e..0d2b92b 100644
--- a/libminifi/test/TestBase.cpp
+++ b/libminifi/test/TestBase.cpp
@@ -63,7 +63,7 @@ std::shared_ptr<core::Processor> TestPlan::addProcessor(const
std::shared_ptr<co
connection_name << last->getUUIDStr() << "-to-" << processor->getUUIDStr();
logger_->log_info("Creating %s connection for proc %d",
connection_name.str(), processor_queue_.size() + 1);
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(flow_repo_, content_repo_,
connection_name.str());
- connection->setRelationship(relationship);
+ connection->addRelationship(relationship);
// link the connections so that we can test results at the end for this
connection->setSource(last);
@@ -192,7 +192,7 @@ std::shared_ptr<minifi::Connection>
TestPlan::buildFinalConnection(std::shared_p
std::shared_ptr<core::Processor> last = processor;
connection_name << last->getUUIDStr() << "-to-" << processor->getUUIDStr();
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(flow_repo_, content_repo_,
connection_name.str());
- connection->setRelationship(termination_);
+ connection->addRelationship(termination_);
// link the connections so that we can test results at the end for this
connection->setSource(last);
diff --git a/libminifi/test/archive-tests/CompressContentTests.cpp
b/libminifi/test/archive-tests/CompressContentTests.cpp
index 30fe677..db82607 100644
--- a/libminifi/test/archive-tests/CompressContentTests.cpp
+++ b/libminifi/test/archive-tests/CompressContentTests.cpp
@@ -125,7 +125,7 @@ TEST_CASE("CompressFileGZip", "[compressfiletest1]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -226,7 +226,7 @@ TEST_CASE("DecompressFileGZip", "[compressfiletest2]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -329,7 +329,7 @@ TEST_CASE("CompressFileBZip", "[compressfiletest3]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -430,7 +430,7 @@ TEST_CASE("DecompressFileBZip", "[compressfiletest4]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -533,7 +533,7 @@ TEST_CASE("CompressFileLZMA", "[compressfiletest5]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -640,7 +640,7 @@ TEST_CASE("DecompressFileLZMA", "[compressfiletest6]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -750,7 +750,7 @@ TEST_CASE("CompressFileXYLZMA", "[compressfiletest7]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -857,7 +857,7 @@ TEST_CASE("DecompressFileXYLZMA", "[compressfiletest8]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from compress processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "compress
successful output"));
+ connection->addRelationship(core::Relationship("success", "compress
successful output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
diff --git a/libminifi/test/archive-tests/MergeFileTests.cpp
b/libminifi/test/archive-tests/MergeFileTests.cpp
index c07338a..7076ed2 100644
--- a/libminifi/test/archive-tests/MergeFileTests.cpp
+++ b/libminifi/test/archive-tests/MergeFileTests.cpp
@@ -143,7 +143,7 @@ TEST_CASE("MergeFileDefragment", "[mergefiletest1]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from merge processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("merged", "Merge successful
output"));
+ connection->addRelationship(core::Relationship("merged", "Merge successful
output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -315,7 +315,7 @@ TEST_CASE("MergeFileDefragmentDelimiter",
"[mergefiletest2]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from merge processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("merged", "Merge successful
output"));
+ connection->addRelationship(core::Relationship("merged", "Merge successful
output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -478,7 +478,7 @@ TEST_CASE("MergeFileDefragmentDropFlow",
"[mergefiletest3]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from merge processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("merged", "Merge successful
output"));
+ connection->addRelationship(core::Relationship("merged", "Merge successful
output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -643,7 +643,7 @@ TEST_CASE("MergeFileBinPack", "[mergefiletest4]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from merge processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("merged", "Merge successful
output"));
+ connection->addRelationship(core::Relationship("merged", "Merge successful
output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -791,7 +791,7 @@ TEST_CASE("MergeFileTar", "[mergefiletest4]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from merge processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("merged", "Merge successful
output"));
+ connection->addRelationship(core::Relationship("merged", "Merge successful
output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
@@ -948,7 +948,7 @@ TEST_CASE("MergeFileZip", "[mergefiletest5]") {
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
// connection from merge processor to log attribute
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("merged", "Merge successful
output"));
+ connection->addRelationship(core::Relationship("merged", "Merge successful
output"));
connection->setSource(processor);
connection->setDestination(logAttributeProcessor);
connection->setSourceUUID(processoruuid);
diff --git a/libminifi/test/integration/TestExecuteProcess.cpp
b/libminifi/test/integration/TestExecuteProcess.cpp
index f4f28d9..b68a83c 100644
--- a/libminifi/test/integration/TestExecuteProcess.cpp
+++ b/libminifi/test/integration/TestExecuteProcess.cpp
@@ -59,7 +59,7 @@ int main(int argc, char **argv) {
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"));
+ connection->addRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(processor);
diff --git a/libminifi/test/unit/GetTCPTests.cpp
b/libminifi/test/unit/GetTCPTests.cpp
index a8a987a..c9f8718 100644
--- a/libminifi/test/unit/GetTCPTests.cpp
+++ b/libminifi/test/unit/GetTCPTests.cpp
@@ -77,10 +77,10 @@ TEST_CASE("GetTCPWithoutEOM", "[GetTCP1]") {
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"));
+ connection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> connection2 =
std::make_shared<minifi::Connection>(repo, content_repo, "logattribute");
- connection2->setRelationship(core::Relationship("success", "description"));
+ connection2->addRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(processor);
@@ -190,10 +190,10 @@ TEST_CASE("GetTCPWithOEM", "[GetTCP2]") {
REQUIRE(true == logAttribute->getUUID(logattribute_uuid));
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"gettcpexampleConnection");
- connection->setRelationship(core::Relationship("partial", "description"));
+ connection->addRelationship(core::Relationship("partial", "description"));
std::shared_ptr<minifi::Connection> connection2 =
std::make_shared<minifi::Connection>(repo, content_repo, "logattribute");
- connection2->setRelationship(core::Relationship("partial", "description"));
+ connection2->addRelationship(core::Relationship("partial", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(processor);
@@ -315,10 +315,10 @@ TEST_CASE("GetTCPWithOnlyOEM", "[GetTCP3]") {
REQUIRE(true == logAttribute->getUUID(logattribute_uuid));
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"gettcpexampleConnection");
- connection->setRelationship(core::Relationship("success", "description"));
+ connection->addRelationship(core::Relationship("success", "description"));
std::shared_ptr<minifi::Connection> connection2 =
std::make_shared<minifi::Connection>(repo, content_repo, "logattribute");
- connection2->setRelationship(core::Relationship("success", "description"));
+ connection2->addRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(processor);
diff --git a/libminifi/test/unit/ProcessorTests.cpp
b/libminifi/test/unit/ProcessorTests.cpp
index b231c9b..592013c 100644
--- a/libminifi/test/unit/ProcessorTests.cpp
+++ b/libminifi/test/unit/ProcessorTests.cpp
@@ -58,7 +58,7 @@ TEST_CASE("Test GetFileMultiple", "[getfileCreate3]") {
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(test_repo, content_repo,
"getfileCreate2Connection");
- connection->setRelationship(core::Relationship("success", "description"));
+ connection->addRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(processor);
@@ -142,7 +142,7 @@ TEST_CASE("Test GetFile Ignore", "[getfileCreate3]") {
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(test_repo, content_repo,
"getfileCreate2Connection");
- connection->setRelationship(core::Relationship("success", "description"));
+ connection->addRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
connection->setSource(processor);
diff --git a/libminifi/test/unit/TailFileTests.cpp
b/libminifi/test/unit/TailFileTests.cpp
index f42255c..b6241ce 100644
--- a/libminifi/test/unit/TailFileTests.cpp
+++ b/libminifi/test/unit/TailFileTests.cpp
@@ -142,7 +142,7 @@ TEST_CASE("TailFileWithDelimiter", "[tailfiletest1]") {
std::shared_ptr<core::ContentRepository> content_repo =
std::make_shared<core::repository::VolatileContentRepository>();
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "TailFile
successful output"));
+ connection->addRelationship(core::Relationship("success", "TailFile
successful output"));
// link the connections so that we can test results at the end for this
connection->setDestination(connection);
@@ -211,7 +211,7 @@ TEST_CASE("TailFileWithoutDelimiter", "[tailfiletest2]") {
std::shared_ptr<core::ContentRepository> content_repo =
std::make_shared<core::repository::VolatileContentRepository>();
content_repo->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(repo, content_repo,
"logattributeconnection");
- connection->setRelationship(core::Relationship("success", "TailFile
successful output"));
+ connection->addRelationship(core::Relationship("success", "TailFile
successful output"));
// link the connections so that we can test results at the end for this
connection->setDestination(connection);
diff --git a/nanofi/src/cxx/Plan.cpp b/nanofi/src/cxx/Plan.cpp
index 32c2d19..242b03b 100644
--- a/nanofi/src/cxx/Plan.cpp
+++ b/nanofi/src/cxx/Plan.cpp
@@ -283,7 +283,7 @@ std::shared_ptr<minifi::Connection>
ExecutionPlan::connectProcessors(std::shared
std::stringstream connection_name;
connection_name << src_proc->getUUIDStr() << "-to-" <<
dst_proc->getUUIDStr();
std::shared_ptr<minifi::Connection> connection =
std::make_shared<minifi::Connection>(flow_repo_, content_repo_,
connection_name.str());
- connection->setRelationship(relationship);
+ connection->addRelationship(relationship);
// link the connections so that we can test results at the end for this
connection->setSource(src_proc);