diff --git a/build.gradle b/build.gradle index 5cc0c4f7..43f0c791 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ repositories { dependencies { // Framework dependencies - def vertx_version = '4.5.0' + def vertx_version = '4.5.1' implementation group: 'io.vertx', name: 'vertx-core', version: vertx_version implementation group: 'io.vertx', name: 'vertx-web', version: vertx_version implementation group: 'io.vertx', name: 'vertx-web-client', version: vertx_version diff --git a/src/main/java/io/neonbee/NeonBee.java b/src/main/java/io/neonbee/NeonBee.java index d28f8bb5..896fa6d8 100644 --- a/src/main/java/io/neonbee/NeonBee.java +++ b/src/main/java/io/neonbee/NeonBee.java @@ -32,6 +32,8 @@ import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.annotation.Nullable; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -197,12 +199,12 @@ public class NeonBee { *

* Important: Will only return a value in case a Vert.x context is available, otherwise returns null. Attention: * This method is NOT signature compliant to {@link Vertx#vertx()}! It will NOT create a new NeonBee instance, - * please use {@link NeonBee#create(NeonBeeOptions)} or - * {@link NeonBee#create(Function, ClusterManagerFactory, NeonBeeOptions, NeonBeeConfig)} instead. + * please use {@link NeonBee#create(NeonBeeOptions)} or {@link NeonBee#create(NeonBeeOptions, NeonBeeConfig)} + * instead. * * @return A NeonBee instance or null */ - public static NeonBee get() { + public static @Nullable NeonBee get() { Context context = Vertx.currentContext(); return context != null ? get(context.owner()) : null; } @@ -248,14 +250,16 @@ public static Future create(NeonBeeOptions options) { * @return the future to a new NeonBee instance initialized with default options and a new Vert.x instance */ public static Future create(NeonBeeOptions options, NeonBeeConfig config) { - return create((OwnVertxFactory) vertxOptions -> newVertx(vertxOptions, options), options.getClusterManager(), - options, config); + // using the marker interface we signal, that we are responsible of also closing Vert.x if NeonBee shuts down + return create((OwnVertxFactory) (vertxOptions, clusterManager) -> { + return newVertx(vertxOptions, clusterManager, options); + }, options.getClusterManager(), options, config); } @VisibleForTesting @SuppressWarnings({ "PMD.EmptyCatchBlock", "PMD.AvoidCatchingThrowable" }) - static Future create(Function> vertxFactory, - ClusterManagerFactory clusterManagerFactory, NeonBeeOptions options, NeonBeeConfig config) { + static Future create(VertxFactory vertxFactory, @Nullable ClusterManagerFactory clusterManagerFactory, + NeonBeeOptions options, NeonBeeConfig config) { try { // create the NeonBee working and logging directory (as the only mandatory directory for NeonBee) Files.createDirectories(options.getLogDirectory()); @@ -271,52 +275,61 @@ static Future create(Function> vertxFactory vertxOptions.setMetricsOptions(new MicrometerMetricsOptions().setRegistryName(options.getMetricsRegistryName()) .setMicrometerRegistry(compositeMeterRegistry).setEnabled(true)); - Future loadClusterManager = !options.isClustered() ? succeededFuture(vertxOptions) - : clusterManagerFactory.create(options).map(vertxOptions::setClusterManager); - - // create a Vert.x instance (clustered or unclustered) - return loadClusterManager.compose(vertxFactory).compose(vertx -> { - // at this point at any failure that occurs, it is in our responsibility to properly close down the created - // Vert.x instance again. we have to be vigilant the fact that a runtime exception could happen anytime! - Function> closeVertx = throwable -> { - if (!(vertxFactory instanceof OwnVertxFactory)) { - // the Vert.x instance is *not* owned by us, thus don't close it either - LOGGER.error("Failure during bootstrap phase.", throwable); // NOPMD slf4j - return failedFuture(throwable); - } - - // the instance has been created, but after initialization some post-initialization - // tasks went wrong, stop Vert.x again. This will also call the close hook and clean up. - LOGGER.error("Failure during bootstrap phase. Shutting down Vert.x instance.", throwable); - - // we wait for Vert.x to close, before we propagate the reason why booting failed - return vertx.close().transform(closeResult -> failedFuture(throwable)); - }; + Future loadClusterManager = succeededFuture(); + if (options.isClustered()) { + if (clusterManagerFactory == null) { + return failedFuture("Missing a cluster manager factory to create a clustered NeonBee instance"); + } - try { - Future configFuture; - if (config == null) { - configFuture = loadConfig(vertx, options.getConfigDirectory()); - } else { - configFuture = succeededFuture(config); - } + loadClusterManager = clusterManagerFactory.create(options); + } - // create a NeonBee instance, hook registry and close handler - Future neonBeeFuture = configFuture.map(loadedConfig -> { - return new NeonBee(vertx, options, loadedConfig, compositeMeterRegistry); + // create a Vert.x instance (clustered or unclustered) + return loadClusterManager.compose(clusterManager -> vertxFactory.create(vertxOptions, clusterManager)) + .compose(vertx -> { + // from this point onwards, if any failure that occurs it will be our responsibility to properly + // close down the Vert.x instance again (in case it was created by us in the first place). we have + // to be vigilant the fact that a runtime exception could happen anytime! + Function> closeVertx = throwable -> { + if (!(vertxFactory instanceof OwnVertxFactory)) { + // the Vert.x instance is *not* owned by us, thus don't close it either + LOGGER.error("Failure during bootstrap phase.", throwable); // NOPMD slf4j + return failedFuture(throwable); + } + + // the instance has been created, but after initialization some post-initialization tasks went + // wrong, stop Vert.x again. This will also call the close hook and clean up + LOGGER.error("Failure during bootstrap phase. Shutting down Vert.x instance.", throwable); + + // we wait for Vert.x to close, before we propagate the reason why booting failed + return vertx.close().transform(closeResult -> failedFuture(throwable)); + }; + + try { + Future configFuture; + if (config == null) { + configFuture = loadConfig(vertx, options.getConfigDirectory()); + } else { + configFuture = succeededFuture(config); + } + + // create a NeonBee instance, hook registry and close handler + Future neonBeeFuture = configFuture.map(loadedConfig -> { + return new NeonBee(vertx, options, loadedConfig, compositeMeterRegistry); + }); + + // boot NeonBee, on failure close Vert.x + return neonBeeFuture.compose(NeonBee::boot).recover(closeVertx) + .compose(unused -> neonBeeFuture); + } catch (Throwable t) { + // on any exception (e.g. during initialization of NeonBee) don't forget to close Vert.x! + return closeVertx.apply(t).mapEmpty(); + } }); - - // boot NeonBee, on failure close Vert.x - return neonBeeFuture.compose(NeonBee::boot).recover(closeVertx).compose(unused -> neonBeeFuture); - } catch (Throwable t) { - // on any exception (e.g. during the initialization of a NeonBee object) don't forget to close Vert.x! - return closeVertx.apply(t).mapEmpty(); - } - }); } @VisibleForTesting - static Future newVertx(VertxOptions vertxOptions, NeonBeeOptions options) { + static Future newVertx(VertxOptions vertxOptions, ClusterManager clusterManager, NeonBeeOptions options) { if (!options.isClustered()) { return succeededFuture(Vertx.vertx(vertxOptions)); } @@ -326,7 +339,9 @@ static Future newVertx(VertxOptions vertxOptions, NeonBeeOptions options) .ifPresent(currentIp -> vertxOptions.getEventBusOptions().setHost(currentIp)); return applyEncryptionOptions(options, vertxOptions.getEventBusOptions()) - .compose(v -> Vertx.clusteredVertx(vertxOptions)).onFailure(throwable -> { + .compose(v -> Vertx.builder().with(vertxOptions) + .withClusterManager(clusterManager).buildClustered()) + .onFailure(throwable -> { LOGGER.error("Failed to start clustered Vert.x", throwable); // NOPMD slf4j }); } @@ -342,8 +357,7 @@ static Future applyEncryptionOptions(NeonBeeOptions neonBeeOptions, EventB Optional.ofNullable(neonBeeOptions.getClusterTruststorePassword()) .ifPresent(truststoreOpts::setAliasPassword); - ebo.setSsl(true).setClientAuth(REQUIRED).setPfxKeyCertOptions(keystoreOpts) - .setPfxTrustOptions(truststoreOpts); + ebo.setSsl(true).setClientAuth(REQUIRED).setKeyCertOptions(keystoreOpts).setTrustOptions(truststoreOpts); return succeededFuture(); } else if (neonBeeOptions.getClusterKeystore() == null && neonBeeOptions.getClusterTruststore() == null) { return succeededFuture(); @@ -869,10 +883,25 @@ public boolean isStarted() { return started.get(); } + /** + * Vert.x factory by NeonBee to create a Vert.x instance. + */ + @FunctionalInterface + public interface VertxFactory { + /** + * Called (exactly once) by NeonBee to create a Vert.x instance to use for initialization afterwards. + * + * @param options The Vert.x options to be used, parameterized according to the options / configuration + * @param clusterManager in case NeonBee is configured to be started clustered, the cluster manager to use + * @return a future to a Vert.x instance + */ + Future create(VertxOptions options, @Nullable ClusterManager clusterManager); + } + /** * Hidden marker function interface, that indicates to the boot-stage that an own Vert.x instance was created, and * we must be held responsible to close it again. */ @VisibleForTesting - interface OwnVertxFactory extends Function> {} + interface OwnVertxFactory extends VertxFactory {} } diff --git a/src/main/java/io/neonbee/config/ServerConfig.java b/src/main/java/io/neonbee/config/ServerConfig.java index 16ecaf64..70550c7e 100644 --- a/src/main/java/io/neonbee/config/ServerConfig.java +++ b/src/main/java/io/neonbee/config/ServerConfig.java @@ -857,6 +857,7 @@ public ServerConfig setInitialSettings(Http2Settings settings) { } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) { super.setJdkSslEngineOptions(sslEngineOptions); return this; @@ -869,6 +870,7 @@ public ServerConfig setKeyCertOptions(KeyCertOptions options) { } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setKeyStoreOptions(JksOptions options) { super.setKeyStoreOptions(options); return this; @@ -911,18 +913,21 @@ public ServerConfig setMaxWebSocketMessageSize(int maxWebSocketMessageSize) { } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) { super.setOpenSslEngineOptions(sslEngineOptions); return this; } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setPemKeyCertOptions(PemKeyCertOptions options) { super.setPemKeyCertOptions(options); return this; } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setPemTrustOptions(PemTrustOptions options) { super.setPemTrustOptions(options); return this; @@ -941,12 +946,14 @@ public ServerConfig setPerMessageWebSocketCompressionSupported(boolean supported } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setPfxKeyCertOptions(PfxOptions options) { super.setPfxKeyCertOptions(options); return this; } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setPfxTrustOptions(PfxOptions options) { super.setPfxTrustOptions(options); return this; @@ -1079,6 +1086,7 @@ public ServerConfig setTrustOptions(TrustOptions options) { } @Override + @SuppressWarnings("deprecation") // reason: we have to comply to the interface still public ServerConfig setTrustStoreOptions(JksOptions options) { super.setTrustStoreOptions(options); return this; diff --git a/src/test/java/io/neonbee/NeonBeeExtension.java b/src/test/java/io/neonbee/NeonBeeExtension.java index 4a651234..bcf8c33a 100644 --- a/src/test/java/io/neonbee/NeonBeeExtension.java +++ b/src/test/java/io/neonbee/NeonBeeExtension.java @@ -317,7 +317,9 @@ private NeonBee createNeonBee(NeonBeeOptions options, NeonBeeInstanceConfigurati AtomicReference neonBeeBox = new AtomicReference<>(); AtomicReference errorBox = new AtomicReference<>(); - NeonBee.create((NeonBee.OwnVertxFactory) (vertxOptions) -> NeonBee.newVertx(vertxOptions, options), + NeonBee.create( + (NeonBee.OwnVertxFactory) (vertxOptions, clusterManagerInstance) -> NeonBee.newVertx(vertxOptions, + clusterManagerInstance, options), clusterManager.factory(), options, null).onComplete(ar -> { if (ar.succeeded()) { neonBeeBox.set(ar.result()); diff --git a/src/test/java/io/neonbee/NeonBeeMockHelper.java b/src/test/java/io/neonbee/NeonBeeMockHelper.java index 78ff472c..c61f8ed7 100644 --- a/src/test/java/io/neonbee/NeonBeeMockHelper.java +++ b/src/test/java/io/neonbee/NeonBeeMockHelper.java @@ -192,7 +192,7 @@ public static Future createNeonBee(Vertx vertx) { * @return the mocked NeonBee instance */ public static Future createNeonBee(Vertx vertx, NeonBeeOptions options) { - return NeonBee.create((vertxOptions) -> { + return NeonBee.create((vertxOptions, clusterManager) -> { if (vertxOptions.getMetricsOptions() != null) { new VertxMetricsFactoryImpl().metrics(vertxOptions); } diff --git a/src/test/java/io/neonbee/NeonBeeTest.java b/src/test/java/io/neonbee/NeonBeeTest.java index 90f21138..55255d0a 100644 --- a/src/test/java/io/neonbee/NeonBeeTest.java +++ b/src/test/java/io/neonbee/NeonBeeTest.java @@ -36,7 +36,6 @@ import java.util.List; import java.util.Map; import java.util.function.BiFunction; -import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Stream; @@ -81,7 +80,6 @@ import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; -import io.vertx.core.VertxOptions; import io.vertx.core.eventbus.DeliveryContext; import io.vertx.core.eventbus.EventBus; import io.vertx.core.eventbus.EventBusOptions; @@ -89,6 +87,7 @@ import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import io.vertx.core.json.jackson.DatabindCodec; +import io.vertx.core.net.PfxOptions; import io.vertx.junit5.VertxTestContext; import io.vertx.junit5.VertxTestContext.ExecutionBlock; @@ -200,7 +199,8 @@ void testStartWithEmptyWorkingDirectory() { @Tag(DOESNT_REQUIRE_NEONBEE) void testStandaloneInitialization(VertxTestContext testContext) { NeonBeeOptions options = defaultOptions().clearActiveProfiles().addActiveProfile(NO_WEB); - NeonBee.create((NeonBee.OwnVertxFactory) (vertxOptions) -> NeonBee.newVertx(vertxOptions, options) + NeonBee.create((NeonBee.OwnVertxFactory) (vertxOptions, clusterManager) -> NeonBee + .newVertx(vertxOptions, clusterManager, options) .onSuccess(newVertx -> vertx = newVertx), ClusterManager.FAKE.factory(), options, null) .onComplete(testContext.succeeding(neonBee -> testContext.verify(() -> { assertThat(neonBee.getVertx().isClustered()).isFalse(); @@ -213,7 +213,8 @@ void testStandaloneInitialization(VertxTestContext testContext) { @Tag(DOESNT_REQUIRE_NEONBEE) void testClusterInitialization(VertxTestContext testContext) { NeonBeeOptions options = defaultOptions().clearActiveProfiles().addActiveProfile(NO_WEB).setClustered(true); - NeonBee.create((NeonBee.OwnVertxFactory) (vertxOptions) -> NeonBee.newVertx(vertxOptions, options) + NeonBee.create((NeonBee.OwnVertxFactory) (vertxOptions, clusterManager) -> NeonBee + .newVertx(vertxOptions, clusterManager, options) .onSuccess(newVertx -> vertx = newVertx), ClusterManager.FAKE.factory(), options, null) .onComplete(testContext.succeeding(neonBee -> testContext.verify(() -> { assertThat(neonBee.getVertx().isClustered()).isTrue(); @@ -248,8 +249,11 @@ void testRegisterDefaultHealthChecks() { @Tag(DOESNT_REQUIRE_NEONBEE) void testRegisterClusterHealthChecks(VertxTestContext testContext) { NeonBeeOptions options = defaultOptions().clearActiveProfiles().addActiveProfile(NO_WEB).setClustered(true); - NeonBee.create((NeonBee.OwnVertxFactory) (vertxOptions) -> NeonBee.newVertx(vertxOptions, options) - .onSuccess(newVertx -> vertx = newVertx), HAZELCAST.factory(), options, null) + NeonBee.create( + (NeonBee.OwnVertxFactory) (vertxOptions, clusterManager) -> NeonBee + .newVertx(vertxOptions, clusterManager, options) + .onSuccess(newVertx -> vertx = newVertx), + HAZELCAST.factory(), options, null) .onComplete(testContext.succeeding(neonBee -> testContext.verify(() -> { Map registeredChecks = neonBee.getHealthCheckRegistry().getHealthChecks(); assertThat(registeredChecks.size()).isEqualTo(4); @@ -376,14 +380,15 @@ void checkTestCloseVertxOnError(String description, boolean ownVertx, Future> vertxFunction; + NeonBee.VertxFactory vertxFactory; if (ownVertx) { - vertxFunction = (NeonBee.OwnVertxFactory) (vertxOptions) -> succeededFuture(failingVertxMock); + vertxFactory = + (NeonBee.OwnVertxFactory) (vertxOptions, clusterManager) -> succeededFuture(failingVertxMock); } else { - vertxFunction = (vertxOptions) -> succeededFuture(failingVertxMock); + vertxFactory = (vertxOptions, clusterManager) -> succeededFuture(failingVertxMock); } - NeonBee.create(vertxFunction, HAZELCAST.factory(), + NeonBee.create(vertxFactory, HAZELCAST.factory(), defaultOptions().clearActiveProfiles().addActiveProfile(NO_WEB), null) .onComplete(testContext.failing(throwable -> { testContext.verify(() -> { @@ -430,10 +435,12 @@ static Stream testEncryptionOptions() { BiFunction>> keyAndTruststoreVerifier = (ebo, testContext) -> asyncVertx -> testContext.verify(() -> { assertThat(asyncVertx.succeeded()).isTrue(); - assertThat(ebo.getPfxTrustOptions().getPath()).isEqualTo(dummyPath.toString()); - assertThat(ebo.getPfxTrustOptions().getPassword()).isEqualTo(dummyPassword); - assertThat(ebo.getPfxKeyCertOptions().getPath()).isEqualTo(dummyPath.toString()); - assertThat(ebo.getPfxKeyCertOptions().getPassword()).isEqualTo(dummyPassword); + assertThat(ebo.getTrustOptions()).isInstanceOf(PfxOptions.class); + assertThat(((PfxOptions) ebo.getTrustOptions()).getPath()).isEqualTo(dummyPath.toString()); + assertThat(((PfxOptions) ebo.getTrustOptions()).getPassword()).isEqualTo(dummyPassword); + assertThat(ebo.getKeyCertOptions()).isInstanceOf(PfxOptions.class); + assertThat(((PfxOptions) ebo.getKeyCertOptions()).getPath()).isEqualTo(dummyPath.toString()); + assertThat(((PfxOptions) ebo.getKeyCertOptions()).getPassword()).isEqualTo(dummyPassword); assertThat(ebo.getClientAuth()).isEqualTo(ClientAuth.REQUIRED); assertThat(ebo.getSslOptions().getTrustOptions()).isNotNull(); assertThat(ebo.getSslOptions().getKeyCertOptions()).isNotNull(); @@ -443,8 +450,8 @@ static Stream testEncryptionOptions() { BiFunction>> noKeyOrTruststoreVerifier = (ebo, testContext) -> asyncVertx -> testContext.verify(() -> { assertThat(asyncVertx.succeeded()).isTrue(); - assertThat(ebo.getTrustStoreOptions()).isNull(); - assertThat(ebo.getKeyStoreOptions()).isNull(); + assertThat(ebo.getTrustOptions()).isNull(); + assertThat(ebo.getKeyCertOptions()).isNull(); assertThat(ebo.getClientAuth()).isEqualTo(ClientAuth.NONE); assertThat(ebo.getSslOptions().getTrustOptions()).isNull(); assertThat(ebo.getSslOptions().getKeyCertOptions()).isNull(); diff --git a/src/test/java/io/neonbee/config/ServerConfigTest.java b/src/test/java/io/neonbee/config/ServerConfigTest.java index 8d1b2bf2..9da7376d 100644 --- a/src/test/java/io/neonbee/config/ServerConfigTest.java +++ b/src/test/java/io/neonbee/config/ServerConfigTest.java @@ -245,16 +245,16 @@ void testOverriddenSetters() { assertThat(sc.getInitialSettings()).isEqualTo(http2Settings); JdkSSLEngineOptions jdkSSLEngineOptions = new JdkSSLEngineOptions(); - assertThat(sc.setJdkSslEngineOptions(jdkSSLEngineOptions)).isSameInstanceAs(sc); - assertThat(sc.getJdkSslEngineOptions()).isEqualTo(jdkSSLEngineOptions); + assertThat(sc.setSslEngineOptions(jdkSSLEngineOptions)).isSameInstanceAs(sc); + assertThat(sc.getSslEngineOptions()).isEqualTo(jdkSSLEngineOptions); KeyCertOptions keyCertOptions = Mockito.mock(KeyCertOptions.class); assertThat(sc.setKeyCertOptions(keyCertOptions)).isSameInstanceAs(sc); assertThat(sc.getKeyCertOptions()).isEqualTo(keyCertOptions); JksOptions jksOptions = new JksOptions(); - assertThat(sc.setKeyStoreOptions(jksOptions)).isSameInstanceAs(sc); - assertThat(sc.getKeyStoreOptions()).isEqualTo(jksOptions); + assertThat(sc.setKeyCertOptions(jksOptions)).isSameInstanceAs(sc); + assertThat(sc.getKeyCertOptions()).isEqualTo(jksOptions); assertThat(sc.setLogActivity(false)).isSameInstanceAs(sc); assertThat(sc.getLogActivity()).isEqualTo(false); @@ -275,16 +275,16 @@ void testOverriddenSetters() { assertThat(sc.getMaxWebSocketMessageSize()).isEqualTo(10); OpenSSLEngineOptions openSSLEngineOptions = new OpenSSLEngineOptions(); - assertThat(sc.setOpenSslEngineOptions(openSSLEngineOptions)).isSameInstanceAs(sc); - assertThat(sc.getOpenSslEngineOptions()).isEqualTo(openSSLEngineOptions); + assertThat(sc.setSslEngineOptions(openSSLEngineOptions)).isSameInstanceAs(sc); + assertThat(sc.getSslEngineOptions()).isEqualTo(openSSLEngineOptions); PemKeyCertOptions pemKeyCertOptions = new PemKeyCertOptions(); assertThat(sc.setPemKeyCertOptions(pemKeyCertOptions)).isSameInstanceAs(sc); - assertThat(sc.getPemKeyCertOptions()).isEqualTo(pemKeyCertOptions); + assertThat(sc.getKeyCertOptions()).isEqualTo(pemKeyCertOptions); PemTrustOptions pemTrustOptions = new PemTrustOptions(); - assertThat(sc.setPemTrustOptions(pemTrustOptions)).isSameInstanceAs(sc); - assertThat(sc.getPemTrustOptions()).isEqualTo(pemTrustOptions); + assertThat(sc.setTrustOptions(pemTrustOptions)).isSameInstanceAs(sc); + assertThat(sc.getTrustOptions()).isEqualTo(pemTrustOptions); assertThat(sc.setPerFrameWebSocketCompressionSupported(false)).isSameInstanceAs(sc); assertThat(sc.getPerFrameWebSocketCompressionSupported()).isEqualTo(false); @@ -293,11 +293,11 @@ void testOverriddenSetters() { assertThat(sc.getPerMessageWebSocketCompressionSupported()).isEqualTo(false); PfxOptions pfxOptions = new PfxOptions(); - assertThat(sc.setPfxKeyCertOptions(pfxOptions)).isSameInstanceAs(sc); - assertThat(sc.getPfxKeyCertOptions()).isEqualTo(pfxOptions); + assertThat(sc.setKeyCertOptions(pfxOptions)).isSameInstanceAs(sc); + assertThat(sc.getKeyCertOptions()).isEqualTo(pfxOptions); - assertThat(sc.setPfxTrustOptions(pfxOptions)).isSameInstanceAs(sc); - assertThat(sc.getPfxTrustOptions()).isEqualTo(pfxOptions); + assertThat(sc.setTrustOptions(pfxOptions)).isSameInstanceAs(sc); + assertThat(sc.getTrustOptions()).isEqualTo(pfxOptions); assertThat(sc.setPort(11)).isSameInstanceAs(sc); assertThat(sc.getPort()).isEqualTo(11); @@ -367,8 +367,8 @@ void testOverriddenSetters() { assertThat(sc.setTrustOptions(trustOptions)).isSameInstanceAs(sc); assertThat(sc.getTrustOptions()).isEqualTo(trustOptions); - assertThat(sc.setTrustStoreOptions(jksOptions)).isSameInstanceAs(sc); - assertThat(sc.getTrustStoreOptions()).isEqualTo(jksOptions); + assertThat(sc.setTrustOptions(jksOptions)).isSameInstanceAs(sc); + assertThat(sc.getTrustOptions()).isEqualTo(jksOptions); assertThat(sc.setUseAlpn(false)).isSameInstanceAs(sc); assertThat(sc.isUseAlpn()).isEqualTo(false);