Repository: nifi Updated Branches: refs/heads/master 8e233ca2e -> f65286be8
http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java index 799d1b7..117a068 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java @@ -263,11 +263,11 @@ public class TestListenHTTP { private SSLContextService configureProcessorSslContextService() throws InitializationException { final SSLContextService sslContextService = new StandardRestrictedSSLContextService(); runner.addControllerService(SSL_CONTEXT_SERVICE_IDENTIFIER, sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/keystore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); runner.setProperty(ListenHTTP.SSL_CONTEXT_SERVICE, SSL_CONTEXT_SERVICE_IDENTIFIER); @@ -277,11 +277,11 @@ public class TestListenHTTP { private SSLContextService configureInvalidProcessorSslContextService() throws InitializationException { final SSLContextService sslContextService = new StandardSSLContextService(); runner.addControllerService(SSL_CONTEXT_SERVICE_IDENTIFIER, sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/keystore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); runner.setProperty(ListenHTTP.SSL_CONTEXT_SERVICE, SSL_CONTEXT_SERVICE_IDENTIFIER); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenRELP.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenRELP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenRELP.java index 5ff47dc..3843183 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenRELP.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenRELP.java @@ -152,11 +152,11 @@ public class TestListenRELP { public void testTLS() throws InitializationException, IOException, InterruptedException { final SSLContextService sslContextService = new StandardSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/keystore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); runner.enableControllerService(sslContextService); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCP.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCP.java index 08127d1..f4d3aa0 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCP.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCP.java @@ -123,11 +123,11 @@ public class TestListenTCP { // Make an SSLContext with a key and trust store to send the test messages final SSLContext clientSslContext = SslContextFactory.createSslContext( - "src/test/resources/localhost-ks.jks", - "localtest".toCharArray(), + "src/test/resources/keystore.jks", + "passwordpassword".toCharArray(), "jks", - "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), + "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "jks", org.apache.nifi.security.util.SslContextFactory.ClientAuth.valueOf("NONE"), "TLS"); @@ -156,8 +156,8 @@ public class TestListenTCP { // Make an SSLContext that only has the trust store, this should not work since the processor has client auth REQUIRED final SSLContext clientSslContext = SslContextFactory.createTrustSslContext( - "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), + "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "jks", "TLS"); @@ -185,8 +185,8 @@ public class TestListenTCP { // Make an SSLContext that only has the trust store, this should not work since the processor has client auth REQUIRED final SSLContext clientSslContext = SslContextFactory.createTrustSslContext( - "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), + "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "jks", "TLS"); @@ -261,11 +261,11 @@ public class TestListenTCP { private SSLContextService configureProcessorSslContextService() throws InitializationException { final SSLContextService sslContextService = new StandardRestrictedSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/keystore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); runner.enableControllerService(sslContextService); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCPRecord.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCPRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCPRecord.java index 7314f98..20145b6 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCPRecord.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenTCPRecord.java @@ -161,11 +161,11 @@ public class TestListenTCPRecord { // Make an SSLContext with a key and trust store to send the test messages final SSLContext clientSslContext = SslContextFactory.createSslContext( - "src/test/resources/localhost-ks.jks", - "localtest".toCharArray(), + "src/test/resources/keystore.jks", + "passwordpassword".toCharArray(), "jks", - "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), + "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "jks", org.apache.nifi.security.util.SslContextFactory.ClientAuth.valueOf("NONE"), "TLS"); @@ -192,8 +192,8 @@ public class TestListenTCPRecord { // Make an SSLContext that only has the trust store, this should not work since the processor has client auth REQUIRED final SSLContext clientSslContext = SslContextFactory.createTrustSslContext( - "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), + "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "jks", "TLS"); @@ -209,8 +209,8 @@ public class TestListenTCPRecord { // Make an SSLContext that only has the trust store, this should work since the processor has client auth NONE final SSLContext clientSslContext = SslContextFactory.createTrustSslContext( - "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), + "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "jks", "TLS"); @@ -266,11 +266,11 @@ public class TestListenTCPRecord { private SSLContextService configureProcessorSslContextService() throws InitializationException { final SSLContextService sslContextService = new StandardRestrictedSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/keystore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword"); runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); runner.enableControllerService(sslContextService); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPostHTTP.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPostHTTP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPostHTTP.java index ef34487..3b69179 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPostHTTP.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPostHTTP.java @@ -44,11 +44,15 @@ import org.junit.Test; import org.junit.Assert; public class TestPostHTTP { - private TestServer server; private TestRunner runner; private CaptureServlet servlet; + private final String KEYSTORE_PATH = "src/test/resources/keystore.jks"; + private final String KEYSTORE_AND_TRUSTSTORE_PASSWORD = "passwordpassword"; + private final String TRUSTSTORE_PATH = "src/test/resources/truststore.jks"; + private final String JKS_TYPE = "JKS"; + private void setup(final Map<String, String> sslProperties) throws Exception { // set up web service ServletHandler handler = new ServletHandler(); @@ -75,16 +79,16 @@ public class TestPostHTTP { public void testTruststoreSSLOnly() throws Exception { final Map<String, String> sslProps = new HashMap<>(); sslProps.put(TestServer.NEED_CLIENT_AUTH, "false"); - sslProps.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); + sslProps.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); setup(sslProps); final SSLContextService sslContextService = new StandardSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, TRUSTSTORE_PATH); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, JKS_TYPE); runner.enableControllerService(sslContextService); runner.setProperty(PostHTTP.URL, server.getSecureUrl()); @@ -100,23 +104,23 @@ public class TestPostHTTP { @Test public void testTwoWaySSL() throws Exception { final Map<String, String> sslProps = new HashMap<>(); - sslProps.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - sslProps.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - sslProps.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + sslProps.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); + sslProps.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + sslProps.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); sslProps.put(TestServer.NEED_CLIENT_AUTH, "true"); setup(sslProps); final SSLContextService sslContextService = new StandardSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, TRUSTSTORE_PATH); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, JKS_TYPE); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, KEYSTORE_PATH); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, JKS_TYPE); runner.enableControllerService(sslContextService); runner.setProperty(PostHTTP.URL, server.getSecureUrl()); @@ -132,20 +136,20 @@ public class TestPostHTTP { @Test public void testOneWaySSLWhenServerConfiguredForTwoWay() throws Exception { final Map<String, String> sslProps = new HashMap<>(); - sslProps.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - sslProps.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - sslProps.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + sslProps.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); + sslProps.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + sslProps.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); sslProps.put(TestServer.NEED_CLIENT_AUTH, "true"); setup(sslProps); final SSLContextService sslContextService = new StandardSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/truststore.jks"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, JKS_TYPE); runner.enableControllerService(sslContextService); runner.setProperty(PostHTTP.URL, server.getSecureUrl()); @@ -202,23 +206,23 @@ public class TestPostHTTP { @Test public void testSendAsFlowFileSecure() throws Exception { final Map<String, String> sslProps = new HashMap<>(); - sslProps.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - sslProps.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - sslProps.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - sslProps.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + sslProps.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + sslProps.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); + sslProps.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + sslProps.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + sslProps.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); sslProps.put(TestServer.NEED_CLIENT_AUTH, "true"); setup(sslProps); final SSLContextService sslContextService = new StandardSSLContextService(); runner.addControllerService("ssl-context", sslContextService); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, "src/test/resources/localhost-ts.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); - runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, "src/test/resources/localhost-ks.jks"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); - runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, "JKS"); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE, TRUSTSTORE_PATH); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_PASSWORD, KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(sslContextService, StandardSSLContextService.TRUSTSTORE_TYPE, JKS_TYPE); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE, KEYSTORE_PATH); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_PASSWORD, KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(sslContextService, StandardSSLContextService.KEYSTORE_TYPE, JKS_TYPE); runner.enableControllerService(sslContextService); runner.setProperty(PostHTTP.URL, server.getSecureUrl()); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTcpSSL.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTcpSSL.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTcpSSL.java index b758987..70e98ca 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTcpSSL.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutTcpSSL.java @@ -57,11 +57,11 @@ public class TestPutTcpSSL extends TestPutTCPCommon { private static Map<String, String> createSslProperties() { final Map<String, String> map = new HashMap<>(); - map.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - map.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); + map.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/keystore.jks"); + map.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "passwordpassword"); map.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - map.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - map.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); + map.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/truststore.jks"); + map.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "passwordpassword"); map.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); return map; } http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/util/TCPTestServer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/util/TCPTestServer.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/util/TCPTestServer.java index 01d492e..a698f39 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/util/TCPTestServer.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/util/TCPTestServer.java @@ -53,8 +53,8 @@ public class TCPTestServer implements Runnable { public synchronized void startServer(boolean ssl) throws Exception { if (!isServerRunning()) { if(ssl){ - final SSLContext sslCtx = SslContextFactory.createSslContext("src/test/resources/localhost-ks.jks","localtest".toCharArray(), "JKS", "src/test/resources/localhost-ts.jks", - "localtest".toCharArray(), "JKS", SslContextFactory.ClientAuth.REQUIRED, "TLS"); + final SSLContext sslCtx = SslContextFactory.createSslContext("src/test/resources/keystore.jks","passwordpassword".toCharArray(), "JKS", "src/test/resources/truststore.jks", + "passwordpassword".toCharArray(), "JKS", SslContextFactory.ClientAuth.REQUIRED, "TLS"); ServerSocketFactory sslSocketFactory = sslCtx.getServerSocketFactory(); serverSocket = sslSocketFactory.createServerSocket(0, 0, ipAddress); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/keystore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/keystore.jks b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/keystore.jks new file mode 100644 index 0000000..246fe88 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/keystore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ks.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ks.jks b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ks.jks deleted file mode 100755 index df36197..0000000 Binary files a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ks.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ts.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ts.jks b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ts.jks deleted file mode 100755 index 7824378..0000000 Binary files a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/localhost-ts.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/truststore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/truststore.jks b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/truststore.jks new file mode 100644 index 0000000..87f4be1 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/truststore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/keystore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/keystore.jks b/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/keystore.jks new file mode 100644 index 0000000..246fe88 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/keystore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ks.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ks.jks b/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ks.jks deleted file mode 100755 index df36197..0000000 Binary files a/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ks.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ts.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ts.jks b/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ts.jks deleted file mode 100755 index 7824378..0000000 Binary files a/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/localhost-ts.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/truststore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/truststore.jks b/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/truststore.jks new file mode 100644 index 0000000..87f4be1 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/test/resources/truststore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/groovy/org/apache/nifi/ssl/StandardSSLContextServiceTest.groovy ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/groovy/org/apache/nifi/ssl/StandardSSLContextServiceTest.groovy b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/groovy/org/apache/nifi/ssl/StandardSSLContextServiceTest.groovy index 6d2f7b2..19c3568 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/groovy/org/apache/nifi/ssl/StandardSSLContextServiceTest.groovy +++ b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/groovy/org/apache/nifi/ssl/StandardSSLContextServiceTest.groovy @@ -46,12 +46,12 @@ import static groovy.test.GroovyAssert.shouldFail class StandardSSLContextServiceTest { private static final Logger logger = LoggerFactory.getLogger(StandardSSLContextServiceTest.class) - private static final String KEYSTORE_PATH = "src/test/resources/localhost-ks.jks" - private static final String TRUSTSTORE_PATH = "src/test/resources/localhost-ts.jks" - private static final String TRUSTSTORE_PATH_WITH_EL = "\${someAttribute}/localhost-ts.jks" + private static final String KEYSTORE_PATH = "src/test/resources/keystore.jks" + private static final String TRUSTSTORE_PATH = "src/test/resources/truststore.jks" + private static final String TRUSTSTORE_PATH_WITH_EL = "\${someAttribute}/truststore.jks" - private static final String KEYSTORE_PASSWORD = "localtest" - private static final String TRUSTSTORE_PASSWORD = "localtest" + private static final String KEYSTORE_PASSWORD = "passwordpassword" + private static final String TRUSTSTORE_PASSWORD = "passwordpassword" private static final String KEYSTORE_TYPE = "JKS" private static final String TRUSTSTORE_TYPE = "JKS" http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/java/org/apache/nifi/ssl/SSLContextServiceTest.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/java/org/apache/nifi/ssl/SSLContextServiceTest.java b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/java/org/apache/nifi/ssl/SSLContextServiceTest.java index 6cddc7d..b98824c 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/java/org/apache/nifi/ssl/SSLContextServiceTest.java +++ b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/java/org/apache/nifi/ssl/SSLContextServiceTest.java @@ -54,6 +54,12 @@ import org.slf4j.LoggerFactory; public class SSLContextServiceTest { private static final Logger logger = LoggerFactory.getLogger(SSLContextServiceTest.class); + private final String KEYSTORE_PATH = "src/test/resources/keystore.jks"; + private final String KEYSTORE_AND_TRUSTSTORE_PASSWORD = "passwordpassword"; + private final String JKS_TYPE = "JKS"; + private final String TRUSTSTORE_PATH = "src/test/resources/truststore.jks"; + private final String DIFFERENT_PASS_KEYSTORE_PATH = "src/test/resources/keystore-different-password.jks"; + private final String DIFFERENT_KEYSTORE_PASSWORD = "differentpassword"; @Rule public TemporaryFolder tmp = new TemporaryFolder(new File("src/test/resources")); @@ -72,8 +78,8 @@ public class SSLContextServiceTest { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); final SSLContextService service = new StandardSSLContextService(); final Map<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); + properties.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); runner.addControllerService("test-bad2", service, properties); runner.assertNotValid(service); } @@ -83,10 +89,10 @@ public class SSLContextServiceTest { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); final SSLContextService service = new StandardSSLContextService(); final Map<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - properties.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); + properties.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); + properties.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); runner.addControllerService("test-bad3", service, properties); runner.assertNotValid(service); } @@ -96,12 +102,12 @@ public class SSLContextServiceTest { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); final SSLContextService service = new StandardSSLContextService(); final Map<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); + properties.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "wrongpassword"); properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "PKCS12"); - properties.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); + properties.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); properties.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "wrongpassword"); - properties.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + properties.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); runner.addControllerService("test-bad4", service, properties); runner.assertNotValid(service); @@ -113,11 +119,11 @@ public class SSLContextServiceTest { final SSLContextService service = new StandardSSLContextService(); final Map<String, String> properties = new HashMap<>(); properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/DOES-NOT-EXIST.jks"); - properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); + properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "PKCS12"); - properties.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - properties.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - properties.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + properties.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + properties.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + properties.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); runner.addControllerService("test-bad5", service, properties); runner.assertNotValid(service); } @@ -127,12 +133,12 @@ public class SSLContextServiceTest { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); SSLContextService service = new StandardSSLContextService(); runner.addControllerService("test-good1", service); - runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - runner.setProperty(service, StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - runner.setProperty(service, StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + runner.setProperty(service, StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(service, StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); runner.enableControllerService(service); runner.setProperty("SSL Context Svc ID", "test-good1"); @@ -150,12 +156,12 @@ public class SSLContextServiceTest { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); SSLContextService service = new StandardSSLContextService(); runner.addControllerService("test-good1", service); - runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - runner.setProperty(service, StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - runner.setProperty(service, StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + runner.setProperty(service, StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(service, StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); runner.enableControllerService(service); runner.setProperty("SSL Context Svc ID", "test-good1"); @@ -165,11 +171,11 @@ public class SSLContextServiceTest { runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/DOES-NOT-EXIST.jks"); runner.assertNotValid(service); - runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); + runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "badpassword"); runner.assertNotValid(service); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); runner.enableControllerService(service); runner.assertValid(service); } @@ -179,8 +185,8 @@ public class SSLContextServiceTest { // Arrange // Copy the keystore and truststore to a tmp directory so the originals are not modified - File originalKeystore = new File("src/test/resources/localhost-ks.jks"); - File originalTruststore = new File("src/test/resources/localhost-ts.jks"); + File originalKeystore = new File(KEYSTORE_PATH); + File originalTruststore = new File(TRUSTSTORE_PATH); File tmpKeystore = tmp.newFile("keystore-tmp.jks"); File tmpTruststore = tmp.newFile("truststore-tmp.jks"); @@ -193,11 +199,11 @@ public class SSLContextServiceTest { final String serviceIdentifier = "test-should-expire"; runner.addControllerService(serviceIdentifier, service); runner.setProperty(service, StandardSSLContextService.KEYSTORE.getName(), tmpKeystore.getAbsolutePath()); - runner.setProperty(service, StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - runner.setProperty(service, StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); + runner.setProperty(service, StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(service, StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); runner.setProperty(service, StandardSSLContextService.TRUSTSTORE.getName(), tmpTruststore.getAbsolutePath()); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + runner.setProperty(service, StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); runner.enableControllerService(service); runner.setProperty("SSL Context Svc ID", serviceIdentifier); @@ -241,9 +247,9 @@ public class SSLContextServiceTest { TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); SSLContextService service = new StandardSSLContextService(); HashMap<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/localhost-ts.jks"); - properties.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "localtest"); - properties.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); + properties.put(StandardSSLContextService.TRUSTSTORE.getName(), TRUSTSTORE_PATH); + properties.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + properties.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), JKS_TYPE); runner.addControllerService("test-good2", service, properties); runner.enableControllerService(service); @@ -262,9 +268,9 @@ public class SSLContextServiceTest { TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); SSLContextService service = new StandardSSLContextService(); HashMap<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/localhost-ks.jks"); - properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "localtest"); - properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); + properties.put(StandardSSLContextService.KEYSTORE.getName(), KEYSTORE_PATH); + properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), KEYSTORE_AND_TRUSTSTORE_PASSWORD); + properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); runner.addControllerService("test-good3", service, properties); runner.enableControllerService(service); @@ -280,16 +286,21 @@ public class SSLContextServiceTest { } } + /** + * This test asserts that the keystore password and key password are different. This is only + * true because they were explicitly set that way. Normal keystores that do not have passwords + * set on individual keys will fail this test. + */ @Test public void testDifferentKeyPassword() { try { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); final SSLContextService service = new StandardSSLContextService(); final Map<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/diffpass-ks.jks"); - properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "storepassword"); + properties.put(StandardSSLContextService.KEYSTORE.getName(), DIFFERENT_PASS_KEYSTORE_PATH); + properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), DIFFERENT_KEYSTORE_PASSWORD); properties.put(StandardSSLContextService.KEY_PASSWORD.getName(), "keypassword"); - properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); + properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); runner.addControllerService("test-diff-keys", service, properties); runner.enableControllerService(service); @@ -305,17 +316,23 @@ public class SSLContextServiceTest { } } + /** + * This test asserts that the keystore password and key password are different. This is only + * true because they were explicitly set that way. Normal keystores that do not have passwords + * set on individual keys will fail this test. + */ @Test - public void testDifferentKeyPasswordWithoutSpecifyingPassword() { + public void testDifferentKeyPasswordWithoutSpecifyingKeyPassword() { try { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); final SSLContextService service = new StandardSSLContextService(); final Map<String, String> properties = new HashMap<>(); - properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/diffpass-ks.jks"); - properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "storepassword"); - properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); + properties.put(StandardSSLContextService.KEYSTORE.getName(), DIFFERENT_PASS_KEYSTORE_PATH); + properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), DIFFERENT_KEYSTORE_PASSWORD); + properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), JKS_TYPE); runner.addControllerService("test-diff-keys", service, properties); + // Assert the service is not valid due to an internal "cannot recover key" because the key password is missing runner.assertNotValid(service); } catch (Exception e) { System.out.println(e); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/diffpass-ks.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/diffpass-ks.jks b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/diffpass-ks.jks deleted file mode 100644 index c4bd59c..0000000 Binary files a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/diffpass-ks.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore-different-password.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore-different-password.jks b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore-different-password.jks new file mode 100644 index 0000000..0ddfef1 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore-different-password.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore.jks b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore.jks new file mode 100644 index 0000000..246fe88 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/keystore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ks.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ks.jks b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ks.jks deleted file mode 100755 index df36197..0000000 Binary files a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ks.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ts.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ts.jks b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ts.jks deleted file mode 100755 index 7824378..0000000 Binary files a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/localhost-ts.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/truststore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/truststore.jks b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/truststore.jks new file mode 100644 index 0000000..87f4be1 Binary files /dev/null and b/nifi-nar-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/test/resources/truststore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/pom.xml b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/pom.xml index d806e3e..cad0864 100644 --- a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/pom.xml +++ b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/pom.xml @@ -55,11 +55,6 @@ <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> - <configuration> - <excludes combine.children="append"> - <exclude>src/test/resources/certs/localhost.crt</exclude> - </excludes> - </configuration> </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketClientExample.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketClientExample.java b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketClientExample.java index 5ef73bf..f8c9b3a 100644 --- a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketClientExample.java +++ b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketClientExample.java @@ -47,11 +47,11 @@ public class WebSocketClientExample { final CountDownLatch replyLatch = new CountDownLatch(1); final SslContextFactory sslContextFactory = new SslContextFactory(); - sslContextFactory.setKeyStorePath("src/test/resources/certs/localhost-ks.jks"); - sslContextFactory.setKeyStorePassword("localtest"); + sslContextFactory.setKeyStorePath("src/test/resources/certs/keystore.jks"); + sslContextFactory.setKeyStorePassword("passwordpassword"); sslContextFactory.setKeyStoreType("JKS"); - sslContextFactory.setTrustStorePath("src/test/resources/certs/localhost-ks.jks"); - sslContextFactory.setTrustStorePassword("localtest"); + sslContextFactory.setTrustStorePath("src/test/resources/certs/truststore.jks"); + sslContextFactory.setTrustStorePassword("passwordpassword"); sslContextFactory.setTrustStoreType("JKS"); WebSocketClient client = new WebSocketClient(sslContextFactory); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketServerExample.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketServerExample.java b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketServerExample.java index eddecd5..e7a3ab6 100644 --- a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketServerExample.java +++ b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/example/WebSocketServerExample.java @@ -153,8 +153,8 @@ public class WebSocketServerExample { httpConnector.setPort(50010); final SslContextFactory sslContextFactory = new SslContextFactory(); - sslContextFactory.setKeyStorePath("src/test/resources/certs/localhost-ks.jks"); - sslContextFactory.setKeyStorePassword("localtest"); + sslContextFactory.setKeyStorePath("src/test/resources/certs/keystore.jks"); + sslContextFactory.setKeyStorePassword("passwordpassword"); sslContextFactory.setKeyStoreType("JKS"); final HttpConfiguration https = new HttpConfiguration(); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/ITJettyWebSocketSecureCommunication.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/ITJettyWebSocketSecureCommunication.java b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/ITJettyWebSocketSecureCommunication.java index 249af7a..3f1c482 100644 --- a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/ITJettyWebSocketSecureCommunication.java +++ b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/ITJettyWebSocketSecureCommunication.java @@ -29,11 +29,11 @@ public class ITJettyWebSocketSecureCommunication extends ITJettyWebSocketCommuni public ITJettyWebSocketSecureCommunication() { try { - sslTestContext.setCustomValue(StandardSSLContextService.KEYSTORE, "src/test/resources/certs/localhost-ks.jks"); - sslTestContext.setCustomValue(StandardSSLContextService.KEYSTORE_PASSWORD, "localtest"); + sslTestContext.setCustomValue(StandardSSLContextService.KEYSTORE, "src/test/resources/certs/keystore.jks"); + sslTestContext.setCustomValue(StandardSSLContextService.KEYSTORE_PASSWORD, "passwordpassword"); sslTestContext.setCustomValue(StandardSSLContextService.KEYSTORE_TYPE, "JKS"); - sslTestContext.setCustomValue(StandardSSLContextService.TRUSTSTORE, "src/test/resources/certs/localhost-ks.jks"); - sslTestContext.setCustomValue(StandardSSLContextService.TRUSTSTORE_PASSWORD, "localtest"); + sslTestContext.setCustomValue(StandardSSLContextService.TRUSTSTORE, "src/test/resources/certs/truststore.jks"); + sslTestContext.setCustomValue(StandardSSLContextService.TRUSTSTORE_PASSWORD, "passwordpassword"); sslTestContext.setCustomValue(StandardSSLContextService.TRUSTSTORE_TYPE, "JKS"); sslContextService.initialize(sslTestContext.getInitializationContext()); http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/keystore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/keystore.jks b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/keystore.jks new file mode 100644 index 0000000..246fe88 Binary files /dev/null and b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/keystore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ks.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ks.jks b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ks.jks deleted file mode 100755 index 119b50f..0000000 Binary files a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ks.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ts.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ts.jks b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ts.jks deleted file mode 100755 index 7824378..0000000 Binary files a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost-ts.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost.crt ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost.crt b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost.crt deleted file mode 100644 index 6c50a80..0000000 Binary files a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/localhost.crt and /dev/null differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/truststore.jks ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/truststore.jks b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/truststore.jks new file mode 100644 index 0000000..87f4be1 Binary files /dev/null and b/nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/resources/certs/truststore.jks differ http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-toolkit/nifi-toolkit-tls/src/test/java/org/apache/nifi/toolkit/tls/status/TlsToolkitGetStatusCommandLineTest.java ---------------------------------------------------------------------- diff --git a/nifi-toolkit/nifi-toolkit-tls/src/test/java/org/apache/nifi/toolkit/tls/status/TlsToolkitGetStatusCommandLineTest.java b/nifi-toolkit/nifi-toolkit-tls/src/test/java/org/apache/nifi/toolkit/tls/status/TlsToolkitGetStatusCommandLineTest.java index 008a9af..65a3852 100644 --- a/nifi-toolkit/nifi-toolkit-tls/src/test/java/org/apache/nifi/toolkit/tls/status/TlsToolkitGetStatusCommandLineTest.java +++ b/nifi-toolkit/nifi-toolkit-tls/src/test/java/org/apache/nifi/toolkit/tls/status/TlsToolkitGetStatusCommandLineTest.java @@ -30,6 +30,10 @@ import static org.junit.Assert.fail; public class TlsToolkitGetStatusCommandLineTest { + private final String TRUSTSTORE_PATH = "src/test/resources/localhost/truststore.jks"; + private final String TRUSTSTORE_PASSWORD = "passwordpassword"; + private final String JKS_TYPE = "JKS"; + private TlsToolkitGetStatusCommandLine commandLine; @Before @@ -53,9 +57,9 @@ public class TlsToolkitGetStatusCommandLineTest { final String urlStr = "https://localhost:8443/test"; commandLine.parse( "-u", urlStr, - "-ts", "src/test/resources/localhost/truststore.jks", - "-tst", "JKS", - "-tsp", "t7rmn1fg8np2ck1sduqdd85opv"); + "-ts", TRUSTSTORE_PATH, + "-tst", JKS_TYPE, + "-tsp", TRUSTSTORE_PASSWORD); final GetStatusConfig config = commandLine.createConfig(); Assert.assertNotNull(config); @@ -75,9 +79,9 @@ public class TlsToolkitGetStatusCommandLineTest { public void testMissingUrl() { try { commandLine.parse( - "-ts", "src/test/resources/localhost/truststore.jks", - "-tst", "JKS", - "-tsp", "t7rmn1fg8np2ck1sduqdd85opv"); + "-ts", TRUSTSTORE_PATH, + "-tst", JKS_TYPE, + "-tsp", TRUSTSTORE_PASSWORD); fail("Expected invalid args"); } catch (CommandLineParseException e) { @@ -92,8 +96,8 @@ public class TlsToolkitGetStatusCommandLineTest { commandLine.parse( "-u", urlStr, "-ts", "does/not/exist/truststore.jks", - "-tst", "JKS", - "-tsp", "t7rmn1fg8np2ck1sduqdd85opv"); + "-tst", JKS_TYPE, + "-tsp", TRUSTSTORE_PASSWORD); fail("Expected invalid args"); } catch (CommandLineParseException e) { @@ -107,9 +111,9 @@ public class TlsToolkitGetStatusCommandLineTest { final String urlStr = "https://localhost:8443/test"; commandLine.parse( "-u", urlStr, - "-ts", "src/test/resources/localhost/truststore.jks", + "-ts", TRUSTSTORE_PATH, "-tst", "INVALID", - "-tsp", "t7rmn1fg8np2ck1sduqdd85opv"); + "-tsp", TRUSTSTORE_PASSWORD); fail("Expected invalid args"); } catch (CommandLineParseException e) { http://git-wip-us.apache.org/repos/asf/nifi/blob/f65286be/nifi-toolkit/nifi-toolkit-tls/src/test/resources/localhost/truststore.jks ---------------------------------------------------------------------- diff --git a/nifi-toolkit/nifi-toolkit-tls/src/test/resources/localhost/truststore.jks b/nifi-toolkit/nifi-toolkit-tls/src/test/resources/localhost/truststore.jks index 8d0b4de..87f4be1 100644 Binary files a/nifi-toolkit/nifi-toolkit-tls/src/test/resources/localhost/truststore.jks and b/nifi-toolkit/nifi-toolkit-tls/src/test/resources/localhost/truststore.jks differ
