use of org.elasticsearch.node.settings.NodeSettingsService in project crate by crate.
the class CrateCircuitBreakerServiceTest method testQueryCircuitBreakerRegistration.
@Test
public void testQueryCircuitBreakerRegistration() throws Exception {
NodeSettingsService settingsService = new NodeSettingsService(Settings.EMPTY);
CircuitBreakerService esBreakerService = new HierarchyCircuitBreakerService(Settings.EMPTY, settingsService);
CrateCircuitBreakerService breakerService = new CrateCircuitBreakerService(Settings.EMPTY, settingsService, esBreakerService);
CircuitBreaker breaker = breakerService.getBreaker(CrateCircuitBreakerService.QUERY);
assertThat(breaker, notNullValue());
assertThat(breaker, instanceOf(CircuitBreaker.class));
assertThat(breaker.getName(), is(CrateCircuitBreakerService.QUERY));
}
use of org.elasticsearch.node.settings.NodeSettingsService in project crate by crate.
the class CrateCircuitBreakerServiceTest method testStats.
@Test
public void testStats() throws Exception {
NodeSettingsService settingsService = new NodeSettingsService(Settings.EMPTY);
CircuitBreakerService esBreakerService = new HierarchyCircuitBreakerService(Settings.EMPTY, settingsService);
CrateCircuitBreakerService breakerService = new CrateCircuitBreakerService(Settings.EMPTY, settingsService, esBreakerService);
CircuitBreakerStats[] stats = breakerService.stats().getAllStats();
assertThat(stats.length, is(7));
CircuitBreakerStats queryBreakerStats = breakerService.stats(CrateCircuitBreakerService.QUERY);
assertThat(queryBreakerStats.getEstimated(), is(0L));
}
use of org.elasticsearch.node.settings.NodeSettingsService in project crate by crate.
the class TableStatsServiceTest method testNoUpdateIfLocalNodeNotAvailable.
@Test
public void testNoUpdateIfLocalNodeNotAvailable() throws Exception {
final ClusterService clusterService = mock(ClusterService.class);
when(clusterService.localNode()).thenReturn(null);
SQLOperations sqlOperations = mock(SQLOperations.class);
SQLOperations.Session session = mock(SQLOperations.Session.class);
when(sqlOperations.createSession(anyString(), any(), anyInt())).thenReturn(session);
TableStatsService statsService = new TableStatsService(Settings.EMPTY, threadPool, clusterService, new TableStats(), new NodeSettingsService(Settings.EMPTY), sqlOperations);
statsService.run();
Mockito.verify(session, times(0)).sync();
}
Aggregations