You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Dan Bress <db...@onyxconsults.com> on 2015/04/02 17:18:24 UTC

Do I need to specifically enable a ControllerService in a unit test?

Lets say I have a ControllerService that loads some data into memory, and lets say that is happening during OnEnabled.  If I want to test this behavior using the NiFi Mock TestRunner, do I need to explicitly call "enableControllerService" to cause the "@OnEnabled" method on my ControllerService to be called?


Looking at StandardSSLContextService [1] this appears to be the case.  I was not aware of this requirement, and wanted to make sure I understood it.


Is this part of allowing full life cycle support for controller services and NIFI-250?  Any reason to not automatically enable controller services during mock testing?  Or is the thinking that explicitly calling it allows you finer grained testing of difference scenarios.


Thanks!


[1] https://github.com/apache/incubator-nifi/blob/develop/nifi/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/java/org/apache/nifi/ssl/SSLContextServiceTest.java#L106


Dan Bress
Software Engineer
ONYX Consulting Services