lordgamez commented on a change in pull request #1253: URL: https://github.com/apache/nifi-minifi-cpp/pull/1253#discussion_r816641846
########## File path: extensions/http-curl/tests/HTTPHandlers.h ########## @@ -446,13 +453,122 @@ class HeartbeatHandler : public ServerAwareHandler { } assert(found); (void)found; // unused in release builds + + verifySupportedOperations(root, verify_components, disallowed_properties); } - virtual void handleHeartbeat(const rapidjson::Document& root, struct mg_connection *) { - verifyJsonHasAgentManifest(root); + private: + using Metadata = std::unordered_map<std::string, std::vector<std::unordered_map<std::string, std::string>>>; + + void sendStopOperation(struct mg_connection *conn) { + std::string resp = "{\"operation\" : \"heartbeat\", \"requested_operations\" : [{ \"operationid\" : 41, \"operation\" : \"stop\", \"operand\" : \"invoke\" }, " + "{ \"operationid\" : 42, \"operation\" : \"stop\", \"operand\" : \"FlowController\" } ]}"; + mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: " + "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n", + resp.length()); + mg_printf(conn, "%s", resp.c_str()); } - virtual void handleAcknowledge(const rapidjson::Document&) { + std::set<std::string> getOperandsofProperties(const rapidjson::Value& operation_node) { + std::set<std::string> operands; + assert(operation_node.HasMember("properties")); + const auto& properties_node = operation_node["properties"]; + for (auto it = properties_node.MemberBegin(); it < properties_node.MemberEnd(); ++it) { + operands.insert(it->name.GetString()); + } + return operands; + } + + void verifyMetadata(const rapidjson::Value& operation_node, const std::unordered_map<std::string, Metadata>& operand_with_metadata) { + std::unordered_map<std::string, Metadata> operand_with_metadata_found; + const auto& properties_node = operation_node["properties"]; + for (auto prop_it = properties_node.MemberBegin(); prop_it < properties_node.MemberEnd(); ++prop_it) { Review comment: It must have been a mistake as the `properties` node was previously an array and we were iterating through it using its `size()` method, so it should have been changed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org