zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jongy...@apache.org
Subject zeppelin git commit: [ZEPPELIN-1542] Cleanup of Note created during jUnit test in zeppelin-server, zeppelin-zengine
Date Tue, 18 Oct 2016 09:20:48 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 6e3a1d26f -> 1214463c6


[ZEPPELIN-1542]  Cleanup of Note created during jUnit test in zeppelin-server, zeppelin-zengine

### What is this PR for?
While running jUnit tests in zeppelin-server & zeppelin-zengine projects, several note
are created during the process and those notes are never purged after the execution of the
tests.

### What type of PR is it?
Bug Fix

### Todos

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1542

### How should this be tested?
Prerequisites:
1. Get the list of note that already exist in server.

Now build zeppelin project by running maven commands(mvn clean package)(mvn clean package
-pl 'zeppelin-interpreter,zeppelin-zengine,zeppelin-server').
1. Now no extra note should get created after running the maven command

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: rajarajan-g <rajarajan.ganesan@imaginea.com>

Closes #1524 from rajarajan-g/ZEPPELIN-1542 and squashes the following commits:

d97cb4a [rajarajan-g] code changes for ZEPPELIN-1542


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/1214463c
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/1214463c
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/1214463c

Branch: refs/heads/master
Commit: 1214463c66062e8c3d31b460fd3c734b8a50a1bc
Parents: 6e3a1d2
Author: rajarajan-g <rajarajan.ganesan@imaginea.com>
Authored: Fri Oct 14 14:31:12 2016 +0530
Committer: Jongyoul Lee <jongyoul@apache.org>
Committed: Tue Oct 18 18:20:33 2016 +0900

----------------------------------------------------------------------
 .../zeppelin/rest/ZeppelinRestApiTest.java      |  2 ++
 .../apache/zeppelin/notebook/NotebookTest.java  | 20 ++++++++++++++++++++
 .../notebook/repo/NotebookRepoSyncTest.java     |  5 ++++-
 .../notebook/repo/VFSNotebookRepoTest.java      |  1 +
 4 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1214463c/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 ad48b50..ffcbf2a 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
@@ -105,6 +105,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
 
     assertTrue(paragraphs.size() > 0);
     assertEquals(paragraphText, paragraphs.get(0).get("text"));
