Give names to parameterized JUnit tests

Change-Id: Ifb53be6df9ad0efb1032b03ad8622c1bb7b7afbe
Reviewed-on: https://asterix-gerrit.ics.uci.edu/568
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java b/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
index 6c6e411..4089646 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
@@ -67,7 +67,7 @@
         }
     }
 
-    @Parameters
+    @Parameters(name = "MetadataTest {index}: {0}")
     public static Collection<Object[]> tests() throws Exception {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         TestCaseContext.Builder b = new TestCaseContext.Builder();
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java b/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java
index 9eee818..538e7ca 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java
@@ -111,7 +111,7 @@
         }
     }
 
-    @Parameters
+    @Parameters(name = "OptimizerTest {index}: {0}")
     public static Collection<Object[]> tests() {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         suiteBuild(new File(PATH_QUERIES), testArgs, "");
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
index 922486f..199ae39 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
@@ -66,7 +66,7 @@
         ExecutionTestUtil.tearDown();
     }
 
-    @Parameters
+    @Parameters(name = "ExecutionTest {index}: {0}")
     public static Collection<Object[]> tests() throws Exception {
         Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.ONLY_TESTSUITE_XML_NAME);
         if (testArgs.size() == 0) {
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
index edb05d4..377dd69 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
@@ -86,7 +86,7 @@
     private int count;
     private final TestExecutor testExecutor = new TestExecutor();
 
-    @Parameters
+    @Parameters(name = "RepeatedTest {index}: {0}")
     public static Collection<Object[]> tests() throws Exception {
         Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.DEFAULT_REPEADED_TESTSUITE_XML_NAME);
         return testArgs;
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
index 22a3ad7..cbb14c5 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
@@ -68,7 +68,7 @@
         AsterixHyracksIntegrationUtil.removeTestStorageFiles();
     }
 
-    @Parameters
+    @Parameters(name = "SqlppExecutionTest {index}: {0}")
     public static Collection<Object[]> tests() throws Exception {
         Collection<Object[]> testArgs = buildTestsInXml("only_sqlpp.xml");
         if (testArgs.size() == 0) {
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java
index 61c6064..485d658 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java
@@ -81,7 +81,7 @@
         }
     }
 
-    @Parameters
+    @Parameters(name = "OptimizerParserTest {index}: {0}")
     public static Collection<Object[]> tests() {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         suiteBuild(new File(PATH_QUERIES), testArgs, "");
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java
index aca1e13..d9d03f9 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java
@@ -62,7 +62,7 @@
         }
     }
 
-    @Parameters
+    @Parameters(name = "RuntimeParserTest {index}: {0}")
     public static Collection<Object[]> tests() throws Exception {
         Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.ONLY_TESTSUITE_XML_NAME);
         if (testArgs.size() == 0) {
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java
index a924d7c..04213a8 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java
@@ -81,7 +81,7 @@
         }
     }
 
-    @Parameters
+    @Parameters(name = "SmokeParserTest {index}: {0}")
     public static Collection<Object[]> tests() {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         suiteBuild(new File(PATH_QUERIES), testArgs, "");
diff --git a/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java b/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
index 9f847f8..e192806 100644
--- a/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
+++ b/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
@@ -175,6 +175,18 @@
                 cUnit.getOutputDir().getValue() + "." + OutputFormat.forCompilationUnit(cUnit).extension());
     }
 
+    @Override
+    public String toString() {
+        final TestCase testCase = getTestCase();
+        StringBuilder sb = new StringBuilder(testCase.getFilePath());
+        sb.append(':');
+        for (CompilationUnit cu : testCase.getCompilationUnit()) {
+            sb.append(' ');
+            sb.append(cu.getName());
+        }
+        return sb.toString();
+    }
+
     public static class Builder {
         private final boolean m_doSlow;
         private final Pattern m_re;