[ https://issues.apache.org/jira/browse/FLINK-8027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16270313#comment-16270313 ]
ASF GitHub Bot commented on FLINK-8027: --------------------------------------- Github user shuai-xu commented on a diff in the pull request: https://github.com/apache/flink/pull/4985#discussion_r153708910 --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TestingTaskExecutorGateway.java --- @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.taskexecutor; + +import org.apache.flink.api.common.JobID; +import org.apache.flink.api.common.time.Time; +import org.apache.flink.runtime.checkpoint.CheckpointOptions; +import org.apache.flink.runtime.clusterframework.types.AllocationID; +import org.apache.flink.runtime.clusterframework.types.ResourceID; +import org.apache.flink.runtime.clusterframework.types.SlotID; +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptor; +import org.apache.flink.runtime.executiongraph.ExecutionAttemptID; +import org.apache.flink.runtime.executiongraph.PartitionInfo; +import org.apache.flink.runtime.jobmaster.JobMasterId; +import org.apache.flink.runtime.messages.Acknowledge; +import org.apache.flink.runtime.resourcemanager.ResourceManagerId; +import org.apache.flink.util.Preconditions; + +import java.util.concurrent.CompletableFuture; + +/** + * Simple {@link TaskExecutorGateway} implementation for testing purposes. + */ +public class TestingTaskExecutorGateway implements TaskExecutorGateway { + + private final String address; + + private final String hostname; + + public TestingTaskExecutorGateway() { + this("foobar:1234", "foobar"); + } + + public TestingTaskExecutorGateway(String address, String hostname) { + this.address = Preconditions.checkNotNull(address); + this.hostname = Preconditions.checkNotNull(hostname); + } + + @Override + public CompletableFuture<Acknowledge> requestSlot(SlotID slotId, JobID jobId, AllocationID allocationId, String targetAddress, ResourceManagerId resourceManagerId, Time timeout) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public CompletableFuture<Acknowledge> submitTask(TaskDeploymentDescriptor tdd, JobMasterId jobMasterId, Time timeout) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public CompletableFuture<Acknowledge> updatePartitions(ExecutionAttemptID executionAttemptID, Iterable<PartitionInfo> partitionInfos, Time timeout) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public void failPartition(ExecutionAttemptID executionAttemptID) { + // noop + } + + @Override + public CompletableFuture<Acknowledge> triggerCheckpoint(ExecutionAttemptID executionAttemptID, long checkpointID, long checkpointTimestamp, CheckpointOptions checkpointOptions) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public CompletableFuture<Acknowledge> confirmCheckpoint(ExecutionAttemptID executionAttemptID, long checkpointId, long checkpointTimestamp) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public CompletableFuture<Acknowledge> stopTask(ExecutionAttemptID executionAttemptID, Time timeout) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public CompletableFuture<Acknowledge> cancelTask(ExecutionAttemptID executionAttemptID, Time timeout) { + return CompletableFuture.completedFuture(Acknowledge.get()); + } + + @Override + public void heartbeatFromJobManager(ResourceID heartbeatOrigin) { + // noop + } + + @Override + public void heartbeatFromResourceManager(ResourceID heartbeatOrigin) { + // noop + } + + @Override + public void disconnectJobManager(JobID jobId, Exception cause) { + // nooop --- End diff -- typo > Generalize existing rest handlers to work with arbitrary RestfulGateway > ----------------------------------------------------------------------- > > Key: FLINK-8027 > URL: https://issues.apache.org/jira/browse/FLINK-8027 > Project: Flink > Issue Type: Sub-task > Components: REST > Affects Versions: 1.5.0 > Reporter: Till Rohrmann > Assignee: Till Rohrmann > Labels: flip-6 > Fix For: 1.5.0 > > > In order to reuse the existing {{AbstractRestHandler}} we should refactor > them such that they work with arbitrary {{RestfulGateway}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)