More flexibility for the LangExecutionUtil

Change-Id: Id2632dce25519995798016b5be1ca650f8af9586
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1507
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java
index ea7e4d6..a20ecc5 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java
@@ -92,13 +92,19 @@
     }
 
     public static void test(TestCaseContext tcCtx) throws Exception {
+        test(testExecutor, tcCtx);
+    }
+
+    public static void test(TestExecutor testExecutor, TestCaseContext tcCtx) throws Exception {
         int repeat = LangExecutionUtil.repeat * tcCtx.getRepeat();
         try {
             for (int i = 1; i <= repeat; i++) {
                 if (repeat > 1) {
                     System.err.print("[" + i + "/" + repeat + "] ");
                 }
-                librarian.cleanup();
+                if (librarian != null) {
+                    librarian.cleanup();
+                }
                 testExecutor.executeTest(PATH_ACTUAL, tcCtx, null, false, ExecutionTestUtil.FailedGroup);
                 try {
                     testExecutor.cleanup(tcCtx.toString(), badTestCases);