+    //
+    ZeppelinServer.notebook.removeNote(sourceNoteID, null);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1214463c/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
index 7d7ae34..86d6c06 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
@@ -126,6 +126,7 @@ public class NotebookTest implements JobListenerFactory{
     note.run(p2.getId());
     while(p2.isTerminated()==false || p2.getResult()==null) Thread.yield();
     assertEquals("repl2: hello world", p2.getResult().message());
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -209,6 +210,7 @@ public class NotebookTest implements JobListenerFactory{
         new InterpreterFactory(conf, null, null, null, depResolver), this, null, null, null);
 
     assertEquals(1, notebook2.getAllNotes().size());
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -221,6 +223,7 @@ public class NotebookTest implements JobListenerFactory{
     Set<String> owners = new HashSet<>();
     owners.add("user1");
     assertEquals(owners, notebook.getNotebookAuthorization().getOwners(note.getId()));
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -239,6 +242,7 @@ public class NotebookTest implements JobListenerFactory{
     // clear paragraph output/result
     note.clearParagraphOutput(p1.getId());
     assertNull(p1.getResult());
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -309,6 +313,7 @@ public class NotebookTest implements JobListenerFactory{
     assertNotNull(dateFinished);
     Thread.sleep(1 * 1000);
     assertEquals(dateFinished, p.getDateFinished());
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -361,6 +366,7 @@ public class NotebookTest implements JobListenerFactory{
     // make sure all paragraph has been executed
     assertNotNull(p.getDateFinished());
     assertNotNull(p2.getDateFinished());
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -397,6 +403,9 @@ public class NotebookTest implements JobListenerFactory{
     Set<String> owners = new HashSet<>();
     owners.add("user1");
     assertEquals(owners, notebook.getNotebookAuthorization().getOwners(importedNote2.getId()));
+    notebook.removeNote(note.getId(), null);
+    notebook.removeNote(importedNote.getId(), null);
+    notebook.removeNote(importedNote2.getId(), null);
   }
 
   @Test
@@ -428,6 +437,9 @@ public class NotebookTest implements JobListenerFactory{
     Set<String> owners = new HashSet<>();
     owners.add("user1");
     assertEquals(owners, notebook.getNotebookAuthorization().getOwners(cloneNote2.getId()));
+    notebook.removeNote(note.getId(), null);
+    notebook.removeNote(cloneNote.getId(), null);
+    notebook.removeNote(cloneNote2.getId(), null);
   }
 
   @Test
@@ -438,6 +450,8 @@ public class NotebookTest implements JobListenerFactory{
 
     Note cloneNote = notebook.cloneNote(note.getId(), null, null);
     assertEquals(cloneNote.getName(), "Note " + cloneNote.getId());
+    notebook.removeNote(note.getId(), null);
+    notebook.removeNote(cloneNote.getId(), null);
   }
 
   @Test
@@ -462,6 +476,8 @@ public class NotebookTest implements JobListenerFactory{
     assertEquals(cp.getId(), p.getId());
     assertEquals(cp.text, p.text);
     assertNull(cp.getResult());
+    notebook.removeNote(note.getId(), null);
+    notebook.removeNote(cloneNote.getId(), null);
   }
 
   @Test
@@ -555,6 +571,7 @@ public class NotebookTest implements JobListenerFactory{
     // notebook scope and global object sould be remained
     assertNotNull(registry.get("o2", note.getId(), null));
     assertNotNull(registry.get("o3", null, null));
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -664,6 +681,7 @@ public class NotebookTest implements JobListenerFactory{
     }
 
     assertTrue(isAborted);
+    notebook.removeNote(note.getId(), null);
   }
 
   @Test
@@ -872,6 +890,8 @@ public class NotebookTest implements JobListenerFactory{
     assertEquals(0, notebook.getAllNotes(new AuthenticationInfo("anonymous")).size());
     assertEquals(1, notebook.getAllNotes(new AuthenticationInfo("user1")).size());
     assertEquals(1, notebook.getAllNotes(new AuthenticationInfo("user2")).size());
+    notebook.removeNote(note1.getId(), null);
+    notebook.removeNote(note2.getId(), null);
   }
 
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1214463c/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
index 95b9209..5a3915c 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
@@ -129,7 +129,8 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
     assertEquals(1, notebookRepoSync.list(0, null).size());
     assertEquals(1, notebookRepoSync.list(1, null).size());
     assertEquals(notebookRepoSync.list(0, null).get(0).getId(),notebookRepoSync.list(1, null).get(0).getId());
-    
+
+    notebookSync.removeNote(notebookRepoSync.list(0, null).get(0).getId(), null);
   }
 
   @Test
@@ -194,6 +195,7 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
         notebookRepoSync.list(0, null).get(0).getId(), null).getLastParagraph().getId());
     assertEquals(p1.getId(), notebookRepoSync.get(1,
         notebookRepoSync.list(1, null).get(0).getId(), null).getLastParagraph().getId());
+    notebookRepoSync.remove(note.getId(), null);
   }
 
   @Test
@@ -306,6 +308,7 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
     vRepoSync.save(note, null);
     vRepoSync.checkpoint(noteId, "checkpoint message 2", null);
     assertThat(gitRepo.revisionHistory(noteId, null).size()).isEqualTo(vCount + 1);
+    notebookRepoSync.remove(note.getId(), null);
   }
   
   static void delete(File file){

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1214463c/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
index 7eaca8c..9fc2d82 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
@@ -135,6 +135,7 @@ public class VFSNotebookRepoTest implements JobListenerFactory {
     note.setName("SaveTest");
     notebookRepo.save(note, null);
     assertEquals(note.getName(), "SaveTest");
+    notebookRepo.remove(note.getId(), null);
   }
 
   class NotebookWriter implements Runnable {


Mime
View raw message