You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by uc...@apache.org on 2016/04/27 14:45:22 UTC

flink git commit: [streaming-contrib] Fix port clash in DbStateBackend tests

Repository: flink
Updated Branches:
  refs/heads/release-1.0 d8feb15df -> c2f480d9a


[streaming-contrib] Fix port clash in DbStateBackend tests


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

Branch: refs/heads/release-1.0
Commit: c2f480d9a80c3c116a7fdd01e505da5b0f11998c
Parents: d8feb15
Author: Ufuk Celebi <uc...@apache.org>
Authored: Wed Apr 27 14:36:21 2016 +0200
Committer: Ufuk Celebi <uc...@apache.org>
Committed: Wed Apr 27 14:36:21 2016 +0200

----------------------------------------------------------------------
 .../state/DBStateCheckpointingTest.java         | 21 +++++++++++++-------
 .../streaming/state/DbStateBackendTest.java     |  9 +++++----
 2 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/c2f480d9/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
index cc2147f..060b8aa 100644
--- a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
+++ b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DBStateCheckpointingTest.java
@@ -19,6 +19,7 @@
 package org.apache.flink.contrib.streaming.state;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.IOException;
@@ -60,15 +61,21 @@ public class DBStateCheckpointingTest extends StreamFaultToleranceTestBase {
 	final static int NUM_KEYS = 100;
 	private static NetworkServerControl server;
 	private static File tempDir;
+	private static final int DERBY_PORT = 1550;
 
 	@Before
 	public void startDerbyServer() throws UnknownHostException, Exception {
-		server = new NetworkServerControl(InetAddress.getByName("localhost"), 1526, "flink", "flink");
-		server.start(null);
-		tempDir = new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString());
-		// We need to ensure that the Derby server starts properly before
-		// beginning the tests
-		DbStateBackendTest.ensureServerStarted(server);
+		try {
+			server = new NetworkServerControl(InetAddress.getByName("localhost"),  DERBY_PORT, "flink", "flink");
+			server.start(null);
+			tempDir = new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString());
+			// We need to ensure that the Derby server starts properly before
+			// beginning the tests
+			DbStateBackendTest.ensureServerStarted(server);
+		} catch (Throwable t) {
+			t.printStackTrace();
+			fail("FAILED");
+		}
 	}
 
 	@After
@@ -86,7 +93,7 @@ public class DBStateCheckpointingTest extends StreamFaultToleranceTestBase {
 		env.enableCheckpointing(500);
 
 		DbBackendConfig conf = new DbBackendConfig("flink", "flink",
-				"jdbc:derby://localhost:1526/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true");
+				"jdbc:derby://localhost:" + DERBY_PORT + "/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true");
 		conf.setDbAdapter(new DerbyAdapter());
 		conf.setKvStateCompactionFrequency(2);
 

http://git-wip-us.apache.org/repos/asf/flink/blob/c2f480d9/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
----------------------------------------------------------------------
diff --git a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
index adef7db..435b4e3 100644
--- a/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
+++ b/flink-contrib/flink-streaming-contrib/src/test/java/org/apache/flink/contrib/streaming/state/DbStateBackendTest.java
@@ -71,10 +71,11 @@ public class DbStateBackendTest {
 	private static DbBackendConfig conf;
 	private static String url1;
 	private static String url2;
+	private static final int DERBY_PORT = 1550;
 
 	@BeforeClass
 	public static void startDerbyServer() throws UnknownHostException, Exception {
-		server = new NetworkServerControl(InetAddress.getByName("localhost"), 1527, "flink", "flink");
+		server = new NetworkServerControl(InetAddress.getByName("localhost"), DERBY_PORT, "flink", "flink");
 
 		// Async call, we need to ensure that the server starts before leaving
 		// the method
@@ -82,12 +83,12 @@ public class DbStateBackendTest {
 
 		tempDir = new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString());
 		conf = new DbBackendConfig("flink", "flink",
-				"jdbc:derby://localhost:1527/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true");
+				"jdbc:derby://localhost:" + DERBY_PORT + "/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true");
 		conf.setDbAdapter(new DerbyAdapter());
 		conf.setKvStateCompactionFrequency(1);
 
-		url1 = "jdbc:derby://localhost:1527/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true";
-		url2 = "jdbc:derby://localhost:1527/" + tempDir.getAbsolutePath() + "/flinkDB2;create=true";
+		url1 = "jdbc:derby://localhost:" + DERBY_PORT + "/" + tempDir.getAbsolutePath() + "/flinkDB1;create=true";
+		url2 = "jdbc:derby://localhost:" + DERBY_PORT + "/" + tempDir.getAbsolutePath() + "/flinkDB2;create=true";
 
 		// We need to ensure that the Derby server starts properly before
 		// beginning the tests