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 2015/03/16 18:15:57 UTC

flink git commit: [gelly-tests] Fixes DegreesWithExceptionITCase to check expected exceptions

Repository: flink
Updated Branches:
  refs/heads/master 5c8b0ba79 -> 36b762e43


[gelly-tests] Fixes DegreesWithExceptionITCase to check expected exceptions


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

Branch: refs/heads/master
Commit: 36b762e433e666bedfa06e06638b36dff8ec2d7a
Parents: 5c8b0ba
Author: Till Rohrmann <tr...@apache.org>
Authored: Mon Mar 16 18:15:14 2015 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Mon Mar 16 18:15:14 2015 +0100

----------------------------------------------------------------------
 .../operations/DegreesWithExceptionITCase.java  | 28 +++++++++++++++-----
 1 file changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/36b762e4/flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
----------------------------------------------------------------------
diff --git a/flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java b/flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
index 4ed1292..e83802c 100644
--- a/flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
+++ b/flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
@@ -21,16 +21,20 @@ package org.apache.flink.graph.test.operations;
 import org.apache.flink.api.java.ExecutionEnvironment;
 import org.apache.flink.api.java.io.DiscardingOutputFormat;
 import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.client.program.ProgramInvocationException;
 import org.apache.flink.configuration.ConfigConstants;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.graph.Graph;
 import org.apache.flink.graph.test.TestGraphUtils;
+import org.apache.flink.runtime.client.JobExecutionException;
 import org.apache.flink.test.util.ForkableFlinkMiniCluster;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.junit.Assert.fail;
+import java.util.NoSuchElementException;
+
+import static org.junit.Assert.*;
 
 @SuppressWarnings("serial")
 public class DegreesWithExceptionITCase {
@@ -48,7 +52,7 @@ public class DegreesWithExceptionITCase {
 	public static void setupCluster() {
 		Configuration config = new Configuration();
 		config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, PARALLELISM);
-		cluster = new ForkableFlinkMiniCluster(config, true);
+		cluster = new ForkableFlinkMiniCluster(config, false);
 	}
 
 	@AfterClass
@@ -83,7 +87,9 @@ public class DegreesWithExceptionITCase {
 
 			fail("graph.outDegrees() did not throw NoSuchElementException");
 		} catch (Exception e) {
-			// expected
+			assertTrue("Root exception has to be of type ProgramInvocationException.", e instanceof ProgramInvocationException);
+			assertTrue("ProgramInvocationException's cause has to be of type JobExecutionException.", e.getCause() instanceof JobExecutionException);
+			assertTrue("JobExecutionException's cause has to be of type NoSuchElementException.", e.getCause().getCause() instanceof NoSuchElementException);
 		}
 	}
 
@@ -106,7 +112,9 @@ public class DegreesWithExceptionITCase {
 
 			fail("graph.inDegrees() did not throw NoSuchElementException");
 		} catch (Exception e) {
-			// expected
+			assertTrue("Root exception has to be of type ProgramInvocationException.", e instanceof ProgramInvocationException);
+			assertTrue("ProgramInvocationException's cause has to be of type JobExecutionException.", e.getCause() instanceof JobExecutionException);
+			assertTrue("JobExecutionException's cause has to be of type NoSuchElementException.", e.getCause().getCause() instanceof NoSuchElementException);
 		}
 	}
 
@@ -129,7 +137,9 @@ public class DegreesWithExceptionITCase {
 
 			fail("graph.getDegrees() did not throw NoSuchElementException");
 		} catch (Exception e) {
-			// expected
+			assertTrue("Root exception has to be of type ProgramInvocationException.", e instanceof ProgramInvocationException);
+			assertTrue("ProgramInvocationException's cause has to be of type JobExecutionException.", e.getCause() instanceof JobExecutionException);
+			assertTrue("JobExecutionException's cause has to be of type NoSuchElementException.", e.getCause().getCause() instanceof NoSuchElementException);
 		}
 	}
 
@@ -152,7 +162,9 @@ public class DegreesWithExceptionITCase {
 
 			fail("graph.getDegrees() did not throw NoSuchElementException");
 		} catch (Exception e) {
-			// expected
+			assertTrue("Root exception has to be of type ProgramInvocationException.", e instanceof ProgramInvocationException);
+			assertTrue("ProgramInvocationException's cause has to be of type JobExecutionException.", e.getCause() instanceof JobExecutionException);
+			assertTrue("JobExecutionException's cause has to be of type NoSuchElementException.", e.getCause().getCause() instanceof NoSuchElementException);
 		}
 	}
 
@@ -175,7 +187,9 @@ public class DegreesWithExceptionITCase {
 
 			fail("graph.getDegrees() did not throw NoSuchElementException");
 		} catch (Exception e) {
-			// expected
+			assertTrue("Root exception has to be of type ProgramInvocationException.", e instanceof ProgramInvocationException);
+			assertTrue("ProgramInvocationException's cause has to be of type JobExecutionException.", e.getCause() instanceof JobExecutionException);
+			assertTrue("JobExecutionException's cause has to be of type NoSuchElementException.", e.getCause().getCause() instanceof NoSuchElementException);
 		}
 	}
 }