asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: Extension of TestExecutor, CCApplicationEntryPoint
Date Wed, 10 Aug 2016 21:57:57 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 7a6705818 -> 52f183f69


Extension of TestExecutor,CCApplicationEntryPoint

Change-Id: Ief977281ed58dfeea5f41feeefc5c75a22bd6f35
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1058
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


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

Branch: refs/heads/master
Commit: 52f183f699fd2d1c5ac37f806ab97f64a377ed1b
Parents: 7a67058
Author: Michael Blow <michael.blow@couchbase.com>
Authored: Tue Aug 9 19:40:50 2016 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Wed Aug 10 14:57:26 2016 -0700

----------------------------------------------------------------------
 .../bootstrap/CCApplicationEntryPoint.java      |  2 +-
 .../apache/asterix/test/aql/TestExecutor.java   | 51 +++++++++++---------
 2 files changed, 28 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52f183f6/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index 916c81f..b6ce217 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -210,7 +210,7 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint
{
         addServlet(context, createServlet(key), key.getPath());
     }
 
-    private Servlet createServlet(Servlets key) {
+    protected Servlet createServlet(Servlets key) {
         switch (key) {
             case AQL:
                 return new AQLAPIServlet(new AqlCompilationProvider());

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/52f183f6/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
index fb1c69a..6bfbd64 100644
--- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
+++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
@@ -76,20 +76,19 @@ public class TestExecutor {
     /*
      * Instance members
      */
-    private String host;
-    private int port;
-    private ITestLibrarian librarian;
-
-    public TestExecutor() {
-        host = "127.0.0.1";
-        port = 19002;
-    }
+    protected final String host;
+    protected final int port;
+    protected ITestLibrarian librarian;
 
     public TestExecutor(String host, int port) {
         this.host = host;
         this.port = port;
     }
 
+    public TestExecutor() {
+        this("127.0.0.1", 19002);
+    }
+
     public void setLibrarian(ITestLibrarian librarian) {
         this.librarian = librarian;
     }
@@ -382,7 +381,7 @@ public class TestExecutor {
     }
 
     private InputStream getHandleResult(String handle, OutputFormat fmt) throws Exception
{
-        final String url = "http://" + host + ":" + port + Servlets.QUERY_RESULT.getPath();
+        final String url = "http://" + host + ":" + port + getPath(Servlets.QUERY_RESULT);
 
         // Create a method instance.
         HttpUriRequest request = RequestBuilder.get(url)
@@ -506,9 +505,9 @@ public class TestExecutor {
         switch (ctx.getType()) {
             case "ddl":
                 if (ctx.getFile().getName().endsWith("aql")) {
-                    executeDDL(statement, "http://" + host + ":" + port + Servlets.AQL_DDL.getPath());
+                    executeDDL(statement, "http://" + host + ":" + port + getPath(Servlets.AQL_DDL));
                 } else {
-                    executeDDL(statement, "http://" + host + ":" + port + Servlets.SQLPP_DDL.getPath());
+                    executeDDL(statement, "http://" + host + ":" + port + getPath(Servlets.SQLPP_DDL));
                 }
                 break;
             case "update":
@@ -517,9 +516,9 @@ public class TestExecutor {
                     statement = statement.replaceAll("nc1://", "127.0.0.1://../../../../../../asterix-app/");
                 }
                 if (ctx.getFile().getName().endsWith("aql")) {
-                    executeUpdate(statement, "http://" + host + ":" + port + Servlets.AQL_UPDATE.getPath());
+                    executeUpdate(statement, "http://" + host + ":" + port + getPath(Servlets.AQL_UPDATE));
                 } else {
-                    executeUpdate(statement, "http://" + host + ":" + port + Servlets.SQLPP_UPDATE.getPath());
+                    executeUpdate(statement, "http://" + host + ":" + port + getPath(Servlets.SQLPP_UPDATE));
                 }
                 break;
             case "query":
@@ -537,25 +536,25 @@ public class TestExecutor {
                 if (ctx.getFile().getName().endsWith("aql")) {
                     if (ctx.getType().equalsIgnoreCase("query")) {
                         resultStream = executeQuery(statement, fmt,
-                                "http://" + host + ":" + port + Servlets.AQL_QUERY.getPath(),
cUnit.getParameter());
+                                "http://" + host + ":" + port + getPath(Servlets.AQL_QUERY),
cUnit.getParameter());
                     } else if (ctx.getType().equalsIgnoreCase("async")) {
                         resultStream = executeAnyAQLAsync(statement, false, fmt,
-                                "http://" + host + ":" + port + Servlets.AQL.getPath());
+                                "http://" + host + ":" + port + getPath(Servlets.AQL));
                     } else if (ctx.getType().equalsIgnoreCase("asyncdefer")) {
                         resultStream = executeAnyAQLAsync(statement, true, fmt,
-                                "http://" + host + ":" + port + Servlets.AQL.getPath());
+                                "http://" + host + ":" + port + getPath(Servlets.AQL));
                     }
                 } else {
                     if (ctx.getType().equalsIgnoreCase("query")) {
                         resultStream = executeQueryService(statement, fmt,
-                                "http://" + host + ":" + port + Servlets.QUERY_SERVICE.getPath(),
cUnit.getParameter());
+                                "http://" + host + ":" + port + getPath(Servlets.QUERY_SERVICE),
cUnit.getParameter());
                         resultStream = ResultExtractor.extract(resultStream);
                     } else if (ctx.getType().equalsIgnoreCase("async")) {
                         resultStream = executeAnyAQLAsync(statement, false, fmt,
-                                "http://" + host + ":" + port + Servlets.SQLPP.getPath());
+                                "http://" + host + ":" + port + getPath(Servlets.SQLPP));
                     } else if (ctx.getType().equalsIgnoreCase("asyncdefer")) {
                         resultStream = executeAnyAQLAsync(statement, true, fmt,
-                                "http://" + host + ":" + port + Servlets.SQLPP.getPath());
+                                "http://" + host + ":" + port + getPath(Servlets.SQLPP));
                     }
                 }
                 if (queryCount.intValue() >= expectedResultFileCtxs.size()) {
@@ -581,14 +580,14 @@ public class TestExecutor {
                 break;
             case "txnqbc": // qbc represents query before crash
                 resultStream = executeQuery(statement, OutputFormat.forCompilationUnit(cUnit),
-                        "http://" + host + ":" + port + Servlets.AQL_QUERY.getPath(), cUnit.getParameter());
+                        "http://" + host + ":" + port + getPath(Servlets.AQL_QUERY), cUnit.getParameter());
                 qbcFile = getTestCaseQueryBeforeCrashFile(actualPath, testCaseCtx, cUnit);
                 qbcFile.getParentFile().mkdirs();
                 writeOutputToFile(qbcFile, resultStream);
                 break;
             case "txnqar": // qar represents query after recovery
                 resultStream = executeQuery(statement, OutputFormat.forCompilationUnit(cUnit),
-                        "http://" + host + ":" + port + Servlets.AQL_QUERY.getPath(), cUnit.getParameter());
+                        "http://" + host + ":" + port + getPath(Servlets.AQL_QUERY), cUnit.getParameter());
                 File qarFile = new File(actualPath + File.separator
                         + testCaseCtx.getTestCase().getFilePath().replace(File.separator,
"_") + "_" + cUnit.getName()
                         + "_qar.adm");
@@ -599,7 +598,7 @@ public class TestExecutor {
                 break;
             case "txneu": // eu represents erroneous update
                 try {
-                    executeUpdate(statement, "http://" + host + ":" + port + Servlets.AQL_UPDATE.getPath());
+                    executeUpdate(statement, "http://" + host + ":" + port + getPath(Servlets.AQL_UPDATE));
                 } catch (Exception e) {
                     // An exception is expected.
                     failed = true;
@@ -627,7 +626,7 @@ public class TestExecutor {
                 break;
             case "errddl": // a ddlquery that expects error
                 try {
-                    executeDDL(statement, "http://" + host + ":" + port + Servlets.AQL_DDL.getPath());
+                    executeDDL(statement, "http://" + host + ":" + port + getPath(Servlets.AQL_DDL));
                 } catch (Exception e) {
                     // expected error happens
                     failed = true;
@@ -668,7 +667,7 @@ public class TestExecutor {
                 try {
                     fmt = OutputFormat.forCompilationUnit(cUnit);
                     resultStream = executeClusterStateQuery(fmt,
-                            "http://" + host + ":" + port + Servlets.CLUSTER_STATE.getPath());
+                            "http://" + host + ":" + port + getPath(Servlets.CLUSTER_STATE));
                     expectedResultFile = expectedResultFileCtxs.get(queryCount.intValue()).getFile();
                     actualResultFile = testCaseCtx.getActualResultFile(cUnit, expectedResultFile,
new File(actualPath));
                     actualResultFile.getParentFile().mkdirs();
@@ -831,4 +830,8 @@ public class TestExecutor {
                 actualPath + File.separator + testCaseCtx.getTestCase().getFilePath().replace(File.separator,
"_") + "_"
                         + cUnit.getName() + "_qbc.adm");
     }
+
+    protected String getPath(Servlets servlet) {
+        return servlet.getPath();
+    }
 }


Mime
View raw message