use of com.palantir.atlasdb.factory.ServiceCreator in project atlasdb by palantir.
the class TransactionPostMortemRunner method createRpcClient.
private static LockDiagnosticInfoService createRpcClient(AtlasDbConfig config, Refreshable<AtlasDbRuntimeConfig> runtimeConfigSupplier) {
Refreshable<ServerListConfig> serverListConfigSupplier = getServerListConfigSupplierForTimeLock(config, runtimeConfigSupplier);
timelockNamespace(config);
ServiceCreator serviceCreator = ServiceCreator.withPayloadLimiter(new MetricsManager(new MetricRegistry(), new DefaultTaggedMetricRegistry(), _unused -> true), serverListConfigSupplier, UserAgent.of(UserAgent.Agent.of("agent", "0.0.0")), () -> runtimeConfigSupplier.get().remotingClient());
return serviceCreator.createService(LockDiagnosticInfoService.class);
}
use of com.palantir.atlasdb.factory.ServiceCreator in project atlasdb by palantir.
the class ShortAndLongTimeoutServicesTest method createInvokesCorrectMethodsOnServiceCreator.
@Test
public void createInvokesCorrectMethodsOnServiceCreator() {
Object shortTimeout = new Object();
Object longTimeout = new Object();
ServiceCreator serviceCreator = mock(ServiceCreator.class);
when(serviceCreator.createServiceWithShortTimeout(any())).thenReturn(shortTimeout);
when(serviceCreator.createService(any())).thenReturn(longTimeout);
ShortAndLongTimeoutServices<Object> services = ShortAndLongTimeoutServices.create(serviceCreator, Object.class);
assertThat(services.shortTimeout()).isEqualTo(shortTimeout);
assertThat(services.longTimeout()).isEqualTo(longTimeout);
verify(serviceCreator).createService(Object.class);
verify(serviceCreator).createServiceWithShortTimeout(Object.class);
verifyNoMoreInteractions(serviceCreator);
}
Aggregations