public static ServerListConfig parseInstallAndRuntimeConfigs(TimeLockClientConfig installClientConfig, Supplier<Optional<TimeLockRuntimeConfig>> runtimeConfig, String namespace) { ServerListConfig nonNamespacedConfig = runtimeConfig.get() .map(TimeLockRuntimeConfig::serversList) .orElse(installClientConfig.serversList()); return namespaceUris(nonNamespacedConfig, namespace); }
public ServerListConfig toNamespacedServerList() { return ServerListConfigs.namespaceUris(serversList(), getClientOrThrow()); }
private static Optional<TimeLockClientConfig> addFallbackSslConfigurationToTimeLockClientConfig( Optional<TimeLockClientConfig> config, Optional<SslConfiguration> sslConfiguration) { //noinspection ConstantConditions - function returns an existing ServerListConfig, maybe with different SSL. return config.map(clientConfig -> ImmutableTimeLockClientConfig.builder() .from(clientConfig) .serversList(addSslConfigurationToServerListFunction(sslConfiguration) .apply(clientConfig.serversList())) .build()); }
@Test public void otherPropertiesConservedWhenAddingClient() { TimeLockClientConfig newConfig = TimeLockClientConfigs.copyWithClient(CONFIG_WITHOUT_CLIENT, CLIENT_1); assertThat(newConfig.serversList()).isEqualTo(SERVERS_LIST); }
private void assertTimeLockConfigDeserializedCorrectly(TimeLockClientConfig timeLockClientConfig) { assertThat(timeLockClientConfig.getClientOrThrow()).isEqualTo("brian"); assertThat(timeLockClientConfig.serversList().servers()).containsExactlyInAnyOrder( "timelock1:8080", "timelock2:8080", "timelock3:8080"); assertThat(timeLockClientConfig.serversList().sslConfiguration().isPresent()).isTrue(); SslConfiguration sslConfiguration = timeLockClientConfig.serversList().sslConfiguration().get(); assertSslConfigDeserializedCorrectly(sslConfiguration); }
@Test public void addingFallbackSslAddsItToTimelockServersBlock() { AtlasDbConfig withoutSsl = ImmutableAtlasDbConfig.builder() .keyValueService(KVS_CONFIG_WITH_NAMESPACE) .timelock(TIMELOCK_CONFIG) .build(); AtlasDbConfig withSsl = AtlasDbConfigs.addFallbackSslConfigurationToAtlasDbConfig(withoutSsl, SSL_CONFIG); assertThat(withSsl.timelock().get().serversList().sslConfiguration(), is(SSL_CONFIG)); }
public static ServerListConfig parseInstallAndRuntimeConfigs(TimeLockClientConfig installClientConfig, Supplier<Optional<TimeLockRuntimeConfig>> runtimeConfig, String namespace) { ServerListConfig nonNamespacedConfig = runtimeConfig.get() .map(TimeLockRuntimeConfig::serversList) .orElse(installClientConfig.serversList()); return namespaceUris(nonNamespacedConfig, namespace); }
public ServerListConfig toNamespacedServerList() { return ServerListConfigs.namespaceUris(serversList(), getClientOrThrow()); }
private static Optional<TimeLockClientConfig> addFallbackSslConfigurationToTimeLockClientConfig( Optional<TimeLockClientConfig> config, Optional<SslConfiguration> sslConfiguration) { //noinspection ConstantConditions - function returns an existing ServerListConfig, maybe with different SSL. return config.map(clientConfig -> ImmutableTimeLockClientConfig.builder() .from(clientConfig) .serversList(addSslConfigurationToServerListFunction(sslConfiguration) .apply(clientConfig.serversList())) .build()); }