zhijiangW commented on a change in pull request #8416: [FLINK-12331] Introduce 
partition/gate setup to decouple task registration with NetworkEnvironment
URL: https://github.com/apache/flink/pull/8416#discussion_r285021351
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/InputChannelTestUtils.java
 ##########
 @@ -133,31 +103,64 @@ public static LocalInputChannel createLocalInputChannel(
                int initialBackoff,
                int maxBackoff) {
 
-               return new LocalInputChannel(
-                       inputGate,
-                       0,
-                       new ResultPartitionID(),
-                       partitionManager,
-                       new TaskEventDispatcher(),
-                       initialBackoff,
-                       maxBackoff,
-                       newUnregisteredInputChannelMetrics());
+               return InputChannelBuilder.newBuilder()
+                       .setPartitionManager(partitionManager)
+                       .setInitialBackoff(initialBackoff)
+                       .setMaxBackoff(maxBackoff)
+                       .buildLocal(inputGate);
        }
 
        public static RemoteInputChannel createRemoteInputChannel(
                SingleInputGate inputGate,
                int channelIndex,
                ConnectionManager connectionManager) {
 
-               return new RemoteInputChannel(
-                       inputGate,
-                       channelIndex,
-                       new ResultPartitionID(),
-                       STUB_CONNECTION_ID,
-                       connectionManager,
-                       0,
-                       0,
-                       newUnregisteredInputChannelMetrics());
+               return InputChannelBuilder.newBuilder()
+                       .setChannelIndex(channelIndex)
+                       .setConnectionManager(connectionManager)
+                       .buildRemote(inputGate);
+       }
+
+       public static RemoteInputChannel createRemoteInputChannel(
+               SingleInputGate inputGate,
+               PartitionRequestClient client,
+               MemorySegmentProvider memorySegmentProvider) {
+
+               return InputChannelBuilder.newBuilder()
+                       
.setConnectionManager(mockConnectionManagerWithPartitionRequestClient(client))
+                       .setMemorySegmentProvider(memorySegmentProvider)
+                       .buildRemote(inputGate);
+       }
+
+       public static ConnectionManager 
mockConnectionManagerWithPartitionRequestClient(PartitionRequestClient client) {
 
 Review comment:
   Maybe it is better to construct the real `PartitionRequestClient` and return 
in `createPartitionRequestClient`, not pass it here because most of the usages 
are stilling mocking the `ConnectionID` and `PartitionRequestClientFactory` 
while constructing `PartitionRequestClient`.

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


With regards,
Apache Git Services

Reply via email to