You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/10/07 21:27:28 UTC

[12/17] git commit: fixing tests

fixing tests


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

Branch: refs/heads/two-dot-o-events
Commit: ba47088b9efed03eaca1a480a58e4e33b93a4e2b
Parents: 9c1e4ab
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Oct 7 11:28:57 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Oct 7 11:28:57 2014 -0600

----------------------------------------------------------------------
 .../services/notifications/ApplicationQueueManager.java       | 2 +-
 .../apache/usergrid/services/notifications/QueueListener.java | 4 +++-
 .../apache/usergrid/services/notifications/TaskManager.java   | 7 ++++---
 3 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba47088b/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
index b36d1fe..7728111 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/ApplicationQueueManager.java
@@ -230,7 +230,7 @@ public class ApplicationQueueManager  {
         if (deviceCount.get() <= 0) {
             TaskManager taskManager = new TaskManager(em, this, notification);
             //if i'm in a test value will be false, do not mark finished for test orchestration, not ideal need real tests
-            taskManager.finishedBatch(false);
+            taskManager.finishedBatch(false,false);
         }
 
         em.update(notification);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba47088b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
index a69afe2..cfeebf5 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/QueueListener.java
@@ -126,7 +126,9 @@ public class QueueListener  {
     }
 
     private void execute(){
-        Thread.currentThread().setDaemon(true);
+        if(Thread.currentThread().isDaemon()) {
+            Thread.currentThread().setDaemon(true);
+        }
         Thread.currentThread().setName("Notifications_Processor"+UUID.randomUUID());
 
         final AtomicInteger consecutiveExceptions = new AtomicInteger();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ba47088b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
index 0baa17f..4b55e95 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/TaskManager.java
@@ -135,9 +135,9 @@ public class TaskManager {
         }
     }
     public void finishedBatch() throws Exception {
-        finishedBatch(true);
+        finishedBatch(true,true);
     }
-    public void finishedBatch(boolean update) throws Exception {
+    public void finishedBatch(boolean update, boolean fetch) throws Exception {
         long successes = this.successes.get(); //reset counters
         long failures = this.failures.get(); //reset counters
         for (int i = 0; i < successes; i++) {
@@ -150,7 +150,8 @@ public class TaskManager {
         this.hasFinished = true;
 
         // refresh notification
-        Notification notification = em.get(this.notification.getUuid(), Notification.class);
+        if(fetch)
+            notification = em.get(this.notification.getUuid(), Notification.class);
         notification.setModified(System.currentTimeMillis());
 
         //and write them out again, this will produce the most accurate count