saintstack commented on a change in pull request #1116: HBASE-23783: Address
tests writing and reading SSL/Security files in …
URL: https://github.com/apache/hbase/pull/1116#discussion_r374274553
##########
File path:
hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestSSLHttpServer.java
##########
@@ -51,62 +52,65 @@
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestSSLHttpServer.class);
+ HBaseClassTestRule.forClass(TestSSLHttpServer.class);
private static final String BASEDIR = System.getProperty("test.build.dir",
- "target/test-dir") + "/" + TestSSLHttpServer.class.getSimpleName();
+ "target/test-dir") + "/" + TestSSLHttpServer.class.getSimpleName();
private static final Logger LOG =
LoggerFactory.getLogger(TestSSLHttpServer.class);
private static Configuration conf;
private static HttpServer server;
private static URL baseUrl;
- private static String keystoresDir;
+ private static File keystoresDir;
private static String sslConfDir;
private static SSLFactory clientSslFactory;
+ private static HBaseCommonTestingUtility htu;
@BeforeClass
public static void setup() throws Exception {
conf = new Configuration();
conf.setInt(HttpServer.HTTP_MAX_THREADS, TestHttpServer.MAX_THREADS);
- File base = new File(BASEDIR);
- FileUtil.fullyDelete(base);
- base.mkdirs();
- keystoresDir = new File(BASEDIR).getAbsolutePath();
+ htu = new HBaseCommonTestingUtility(conf);
+
+ keystoresDir = new File(htu.getDataTestDir("keystore").toString());
+ keystoresDir.mkdirs();
+
sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);
- KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
+ KeyStoreTestUtil.setupSSLConfig(keystoresDir.getAbsolutePath(),
sslConfDir, conf, false);
Configuration sslConf = new Configuration(false);
- sslConf.addResource("ssl-server.xml");
- sslConf.addResource("ssl-client.xml");
-
+ sslConf.addResource(conf.get(SSLFactory.SSL_CLIENT_CONF_KEY));
+ conf.addResource(conf.get(SSLFactory.SSL_SERVER_CONF_KEY));
+ sslConf.set(SSLFactory.SSL_CLIENT_CONF_KEY,
conf.get(SSLFactory.SSL_CLIENT_CONF_KEY));
+
clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
clientSslFactory.init();
server = new HttpServer.Builder()
- .setName("test")
- .addEndpoint(new URI("https://localhost"))
- .setConf(conf)
- .keyPassword(HBaseConfiguration.getPassword(sslConf,
"ssl.server.keystore.keypassword",
- null))
- .keyStore(sslConf.get("ssl.server.keystore.location"),
- HBaseConfiguration.getPassword(sslConf,
"ssl.server.keystore.password", null),
- sslConf.get("ssl.server.keystore.type", "jks"))
- .trustStore(sslConf.get("ssl.server.truststore.location"),
- HBaseConfiguration.getPassword(sslConf,
"ssl.server.truststore.password", null),
- sslConf.get("ssl.server.truststore.type", "jks")).build();
+ .setName("test")
+ .addEndpoint(new URI("https://localhost"))
+ .setConf(conf)
+ .keyPassword(HBaseConfiguration.getPassword(conf,
"ssl.server.keystore.keypassword",
Review comment:
Above its sslconf... you want conf here?
----------------------------------------------------------------
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