This is an automated email from the ASF dual-hosted git repository.
chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new fe5b101e261 [hotfix] Move util to WebFrontedITCase
fe5b101e261 is described below
commit fe5b101e261685ee50160161f895417ceafc058f
Author: Chesnay Schepler <[email protected]>
AuthorDate: Thu Jul 28 16:01:16 2022 +0200
[hotfix] Move util to WebFrontedITCase
This util is a bit questionable, so we're moving it to reduce exposure.
---
.../runtime/webmonitor/WebFrontendITCase.java | 22 ++++++++++++++++++
.../flink/runtime/webmonitor/WebMonitorUtils.java | 26 ----------------------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git
a/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/WebFrontendITCase.java
b/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/WebFrontendITCase.java
index 43a14bfca44..18480d139fc 100644
---
a/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/WebFrontendITCase.java
+++
b/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/WebFrontendITCase.java
@@ -61,6 +61,8 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -273,6 +275,26 @@ class WebFrontendITCase {
assertThat(actual).isEqualTo(expected);
}
+ private static Map<String, String> fromKeyValueJsonArray(String
jsonString) {
+ try {
+ Map<String, String> map = new HashMap<>();
+ ObjectMapper m = new ObjectMapper();
+ ArrayNode array = (ArrayNode) m.readTree(jsonString);
+
+ Iterator<JsonNode> elements = array.elements();
+ while (elements.hasNext()) {
+ JsonNode node = elements.next();
+ String key = node.get("key").asText();
+ String value = node.get("value").asText();
+ map.put(key, value);
+ }
+
+ return map;
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
@Test
void testCancel(
@InjectClusterClient ClusterClient<?> clusterClient,
diff --git
a/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
index 068f32e7186..ca9739083bb 100644
---
a/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
+++
b/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
@@ -26,10 +26,6 @@ import
org.apache.flink.runtime.rest.handler.legacy.files.StaticFileServerHandle
import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever;
import org.apache.flink.util.FlinkException;
-import
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode;
-import
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
-import
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,8 +35,6 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@@ -200,26 +194,6 @@ public final class WebMonitorUtils {
}
}
- public static Map<String, String> fromKeyValueJsonArray(String jsonString)
{
- try {
- Map<String, String> map = new HashMap<>();
- ObjectMapper m = new ObjectMapper();
- ArrayNode array = (ArrayNode) m.readTree(jsonString);
-
- Iterator<JsonNode> elements = array.elements();
- while (elements.hasNext()) {
- JsonNode node = elements.next();
- String key = node.get("key").asText();
- String value = node.get("value").asText();
- map.put(key, value);
- }
-
- return map;
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
/** Private constructor to prevent instantiation. */
private WebMonitorUtils() {
throw new RuntimeException();