exceptionfactory commented on a change in pull request #4981: URL: https://github.com/apache/nifi/pull/4981#discussion_r610608711
########## File path: nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/test/java/org/apache/nifi/redis/service/TestRedisConnectionPoolService.java ########## @@ -19,17 +19,39 @@ import org.apache.nifi.redis.RedisConnectionPool; import org.apache.nifi.redis.util.RedisUtils; import org.apache.nifi.reporting.InitializationException; +import org.apache.nifi.security.util.KeyStoreUtils; +import org.apache.nifi.security.util.SslContextFactory; +import org.apache.nifi.ssl.RestrictedSSLContextService; +import org.apache.nifi.util.MockConfigurationContext; +import org.apache.nifi.util.MockProcessContext; +import org.apache.nifi.util.StandardProcessorTestRunner; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; +import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.security.GeneralSecurityException; public class TestRedisConnectionPoolService { + public static final String SSL_CONTEXT_IDENTIFIER = "ssl-context-service"; private TestRunner testRunner; private FakeRedisProcessor proc; private RedisConnectionPool redisService; + private static SSLContext sslContext; + + @BeforeClass + public static void classSetup() throws IOException, GeneralSecurityException { + sslContext = SslContextFactory.createSslContext(KeyStoreUtils.createTlsConfigAndNewKeystoreTruststore()); Review comment: `KeyStoreUtils.createTlsConfigAndNewKeystoreTruststore()` create files in the `java.io.tmpdir` directory that need to be deleted after the test completes. However, given that the unit test is only checking for the presence of certain SSLContext objects, this could be simplified to just using `SSLContext.getDefault()` and avoid the need to create the keystore and truststore files. ```suggestion sslContext = SSLContext.getDefault(); ``` ########## File path: nifi-nar-bundles/nifi-redis-bundle/nifi-redis-extensions/src/test/java/org/apache/nifi/redis/service/TestRedisConnectionPoolService.java ########## @@ -39,6 +61,69 @@ public void setup() throws InitializationException { testRunner.addControllerService("redis-service", redisService); } + private void enableSslContextService(final SSLContext sslContext) throws InitializationException { Review comment: The `SSLContext` parameter can be removed since it is already a private static variable. ```suggestion private void enableSslContextService() throws InitializationException { ``` -- 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