szaszm commented on a change in pull request #743: Minificpp 1169 - Simplify C2 
metrics collection and reporting
URL: https://github.com/apache/nifi-minifi-cpp/pull/743#discussion_r392364257
 
 

 ##########
 File path: extensions/http-curl/tests/C2VerifyHeartbeatAndStop.cpp
 ##########
 @@ -16,132 +16,48 @@
  * limitations under the License.
  */
 
-#include <sys/stat.h>
 #undef NDEBUG
-#include <cassert>
-#include <utility>
-#include <chrono>
-#include <fstream>
-#include <memory>
-#include <string>
-#include <thread>
-#include <type_traits>
-#include <vector>
-#include <iostream>
-#include <sstream>
-#include "HTTPClient.h"
-#include "InvokeHTTP.h"
 #include "TestBase.h"
-#include "utils/StringUtils.h"
-#include "core/Core.h"
-#include "core/logging/Logger.h"
-#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
-#include "FlowController.h"
-#include "properties/Configure.h"
-#include "unit/ProvenanceTestHelper.h"
-#include "io/StreamFactory.h"
-#include "CivetServer.h"
-#include "RemoteProcessorGroupPort.h"
-#include "core/ConfigurableComponent.h"
-#include "controllers/SSLContextService.h"
-#include "TestServer.h"
 #include "c2/C2Agent.h"
-#include "protocols/RESTReceiver.h"
+#include "protocols/RESTProtocol.h"
 #include "protocols/RESTSender.h"
+#include "protocols/RESTReceiver.h"
 #include "HTTPIntegrationBase.h"
-#include "agent/build_description.h"
-#include "processors/LogAttribute.h"
+#include "HTTPHandlers.h"
 
-class Responder : public CivetHandler {
+class LightWeightC2Handler : public HeartbeatHandler {
  public:
-  explicit Responder(bool isSecure)
-      : isSecure(isSecure) {
+  explicit LightWeightC2Handler(bool isSecure)
+      : HeartbeatHandler(isSecure) {
   }
 
-  std::string readPost(struct mg_connection *conn) {
-    std::string response;
-    int blockSize = 1024 * sizeof(char), readBytes;
+  virtual ~LightWeightC2Handler() = default;
 
-    char buffer[1024];
-    while ((readBytes = mg_read(conn, buffer, blockSize)) > 0) {
-      response.append(buffer, 0, (readBytes / sizeof(char)));
+  virtual void handleHeartbeat(const rapidjson::Document& root, struct 
mg_connection *)  {
+    if (calls_ == 0) {
+      verifyJsonHasAgentManifest(root);
+    } else {
+      assert(root.HasMember("agentInfo") == true);
+      assert(root["agentInfo"].HasMember("agentManifest") == false);
 
 Review comment:
   redundant `== true`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to