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

ASF GitHub Bot commented on NIFI-5318:
--------------------------------------

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

    https://github.com/apache/nifi/pull/2872#discussion_r201485489
  
    --- Diff: 
nifi-testharness/src/main/java/org/apache/nifi/testharness/TestNiFiInstance.java
 ---
    @@ -0,0 +1,485 @@
    +/*
    + * 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.
    + */
    +
    +
    +
    +package org.apache.nifi.testharness;
    +
    +import org.apache.nifi.testharness.api.FlowFileEditorCallback;
    +import org.apache.nifi.EmbeddedNiFi;
    +import org.apache.nifi.testharness.util.FileUtils;
    +import org.apache.nifi.testharness.util.NiFiCoreLibClassLoader;
    +import org.apache.nifi.testharness.util.XmlUtils;
    +import org.apache.nifi.testharness.util.Zip;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
    +
    +import java.util.Arrays;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.Objects;
    +import java.util.Set;
    +import java.util.zip.ZipEntry;
    +
    +/**
    + * <p>
    + * An API wrapper of a "test" NiFi instance to which a flow definition is 
installed for testing.</p>
    + *
    + * <p>
    + * Due to NiFi design restrictions, {@code TestNiFiInstance} has to take 
<i>full command</i>
    + * of the current working directory: it installs a full NiFi installation 
to there. To ensure
    + * this is desired, <strong>it will only run if the current directory is 
called
    + * "nifi_testharness_nifi_home"</strong>. As such the JVM process has to 
be started inside a directory
    + * called "nifi_testharness_nifi_home" so that the following is true:
    + *
    + * <pre><tt>
    + *     new 
File(System.getProperty("user.dir")).getName().equals("nifi_testharness_nifi_home")
    + * </tt></pre>
    + * </p>
    + *
    + * <p>
    + * Before {@code TestNiFiInstance} can be used, it has to be configured 
via its builder
    + * interface:
    + * <ul>
    + *     <li>
    + *      {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the 
location of the NiFi binary
    --- End diff --
    
    I think this should refer to `setNiFiBinaryDistributionZip` instead


> Implement NiFi test harness
> ---------------------------
>
>                 Key: NIFI-5318
>                 URL: https://issues.apache.org/jira/browse/NIFI-5318
>             Project: Apache NiFi
>          Issue Type: New Feature
>            Reporter: Peter Horvath
>            Priority: Major
>
> Currently, it is not really possible to automatically test the behaviour of a 
> specific NiFi flow and make unit test type asserts if it works as expected. 
> For example, if the expected behaviour of a NiFi flow is that a file placed 
> to a specific directory will trigger some operation after which some output 
> file will appear at another directory, once currently can only do one thing: 
> test the NiFi flow manually. 
> Manual testing is especially hard to manage if a NiFi flow is being actively 
> developed: any change to a complex, existing NiFi flow might require a lot of 
> manual testing just to ensure there are no regressions introduced. 
> Some kind of Java API that allows managing a NiFi instance and manipulating 
> flow deployments like for example, [Codehaus 
> Cargo|]https://codehaus-cargo.github.io/] would be of great help. 
>  
>  
>  
>  



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

Reply via email to