usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [38/50] [abbrv] incubator-usergrid git commit: Fix to ensure tests passes when run multiple times without clearing database.
Date Mon, 08 Dec 2014 21:24:20 GMT
Fix to ensure tests passes when run multiple times without clearing database.


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

Branch: refs/heads/two-dot-o-events
Commit: 8088c63f392d30d6248a0c25a3d9fb552c915489
Parents: e71a68f
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Mon Dec 8 09:55:38 2014 -0500
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Mon Dec 8 09:55:38 2014 -0500

----------------------------------------------------------------------
 .../apache/usergrid/persistence/CounterIT.java  | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8088c63f/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 470a6f2..ab7d41e 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
@@ -187,6 +187,15 @@ public class CounterIT extends AbstractCoreIT {
 
         EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId()
);
 
+        // get counts at start of test
+        Query query = new Query();
+        query.addCounterFilter( "admin.logins:*:*:*" );
+        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();
+
         Map<String, Long> counts = em.getApplicationCounters();
         long originalAdminLoginsCount = counts.get( "admin.logins" ).longValue();
 
@@ -240,17 +249,9 @@ public class CounterIT extends AbstractCoreIT {
         assertEquals( 1, 
             r.getCounters().get( 0 ).getValues().get( 0 ).getValue()  - originalAdminLoginsCount
);
 
-        // counts = em.getEntityCounters(organizationEntity.getUuid());
-        // LOG.info(JsonUtils.mapToJsonString(counts));
-        Query query = new Query();
-        query.addCounterFilter( "admin.logins:*:*:*" );
-        query.setStartTime( ts );
-        query.setFinishTime( System.currentTimeMillis() );
-        query.setResolution( CounterResolution.SIX_HOUR );
-        //query.setPad(true);
-
         r = em.getAggregateCounters( query );
         LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) );
-        assertEquals( 1, r.getCounters().get( 0 ).getValues().get( 0 ).getValue() );
+        assertEquals( 1, 
+            r.getCounters().get( 0 ).getValues().get( 0 ).getValue() - originalCount );
     }
 }


Mime
View raw message