justinmclean opened a new issue, #9305:
URL: https://github.com/apache/gravitino/issues/9305

   ### What would you like to be improved?
   
   In the generateEventListenerConfigs method, capacityPerSink has the 
possibility to be set to zero. Make sure it is at least one. Also, as we 
require an int, parseInt can be used here rather than valueOf.
   
   Here's a unit test to show the issue:
   ```
     @Test
     public void testGenerateEventListenerConfigsEnforcesMinimumQueueCapacity() 
{
       // Test case where integer division would result in 0 (2 / 3 = 0)
       List<String> sinks = Arrays.asList("sinkA", "sinkB", "sinkC");
       Map<String, String> lineageConfigs = new HashMap<>();
       lineageConfigs.put(LineageConfig.LINEAGE_SINK_QUEUE_CAPACITY, "2");
   
       Map<String, String> eventListenerConfigs =
           LineageSinkManager.transformToEventListenerConfigs(sinks, 
lineageConfigs);
   
       sinks.forEach(
           sink -> {
             String capacityKey =
                 sink + "." + 
EventListenerManager.GRAVITINO_EVENT_LISTENER_QUEUE_CAPACITY;
             String actualCapacity = eventListenerConfigs.get(capacityKey);
             assertThat(
                 String.format("Queue capacity for %s should be at least 1)", 
sink, actualCapacity),
                 actualCapacity,
                 equalTo("1"));
           });
     }
   ```
   
   ### How should we improve?
   
   See above.


-- 
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]

Reply via email to