[ARVADOS] updated: 9c444153e80d3a872e11ca5898491c747a881a4d

git at public.curoverse.com git at public.curoverse.com
Sat May 3 18:58:44 EDT 2014


Summary of changes:
 sdk/java/.classpath                                |    4 +-
 sdk/java/README                                    |    3 +
 .../main/java/org/arvados/sdk/java/Arvados.java    |   84 +-------------------
 .../java/org/arvados/sdk/java/ArvadosTest.java     |   19 +++++
 4 files changed, 27 insertions(+), 83 deletions(-)

       via  9c444153e80d3a872e11ca5898491c747a881a4d (commit)
      from  0f7fa46c1311ddd2aa6e7f0c280b98a6d69d4ec8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9c444153e80d3a872e11ca5898491c747a881a4d
Author: radhika <radhika at curoverse.com>
Date:   Sat May 3 18:49:58 2014 -0400

    2525: More tests

diff --git a/sdk/java/.classpath b/sdk/java/.classpath
index 5613077..27d14a1 100644
--- a/sdk/java/.classpath
+++ b/sdk/java/.classpath
@@ -3,8 +3,8 @@
 	<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="var" path="M2_REPO/com/google/apis/google-api-services-discovery/v1-rev42-1.18.0-rc/google-api-services-discovery-v1-rev42-1.18.0-rc.jar" sourcepath="/GOOGLE_SERVICE_DISCOVERY"/>
-	<classpathentry kind="var" path="M2_REPO/com/google/api-client/google-api-client/1.18.0-rc/google-api-client-1.18.0-rc.jar" sourcepath="/GOOGLE_API_CLIENT/google-api-client-1.18.0-rc-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/google/apis/google-api-services-discovery/v1-rev42-1.18.0-rc/google-api-services-discovery-v1-rev42-1.18.0-rc.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/google/api-client/google-api-client/1.18.0-rc/google-api-client-1.18.0-rc.jar"/>
 	<classpathentry kind="var" path="M2_REPO/com/google/http-client/google-http-client/1.18.0-rc/google-http-client-1.18.0-rc.jar"/>
 	<classpathentry kind="var" path="M2_REPO/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar"/>
 	<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar"/>
diff --git a/sdk/java/README b/sdk/java/README
index e6794ec..fb2bdd9 100644
--- a/sdk/java/README
+++ b/sdk/java/README
@@ -2,6 +2,9 @@
 
   - Using the Arvados Java SDK, you can access API server from a java program.
 
+  - Please refer to http://doc.arvados.org/api/index.html for a complete list
+    of supported resources and methods.
+
   - This document highlights the details as to how to use the SDK.
 
   - The Java SDK is used as a maven project. Hence, you would need a working
diff --git a/sdk/java/src/main/java/org/arvados/sdk/java/Arvados.java b/sdk/java/src/main/java/org/arvados/sdk/java/Arvados.java
index c2b8c18..6c0cf97 100644
--- a/sdk/java/src/main/java/org/arvados/sdk/java/Arvados.java
+++ b/sdk/java/src/main/java/org/arvados/sdk/java/Arvados.java
@@ -10,7 +10,6 @@ import com.google.api.client.http.HttpTransport;
 import com.google.api.client.http.UriTemplate;
 import com.google.api.client.json.JsonFactory;
 import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.client.util.Lists;
 import com.google.api.client.util.Maps;
 import com.google.api.services.discovery.Discovery;
 import com.google.api.services.discovery.model.JsonSchema;
