zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject zeppelin git commit: [ZEPPELIN-3691] Scheduled note continues to work in the trash
Date Tue, 18 Sep 2018 00:49:37 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.8 f17d76ed8 -> b66c4d4dd


[ZEPPELIN-3691] Scheduled note continues to work in the trash

Fix bug with scheduled note working in the trash.

How to repeat bug:
1. Make scheduled note with cron;
2. Move it to trash;
3. Restart zeppelin.

Bug Fix

[ZEPPELIN-3691](https://issues.apache.org/jira/browse/ZEPPELIN-3691)

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

Author: oxygen311 <alex39-09@mail.ru>

Closes #3117 from oxygen311/DW-17950 and squashes the following commits:

074613701 [oxygen311] Merge branch 'master' of https://github.com/apache/zeppelin into DW-17950-cronTrash
27f92e29f [oxygen311] Add test for cron note in trash
b3e7d0c99 [oxygen311] Check is note in trash in `refreshCron`

(cherry picked from commit 76ac9614234ac0ed9107a3bac9f1c2bf2aa2c349)
Signed-off-by: Jeff Zhang <zjffdu@apache.org>


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

Branch: refs/heads/branch-0.8
Commit: b66c4d4ddb3838a037041f13c223458c23371ed2
Parents: f17d76e
Author: oxygen311 <alex39-09@mail.ru>
Authored: Mon Aug 20 13:12:14 2018 +0200
Committer: Jeff Zhang <zjffdu@apache.org>
Committed: Tue Sep 18 08:49:26 2018 +0800

----------------------------------------------------------------------
 .../org/apache/zeppelin/notebook/Notebook.java  |  3 ++-
 .../apache/zeppelin/notebook/NotebookTest.java  | 23 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b66c4d4d/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
index 02bf919..0a4b494 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
@@ -86,6 +86,7 @@ public class Notebook implements NoteEventListener {
   private StdSchedulerFactory quertzSchedFact;
   private org.quartz.Scheduler quartzSched;
   private JobListenerFactory jobListenerFactory;
+
   private NotebookRepo notebookRepo;
   private SearchService noteSearchService;
   private NotebookAuthorization notebookAuthorization;
@@ -968,7 +969,7 @@ public class Notebook implements NoteEventListener {
     synchronized (notes) {
 
       Note note = notes.get(id);
-      if (note == null) {
+      if (note == null || note.isTrash()) {
         return;
       }
       Map<String, Object> config = note.getConfig();

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b66c4d4d/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 7327bfc..6167513 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
@@ -51,6 +51,7 @@ import org.junit.runner.Request;
 import org.junit.runner.Result;
 import org.mockito.internal.runners.JUnit44RunnerImpl;
 import org.quartz.SchedulerException;
+import org.quartz.impl.matchers.GroupMatcher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.sonatype.aether.RepositoryException;
@@ -691,6 +692,28 @@ public class NotebookTest extends AbstractInterpreterTest implements
JobListener
   }
 
   @Test
+  public void testCronNoteInTrash() throws InterruptedException, IOException, SchedulerException
{
+    Note note = notebook.createNote(anonymous);
+    note.setName("~Trash/NotCron");
+
+    Map<String, Object> config = note.getConfig();
+    config.put("enabled", true);
+    config.put("cron", "* * * * * ?");
+    note.setConfig(config);
+
+    final int jobsBeforeRefresh = notebook.quartzSched.getJobKeys(GroupMatcher.anyGroup()).size();
+    notebook.refreshCron(note.getId());
+    final int jobsAfterRefresh = notebook.quartzSched.getJobKeys(GroupMatcher.anyGroup()).size();
+
+    assertEquals(jobsBeforeRefresh, jobsAfterRefresh);
+
+    // remove cron scheduler.
+    config.remove("cron");
+    notebook.refreshCron(note.getId());
+    notebook.removeNote(note.getId(), anonymous);
+  }
+
+  @Test
   public void testExportAndImportNote() throws IOException, CloneNotSupportedException,
           InterruptedException, InterpreterException, SchedulerException, RepositoryException
{
     Note note = notebook.createNote(anonymous);


Mime
View raw message