github-code-scanning[bot] commented on code in PR #14695:
URL: https://github.com/apache/druid/pull/14695#discussion_r1278256456


##########
processing/src/test/java/org/apache/druid/query/DruidProcessingConfigTest.java:
##########
@@ -46,47 +42,15 @@
   private static final long DIRECT_SIZE = BUFFER_SIZE * (3L + 2L + 1L);
   private static final long HEAP_SIZE = BUFFER_SIZE * 2L;
 
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private static Injector makeInjector(int numProcessors, long 
directMemorySize, long heapSize)
-  {
-    return makeInjector(numProcessors, directMemorySize, heapSize, new 
Properties(), null);
-  }
-
   @AfterClass
   public static void teardown()
   {
     JvmUtils.resetTestsToDefaultRuntimeInfo();
   }
 
-  private static Injector makeInjector(
-      int numProcessors,
-      long directMemorySize,
-      long heapSize,
-      Properties props,
-      Map<String, String> replacements
-  )
-  {
-    return Guice.createInjector(
-        binder -> {
-          binder.bind(RuntimeInfo.class).toInstance(new 
MockRuntimeInfo(numProcessors, directMemorySize, heapSize));
-          binder.requestStaticInjection(JvmUtils.class);
-          ConfigurationObjectFactory factory = Config.createFactory(props);
-          DruidProcessingConfig config;
-          if (replacements != null) {
-            config = factory.buildWithReplacements(
-                DruidProcessingConfig.class,
-                replacements
-            );
-          } else {
-            config = factory.build(DruidProcessingConfig.class);
-          }
-          binder.bind(ConfigurationObjectFactory.class).toInstance(factory);
-          binder.bind(DruidProcessingConfig.class).toInstance(config);
-        }
-    );
-  }
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [ExpectedException.none](1) should be avoided because it has been 
deprecated.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/5311)



##########
server/src/test/java/org/apache/druid/guice/BrokerProcessingModuleTest.java:
##########
@@ -107,43 +117,40 @@
     catch (UnsupportedOperationException e) {
       Assume.assumeNoException(e);
     }
+    Properties props = new Properties();
+    props.setProperty("druid.processing.buffer.sizeBytes", "3GiB");
+    Injector injector1 = makeInjector(props);
 
+    DruidProcessingConfig processingBufferConfig = 
injector1.getInstance(DruidProcessingConfig.class);
     BrokerProcessingModule module = new BrokerProcessingModule();
-    module.getMergeBufferPool(new DruidProcessingConfig()
-    {
-      @Override
-      public String getFormatString()
-      {
-        return "test";
-      }
-
-      @Override
-      public int intermediateComputeSizeBytes()
-      {
-        return Integer.MAX_VALUE;
-      }
-    });
+    module.getMergeBufferPool(processingBufferConfig);
   }
 
-  private Injector makeInjector(boolean withServerTypeConfig)
+  private Injector makeInjector(Properties props)
   {
-    return Initialization.makeInjectorWithModules(
-        GuiceInjectors.makeStartupInjector(), 
(ImmutableList.of(Modules.override(
-            (binder) -> {
-              
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("test");
-              
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0);
-              
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1);
-              
binder.bind(DruidProcessingConfig.class).toInstance(druidProcessingConfig);
-            },
-            target
-        ).with(
-            (binder) -> {
+
+    Injector injector = Initialization.makeInjectorWithModules(
+        GuiceInjectors.makeStartupInjector(),
+        ImmutableList.of(
+            Modules.override(
+                (binder) -> {
+                  
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("test");
+                  
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0);
+                  
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1);
+                  binder.bind(Properties.class).toInstance(props);
+                  ConfigurationObjectFactory factory = 
Config.createFactory(props);
+                  LegacyBrokerParallelMergeConfig legacyConfig = 
factory.build(LegacyBrokerParallelMergeConfig.class);
+                  
binder.bind(ConfigurationObjectFactory.class).toInstance(factory);
+                  
binder.bind(LegacyBrokerParallelMergeConfig.class).toInstance(legacyConfig);
+                },
+                target
+            ).with((binder) -> {
               
binder.bind(CachePopulatorStats.class).toInstance(cachePopulatorStats);
               binder.bind(CacheConfig.class).toInstance(cacheConfig);
-            }
+            })
         )
-        )));
+    );

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [Initialization.makeInjectorWithModules](1) should be avoided 
because it has been deprecated.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/5312)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to