abdullah alamoudi has submitted this change and it was merged.

Change subject: [NO ISSUE][CLUS] Allow Extension of cc application context
......................................................................


[NO ISSUE][CLUS] Allow Extension of cc application context

- user model changes: no
- storage format changes: no
- interface changes: yes
  + ICcApplicationContext.setExtensionManager
  + ICcApplicationContext.getExtensionProperties

details:
- This change allows better extension of cc application context.
  While this was possible before this change, the cc can end up
  with multiple app context which can lead to bad situations.

Change-Id: I924716b037bf94b68dd9ffa2ec0043c75f4e81a6
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2192
Sonar-Qube: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Contrib: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Till Westmann <[email protected]>
---
D 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IAlgebraExtensionManager.java
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CCExtensionManager.java
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/ICcApplicationContext.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/CcApplicationContext.java
M 
hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
9 files changed, 85 insertions(+), 84 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; No violations found; ; Verified



diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IAlgebraExtensionManager.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IAlgebraExtensionManager.java
deleted file mode 100644
index d9641df..0000000
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IAlgebraExtensionManager.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.algebra.extension;
-
-public interface IAlgebraExtensionManager {
-
-}
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
index 165c104..6826b26 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/ClusterApiServlet.java
@@ -28,7 +28,6 @@
 import java.util.logging.Logger;
 
 import org.apache.asterix.common.dataflow.ICcApplicationContext;
-import org.apache.asterix.runtime.utils.CcApplicationContext;
 import org.apache.hyracks.api.config.IOption;
 import org.apache.hyracks.api.config.Section;
 import org.apache.hyracks.control.common.config.ConfigUtils;
@@ -97,7 +96,7 @@
 
     protected ObjectNode getClusterStateJSON(IServletRequest request, String 
pathToNode) {
         ObjectNode json = 
appCtx.getClusterStateManager().getClusterStateDescription();
-        CcApplicationContext appConfig = (CcApplicationContext) 
ctx.get(ASTERIX_APP_CONTEXT_INFO_ATTR);
+        ICcApplicationContext appConfig = (ICcApplicationContext) 
ctx.get(ASTERIX_APP_CONTEXT_INFO_ATTR);
         json.putPOJO("config", 
ConfigUtils.getSectionOptionsForJSON(appConfig.getServiceContext().getAppConfig(),
                 Section.COMMON, getConfigSelector()));
 
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CCExtensionManager.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CCExtensionManager.java
index 768416d..1ba418a 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CCExtensionManager.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CCExtensionManager.java
@@ -25,7 +25,6 @@
 
 import org.apache.asterix.algebra.base.ILangExtension;
 import org.apache.asterix.algebra.base.ILangExtension.Language;
-import org.apache.asterix.algebra.extension.IAlgebraExtensionManager;
 import org.apache.asterix.app.translator.DefaultStatementExecutorFactory;
 import org.apache.asterix.common.api.ExtensionId;
 import org.apache.asterix.common.api.IExtension;
@@ -48,7 +47,7 @@
  * AsterixDB's implementation of {@code IAlgebraExtensionManager} and {@code 
IFunctionExtensionManager}
  * which takes care of initializing extensions for App and Compilation purposes
  */
