You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by jo...@apache.org on 2018/08/29 10:07:08 UTC

[12/50] [abbrv] zeppelin git commit: Revert "[ZEPPELIN-3740] Adopt `google-java-format` and `fmt-maven-plugin`"

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/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 a8d6ea2..9d96ee5 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
@@ -24,18 +24,10 @@ import static org.junit.Assert.assertThat;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
+
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.zeppelin.interpreter.InterpreterResult;
-import org.apache.zeppelin.notebook.Note;
-import org.apache.zeppelin.notebook.Paragraph;
-import org.apache.zeppelin.scheduler.Job;
-import org.apache.zeppelin.server.ZeppelinServer;
-import org.apache.zeppelin.user.AuthenticationInfo;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -43,7 +35,20 @@ import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
 
-/** Zeppelin notebook rest api tests. */
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.notebook.Note;
+import org.apache.zeppelin.notebook.Paragraph;
+import org.apache.zeppelin.scheduler.Job;
+import org.apache.zeppelin.server.ZeppelinServer;
+import org.apache.zeppelin.user.AuthenticationInfo;
+
+/**
+ * Zeppelin notebook rest api tests.
+ */
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class NotebookRestApiTest extends AbstractTestRestApi {
   Gson gson = new Gson();
@@ -73,16 +78,15 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
 
     GetMethod get = httpGet("/notebook/job/" + note1.getId() + "/" + paragraphId);
     assertThat(get, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     Map<String, Set<String>> paragraphStatus = (Map<String, Set<String>>) resp.get("body");
 
     // Check id and status have proper value
     assertEquals(paragraphStatus.get("id"), paragraphId);
     assertEquals(paragraphStatus.get("status"), "READY");
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(note1.getId(), anonymous);
   }
 
@@ -96,9 +100,8 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     // run blank paragraph
     PostMethod post = httpPost("/notebook/job/" + note1.getId() + "/" + p.getId(), "");
     assertThat(post, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     assertEquals(resp.get("status"), "OK");
     post.releaseConnection();
     assertEquals(p.getStatus(), Job.Status.FINISHED);
@@ -107,14 +110,13 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     p.setText("test");
     post = httpPost("/notebook/job/" + note1.getId() + "/" + p.getId(), "");
     assertThat(post, isAllowed());
-    resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     assertEquals(resp.get("status"), "OK");
     post.releaseConnection();
     assertNotEquals(p.getStatus(), Job.Status.READY);
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(note1.getId(), anonymous);
   }
 
@@ -139,9 +141,8 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
 
     PostMethod post = httpPost("/notebook/job/" + note1.getId(), "");
     assertThat(post, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     assertEquals(resp.get("status"), "OK");
     post.releaseConnection();
 
@@ -166,15 +167,13 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     //
     Paragraph p1 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS);
     Paragraph p2 = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS);
-    p1.setText(
-        "%python import time\ntime.sleep(1)\nfrom __future__ import print_function\nprint(user2)");
+    p1.setText("%python import time\ntime.sleep(1)\nfrom __future__ import print_function\nprint(user2)");
     p2.setText("%python user2='abc'\nprint(user2)");
 
     PostMethod post = httpPost("/notebook/job/" + note1.getId(), "");
     assertThat(post, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     assertEquals(resp.get("status"), "OK");
     post.releaseConnection();
 
@@ -189,23 +188,21 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     PostMethod post = httpPost("/notebook/" + note1.getId(), "");
     LOG.info("testCloneNote response\n" + post.getResponseBodyAsString());
     assertThat(post, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     String clonedNoteId = (String) resp.get("body");
     post.releaseConnection();
 
     GetMethod get = httpGet("/notebook/" + clonedNoteId);
     assertThat(get, isAllowed());
-    Map<String, Object> resp2 =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body");
 
     assertEquals(resp2Body.get("name"), "Note " + clonedNoteId);
     get.releaseConnection();
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(note1.getId(), anonymous);
     ZeppelinServer.notebook.removeNote(clonedNoteId, anonymous);
   }
@@ -224,7 +221,7 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
 
     assertEquals(note.getName(), newName);
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(noteId, anonymous);
   }
 
@@ -237,13 +234,12 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     String paragraphId = p.getId();
     String jsonRequest = "{\"colWidth\": 6.0}";
 
-    PutMethod put =
-        httpPut("/notebook/" + noteId + "/paragraph/" + paragraphId + "/config", jsonRequest);
+    PutMethod put = httpPut("/notebook/" + noteId + "/paragraph/" + paragraphId + "/config",
+            jsonRequest);
     assertThat("test testUpdateParagraphConfig:", put, isAllowed());
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            put.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(put.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     Map<String, Object> respBody = (Map<String, Object>) resp.get("body");
     Map<String, Object> config = (Map<String, Object>) respBody.get("config");
     put.releaseConnection();
@@ -252,7 +248,7 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     note = ZeppelinServer.notebook.getNote(noteId);
     assertEquals(note.getParagraph(paragraphId).getConfig().get("colWidth"), 6.0);
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(noteId, anonymous);
   }
 
@@ -261,9 +257,8 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     // Create note and set result explicitly
     Note note = ZeppelinServer.notebook.createNote(anonymous);
     Paragraph p1 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
-    InterpreterResult result =
-        new InterpreterResult(
-            InterpreterResult.Code.SUCCESS, InterpreterResult.Type.TEXT, "result");
+    InterpreterResult result = new InterpreterResult(InterpreterResult.Code.SUCCESS,
+            InterpreterResult.Type.TEXT, "result");
     p1.setResult(result);
 
     Paragraph p2 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
@@ -278,22 +273,20 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
     // check if paragraph results are cleared
     GetMethod get = httpGet("/notebook/" + note.getId() + "/paragraph/" + p1.getId());
     assertThat(get, isAllowed());
-    Map<String, Object> resp1 =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp1 = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     Map<String, Object> resp1Body = (Map<String, Object>) resp1.get("body");
     assertNull(resp1Body.get("result"));
 
     get = httpGet("/notebook/" + note.getId() + "/paragraph/" + p2.getId());
     assertThat(get, isAllowed());
-    Map<String, Object> resp2 =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body");
     assertNull(resp2Body.get("result"));
     get.releaseConnection();
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(note.getId(), anonymous);
   }
 
@@ -334,9 +327,8 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
 
     PostMethod post2 = httpPost("/notebook/job/" + note1.getId(), "");
     assertThat(post2, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            post2.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post2.getResponseBodyAsString(),
+        new TypeToken<Map<String, Object>>() {}.getType());
     assertEquals(resp.get("status"), "OK");
     post2.releaseConnection();
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/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 c40a4b4..209a272 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
@@ -24,29 +24,32 @@ import static org.junit.Assert.assertThat;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Map;
+
 import org.apache.commons.httpclient.HttpMethodBase;
 import org.apache.commons.httpclient.methods.DeleteMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.zeppelin.notebook.Note;
-import org.apache.zeppelin.server.ZeppelinServer;
 import org.hamcrest.Matcher;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.apache.zeppelin.notebook.Note;
+import org.apache.zeppelin.server.ZeppelinServer;
+
 public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
   Gson gson = new Gson();
 
   @BeforeClass
   public static void init() throws Exception {
     AbstractTestRestApi.startUpWithAuthenticationEnable(
-        NotebookSecurityRestApiTest.class.getSimpleName());
+            NotebookSecurityRestApiTest.class.getSimpleName());
   }
 
   @AfterClass
@@ -56,7 +59,7 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
 
   @Before
   public void setUp() {}
-
+  
   @Test
   public void testThatUserCanCreateAndRemoveNote() throws IOException {
     String noteId = createNoteForUser("test", "admin", "password1");
@@ -65,50 +68,48 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
     assertThat(id, is(noteId));
     deleteNoteForUser(noteId, "admin", "password1");
   }
-
+  
   @Test
   public void testThatOtherUserCanAccessNoteIfPermissionNotSet() throws IOException {
     String noteId = createNoteForUser("test", "admin", "password1");
-
+    
     userTryGetNote(noteId, "user1", "password2", isAllowed());
-
+    
     deleteNoteForUser(noteId, "admin", "password1");
   }
