@@ -147,7 +147,7 @@ public void testReloadingKeyStore() throws Exception {
147
147
throw new RuntimeException ("Exception starting or connecting to the mock server" , e );
148
148
}
149
149
};
150
- validateSSLConfigurationIsReloaded (settings , env , keyMaterialPreChecks , modifier , keyMaterialPostChecks );
150
+ validateSSLConfigurationIsReloaded (env , keyMaterialPreChecks , modifier , keyMaterialPostChecks );
151
151
}
152
152
}
153
153
/**
@@ -174,7 +174,7 @@ public void testPEMKeyConfigReloading() throws Exception {
174
174
.putList ("xpack.security.transport.ssl.certificate_authorities" , certPath .toString ())
175
175
.setSecureSettings (secureSettings )
176
176
.build ();
177
- final Environment env = newEnvironment ();
177
+ final Environment env = TestEnvironment . newEnvironment (settings );
178
178
// Load HTTPClient once. Client uses a keystore containing testnode key/cert as a truststore
179
179
try (CloseableHttpClient client = getSSLClient (Collections .singletonList (certPath ))) {
180
180
final Consumer <SSLContext > keyMaterialPreChecks = (context ) -> {
@@ -207,7 +207,7 @@ public void testPEMKeyConfigReloading() throws Exception {
207
207
throw new RuntimeException ("Exception starting or connecting to the mock server" , e );
208
208
}
209
209
};
210
- validateSSLConfigurationIsReloaded (settings , env , keyMaterialPreChecks , modifier , keyMaterialPostChecks );
210
+ validateSSLConfigurationIsReloaded (env , keyMaterialPreChecks , modifier , keyMaterialPostChecks );
211
211
}
212
212
}
213
213
@@ -259,7 +259,7 @@ public void testReloadingTrustStore() throws Exception {
259
259
throw new RuntimeException ("Error closing CloseableHttpClient" , e );
260
260
}
261
261
};
262
- validateSSLConfigurationIsReloaded (settings , env , trustMaterialPreChecks , modifier , trustMaterialPostChecks );
262
+ validateSSLConfigurationIsReloaded (env , trustMaterialPreChecks , modifier , trustMaterialPostChecks );
263
263
}
264
264
}
265
265
@@ -309,7 +309,7 @@ public void testReloadingPEMTrustConfig() throws Exception {
309
309
throw new RuntimeException ("Error closing CloseableHttpClient" , e );
310
310
}
311
311
};
312
- validateSSLConfigurationIsReloaded (settings , env , trustMaterialPreChecks , modifier , trustMaterialPostChecks );
312
+ validateSSLConfigurationIsReloaded (env , trustMaterialPreChecks , modifier , trustMaterialPostChecks );
313
313
}
314
314
}
315
315
@@ -331,7 +331,7 @@ public void testReloadingKeyStoreException() throws Exception {
331
331
.put ("path.home" , createTempDir ())
332
332
.build ();
333
333
Environment env = TestEnvironment .newEnvironment (settings );
334
- final SSLService sslService = new SSLService (settings , env );
334
+ final SSLService sslService = new SSLService (env );
335
335
final SSLConfiguration config = sslService .getSSLConfiguration ("xpack.security.transport.ssl." );
336
336
final AtomicReference <Exception > exceptionRef = new AtomicReference <>();
337
337
final CountDownLatch latch = new CountDownLatch (1 );
@@ -353,6 +353,7 @@ void reloadSSLContext(SSLConfiguration configuration) {
353
353
354
354
// truncate the keystore
355
355
try (OutputStream ignore = Files .newOutputStream (keystorePath , StandardOpenOption .TRUNCATE_EXISTING )) {
356
+ // do nothing
356
357
}
357
358
358
359
latch .await ();
@@ -384,7 +385,7 @@ public void testReloadingPEMKeyConfigException() throws Exception {
384
385
.setSecureSettings (secureSettings )
385
386
.build ();
386
387
Environment env = TestEnvironment .newEnvironment (settings );
387
- final SSLService sslService = new SSLService (settings , env );
388
+ final SSLService sslService = new SSLService (env );
388
389
final SSLConfiguration config = sslService .getSSLConfiguration ("xpack.security.transport.ssl." );
389
390
final AtomicReference <Exception > exceptionRef = new AtomicReference <>();
390
391
final CountDownLatch latch = new CountDownLatch (1 );
@@ -430,7 +431,7 @@ public void testTrustStoreReloadException() throws Exception {
430
431
.put ("path.home" , createTempDir ())
431
432
.build ();
432
433
Environment env = TestEnvironment .newEnvironment (settings );
433
- final SSLService sslService = new SSLService (settings , env );
434
+ final SSLService sslService = new SSLService (env );
434
435
final SSLConfiguration config = sslService .getSSLConfiguration ("xpack.security.transport.ssl." );
435
436
final AtomicReference <Exception > exceptionRef = new AtomicReference <>();
436
437
final CountDownLatch latch = new CountDownLatch (1 );
@@ -474,7 +475,7 @@ public void testPEMTrustReloadException() throws Exception {
474
475
.put ("path.home" , createTempDir ())
475
476
.build ();
476
477
Environment env = TestEnvironment .newEnvironment (settings );
477
- final SSLService sslService = new SSLService (settings , env );
478
+ final SSLService sslService = new SSLService (env );
478
479
final SSLConfiguration config = sslService .sslConfiguration (settings .getByPrefix ("xpack.security.transport.ssl." ));
479
480
final AtomicReference <Exception > exceptionRef = new AtomicReference <>();
480
481
final CountDownLatch latch = new CountDownLatch (1 );
@@ -524,10 +525,10 @@ private Settings.Builder baseKeystoreSettings(Path tempDir, MockSecureSettings s
524
525
.setSecureSettings (secureSettings );
525
526
}
526
527
527
- private void validateSSLConfigurationIsReloaded (Settings settings , Environment env , Consumer <SSLContext > preChecks ,
528
+ private void validateSSLConfigurationIsReloaded (Environment env , Consumer <SSLContext > preChecks ,
528
529
Runnable modificationFunction , Consumer <SSLContext > postChecks ) throws Exception {
529
530
final CountDownLatch reloadLatch = new CountDownLatch (1 );
530
- final SSLService sslService = new SSLService (settings , env );
531
+ final SSLService sslService = new SSLService (env );
531
532
final SSLConfiguration config = sslService .getSSLConfiguration ("xpack.security.transport.ssl" );
532
533
new SSLConfigurationReloader (env , sslService , resourceWatcherService ) {
533
534
@ Override
0 commit comments