flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [4/4] flink git commit: [FLINK-2448] [tests] Create new Test Environments on every call to getExecutionEnvironment and allow sharing of job execution results
Date Wed, 02 Sep 2015 13:54:40 GMT
[FLINK-2448] [tests] Create new Test Environments on every call to getExecutionEnvironment
and allow sharing of job execution results


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

Branch: refs/heads/master
Commit: 166b3705c9079efafe9217d98e7edaf54e6a84cf
Parents: 2e6e4de
Author: Sachin Goel <sachingoel0101@gmail.com>
Authored: Mon Aug 24 21:51:52 2015 +0530
Committer: Stephan Ewen <sewen@apache.org>
Committed: Wed Sep 2 14:12:55 2015 +0200

----------------------------------------------------------------------
 .../flink/test/util/CollectionTestEnvironment.java   | 15 ++++++++++++++-
 .../org/apache/flink/test/util/TestEnvironment.java  | 15 ++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/166b3705/flink-test-utils/src/main/java/org/apache/flink/test/util/CollectionTestEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-test-utils/src/main/java/org/apache/flink/test/util/CollectionTestEnvironment.java
b/flink-test-utils/src/main/java/org/apache/flink/test/util/CollectionTestEnvironment.java
index 7189bbe..e56c7e8 100644
--- a/flink-test-utils/src/main/java/org/apache/flink/test/util/CollectionTestEnvironment.java
+++ b/flink-test-utils/src/main/java/org/apache/flink/test/util/CollectionTestEnvironment.java
@@ -25,6 +25,18 @@ import org.apache.flink.api.java.ExecutionEnvironmentFactory;
 
 public class CollectionTestEnvironment extends CollectionEnvironment {
 
+	private CollectionTestEnvironment lastEnv = null;
+
+	@Override
+	public JobExecutionResult getLastJobExecutionResult() {
+		if (lastEnv == null) {
+			return this.lastJobExecutionResult;
+		}
+		else {
+			return lastEnv.getLastJobExecutionResult();
+		}
+	}
+
 	@Override
 	public JobExecutionResult execute() throws Exception {
 		return execute("test job");
@@ -41,7 +53,8 @@ public class CollectionTestEnvironment extends CollectionEnvironment {
 		ExecutionEnvironmentFactory factory = new ExecutionEnvironmentFactory() {
 			@Override
 			public ExecutionEnvironment createExecutionEnvironment() {
-				return CollectionTestEnvironment.this;
+				lastEnv = new CollectionTestEnvironment();
+				return lastEnv;
 			}
 		};
 

http://git-wip-us.apache.org/repos/asf/flink/blob/166b3705/flink-test-utils/src/main/java/org/apache/flink/test/util/TestEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-test-utils/src/main/java/org/apache/flink/test/util/TestEnvironment.java
b/flink-test-utils/src/main/java/org/apache/flink/test/util/TestEnvironment.java
index d0c8e3d..e8b7e86 100644
--- a/flink-test-utils/src/main/java/org/apache/flink/test/util/TestEnvironment.java
+++ b/flink-test-utils/src/main/java/org/apache/flink/test/util/TestEnvironment.java
@@ -35,6 +35,18 @@ public class TestEnvironment extends ExecutionEnvironment {
 
 	private final ForkableFlinkMiniCluster executor;
 
+	private TestEnvironment lastEnv = null;
+
+	@Override
+	public JobExecutionResult getLastJobExecutionResult() {
+		if (lastEnv == null) {
+			return this.lastJobExecutionResult;
+		}
+		else {
+			return lastEnv.getLastJobExecutionResult();
+		}
+	}
+
 	public TestEnvironment(ForkableFlinkMiniCluster executor, int parallelism) {
 		this.executor = executor;
 		setParallelism(parallelism);
@@ -82,7 +94,8 @@ public class TestEnvironment extends ExecutionEnvironment {
 		ExecutionEnvironmentFactory factory = new ExecutionEnvironmentFactory() {
 			@Override
 			public ExecutionEnvironment createExecutionEnvironment() {
-				return TestEnvironment.this;
+				lastEnv = new TestEnvironment(executor, getParallelism());
+				return lastEnv;
 			}
 		};
 


Mime
View raw message