zhuzhurk commented on a change in pull request #12917: URL: https://github.com/apache/flink/pull/12917#discussion_r465528629
########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolUtils.java ########## @@ -45,19 +50,108 @@ */ public class SlotPoolUtils { + public static final Time TIMEOUT = Time.seconds(10L); + private SlotPoolUtils() { throw new UnsupportedOperationException("Cannot instantiate this class."); } + public static SlotPoolBuilder createSlotPoolBuilder() { + return createSlotPoolBuilder(ComponentMainThreadExecutorServiceAdapter.forMainThread()); + } + + public static SlotPoolBuilder createSlotPoolBuilder(final ComponentMainThreadExecutor mainThreadExecutor) { + return new SlotPoolBuilder(mainThreadExecutor); + } + + public static SlotPoolBuilder createSlotPoolBuilder(final ResourceManagerGateway resourceManagerGateway) { + return createSlotPoolBuilder().setResourceManagerGateway(resourceManagerGateway); + } + + public static SlotPoolBuilder createSlotPoolBuilder( + final ComponentMainThreadExecutor mainThreadExecutor, + final ResourceManagerGateway resourceManagerGateway) { + + return createSlotPoolBuilder(mainThreadExecutor).setResourceManagerGateway(resourceManagerGateway); + } + + public static TestingSlotPoolImpl createAndSetUpSlotPool( + final ResourceManagerGateway resourceManagerGateway) throws Exception { + + return createSlotPoolBuilder(resourceManagerGateway).build(); + } + + public static TestingSlotPoolImpl createAndSetUpSlotPool( + final ResourceManagerGateway resourceManagerGateway, + final JobID jobId) throws Exception { + + return createSlotPoolBuilder(resourceManagerGateway).setJobId(jobId).build(); + } + + public static TestingSlotPoolImpl createAndSetUpSlotPool( Review comment: This method is used only in `SlotPoolImplTest`. I'd prefer to put it there at the moment. ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolUtils.java ########## @@ -45,19 +50,108 @@ */ public class SlotPoolUtils { + public static final Time TIMEOUT = Time.seconds(10L); + private SlotPoolUtils() { throw new UnsupportedOperationException("Cannot instantiate this class."); } + public static SlotPoolBuilder createSlotPoolBuilder() { + return createSlotPoolBuilder(ComponentMainThreadExecutorServiceAdapter.forMainThread()); + } + + public static SlotPoolBuilder createSlotPoolBuilder(final ComponentMainThreadExecutor mainThreadExecutor) { + return new SlotPoolBuilder(mainThreadExecutor); + } + + public static SlotPoolBuilder createSlotPoolBuilder(final ResourceManagerGateway resourceManagerGateway) { + return createSlotPoolBuilder().setResourceManagerGateway(resourceManagerGateway); + } + + public static SlotPoolBuilder createSlotPoolBuilder( + final ComponentMainThreadExecutor mainThreadExecutor, + final ResourceManagerGateway resourceManagerGateway) { + + return createSlotPoolBuilder(mainThreadExecutor).setResourceManagerGateway(resourceManagerGateway); + } + + public static TestingSlotPoolImpl createAndSetUpSlotPool( + final ResourceManagerGateway resourceManagerGateway) throws Exception { + + return createSlotPoolBuilder(resourceManagerGateway).build(); + } + + public static TestingSlotPoolImpl createAndSetUpSlotPool( Review comment: This method is used only in `SlotPoolImplTest`. I'd prefer to put it there at the moment. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org