-
+  
   @Test
   public void testThatOtherUserCannotAccessNoteIfPermissionSet() throws IOException {
     String noteId = createNoteForUser("test", "admin", "password1");
-
-    // set permission
-    String payload =
-        "{ \"owners\": [\"admin\"], \"readers\": [\"user2\"], "
-            + "\"runners\": [\"user2\"], \"writers\": [\"user2\"] }";
-    PutMethod put = httpPut("/notebook/" + noteId + "/permissions", payload, "admin", "password1");
+    
+    //set permission
+    String payload = "{ \"owners\": [\"admin\"], \"readers\": [\"user2\"], " +
+            "\"runners\": [\"user2\"], \"writers\": [\"user2\"] }";
+    PutMethod put = httpPut("/notebook/" + noteId + "/permissions", payload , "admin", "password1");
     assertThat("test set note permission method:", put, isAllowed());
     put.releaseConnection();
-
+    
     userTryGetNote(noteId, "user1", "password2", isForbidden());
-
+    
     userTryGetNote(noteId, "user2", "password3", isAllowed());
-
+    
     deleteNoteForUser(noteId, "admin", "password1");
   }
-
+  
   @Test
   public void testThatWriterCannotRemoveNote() throws IOException {
     String noteId = createNoteForUser("test", "admin", "password1");
-
-    // set permission
-    String payload =
-        "{ \"owners\": [\"admin\", \"user1\"], \"readers\": [\"user2\"], "
-            + "\"runners\": [\"user2\"], \"writers\": [\"user2\"] }";
-    PutMethod put = httpPut("/notebook/" + noteId + "/permissions", payload, "admin", "password1");
+    
+    //set permission
+    String payload = "{ \"owners\": [\"admin\", \"user1\"], \"readers\": [\"user2\"], " +
+            "\"runners\": [\"user2\"], \"writers\": [\"user2\"] }";
+    PutMethod put = httpPut("/notebook/" + noteId + "/permissions", payload , "admin", "password1");
     assertThat("test set note permission method:", put, isAllowed());
     put.releaseConnection();
-
+    
     userTryRemoveNote(noteId, "user2", "password3", isForbidden());
     userTryRemoveNote(noteId, "user1", "password2", isAllowed());
-
+    
     Note deletedNote = ZeppelinServer.notebook.getNote(noteId);
     assertNull("Deleted note should be null", deletedNote);
   }
@@ -116,14 +117,14 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
   @Test
   public void testThatUserCanSearchNote() throws IOException {
     String noteId1 = createNoteForUser("test1", "admin", "password1");
-    createParagraphForUser(
-        noteId1, "admin", "password1", "title1", "ThisIsToTestSearchMethodWithPermissions 1");
+    createParagraphForUser(noteId1, "admin", "password1", "title1",
+            "ThisIsToTestSearchMethodWithPermissions 1");
 
     String noteId2 = createNoteForUser("test2", "user1", "password2");
-    createParagraphForUser(
-        noteId1, "admin", "password1", "title2", "ThisIsToTestSearchMethodWithPermissions 2");
+    createParagraphForUser(noteId1, "admin", "password1", "title2",
+            "ThisIsToTestSearchMethodWithPermissions 2");
 
-    // set permission for each note
+    //set permission for each note
     setPermissionForNote(noteId1, "admin", "password1");
     setPermissionForNote(noteId1, "user1", "password2");
 
@@ -133,17 +134,15 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
     deleteNoteForUser(noteId2, "user1", "password2");
   }
 
