Member since
07-13-2023
1
Post
0
Kudos Received
0
Solutions
07-13-2023
06:22 AM
I'm writing a custom processor that reads from a CSV file to determine what allowableValues to support for a specific property. I do this by reading the CSV during the processor's init method and then building the property accordingly. However, now my customer would like the specific CSV used by the processor to be configurable in NIFI. To this end I tried to add a new ControllerService that would read the CSV and then supply the data to the Processor. The problem is that whenever I run a unit test to test the processor, I discover that the ControllerService isn't available in the init method. The contract says that I should be able to lookup controllers via the getControllerServiceLookup API. However, when using TestRunners to create a test case, the init method is called immediately. Before I can add any services to the TestRunner. This means that the code won't work in unit tests. I'm not sure if it would work in 'production' but I'm extremely reluctant to implement anything that can't be tested in some type of unit test. Can anyone offer suggestions for approaches to dynamically changing the allowableValues after the init method has already run? Or conversely, explain how I can get around this unit test problem? Thanks
... View more
Labels:
- Labels:
-
Apache NiFi