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/12/09 17:38:58 UTC

[02/15] incubator-usergrid git commit: Fix broken tests that could not be run multiple times without deleting all data from C* and ES after each run.

Fix broken tests that could not be run multiple times without deleting all data from C* and ES after each run.


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

Branch: refs/heads/delete_from_all_indexes
Commit: 26774448a2ff824d2f3ea2f924ef0ee3e30a4875
Parents: c4973e9
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Dec 5 15:28:05 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Dec 5 15:28:05 2014 -0500

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        | 230 ++++++++++---------
 .../corepersistence/util/CpEntityMapUtils.java  |  32 ++-
 .../batch/job/SchedulerRuntimeIntervalIT.java   |  47 ++--
 .../migration/EntityTypeMappingMigrationIT.java |  87 +++----
 .../apache/usergrid/persistence/CounterIT.java  |  62 +++--
 .../usergrid/persistence/CountingMutatorIT.java |   4 +-
 .../persistence/EntityDictionaryIT.java         |  11 +-
 .../usergrid/persistence/EntityManagerIT.java   |  47 ++--
 .../persistence/GeoQueryBooleanTest.java        |   7 +-
 .../apache/usergrid/persistence/IndexIT.java    |  14 +-
 .../usergrid/persistence/PathQueryIT.java       |   5 +-
 .../PerformanceEntityRebuildIndexTest.java      |   6 +-
 .../usergrid/persistence/PermissionsIT.java     |   5 +-
 .../cassandra/EntityManagerFactoryImplIT.java   |   9 +-
 .../query/AbstractIteratingQueryIT.java         |   3 +-
 stack/core/src/test/resources/log4j.properties  |   5 +-
 .../data/DataMigrationManagerImpl.java          |  29 ++-
 .../persistence/index/IndexIdentifier.java      |   4 +
 .../index/impl/EsEntityIndexImpl.java           |  80 ++++---
 19 files changed, 386 insertions(+), 301 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index b2d854b..4c5ff0a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -69,7 +69,6 @@ import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.exception.WriteOptimisticVerifyException;
 import org.apache.usergrid.persistence.collection.exception.WriteUniqueVerifyException;
-import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.Health;
 import org.apache.usergrid.persistence.entities.Application;
@@ -215,23 +214,24 @@ public class CpEntityManager implements EntityManager {
         // set to false for now
         this.skipAggregateCounters = false;
 
-        int entityCacheSize =
-                Integer.parseInt( cass.getProperties().getProperty( "usergrid.entity_cache_size", "100" ) );
+        int entityCacheSize = Integer.parseInt( cass.getProperties()
+                .getProperty( "usergrid.entity_cache_size", "100" ) );
 
-        int entityCacheTimeout =
-                Integer.parseInt( cass.getProperties().getProperty( "usergrid.entity_cache_timeout_ms", "500" ) );
+        int entityCacheTimeout = Integer.parseInt( cass.getProperties()
+                .getProperty( "usergrid.entity_cache_timeout_ms", "500" ) );
 
-        this.entityCache = CacheBuilder.newBuilder().maximumSize( entityCacheSize )
-                                       .expireAfterWrite( entityCacheTimeout, TimeUnit.MILLISECONDS )
-                                       .build( new CacheLoader<EntityScope, org.apache.usergrid.persistence.model
-                                               .entity.Entity>() {
-                                                   public org.apache.usergrid.persistence.model.entity.Entity load(
-                                                           EntityScope es ) {
-                                                       return managerCache.getEntityCollectionManager( es.scope )
-                                                                          .load( es.entityId ).toBlocking()
-                                                                          .lastOrDefault( null );
-                                                   }
-                                               } );
+        this.entityCache = CacheBuilder.newBuilder()
+            .maximumSize(entityCacheSize)
+            .expireAfterWrite(entityCacheTimeout, TimeUnit.MILLISECONDS)
+            .build( new CacheLoader<EntityScope, org.apache.usergrid.persistence.model.entity.Entity>() {
+
+                public org.apache.usergrid.persistence.model.entity.Entity load( EntityScope es) {
+                        return managerCache.getEntityCollectionManager(es.scope)
+                            .load(es.entityId).toBlocking()
+                            .lastOrDefault(null);
+                    }
+                }
+            );
     }
 
 
