Github user arpadboda commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/417#discussion_r225850037
--- Diff: libminifi/test/capi/CAPITests.cpp ---
@@ -0,0 +1,199 @@
+/**
+ *
+ * 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 <uuid/uuid.h>
+#include <sys/stat.h>
+#include <utility>
+#include <memory>
+#include <string>
+#include <vector>
+#include <set>
+#include <fstream>
+
+
+#include "utils/file/FileUtils.h"
+#include "../TestBase.h"
+
+#include "capi/api.h"
+
+#include <chrono>
+#include <thread>
+
+TEST_CASE("Test Creation of instance, one processor",
"[createInstanceAndFlow]") {
+ nifi_instance *instance = create_instance("random_instance",
create_port("12345"));
+ REQUIRE(instance != nullptr);
+ flow *test_flow = create_flow(instance, nullptr);
+ REQUIRE(test_flow != nullptr);
+ processor *test_proc = add_processor(test_flow, "GenerateFlowFile");
+ REQUIRE(test_proc != nullptr);
+ free_flow(test_flow);
+ free_instance(instance);
+}
+
+TEST_CASE("Invalid processor returns null", "[addInvalidProcessor]") {
+ nifi_instance *instance = create_instance("random_instance",
create_port("12345"));
+ REQUIRE(instance != nullptr);
+ flow *test_flow = create_flow(instance, nullptr);
+ processor *test_proc = add_processor(test_flow, "NeverExisted");
+ REQUIRE(test_proc == nullptr);
+ processor *no_proc = add_processor(test_flow, "");
+ REQUIRE(no_proc == nullptr);
+ free_flow(test_flow);
+ free_instance(instance);
+}
+
+TEST_CASE("Set valid and invalid properties", "[setProcesssorProperties]")
{
+ nifi_instance *instance = create_instance("random_instance",
create_port("12345"));
+ REQUIRE(instance != nullptr);
+ flow *test_flow = create_flow(instance, nullptr);
+ REQUIRE(test_flow != nullptr);
+ processor *test_proc = add_processor(test_flow, "GenerateFlowFile");
+ REQUIRE(test_proc != nullptr);
+ REQUIRE(set_property(test_proc, "Data Format", "Text") == 0); // Valid
value
+ // TODO(aboda): add this two below when property handling is made
strictly typed
--- End diff --
That's the format linter requires, although this file is going to be
excluded anyway, so will remove.
---