[FLINK-8961][tests] Add MiniClusterResource#getClientConfiguration

Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/b1f3ca3f
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/b1f3ca3f
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/b1f3ca3f

Branch: refs/heads/master
Commit: b1f3ca3f61fa1f0a906804e42844c2c08bd3f5cc
Parents: 8eb4604
Author: zentol <ches...@apache.org>
Authored: Thu Apr 5 11:00:45 2018 +0200
Committer: zentol <ches...@apache.org>
Committed: Mon Apr 16 21:17:53 2018 +0200

----------------------------------------------------------------------
 .../apache/flink/test/util/MiniClusterResource.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/b1f3ca3f/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
----------------------------------------------------------------------
diff --git 
a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
 
b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
index 8a05750..531a3c7 100644
--- 
a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
+++ 
b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
@@ -25,8 +25,10 @@ import 
org.apache.flink.client.program.StandaloneClusterClient;
 import org.apache.flink.configuration.ConfigConstants;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.CoreOptions;
+import org.apache.flink.configuration.JobManagerOptions;
 import org.apache.flink.configuration.RestOptions;
 import org.apache.flink.configuration.TaskManagerOptions;
+import org.apache.flink.configuration.UnmodifiableConfiguration;
 import org.apache.flink.runtime.akka.AkkaUtils;
 import org.apache.flink.runtime.minicluster.JobExecutorService;
 import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
@@ -67,6 +69,8 @@ public class MiniClusterResource extends ExternalResource {
 
        private ClusterClient<?> clusterClient;
 
+       private Configuration restClusterClientConfig;
+
        private int numberSlots = -1;
 
        private TestEnvironment executionEnvironment;
@@ -117,6 +121,10 @@ public class MiniClusterResource extends ExternalResource {
                return clusterClient;
        }
 
+       public Configuration getClientConfiguration() {
+               return restClusterClientConfig;
+       }
+
        public TestEnvironment getTestEnvironment() {
                return executionEnvironment;
        }
@@ -194,6 +202,9 @@ public class MiniClusterResource extends ExternalResource {
                if (enableClusterClient) {
                        clusterClient = new 
StandaloneClusterClient(configuration, 
flinkMiniCluster.highAvailabilityServices(), true);
                }
+               Configuration restClientConfig = new Configuration();
+               restClientConfig.setInteger(JobManagerOptions.PORT, 
flinkMiniCluster.getLeaderRPCPort());
+               this.restClusterClientConfig = new 
UnmodifiableConfiguration(restClientConfig);
        }
 
        private void startMiniCluster() throws Exception {
@@ -229,6 +240,10 @@ public class MiniClusterResource extends ExternalResource {
                if (enableClusterClient) {
                        clusterClient = new MiniClusterClient(configuration, 
miniCluster);
                }
+               Configuration restClientConfig = new Configuration();
+               restClientConfig.setString(JobManagerOptions.ADDRESS, 
miniCluster.getRestAddress().getHost());
+               restClientConfig.setInteger(RestOptions.REST_PORT, 
miniCluster.getRestAddress().getPort());
+               this.restClusterClientConfig = new 
UnmodifiableConfiguration(restClientConfig);
        }
 
        /**

Reply via email to