@@ -21,7 +20,6 @@ import com.google.api.services.discovery.model.RestResource;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -109,35 +107,6 @@ public class Arvados {
    */
   public RestDescription discover() throws Exception {
     restDescription = loadArvadosApi();
-
-    // compute method details
-    ArrayList<MethodDetails> result = Lists.newArrayList();
-    String resourceName = "";
-    processResources(result, resourceName, restDescription.getResources());
-
-    // display method details
-    Collections.sort(result);
-    StringBuffer buffer = new StringBuffer();
-    for (MethodDetails methodDetail : result) {
-      buffer.append("\nArvados call " + apiName + " " + apiVersion + " " + methodDetail.name);
-      for (String param : methodDetail.requiredParameters) {
-        buffer.append(" <" + param + ">");
-      }
-      if (methodDetail.hasContent) {
-        buffer.append(" contentFile");
-      }
-      if (methodDetail.optionalParameters.isEmpty() && !methodDetail.hasContent) {
-        buffer.append("\n");
-      } else {
-        buffer.append("\n [optional parameters...]");
-        buffer.append("\n  --contentType <value> (default is \"application/json\")");
-        for (String param : methodDetail.optionalParameters) {
-          buffer.append("\n  --" + param + " <value>");
-        }
-      }
-    }
-    logger.debug(buffer.toString());
-
     return (restDescription);
   }
 
@@ -225,7 +194,7 @@ public class Arvados {
         if (restDescription.getParameters() != null) {
           parameter = restDescription.getParameters().get(parameterName);
         }
-        if (parameter == null && method.getParameters() == null) {
+        if (parameter == null && method.getParameters() != null) {
           parameter = method.getParameters().get(parameterName);
         }
         putParameter(parameterName, parameters, parameterName, parameter, parameterValue);
@@ -291,55 +260,6 @@ public class Arvados {
     }
   }
 
-  private void processMethods(
-      ArrayList<MethodDetails> result, String resourceName, Map<String, RestMethod> methodMap) {
-    if (methodMap == null) {
-      return;
-    }
-    for (Map.Entry<String, RestMethod> methodEntry : methodMap.entrySet()) {
-      MethodDetails details = new MethodDetails();
-      String methodName = methodEntry.getKey();
-      RestMethod method = methodEntry.getValue();
-      details.name = (resourceName.isEmpty() ? "" : resourceName + ".") + methodName;
-      details.hasContent =
-          !method.getHttpMethod().equals("GET") && !method.getHttpMethod().equals("DELETE");
-      // required parameters
-      if (method.getParameterOrder() != null) {
-        for (String parameterName : method.getParameterOrder()) {
-          JsonSchema parameter = method.getParameters().get(parameterName);
-          if (Boolean.TRUE.equals(parameter.getRequired())) {
-            details.requiredParameters.add(parameterName);
-          }
-        }
-      }
-      // optional parameters
-      Map<String, JsonSchema> parameters = method.getParameters();
-      if (parameters != null) {
-        for (Map.Entry<String, JsonSchema> parameterEntry : parameters.entrySet()) {
-          String parameterName = parameterEntry.getKey();
-          JsonSchema parameter = parameterEntry.getValue();
-          if (!Boolean.TRUE.equals(parameter.getRequired())) {
-            details.optionalParameters.add(parameterName);
-          }
-        }
-      }
-      result.add(details);
-    }
-  }
-
-  private void processResources(
-      ArrayList<MethodDetails> result, String resourceName, Map<String, RestResource> resourceMap) {
-    if (resourceMap == null) {
-      return;
-    }
-    for (Map.Entry<String, RestResource> entry : resourceMap.entrySet()) {
-      RestResource resource = entry.getValue();
-      String curResourceName = (resourceName.isEmpty() ? "" : resourceName + ".") + entry.getKey();
-      processMethods(result, curResourceName, resource.getMethods());
-      processResources(result, curResourceName, resource.getResources());
-    }
-  }
-
   private void putParameter(String argName, Map<String, Object> parameters,
       String parameterName, JsonSchema parameter, Object parameterValue) throws Exception {
     Object value = parameterValue;
@@ -350,6 +270,8 @@ public class Arvados {
         value = new BigDecimal(parameterValue.toString());
       } else if ("integer".equals(parameter.getType())) {
         value = new BigInteger(parameterValue.toString());
+      } else if ("array".equals(parameter.getType())) {
+        // TBD
       }
     }
     
diff --git a/sdk/java/src/test/java/org/arvados/sdk/java/ArvadosTest.java b/sdk/java/src/test/java/org/arvados/sdk/java/ArvadosTest.java
index 084b6d1..7f7bfab 100644
--- a/sdk/java/src/test/java/org/arvados/sdk/java/ArvadosTest.java
+++ b/sdk/java/src/test/java/org/arvados/sdk/java/ArvadosTest.java
@@ -388,4 +388,23 @@ public class ArvadosTest {
     assertEquals ("Got more users than requested", numUsersListItems-1, numUsersListItems2);
   }
 
+  @Test
+  public void testGetLinksWithFilters() throws Exception {
+    Arvados arv = new Arvados("arvados", "v1");
+
+    Map<String, Object> params = new HashMap<String, Object>();
+
+    String response = arv.call("links", "list", params);
+    assertTrue("Expected links.list in response", response.contains("arvados#linkList"));
+
+    /*
+    String[] filters = new String[1];
+    filters[0] = "name != 'can_manage'";
+    
+    params.put("filters", filters);
+    response = arv.call("links", "list", params);
+    assertTrue("Expected links.list in response", response.contains("arvados#linkList"));
+    */   
+  }
+
 }
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list