This is an automated email from the ASF dual-hosted git repository. guoyangze pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit ebdde651edae8db6b2ac740f07d97124dc01fea4 Author: Yangze Guo <karma...@gmail.com> AuthorDate: Mon Jul 4 13:20:05 2022 +0800 [hotfix][rest] Rename ClusterConfigurationInfo to ConfigurationInfo --- .../shortcodes/generated/rest_v1_dispatcher.html | 2 +- docs/static/generated/rest_v1_dispatcher.yml | 18 +++++++++--------- .../src/test/resources/rest_api_v1.snapshot | 2 +- .../rest/handler/cluster/ClusterConfigHandler.java | 15 ++++++--------- .../rest/messages/ClusterConfigurationInfoHeaders.java | 7 +++---- ...erConfigurationInfo.java => ConfigurationInfo.java} | 15 ++++++--------- ...ationInfoEntry.java => ConfigurationInfoEntry.java} | 8 ++++---- ...urationInfoTest.java => ConfigurationInfoTest.java} | 17 ++++++++--------- .../flink/yarn/YARNSessionCapacitySchedulerITCase.java | 11 +++++------ 9 files changed, 43 insertions(+), 52 deletions(-) diff --git a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html index eb862ac83bf..3683cbca3d6 100644 --- a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html +++ b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html @@ -857,7 +857,7 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "type" : "array", "items" : { "type" : "object", - "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:ClusterConfigurationInfoEntry", + "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:ConfigurationInfoEntry", "properties" : { "key" : { "type" : "string" diff --git a/docs/static/generated/rest_v1_dispatcher.yml b/docs/static/generated/rest_v1_dispatcher.yml index 2836526421e..d8c0cb3b8e8 100644 --- a/docs/static/generated/rest_v1_dispatcher.yml +++ b/docs/static/generated/rest_v1_dispatcher.yml @@ -272,7 +272,7 @@ paths: empty: type: boolean items: - $ref: '#/components/schemas/ClusterConfigurationInfoEntry' + $ref: '#/components/schemas/ConfigurationInfoEntry' /jobmanager/logs: get: description: Returns the list of log files on the JobManager. @@ -2137,19 +2137,19 @@ components: type: array items: $ref: '#/components/schemas/UserAccumulator' + ConfigurationInfo: + type: array + properties: + empty: + type: boolean + items: + $ref: '#/components/schemas/ConfigurationInfoEntry' Type: type: string enum: - FULL - ON_CPU - OFF_CPU - ClusterConfigurationInfo: - type: array - properties: - empty: - type: boolean - items: - $ref: '#/components/schemas/ClusterConfigurationInfoEntry' UserAccumulator: type: object properties: @@ -2372,7 +2372,7 @@ components: $ref: '#/components/schemas/JobID' status: $ref: '#/components/schemas/JobStatus' - ClusterConfigurationInfoEntry: + ConfigurationInfoEntry: type: object properties: key: diff --git a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot index 144f4e774eb..c390c7f600b 100644 --- a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot +++ b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot @@ -472,7 +472,7 @@ "type" : "array", "items" : { "type" : "object", - "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:ClusterConfigurationInfoEntry", + "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:ConfigurationInfoEntry", "properties" : { "key" : { "type" : "string" diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/ClusterConfigHandler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/ClusterConfigHandler.java index 26d0aa67f1a..f5776588733 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/ClusterConfigHandler.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/ClusterConfigHandler.java @@ -23,7 +23,7 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.runtime.rest.handler.AbstractRestHandler; import org.apache.flink.runtime.rest.handler.HandlerRequest; import org.apache.flink.runtime.rest.handler.RestHandlerException; -import org.apache.flink.runtime.rest.messages.ClusterConfigurationInfo; +import org.apache.flink.runtime.rest.messages.ConfigurationInfo; import org.apache.flink.runtime.rest.messages.EmptyMessageParameters; import org.apache.flink.runtime.rest.messages.EmptyRequestBody; import org.apache.flink.runtime.rest.messages.MessageHeaders; @@ -39,28 +39,25 @@ import java.util.concurrent.CompletableFuture; /** Handler which serves the cluster's configuration. */ public class ClusterConfigHandler extends AbstractRestHandler< - RestfulGateway, - EmptyRequestBody, - ClusterConfigurationInfo, - EmptyMessageParameters> { + RestfulGateway, EmptyRequestBody, ConfigurationInfo, EmptyMessageParameters> { - private final ClusterConfigurationInfo clusterConfig; + private final ConfigurationInfo clusterConfig; public ClusterConfigHandler( GatewayRetriever<? extends RestfulGateway> leaderRetriever, Time timeout, Map<String, String> responseHeaders, - MessageHeaders<EmptyRequestBody, ClusterConfigurationInfo, EmptyMessageParameters> + MessageHeaders<EmptyRequestBody, ConfigurationInfo, EmptyMessageParameters> messageHeaders, Configuration configuration) { super(leaderRetriever, timeout, responseHeaders, messageHeaders); Preconditions.checkNotNull(configuration); - this.clusterConfig = ClusterConfigurationInfo.from(configuration); + this.clusterConfig = ConfigurationInfo.from(configuration); } @Override - protected CompletableFuture<ClusterConfigurationInfo> handleRequest( + protected CompletableFuture<ConfigurationInfo> handleRequest( @Nonnull HandlerRequest<EmptyRequestBody> request, @Nonnull RestfulGateway gateway) throws RestHandlerException { return CompletableFuture.completedFuture(clusterConfig); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoHeaders.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoHeaders.java index 328376d8c08..1d9e80a5de6 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoHeaders.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoHeaders.java @@ -25,8 +25,7 @@ import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseSt /** Message headers for the {@link ClusterConfigHandler}. */ public final class ClusterConfigurationInfoHeaders - implements MessageHeaders< - EmptyRequestBody, ClusterConfigurationInfo, EmptyMessageParameters> { + implements MessageHeaders<EmptyRequestBody, ConfigurationInfo, EmptyMessageParameters> { private static final ClusterConfigurationInfoHeaders INSTANCE = new ClusterConfigurationInfoHeaders(); @@ -54,8 +53,8 @@ public final class ClusterConfigurationInfoHeaders } @Override - public Class<ClusterConfigurationInfo> getResponseClass() { - return ClusterConfigurationInfo.class; + public Class<ConfigurationInfo> getResponseClass() { + return ConfigurationInfo.class; } @Override diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfo.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ConfigurationInfo.java similarity index 76% rename from flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfo.java rename to flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ConfigurationInfo.java index 5ca1a7c9891..bcb90b95abe 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfo.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ConfigurationInfo.java @@ -29,29 +29,26 @@ import java.util.Map; * Response of the {@link ClusterConfigHandler}, represented as a list of key-value pairs of the * cluster {@link Configuration}. */ -public class ClusterConfigurationInfo extends ArrayList<ClusterConfigurationInfoEntry> - implements ResponseBody { +public class ConfigurationInfo extends ArrayList<ConfigurationInfoEntry> implements ResponseBody { private static final long serialVersionUID = -1170348873871206964L; // a default constructor is required for collection type marshalling - public ClusterConfigurationInfo() {} + public ConfigurationInfo() {} - public ClusterConfigurationInfo(int initialEntries) { + public ConfigurationInfo(int initialEntries) { super(initialEntries); } - public static ClusterConfigurationInfo from(Configuration config) { - final ClusterConfigurationInfo clusterConfig = - new ClusterConfigurationInfo(config.keySet().size()); + public static ConfigurationInfo from(Configuration config) { + final ConfigurationInfo clusterConfig = new ConfigurationInfo(config.keySet().size()); final Map<String, String> configurationWithHiddenSensitiveValues = ConfigurationUtils.hideSensitiveValues(config.toMap()); for (Map.Entry<String, String> keyValuePair : configurationWithHiddenSensitiveValues.entrySet()) { clusterConfig.add( - new ClusterConfigurationInfoEntry( - keyValuePair.getKey(), keyValuePair.getValue())); + new ConfigurationInfoEntry(keyValuePair.getKey(), keyValuePair.getValue())); } return clusterConfig; diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoEntry.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ConfigurationInfoEntry.java similarity index 89% rename from flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoEntry.java rename to flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ConfigurationInfoEntry.java index 85d2f7efa37..23791fba80b 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoEntry.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/ConfigurationInfoEntry.java @@ -25,8 +25,8 @@ import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonPro import java.util.Objects; -/** A single key-value pair entry in the {@link ClusterConfigurationInfo} response. */ -public class ClusterConfigurationInfoEntry { +/** A single key-value pair entry in the {@link ConfigurationInfo} response. */ +public class ConfigurationInfoEntry { public static final String FIELD_NAME_CONFIG_KEY = "key"; public static final String FIELD_NAME_CONFIG_VALUE = "value"; @@ -38,7 +38,7 @@ public class ClusterConfigurationInfoEntry { private final String value; @JsonCreator - public ClusterConfigurationInfoEntry( + public ConfigurationInfoEntry( @JsonProperty(FIELD_NAME_CONFIG_KEY) String key, @JsonProperty(FIELD_NAME_CONFIG_VALUE) String value) { this.key = Preconditions.checkNotNull(key); @@ -63,7 +63,7 @@ public class ClusterConfigurationInfoEntry { return false; } - ClusterConfigurationInfoEntry that = (ClusterConfigurationInfoEntry) o; + ConfigurationInfoEntry that = (ConfigurationInfoEntry) o; return key.equals(that.key) && value.equals(that.value); } diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ConfigurationInfoTest.java similarity index 61% rename from flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoTest.java rename to flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ConfigurationInfoTest.java index 1b07ae51520..f10de95a61b 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ClusterConfigurationInfoTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ConfigurationInfoTest.java @@ -18,20 +18,19 @@ package org.apache.flink.runtime.rest.messages; -/** Tests for the {@link ClusterConfigurationInfo}. */ -public class ClusterConfigurationInfoTest - extends RestResponseMarshallingTestBase<ClusterConfigurationInfo> { +/** Tests for the {@link ConfigurationInfo}. */ +public class ConfigurationInfoTest extends RestResponseMarshallingTestBase<ConfigurationInfo> { @Override - protected Class<ClusterConfigurationInfo> getTestResponseClass() { - return ClusterConfigurationInfo.class; + protected Class<ConfigurationInfo> getTestResponseClass() { + return ConfigurationInfo.class; } @Override - protected ClusterConfigurationInfo getTestResponseInstance() { - final ClusterConfigurationInfo expected = new ClusterConfigurationInfo(2); - expected.add(new ClusterConfigurationInfoEntry("key1", "value1")); - expected.add(new ClusterConfigurationInfoEntry("key2", "value2")); + protected ConfigurationInfo getTestResponseInstance() { + final ConfigurationInfo expected = new ConfigurationInfo(2); + expected.add(new ConfigurationInfoEntry("key1", "value1")); + expected.add(new ConfigurationInfoEntry("key2", "value2")); return expected; } diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java index 125bb3b0d91..6a0409ad0d4 100644 --- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java +++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java @@ -25,10 +25,10 @@ import org.apache.flink.configuration.GlobalConfiguration; import org.apache.flink.configuration.JobManagerOptions; import org.apache.flink.runtime.rest.RestClient; import org.apache.flink.runtime.rest.handler.legacy.messages.ClusterOverviewWithVersion; -import org.apache.flink.runtime.rest.messages.ClusterConfigurationInfo; -import org.apache.flink.runtime.rest.messages.ClusterConfigurationInfoEntry; import org.apache.flink.runtime.rest.messages.ClusterConfigurationInfoHeaders; import org.apache.flink.runtime.rest.messages.ClusterOverviewHeaders; +import org.apache.flink.runtime.rest.messages.ConfigurationInfo; +import org.apache.flink.runtime.rest.messages.ConfigurationInfoEntry; import org.apache.flink.runtime.rest.messages.taskmanager.TaskManagerInfo; import org.apache.flink.runtime.rest.messages.taskmanager.TaskManagersHeaders; import org.apache.flink.runtime.rest.messages.taskmanager.TaskManagersInfo; @@ -425,16 +425,15 @@ class YARNSessionCapacitySchedulerITCase extends YarnTestBase { private static Map<String, String> getFlinkConfig(final String host, final int port) throws Exception { - final ClusterConfigurationInfo clusterConfigurationInfoEntries = + final ConfigurationInfo configurationInfoEntries = restClient .sendRequest(host, port, ClusterConfigurationInfoHeaders.getInstance()) .get(); - return clusterConfigurationInfoEntries.stream() + return configurationInfoEntries.stream() .collect( Collectors.toMap( - ClusterConfigurationInfoEntry::getKey, - ClusterConfigurationInfoEntry::getValue)); + ConfigurationInfoEntry::getKey, ConfigurationInfoEntry::getValue)); } /**