szaszm commented on a change in pull request #1177:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1177#discussion_r712137870



##########
File path: libminifi/test/unit/ContentRepositoryDependentTests.h
##########
@@ -0,0 +1,119 @@
+/**
+ *
+ * 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 <memory>
+#include <string>
+#include <vector>
+
+#include <catch.hpp>
+#include "core/ProcessSession.h"
+#include "core/Resource.h"
+#include "../TestBase.h"
+#include "StreamPipe.h"
+
+#pragma once
+
+namespace ContentRepositoryDependentTests {
+
+struct WriteStringToFlowFile : public minifi::OutputStreamCallback {
+  const std::vector<uint8_t> buffer_;
+
+  explicit WriteStringToFlowFile(const std::string& buffer) : 
buffer_(buffer.begin(), buffer.end()) {}
+
+  int64_t process(const std::shared_ptr<minifi::io::BaseStream> &stream) 
override {
+    size_t bytes_written = stream->write(buffer_, buffer_.size());
+    return minifi::io::isError(bytes_written) ? -1 : 
gsl::narrow<int64_t>(bytes_written);
+  }
+};
+
+struct ReadFlowFileIntoString : public minifi::InputStreamCallback {
+  std::string value_;
+
+  int64_t process(const std::shared_ptr<minifi::io::BaseStream> &stream) 
override {
+    value_.clear();
+    std::vector<uint8_t> buffer;
+    size_t bytes_read = stream->read(buffer, stream->size());
+    value_.assign(buffer.begin(), buffer.end());
+    return minifi::io::isError(bytes_read) ? -1 : 
gsl::narrow<int64_t>(bytes_read);
+  }
+};
+
+class DummyProcessor : public core::Processor {
+  using core::Processor::Processor;
+};
+
+REGISTER_RESOURCE(DummyProcessor, "A processor that does nothing.");
+
+template<class ContentRepositoryClass>
+class Fixture {

Review comment:
       I would make the same modifications here as I suggested for createPlan: 
Keep things simple and take a content repo as parameter instead of making the 
whole thing a template.
   In this case, I'm thinking about a constructor parameter for `Fixture` and a 
function parameter for `testReadOnSmallerClonedFlowFiles`.




-- 
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