[ 
https://issues.apache.org/jira/browse/MINIFICPP-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16652701#comment-16652701
 ] 

ASF GitHub Bot commented on MINIFICPP-638:
------------------------------------------

Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/417#discussion_r225498252
  
    --- 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 --
    
    Let's avoid names in submissions. 


> C API: add unit tests
> ---------------------
>
>                 Key: MINIFICPP-638
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-638
>             Project: NiFi MiNiFi C++
>          Issue Type: Sub-task
>            Reporter: Arpad Boda
>            Assignee: Arpad Boda
>            Priority: Minor
>             Fix For: 0.6.0
>
>
> Add some C API unit tests. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to