[ARVADOS] updated: 5a977746e6df04e3ce1578299e98ed7ec645fcdd
git at public.curoverse.com
git at public.curoverse.com
Thu May 8 14:07:12 EDT 2014
Summary of changes:
apps/workbench/app/models/pipeline_instance.rb | 2 +-
apps/workbench/app/views/users/_tables.html.erb | 2 +-
sdk/cli/bin/arv-run-pipeline-instance | 44 ++++++++++++--
sdk/cli/bin/crunch-job | 24 +++++---
sdk/cli/test/test_arv-run-pipeline-instance.rb | 33 +++++++++++
.../main/java/org/arvados/sdk/java/Arvados.java | 41 ++++++++++++-
.../java/org/arvados/sdk/java/ArvadosTest.java | 33 +++++++++++
services/api/app/models/pipeline_instance.rb | 61 ++++++++++---------
8 files changed, 189 insertions(+), 51 deletions(-)
create mode 100644 sdk/cli/test/test_arv-run-pipeline-instance.rb
via 5a977746e6df04e3ce1578299e98ed7ec645fcdd (commit)
via 0c1af8806516569044c7354ff58f7371a510594d (commit)
via 16af0b22def5b80a1861788907a2fc45b14e3273 (commit)
via 15945ebab4fc71980b2c6ddceb149a3d7365c29e (commit)
via a9eaabb02fe7110f0e16bcd7f27d1a0cd5eab08b (commit)
via 3aaf11c2dd372b5d34ba317a1a4b761d263f86d6 (commit)
via eed7af8f901adb263c870a2277ec166467a28d77 (commit)
via d97e3de81c48673b0e1d3927edaaf0e560a9a2ba (commit)
via 14c312c452e0e010d617c02a33b94a178632ac26 (commit)
via 5c3c04ad25cfabaa860bb0ea3f3dc078a9562008 (commit)
via 5e968d7875c62a6145b7aefc39f070d14f4c97e8 (commit)
via eff3277fa6800bbc4ac81654f8883bbfd3a85d30 (commit)
via 002f863605469cee7e112f4c16a78e3b6278672c (commit)
via 6c2a704b7a2d721087976b2b8ec4f22cdaf44178 (commit)
via 01436e8b76300759ef4bfea30d7798445d50bf60 (commit)
via eee2c981d6a29eb7f15b8957570bbf8515d3d947 (commit)
via 1b8120689041941db937883c3132a9c6819b56c5 (commit)
via 8624ad6e91ed73876bd4f12fe8df2387e3e6330e (commit)
via 22233bfa18060d000e303d7734ec3016f7e80c8e (commit)
via ebddfbe7fbca80ecf852bbb20af9c6b584394691 (commit)
via 415347a3354031b48c22cae56c7bbfdcb76d607c (commit)
from cdf7b162906cb37d4ecf88ff6c72433bcdd8fc84 (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 5a977746e6df04e3ce1578299e98ed7ec645fcdd
Author: radhika <radhika at curoverse.com>
Date: Thu May 8 14:06:04 2014 -0400
2525: getAvailableParametersForMethod includes properties from request also.
This is required for create and update methods which have no other parameters.
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 a81c3cf..e404d68 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
@@ -15,6 +15,7 @@ import com.google.api.services.discovery.Discovery;
import com.google.api.services.discovery.model.JsonSchema;
import com.google.api.services.discovery.model.RestDescription;
import com.google.api.services.discovery.model.RestMethod;
+import com.google.api.services.discovery.model.RestMethod.Request;
import com.google.api.services.discovery.model.RestResource;
import java.math.BigDecimal;
@@ -161,20 +162,52 @@ public class Arvados {
}
}
+ /**
+ * Get all supported resources by the API
+ * @return Set
+ */
public Set<String> getAvailableResourses() {
return (restDescription.getResources().keySet());
}
-
+
+ /**
+ * Get all supported method names for the given resource
+ * @param resourceName
+ * @return Set
+ * @throws Exception
+ */
public Set<String> getAvailableMethodsForResourse(String resourceName)
- throws Exception {
+ throws Exception {
Map<String, RestMethod> methodMap = getMatchingMethodMap (resourceName);
return (methodMap.keySet());
}
+ /**
+ * Get the parameters for the method in the resource sought.
+ * @param resourceName
+ * @param methodName
+ * @return Set
+ * @throws Exception
+ */
public Set<String> getAvailableParametersForMethod(String resourceName, String methodName)
throws Exception {
RestMethod method = getMatchingMethod(resourceName, methodName);
- return (method.getParameters().keySet());
+ Set<String> parameters = method.getParameters().keySet();
+ Request request = method.getRequest();
+ if (request != null) {
+ Object requestProperties = request.get("properties");
+ if (requestProperties != null) {
+ if (requestProperties instanceof Map) {
+ Map properties = (Map)requestProperties;
+ Set<String> propertyKeys = properties.keySet();
+ if (propertyKeys.size()>0) {
+ propertyKeys.addAll(parameters);
+ parameters = propertyKeys;
+ }
+ }
+ }
+ }
+ return parameters;
}
private HashMap<String, Object> loadParameters(Map<String, Object> paramsMap,
@@ -237,7 +270,7 @@ public class Arvados {
}
private Map<String, RestMethod> getMatchingMethodMap(String resourceName)
- throws Exception {
+ throws Exception {
if (resourceName == null) {
error("missing resource name");
}
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 6f44da8..bb1cf64 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
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.junit.Test;
@@ -384,4 +385,36 @@ public class ArvadosTest {
assertEquals("Expected links.list in response", "arvados#linkList", response.get("kind"));
}
+ @Test
+ public void testGetAvailableResources() throws Exception {
+ Arvados arv = new Arvados("arvados", "v1");
+ Set<String> resources = arv.getAvailableResourses();
+ assertNotNull("Expected resources", resources);
+ assertTrue("Excected users in resrouces", resources.contains("users"));
+ }
+
+ @Test
+ public void testGetAvailableMethodsResources() throws Exception {
+ Arvados arv = new Arvados("arvados", "v1");
+ Set<String> methods = arv.getAvailableMethodsForResourse("users");
+ assertNotNull("Expected resources", methods);
+ assertTrue("Excected create method for users", methods.contains("create"));
+ }
+
+ @Test
+ public void testGetAvailableParametersForUsersGetMethod() throws Exception {
+ Arvados arv = new Arvados("arvados", "v1");
+ Set<String> parameters = arv.getAvailableParametersForMethod("users", "get");
+ assertNotNull("Expected parameters", parameters);
+ assertTrue("Excected uuid parameter for get method for users", parameters.contains("uuid"));
+ }
+
+ @Test
+ public void testGetAvailableParametersForUsersCreateMethod() throws Exception {
+ Arvados arv = new Arvados("arvados", "v1");
+ Set<String> parameters = arv.getAvailableParametersForMethod("users", "create");
+ assertNotNull("Expected parameters", parameters);
+ assertTrue("Excected user parameter for create method for users", parameters.contains("user"));
+ }
+
}
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list