Removed the type checking for integers since updateStatistics is only used once for guaranteed
longs.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/9edfda62
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/9edfda62
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/9edfda62
Branch: refs/heads/release-2.1.1
Commit: 9edfda620eefae7ce74a54ac1eff24b94d02094c
Parents: 987ffdc
Author: George Reyes <grey@apache.org>
Authored: Mon May 9 12:19:28 2016 -0700
Committer: George Reyes <grey@apache.org>
Committed: Mon May 9 12:19:28 2016 -0700
----------------------------------------------------------------------
.../usergrid/persistence/entities/Notification.java | 11 ++++++-----
.../applications/collection/CollectionsResourceIT.java | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9edfda62/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
index bb2e03f..c4867c3 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Notification.java
@@ -308,12 +308,13 @@ public class Notification extends TypedEntity {
this.statistics.put("sent", sent);
this.statistics.put("errors", errors);
} else {
- if(this.statistics.get( "sent" ) instanceof Integer){
- this.statistics.put( "sent", sent + (Integer) this.statistics.get( "sent"
) );
- this.statistics.put( "errors", errors + (Integer) this.statistics.get( "errors"
) );
- }
- else if (this.statistics.get( "sent" ) instanceof Long ) {
+ //Don't need to account for integers here because this is only called internally
+ //We won't ever need to call updateStatistics for a postedNotification as that
only happens once
+ //after the notification is completed.
+ if (this.statistics.get( "sent" ) instanceof Long ) {
this.statistics.put( "sent", sent + (Long) this.statistics.get( "sent" )
);
+ }
+ if( this.statistics.get( "errors" ) instanceof Long){
this.statistics.put( "errors", errors + (Long) this.statistics.get( "errors"
) );
}
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/9edfda62/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index 0908f5c..690cec2 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -1118,7 +1118,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
Map statistics = new HashMap<>( );
statistics.put( "sent",1 );
- statistics.put( "errors",0 );
+ statistics.put( "errors",2 );
Entity payload = new Entity();
payload.put("debug", false);
|