You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/08/01 07:54:22 UTC

[flink] 02/02: [FLINK-9988][rest] Add RestOptionTest for deprecated BIND_ADDRESS keys

This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit b3df1f963d25e7b7b6109d643090c2dff624ab2f
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Tue Jul 31 14:58:20 2018 +0200

    [FLINK-9988][rest] Add RestOptionTest for deprecated BIND_ADDRESS keys
    
    This closes #6441.
---
 .../apache/flink/configuration/RestOptions.java    |  2 +-
 .../flink/configuration/RestOptionsTest.java       | 55 ++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java
index 5ac5a55..3c24158 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java
@@ -34,7 +34,7 @@ public class RestOptions {
 	public static final ConfigOption<String> BIND_ADDRESS =
 		key("rest.bind-address")
 			.noDefaultValue()
-			.withDeprecatedKeys(WebOptions.ADDRESS.key(), "jobmanager.web.address")
+			.withDeprecatedKeys(WebOptions.ADDRESS.key(), ConfigConstants.DEFAULT_JOB_MANAGER_WEB_FRONTEND_ADDRESS.key())
 			.withDescription("The address that the server binds itself.");
 
 	/**
diff --git a/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java b/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java
new file mode 100644
index 0000000..9c9e6b9
--- /dev/null
+++ b/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.configuration;
+
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests for the {@link RestOptions}.
+ */
+public class RestOptionsTest extends TestLogger {
+
+	@Test
+	public void testBindAddressFirstDeprecatedKey() {
+		final Configuration configuration = new Configuration();
+		final String expectedAddress = "foobar";
+		configuration.setString("web.address", expectedAddress);
+
+		final String actualAddress = configuration.getString(RestOptions.BIND_ADDRESS);
+
+		assertThat(actualAddress, is(equalTo(expectedAddress)));
+	}
+
+	@Test
+	public void testBindAddressSecondDeprecatedKey() {
+		final Configuration configuration = new Configuration();
+		final String expectedAddress = "foobar";
+		configuration.setString("jobmanager.web.address", expectedAddress);
+
+		final String actualAddress = configuration.getString(RestOptions.BIND_ADDRESS);
+
+		assertThat(actualAddress, is(equalTo(expectedAddress)));
+	}
+}