@@ -374,7 +374,8 @@ public class CpEntityManager implements EntityManager {
 
         Id id = new SimpleId( entityRef.getUuid(), entityRef.getType() );
 
-        CollectionScope collectionScope = getCollectionScopeNameFromEntityType(applicationScope.getApplication(),  entityRef.getType());
+        CollectionScope collectionScope = getCollectionScopeNameFromEntityType(
+                applicationScope.getApplication(),  entityRef.getType());
 
 
         //        if ( !UUIDUtils.isTimeBased( id.getUuid() ) ) {
@@ -583,7 +584,8 @@ public class CpEntityManager implements EntityManager {
 
     private Observable deleteAsync( EntityRef entityRef ) throws Exception {
 
-        CollectionScope collectionScope = getCollectionScopeNameFromEntityType(applicationScope.getApplication(), entityRef.getType()  );
+        CollectionScope collectionScope = getCollectionScopeNameFromEntityType(
+                applicationScope.getApplication(), entityRef.getType()  );
 
         EntityCollectionManager ecm = managerCache.getEntityCollectionManager( collectionScope );
 
@@ -1374,8 +1376,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Entity createItemInCollection( EntityRef entityRef, String collectionName, String itemType,
-                                          Map<String, Object> props ) throws Exception {
+    public Entity createItemInCollection( EntityRef entityRef, String collectionName, 
+            String itemType, Map<String, Object> props ) throws Exception {
 
         return getRelationManager( entityRef ).createItemInCollection( collectionName, itemType, props );
     }
@@ -1420,8 +1422,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public ConnectionRef createConnection( EntityRef connectingEntity, String pairedConnectionType,
-                                           EntityRef pairedEntity, String connectionType, EntityRef connectedEntityRef )
+    public ConnectionRef createConnection( EntityRef connectingEntity, String pairedConnectionType, 
+            EntityRef pairedEntity, String connectionType, EntityRef connectedEntityRef )
             throws Exception {
 
         return getRelationManager( connectingEntity )
@@ -1447,8 +1449,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public ConnectionRef connectionRef( EntityRef connectingEntity, String pairedConnectionType, EntityRef pairedEntity,
-                                        String connectionType, EntityRef connectedEntityRef ) throws Exception {
+    public ConnectionRef connectionRef( EntityRef connectingEntity, String pairedConnectionType, 
+            EntityRef pairedEntity, String connectionType, EntityRef connectedEntityRef ) throws Exception {
 
         return getRelationManager( connectingEntity )
                 .connectionRef( pairedConnectionType, pairedEntity, connectionType, connectedEntityRef );
@@ -1479,8 +1481,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Results getConnectedEntities( EntityRef entityRef, String connectionType, String connectedEntityType,
-                                         Level resultsLevel ) throws Exception {
+    public Results getConnectedEntities( EntityRef entityRef, String connectionType, 
+            String connectedEntityType, Level resultsLevel ) throws Exception {
 
         return getRelationManager( entityRef )
                 .getConnectedEntities( connectionType, connectedEntityType, resultsLevel );
@@ -1488,8 +1490,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Results getConnectingEntities( EntityRef entityRef, String connectionType, String connectedEntityType,
-                                          Level resultsLevel ) throws Exception {
+    public Results getConnectingEntities( EntityRef entityRef, String connectionType, 
+            String connectedEntityType, Level resultsLevel ) throws Exception {
 
         return getRelationManager( entityRef )
                 .getConnectingEntities( connectionType, connectedEntityType, resultsLevel );
@@ -1497,8 +1499,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Results getConnectingEntities( EntityRef entityRef, String connectionType, String entityType, Level level,
-                                          int count ) throws Exception {
+    public Results getConnectingEntities( EntityRef entityRef, String connectionType,
+            String entityType, Level level, int count ) throws Exception {
 
         return getRelationManager( entityRef ).getConnectingEntities( connectionType, entityType, level, count );
     }
@@ -1592,8 +1594,8 @@ public class CpEntityManager implements EntityManager {
     }
 
 
-    private Entity batchCreateRole( String roleName, String roleTitle, long inactivity, String propertyName,
-                                    UUID ownerId, Map<String, Object> additionalProperties ) throws Exception {
+    private Entity batchCreateRole( String roleName, String roleTitle, long inactivity, 
+            String propertyName, UUID ownerId, Map<String, Object> additionalProperties ) throws Exception {
 
         UUID timestampUuid = UUIDUtils.newTimeUUID();
         long timestamp = UUIDUtils.getUUIDLong( timestampUuid );
@@ -1615,9 +1617,11 @@ public class CpEntityManager implements EntityManager {
 
         Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
         CassandraPersistenceUtils.addInsertToMutator( batch, ENTITY_DICTIONARIES,
-                CassandraPersistenceUtils.key( ownerId, Schema.DICTIONARY_ROLENAMES ), roleName, roleTitle, timestamp );
+                CassandraPersistenceUtils.key( ownerId, 
+                        Schema.DICTIONARY_ROLENAMES ), roleName, roleTitle, timestamp );
         CassandraPersistenceUtils.addInsertToMutator( batch, ENTITY_DICTIONARIES,
-                CassandraPersistenceUtils.key( ownerId, Schema.DICTIONARY_ROLETIMES ), roleName, inactivity,
+                CassandraPersistenceUtils.key( ownerId, 
+                        Schema.DICTIONARY_ROLETIMES ), roleName, inactivity,
                 timestamp );
         CassandraPersistenceUtils.addInsertToMutator( batch, ENTITY_DICTIONARIES,
                 CassandraPersistenceUtils.key( ownerId, DICTIONARY_SETS ), Schema.DICTIONARY_ROLENAMES, null,
@@ -1635,9 +1639,8 @@ public class CpEntityManager implements EntityManager {
         permission = permission.toLowerCase();
         long timestamp = cass.createTimestamp();
         Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
-        CassandraPersistenceUtils
-                .addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, getRolePermissionsKey( roleName ),
-                        permission, ByteBuffer.allocate( 0 ), timestamp );
+        CassandraPersistenceUtils.addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, 
+            getRolePermissionsKey( roleName ), permission, ByteBuffer.allocate( 0 ), timestamp );
         CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT );
     }
 
@@ -1650,16 +1653,16 @@ public class CpEntityManager implements EntityManager {
         Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
         for ( String permission : permissions ) {
             permission = permission.toLowerCase();
-            CassandraPersistenceUtils
-                    .addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, getRolePermissionsKey( roleName ),
-                            permission, ByteBuffer.allocate( 0 ), timestamp );
+            CassandraPersistenceUtils.addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, 
+                getRolePermissionsKey( roleName ), permission, ByteBuffer.allocate( 0 ), timestamp);
         }
         CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT );
     }
 
 
     private Object getRolePermissionsKey( String roleName ) {
-        return CassandraPersistenceUtils.key( SimpleRoleRef.getIdForRoleName( roleName ), DICTIONARY_PERMISSIONS );
+        return CassandraPersistenceUtils.key( 
+                SimpleRoleRef.getIdForRoleName( roleName ), DICTIONARY_PERMISSIONS );
     }
 
 
@@ -1680,10 +1683,9 @@ public class CpEntityManager implements EntityManager {
         roleName = roleName.toLowerCase();
         permission = permission.toLowerCase();
         long timestamp = cass.createTimestamp();
-        Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
-        CassandraPersistenceUtils
-                .addDeleteToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, getRolePermissionsKey( roleName ),
-                        permission, timestamp );
+        Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be);
+        CassandraPersistenceUtils.addDeleteToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES, 
+                getRolePermissionsKey( roleName ), permission, timestamp );
         CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT );
     }
 
@@ -1691,8 +1693,8 @@ public class CpEntityManager implements EntityManager {
     @Override
     public Set<String> getRolePermissions( String roleName ) throws Exception {
         roleName = roleName.toLowerCase();
-        return cass.getAllColumnNames( cass.getApplicationKeyspace( applicationId ), ApplicationCF.ENTITY_DICTIONARIES,
-                getRolePermissionsKey( roleName ) );
+        return cass.getAllColumnNames( cass.getApplicationKeyspace( applicationId ), 
+                ApplicationCF.ENTITY_DICTIONARIES, getRolePermissionsKey( roleName ) );
     }
 
 
@@ -1747,7 +1749,7 @@ public class CpEntityManager implements EntityManager {
         long timestamp = cass.createTimestamp();
         Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
         CassandraPersistenceUtils.addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES,
-                getRolePermissionsKey( groupId, roleName ), permission, ByteBuffer.allocate( 0 ), timestamp );
+            getRolePermissionsKey( groupId, roleName ), permission, ByteBuffer.allocate( 0 ), timestamp );
         CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT );
     }
 
@@ -1767,8 +1769,8 @@ public class CpEntityManager implements EntityManager {
     @Override
     public Set<String> getGroupRolePermissions( UUID groupId, String roleName ) throws Exception {
         roleName = roleName.toLowerCase();
-        return cass.getAllColumnNames( cass.getApplicationKeyspace( applicationId ), ApplicationCF.ENTITY_DICTIONARIES,
-                getRolePermissionsKey( groupId, roleName ) );
+        return cass.getAllColumnNames( cass.getApplicationKeyspace( applicationId ), 
+                ApplicationCF.ENTITY_DICTIONARIES, getRolePermissionsKey( groupId, roleName ) );
     }
 
 
@@ -1810,8 +1812,8 @@ public class CpEntityManager implements EntityManager {
 
     @Override
     public Set<String> getUserPermissions( UUID userId ) throws Exception {
-        return cast(
-                getDictionaryAsSet( new SimpleEntityRef( User.ENTITY_TYPE, userId ), Schema.DICTIONARY_PERMISSIONS ) );
+        return cast(getDictionaryAsSet( 
+                new SimpleEntityRef( User.ENTITY_TYPE, userId ), Schema.DICTIONARY_PERMISSIONS ) );
     }
 
 
@@ -1891,23 +1893,23 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public void incrementAggregateCounters( UUID userId, UUID groupId, String category, String counterName,
-                                            long value ) {
+    public void incrementAggregateCounters( UUID userId, UUID groupId, String category, 
+            String counterName, long value ) {
 
         long cassandraTimestamp = cass.createTimestamp();
         incrementAggregateCounters( userId, groupId, category, counterName, value, cassandraTimestamp );
     }
 
 
-    private void incrementAggregateCounters( UUID userId, UUID groupId, String category, String counterName, long value,
-                                             long cassandraTimestamp ) {
+    private void incrementAggregateCounters( UUID userId, UUID groupId, String category, 
+            String counterName, long value, long cassandraTimestamp ) {
+
         // TODO short circuit
         if ( !skipAggregateCounters ) {
             Mutator<ByteBuffer> m = createMutator( cass.getApplicationKeyspace( applicationId ), be );
 
-            counterUtils
-                    .batchIncrementAggregateCounters( m, applicationId, userId, groupId, null, category, counterName,
-                            value, cassandraTimestamp / 1000, cassandraTimestamp );
+            counterUtils.batchIncrementAggregateCounters( m, applicationId, userId, groupId, null, 
+                    category, counterName, value, cassandraTimestamp / 1000, cassandraTimestamp );
 
             CassandraPersistenceUtils.batchExecute( m, CassandraService.RETRY_COUNT );
         }
@@ -1915,16 +1917,16 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Results getAggregateCounters( UUID userId, UUID groupId, String category, String counterName,
-                                         CounterResolution resolution, long start, long finish, boolean pad ) {
-        return this
-                .getAggregateCounters( userId, groupId, null, category, counterName, resolution, start, finish, pad );
+    public Results getAggregateCounters( UUID userId, UUID groupId, String category, 
+            String counterName, CounterResolution resolution, long start, long finish, boolean pad ) {
+        return this.getAggregateCounters( 
+                userId, groupId, null, category, counterName, resolution, start, finish, pad );
     }
 
 
     @Override
-    public Results getAggregateCounters( UUID userId, UUID groupId, UUID queueId, String category, String counterName,
-                                         CounterResolution resolution, long start, long finish, boolean pad ) {
+    public Results getAggregateCounters( UUID userId, UUID groupId, UUID queueId, String category, 
+        String counterName, CounterResolution resolution, long start, long finish, boolean pad ) {
 
         start = resolution.round( start );
         finish = resolution.round( finish );
@@ -2030,8 +2032,8 @@ public class CpEntityManager implements EntityManager {
                 }
             }
             CounterUtils.AggregateCounterSelection selection = selections.get( r.getKey() );
-            countSets.add( new AggregateCounterSet( selection.getName(), selection.getUserId(), selection.getGroupId(),
-                    selection.getCategory(), counters ) );
+            countSets.add( new AggregateCounterSet( selection.getName(), selection.getUserId(), 
+                    selection.getGroupId(), selection.getCategory(), counters ) );
         }
 
         Collections.sort( countSets, new Comparator<AggregateCounterSet>() {
@@ -2059,8 +2061,8 @@ public class CpEntityManager implements EntityManager {
             return new SimpleEntityRef( "user", identifier.getUUID() );
         }
         if ( identifier.isName() ) {
-            return this.getAlias( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ), "user",
-                    identifier.getName() );
+            return this.getAlias( new SimpleEntityRef( 
+                    Application.ENTITY_TYPE, applicationId ), "user", identifier.getName() );
         }
         if ( identifier.isEmail() ) {
 
@@ -2150,8 +2152,8 @@ public class CpEntityManager implements EntityManager {
         if ( !skipAggregateCounters ) {
             long timestamp = cass.createTimestamp();
             Mutator<ByteBuffer> m = createMutator( cass.getApplicationKeyspace( applicationId ), be );
-            counterUtils.batchIncrementAggregateCounters( m, applicationId, userId, groupId, null, category, counters,
-                    timestamp );
+            counterUtils.batchIncrementAggregateCounters( 
+                    m, applicationId, userId, groupId, null, category, counters, timestamp );
 
             CassandraPersistenceUtils.batchExecute( m, CassandraService.RETRY_COUNT );
         }
@@ -2173,13 +2175,14 @@ public class CpEntityManager implements EntityManager {
     private Id getIdForUniqueEntityField( final String collectionName, final String propertyName,
                                           final Object propertyValue ) {
 
-        CollectionScope collectionScope = getCollectionScopeNameFromEntityType(applicationScope.getApplication(), collectionName);
+        CollectionScope collectionScope = getCollectionScopeNameFromEntityType(
+                applicationScope.getApplication(), collectionName);
 
         final EntityCollectionManager ecm = managerCache.getEntityCollectionManager( collectionScope );
 
         //convert to a string, that's what we store
-        final Id results = ecm.getIdField( new StringField( propertyName, propertyValue.toString() ) ).toBlocking()
-                              .lastOrDefault( null );
+        final Id results = ecm.getIdField( new StringField( 
+                propertyName, propertyValue.toString() ) ).toBlocking() .lastOrDefault( null );
 
         return results;
     }
@@ -2370,8 +2373,8 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public <A extends Entity> A batchCreate( Mutator<ByteBuffer> ignored, String entityType, Class<A> entityClass,
-                                             Map<String, Object> properties, UUID importId, UUID timestampUuid )
+    public <A extends Entity> A batchCreate( Mutator<ByteBuffer> ignored, String entityType, 
+            Class<A> entityClass, Map<String, Object> properties, UUID importId, UUID timestampUuid )
             throws Exception {
 
         String eType = Schema.normalizeEntityType( entityType );
@@ -2502,10 +2505,15 @@ public class CpEntityManager implements EntityManager {
         EntityCollectionManager ecm = managerCache.getEntityCollectionManager( collectionScope );
 
         if ( logger.isDebugEnabled() ) {
-            logger.debug( "Writing entity {}:{} into scope\n   app {}\n   owner {}\n   name {} data {}", new Object[] {
-                            entity.getType(), entity.getUuid(), collectionScope.getApplication(),
-                            collectionScope.getOwner(), collectionScope.getName(), CpEntityMapUtils.toMap( cpEntity )
-                    } );
+            logger.debug( "Writing entity {}:{} into scope\n   app {}\n   owner {}\n   name {} data {}", 
+                new Object[] {
+                    entity.getType(), 
+                    entity.getUuid(), 
+                    collectionScope.getApplication(),
+                    collectionScope.getOwner(), 
+                    collectionScope.getName(), 
+                    CpEntityMapUtils.toMap( cpEntity )
+                } );
             //
             //            if ( entity.getType().equals("group")) {
             //                logger.debug("Writing Group");
@@ -2575,18 +2583,20 @@ public class CpEntityManager implements EntityManager {
 
     private void incrementEntityCollection( String collection_name, long cassandraTimestamp ) {
         try {
-            incrementAggregateCounters( null, null, null, APPLICATION_COLLECTION + collection_name, ONE_COUNT,
-                    cassandraTimestamp );
+            incrementAggregateCounters( null, null, null, 
+                    APPLICATION_COLLECTION + collection_name, ONE_COUNT, cassandraTimestamp );
         }
         catch ( Exception e ) {
             logger.error( "Unable to increment counter application.collection: {}.",
                     new Object[] { collection_name, e } );
         }
         try {
-            incrementAggregateCounters( null, null, null, APPLICATION_ENTITIES, ONE_COUNT, cassandraTimestamp );
+            incrementAggregateCounters( null, null, null, 
+                    APPLICATION_ENTITIES, ONE_COUNT, cassandraTimestamp );
         }
         catch ( Exception e ) {
-            logger.error( "Unable to increment counter application.entities for collection: " + "{} with timestamp: {}",
+            logger.error( "Unable to increment counter application.entities for collection: " 
+                    + "{} with timestamp: {}",
                     new Object[] { collection_name, cassandraTimestamp, e } );
         }
     }
@@ -2612,26 +2622,26 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Mutator<ByteBuffer> batchSetProperty( Mutator<ByteBuffer> batch, EntityRef entity, String propertyName,
-                                                 Object propertyValue, UUID timestampUuid ) throws Exception {
+    public Mutator<ByteBuffer> batchSetProperty( Mutator<ByteBuffer> batch, EntityRef entity, 
+            String propertyName, Object propertyValue, UUID timestampUuid ) throws Exception {
 
         throw new UnsupportedOperationException( "Not supported yet." );
     }
 
 
     @Override
-    public Mutator<ByteBuffer> batchSetProperty( Mutator<ByteBuffer> batch, EntityRef entity, String propertyName,
-                                                 Object propertyValue, boolean force, boolean noRead,
-                                                 UUID timestampUuid ) throws Exception {
+    public Mutator<ByteBuffer> batchSetProperty( Mutator<ByteBuffer> batch, EntityRef entity, 
+            String propertyName, Object propertyValue, boolean force, boolean noRead, 
+            UUID timestampUuid ) throws Exception {
 
         throw new UnsupportedOperationException( "Not supported yet." );
     }
 
 
     @Override
-    public Mutator<ByteBuffer> batchUpdateDictionary( Mutator<ByteBuffer> batch, EntityRef entity,
-                                                      String dictionaryName, Object elementValue, Object elementCoValue,
-                                                      boolean removeFromDictionary, UUID timestampUuid )
+    public Mutator<ByteBuffer> batchUpdateDictionary( Mutator<ByteBuffer> batch, EntityRef entity, 
+            String dictionaryName, Object elementValue, Object elementCoValue,
+            boolean removeFromDictionary, UUID timestampUuid )
             throws Exception {
 
         long timestamp = UUIDUtils.getUUIDLong( timestampUuid );
@@ -2641,31 +2651,34 @@ public class CpEntityManager implements EntityManager {
             elementCoValue = ByteBuffer.allocate( 0 );
         }
 
-        boolean entityHasDictionary = Schema.getDefaultSchema().hasDictionary( entity.getType(), dictionaryName );
+        boolean entityHasDictionary = Schema.getDefaultSchema()
+                .hasDictionary( entity.getType(), dictionaryName );
 
         // Don't index dynamic dictionaries not defined by the schema
         if ( entityHasDictionary ) {
-            getRelationManager( entity )
-                    .batchUpdateSetIndexes( batch, dictionaryName, elementValue, removeFromDictionary, timestampUuid );
+            getRelationManager( entity ).batchUpdateSetIndexes(
+                    batch, dictionaryName, elementValue, removeFromDictionary, timestampUuid );
         }
 
-        ApplicationCF dictionary_cf = entityHasDictionary ? ENTITY_DICTIONARIES : ENTITY_COMPOSITE_DICTIONARIES;
+        ApplicationCF dictionary_cf = entityHasDictionary 
+                ? ENTITY_DICTIONARIES : ENTITY_COMPOSITE_DICTIONARIES;
 
         if ( elementValue != null ) {
             if ( !removeFromDictionary ) {
                 // Set the new value
 
-                elementCoValue =
-                        CassandraPersistenceUtils.toStorableBinaryValue( elementCoValue, !entityHasDictionary );
+                elementCoValue = CassandraPersistenceUtils.toStorableBinaryValue( 
+                        elementCoValue, !entityHasDictionary );
 
                 CassandraPersistenceUtils.addInsertToMutator( batch, dictionary_cf,
                         CassandraPersistenceUtils.key( entity.getUuid(), dictionaryName ),
-                        entityHasDictionary ? elementValue : asList( elementValue ), elementCoValue, timestamp );
+                        entityHasDictionary ? elementValue : asList( elementValue ), 
+                        elementCoValue, timestamp );
 
                 if ( !entityHasDictionary ) {
                     CassandraPersistenceUtils.addInsertToMutator( batch, ENTITY_DICTIONARIES,
-                            CassandraPersistenceUtils.key( entity.getUuid(), DICTIONARY_SETS ), dictionaryName, null,
-                            timestamp );
+                            CassandraPersistenceUtils.key( entity.getUuid(), DICTIONARY_SETS ), 
+                            dictionaryName, null, timestamp );
                 }
             }
             else {
@@ -2680,20 +2693,19 @@ public class CpEntityManager implements EntityManager {
 
 
     @Override
-    public Mutator<ByteBuffer> batchUpdateDictionary( Mutator<ByteBuffer> batch, EntityRef entity,
-                                                      String dictionaryName, Object elementValue,
-                                                      boolean removeFromDictionary, UUID timestampUuid )
+    public Mutator<ByteBuffer> batchUpdateDictionary( Mutator<ByteBuffer> batch, EntityRef entity, 
+            String dictionaryName, Object elementValue, boolean removeFromDictionary, 
+            UUID timestampUuid )
             throws Exception {
 
-        return batchUpdateDictionary( batch, entity, dictionaryName, elementValue, null, removeFromDictionary,
-                timestampUuid );
+        return batchUpdateDictionary( batch, entity, dictionaryName, elementValue, null, 
+                removeFromDictionary, timestampUuid );
     }
 
 
     @Override
-    public Mutator<ByteBuffer> batchUpdateProperties( Mutator<ByteBuffer> batch, EntityRef entity,
-                                                      Map<String, Object> properties, UUID timestampUuid )
-            throws Exception {
+    public Mutator<ByteBuffer> batchUpdateProperties( Mutator<ByteBuffer> batch, EntityRef entity, 
+            Map<String, Object> properties, UUID timestampUuid ) throws Exception {
 
         throw new UnsupportedOperationException( "Not supported yet." );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpEntityMapUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpEntityMapUtils.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpEntityMapUtils.java
index ba59154..344bcd3 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpEntityMapUtils.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpEntityMapUtils.java
@@ -139,38 +139,54 @@ public class CpEntityMapUtils {
 
         // is the map really a location element?
         if ("location" .equals(fieldName.toString().toLowerCase()) ) {
+
             // get the object to inspect
-            Map<String, Object> m = (Map<String, Object>) value;
-            // should have two elements
-            if (m.size() == 2) {
+            Map<String, Object> origMap = (Map<String, Object>) value;
+            Map<String, Object> m = new HashMap<String, Object>();
+
+            // Tests expect us to treat "Longitude" the same as "longitude"
+            for ( String key : origMap.keySet() ) {
+                m.put( key.toLowerCase(), origMap.get(key) );
+            }
+
+            // Expect at least two fields in a Location object
+            if (m.size() >= 2) {
+
                 Double lat = null;
                 Double lon = null;
+
                 // check the properties to make sure they are set and are doubles
                 if (m.get("latitude") != null && m.get("longitude") != null) {
                     try {
                         lat = Double.parseDouble(m.get("latitude").toString());
                         lon = Double.parseDouble(m.get("longitude").toString());
+
                     } catch (NumberFormatException ignored) {
-                        throw new IllegalArgumentException("Latitude and longitude must be doubles (e.g. 32.1234).");
+                        throw new IllegalArgumentException(
+                                "Latitude and longitude must be doubles (e.g. 32.1234).");
                     }
                 } else if (m.get("lat") != null && m.get("lon") != null) {
                     try {
                         lat = Double.parseDouble(m.get("lat").toString());
                         lon = Double.parseDouble(m.get("lon").toString());
                     } catch (NumberFormatException ignored) {
-                        throw new IllegalArgumentException("Latitude and longitude must be doubles (e.g. 32.1234).");
+                        throw new IllegalArgumentException(""
+                                + "Latitude and longitude must be doubles (e.g. 32.1234).");
                     }
                 } else {
-                    throw new IllegalArgumentException("Location properties require two fields - latitude and longitude, or lat and lon");
+                    throw new IllegalArgumentException("Location properties require two fields - "
+                            + "latitude and longitude, or lat and lon");
                 }
 
                 if (lat != null && lon != null) {
                     entity.setField( new LocationField(fieldName, new Location(lat, lon)));
                 } else {
-                    throw new IllegalArgumentException("Unable to parse location field properties - make sure they conform - lat and lon, and should be doubles.");
+                    throw new IllegalArgumentException( "Unable to parse location field properties "
+                            + "- make sure they conform - lat and lon, and should be doubles.");
                 }
             } else {
-                throw new IllegalArgumentException("Location properties require two fields - latitude and longitude, or lat and lon.");
+                throw new IllegalArgumentException("Location properties requires two fields - "
+                        + "latitude and longitude, or lat and lon.");
             }
         } else {
             // not a location element, process it as map

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
index 351ca7b..b6544d7 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/SchedulerRuntimeIntervalIT.java
@@ -32,75 +32,58 @@ import static org.junit.Assert.assertTrue;
 
 
 /**
- * Class to test job that the run loop executes in the time expected when there's no jobs to run.  Tests
- * saturation at each point of the runtime as well
+ * Class to test job that the run loop executes in the time expected when there's no jobs to run.  
+ * Tests saturation at each point of the runtime as well
  */
 @Concurrent
 public class SchedulerRuntimeIntervalIT extends AbstractSchedulerRuntimeIT {
 	
-	private static final Logger logger = LoggerFactory.getLogger(SchedulerRuntimeIntervalIT.class.getName());
+	private static final Logger logger = 
+            LoggerFactory.getLogger(SchedulerRuntimeIntervalIT.class.getName());
 
     private static final long EXPECTED_RUNTIME = 60000;
-
-
 //    private static final long EXPECTED_RUNTIME = 3000000;
 
 
     /**
-     * This is a combination of ( count+1 ) * interval*2.  If this test takes longer than this to run, we have a bug in how
-     * often the run loop is executing
-     * @throws InterruptedException
+     * This is a combination of ( count+1 ) * interval*2.  If this test takes longer than this 
+     * to run, we have a bug in how often the run loop is executing
      */
     @Test(timeout = EXPECTED_RUNTIME)
     public void runLoopTest() throws InterruptedException {
 
-        /**
-         * the number of iterations we should run
-         *
-         */
+        // the number of iterations we should run
         final int pollCount = 5;
         final int expectedInterval = 5000;
 
-
-
-
-        JobSchedulerService schedulerService = cassandraResource.getBean( JobSchedulerService.class );
+        JobSchedulerService schedulerService = cassandraResource.getBean(JobSchedulerService.class);
 
         final long interval = schedulerService.getInterval();
-
         final int numberOfWorkers = schedulerService.getWorkerSize();
-
         final int expectedExecutions = numberOfWorkers * pollCount;
 
-
-        assertEquals("Interval must be set to "+ expectedInterval + " for test to work properly", expectedInterval, interval);
-
+        assertEquals("Interval must be set to "+ expectedInterval 
+                + " for test to work properly", expectedInterval, interval);
 
         CountdownLatchJob counterJob = cassandraResource.getBean( CountdownLatchJob.class );
             // set the counter job latch size
         counterJob.setLatch( expectedExecutions );
 
-
         getJobListener().setExpected(expectedExecutions );
 
-
         long fireTime = System.currentTimeMillis();
 
-        /**
-         * We want to space the jobs out so there will most likely be an empty poll phase.  For each run where we do
-         * get jobs, we want to saturate the worker pool to ensure the semaphore is release properly
-         */
+         // We want to space the jobs out so there will most likely be an empty poll phase.  
+         // For each run where we do get jobs, we want to saturate the worker pool to ensure the 
+        // semaphore is release properly
         for ( int i = 0; i < pollCount; i++ ) {
 
             for(int j = 0; j < numberOfWorkers; j ++){
                 scheduler.createJob( "countdownLatch", fireTime, new JobData() );
             }
-
-
             fireTime += expectedInterval*2;
         }
 
-
         boolean waited = counterJob.waitForCount(EXPECTED_RUNTIME, TimeUnit.MILLISECONDS);
 
         assertTrue( "Ran" + getCount() + " number of jobs", waited);
@@ -109,7 +92,7 @@ public class SchedulerRuntimeIntervalIT extends AbstractSchedulerRuntimeIT {
         	logger.warn("Jobs not yet finished after waited {}, block again" , waitTime);
         }
 
-        //If we get to here without timing out, the test ran correctly.  The assertion is implicit in the timeout
-        
+        // If we get to here without timing out, the test ran correctly.  
+        // The assertion is implicit in the timeout
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
index 3a52b96..837997c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/EntityTypeMappingMigrationIT.java
@@ -68,7 +68,8 @@ public class EntityTypeMappingMigrationIT extends AbstractCoreIT {
      * Rule to do the resets we need
      */
     @Rule
-    public MigrationTestRule migrationTestRule = new MigrationTestRule( app, CpSetup.getInjector() ,EntityTypeMappingMigration.class  );
+    public MigrationTestRule migrationTestRule = new MigrationTestRule( 
+            app, CpSetup.getInjector() ,EntityTypeMappingMigration.class  );
 
 
 
@@ -111,7 +112,9 @@ public class EntityTypeMappingMigrationIT extends AbstractCoreIT {
         keyspace.truncateColumnFamily( MapSerializationImpl.MAP_ENTRIES );
         keyspace.truncateColumnFamily( MapSerializationImpl.MAP_KEYS );
 
-        app.createApplication( GraphShardVersionMigrationIT.class.getSimpleName()+ UUIDGenerator.newTimeUUID(), "migrationTest" );
+        app.createApplication( 
+                GraphShardVersionMigrationIT.class.getSimpleName()+ UUIDGenerator.newTimeUUID(), 
+                "migrationTest" );
 
 
 
@@ -121,46 +124,46 @@ public class EntityTypeMappingMigrationIT extends AbstractCoreIT {
 
 
         AllEntitiesInSystemObservable.getAllEntitiesInSystem( managerCache, 1000 )
-                                     .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
-                                         @Override
-                                         public void call(
-                                                 final AllEntitiesInSystemObservable.ApplicationEntityGroup entity ) {
-                                             //ensure that each one has a type
-
-                                             final EntityManager em = emf.getEntityManager(
-                                                     entity.applicationScope.getApplication().getUuid() );
-
-                                             for ( final Id id : entity.entityIds ) {
-                                                 try {
-                                                     final Entity returned = em.get( id.getUuid() );
-
-                                                     //we seem to occasionally get phantom edges.  If this is the
-                                                     // case we'll store the type _> uuid mapping, but we won't have
-                                                     // anything to load
-
-                                                     if ( returned != null ) {
-                                                         assertEquals( id.getUuid(), returned.getUuid() );
-                                                         assertEquals( id.getType(), returned.getType() );
-                                                     }
-                                                     else {
-                                                         final String type = managerCache.getMapManager( CpNamingUtils
-                                                                 .getEntityTypeMapScope(
-                                                                         entity.applicationScope.getApplication() ) )
-                                                                                         .getString( id.getUuid()
-                                                                                                       .toString() );
-
-                                                         assertEquals( id.getType(), type );
-                                                     }
-                                                 }
-                                                 catch ( Exception e ) {
-                                                     throw new RuntimeException( "Unable to get entity " + id
-                                                             + " by UUID, migration failed", e );
-                                                 }
-
-                                                 allEntities.remove( id );
-                                             }
-                                         }
-                                     } ).toBlocking().lastOrDefault( null );
+            .doOnNext( new Action1<AllEntitiesInSystemObservable.ApplicationEntityGroup>() {
+                @Override
+                public void call(
+                        final AllEntitiesInSystemObservable.ApplicationEntityGroup entity ) {
+                    //ensure that each one has a type
+
+                    final EntityManager em = emf.getEntityManager(
+                            entity.applicationScope.getApplication().getUuid() );
+
+                    for ( final Id id : entity.entityIds ) {
+                        try {
+                            final Entity returned = em.get( id.getUuid() );
+
+                            //we seem to occasionally get phantom edges.  If this is the
+                            // case we'll store the type _> uuid mapping, but we won't have
+                            // anything to load
+
+                            if ( returned != null ) {
+                                assertEquals( id.getUuid(), returned.getUuid() );
+                                assertEquals( id.getType(), returned.getType() );
+                            }
+                            else {
+                                final String type = managerCache.getMapManager( CpNamingUtils
+                                        .getEntityTypeMapScope(
+                                                entity.applicationScope.getApplication() ) )
+                                                                .getString( id.getUuid()
+                                                                            .toString() );
+
+                                assertEquals( id.getType(), type );
+                            }
+                        }
+                        catch ( Exception e ) {
+                            throw new RuntimeException( "Unable to get entity " + id
+                                    + " by UUID, migration failed", e );
+                        }
+
+                        allEntities.remove( id );
+                    }
+                }
+            } ).toBlocking().lastOrDefault( null );
 
 
         assertEquals( "Every element should have been encountered", 0, allEntities.size() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/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 0aecfd9..470a6f2 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
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -71,7 +72,8 @@ public class CounterIT extends AbstractCoreIT {
 
         LOG.info( "CounterIT.testIncrementAndDecrement" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCountersIandD" );
+        UUID applicationId = setup.createApplication( 
+            "testOrganization", "testCountersIandD" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -102,7 +104,8 @@ public class CounterIT extends AbstractCoreIT {
     public void testCounters() throws Exception {
         LOG.info( "CounterIT.testCounters" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCounters" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testCounters" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -141,7 +144,8 @@ public class CounterIT extends AbstractCoreIT {
                 System.currentTimeMillis(), true );
         LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) );
 
-        r = em.getAggregateCounters( user1, null, null, "visits", CounterResolution.ALL, ts, System.currentTimeMillis(),
+        r = em.getAggregateCounters( user1, null, null, "visits", CounterResolution.ALL, ts, 
+                System.currentTimeMillis(),
                 false );
         LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) );
 
@@ -180,25 +184,32 @@ public class CounterIT extends AbstractCoreIT {
 
     @Test
     public void testCommunityCounters() throws Exception {
+
         EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
 
+        Map<String, Long> counts = em.getApplicationCounters();
+        long originalAdminLoginsCount = counts.get( "admin.logins" ).longValue();
+
+        String randomSuffix = RandomStringUtils.randomAlphabetic(20); 
+        String orgName = "testCounter" + randomSuffix;
+        String appName = "testEntityCounters" + randomSuffix;
+
         Group organizationEntity = new Group();
-        organizationEntity.setPath( "tst-counter" );
-        organizationEntity.setProperty( "name", "testCounter" );
+        organizationEntity.setPath( "tst-counter" + randomSuffix );
+        organizationEntity.setProperty( "name", orgName );
         organizationEntity = em.create( organizationEntity );
 
-
-        UUID applicationId = setup.getEmf().createApplication( "testCounter", "testEntityCounters" );
+        UUID applicationId = setup.getEmf().createApplication( orgName, appName  ); 
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
-        properties.put( "name", "testCounter/testEntityCounters" );
+        properties.put( "name", orgName + "/" + appName );
         Entity applicationEntity = em.create( applicationId, "application_info", properties );
+
 //Creating connections like below doesn't work.
 //        em.createConnection( new SimpleEntityRef( "group", organizationEntity.getUuid() ), "owns",
 //                new SimpleEntityRef( "application_info", applicationId ) );
 
-        em.createConnection( organizationEntity.toTypedEntity(),"owns",applicationEntity );
-
+        em.createConnection( organizationEntity.toTypedEntity(), "owns", applicationEntity );
 
         Event event = new Event();
         event.setTimestamp( System.currentTimeMillis() );
@@ -207,32 +218,37 @@ public class CounterIT extends AbstractCoreIT {
 
         // TODO look at row syntax of event counters being sent
         em.create( event );
-    /*
-    event = new Event();
-    event.setTimestamp(System.currentTimeMillis());
-    event.addCounter("admin.logins", 1);
-    em.create(event);
-   */
-        Map<String, Long> counts = em.getApplicationCounters();
+
+        // event = new Event();
+        // event.setTimestamp(System.currentTimeMillis());
+        // event.addCounter("admin.logins", 1);
+        // em.create(event);
+
+        counts = em.getApplicationCounters();
         LOG.info( JsonUtils.mapToJsonString( counts ) );
         assertNotNull( counts.get( "admin.logins" ) );
-        assertEquals( 1, counts.get( "admin.logins" ).longValue() );
+        assertEquals( 1, counts.get( "admin.logins" ).longValue() - originalAdminLoginsCount );
+
         // Q's:
         // how to "count" a login to a specific application?
         // when org is provided, why is it returning 8? Is it 4 with one 'event'?
 
-        Results r = em.getAggregateCounters( null, null, null, "admin.logins", CounterResolution.ALL, ts,
-                System.currentTimeMillis(), false );
+        Results r = em.getAggregateCounters( null, null, null, "admin.logins", 
+                CounterResolution.ALL, ts, System.currentTimeMillis(), false );
+
         LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) );
-        assertEquals( 1, r.getCounters().get( 0 ).getValues().get( 0 ).getValue() );
-        //counts = em.getEntityCounters(organizationEntity.getUuid());
-        //LOG.info(JsonUtils.mapToJsonString(counts));
+        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() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/CountingMutatorIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CountingMutatorIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CountingMutatorIT.java
index 83a00f3..0d029dd 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CountingMutatorIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CountingMutatorIT.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.persistence;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.After;
 import org.junit.Before;
@@ -65,7 +66,8 @@ public class CountingMutatorIT extends AbstractCoreIT {
         //temporarily set our max size to 10 for testing
         CountingMutator.MAX_SIZE = 10;
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testFlushingMutatorOnConnections" );
+        UUID applicationId = setup.createApplication( 
+            "testOrganization", "testFlushingMutator-" + RandomStringUtils.randomAlphabetic(20) );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/EntityDictionaryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/EntityDictionaryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/EntityDictionaryIT.java
index 111b9fa..d38c50c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/EntityDictionaryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/EntityDictionaryIT.java
@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -61,7 +62,7 @@ public class EntityDictionaryIT extends AbstractCoreIT {
 
         LOG.info( "EntityDictionaryIT.testApplicationDictionaries" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testApplicationDictionaries" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testApplicationDictionaries" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -78,7 +79,7 @@ public class EntityDictionaryIT extends AbstractCoreIT {
     public void testUserDictionaries() throws Exception {
         LOG.info( "EntityDictionaryIT.testUserDictionaries" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testUserDictionaries" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testUserDictionaries" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -151,7 +152,7 @@ public class EntityDictionaryIT extends AbstractCoreIT {
 
         LOG.info( "EntityDictionaryIT.testApplicationDictionaries" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testRemoveFromDictionary" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testRemoveFromDictionary" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -185,7 +186,7 @@ public class EntityDictionaryIT extends AbstractCoreIT {
         provider.setAccessTokenEndpointUrl( "https://accounts.google.com/o/oauth2/token" );
         provider.setVersion( "2.0" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testGetDictionaries" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testGetDictionaries" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -206,7 +207,7 @@ public class EntityDictionaryIT extends AbstractCoreIT {
         LOG.info( "EntityDictionaryIT.testAddMapToDictionaries" );
 
         Map<String,Object> testMap = new HashMap<String,Object>();
-        UUID applicationId = setup.createApplication( "testOrganization", "testAddMapToDictionaries" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testAddMapToDictionaries" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java
index cb65a2a..427c168 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.Ignore;
 import org.junit.Test;
@@ -59,7 +60,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testEntityManager() throws Exception {
         LOG.info( "EntityManagerIT.testEntityManagerTest" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testEntityManagerTest" );
+        UUID applicationId = setup.createApplication( 
+            "testOrganization", "testEntityManagerTest" + RandomStringUtils.randomAlphabetic(20) );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -119,7 +121,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testCreateAndGet() throws Exception {
         LOG.info( "EntityDaoTest.testCreateAndGet" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCreateAndGet" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testCreateAndGet" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -189,7 +192,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testDictionaries() throws Exception {
         LOG.info( "EntityDaoTest.testDictionaries" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testDictionaries" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testDictionaries" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -232,7 +236,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testProperties() throws Exception {
         LOG.info( "EntityDaoTest.testProperties" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testProperties" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testProperties" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -270,7 +275,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testCreateAndDelete() throws Exception {
         LOG.info( "EntityDaoTest.testCreateAndDelete" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCreateAndDelete" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testCreateAndDelete" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -292,8 +298,8 @@ public class EntityManagerIT extends AbstractCoreIT {
 
         // now search by username, no results should be returned
 
-        Results r =
-                em.searchCollection( em.getApplicationRef(), "thing", new Query().addEqualityFilter( "name", name ) );
+        Results r = em.searchCollection( em.getApplicationRef(), "thing", 
+                new Query().addEqualityFilter( "name", name ) );
 
         assertEquals( 0, r.size() );
     }
@@ -303,7 +309,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testCreateAndDeleteUser() throws Exception {
         LOG.info( "EntityDaoTest.testCreateAndDeleteUser" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCreateAndDeleteUser" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testCreateAndDeleteUser" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -344,7 +351,8 @@ public class EntityManagerIT extends AbstractCoreIT {
 
         em.refreshIndex();
 
-        r = em.searchCollection( em.getApplicationRef(), "users", new Query().addEqualityFilter( "username", name ) );
+        r = em.searchCollection( em.getApplicationRef(), "users", 
+                new Query().addEqualityFilter( "username", name ) );
 
         assertEquals( 1, r.size() );
 
@@ -357,7 +365,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testJson() throws Exception {
         LOG.info( "EntityDaoTest.testProperties" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testJson" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testJson" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -398,7 +407,8 @@ public class EntityManagerIT extends AbstractCoreIT {
         organizationEntity.setProperty( "name", "testCounterOrg" );
         organizationEntity = em.create( organizationEntity );
 
-        UUID applicationId = setup.getEmf().createApplication( "testCounterOrg", "testEntityCounters" );
+        UUID applicationId = setup.getEmf().createApplication( 
+                "testCounterOrg", "testEntityCounters" + RandomStringUtils.randomAlphabetic(20)  );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
         properties.put( "name", "testEntityCounters" );
@@ -434,7 +444,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testCreateAndList() throws Exception {
         LOG.info( "EntityDaoTest.testCreateAndDelete" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCreateAndList" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testCreateAndList" + RandomStringUtils.randomAlphabetic(20) );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -476,7 +487,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     @Test
     public void testCorrectType() throws Exception {
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCorrectType" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testCorrectType" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -502,7 +514,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testImmutableForcedPropChange() throws Exception {
         LOG.info( "EntityDaoTest.testProperties" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testNamePropChanges" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testNamePropChanges" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -525,7 +538,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     @Test
     public void ownershipScopeCorrect() throws Exception {
 
-        UUID applicationId = setup.createApplication( "testOrganization", "ownershipScopeCorrect" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "ownershipScopeCorrect" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -583,7 +597,8 @@ public class EntityManagerIT extends AbstractCoreIT {
     public void testDeprecatedGet() throws Exception {
         LOG.info( "EntityManagerIT.testDeprecatedGet" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testDeprecatedGet" );
+        UUID applicationId = setup.createApplication( 
+                "testOrganization", "testDeprecatedGet" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
index 3b11872..a13f242 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -50,7 +51,8 @@ public class GeoQueryBooleanTest extends AbstractCoreIT {
 
         log.info( "GeoQueryBooleanTest.testGeoQueryWithOr" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testGeoQueryWithOr" );
+        UUID applicationId = setup.createApplication( 
+            "testOrganization", "testGeoQueryWithOr-" + RandomStringUtils.randomAlphabetic(20));
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -116,7 +118,8 @@ public class GeoQueryBooleanTest extends AbstractCoreIT {
 
         log.info( "GeoQueryBooleanTest.testGeoQueryWithOr" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testGeoQueryWithNot" );
+        UUID applicationId = setup.createApplication( 
+            "testOrganization", "testGeoQueryWithNot-" + RandomStringUtils.randomAlphabetic(20) );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index 2f571fb..e839fa1 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -25,6 +25,7 @@ import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
 import me.prettyprint.hector.api.Keyspace;
 import static me.prettyprint.hector.api.factory.HFactory.createMutator;
 import me.prettyprint.hector.api.mutation.Mutator;
+import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.usergrid.AbstractCoreIT;
 import org.apache.usergrid.CoreITSuite;
 import org.apache.usergrid.cassandra.Concurrent;
@@ -32,15 +33,12 @@ import org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.cassandra.IndexUpdate;
 import org.apache.usergrid.persistence.cassandra.IndexUpdate.IndexEntry;
 import org.apache.usergrid.persistence.cassandra.RelationManagerImpl;
-import org.apache.usergrid.persistence.hector.CountingMutator;
 import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.utils.JsonUtils;
 import org.apache.usergrid.utils.UUIDUtils;
-import static org.junit.Assert.assertEquals;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -62,7 +60,7 @@ public class IndexIT extends AbstractCoreIT {
     public void testCollectionOrdering() throws Exception {
         LOG.info( "testCollectionOrdering" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCollectionOrdering" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testCollectionOrdering" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -135,7 +133,7 @@ public class IndexIT extends AbstractCoreIT {
     public void testCollectionFilters() throws Exception {
         LOG.info( "testCollectionFilters" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testCollectionFilters" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testCollectionFilters" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -261,7 +259,7 @@ public class IndexIT extends AbstractCoreIT {
     public void testSecondarySorts() throws Exception {
         LOG.info( "testSecondarySorts" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testSecondarySorts" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testSecondarySorts" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
@@ -295,7 +293,7 @@ public class IndexIT extends AbstractCoreIT {
     @Test
     public void testPropertyUpdateWithConnection() throws Exception {
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testPropertyUpdateWithConnection" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testPropertyUpdateWithConnection" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
@@ -370,7 +368,7 @@ public class IndexIT extends AbstractCoreIT {
     public void testPropertyUpdateWithConnectionEntityIndexEntryAudit() throws Exception {
 
         UUID applicationId =
-                setup.createApplication( "testOrganization", "testPropertyUpdateWithConnectionEntityIndexEntryAudit" );
+                setup.createApplication( "testOrganization", "testPropertyUpdateWithConnectionEntityIndexEntryAudit" + RandomStringUtils.randomAlphabetic(20)  );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
index 16fae85..e5256f3 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PathQueryIT.java
@@ -25,6 +25,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.Test;
 import org.apache.usergrid.AbstractCoreIT;
@@ -37,7 +38,7 @@ public class PathQueryIT extends AbstractCoreIT {
 
     @Test
     public void testUserDevicePathQuery() throws Exception {
-        UUID applicationId = setup.createApplication( "testOrganization", "testUserDevicePathQuery" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testUserDevicePathQuery" + RandomStringUtils.randomAlphabetic(20)  );
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
         List<Entity> users = new ArrayList<Entity>();
@@ -106,7 +107,7 @@ public class PathQueryIT extends AbstractCoreIT {
     @Test
     public void testGroupUserDevicePathQuery() throws Exception {
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testGroupUserDevicePathQuery" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testGroupUserDevicePathQuery" + RandomStringUtils.randomAlphabetic(20)  );
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
 
         List<Entity> groups = new ArrayList<Entity>();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
index 28974ac..574d366 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PerformanceEntityRebuildIndexTest.java
@@ -63,7 +63,7 @@ public class PerformanceEntityRebuildIndexTest extends AbstractCoreIT {
     private static final MetricRegistry registry = new MetricRegistry();
     private Slf4jReporter reporter;
 
-    private static final long RUNTIME_MS = TimeUnit.SECONDS.toMillis( 5 );
+    private static final long RUNTIME_MS = TimeUnit.SECONDS.toMillis( 3 );
 
     private static final long WRITE_DELAY_MS = 10;
 
@@ -207,8 +207,8 @@ public class PerformanceEntityRebuildIndexTest extends AbstractCoreIT {
         };
 
         try {
-//            setup.getEmf().refreshIndex();
-            setup.getEmf().rebuildAllIndexes( po );
+
+            setup.getEmf().rebuildApplicationIndexes( em.getApplicationId(), po );
 
             reporter.report();
             registry.remove( meterName );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
index 87aca64..bdd82ea 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/PermissionsIT.java
@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -49,7 +50,7 @@ public class PermissionsIT extends AbstractCoreIT {
 
     @Test
     public void testPermissionTimeout() throws Exception {
-        UUID applicationId = setup.createApplication( "permissionsTest", "testPermissionTimeout" );
+        UUID applicationId = setup.createApplication( "permissionsTest", "testPermissionTimeout" + RandomStringUtils.randomAlphabetic(20)  );
 
         assertNotNull( applicationId );
 
@@ -99,7 +100,7 @@ public class PermissionsIT extends AbstractCoreIT {
     public void testPermissions() throws Exception {
         logger.info( "PermissionsIT.testPermissions" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testPermissions" );
+        UUID applicationId = setup.createApplication( "testOrganization", "testPermissions" + RandomStringUtils.randomAlphabetic(20)  );
         assertNotNull( applicationId );
 
         EntityManager em = setup.getEmf().getEntityManager( applicationId );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
index dc7ab3c..4cc0dbd 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.commons.lang3.RandomStringUtils;
 
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -88,8 +89,10 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
 
     @Before
     public void initTracing() {
-        traceTagManager = CoreITSuite.cassandraResource.getBean( "traceTagManager", TraceTagManager.class );
-        traceTagReporter = CoreITSuite.cassandraResource.getBean( "traceTagReporter", TraceTagReporter.class );
+        traceTagManager = CoreITSuite.cassandraResource.getBean( 
+                "traceTagManager", TraceTagManager.class );
+        traceTagReporter = CoreITSuite.cassandraResource.getBean( 
+                "traceTagReporter", TraceTagReporter.class );
     }
 
 
@@ -105,7 +108,7 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
         traceTagManager.attach( traceTag );
         logger.info( "EntityDaoTest.testCreateAndGet" );
 
-        UUID applicationId = createApplication( "EntityManagerFactoryImplIT", "testCreateAndGet" );
+        UUID applicationId = createApplication( "EntityManagerFactoryImplIT", "testCreateAndGet" + RandomStringUtils.randomAlphabetic(20)  );
         logger.info( "Application id " + applicationId );
 
         EntityManager em = emf.getEntityManager( applicationId );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
index 4d371fb..d8f31ff 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
@@ -50,7 +50,8 @@ public abstract class AbstractIteratingQueryIT {
 
     @ClassRule
     public static CoreITSetup setup = new CoreITSetupImpl( 
-            ConcurrentCoreIteratorITSuite.cassandraResource, ConcurrentCoreIteratorITSuite.elasticSearchResource );
+            ConcurrentCoreIteratorITSuite.cassandraResource, 
+            ConcurrentCoreIteratorITSuite.elasticSearchResource );
 
     @Rule
     public CoreApplication app = new CoreApplication( setup );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/26774448/stack/core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/log4j.properties b/stack/core/src/test/resources/log4j.properties
index 2aa9983..2b156b3 100644
--- a/stack/core/src/test/resources/log4j.properties
+++ b/stack/core/src/test/resources/log4j.properties
@@ -43,8 +43,9 @@ log4j.logger.org.apache.usergrid.persistence.PerformanceEntityReadTest=DEBUG
 log4j.logger.org.apache.usergrid.persistence.PerformanceEntityRebuildIndexTest=DEBUG
 #log4j.logger.org.apache.usergrid.persistence=INFO
 
-log4j.logger.org.apache.usergrid.corepersistence=DEBUG
+log4j.logger.org.apache.usergrid.corepersistence.migration=WARN
 #log4j.logger.org.apache.usergrid.corepersistence.CpSetup=INFO
+#log4j.logger.org.apache.usergrid.corepersistence=DEBUG
 #log4j.logger.org.apache.usergrid.corepersistence.CpEntityManagerFactory=DEBUG
 #log4j.logger.org.apache.usergrid.corepersistence.CpEntityManager=DEBUG
 #log4j.logger.org.apache.usergrid.corepersistence.CpRelationManager=DEBUG
@@ -54,7 +55,7 @@ log4j.logger.org.apache.usergrid.corepersistence=DEBUG
 
 #log4j.logger.org.apache.usergrid.persistence.CollectionIT=DEBUG
 #log4j.logger.org.apache.usergrid.persistence.collection=DEBUG
-log4j.logger.org.apache.usergrid.persistence.index=DEBUG
+#log4j.logger.org.apache.usergrid.persistence.index=DEBUG
 #log4j.logger.org.elasticsearch=DEBUG
 
 #log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG, stdout