use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.
the class TaskQueueTest method testLockConfigTakePrecedenceThanDefaultTaskContext.
@Test
public void testLockConfigTakePrecedenceThanDefaultTaskContext() throws EntryExistsException {
final TaskActionClientFactory actionClientFactory = createActionClientFactory();
final TaskQueue taskQueue = new TaskQueue(new TaskLockConfig(), new TaskQueueConfig(null, null, null, null), new DefaultTaskConfig() {
@Override
public Map<String, Object> getContext() {
return ImmutableMap.of(Tasks.FORCE_TIME_CHUNK_LOCK_KEY, false);
}
}, getTaskStorage(), new SimpleTaskRunner(actionClientFactory), actionClientFactory, getLockbox(), new NoopServiceEmitter());
taskQueue.setActive(true);
final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"));
taskQueue.add(task);
final List<Task> tasks = taskQueue.getTasks();
Assert.assertEquals(1, tasks.size());
final Task queuedTask = tasks.get(0);
Assert.assertTrue(queuedTask.getContextValue(Tasks.FORCE_TIME_CHUNK_LOCK_KEY));
}
use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.
the class TaskQueueTest method testSetUseLineageBasedSegmentAllocationByDefault.
@Test
public void testSetUseLineageBasedSegmentAllocationByDefault() throws EntryExistsException {
final TaskActionClientFactory actionClientFactory = createActionClientFactory();
final TaskQueue taskQueue = new TaskQueue(new TaskLockConfig(), new TaskQueueConfig(null, null, null, null), new DefaultTaskConfig(), getTaskStorage(), new SimpleTaskRunner(actionClientFactory), actionClientFactory, getLockbox(), new NoopServiceEmitter());
taskQueue.setActive(true);
final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"));
taskQueue.add(task);
final List<Task> tasks = taskQueue.getTasks();
Assert.assertEquals(1, tasks.size());
final Task queuedTask = tasks.get(0);
Assert.assertTrue(queuedTask.getContextValue(SinglePhaseParallelIndexTaskRunner.CTX_USE_LINEAGE_BASED_SEGMENT_ALLOCATION_KEY));
}
use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.
the class BrokerServerViewTest method setupViews.
private void setupViews(Set<String> watchedTiers, Set<String> ignoredTiers, boolean watchRealtimeTasks) throws Exception {
baseView = new BatchServerInventoryView(zkPathsConfig, curator, jsonMapper, Predicates.alwaysTrue(), "test") {
@Override
public void registerSegmentCallback(Executor exec, final SegmentCallback callback) {
super.registerSegmentCallback(exec, new SegmentCallback() {
@Override
public CallbackAction segmentAdded(DruidServerMetadata server, DataSegment segment) {
CallbackAction res = callback.segmentAdded(server, segment);
segmentAddedLatch.countDown();
return res;
}
@Override
public CallbackAction segmentRemoved(DruidServerMetadata server, DataSegment segment) {
CallbackAction res = callback.segmentRemoved(server, segment);
segmentRemovedLatch.countDown();
return res;
}
@Override
public CallbackAction segmentViewInitialized() {
CallbackAction res = callback.segmentViewInitialized();
segmentViewInitLatch.countDown();
return res;
}
});
}
};
brokerServerView = new BrokerServerView(EasyMock.createMock(QueryToolChestWarehouse.class), EasyMock.createMock(QueryWatcher.class), getSmileMapper(), EasyMock.createMock(HttpClient.class), baseView, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()), new NoopServiceEmitter(), new BrokerSegmentWatcherConfig() {
@Override
public Set<String> getWatchedTiers() {
return watchedTiers;
}
@Override
public boolean isWatchRealtimeTasks() {
return watchRealtimeTasks;
}
@Override
public Set<String> getIgnoredTiers() {
return ignoredTiers;
}
});
baseView.start();
}
use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.
the class DirectDruidClientTest method setup.
@Before
public void setup() {
httpClient = EasyMock.createMock(HttpClient.class);
serverSelector = new ServerSelector(dataSegment, new HighestPriorityTierSelectorStrategy(new ConnectionCountServerSelectorStrategy()));
client = new DirectDruidClient(new ReflectionQueryToolChestWarehouse(), QueryRunnerTestHelper.NOOP_QUERYWATCHER, new DefaultObjectMapper(), httpClient, "http", hostName, new NoopServiceEmitter());
queryableDruidServer = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, 0), client);
serverSelector.addServerAndUpdateSegment(queryableDruidServer, serverSelector.getSegment());
}
use of org.apache.druid.server.metrics.NoopServiceEmitter in project druid by druid-io.
the class QueryableModuleTest method makeInjector.
private Injector makeInjector(Properties properties) {
Injector injector = Guice.createInjector(ImmutableList.of(new DruidGuiceExtensions(), new JacksonModule(), new ConfigModule(), new QueryRunnerFactoryModule(), new DruidProcessingConfigModule(), new BrokerProcessingModule(), new LifecycleModule(), binder -> {
binder.bind(Properties.class).toInstance(properties);
}, new QueryableModule()));
ObjectMapper mapper = injector.getInstance(Key.get(ObjectMapper.class, Json.class));
mapper.registerModules(new QueryableModule().getJacksonModules());
mapper.setInjectableValues(new InjectableValues.Std().addValue(ServiceEmitter.class, new NoopServiceEmitter()));
return injector;
}
Aggregations