[ARVADOS] updated: 00ba956a67072f8b4a77fe71d3dc1e4dd8f70e98
git at public.curoverse.com
git at public.curoverse.com
Sat May 3 22:17:57 EDT 2014
Summary of changes:
sdk/java/README | 33 +++++++++-----
.../java/org/arvados/sdk/java/ArvadosTest.java | 46 +++++++++++--------
sdk/java/src/test/resources/create_user.json | 1 -
3 files changed, 49 insertions(+), 31 deletions(-)
delete mode 100644 sdk/java/src/test/resources/create_user.json
via 00ba956a67072f8b4a77fe71d3dc1e4dd8f70e98 (commit)
via 98fd371d846022d8ccc25e8234d913e436ecce69 (commit)
from 9c444153e80d3a872e11ca5898491c747a881a4d (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 00ba956a67072f8b4a77fe71d3dc1e4dd8f70e98
Author: radhika <radhika at curoverse.com>
Date: Sat May 3 22:17:30 2014 -0400
2525: readme and test updates
diff --git a/sdk/java/README b/sdk/java/README
index a336e6f..e4cc203 100644
--- a/sdk/java/README
+++ b/sdk/java/README
@@ -7,6 +7,8 @@
- This document highlights the details as to how to use the SDK.
+ - The Java SDK requires Java 6 or later
+
- The Java SDK is used as a maven project. Hence, you would need a working
maven environment to be able to build the source code.
@@ -25,7 +27,8 @@
API server needs to be passed to the SDK using environment variables or
during the construction of the Arvados instance.
- - If you would like to use environment variables, below are the details.
+ - Below are the details about the environment variables and example setup
+ statements for a .bashrc file.
1. ARVADOS_API_TOKEN
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 7f7bfab..644365c 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
@@ -1,6 +1,10 @@
package org.arvados.sdk.java;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -115,9 +119,6 @@ public class ArvadosTest {
public void testCreateUser() throws Exception {
Arvados arv = new Arvados("arvados", "v1");
- File file = new File(getClass().getResource( "/create_user.json" ).toURI());
- String filePath = file.getPath();
-
Map<String, Object> params = new HashMap<String, Object>();
params.put("user", "{}");
String response = arv.call("users", "create", params);
@@ -125,15 +126,15 @@ public class ArvadosTest {
JSONParser parser = new JSONParser();
JSONObject jsonObject = (JSONObject) parser.parse(response);
assertEquals("Expected kind to be user", "arvados#user", jsonObject.get("kind"));
-
+
Object uuid = jsonObject.get("uuid");
assertNotNull("Expected uuid for first user", uuid);
-
+
// delete the object
params = new HashMap<String, Object>();
params.put("uuid", uuid);
response = arv.call("users", "delete", params);
-
+
// invoke users.get with the system user uuid
params = new HashMap<String, Object>();
params.put("uuid", uuid);
@@ -182,10 +183,10 @@ public class ArvadosTest {
JSONParser parser = new JSONParser();
JSONObject jsonObject = (JSONObject) parser.parse(response);
assertEquals("Expected kind to be user", "arvados#user", jsonObject.get("kind"));
-
+
Object uuid = jsonObject.get("uuid");
assertNotNull("Expected uuid for first user", uuid);
-
+
// update this user
params = new HashMap<String, Object>();
params.put("user", "{}");
@@ -195,10 +196,10 @@ public class ArvadosTest {
parser = new JSONParser();
jsonObject = (JSONObject) parser.parse(response);
assertEquals("Expected kind to be user", "arvados#user", jsonObject.get("kind"));
-
+
uuid = jsonObject.get("uuid");
assertNotNull("Expected uuid for first user", uuid);
-
+
// delete the object
params = new HashMap<String, Object>();
params.put("uuid", uuid);
@@ -242,7 +243,7 @@ public class ArvadosTest {
assertNotNull ("expected exception", caught);
assertTrue ("Expected 404 when unsupported version is used", caught.getMessage().contains("404 Not Found"));
}
-
+
/**
* Test unsupported api version api
* @throws Exception
@@ -261,7 +262,7 @@ public class ArvadosTest {
assertNotNull ("expected exception", caught);
assertTrue ("Expected ERROR: 404 not found", caught.getMessage().contains("ERROR: resource not found"));
}
-
+
/**
* Test unsupported api version api
* @throws Exception
@@ -290,10 +291,17 @@ public class ArvadosTest {
Arvados arv = new Arvados("arvados", "v1");
File file = new File(getClass().getResource( "/first_pipeline.json" ).toURI());
- String filePath = file.getPath();
+ byte[] data = new byte[(int)file.length()];
+ try {
+ FileInputStream is = new FileInputStream(file);
+ is.read(data);
+ is.close();
+ }catch(Exception e) {
+ e.printStackTrace();
+ }
Map<String, Object> params = new HashMap<String, Object>();
- params.put("pipeline_template", "{}"); // TBD - read file and send
+ params.put("pipeline_template", new String(data));
String response = arv.call("pipeline_templates", "create", params);
JSONParser parser = new JSONParser();
@@ -301,7 +309,7 @@ public class ArvadosTest {
assertEquals("Expected kind to be user", "arvados#pipelineTemplate", jsonObject.get("kind"));
String uuid = (String)jsonObject.get("uuid");
assertNotNull("Expected uuid for pipeline template", uuid);
-
+
// get the pipeline
params = new HashMap<String, Object>();
params.put("uuid", uuid);
@@ -311,7 +319,7 @@ public class ArvadosTest {
jsonObject = (JSONObject) parser.parse(response);
assertEquals("Expected kind to be user", "arvados#pipelineTemplate", jsonObject.get("kind"));
assertEquals("Expected uuid for pipeline template", uuid, jsonObject.get("uuid"));
-
+
// delete the object
params = new HashMap<String, Object>();
params.put("uuid", uuid);
@@ -371,7 +379,7 @@ public class ArvadosTest {
// make the request again with limit
params = new HashMap<String, Object>();
params.put("limit", numUsersListItems-1);
-
+
response = arv.call("users", "list", params);
parser = new JSONParser();
@@ -400,11 +408,11 @@ public class ArvadosTest {
/*
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
diff --git a/sdk/java/src/test/resources/create_user.json b/sdk/java/src/test/resources/create_user.json
deleted file mode 100644
index 0967ef4..0000000
--- a/sdk/java/src/test/resources/create_user.json
+++ /dev/null
@@ -1 +0,0 @@
-{}
commit 98fd371d846022d8ccc25e8234d913e436ecce69
Author: radhika <radhika at curoverse.com>
Date: Sat May 3 19:15:10 2014 -0400
2525: updated README
diff --git a/sdk/java/README b/sdk/java/README
index fb2bdd9..a336e6f 100644
--- a/sdk/java/README
+++ b/sdk/java/README
@@ -22,22 +22,28 @@
== Setting up the environment
- The SDK requires a running Arvados API server. The information about the
- API server needs to be passed to the SDK using environment variables.
+ API server needs to be passed to the SDK using environment variables or
+ during the construction of the Arvados instance.
- - The following two environment variables are required by the SDK
-
- ARVADOS_API_TOKEN, ARVADOS_API_HOST
+ - If you would like to use environment variables, below are the details.
+
+ 1. ARVADOS_API_TOKEN
- Below are examples using a .bashrc file:
+ API client token to be used to authorize with API server.
- export ARVADOS_API_TOKEN=z40gplmla6i58rsg96jhg5u41ewdl5rj4g1py2xg6s6e2lsc3
+ export ARVADOS_API_TOKEN=z40gplmla6i58rsg96jhg5u41ewdl5rj4g1py2s6e2lsc3
+
+ 2. ARVADOS_API_HOST
+
+ Host name of the API server.
+
export ARVADOS_API_HOST=localhost:3001
-
- - You can also set ARVADOS_API_HOST_INSECURE to true if you are using
- self-signed certificates and want to bypass certificate validations.
- Below is an example using a .bashrc file:
-
+ 3. ARVADOS_API_HOST_INSECURE
+
+ Set this to true if you are using self-signed certificates and
+ would like to bypass certificate validations.
+
export ARVADOS_API_HOST_INSECURE=true
@@ -92,6 +98,8 @@
- To develop in eclipse, you can use the SDK eclipse project.
- Install "m2eclipse" plugin in your eclipse
+
+ - Set M2_REPO to your .m2/repository directory
- Open the SDK project.
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list