I've been getting lots of questions about how to develop/debug scripts
that go into ExecuteScript. One way to do this is to add a unit test
to the nifi-scripting-processors submodule, and set the Script File
property to your test script. However for this you basically need the
full NiFi source.

To make things easier, I basically took a pared-down copy of the
ExecuteScript processor (and its helper classes), added nifi-mock as a
dependency, and slapped a command-line interface on it. This way with
a single JAR you can run your script inside a dummy flow containing
ExecuteScript.

 Announcing v1.0 of the NiFi Script Tester utility:
https://github.com/mattyb149/nifi-script-tester

also on Bintray:
https://bintray.com/mattyb149/maven/download_file?file_path=mattyb149%2Fnifi-script-tester%2F1.0%2Fnifi-script-tester-1.0-all.jar

Basically it runs your script as a little unit test, and you can pipe
stdin to become a flowfile, or point it at a directory and it will
send every file as a flowfile, stuff like that. If your script doesn't
need a flowfile, you can run it without specifying an input dir or
piping in stdin, it will run once even without input.

It only supports Javascript and Groovy at the moment; including Jython
for example would 5X the size :/ Right now its only 8.4 MB, so a
little big but not too bad.

Anyway hope this helps, please let me know how/if it works for you!

Cheers,
Matt

Reply via email to