I am implementing a custom processor based on JSON messages.
I have unit tests around the processor. These verify the expected
functionality and are similar to:
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream inputStream =
loader.getResourceAsStream("matched.json");
testRunner.enqueue(inputStream);
testRunner.run();
testRunner.assertTransferCount(JsonRouteProcessor.REL_MATCHED, 1);
testRunner.assertQueueEmpty();
Once I drop my processor into the NiFi server and put it in my flow, this
processor does not route messages as expected and as verified in the unit
tests. I can't see into the logic in the logs, just that this processor
routed the message to the wrong downstream processor. I've even taken the
messages the processor rejects in my NiFi flow and ran them through my unit
tests - they behave as expected.
Do I have a misunderstanding of the correct way to unit test the onTrigger
method for my processor?
*Jeremiah Adams*
Senior Software Developer
Pearson
2154 East Commons Ave.
Suite 400
Centennial, CO 80122
Always Learning
Learn more at www.pearson.com