bbende commented on a change in pull request #3904: NIFI-6833 
KeytabCredentialsService updated to qualify a principal wit…
URL: https://github.com/apache/nifi/pull/3904#discussion_r353808614
 
 

 ##########
 File path: 
nifi-mock/src/main/java/org/apache/nifi/util/MockControllerServiceInitializationContext.java
 ##########
 @@ -32,19 +34,37 @@
     private final StateManager stateManager;
     private volatile boolean isClustered;
     private volatile boolean isPrimaryNode;
+    private NiFiProperties nifiProperties;
 
     public MockControllerServiceInitializationContext(final ControllerService 
controllerService, final String identifier) {
-        this(controllerService, identifier, new 
MockStateManager(controllerService));
+        this(controllerService, identifier, new 
MockStateManager(controllerService), 
NiFiProperties.createBasicNiFiProperties(null, Collections.emptyMap()));
+    }
+
+    public MockControllerServiceInitializationContext(final ControllerService 
controllerService, final String identifier, final NiFiProperties 
nifiProperties) {
+        this(controllerService, identifier, new 
MockStateManager(controllerService), nifiProperties);
     }
 
     public MockControllerServiceInitializationContext(final ControllerService 
controllerService, final String identifier, final StateManager stateManager) {
-        this(controllerService, identifier, new MockComponentLog(identifier, 
controllerService), stateManager);
+        this(controllerService, identifier, new MockComponentLog(identifier, 
controllerService), stateManager, NiFiProperties.createBasicNiFiProperties(null,
+                Collections.emptyMap()));
+    }
+
+    public MockControllerServiceInitializationContext(final ControllerService 
controllerService, final String identifier, final StateManager stateManager,
+                                                      final NiFiProperties 
nifiProperties) {
+        this(controllerService, identifier, new MockComponentLog(identifier, 
controllerService), stateManager, nifiProperties);
     }
 
     public MockControllerServiceInitializationContext(final ControllerService 
controllerService, final String identifier, final ComponentLog logger, final 
StateManager stateManager) {
+        this(controllerService, identifier, new MockComponentLog(identifier, 
controllerService), stateManager, NiFiProperties.createBasicNiFiProperties(null,
+                Collections.emptyMap()));
+    }
+
+    public MockControllerServiceInitializationContext(final ControllerService 
controllerService, final String identifier, final ComponentLog logger, final 
StateManager stateManager,
+                                                      final NiFiProperties 
nifiProperties) {
         this.identifier = identifier;
         this.logger = logger;
         this.stateManager = stateManager;
+        this.nifiProperties = nifiProperties == null ? 
NiFiProperties.createBasicNiFiProperties(null, Collections.emptyMap()) : 
nifiProperties;
 
 Review comment:
   I'm wondering it it makes sense to use NiFiProperties with in the mock 
framework. I know it that is how the running application obtains the kerberos 
properties, but it feels like the mock framework shouldn't have to really use 
NiFiProperties.
   
   What do you think about this approach...
   - Implement a class `MockKerberosContext` that implements `KerberosContext`
   - Add a member variable of `KerberosContext ` to 
`StandardProcessorTestRunner`
   - Add a new constructor to `StandardProcessorTestRunner` that allows you to 
pass in a `KerberosContext `
   - Add a new overload factory method to `TestRunners` that allows passing in 
a `KerberosContext `
   - In `StandardProcessorTestRunner`, whenever a 
`MockControllerServiceInitializationContext` is created, pass in the 
`KerberosContext ` that was set, and have it delegate to that

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to