usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [47/50] [abbrv] incubator-usergrid git commit: Fix in original value test logic.
Date Mon, 08 Dec 2014 21:24:29 GMT
Fix in original value test logic.


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

Branch: refs/heads/two-dot-o-events
Commit: e29a99e8bce2610a9281fe89de23b5c5b4ec72ba
Parents: 2016476
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Mon Dec 8 15:46:18 2014 -0500
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Mon Dec 8 15:46:18 2014 -0500

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/CounterIT.java  | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e29a99e8/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
index ab7d41e..e360244 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
@@ -1,4 +1,5 @@
 /*
+
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -193,11 +194,22 @@ public class CounterIT extends AbstractCoreIT {
         query.setStartTime( ts );
         query.setFinishTime( System.currentTimeMillis() );
         query.setResolution( CounterResolution.SIX_HOUR );
+
         Results or = em.getAggregateCounters( query );
-        long originalCount =  or.getCounters().get( 0 ).getValues().get( 0 ).getValue();
+        final long originalCount;
+        if ( or.getCounters().get( 0 ).getValues().isEmpty() ) {
+            originalCount = 0;
+        } else {
+            originalCount = or.getCounters().get( 0 ).getValues().get( 0 ).getValue();
+        }
 
         Map<String, Long> counts = em.getApplicationCounters();
-        long originalAdminLoginsCount = counts.get( "admin.logins" ).longValue();
+        final long originalAdminLoginsCount;
+        if ( counts.get( "admin.logins" ) == null ) {
+            originalAdminLoginsCount = 0;
+        } else {
+            originalAdminLoginsCount = counts.get( "admin.logins" );
+        }
 
         String randomSuffix = RandomStringUtils.randomAlphabetic(20); 
         String orgName = "testCounter" + randomSuffix;


Mime
View raw message