-public class CCExtensionManager implements IAlgebraExtensionManager, 
IFunctionExtensionManager {
+public class CCExtensionManager implements IFunctionExtensionManager {
 
     private final IStatementExecutorExtension statementExecutorExtension;
     private final ILangCompilationProvider aqlCompilationProvider;
@@ -110,18 +109,21 @@
 
     public IStatementExecutorFactory 
getStatementExecutorFactory(ExecutorService executorService) {
         if (statementExecutorFactory == null) {
-            statementExecutorFactory = statementExecutorExtension == null
-                    ? new DefaultStatementExecutorFactory(executorService)
-                    : 
statementExecutorExtension.getStatementExecutorFactory(executorService);
+            statementExecutorFactory =
+                    statementExecutorExtension == null ? new 
DefaultStatementExecutorFactory(executorService)
+                            : 
statementExecutorExtension.getStatementExecutorFactory(executorService);
         }
         return statementExecutorFactory;
     }
 
     public ILangCompilationProvider getCompilationProvider(Language lang) {
         switch (lang) {
-            case AQL: return aqlCompilationProvider;
-            case SQLPP: return sqlppCompilationProvider;
-            default: throw new IllegalArgumentException(String.valueOf(lang));
+            case AQL:
+                return aqlCompilationProvider;
+            case SQLPP:
+                return sqlppCompilationProvider;
+            default:
+                throw new IllegalArgumentException(String.valueOf(lang));
         }
     }
 
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
index 96cfe91..4e75bf7 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java
@@ -25,6 +25,7 @@
 import static 
org.apache.asterix.api.http.server.ServletConstants.HYRACKS_CONNECTION_ATTR;
 import static 
org.apache.asterix.common.api.IClusterManagementWork.ClusterState.SHUTTING_DOWN;
 
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.ConcurrentMap;
@@ -80,6 +81,7 @@
 import org.apache.asterix.runtime.utils.CcApplicationContext;
 import org.apache.asterix.translator.IStatementExecutorContext;
 import org.apache.asterix.translator.IStatementExecutorFactory;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.application.ICCServiceContext;
 import org.apache.hyracks.api.application.IServiceContext;
 import org.apache.hyracks.api.client.HyracksConnection;
@@ -103,7 +105,7 @@
     protected IStorageComponentProvider componentProvider;
     protected StatementExecutorContext statementExecutorCtx;
     protected WebManager webManager;
-    protected CcApplicationContext appCtx;
+    protected ICcApplicationContext appCtx;
     private IJobCapacityController jobCapacityController;
     private IHyracksClientConnection hcc;
 
@@ -119,8 +121,8 @@
         if (args.length > 0) {
             throw new IllegalArgumentException("Unrecognized argument(s): " + 
Arrays.toString(args));
         }
-        final ClusterControllerService controllerService = 
(ClusterControllerService) ccServiceCtx
-                .getControllerService();
+        final ClusterControllerService controllerService =
+                (ClusterControllerService) ccServiceCtx.getControllerService();
         ccServiceCtx.setMessageBroker(new CCMessageBroker(controllerService));
 
         
configureLoggingLevel(ccServiceCtx.getAppConfig().getLoggingLevel(ExternalProperties.Option.LOG_LEVEL));
@@ -141,9 +143,7 @@
         componentProvider = new StorageComponentProvider();
         GlobalRecoveryManager globalRecoveryManager = 
createGlobalRecoveryManager();
         statementExecutorCtx = new StatementExecutorContext();
-        appCtx = new CcApplicationContext(ccServiceCtx, getHcc(), 
libraryManager, () -> MetadataManager.INSTANCE,
-                globalRecoveryManager, ftStrategy, new 
ActiveNotificationHandler(), componentProvider,
-                new MetadataLockManager());
+        appCtx = createApplicationContext(libraryManager, 
globalRecoveryManager, ftStrategy);
         ccExtensionManager = new CCExtensionManager(getExtensions());
         appCtx.setExtensionManager(ccExtensionManager);
         final CCConfig ccConfig = controllerService.getCCConfig();
@@ -165,6 +165,14 @@
         ccServiceCtx.addClusterLifecycleListener(new 
ClusterLifecycleListener(appCtx));
 
         jobCapacityController = new 
JobCapacityController(controllerService.getResourceManager());
+    }
+
+    protected ICcApplicationContext createApplicationContext(ILibraryManager 
libraryManager,
+            GlobalRecoveryManager globalRecoveryManager, 
IFaultToleranceStrategy ftStrategy)
+            throws AlgebricksException, IOException {
+        return new CcApplicationContext(ccServiceCtx, getHcc(), 
libraryManager, () -> MetadataManager.INSTANCE,
+                globalRecoveryManager, ftStrategy, new 
ActiveNotificationHandler(), componentProvider,
+                new MetadataLockManager());
     }
 
     protected GlobalRecoveryManager createGlobalRecoveryManager() throws 
Exception {
@@ -194,9 +202,7 @@
             LOGGER.info("Stopping Asterix cluster controller");
         }
         appCtx.getClusterStateManager().setState(SHUTTING_DOWN);
-        if (appCtx != null) {
-            ((ActiveNotificationHandler) 
appCtx.getActiveNotificationHandler()).stop();
-        }
+        ((ActiveNotificationHandler) 
appCtx.getActiveNotificationHandler()).stop();
         AsterixStateProxy.unregisterRemoteObject();
         webManager.stop();
     }