-  private void userTryRemoveNote(
-      String noteId, String user, String pwd, Matcher<? super HttpMethodBase> m)
-      throws IOException {
+  private void userTryRemoveNote(String noteId, String user, String pwd,
+          Matcher<? super HttpMethodBase> m) throws IOException {
     DeleteMethod delete = httpDelete(("/notebook/" + noteId), user, pwd);
     assertThat(delete, m);
     delete.releaseConnection();
   }
-
-  private void userTryGetNote(
-      String noteId, String user, String pwd, Matcher<? super HttpMethodBase> m)
-      throws IOException {
+  
+  private void userTryGetNote(String noteId, String user, String pwd,
+          Matcher<? super HttpMethodBase> m) throws IOException {
     GetMethod get = httpGet("/notebook/" + noteId, user, pwd);
     assertThat(get, m);
     get.releaseConnection();
@@ -152,22 +151,20 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
   private String getNoteIdForUser(String noteId, String user, String pwd) throws IOException {
     GetMethod get = httpGet("/notebook/" + noteId, user, pwd);
     assertThat("test note create method:", get, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     get.releaseConnection();
     return (String) ((Map<String, Object>) resp.get("body")).get("id");
   }
-
+  
   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, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     post.releaseConnection();
-    String newNoteId = (String) resp.get("body");
+    String newNoteId =  (String) resp.get("body");
     Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
     assertNotNull("Can not find new note by id", newNote);
     return newNoteId;
@@ -184,34 +181,24 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
     }
   }
 
-  private void createParagraphForUser(
-      String noteId, String user, String pwd, String title, String text) throws IOException {
+  private void createParagraphForUser(String noteId, String user, String pwd,
+          String title, String text) throws IOException {
     String payload = "{\"title\": \"" + title + "\",\"text\": \"" + text + "\"}";
     PostMethod post = httpPost(("/notebook/" + noteId + "/paragraph"), payload, user, pwd);
     post.releaseConnection();
   }
 
   private void setPermissionForNote(String noteId, String user, String pwd) throws IOException {
-    String payload =
-        "{\"owners\":[\""
-            + user
-            + "\"],\"readers\":[\""
-            + user
-            + "\"],\"runners\":[\""
-            + user
-            + "\"],\"writers\":[\""
-            + user
-            + "\"]}";
+    String payload = "{\"owners\":[\"" + user + "\"],\"readers\":[\"" + user +
+            "\"],\"runners\":[\"" + user + "\"],\"writers\":[\"" + user + "\"]}";
     PutMethod put = httpPut(("/notebook/" + noteId + "/permissions"), payload, user, pwd);
     put.releaseConnection();
   }
 
   private void searchNoteBasedOnPermission(String searchText, String user, String pwd)
-      throws IOException {
+          throws IOException{
     GetMethod searchNote = httpGet(("/notebook/search?q=" + searchText), user, pwd);
-    Map<String, Object> respSearchResult =
-        gson.fromJson(
-            searchNote.getResponseBodyAsString(),
+    Map<String, Object> respSearchResult = gson.fromJson(searchNote.getResponseBodyAsString(),
             new TypeToken<Map<String, Object>>() {}.getType());
     ArrayList searchBody = (ArrayList) respSearchResult.get("body");
     assertEquals("At-least one search results is there", true, searchBody.size() >= 1);
@@ -221,9 +208,7 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
       String userId = searchResult.get("id").split("/", 2)[0];
 
       GetMethod getPermission = httpGet(("/notebook/" + userId + "/permissions"), user, pwd);
-      Map<String, Object> resp =
-          gson.fromJson(
-              getPermission.getResponseBodyAsString(),
+      Map<String, Object> resp = gson.fromJson(getPermission.getResponseBodyAsString(),
               new TypeToken<Map<String, Object>>() {}.getType());
       Map<String, ArrayList> permissions = (Map<String, ArrayList>) resp.get("body");
       ArrayList owners = permissions.get("owners");
@@ -232,13 +217,8 @@ public class NotebookSecurityRestApiTest extends AbstractTestRestApi {
       ArrayList runners = permissions.get("runners");
 
       if (owners.size() != 0 && readers.size() != 0 && writers.size() != 0 && runners.size() != 0) {
-        assertEquals(
-            "User has permissions  ",
-            true,
-            (owners.contains(user)
-                || readers.contains(user)
-                || writers.contains(user)
-                || runners.contains(user)));
+        assertEquals("User has permissions  ", true, (owners.contains(user) ||
+                readers.contains(user) || writers.contains(user) || runners.contains(user)));
       }
       getPermission.releaseConnection();
     }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/rest/SecurityRestApiTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/SecurityRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/SecurityRestApiTest.java
index 519c25a..c4584b2 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/SecurityRestApiTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/SecurityRestApiTest.java
@@ -18,9 +18,7 @@ package org.apache.zeppelin.rest;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
+
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.hamcrest.CoreMatchers;
 import org.junit.AfterClass;
@@ -29,10 +27,15 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ErrorCollector;
 
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
 public class SecurityRestApiTest extends AbstractTestRestApi {
   Gson gson = new Gson();
 
-  @Rule public ErrorCollector collector = new ErrorCollector();
+  @Rule
+  public ErrorCollector collector = new ErrorCollector();
 
   @BeforeClass
   public static void init() throws Exception {
@@ -48,13 +51,13 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
   public void testTicket() throws IOException {
     GetMethod get = httpGet("/security/ticket", "admin", "password1");
     get.addRequestHeader("Origin", "http://localhost");
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+        new TypeToken<Map<String, Object>>(){}.getType());
     Map<String, String> body = (Map<String, String>) resp.get("body");
-    collector.checkThat(
-        "Paramater principal", body.get("principal"), CoreMatchers.equalTo("admin"));
-    collector.checkThat("Paramater ticket", body.get("ticket"), CoreMatchers.not("anonymous"));
+    collector.checkThat("Paramater principal", body.get("principal"),
+        CoreMatchers.equalTo("admin"));
+    collector.checkThat("Paramater ticket", body.get("ticket"),
+        CoreMatchers.not("anonymous"));
     get.releaseConnection();
   }
 
@@ -62,22 +65,22 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
   public void testGetUserList() throws IOException {
     GetMethod get = httpGet("/security/userlist/admi", "admin", "password1");
     get.addRequestHeader("Origin", "http://localhost");
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+        new TypeToken<Map<String, Object>>(){}.getType());
     List<String> userList = (List) ((Map) resp.get("body")).get("users");
-    collector.checkThat("Search result size", userList.size(), CoreMatchers.equalTo(1));
-    collector.checkThat(
-        "Search result contains admin", userList.contains("admin"), CoreMatchers.equalTo(true));
+    collector.checkThat("Search result size", userList.size(),
+        CoreMatchers.equalTo(1));
+    collector.checkThat("Search result contains admin", userList.contains("admin"),
+        CoreMatchers.equalTo(true));
     get.releaseConnection();
 
     GetMethod notUser = httpGet("/security/userlist/randomString", "admin", "password1");
     notUser.addRequestHeader("Origin", "http://localhost");
-    Map<String, Object> notUserResp =
-        gson.fromJson(
-            notUser.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> notUserResp = gson.fromJson(notUser.getResponseBodyAsString(),
+        new TypeToken<Map<String, Object>>(){}.getType());
     List<String> emptyUserList = (List) ((Map) notUserResp.get("body")).get("users");
-    collector.checkThat("Search result size", emptyUserList.size(), CoreMatchers.equalTo(0));
+    collector.checkThat("Search result size", emptyUserList.size(),
+        CoreMatchers.equalTo(0));
 
     notUser.releaseConnection();
   }
@@ -85,11 +88,12 @@ public class SecurityRestApiTest extends AbstractTestRestApi {
   @Test
   public void testRolesEscaped() throws IOException {
     GetMethod get = httpGet("/security/ticket", "admin", "password1");
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>(){}.getType());
     String roles = (String) ((Map) resp.get("body")).get("roles");
-    collector.checkThat("Paramater roles", roles, CoreMatchers.equalTo("[\"admin\"]"));
+    collector.checkThat("Paramater roles", roles,
+            CoreMatchers.equalTo("[\"admin\"]"));
     get.releaseConnection();
   }
+
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/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 59f9859..65280f8 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
@@ -26,21 +26,12 @@ import static org.junit.Assert.assertTrue;
 import com.google.common.collect.Sets;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
+
 import org.apache.commons.httpclient.methods.DeleteMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
-import org.apache.zeppelin.notebook.Note;
-import org.apache.zeppelin.notebook.Paragraph;
-import org.apache.zeppelin.server.ZeppelinServer;
-import org.apache.zeppelin.user.AuthenticationInfo;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -48,7 +39,21 @@ import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
 
-/** BASIC Zeppelin rest api tests. */
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
+import org.apache.zeppelin.notebook.Note;
+import org.apache.zeppelin.notebook.Paragraph;
+import org.apache.zeppelin.server.ZeppelinServer;
+import org.apache.zeppelin.user.AuthenticationInfo;
+
+/**
+ * BASIC Zeppelin rest api tests.
+ */
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class ZeppelinRestApiTest extends AbstractTestRestApi {
   Gson gson = new Gson();
@@ -69,7 +74,9 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     anonymous = new AuthenticationInfo("anonymous");
   }
 
-  /** ROOT API TEST. */
+  /**
+   * ROOT API TEST.
+   **/
   @Test
   public void getApiRoot() throws IOException {
     // when
@@ -99,9 +106,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     LOG.info("testGetNoteInfo \n" + get.getResponseBodyAsString());
     assertThat("test note get method:", get, isAllowed());
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
     assertNotNull(resp);
     assertEquals("OK", resp.get("status"));
@@ -130,25 +136,21 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
   public void testNoteCreateWithParagraphs() throws IOException {
     // Call Create Note REST API
     String noteName = "test";
-    String jsonRequest =
-        "{\"name\":\""
-            + noteName
-            + "\", \"paragraphs\": ["
-            + "{\"title\": \"title1\", \"text\": \"text1\"},"
-            + "{\"title\": \"title2\", \"text\": \"text2\"},"
-            + "{\"title\": \"titleConfig\", \"text\": \"text3\", "
-            + "\"config\": {\"colWidth\": 9.0, \"title\": true, "
-            + "\"results\": [{\"graph\": {\"mode\": \"pieChart\"}}] "
-            + "}}]} ";
+    String jsonRequest = "{\"name\":\"" + noteName + "\", \"paragraphs\": [" +
+        "{\"title\": \"title1\", \"text\": \"text1\"}," +
+        "{\"title\": \"title2\", \"text\": \"text2\"}," +
+        "{\"title\": \"titleConfig\", \"text\": \"text3\", " +
+        "\"config\": {\"colWidth\": 9.0, \"title\": true, " +
+        "\"results\": [{\"graph\": {\"mode\": \"pieChart\"}}] " +
+        "}}]} ";
     PostMethod post = httpPost("/notebook/", jsonRequest);
     LOG.info("testNoteCreate \n" + post.getResponseBodyAsString());
     assertThat("test note create method:", post, isAllowed());
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
-    String newNoteId = (String) resp.get("body");
+    String newNoteId =  (String) resp.get("body");
     LOG.info("newNoteId:=" + newNoteId);
     Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
     assertNotNull("Can not find new note by id", newNote);
@@ -187,11 +189,10 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     LOG.info("testNoteCreate \n" + post.getResponseBodyAsString());
     assertThat("test note create method:", post, isAllowed());
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
-    String newNoteId = (String) resp.get("body");
+    String newNoteId =  (String) resp.get("body");
     LOG.info("newNoteId:=" + newNoteId);
     Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
     assertNotNull("Can not find new note by id", newNote);
@@ -210,7 +211,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
   @Test
   public void testDeleteNote() throws IOException {
     LOG.info("testDeleteNote");
-    // Create note and get ID
+    //Create note and get ID
     Note note = ZeppelinServer.notebook.createNote(anonymous);
     String noteId = note.getId();
     testDeleteNote(noteId);
@@ -241,8 +242,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertThat("test note export method:", get, isAllowed());
 
     Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+        gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
     String exportJSON = (String) resp.get("body");
     assertNotNull("Can not find new notejson", exportJSON);
@@ -273,16 +274,15 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     PostMethod importPost = httpPost("/notebook/import/", oldJson);
     assertThat(importPost, isAllowed());
     resp =
-        gson.fromJson(
-            importPost.getResponseBodyAsString(),
+        gson.fromJson(importPost.getResponseBodyAsString(),
             new TypeToken<Map<String, Object>>() {}.getType());
     String importId = (String) resp.get("body");
 
     assertNotNull("Did not get back a note id in body", importId);
     Note newNote = ZeppelinServer.notebook.getNote(importId);
     assertEquals("Compare note names", noteName, newNote.getName());
-    assertEquals(
-        "Compare paragraphs count", note.getParagraphs().size(), newNote.getParagraphs().size());
+    assertEquals("Compare paragraphs count", note.getParagraphs().size(), newNote.getParagraphs()
+        .size());
     // cleanup
     ZeppelinServer.notebook.removeNote(note.getId(), anonymous);
     ZeppelinServer.notebook.removeNote(newNote.getId(), anonymous);
@@ -294,8 +294,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertThat(get, isAllowed());
     get.addRequestHeader("Origin", "http://localhost");
     Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+        gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     assertEquals(200, get.getStatusCode());
     String body = resp.get("body").toString();
     // System.out.println("Body is " + body);
@@ -344,18 +344,17 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     LOG.info("testNoteClone \n" + post.getResponseBodyAsString());
     assertThat("test note clone method:", post, isAllowed());
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
-    String newNoteId = (String) resp.get("body");
+    String newNoteId =  (String) resp.get("body");
     LOG.info("newNoteId:=" + newNoteId);
     Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
     assertNotNull("Can not find new note by id", newNote);
     assertEquals("Compare note names", noteName, newNote.getName());
-    assertEquals(
-        "Compare paragraphs count", note.getParagraphs().size(), newNote.getParagraphs().size());
-    // cleanup
+    assertEquals("Compare paragraphs count", note.getParagraphs().size(),
+            newNote.getParagraphs().size());
+    //cleanup
     ZeppelinServer.notebook.removeNote(note.getId(), anonymous);
     ZeppelinServer.notebook.removeNote(newNote.getId(), anonymous);
     post.releaseConnection();
@@ -366,14 +365,13 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     LOG.info("testListNotes");
     GetMethod get = httpGet("/notebook/ ");
     assertThat("List notes method", get, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     List<Map<String, String>> body = (List<Map<String, String>>) resp.get("body");
-    // TODO(khalid): anonymous or specific user notes?
+    //TODO(khalid): anonymous or specific user notes?
     HashSet<String> anonymous = Sets.newHashSet("anonymous");
-    assertEquals(
-        "List notes are equal", ZeppelinServer.notebook.getAllNotes(anonymous).size(), body.size());
+    assertEquals("List notes are equal", ZeppelinServer.notebook.getAllNotes(anonymous)
+            .size(), body.size());
     get.releaseConnection();
   }
 
@@ -428,7 +426,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     deleteParagraph.releaseConnection();
     Thread.sleep(1000);
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(note.getId(), anonymous);
   }
 
@@ -458,8 +456,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     get.releaseConnection();
 
     LOG.info("test get note job: \n" + responseBody);
-    Map<String, Object> resp =
-        gson.fromJson(responseBody, new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(responseBody,
+            new TypeToken<Map<String, Object>>() {}.getType());
 
     List<Map<String, Object>> paragraphs = (List<Map<String, Object>>) resp.get("body");
     assertEquals(1, paragraphs.size());
@@ -500,10 +498,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     note.runAll();
 
     // Call Run paragraph REST API
-    PostMethod postParagraph =
-        httpPost(
-            "/notebook/job/" + noteId + "/" + paragraph.getId(),
-            "{\"params\": {\"param\": \"hello\", \"param2\": \"world\"}}");
+    PostMethod postParagraph = httpPost("/notebook/job/" + noteId + "/" + paragraph.getId(),
+        "{\"params\": {\"param\": \"hello\", \"param2\": \"world\"}}");
     assertThat("test paragraph run:", postParagraph, isAllowed());
     postParagraph.releaseConnection();
     Thread.sleep(1000);
@@ -514,12 +510,12 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertEquals("hello", params.get("param"));
     assertEquals("world", params.get("param2"));
 
-    // cleanup
+    //cleanup
     ZeppelinServer.notebook.removeNote(note.getId(), anonymous);
   }
 
   @Test
-  public void testJobs() throws InterruptedException, IOException {
+  public void testJobs() throws InterruptedException, IOException{
     // create a note and a paragraph
     Note note = ZeppelinServer.notebook.createNote(anonymous);
 
@@ -560,7 +556,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
   }
 
   @Test
-  public void testCronDisable() throws InterruptedException, IOException {
+  public void testCronDisable() throws InterruptedException, IOException{
     // create a note and a paragraph
     System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_CRON_ENABLE.getVarName(), "false");
     Note note = ZeppelinServer.notebook.createNote(anonymous);
@@ -613,9 +609,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
 
     GetMethod getNoteJobs = httpGet("/notebook/job/" + note.getId());
     assertThat("test note jobs run:", getNoteJobs, isAllowed());
-    Map<String, Object> resp =
-        gson.fromJson(
-            getNoteJobs.getResponseBodyAsString(),
+    Map<String, Object> resp = gson.fromJson(getNoteJobs.getResponseBodyAsString(),
             new TypeToken<Map<String, Object>>() {}.getType());
     List<Map<String, String>> body = (List<Map<String, String>>) resp.get("body");
     assertFalse(body.get(0).containsKey("started"));
@@ -635,9 +629,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertThat("Test insert method:", post, isAllowed());
     post.releaseConnection();
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
     String newParagraphId = (String) resp.get("body");
     LOG.info("newParagraphId:=" + newParagraphId);
@@ -663,11 +656,10 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertEquals("title2", paragraphAtIdx0.getTitle());
     assertEquals("text2", paragraphAtIdx0.getText());
 
-    // append paragraph providing graph
-    String jsonRequest3 =
-        "{\"title\": \"title3\", \"text\": \"text3\", "
-            + "\"config\": {\"colWidth\": 9.0, \"title\": true, "
-            + "\"results\": [{\"graph\": {\"mode\": \"pieChart\"}}]}}";
+    //append paragraph providing graph
+    String jsonRequest3 = "{\"title\": \"title3\", \"text\": \"text3\", " +
+                          "\"config\": {\"colWidth\": 9.0, \"title\": true, " +
+                          "\"results\": [{\"graph\": {\"mode\": \"pieChart\"}}]}}";
     PostMethod post3 = httpPost("/notebook/" + note.getId() + "/paragraph", jsonRequest3);
     LOG.info("testInsertParagraph response4\n" + post3.getResponseBodyAsString());
     assertThat("Test insert method:", post3, isAllowed());
@@ -691,37 +683,36 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
 
     String jsonRequest = "{\"title\": \"title1\", \"text\": \"text1\"}";
     PostMethod post = httpPost("/notebook/" + note.getId() + "/paragraph", jsonRequest);
-    Map<String, Object> resp =
-        gson.fromJson(
-            post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
     post.releaseConnection();
 
     String newParagraphId = (String) resp.get("body");
-    Paragraph newParagraph =
-        ZeppelinServer.notebook.getNote(note.getId()).getParagraph(newParagraphId);
+    Paragraph newParagraph = ZeppelinServer.notebook.getNote(note.getId())
+            .getParagraph(newParagraphId);
 
     assertEquals("title1", newParagraph.getTitle());
     assertEquals("text1", newParagraph.getText());
 
     String updateRequest = "{\"text\": \"updated text\"}";
-    PutMethod put =
-        httpPut("/notebook/" + note.getId() + "/paragraph/" + newParagraphId, updateRequest);
+    PutMethod put = httpPut("/notebook/" + note.getId() + "/paragraph/" + newParagraphId,
+            updateRequest);
     assertThat("Test update method:", put, isAllowed());
     put.releaseConnection();
 
-    Paragraph updatedParagraph =
-        ZeppelinServer.notebook.getNote(note.getId()).getParagraph(newParagraphId);
+    Paragraph updatedParagraph = ZeppelinServer.notebook.getNote(note.getId())
+            .getParagraph(newParagraphId);
 
     assertEquals("title1", updatedParagraph.getTitle());
     assertEquals("updated text", updatedParagraph.getText());
 
     String updateBothRequest = "{\"title\": \"updated title\", \"text\" : \"updated text 2\" }";
-    PutMethod updatePut =
-        httpPut("/notebook/" + note.getId() + "/paragraph/" + newParagraphId, updateBothRequest);
+    PutMethod updatePut = httpPut("/notebook/" + note.getId() + "/paragraph/" + newParagraphId,
+            updateBothRequest);
     updatePut.releaseConnection();
 
-    Paragraph updatedBothParagraph =
-        ZeppelinServer.notebook.getNote(note.getId()).getParagraph(newParagraphId);
+    Paragraph updatedBothParagraph = ZeppelinServer.notebook.getNote(note.getId())
+            .getParagraph(newParagraphId);
 
     assertEquals("updated title", updatedBothParagraph.getTitle());
     assertEquals("updated text 2", updatedBothParagraph.getText());
@@ -743,9 +734,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertThat("Test get method: ", get, isAllowed());
     get.releaseConnection();
 
-    Map<String, Object> resp =
-        gson.fromJson(
-            get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(),
+            new TypeToken<Map<String, Object>>() {}.getType());
 
     assertNotNull(resp);
     assertEquals("OK", resp.get("status"));
@@ -773,8 +763,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
 
     note.persist(anonymous);
 
-    PostMethod post =
-        httpPost("/notebook/" + note.getId() + "/paragraph/" + p2.getId() + "/move/" + 0, "");
+    PostMethod post = httpPost("/notebook/" + note.getId() + "/paragraph/" + p2.getId() +
+            "/move/" + 0, "");
     assertThat("Test post method: ", post, isAllowed());
     post.releaseConnection();
 
@@ -785,8 +775,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
     assertEquals(p2.getTitle(), paragraphAtIdx0.getTitle());
     assertEquals(p2.getText(), paragraphAtIdx0.getText());
 
-    PostMethod post2 =
-        httpPost("/notebook/" + note.getId() + "/paragraph/" + p2.getId() + "/move/" + 10, "");
+    PostMethod post2 = httpPost("/notebook/" + note.getId() + "/paragraph/" + p2.getId() +
+            "/move/" + 10, "");
     assertThat("Test post method: ", post2, isBadRequest());
     post.releaseConnection();
 
@@ -817,18 +807,16 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
   @Test
   public void testTitleSearch() throws IOException {
     Note note = ZeppelinServer.notebook.createNote(anonymous);
-    String jsonRequest =
-        "{\"title\": \"testTitleSearchOfParagraph\", "
-            + "\"text\": \"ThisIsToTestSearchMethodWithTitle \"}";
+    String jsonRequest = "{\"title\": \"testTitleSearchOfParagraph\", " +
+            "\"text\": \"ThisIsToTestSearchMethodWithTitle \"}";
     PostMethod postNoteText = httpPost("/notebook/" + note.getId() + "/paragraph", jsonRequest);
     postNoteText.releaseConnection();
 
     GetMethod searchNote = httpGet("/notebook/search?q='testTitleSearchOfParagraph'");
     searchNote.addRequestHeader("Origin", "http://localhost");
-    Map<String, Object> respSearchResult =
-        gson.fromJson(
-            searchNote.getResponseBodyAsString(),
-            new TypeToken<Map<String, Object>>() {}.getType());
+    Map<String, Object> respSearchResult = gson.fromJson(searchNote.getResponseBodyAsString(),
+        new TypeToken<Map<String, Object>>() {
+        }.getType());
     ArrayList searchBody = (ArrayList) respSearchResult.get("body");
 
     int numberOfTitleHits = 0;

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinServerTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinServerTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinServerTest.java
index 47e0897..76a0758 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinServerTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinServerTest.java
@@ -17,4 +17,7 @@
 
 package org.apache.zeppelin.rest;
 
-public class ZeppelinServerTest extends AbstractTestRestApi {}
+public class ZeppelinServerTest extends AbstractTestRestApi {
+
+
+}

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
index 530bc0d..ec370d4 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
@@ -19,6 +19,15 @@ package org.apache.zeppelin.rest;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import org.apache.commons.io.FileUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
@@ -27,7 +36,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import org.apache.commons.io.FileUtils;
+
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.display.AngularObject;
 import org.apache.zeppelin.interpreter.InterpreterException;
@@ -41,26 +50,21 @@ import org.apache.zeppelin.notebook.Paragraph;
 import org.apache.zeppelin.scheduler.Job.Status;
 import org.apache.zeppelin.server.ZeppelinServer;
 import org.apache.zeppelin.user.AuthenticationInfo;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-/** Test against spark cluster. */
+/**
+ * Test against spark cluster.
+ */
 @RunWith(value = Parameterized.class)
 public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(ZeppelinSparkClusterTest.class);
 
-  // This is for only run setupSparkInterpreter one time for each spark version, otherwise
-  // each test method will run setupSparkInterpreter which will cost a long time and may cause
-  // travis
-  // ci timeout.
-  // TODO(zjffdu) remove this after we upgrade it to junit 4.13 (ZEPPELIN-3341)
+  //This is for only run setupSparkInterpreter one time for each spark version, otherwise
+  //each test method will run setupSparkInterpreter which will cost a long time and may cause travis
+  //ci timeout.
+  //TODO(zjffdu) remove this after we upgrade it to junit 4.13 (ZEPPELIN-3341)
   private static Set<String> verifiedSparkVersions = new HashSet<>();
+  
 
   private String sparkVersion;
   private AuthenticationInfo anonymous = new AuthenticationInfo("anonymous");
@@ -78,43 +82,47 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
 
   @Parameterized.Parameters
   public static List<Object[]> data() {
-    return Arrays.asList(new Object[][] {{"2.2.1"}, {"2.1.2"}, {"2.0.2"}, {"1.6.3"}});
+    return Arrays.asList(new Object[][]{
+        {"2.2.1"},
+        {"2.1.2"},
+        {"2.0.2"},
+        {"1.6.3"}
+    });
   }
 
   public void setupSparkInterpreter(String sparkHome) throws InterpreterException {
-    InterpreterSetting sparkIntpSetting =
-        ZeppelinServer.notebook.getInterpreterSettingManager().getInterpreterSettingByName("spark");
+    InterpreterSetting sparkIntpSetting = ZeppelinServer.notebook.getInterpreterSettingManager()
+        .getInterpreterSettingByName("spark");
 
     Map<String, InterpreterProperty> sparkProperties =
         (Map<String, InterpreterProperty>) sparkIntpSetting.getProperties();
     LOG.info("SPARK HOME detected " + sparkHome);
     if (System.getenv("SPARK_MASTER") != null) {
-      sparkProperties.put(
-          "master", new InterpreterProperty("master", System.getenv("SPARK_MASTER")));
+      sparkProperties.put("master",
+          new InterpreterProperty("master", System.getenv("SPARK_MASTER")));
     } else {
       sparkProperties.put("master", new InterpreterProperty("master", "local[2]"));
     }
     sparkProperties.put("SPARK_HOME", new InterpreterProperty("SPARK_HOME", sparkHome));
     sparkProperties.put("spark.master", new InterpreterProperty("spark.master", "local[2]"));
-    sparkProperties.put("spark.cores.max", new InterpreterProperty("spark.cores.max", "2"));
-    sparkProperties.put(
-        "zeppelin.spark.useHiveContext",
+    sparkProperties.put("spark.cores.max",
+        new InterpreterProperty("spark.cores.max", "2"));
+    sparkProperties.put("zeppelin.spark.useHiveContext",
         new InterpreterProperty("zeppelin.spark.useHiveContext", "false"));
-    sparkProperties.put(
-        "zeppelin.pyspark.useIPython",
-        new InterpreterProperty("zeppelin.pyspark.useIPython", "false"));
-    sparkProperties.put(
-        "zeppelin.spark.useNew", new InterpreterProperty("zeppelin.spark.useNew", "true"));
-    sparkProperties.put(
-        "zeppelin.spark.test", new InterpreterProperty("zeppelin.spark.test", "true"));
+    sparkProperties.put("zeppelin.pyspark.useIPython",
+            new InterpreterProperty("zeppelin.pyspark.useIPython", "false"));
+    sparkProperties.put("zeppelin.spark.useNew",
+            new InterpreterProperty("zeppelin.spark.useNew", "true"));
+    sparkProperties.put("zeppelin.spark.test",
+            new InterpreterProperty("zeppelin.spark.test", "true"));
 
     ZeppelinServer.notebook.getInterpreterSettingManager().restart(sparkIntpSetting.getId());
   }
 
   @BeforeClass
   public static void setUp() throws Exception {
-    System.setProperty(
-        ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), "helium");
+    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(),
+            "helium");
     AbstractTestRestApi.startUp(ZeppelinSparkClusterTest.class.getSimpleName());
   }
 
@@ -140,11 +148,15 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     // create new note
     Note note = ZeppelinServer.notebook.createNote(anonymous);
     Paragraph p = note.addNewParagraph(anonymous);
-    p.setText("%spark import java.util.Date\n" + "import java.net.URL\n" + "println(\"hello\")\n");
+    p.setText("%spark import java.util.Date\n" +
+        "import java.net.URL\n" +
+        "println(\"hello\")\n"
+    );
     note.run(p.getId(), true);
     assertEquals(Status.FINISHED, p.getStatus());
-    assertEquals(
-        "hello\n" + "import java.util.Date\n" + "import java.net.URL\n",
+    assertEquals("hello\n" +
+        "import java.util.Date\n" +
+        "import java.net.URL\n",
         p.getReturn().message().get(0).getData());
 
     p.setText("%spark invalid_code");
@@ -174,19 +186,17 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     Note note = ZeppelinServer.notebook.createNote(anonymous);
     // test basic dataframe api
     Paragraph p = note.addNewParagraph(anonymous);
-    p.setText("%spark val df=sqlContext.createDataFrame(Seq((\"hello\",20)))\n" + "df.collect()");
+    p.setText("%spark val df=sqlContext.createDataFrame(Seq((\"hello\",20)))\n" +
+        "df.collect()");
     note.run(p.getId(), true);
     assertEquals(Status.FINISHED, p.getStatus());
-    assertTrue(
-        p.getReturn()
-            .message()
-            .get(0)
-            .getData()
-            .contains("Array[org.apache.spark.sql.Row] = Array([hello,20])"));
+    assertTrue(p.getReturn().message().get(0).getData().contains(
+        "Array[org.apache.spark.sql.Row] = Array([hello,20])"));
 
     // test display DataFrame
     p = note.addNewParagraph(anonymous);
-    p.setText("%spark val df=sqlContext.createDataFrame(Seq((\"hello\",20)))\n" + "z.show(df)");
+    p.setText("%spark val df=sqlContext.createDataFrame(Seq((\"hello\",20)))\n" +
+        "z.show(df)");
     note.run(p.getId(), true);
     assertEquals(Status.FINISHED, p.getStatus());
     assertEquals(InterpreterResult.Type.TABLE, p.getReturn().message().get(0).getType());
@@ -195,7 +205,8 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     // test display DataSet
     if (isSpark2()) {
       p = note.addNewParagraph(anonymous);
-      p.setText("%spark val ds=spark.createDataset(Seq((\"hello\",20)))\n" + "z.show(ds)");
+      p.setText("%spark val ds=spark.createDataset(Seq((\"hello\",20)))\n" +
+          "z.show(ds)");
       note.run(p.getId(), true);
       assertEquals(Status.FINISHED, p.getStatus());
       assertEquals(InterpreterResult.Type.TABLE, p.getReturn().message().get(0).getType());
@@ -212,12 +223,10 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
       sqlContextName = "spark";
     }
     Paragraph p = note.addNewParagraph(anonymous);
-    p.setText(
-        "%spark.r localDF <- data.frame(name=c(\"a\", \"b\", \"c\"), age=c(19, 23, 18))\n"
-            + "df <- createDataFrame("
-            + sqlContextName
-            + ", localDF)\n"
-            + "count(df)");
+    p.setText("%spark.r localDF <- data.frame(name=c(\"a\", \"b\", \"c\"), age=c(19, 23, 18))\n" +
+        "df <- createDataFrame(" + sqlContextName + ", localDF)\n" +
+        "count(df)"
+    );
     note.run(p.getId(), true);
     assertEquals(Status.FINISHED, p.getStatus());
     assertEquals("[1] 3", p.getReturn().message().get(0).getData().trim());
@@ -237,20 +246,18 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     if (!isSpark2()) {
       // run sqlContext test
       p = note.addNewParagraph(anonymous);
-      p.setText(
-          "%pyspark from pyspark.sql import Row\n"
-              + "df=sqlContext.createDataFrame([Row(id=1, age=20)])\n"
-              + "df.collect()");
+      p.setText("%pyspark from pyspark.sql import Row\n" +
+          "df=sqlContext.createDataFrame([Row(id=1, age=20)])\n" +
+          "df.collect()");
       note.run(p.getId(), true);
       assertEquals(Status.FINISHED, p.getStatus());
       assertEquals("[Row(age=20, id=1)]\n", p.getReturn().message().get(0).getData());
 
       // test display Dataframe
       p = note.addNewParagraph(anonymous);
-      p.setText(
-          "%pyspark from pyspark.sql import Row\n"
-              + "df=sqlContext.createDataFrame([Row(id=1, age=20)])\n"
-              + "z.show(df)");
+      p.setText("%pyspark from pyspark.sql import Row\n" +
+          "df=sqlContext.createDataFrame([Row(id=1, age=20)])\n" +
+          "z.show(df)");
       note.run(p.getId(), true);
       waitForFinish(p);
       assertEquals(Status.FINISHED, p.getStatus());
@@ -260,36 +267,34 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
 
       // test udf
       p = note.addNewParagraph(anonymous);
-      p.setText(
-          "%pyspark sqlContext.udf.register(\"f1\", lambda x: len(x))\n"
-              + "sqlContext.sql(\"select f1(\\\"abc\\\") as len\").collect()");
+      p.setText("%pyspark sqlContext.udf.register(\"f1\", lambda x: len(x))\n" +
+          "sqlContext.sql(\"select f1(\\\"abc\\\") as len\").collect()");
       note.run(p.getId(), true);
       assertEquals(Status.FINISHED, p.getStatus());
-      assertTrue(
-          "[Row(len=u'3')]\n".equals(p.getReturn().message().get(0).getData())
-              || "[Row(len='3')]\n".equals(p.getReturn().message().get(0).getData()));
+      assertTrue("[Row(len=u'3')]\n".equals(p.getReturn().message().get(0).getData()) ||
+          "[Row(len='3')]\n".equals(p.getReturn().message().get(0).getData()));
 
       // test exception
       p = note.addNewParagraph(anonymous);
       /*
-      %pyspark
-      a=1
+       %pyspark
+       a=1
 
-      print(a2)
-      */
+       print(a2)
+       */
       p.setText("%pyspark a=1\n\nprint(a2)");
       note.run(p.getId(), true);
       assertEquals(Status.ERROR, p.getStatus());
-      assertTrue(
-          p.getReturn().message().get(0).getData().contains("Fail to execute line 3: print(a2)"));
-      assertTrue(p.getReturn().message().get(0).getData().contains("name 'a2' is not defined"));
+      assertTrue(p.getReturn().message().get(0).getData()
+          .contains("Fail to execute line 3: print(a2)"));
+      assertTrue(p.getReturn().message().get(0).getData()
+          .contains("name 'a2' is not defined"));
     } else {
       // run SparkSession test
       p = note.addNewParagraph(anonymous);
-      p.setText(
-          "%pyspark from pyspark.sql import Row\n"
-              + "df=sqlContext.createDataFrame([Row(id=1, age=20)])\n"
-              + "df.collect()");
+      p.setText("%pyspark from pyspark.sql import Row\n" +
+          "df=sqlContext.createDataFrame([Row(id=1, age=20)])\n" +
+          "df.collect()");
       note.run(p.getId(), true);
       assertEquals(Status.FINISHED, p.getStatus());
       assertEquals("[Row(age=20, id=1)]\n", p.getReturn().message().get(0).getData());
@@ -297,14 +302,12 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
       // test udf
       p = note.addNewParagraph(anonymous);
       // use SQLContext to register UDF but use this UDF through SparkSession
-      p.setText(
-          "%pyspark sqlContext.udf.register(\"f1\", lambda x: len(x))\n"
-              + "spark.sql(\"select f1(\\\"abc\\\") as len\").collect()");
+      p.setText("%pyspark sqlContext.udf.register(\"f1\", lambda x: len(x))\n" +
+          "spark.sql(\"select f1(\\\"abc\\\") as len\").collect()");
       note.run(p.getId(), true);
       assertEquals(Status.FINISHED, p.getStatus());
-      assertTrue(
-          "[Row(len=u'3')]\n".equals(p.getReturn().message().get(0).getData())
-              || "[Row(len='3')]\n".equals(p.getReturn().message().get(0).getData()));
+      assertTrue("[Row(len=u'3')]\n".equals(p.getReturn().message().get(0).getData()) ||
+          "[Row(len='3')]\n".equals(p.getReturn().message().get(0).getData()));
     }
   }
 
@@ -414,16 +417,11 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
 
     // register global hook & note1 hook
     Paragraph p1 = note.addNewParagraph(anonymous);
-    p1.setText(
-        "%python from __future__ import print_function\n"
-            + "z.registerHook('pre_exec', 'print(1)')\n"
-            + "z.registerHook('post_exec', 'print(2)')\n"
-            + "z.registerNoteHook('pre_exec', 'print(3)', '"
-            + note.getId()
-            + "')\n"
-            + "z.registerNoteHook('post_exec', 'print(4)', '"
-            + note.getId()
-            + "')\n");
+    p1.setText("%python from __future__ import print_function\n" +
+        "z.registerHook('pre_exec', 'print(1)')\n" +
+        "z.registerHook('post_exec', 'print(2)')\n" +
+        "z.registerNoteHook('pre_exec', 'print(3)', '" + note.getId() + "')\n" +
+        "z.registerNoteHook('post_exec', 'print(4)', '" + note.getId() + "')\n");
 
     Paragraph p2 = note.addNewParagraph(anonymous);
     p2.setText("%python print(5)");
@@ -466,15 +464,10 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     if (isSpark2()) {
       sqlContextName = "spark";
     }
-    p1.setText(
-        "%pyspark\n"
-            + "from pyspark.sql import SQLContext\n"
-            + "print("
-            + sqlContextName
-            + ".read.format('com.databricks.spark.csv')"
-            + ".load('file://"
-            + tmpFile.getAbsolutePath()
-            + "').count())");
+    p1.setText("%pyspark\n" +
+        "from pyspark.sql import SQLContext\n" +
+        "print(" + sqlContextName + ".read.format('com.databricks.spark.csv')" +
+        ".load('file://" + tmpFile.getAbsolutePath() + "').count())");
     note.run(p1.getId(), true);
 
     assertEquals(Status.FINISHED, p1.getStatus());
@@ -506,14 +499,13 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
   public void testSparkZeppelinContextDynamicForms() throws IOException {
     Note note = ZeppelinServer.notebook.createNote(anonymous);
     Paragraph p = note.addNewParagraph(anonymous);
-    String code =
-        "%spark.spark println(z.textbox(\"my_input\", \"default_name\"))\n"
-            + "println(z.password(\"my_pwd\"))\n"
-            + "println(z.select(\"my_select\", \"1\","
-            + "Seq((\"1\", \"select_1\"), (\"2\", \"select_2\"))))\n"
-            + "val items=z.checkbox(\"my_checkbox\", Seq(\"2\"), "
-            + "Seq((\"1\", \"check_1\"), (\"2\", \"check_2\")))\n"
-            + "println(items(0))";
+    String code = "%spark.spark println(z.textbox(\"my_input\", \"default_name\"))\n" +
+        "println(z.password(\"my_pwd\"))\n" +
+        "println(z.select(\"my_select\", \"1\"," +
+        "Seq((\"1\", \"select_1\"), (\"2\", \"select_2\"))))\n" +
+        "val items=z.checkbox(\"my_checkbox\", Seq(\"2\"), " +
+        "Seq((\"1\", \"check_1\"), (\"2\", \"check_2\")))\n" +
+        "println(items(0))";
     p.setText(code);
     note.run(p.getId());
     waitForFinish(p);
@@ -539,14 +531,13 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
   public void testPySparkZeppelinContextDynamicForms() throws IOException {
     Note note = ZeppelinServer.notebook.createNote(anonymous);
     Paragraph p = note.addNewParagraph(anonymous);
-    String code =
-        "%spark.pyspark print(z.input('my_input', 'default_name'))\n"
-            + "print(z.password('my_pwd'))\n"
-            + "print(z.select('my_select', "
-            + "[('1', 'select_1'), ('2', 'select_2')], defaultValue='1'))\n"
-            + "items=z.checkbox('my_checkbox', "
-            + "[('1', 'check_1'), ('2', 'check_2')], defaultChecked=['2'])\n"
-            + "print(items[0])";
+    String code = "%spark.pyspark print(z.input('my_input', 'default_name'))\n" +
+        "print(z.password('my_pwd'))\n" +
+        "print(z.select('my_select', " +
+        "[('1', 'select_1'), ('2', 'select_2')], defaultValue='1'))\n" +
+        "items=z.checkbox('my_checkbox', " +
+        "[('1', 'check_1'), ('2', 'check_2')], defaultChecked=['2'])\n" +
+        "print(items[0])";
     p.setText(code);
     note.run(p.getId(), true);
 
@@ -575,11 +566,8 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     p1.setText("%spark z.angularBind(\"name\", \"world\")");
     note.run(p1.getId(), true);
     assertEquals(Status.FINISHED, p1.getStatus());
-    List<AngularObject> angularObjects =
-        p1.getBindedInterpreter()
-            .getInterpreterGroup()
-            .getAngularObjectRegistry()
-            .getAll(note.getId(), null);
+    List<AngularObject> angularObjects = p1.getBindedInterpreter().getInterpreterGroup()
+            .getAngularObjectRegistry().getAll(note.getId(), null);
     assertEquals(1, angularObjects.size());
     assertEquals("name", angularObjects.get(0).getName());
     assertEquals("world", angularObjects.get(0).get());
@@ -589,10 +577,7 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     p2.setText("%spark z.angularUnbind(\"name\")");
     note.run(p2.getId(), true);
     assertEquals(Status.FINISHED, p2.getStatus());
-    angularObjects =
-        p1.getBindedInterpreter()
-            .getInterpreterGroup()
-            .getAngularObjectRegistry()
+    angularObjects = p1.getBindedInterpreter().getInterpreterGroup().getAngularObjectRegistry()
             .getAll(note.getId(), null);
     assertEquals(0, angularObjects.size());
 
@@ -601,11 +586,8 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     p3.setText("%spark z.angularBindGlobal(\"name2\", \"world2\")");
     note.run(p3.getId(), true);
     assertEquals(Status.FINISHED, p3.getStatus());
-    List<AngularObject> globalAngularObjects =
-        p3.getBindedInterpreter()
-            .getInterpreterGroup()
-            .getAngularObjectRegistry()
-            .getAll(null, null);
+    List<AngularObject> globalAngularObjects = p3.getBindedInterpreter().getInterpreterGroup()
+            .getAngularObjectRegistry().getAll(null, null);
     assertEquals(1, globalAngularObjects.size());
     assertEquals("name2", globalAngularObjects.get(0).getName());
     assertEquals("world2", globalAngularObjects.get(0).get());
@@ -615,11 +597,8 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
     p4.setText("%spark z.angularUnbindGlobal(\"name2\")");
     note.run(p4.getId(), true);
     assertEquals(Status.FINISHED, p4.getStatus());
-    globalAngularObjects =
-        p4.getBindedInterpreter()
-            .getInterpreterGroup()
-            .getAngularObjectRegistry()
-            .getAll(note.getId(), null);
+    globalAngularObjects = p4.getBindedInterpreter().getInterpreterGroup()
+            .getAngularObjectRegistry().getAll(note.getId(), null);
     assertEquals(0, globalAngularObjects.size());
   }
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/security/DirAccessTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/security/DirAccessTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/security/DirAccessTest.java
index 471b3e9..dc281bc 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/security/DirAccessTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/security/DirAccessTest.java
@@ -19,16 +19,17 @@ package org.apache.zeppelin.security;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.GetMethod;
+import org.junit.Test;
+
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.rest.AbstractTestRestApi;
-import org.junit.Test;
 
 public class DirAccessTest extends AbstractTestRestApi {
   @Test
   public void testDirAccessForbidden() throws Exception {
     synchronized (this) {
-      System.setProperty(
-          ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED.getVarName(), "false");
+      System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED
+              .getVarName(), "false");
       AbstractTestRestApi.startUp(DirAccessTest.class.getSimpleName());
       HttpClient httpClient = new HttpClient();
       GetMethod getMethod = new GetMethod(getUrlToTest() + "/app/");
@@ -41,8 +42,8 @@ public class DirAccessTest extends AbstractTestRestApi {
   @Test
   public void testDirAccessOk() throws Exception {
     synchronized (this) {
-      System.setProperty(
-          ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED.getVarName(), "true");
+      System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED
+              .getVarName(), "true");
       AbstractTestRestApi.startUp(DirAccessTest.class.getSimpleName());
       HttpClient httpClient = new HttpClient();
       GetMethod getMethod = new GetMethod(getUrlToTest() + "/app/");
@@ -60,3 +61,4 @@ public class DirAccessTest extends AbstractTestRestApi {
     return url;
   }
 }
+

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/security/SecurityUtilsTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/security/SecurityUtilsTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/security/SecurityUtilsTest.java
index e005d4c..0c535b9 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/security/SecurityUtilsTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/security/SecurityUtilsTest.java
@@ -44,7 +44,8 @@ import sun.security.acl.PrincipalImpl;
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(org.apache.shiro.SecurityUtils.class)
 public class SecurityUtilsTest {
-  @Mock org.apache.shiro.subject.Subject subject;
+  @Mock
+  org.apache.shiro.subject.Subject subject;
 
   @Test
   public void isInvalid() throws URISyntaxException, UnknownHostException {
@@ -53,11 +54,9 @@ public class SecurityUtilsTest {
 
   @Test
   public void isInvalidFromConfig()
-      throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertFalse(
-        SecurityUtils.isValidOrigin(
-            "http://otherinvalidhost.com",
-            new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertFalse(SecurityUtils.isValidOrigin("http://otherinvalidhost.com",
+          new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
   }
 
   @Test
@@ -68,64 +67,54 @@ public class SecurityUtilsTest {
   @Test
   public void isLocalMachine() throws URISyntaxException, UnknownHostException {
     String origin = "http://" + InetAddress.getLocalHost().getHostName();
-    assertTrue(
-        "Origin " + origin + " is not allowed. Please check your hostname.",
-        SecurityUtils.isValidOrigin(origin, ZeppelinConfiguration.create()));
+    assertTrue("Origin " + origin + " is not allowed. Please check your hostname.",
+               SecurityUtils.isValidOrigin(origin, ZeppelinConfiguration.create()));
   }
 
   @Test
   public void isValidFromConfig()
-      throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertTrue(
-        SecurityUtils.isValidOrigin(
-            "http://otherhost.com",
-            new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertTrue(SecurityUtils.isValidOrigin("http://otherhost.com",
+           new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
   }
 
   @Test
   public void isValidFromStar()
-      throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertTrue(
-        SecurityUtils.isValidOrigin(
-            "http://anyhost.com",
-            new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site-star.xml"))));
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertTrue(SecurityUtils.isValidOrigin("http://anyhost.com",
+           new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site-star.xml"))));
   }
 
   @Test
-  public void nullOrigin() throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertFalse(
-        SecurityUtils.isValidOrigin(
-            null, new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
+  public void nullOrigin()
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertFalse(SecurityUtils.isValidOrigin(null,
+          new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
   }
 
   @Test
   public void nullOriginWithStar()
-      throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertTrue(
-        SecurityUtils.isValidOrigin(
-            null,
-            new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site-star.xml"))));
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertTrue(SecurityUtils.isValidOrigin(null,
+        new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site-star.xml"))));
   }
 
   @Test
   public void emptyOrigin()
-      throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertFalse(
-        SecurityUtils.isValidOrigin(
-            "", new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertFalse(SecurityUtils.isValidOrigin("",
+          new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
   }
 
   @Test
   public void notAURIOrigin()
-      throws URISyntaxException, UnknownHostException, ConfigurationException {
-    assertFalse(
-        SecurityUtils.isValidOrigin(
-            "test123",
-            new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
+          throws URISyntaxException, UnknownHostException, ConfigurationException {
+    assertFalse(SecurityUtils.isValidOrigin("test123",
+          new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"))));
   }
 
   @Test
-  public void canGetPrincipalName() {
+  public void canGetPrincipalName()  {
     String expectedName = "java.security.Principal.getName()";
     setupPrincipalName(expectedName);
     assertEquals(expectedName, SecurityUtils.getPrincipal());
@@ -134,11 +123,11 @@ public class SecurityUtilsTest {
   @Test
   public void testUsernameForceLowerCase() throws IOException, InterruptedException {
     String expectedName = "java.security.Principal.getName()";
-    System.setProperty(
-        ZeppelinConfiguration.ConfVars.ZEPPELIN_USERNAME_FORCE_LOWERCASE.getVarName(),
-        String.valueOf(true));
+    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_USERNAME_FORCE_LOWERCASE
+        .getVarName(), String.valueOf(true));
     setupPrincipalName(expectedName);
     assertEquals(expectedName.toLowerCase(), SecurityUtils.getPrincipal());
+
   }
 
   private void setupPrincipalName(String expectedName) {
@@ -170,4 +159,6 @@ public class SecurityUtilsTest {
     modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
     field.set(null, newValue);
   }
+
+
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/server/CorsFilterTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/server/CorsFilterTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/server/CorsFilterTest.java
index da9decd..ff713ea 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/server/CorsFilterTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/server/CorsFilterTest.java
@@ -21,17 +21,21 @@ import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
 import java.io.IOException;
+
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
-/** Basic CORS REST API tests. */
+/**
+ * Basic CORS REST API tests.
+ */
 public class CorsFilterTest {
   public static String[] headers = new String[8];
   public static Integer count = 0;
@@ -48,17 +52,14 @@ public class CorsFilterTest {
     when(mockRequest.getServerName()).thenReturn("localhost");
     count = 0;
 
-    doAnswer(
-            new Answer() {
-              @Override
-              public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
-                headers[count] = invocationOnMock.getArguments()[1].toString();
-                count++;
-                return null;
-              }
-            })
-        .when(mockResponse)
-        .setHeader(anyString(), anyString());
+    doAnswer(new Answer() {
+        @Override
+        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
+            headers[count] = invocationOnMock.getArguments()[1].toString();
+            count++;
+            return null;
+        }
+    }).when(mockResponse).setHeader(anyString(), anyString());
 
     filter.doFilter(mockRequest, mockResponse, mockedFilterChain);
     Assert.assertTrue(headers[0].equals("http://localhost:8080"));
@@ -75,17 +76,14 @@ public class CorsFilterTest {
     when(mockRequest.getMethod()).thenReturn("Empty");
     when(mockRequest.getServerName()).thenReturn("evillocalhost");
 
-    doAnswer(
-            new Answer() {
-              @Override
-              public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
-                headers[count] = invocationOnMock.getArguments()[1].toString();
-                count++;
-                return null;
-              }
-            })
-        .when(mockResponse)
-        .setHeader(anyString(), anyString());
+    doAnswer(new Answer() {
+        @Override
+        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
+            headers[count] = invocationOnMock.getArguments()[1].toString();
+            count++;
+            return null;
+        }
+    }).when(mockResponse).setHeader(anyString(), anyString());
 
     filter.doFilter(mockRequest, mockResponse, mockedFilterChain);
     Assert.assertTrue(headers[0].equals(""));

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java
index f94c573..ee4f4fc 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/service/ConfigurationServiceTest.java
@@ -15,17 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.zeppelin.service;
 
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.verify;
+package org.apache.zeppelin.service;
 
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Map;
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.rest.AbstractTestRestApi;
 import org.apache.zeppelin.server.ZeppelinServer;
@@ -34,6 +26,16 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Map;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+
 public class ConfigurationServiceTest extends AbstractTestRestApi {
 
   private static ConfigurationService configurationService;
@@ -45,8 +47,8 @@ public class ConfigurationServiceTest extends AbstractTestRestApi {
 
   @BeforeClass
   public static void setUp() throws Exception {
-    System.setProperty(
-        ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(), "helium");
+    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HELIUM_REGISTRY.getVarName(),
+        "helium");
     AbstractTestRestApi.startUp(ConfigurationServiceTest.class.getSimpleName());
     configurationService = ZeppelinServer.notebookWsServer.getConfigurationService();
   }