Search in sources :

Example 1 with SslConfiguration

use of com.palantir.remoting.api.config.ssl.SslConfiguration in project atlasdb by palantir.

the class TimeLockTestUtils method createTransactionManager.

static SerializableTransactionManager createTransactionManager(TestableTimelockCluster cluster) {
    List<String> serverUris = cluster.servers().stream().map(server -> server.serverHolder().getTimelockUri()).collect(Collectors.toList());
    AtlasDbConfig config = ImmutableAtlasDbConfig.builder().namespace("test").keyValueService(new InMemoryAtlasDbConfig()).timelock(ImmutableTimeLockClientConfig.builder().serversList(ImmutableServerListConfig.builder().servers(serverUris).sslConfiguration(SslConfiguration.of(Paths.get("var/security/trustStore.jks"))).build()).build()).build();
    return TransactionManagers.builder().config(config).userAgent("test").globalMetricsRegistry(new MetricRegistry()).globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()).build().serializable();
}
Also used : ImmutableServerListConfig(com.palantir.atlasdb.config.ImmutableServerListConfig) MetricRegistry(com.codahale.metrics.MetricRegistry) ImmutableTimeLockClientConfig(com.palantir.atlasdb.config.ImmutableTimeLockClientConfig) InMemoryAtlasDbConfig(com.palantir.atlasdb.memory.InMemoryAtlasDbConfig) DefaultTaggedMetricRegistry(com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry) Collectors(java.util.stream.Collectors) TransactionManagers(com.palantir.atlasdb.factory.TransactionManagers) List(java.util.List) ImmutableAtlasDbConfig(com.palantir.atlasdb.config.ImmutableAtlasDbConfig) SslConfiguration(com.palantir.remoting.api.config.ssl.SslConfiguration) Paths(java.nio.file.Paths) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) AtlasDbConfig(com.palantir.atlasdb.config.AtlasDbConfig) MetricRegistry(com.codahale.metrics.MetricRegistry) DefaultTaggedMetricRegistry(com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry) InMemoryAtlasDbConfig(com.palantir.atlasdb.memory.InMemoryAtlasDbConfig) ImmutableAtlasDbConfig(com.palantir.atlasdb.config.ImmutableAtlasDbConfig) AtlasDbConfig(com.palantir.atlasdb.config.AtlasDbConfig) InMemoryAtlasDbConfig(com.palantir.atlasdb.memory.InMemoryAtlasDbConfig)

Example 2 with SslConfiguration

use of com.palantir.remoting.api.config.ssl.SslConfiguration in project atlasdb by palantir.

the class AtlasDbConfigDeserializationTest method assertTimeLockConfigDeserializedCorrectly.

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);
}
Also used : SslConfiguration(com.palantir.remoting.api.config.ssl.SslConfiguration)

Example 3 with SslConfiguration

use of com.palantir.remoting.api.config.ssl.SslConfiguration in project atlasdb by palantir.

the class AtlasDbCommandUtilsTest method canSerializeAndDeserializeAtlasDbConfig.

@Test
public void canSerializeAndDeserializeAtlasDbConfig() throws IOException {
    SslConfiguration ssl = SslConfiguration.of(new File("var/security/truststore.jks").toPath(), new File("var/security/keystore.jks").toPath(), "keystorePassword");
    @SuppressWarnings("deprecation") AtlasDbConfig bigConfig = ImmutableAtlasDbConfig.builder().leader(ImmutableLeaderConfig.builder().quorumSize(1).addLeaders(LOCAL_SERVER_NAME).localServer(LOCAL_SERVER_NAME).sslConfiguration(ssl).learnerLogDir(new File("var/data/paxos/learner").getAbsoluteFile()).acceptorLogDir(new File("var/data/paxos/acceptor").getAbsoluteFile()).build()).keyValueService(ImmutableCassandraKeyValueServiceConfig.builder().keyspace("test").replicationFactor(3).servers(ImmutableSet.of(new InetSocketAddress("host1", 9160), new InetSocketAddress("host2", 9160), new InetSocketAddress("host3", 9160))).ssl(true).sslConfiguration(ssl).build()).build();
    String configAsString = AtlasDbCommandUtils.serialiseConfiguration(bigConfig);
    AtlasDbConfig deserializedConfig = AtlasDbConfigs.loadFromString(configAsString, "", AtlasDbConfig.class);
    assertThat(bigConfig).isEqualTo(deserializedConfig);
}
Also used : SslConfiguration(com.palantir.remoting.api.config.ssl.SslConfiguration) InetSocketAddress(java.net.InetSocketAddress) ImmutableAtlasDbConfig(com.palantir.atlasdb.config.ImmutableAtlasDbConfig) AtlasDbConfig(com.palantir.atlasdb.config.AtlasDbConfig) File(java.io.File) Test(org.junit.Test)

Aggregations

SslConfiguration (com.palantir.remoting.api.config.ssl.SslConfiguration)3 AtlasDbConfig (com.palantir.atlasdb.config.AtlasDbConfig)2 ImmutableAtlasDbConfig (com.palantir.atlasdb.config.ImmutableAtlasDbConfig)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 ImmutableServerListConfig (com.palantir.atlasdb.config.ImmutableServerListConfig)1 ImmutableTimeLockClientConfig (com.palantir.atlasdb.config.ImmutableTimeLockClientConfig)1 TransactionManagers (com.palantir.atlasdb.factory.TransactionManagers)1 InMemoryAtlasDbConfig (com.palantir.atlasdb.memory.InMemoryAtlasDbConfig)1 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)1 DefaultTaggedMetricRegistry (com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry)1 File (java.io.File)1 InetSocketAddress (java.net.InetSocketAddress)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Test (org.junit.Test)1