- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Dynamically Changing AllowableValues
- Labels:
-
Apache NiFi
Created 07-13-2023 06:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created 07-13-2023 11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@MattMa Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @cotopaul and @MattWho who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
