You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2015/06/19 04:34:54 UTC

tajo git commit: TAJO-1649: Change Rest API /databases/{database-name}/functions to /functions.

Repository: tajo
Updated Branches:
  refs/heads/master ec46798c1 -> b0df5e0df


TAJO-1649: Change Rest API /databases/{database-name}/functions to /functions.

Signed-off-by: Hyunsik Choi <hy...@apache.org>


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

Branch: refs/heads/master
Commit: b0df5e0df1be78cd93b60db014a51a6dc6fed02e
Parents: ec46798
Author: clark.kang <cl...@kakao.com>
Authored: Wed Jun 17 23:22:07 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Thu Jun 18 19:32:42 2015 -0700

----------------------------------------------------------------------
 CHANGES                                         |  3 ++
 .../tajo/ws/rs/resources/FunctionsResource.java | 41 ++++++--------------
 .../ws/rs/resources/TestFunctionsResource.java  | 18 ++++-----
 3 files changed, 24 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/b0df5e0d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0440302..f8440b9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -27,6 +27,9 @@ Release 0.11.0 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1649: Change Rest API /databases/{database-name}/functions to 
+    /functions. (Contributed by DaeMyung Kang, Committed by hyunsik)
+
     TAJO-1646: Add extlib directory for third-party libraries. (hyunsik)
 
     TAJO-1636: query rest api uri should change

http://git-wip-us.apache.org/repos/asf/tajo/blob/b0df5e0d/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/FunctionsResource.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/FunctionsResource.java b/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/FunctionsResource.java
index 9545b1a..ead4b71 100644
--- a/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/FunctionsResource.java
+++ b/tajo-core/src/main/java/org/apache/tajo/ws/rs/resources/FunctionsResource.java
@@ -18,33 +18,23 @@
 
 package org.apache.tajo.ws.rs.resources;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.catalog.FunctionDesc;
 import org.apache.tajo.function.FunctionSignature;
 import org.apache.tajo.master.TajoMaster.MasterContext;
-import org.apache.tajo.ws.rs.JerseyResourceDelegate;
-import org.apache.tajo.ws.rs.JerseyResourceDelegateContext;
-import org.apache.tajo.ws.rs.JerseyResourceDelegateContextKey;
-import org.apache.tajo.ws.rs.JerseyResourceDelegateUtil;
-import org.apache.tajo.ws.rs.ResourcesUtil;
+import org.apache.tajo.ws.rs.*;
 
-@Path("/databases/{databaseName}/functions")
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.*;
+import javax.ws.rs.core.Response.Status;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+@Path("/functions")
 public class FunctionsResource {
   
   private static final Log LOG = LogFactory.getLog(TablesResource.class);
@@ -54,10 +44,7 @@ public class FunctionsResource {
   
   @Context
   Application application;
-  
-  @PathParam("databaseName")
-  String databaseName;
-  
+
   JerseyResourceDelegateContext context;
   
   private static final String databaseNameKeyName = "databaseName";
@@ -79,10 +66,6 @@ public class FunctionsResource {
     Response response = null;
     try {
       initializeContext();
-      JerseyResourceDelegateContextKey<String> databaseNameKey =
-          JerseyResourceDelegateContextKey.valueOf(databaseNameKeyName, String.class);
-      context.put(databaseNameKey, databaseName);
-      
       response = JerseyResourceDelegateUtil.runJerseyResourceDelegate(
           new GetAllFunctionsDelegate(),
           application,

http://git-wip-us.apache.org/repos/asf/tajo/blob/b0df5e0d/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestFunctionsResource.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestFunctionsResource.java b/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestFunctionsResource.java
index 2794ded..7c7aeae 100644
--- a/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestFunctionsResource.java
+++ b/tajo-core/src/test/java/org/apache/tajo/ws/rs/resources/TestFunctionsResource.java
@@ -18,13 +18,6 @@
 
 package org.apache.tajo.ws.rs.resources;
 
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.core.GenericType;
-
 import org.apache.tajo.QueryTestCaseBase;
 import org.apache.tajo.TajoConstants;
 import org.apache.tajo.conf.TajoConf.ConfVars;
@@ -36,7 +29,14 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.GenericType;
+import java.net.URI;
+import java.util.List;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 public class TestFunctionsResource extends QueryTestCaseBase {
   
@@ -52,7 +52,7 @@ public class TestFunctionsResource extends QueryTestCaseBase {
   public void setUp() throws Exception {
     int restPort = testBase.getTestingCluster().getConfiguration().getIntVar(ConfVars.REST_SERVICE_PORT);
     restServiceURI = new URI("http", null, "127.0.0.1", restPort, "/rest", null, null);
-    functionsURI = new URI(restServiceURI + "/databases/" + TajoConstants.DEFAULT_DATABASE_NAME + "/functions");
+    functionsURI = new URI(restServiceURI + "/functions");
     restClient = ClientBuilder.newBuilder()
         .register(new GsonFeature(RestTestUtils.registerTypeAdapterMap()))
         .register(LoggingFilter.class)