'Nifi testing : Input Port and Output Port

I have a flow with one input and 2 output flows (happy path and failure path). I would like to test the flow, thinking to put message directly to the input flow and validate the output flows. Possible options are to use REST api or site-2-site with transaction ?. I managed to get to use site-to-site for write and read but i have noticed that output port is left with message even after consuming it (i did commit the transaction i.e . transaction.confirm() & transaction.complete()).

Anyone managed to get this working and can share the sample code ? please or any other way to test this ?



Solution 1:[1]

I would recommend putting this flow into a process group and on the root (or ancestor process group) canvas, use a GenerateFlowFile processor to generate test fixture data and route this to the PG input port. Then use one or more LogAttribute processors to consume the success/failure output and verify it. This ad-hoc test harness will make refining your flow much easier.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andy