You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/01/20 06:22:34 UTC
zeppelin git commit: [ZEPPELIN-1869] changed the API response to
generate to 200.
Repository: zeppelin
Updated Branches:
refs/heads/master 28a8be468 -> 5eeebeb0a
[ZEPPELIN-1869] changed the API response to generate to 200.
### What is this PR for?
A few sentences describing the overall goals of the pull request's commits.
First time? Check out the contributing guide - https://zeppelin.apache.org/contribution/contributions.html
### What type of PR is it?
Documentation | change
### Todos
- [x] replace to doc
- [x] change response 201 -> 200
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1869
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? yes
Author: cloverhearts <cl...@gmail.com>
Closes #1814 from cloverhearts/ZEPPELIN-STATUS-CHANGE-API and squashes the following commits:
0f2f5bd [cloverhearts] change test case in notebooksecurity
1be0968 [cloverhearts] fixed more isCreated to isAllowed
cfcb6fd [cloverhearts] change test case in zeppelin rest api test
7bbfcd1 [cloverhearts] change status value in test case http
f9fcbc8 [cloverhearts] Revert "refix"
ed31788 [cloverhearts] refix
754309e [cloverhearts] Apply to api success status code 200
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/5eeebeb0
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/5eeebeb0
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/5eeebeb0
Branch: refs/heads/master
Commit: 5eeebeb0aaefa87ddcd6a06ff121ff2824d5d937
Parents: 28a8be4
Author: cloverhearts <cl...@gmail.com>
Authored: Sat Jan 7 02:45:59 2017 -0800
Committer: Lee moon soo <mo...@apache.org>
Committed: Thu Jan 19 22:22:26 2017 -0800
----------------------------------------------------------------------
docs/rest-api/rest-interpreter.md | 4 ++--
docs/rest-api/rest-notebook.md | 4 ++--
.../org/apache/zeppelin/rest/InterpreterRestApi.java | 4 ++--
.../java/org/apache/zeppelin/rest/NotebookRestApi.java | 10 +++++-----
.../apache/zeppelin/rest/InterpreterRestApiTest.java | 8 ++++----
.../org/apache/zeppelin/rest/NotebookRestApiTest.java | 2 +-
.../zeppelin/rest/NotebookSecurityRestApiTest.java | 2 +-
.../org/apache/zeppelin/rest/ZeppelinRestApiTest.java | 12 ++++++------
8 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/docs/rest-api/rest-interpreter.md
----------------------------------------------------------------------
diff --git a/docs/rest-api/rest-interpreter.md b/docs/rest-api/rest-interpreter.md
index 277d365..d7dc6dd 100644
--- a/docs/rest-api/rest-interpreter.md
+++ b/docs/rest-api/rest-interpreter.md
@@ -253,7 +253,7 @@ The role of registered interpreters, settings and interpreters group are describ
</tr>
<tr>
<td>Success code</td>
- <td>201</td>
+ <td>200</td>
</tr>
<tr>
<td>Fail code</td>
@@ -492,7 +492,7 @@ The role of registered interpreters, settings and interpreters group are describ
</tr>
<tr>
<td>Success code</td>
- <td>201</td>
+ <td>200</td>
</tr>
<tr>
<td>Fail code</td>
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/docs/rest-api/rest-notebook.md
----------------------------------------------------------------------
diff --git a/docs/rest-api/rest-notebook.md b/docs/rest-api/rest-notebook.md
index df0afa5..5a09450 100644
--- a/docs/rest-api/rest-notebook.md
+++ b/docs/rest-api/rest-notebook.md
@@ -89,7 +89,7 @@ Notebooks REST API supports the following operations: List, Create, Get, Delete,
</tr>
<tr>
<td>Success code</td>
- <td>201</td>
+ <td>200</td>
</tr>
<tr>
<td> Fail code</td>
@@ -318,7 +318,7 @@ Notebooks REST API supports the following operations: List, Create, Get, Delete,
</tr>
<tr>
<td>Success code</td>
- <td>201</td>
+ <td>200</td>
</tr>
<tr>
<td> Fail code</td>
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java
index 06d4752..0928007 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java
@@ -123,7 +123,7 @@ public class InterpreterRestApi {
.createNewSetting(request.getName(), request.getGroup(), request.getDependencies(),
request.getOption(), p);
logger.info("new setting created with {}", interpreterSetting.getId());
- return new JsonResponse<>(Status.CREATED, "", interpreterSetting).build();
+ return new JsonResponse<>(Status.OK, "", interpreterSetting).build();
} catch (InterpreterException | IOException e) {
logger.error("Exception in InterpreterRestApi while creating ", e);
return new JsonResponse<>(Status.NOT_FOUND, e.getMessage(), ExceptionUtils.getStackTrace(e))
@@ -237,7 +237,7 @@ public class InterpreterRestApi {
return new JsonResponse<>(Status.INTERNAL_SERVER_ERROR, e.getMessage(),
ExceptionUtils.getStackTrace(e)).build();
}
- return new JsonResponse(Status.CREATED).build();
+ return new JsonResponse(Status.OK).build();
}
/**
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
index 7b02207..8292fd0 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java
@@ -323,7 +323,7 @@ public class NotebookRestApi {
public Response importNote(String req) throws IOException {
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
Note newNote = notebook.importNote(req, null, subject);
- return new JsonResponse<>(Status.CREATED, "", newNote.getId()).build();
+ return new JsonResponse<>(Status.OK, "", newNote.getId()).build();
}
/**
@@ -359,7 +359,7 @@ public class NotebookRestApi {
note.persist(subject);
notebookServer.broadcastNote(note);
notebookServer.broadcastNoteList(subject, SecurityUtils.getRoles());
- return new JsonResponse<>(Status.CREATED, "", note.getId()).build();
+ return new JsonResponse<>(Status.OK, "", note.getId()).build();
}
/**
@@ -391,7 +391,7 @@ public class NotebookRestApi {
* Clone note REST API
*
* @param noteId ID of Note
- * @return JSON with status.CREATED
+ * @return JSON with status.OK
* @throws IOException, CloneNotSupportedException, IllegalArgumentException
*/
@POST
@@ -410,7 +410,7 @@ public class NotebookRestApi {
Note newNote = notebook.cloneNote(noteId, newNoteName, subject);
notebookServer.broadcastNote(newNote);
notebookServer.broadcastNoteList(subject, SecurityUtils.getRoles());
- return new JsonResponse<>(Status.CREATED, "", newNote.getId()).build();
+ return new JsonResponse<>(Status.OK, "", newNote.getId()).build();
}
/**
@@ -445,7 +445,7 @@ public class NotebookRestApi {
note.persist(subject);
notebookServer.broadcastNote(note);
- return new JsonResponse<>(Status.CREATED, "", p.getId()).build();
+ return new JsonResponse<>(Status.OK, "", p.getId()).build();
}
/**
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/zeppelin-server/src/test/java/org/apache/zeppelin/rest/InterpreterRestApiTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/InterpreterRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/InterpreterRestApiTest.java
index ac0d106..1214841 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/InterpreterRestApiTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/InterpreterRestApiTest.java
@@ -121,7 +121,7 @@ public class InterpreterRestApiTest extends AbstractTestRestApi {
InterpreterSetting created = convertResponseToInterpreterSetting(postResponse);
String newSettingId = created.getId();
// then : call create setting API
- assertThat("test create method:", post, isCreated());
+ assertThat("test create method:", post, isAllowed());
post.releaseConnection();
// when: call read setting API
@@ -168,7 +168,7 @@ public class InterpreterRestApiTest extends AbstractTestRestApi {
" }]," +
"\"option\": { \"remote\": true, \"session\": false }}";
PostMethod post = httpPost("/interpreter/setting", reqBody1);
- assertThat("test create method:", post, isCreated());
+ assertThat("test create method:", post, isAllowed());
post.releaseConnection();
String reqBody2 = "{\"name\":\"" + md2Name + "\",\"group\":\"md\",\"properties\":{\"propname\":\"propvalue\"}," +
@@ -179,7 +179,7 @@ public class InterpreterRestApiTest extends AbstractTestRestApi {
" }]," +
"\"option\": { \"remote\": true, \"session\": false }}";
post = httpPost("/interpreter/setting", reqBody2);
- assertThat("test create method:", post, isCreated());
+ assertThat("test create method:", post, isAllowed());
post.releaseConnection();
// 1. Call settings API
@@ -349,7 +349,7 @@ public class InterpreterRestApiTest extends AbstractTestRestApi {
"\",\"url\":\"https://repo1.maven.org/maven2\",\"snapshot\":\"false\"}";
PostMethod post = httpPost("/interpreter/repository/", jsonRequest);
- assertThat("Test create method:", post, isCreated());
+ assertThat("Test create method:", post, isAllowed());
post.releaseConnection();
// Call delete repository API
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
index b187bfe..d69339c 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
@@ -126,7 +126,7 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
Note note1 = ZeppelinServer.notebook.createNote(anonymous);
PostMethod post = httpPost("/notebook/" + note1.getId(), "");
LOG.info("testCloneNote response\n" + post.getResponseBodyAsString());
- assertThat(post, isCreated());
+ assertThat(post, isAllowed());
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
}.getType());
String clonedNoteId = (String) resp.get("body");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookSecurityRestApiTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookSecurityRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookSecurityRestApiTest.java
index 0f4a440..367a199 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookSecurityRestApiTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookSecurityRestApiTest.java
@@ -152,7 +152,7 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
private String createNoteForUser(String noteName, String user, String pwd) throws IOException {
String jsonRequest = "{\"name\":\"" + noteName + "\"}";
PostMethod post = httpPost("/notebook/", jsonRequest, user, pwd);
- assertThat("test note create method:", post, isCreated());
+ assertThat("test note create method:", post, isAllowed());
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
}.getType());
post.releaseConnection();
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5eeebeb0/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
index 9fa6c51..e7b95e4 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
@@ -137,7 +137,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
"]}";
PostMethod post = httpPost("/notebook/", jsonRequest);
LOG.info("testNoteCreate \n" + post.getResponseBodyAsString());
- assertThat("test note create method:", post, isCreated());
+ assertThat("test note create method:", post, isAllowed());
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
}.getType());
@@ -172,7 +172,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String jsonRequest = "{\"name\":\"" + noteName + "\"}";
PostMethod post = httpPost("/notebook/", jsonRequest);
LOG.info("testNoteCreate \n" + post.getResponseBodyAsString());
- assertThat("test note create method:", post, isCreated());
+ assertThat("test note create method:", post, isAllowed());
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
}.getType());
@@ -262,7 +262,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String oldJson = getNoteContent(sourceNoteId);
// call note post
PostMethod importPost = httpPost("/notebook/import/", oldJson);
- assertThat(importPost, isCreated());
+ assertThat(importPost, isAllowed());
resp =
gson.fromJson(importPost.getResponseBodyAsString(),
new TypeToken<Map<String, Object>>() {}.getType());
@@ -326,7 +326,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String jsonRequest = "{\"name\":\"" + noteName + "\"}";
PostMethod post = httpPost("/notebook/" + sourceNoteId, jsonRequest);
LOG.info("testNoteClone \n" + post.getResponseBodyAsString());
- assertThat("test note clone method:", post, isCreated());
+ assertThat("test note clone method:", post, isAllowed());
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
}.getType());
@@ -590,7 +590,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String jsonRequest = "{\"title\": \"title1\", \"text\": \"text1\"}";
PostMethod post = httpPost("/notebook/" + note.getId() + "/paragraph", jsonRequest);
LOG.info("testInsertParagraph response\n" + post.getResponseBodyAsString());
- assertThat("Test insert method:", post, isCreated());
+ assertThat("Test insert method:", post, isAllowed());
post.releaseConnection();
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
@@ -613,7 +613,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String jsonRequest2 = "{\"index\": 0, \"title\": \"title2\", \"text\": \"text2\"}";
PostMethod post2 = httpPost("/notebook/" + note.getId() + "/paragraph", jsonRequest2);
LOG.info("testInsertParagraph response2\n" + post2.getResponseBodyAsString());
- assertThat("Test insert method:", post2, isCreated());
+ assertThat("Test insert method:", post2, isAllowed());
post2.releaseConnection();
Paragraph paragraphAtIdx0 = note.getParagraphs().get(0);