use of com.palantir.timelock.config.ClusterInstallConfiguration in project atlasdb by palantir.
the class InMemoryTimelockServices method before.
@Override
protected void before() throws IOException {
PaxosInstallConfiguration paxos = PaxosInstallConfiguration.builder().dataDirectory(tryCreateSubFolder(tempFolder)).leaderMode(PaxosLeaderMode.SINGLE_LEADER).sqlitePersistence(ImmutableSqlitePaxosPersistenceConfiguration.builder().dataDirectory(tryCreateSubFolder(tempFolder, client)).build()).isNewService(false).build();
ClusterInstallConfiguration cluster = ImmutableClusterInstallConfiguration.builder().enableNonstandardAndPossiblyDangerousTopology(true).build();
TimeLockInstallConfiguration install = TimeLockInstallConfiguration.builder().paxos(paxos).cluster(cluster).build();
ImmutableDefaultClusterConfiguration clusterConfig = ImmutableDefaultClusterConfiguration.builder().localServer("local").cluster(PartialServiceConfiguration.of(List.of("local"), Optional.empty())).build();
TimeLockRuntimeConfiguration runtime = ImmutableTimeLockRuntimeConfiguration.builder().permittedBackupToken(BEARER_TOKEN).clusterSnapshot(clusterConfig).build();
MetricsManager metricsManager = MetricsManagers.createForTests();
timeLockAgent = TimeLockAgent.create(metricsManager, install, // This won't actually live reload.
Refreshable.only(runtime), runtime.clusterSnapshot(), USER_AGENT, THREAD_POOL_SIZE, BLOCKING_TIMEOUT_MS, _unused -> {
}, Optional.empty(), OrderableSlsVersion.valueOf("0.0.0"), ObjectMappers.newServerObjectMapper(), () -> System.exit(0));
delegate = timeLockAgent.createInvalidatingTimeLockServices(client);
createHelperServices(metricsManager);
// Wait for leadership
Awaitility.await().atMost(Duration.ofSeconds(30L)).pollInterval(Duration.ofMillis(50)).ignoreExceptions().until(() -> delegate.getTimestampService().getFreshTimestamp() > 0);
}
Aggregations