use of org.apache.druid.java.util.metrics.MonitorScheduler in project druid by druid-io.
the class ShuffleModuleTest method testGetShuffleMetricsWhenShuffleMonitorExists.
@Test
public void testGetShuffleMetricsWhenShuffleMonitorExists() {
final ShuffleMonitor shuffleMonitor = new ShuffleMonitor();
final MonitorScheduler monitorScheduler = Mockito.mock(MonitorScheduler.class);
Mockito.when(monitorScheduler.findMonitor(ShuffleMonitor.class)).thenReturn(Optional.of(shuffleMonitor));
final Injector injector = createInjector(monitorScheduler);
final Optional<ShuffleMetrics> optional = injector.getInstance(Key.get(new TypeLiteral<Optional<ShuffleMetrics>>() {
}));
Assert.assertTrue(optional.isPresent());
}
use of org.apache.druid.java.util.metrics.MonitorScheduler in project druid by druid-io.
the class ShuffleModuleTest method testGetShuffleMetricsWithNoShuffleMonitor.
@Test
public void testGetShuffleMetricsWithNoShuffleMonitor() {
final MonitorScheduler monitorScheduler = Mockito.mock(MonitorScheduler.class);
Mockito.when(monitorScheduler.findMonitor(ArgumentMatchers.eq(ShuffleMonitor.class))).thenReturn(Optional.empty());
final Injector injector = createInjector(monitorScheduler);
final Optional<ShuffleMetrics> optional = injector.getInstance(Key.get(new TypeLiteral<Optional<ShuffleMetrics>>() {
}));
Assert.assertFalse(optional.isPresent());
}
use of org.apache.druid.java.util.metrics.MonitorScheduler in project druid by druid-io.
the class TaskLifecycleTest method setUp.
@Before
public void setUp() throws Exception {
// mock things
queryRunnerFactoryConglomerate = EasyMock.createStrictMock(QueryRunnerFactoryConglomerate.class);
monitorScheduler = EasyMock.createStrictMock(MonitorScheduler.class);
// initialize variables
announcedSinks = 0;
pushedSegments = 0;
indexSpec = new IndexSpec();
emitter = newMockEmitter();
EmittingLogger.registerEmitter(emitter);
mapper = TEST_UTILS.getTestObjectMapper();
handOffCallbacks = new ConcurrentHashMap<>();
// Set up things, the order does matter as if it is messed up then the setUp
// should fail because of the Precondition checks in the respective setUp methods
// For creating a customized TaskQueue see testRealtimeIndexTaskFailure test
taskStorage = setUpTaskStorage();
handoffNotifierFactory = setUpSegmentHandOffNotifierFactory();
dataSegmentPusher = setUpDataSegmentPusher();
mdc = setUpMetadataStorageCoordinator();
tb = setUpTaskToolboxFactory(dataSegmentPusher, handoffNotifierFactory, mdc);
taskRunner = setUpThreadPoolTaskRunner(tb);
taskQueue = setUpTaskQueue(taskStorage, taskRunner);
}
use of org.apache.druid.java.util.metrics.MonitorScheduler in project druid by druid-io.
the class MetricsModuleTest method testGetBasicMonitorSchedulerViaConfig.
@Test
public void testGetBasicMonitorSchedulerViaConfig() {
final Properties properties = new Properties();
properties.setProperty(StringUtils.format("%s.schedulerClassName", MetricsModule.MONITORING_PROPERTY_PREFIX), BasicMonitorScheduler.class.getName());
final MonitorScheduler monitorScheduler = createInjector(properties).getInstance(MonitorScheduler.class);
Assert.assertSame(BasicMonitorScheduler.class, monitorScheduler.getClass());
}
use of org.apache.druid.java.util.metrics.MonitorScheduler in project druid by druid-io.
the class MetricsModuleTest method testGetClockDriftSafeMonitorSchedulerViaConfig.
@Test
public void testGetClockDriftSafeMonitorSchedulerViaConfig() {
final Properties properties = new Properties();
properties.setProperty(StringUtils.format("%s.schedulerClassName", MetricsModule.MONITORING_PROPERTY_PREFIX), ClockDriftSafeMonitorScheduler.class.getName());
final MonitorScheduler monitorScheduler = createInjector(properties).getInstance(MonitorScheduler.class);
Assert.assertSame(ClockDriftSafeMonitorScheduler.class, monitorScheduler.getClass());
}
Aggregations