exceptionfactory commented on a change in pull request #4981:
URL: https://github.com/apache/nifi/pull/4981#discussion_r608949849



##########
File path: 
nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/test/java/org/apache/nifi/redis/service/TestRedisConnectionPoolService.java
##########
@@ -39,6 +47,71 @@ public void setup() throws InitializationException {
         testRunner.addControllerService("redis-service", redisService);
     }
 
+    @Test
+    public void testSSLContextService() throws InitializationException {
+        StandardRestrictedSSLContextService sslContextService = new 
StandardRestrictedSSLContextService();
+        testRunner.addControllerService("ssl-context-service", 
sslContextService);
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks");
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword");
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.TRUSTSTORE_TYPE, "JKS");
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.KEYSTORE, "src/test/resources/keystore.jks");
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword");
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.KEYSTORE_TYPE, "JKS");
+        testRunner.setProperty(sslContextService, 
StandardSSLContextService.SSL_ALGORITHM, TlsConfiguration.TLS_1_2_PROTOCOL);

Review comment:
       Rather than creating an instance of `RestrictedSSLContextService`, 
recommend mocking the interface and return a mocked `SSLContext`.  This avoids 
the test dependency on the `nifi-ssl-context-service` library and also avoids 
checking committing additional binary keystore and truststore files.  See other 
components for examples of mocking the `RestrictedSSLContextService` interface 
for testing.




-- 
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:
us...@infra.apache.org


Reply via email to