4141import org .apache .druid .indexing .common .task .CompactionIntervalSpec ;
4242import org .apache .druid .indexing .common .task .CompactionTask ;
4343import org .apache .druid .indexing .common .task .NoopTask ;
44- import org .apache .druid .indexing .common .task .Task ;
4544import org .apache .druid .indexing .common .task .TaskResource ;
4645import org .apache .druid .indexing .common .task .batch .parallel .ShuffleClient ;
4746import org .apache .druid .indexing .overlord .TaskRunner ;
5958import org .apache .druid .java .util .common .granularity .AllGranularity ;
6059import org .apache .druid .query .DruidMetrics ;
6160import org .apache .druid .query .QuerySegmentWalker ;
62- import org .apache .druid .query .filter .SelectorDimFilter ;
6361import org .apache .druid .query .policy .PolicyEnforcer ;
6462import org .apache .druid .query .policy .RestrictAllTablesPolicyEnforcer ;
6563import org .apache .druid .segment .TestHelper ;
6967import org .apache .druid .segment .indexing .DataSchema ;
7068import org .apache .druid .segment .realtime .ChatHandlerProvider ;
7169import org .apache .druid .segment .realtime .appenderator .AppenderatorsManager ;
72- import org .apache .druid .segment .transform .CompactionTransformSpec ;
7370import org .apache .druid .server .coordination .BroadcastDatasourceLoadingSpec ;
7471import org .apache .druid .server .lookup .cache .LookupLoadingSpec ;
7572import org .apache .druid .server .metrics .LoadSpecHolder ;
@@ -125,17 +122,6 @@ public void testCliPeonNonK8sMode() throws IOException
125122 Assert .assertNotNull (runnable .makeInjector ());
126123 }
127124
128- @ Test
129- public void testCliPeonNonK8sMode3 () throws IOException
130- {
131- File file = temporaryFolder .newFile ("task.json" );
132- FileUtils .write (file , "{\" type\" :\" noop\" }" , StandardCharsets .UTF_8 );
133- GuiceRunnable runnable = new FakeCliPeon (file .getParent (), "httpRemote" );
134- final Injector injector = GuiceInjectors .makeStartupInjector ();
135- injector .injectMembers (runnable );
136- Assert .assertNotNull (runnable .makeInjector ());
137- }
138-
139125 @ Test
140126 public void testCliPeonK8sANdWorkerIsK8sMode () throws IOException
141127 {
@@ -209,39 +195,6 @@ public void testCliPeonHeartbeatDimensions()
209195 );
210196 }
211197
212- @ Test
213- public void testCliPeonAllBindingsUp () throws IOException
214- {
215- File file = temporaryFolder .newFile ("task.json" );
216- FileUtils .write (file , "{\" type\" :\" noop\" }" , StandardCharsets .UTF_8 );
217-
218- CliPeon runnable = new CliPeon ();
219- runnable .taskAndStatusFile = ImmutableList .of (file .getParent (), "1" );
220- Properties properties = new Properties ();
221- runnable .configure (properties );
222- runnable .configure (properties , GuiceInjectors .makeStartupInjector ());
223- Injector injector = runnable .makeInjector ();
224-
225- Assert .assertNotNull (injector .getInstance (ExecutorLifecycle .class ));
226- Assert .assertNotNull (injector .getInstance (TaskRunner .class ));
227- Assert .assertNotNull (injector .getInstance (QuerySegmentWalker .class ));
228- Assert .assertNotNull (injector .getInstance (AppenderatorsManager .class ));
229- Assert .assertNotNull (injector .getInstance (ServerTypeConfig .class ));
230- Assert .assertNotNull (injector .getInstance (RowIngestionMetersFactory .class ));
231- Assert .assertNotNull (injector .getInstance (ChatHandlerProvider .class ));
232- Assert .assertNotNull (injector .getInstance (IntermediaryDataManager .class ));
233- Assert .assertNotNull (injector .getInstance (ShuffleClient .class ));
234- Assert .assertNotNull (injector .getInstance (SegmentHandoffNotifierFactory .class ));
235- Assert .assertNotNull (injector .getInstance (TaskReportFileWriter .class ));
236-
237-
238- Supplier <Map <String , Object >> hb = injector .getInstance (
239- Key .get (new TypeLiteral <Supplier <Map <String , Object >>>() {}, Names .named (ServiceStatusMonitor .HEARTBEAT_TAGS_BINDING ))
240- );
241- Assert .assertNotNull (hb );
242- Assert .assertNotNull (hb .get ());
243- }
244-
245198 @ Test
246199 public void testCliPeonLocalTmpStorage () throws IOException
247200 {
@@ -261,56 +214,7 @@ public void testCliPeonLocalTmpStorage() throws IOException
261214 }
262215
263216 @ Test
264- public void testCliPeonAllBindingsUp2 () throws IOException
265- {
266- File file = temporaryFolder .newFile ("task.json" );
267- Task noopTask = new NoopTask ("noopId" , null , "noopDs" , 0 , 0 , Map .of ());
268-
269- FileUtils .write (file , mapper .writeValueAsString (noopTask ), StandardCharsets .UTF_8 );
270-
271- CliPeon runnable = new CliPeon ();
272- runnable .taskAndStatusFile = ImmutableList .of (file .getParent (), "1" );
273- Properties properties = new Properties ();
274- runnable .configure (properties );
275- runnable .configure (properties , GuiceInjectors .makeStartupInjector ());
276- Injector injector = runnable .makeInjector ();
277-
278- LoadSpecHolder instance = injector .getInstance (LoadSpecHolder .class );
279- Assert .assertEquals (LookupLoadingSpec .ALL , instance .getLookupLoadingSpec ());
280- Assert .assertEquals (BroadcastDatasourceLoadingSpec .ALL , instance .getBroadcastDatasourceLoadingSpec ());
281-
282- TaskHolder instance1 = injector .getInstance (TaskHolder .class );
283- Assert .assertEquals ("noopDs" , instance1 .getDataSource ());
284- Assert .assertEquals ("noopId" , instance1 .getTaskId ());
285-
286- Supplier <Map <String , Object >> hb = injector .getInstance (
287- Key .get (new TypeLiteral <Supplier <Map <String , Object >>>() {}, Names .named (ServiceStatusMonitor .HEARTBEAT_TAGS_BINDING ))
288- );
289- Assert .assertNotNull (hb );
290- Assert .assertNotNull (hb .get ());
291- }
292-
293- @ Test
294- public void testCliPeonLookupAndExpressionModulesDoNotCycle () throws IOException
295- {
296- File file = temporaryFolder .newFile ("task.json" );
297- FileUtils .write (file , "{\" type\" :\" noop\" }" , StandardCharsets .UTF_8 );
298-
299- CliPeon runnable = new CliPeon ();
300- runnable .taskAndStatusFile = ImmutableList .of (file .getParent (), "1" );
301- Properties properties = new Properties ();
302- runnable .configure (properties );
303- runnable .configure (properties , GuiceInjectors .makeStartupInjector ());
304- Injector injector = runnable .makeInjector ();
305-
306- // Also ensure LoadSpecHolder is accessible and returns non-null specs.
307- LoadSpecHolder loadSpecHolder = injector .getInstance (LoadSpecHolder .class );
308- Assert .assertNotNull (loadSpecHolder .getLookupLoadingSpec ());
309- Assert .assertNotNull (loadSpecHolder .getBroadcastDatasourceLoadingSpec ());
310- }
311-
312- @ Test
313- public void testCliPeonLookupAndExpressionModulesDoNotCycleDefaultsFinal () throws IOException
217+ public void testCliPeonDefaultHolders () throws IOException
314218 {
315219 File file = temporaryFolder .newFile ("task.json" );
316220
@@ -345,7 +249,7 @@ public void testCliPeonLookupAndExpressionModulesDoNotCycleDefaultsFinal() throw
345249 }
346250
347251 @ Test
348- public void testCliPeonLookupAndExpressionModulesDoNotCycleContextOverrides () throws IOException
252+ public void testCliPeonWithTaskContextOverrides () throws IOException
349253 {
350254 File file = temporaryFolder .newFile ("task.json" );
351255
@@ -383,46 +287,6 @@ public void testCliPeonLookupAndExpressionModulesDoNotCycleContextOverrides() th
383287 Assert .assertEquals ("test_ds" , taskHolder .getDataSource ());
384288 }
385289
386- @ Test
387- public void testCliPeonLookupAndExpressionModulesDoNotCycleContextOverrides3 () throws IOException
388- {
389- File file = temporaryFolder .newFile ("task.json" );
390-
391- final CompactionTask .Builder builder = new CompactionTask .Builder (
392- "test_ds" ,
393- new SegmentCacheManagerFactory (TestIndex .INDEX_IO , mapper )
394- );
395- final CompactionTask compactionTask = builder
396- .id ("compact_test_taskid" )
397- .inputSpec (new CompactionIntervalSpec (Intervals .of ("2020/2021" ), null ))
398- .transformSpec (new CompactionTransformSpec (new SelectorDimFilter ("dim1" , "foo" , null )))
399- .context (Map .of (
400- "lookupLoadingMode" , LookupLoadingSpec .Mode .NONE ,
401- "broadcastDatasourceLoadingMode" , BroadcastDatasourceLoadingSpec .Mode .NONE
402- ))
403- .build ();
404-
405- FileUtils .write (file , mapper .writeValueAsString (compactionTask ), StandardCharsets .UTF_8 );
406-
407- CliPeon runnable = new CliPeon ();
408- runnable .taskAndStatusFile = ImmutableList .of (file .getParent (), "1" );
409- Properties properties = new Properties ();
410- runnable .configure (properties );
411- runnable .configure (properties , GuiceInjectors .makeStartupInjector ());
412- Injector injector = runnable .makeInjector ();
413- runnable .configure (properties , injector );
414-
415- LoadSpecHolder loadSpecHolder = injector .getInstance (LoadSpecHolder .class );
416- Assert .assertTrue (loadSpecHolder instanceof CliPeonLoadSpecHolder );
417- Assert .assertEquals (LookupLoadingSpec .NONE , loadSpecHolder .getLookupLoadingSpec ());
418- Assert .assertEquals (BroadcastDatasourceLoadingSpec .NONE , loadSpecHolder .getBroadcastDatasourceLoadingSpec ());
419-
420- TaskHolder taskHolder = injector .getInstance (TaskHolder .class );
421- Assert .assertTrue (taskHolder instanceof CliPeonTaskHolder );
422- Assert .assertEquals ("compact_test_taskid" , taskHolder .getTaskId ());
423- Assert .assertEquals ("test_ds" , taskHolder .getDataSource ());
424- }
425-
426290 private static class FakeCliPeon extends CliPeon
427291 {
428292 List <String > taskAndStatusFile = new ArrayList <>();
@@ -468,27 +332,6 @@ private static class TestStreamingTask extends SeekableStreamIndexTask<String, S
468332 static final String TYPE = "testStreaming" ;
469333 static final String STATUS = SeekableStreamIndexTaskRunner .Status .PAUSED .toString ();
470334
471- public TestStreamingTask (
472- String id ,
473- @ Nullable String supervisorId ,
474- String datasource ,
475- @ Nullable Map context ,
476- @ Nullable String groupId ,
477- DataSchema dataSchema
478- )
479- {
480- this (
481- id ,
482- supervisorId ,
483- null ,
484- dataSchema ,
485- mock (SeekableStreamIndexTaskTuningConfig .class ),
486- new TestSeekableStreamIndexTaskIOConfig (),
487- context ,
488- groupId
489- );
490- }
491-
492335 public TestStreamingTask (
493336 String id ,
494337 @ Nullable String supervisorId ,
@@ -514,7 +357,7 @@ public TestStreamingTask(
514357 );
515358 }
516359
517- public TestStreamingTask (
360+ private TestStreamingTask (
518361 String id ,
519362 @ Nullable String supervisorId ,
520363 @ Nullable TaskResource taskResource ,
@@ -525,6 +368,7 @@ public TestStreamingTask(
525368 @ Nullable String groupId
526369 )
527370 {
371+
528372 super (id , supervisorId , taskResource , dataSchema , tuningConfig , ioConfig , context , groupId );
529373 }
530374
0 commit comments