usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [3/4] git commit: tests passing
Date Sat, 04 Oct 2014 01:11:57 GMT
tests passing


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

Branch: refs/heads/sqs_queues
Commit: 5be329d0dd5050ec72355874e69291f43cc794de
Parents: fadf527
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Fri Oct 3 18:25:06 2014 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Fri Oct 3 18:25:06 2014 -0600

----------------------------------------------------------------------
 .../usergrid/services/notifications/QueueListener.java    |  7 +------
 .../usergrid/services/notifications/TaskManager.java      | 10 ++++------
 .../notifications/apns/NotificationsServiceIT.java        |  2 +-
 3 files changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5be329d0/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 a9e0702..6aacf74 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
@@ -138,7 +138,7 @@ public class QueueListener  {
                 LOG.info("getting from queue {} ", queueName);
                 QueueScope queueScope = new QueueScopeImpl(new SimpleId(smf.getManagementAppId(),"notifications"),queueName);
                 QueueManager queueManager = queueManagerFactory.getQueueManager(queueScope);
-                List<QueueMessage> messages = getDeliveryBatch(queueManager);
+                List<QueueMessage> messages = queueManager.getMessages(getBatchSize(),MESSAGE_TRANSACTION_TIMEOUT);
                 LOG.info("QueueListener: retrieved batch of {} messages from queue {} ",
messages.size(),queueName);
 
                 if (messages.size() > 0) {
@@ -222,11 +222,6 @@ public class QueueListener  {
         pool.shutdownNow();
     }
 
-    private  List<QueueMessage> getDeliveryBatch(QueueManager queueManager) throws
Exception {
-
-        List<QueueMessage> results = queueManager.getMessages(getBatchSize(),MESSAGE_TRANSACTION_TIMEOUT);
-        return results;
-    }
 
     public void setBatchSize(int batchSize){
         this.batchSize = batchSize;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5be329d0/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 42bd65c..7c70634 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
@@ -62,7 +62,9 @@ public class TaskManager {
         LOG.debug("REMOVED {}", deviceUUID);
         try {
             LOG.debug("notification {} removing device {} from remaining", notification.getUuid(),
deviceUUID);
-
+            if(queueManager!=null){
+                queueManager.commitMessage(messageMap.get(deviceUUID));
+            }
 
             EntityRef deviceRef = new SimpleEntityRef(Device.ENTITY_TYPE, deviceUUID);
             if (receipt != null) {
@@ -146,11 +148,7 @@ public class TaskManager {
     }
 
     public void finishedBatch() throws Exception {
-        if(queueManager!=null){
-            List<QueueMessage> list = new ArrayList<QueueMessage>();
-            list.addAll(messageMap.values());
-            queueManager.commitMessages(list);
-        }
+
         long successes = this.successes.getAndSet(0); //reset counters
         long failures = this.failures.getAndSet(0); //reset counters
         this.hasFinished = true;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5be329d0/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 12d0925..1a8d8f9 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -181,7 +181,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
 
         // verify Query for CREATED state
         Query query = new Query();
-        query.addEqualityFilter("state", Notification.State.FINISHED.toString());
+        query.addEqualityFilter("state", Notification.State.STARTED.toString());
         Results results = app.getEm().searchCollection(
                 app.getEm().getApplicationRef(), "notifications", query);
         Entity entity = results.getEntitiesMap().get(notification.getUuid());


Mime
View raw message