martinzink commented on a change in pull request #1188:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1188#discussion_r724153459



##########
File path: libminifi/test/ReadFromFlowFileTestProcessor.h
##########
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string>
+#include <memory>
+
+#include "core/Processor.h"
+#include "core/ProcessSession.h"
+#include "core/Core.h"
+#include "core/Resource.h"
+
+#pragma once
+
+namespace org::apache::nifi::minifi::processors {
+
+class ReadFromFlowFileTestProcessor : public core::Processor {
+ public:
+  static const std::string OnScheduleLogStr;
+  static const std::string OnTriggerLogStr;
+  static const std::string OnUnScheduleLogStr;
+
+  explicit ReadFromFlowFileTestProcessor(const std::string& name, const 
utils::Identifier& uuid = utils::Identifier())
+      : Processor(name, uuid), 
logger_(logging::LoggerFactory<ReadFromFlowFileTestProcessor>::getLogger()) {

Review comment:
       :+1: Added it in 
https://github.com/apache/nifi-minifi-cpp/pull/1188/commits/18ca91b7df6d97278af30ecc7537d2f55767071b

##########
File path: libminifi/test/ReadFromFlowFileTestProcessor.cpp
##########
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ReadFromFlowFileTestProcessor.h"
+
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace org::apache::nifi::minifi::processors {
+
+const std::string ReadFromFlowFileTestProcessor::OnScheduleLogStr = 
"ReadFromFlowFileTestProcessor::onSchedule executed";
+const std::string ReadFromFlowFileTestProcessor::OnTriggerLogStr = 
"ReadFromFlowFileTestProcessor::onTrigger executed";
+const std::string ReadFromFlowFileTestProcessor::OnUnScheduleLogStr = 
"ReadFromFlowFileTestProcessor::onUnSchedule";
+
+core::Relationship ReadFromFlowFileTestProcessor::Success("success", "success 
operational on the flow record");
+
+void ReadFromFlowFileTestProcessor::initialize() {
+  setSupportedRelationships({ Success });
+}
+
+void ReadFromFlowFileTestProcessor::onSchedule(core::ProcessContext*, 
core::ProcessSessionFactory*) {
+  logger_->log_info("%s", OnScheduleLogStr);
+}
+
+namespace {
+struct ReadFlowFileIntoBuffer : public InputStreamCallback {
+  std::vector<uint8_t> buffer_;
+
+  int64_t process(const std::shared_ptr<io::BaseStream> &stream) override {
+    size_t bytes_read = stream->read(buffer_, stream->size());
+    return io::isError(bytes_read) ? -1 : gsl::narrow<int64_t>(bytes_read);
+  }
+};
+}
+
+void ReadFromFlowFileTestProcessor::onTrigger(core::ProcessContext* context, 
core::ProcessSession* session) {
+  logger_->log_info("%s", OnTriggerLogStr);

Review comment:
       :+1: Added it in 
https://github.com/apache/nifi-minifi-cpp/pull/1188/commits/18ca91b7df6d97278af30ecc7537d2f55767071b




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to