@@ -212,8 +218,8 @@
     }
 
     protected HttpServer setupJSONAPIServer(ExternalProperties 
externalProperties) throws Exception {
-        HttpServer jsonAPIServer = new HttpServer(webManager.getBosses(), 
webManager.getWorkers(),
-                externalProperties.getAPIServerPort());
+        HttpServer jsonAPIServer =
+                new HttpServer(webManager.getBosses(), 
webManager.getWorkers(), externalProperties.getAPIServerPort());
         jsonAPIServer.setAttribute(HYRACKS_CONNECTION_ATTR, hcc);
         jsonAPIServer.setAttribute(ASTERIX_APP_CONTEXT_INFO_ATTR, appCtx);
         jsonAPIServer.setAttribute(ServletConstants.EXECUTOR_SERVICE_ATTR,
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
index 50fe65e..8f479eb 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
@@ -34,7 +34,7 @@
 import org.apache.asterix.common.api.IClusterManagementWorkResponse.Status;
 import org.apache.asterix.common.cluster.IClusterStateManager;
 import org.apache.asterix.common.config.ClusterProperties;
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.dataflow.ICcApplicationContext;
 import org.apache.asterix.event.schema.cluster.Node;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.cluster.AddNodeWork;
@@ -42,7 +42,6 @@
 import org.apache.asterix.metadata.cluster.ClusterManagerProvider;
 import org.apache.asterix.metadata.cluster.RemoveNodeWork;
 import org.apache.asterix.metadata.cluster.RemoveNodeWorkResponse;
-import org.apache.asterix.runtime.utils.CcApplicationContext;
 import org.apache.hyracks.api.application.IClusterLifecycleListener;
 import org.apache.hyracks.api.config.IOption;
 import org.apache.hyracks.api.exceptions.HyracksException;
@@ -50,12 +49,12 @@
 public class ClusterLifecycleListener implements IClusterLifecycleListener {
 
     private static final Logger LOGGER = 
Logger.getLogger(ClusterLifecycleListener.class.getName());
-    private final CcApplicationContext appCtx;
+    private final ICcApplicationContext appCtx;
     private final LinkedBlockingQueue<Set<IClusterManagementWork>> 
workRequestQueue = new LinkedBlockingQueue<>();
     private final ClusterWorkExecutor eventHandler;
     private final List<IClusterManagementWorkResponse> pendingWorkResponses = 
new ArrayList<>();
 
-    public ClusterLifecycleListener(CcApplicationContext appCtx) {
+    public ClusterLifecycleListener(ICcApplicationContext appCtx) {
         this.appCtx = appCtx;
         eventHandler = new ClusterWorkExecutor(appCtx, workRequestQueue);
         Thread t = new Thread(eventHandler);
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index 0d66256..b518f94 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -107,13 +107,13 @@
     // see
     // 
https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers/417184
     private static final long MAX_URL_LENGTH = 2000l;
-    private static final Pattern JAVA_BLOCK_COMMENT_PATTERN = 
Pattern.compile("/\\*.*\\*/",
-            Pattern.MULTILINE | Pattern.DOTALL);
-    private static final Pattern JAVA_SHELL_SQL_LINE_COMMENT_PATTERN = 
Pattern.compile("^(//|#|--).*$",
-            Pattern.MULTILINE);
+    private static final Pattern JAVA_BLOCK_COMMENT_PATTERN =
+            Pattern.compile("/\\*.*\\*/", Pattern.MULTILINE | Pattern.DOTALL);
+    private static final Pattern JAVA_SHELL_SQL_LINE_COMMENT_PATTERN =
+            Pattern.compile("^(//|#|--).*$", Pattern.MULTILINE);
     private static final Pattern REGEX_LINES_PATTERN = 
Pattern.compile("^(-)?/(.*)/([im]*)$");
-    private static final Pattern POLL_TIMEOUT_PATTERN = 
Pattern.compile("polltimeoutsecs=(\\d+)(\\D|$)",
-            Pattern.MULTILINE);
+    private static final Pattern POLL_TIMEOUT_PATTERN =
+            Pattern.compile("polltimeoutsecs=(\\d+)(\\D|$)", 
Pattern.MULTILINE);
     private static final Pattern POLL_DELAY_PATTERN = 
Pattern.compile("polldelaysecs=(\\d+)(\\D|$)", Pattern.MULTILINE);
     private static final Pattern HANDLE_VARIABLE_PATTERN = 
Pattern.compile("handlevariable=(\\w+)");
     private static final Pattern VARIABLE_REF_PATTERN = 
Pattern.compile("\\$(\\w+)");
@@ -175,10 +175,10 @@
     public void runScriptAndCompareWithResult(File scriptFile, PrintWriter 
print, File expectedFile, File actualFile,
             ComparisonEnum compare) throws Exception {
         System.err.println("Expected results file: " + 
expectedFile.toString());
-        BufferedReader readerExpected = new BufferedReader(
-                new InputStreamReader(new FileInputStream(expectedFile), 
"UTF-8"));
-        BufferedReader readerActual = new BufferedReader(
-                new InputStreamReader(new FileInputStream(actualFile), 
"UTF-8"));
+        BufferedReader readerExpected =
+                new BufferedReader(new InputStreamReader(new 
FileInputStream(expectedFile), "UTF-8"));
+        BufferedReader readerActual =
+                new BufferedReader(new InputStreamReader(new 
FileInputStream(actualFile), "UTF-8"));
         boolean regex = false;
         try {
             if (ComparisonEnum.BINARY.equals(compare)) {
@@ -361,10 +361,10 @@
     public void runScriptAndCompareWithResultRegex(File scriptFile, File 
expectedFile, File actualFile)
             throws Exception {
         String lineExpected, lineActual;
-        try (BufferedReader readerExpected = new BufferedReader(
-                new InputStreamReader(new FileInputStream(expectedFile), 
"UTF-8"));
-                BufferedReader readerActual = new BufferedReader(
-                        new InputStreamReader(new FileInputStream(actualFile), 
"UTF-8"))) {
+        try (BufferedReader readerExpected =
+                new BufferedReader(new InputStreamReader(new 
FileInputStream(expectedFile), "UTF-8"));
+                BufferedReader readerActual =
+                        new BufferedReader(new InputStreamReader(new 
FileInputStream(actualFile), "UTF-8"))) {
             StringBuilder actual = new StringBuilder();
             while ((lineActual = readerActual.readLine()) != null) {
                 actual.append(lineActual).append('\n');
@@ -704,8 +704,8 @@
     // Insert and Delete statements are executed here
     public void executeUpdate(String str, URI uri) throws Exception {
         // Create a method instance.
-        HttpUriRequest request = RequestBuilder.post(uri).setEntity(new 
StringEntity(str, StandardCharsets.UTF_8))
-                .build();
+        HttpUriRequest request =
+                RequestBuilder.post(uri).setEntity(new StringEntity(str, 
StandardCharsets.UTF_8)).build();
 
         // Execute the method.
         executeAndCheckHttpRequest(request);
@@ -715,10 +715,10 @@
     public InputStream executeAnyAQLAsync(String statement, boolean defer, 
OutputFormat fmt, URI uri,
             Map<String, Object> variableCtx) throws Exception {
         // Create a method instance.
-        HttpUriRequest request = RequestBuilder.post(uri)
-                .addParameter("mode", defer ? "asynchronous-deferred" : 
"asynchronous")
-                .setEntity(new StringEntity(statement, 
StandardCharsets.UTF_8)).setHeader("Accept", fmt.mimeType())
-                .build();
+        HttpUriRequest request =
+                RequestBuilder.post(uri).addParameter("mode", defer ? 
"asynchronous-deferred" : "asynchronous")
+                        .setEntity(new StringEntity(statement, 
StandardCharsets.UTF_8))
+                        .setHeader("Accept", fmt.mimeType()).build();
 
         String handleVar = getHandleVariable(statement);
 
@@ -744,8 +744,8 @@
     // create function statement
     public void executeDDL(String str, URI uri) throws Exception {
         // Create a method instance.
-        HttpUriRequest request = RequestBuilder.post(uri).setEntity(new 
StringEntity(str, StandardCharsets.UTF_8))
-                .build();
+        HttpUriRequest request =
+                RequestBuilder.post(uri).setEntity(new StringEntity(str, 
StandardCharsets.UTF_8)).build();
 
         // Execute the method.
         executeAndCheckHttpRequest(request);
@@ -755,8 +755,8 @@
     // and returns the contents as a string
     // This string is later passed to REST API for execution.
     public String readTestFile(File testFile) throws Exception {
-        BufferedReader reader = new BufferedReader(
-                new InputStreamReader(new FileInputStream(testFile), 
StandardCharsets.UTF_8));
+        BufferedReader reader =
+                new BufferedReader(new InputStreamReader(new 
FileInputStream(testFile), StandardCharsets.UTF_8));
         String line;
         StringBuilder stringBuilder = new StringBuilder();
         String ls = System.getProperty("line.separator");
@@ -811,8 +811,8 @@
 
     private static String getProcessOutput(Process p) throws Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        Future<Integer> future = Executors.newSingleThreadExecutor()
-                .submit(() -> IOUtils.copy(p.getInputStream(), new 
OutputStream() {
+        Future<Integer> future =
+                Executors.newSingleThreadExecutor().submit(() -> 
IOUtils.copy(p.getInputStream(), new OutputStream() {
                     @Override
                     public void write(int b) throws IOException {
                         baos.write(b);
@@ -1002,7 +1002,7 @@
                         ctx.extension(), cUnit.getOutputDir().getCompare());
                 break;
             case "server": // (start <test server name> <port>
-                               // [<arg1>][<arg2>][<arg3>]...|stop 
(<port>|all))
+                           // [<arg1>][<arg2>][<arg3>]...|stop (<port>|all))
                 try {
                     lines = statement.trim().split("\n");
                     String[] command = lines[lines.length - 1].trim().split(" 
");
@@ -1050,7 +1050,7 @@
                 }
                 break;
             case "lib": // expected format <dataverse-name> <library-name>
-                            // <library-directory>
+                        // <library-directory>
                         // TODO: make this case work well with entity names 
containing spaces by
                         // looking for \"
                 lines = statement.split("\n");
@@ -1206,9 +1206,8 @@
             final URI uri = getEndpoint(Servlets.QUERY_SERVICE);
             if (DELIVERY_IMMEDIATE.equals(delivery)) {
                 resultStream = executeQueryService(statement, fmt, uri, 
params, true, null, true);
-                resultStream = METRICS_QUERY_TYPE.equals(reqType) ?
-                        ResultExtractor.extractMetrics(resultStream) :
-                        ResultExtractor.extract(resultStream);
+                resultStream = METRICS_QUERY_TYPE.equals(reqType) ? 
ResultExtractor.extractMetrics(resultStream)
+                        : ResultExtractor.extract(resultStream);
             } else {
                 String handleVar = getHandleVariable(statement);
                 resultStream = executeQueryService(statement, fmt, uri, 
upsertParam(params, "mode", delivery), true);
@@ -1462,7 +1461,7 @@
                         if (failedGroup != null) {
                             
failedGroup.getTestCase().add(testCaseCtx.getTestCase());
                         }
-                        throw new Exception("Test \"" + testFile + "\" 
FAILED!", e);
+                        fail(testCaseCtx, pb, testFile, e);
                     }
                 } finally {
                     if (numOfFiles == testFileCtxs.size()) {
@@ -1481,6 +1480,10 @@
         }
     }
 
+    protected void fail(TestCaseContext testCaseCtx, ProcessBuilder pb, File 
testFile, Exception e) throws Exception {
+        throw new Exception("Test \"" + testFile + "\" FAILED!", e);
+    }
+
     protected boolean isUnExpected(Exception e, List<String> expectedErrors, 
int numOfErrors, MutableInt queryCount) {
         String expectedError = null;
         if (expectedErrors.size() < numOfErrors) {
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/ICcApplicationContext.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/ICcApplicationContext.java
index 690d1fd..3f4d6a6 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/ICcApplicationContext.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/ICcApplicationContext.java
@@ -22,6 +22,7 @@
 import org.apache.asterix.common.api.IMetadataLockManager;
 import org.apache.asterix.common.cluster.IClusterStateManager;
 import org.apache.asterix.common.cluster.IGlobalRecoveryManager;
+import org.apache.asterix.common.config.ExtensionProperties;
 import org.apache.asterix.common.context.IStorageComponentProvider;
 import org.apache.asterix.common.metadata.IMetadataBootstrap;
 import org.apache.asterix.common.replication.IFaultToleranceStrategy;
@@ -102,4 +103,16 @@
      * @return the cluster state manager
      */
     IClusterStateManager getClusterStateManager();
+
+    /**
+     * Set the extension manager
+     *
+     * @param extensionManager
+     */
+    void setExtensionManager(Object extensionManager);
+
+    /**
+     * @return the extension properties
+     */
+    ExtensionProperties getExtensionProperties();
 }
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/CcApplicationContext.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/CcApplicationContext.java
index 0bd8b9e..63d3d6f 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/CcApplicationContext.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/CcApplicationContext.java
@@ -38,7 +38,6 @@
 import org.apache.asterix.common.config.TransactionProperties;
 import org.apache.asterix.common.context.IStorageComponentProvider;
 import org.apache.asterix.common.dataflow.ICcApplicationContext;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.library.ILibraryManager;
 import org.apache.asterix.common.metadata.IMetadataBootstrap;
 import org.apache.asterix.common.replication.IFaultToleranceStrategy;
@@ -198,10 +197,12 @@
         return extensionManager;
     }
 
+    @Override
     public void setExtensionManager(Object extensionManager) {
         this.extensionManager = extensionManager;
     }
 
+    @Override
     public ExtensionProperties getExtensionProperties() {
         return extensionProperties;
     }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
 
b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
index b51d670..9067586 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
@@ -280,7 +280,7 @@
         }
     }
 
-    protected HttpResponse executeHttpRequest(HttpUriRequest method) throws 
Exception {
+    public static HttpResponse executeHttpRequest(HttpUriRequest method) 
throws Exception {
         HttpClient client = 
HttpClients.custom().setRetryHandler(StandardHttpRequestRetryHandler.INSTANCE).build();
         try {
             return client.execute(method);
@@ -290,8 +290,9 @@
         }
     }
 
-    protected HttpUriRequest get(String query) throws URISyntaxException {
-        URI uri = new URI(PROTOCOL, null, HOST, PORT, PATH, query, null);
+    public static HttpUriRequest get(String protocol, String host, int port, 
String path, String query)
+            throws URISyntaxException {
+        URI uri = new URI(protocol, null, host, port, path, query, null);
         RequestBuilder builder = RequestBuilder.get(uri);
         builder.setCharset(StandardCharsets.UTF_8);
         return builder.build();

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2192
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I924716b037bf94b68dd9ffa2ec0043c75f4e81a6
Gerrit-PatchSet: 8
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>
Gerrit-Reviewer: abdullah alamoudi <[email protected]>

Reply via email to