usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [36/50] incubator-usergrid git commit: Fixing many more merge problems.
Date Mon, 15 Dec 2014 18:32:20 GMT
Fixing many more merge problems.


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

Branch: refs/heads/two-dot-o
Commit: 2ee0eff3cd7a7b4bff53ed92cc411324634c9244
Parents: 3227693
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Mon Nov 24 10:25:58 2014 -0500
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Mon Nov 24 10:25:58 2014 -0500

----------------------------------------------------------------------
 .../usergrid/corepersistence/CpSetup.java       | 16 +++---
 .../usergrid/corepersistence/GuiceModule.java   | 28 +++++++----
 .../events/EntityDeletedHandler.java            |  8 +--
 .../events/EntityVersionCreatedHandler.java     | 18 +++----
 .../events/EntityVersionDeletedHandler.java     |  7 ++-
 .../corepersistence/StaleIndexCleanupTest.java  | 51 ++++++++++++--------
 .../corepersistence/TestGuiceModule.java        | 12 +++--
 .../usergrid/persistence/index/EntityIndex.java |  1 -
 .../apache/usergrid/rest/TestContextSetup.java  |  6 +--
 .../collection/DuplicateNameIT.java             |  2 +-
 .../rest/test/resource/TestContext.java         |  3 +-
 11 files changed, 90 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
index d48a20c..35ef63b 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
@@ -62,15 +62,11 @@ public class CpSetup implements Setup {
     private static final Logger logger = LoggerFactory.getLogger( CpSetup.class );
 
     private static Injector injector = null;
+    private static EntityManagerFactory emf;
 
-
-    private final org.apache.usergrid.persistence.EntityManagerFactory emf;
     private final CassandraService cass;
 
 
-
-
-
     /**
      * Instantiates a new setup object.
      *
@@ -82,11 +78,9 @@ public class CpSetup implements Setup {
     }
 
 
-
-
     public static Injector getInjector() {
         if ( injector == null ) {
-            injector = Guice.createInjector( new GuiceModule() ); 
+            injector = Guice.createInjector( new GuiceModule( emf ) ); 
         }
         return injector;
     }
@@ -175,14 +169,16 @@ public class CpSetup implements Setup {
             emf.initializeApplication( DEFAULT_ORGANIZATION,
                     emf.getDefaultAppId(), DEFAULT_APPLICATION, null );
         } catch (ApplicationAlreadyExistsException ex) {
-            logger.warn("Application {}/{} already exists", DEFAULT_ORGANIZATION, DEFAULT_APPLICATION);
+            logger.warn("Application {}/{} already exists", 
+                    DEFAULT_ORGANIZATION, DEFAULT_APPLICATION);
         }
 
         try {
             emf.initializeApplication( DEFAULT_ORGANIZATION,
                     emf.getManagementAppId(), MANAGEMENT_APPLICATION, null );
         } catch (ApplicationAlreadyExistsException ex) {
-            logger.warn("Application {}/{} already exists", DEFAULT_ORGANIZATION, MANAGEMENT_APPLICATION);
+            logger.warn("Application {}/{} already exists", 
+                    DEFAULT_ORGANIZATION, MANAGEMENT_APPLICATION);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
index 2697958..98f473a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
@@ -23,6 +23,7 @@ import org.apache.usergrid.corepersistence.migration.GraphShardVersionMigration;
 import org.apache.usergrid.corepersistence.events.EntityDeletedHandler;
 import org.apache.usergrid.corepersistence.events.EntityVersionCreatedHandler;
 import org.apache.usergrid.corepersistence.events.EntityVersionDeletedHandler;
+import org.apache.usergrid.persistence.EntityManagerFactory;
 import org.apache.usergrid.persistence.collection.event.EntityDeleted;
 import org.apache.usergrid.persistence.collection.event.EntityVersionCreated;
 import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
@@ -44,9 +45,19 @@ public class GuiceModule extends AbstractModule {
 
     private static final Logger logger = LoggerFactory.getLogger(GuiceModule.class);
 
+    private EntityManagerFactory emf;
+
+    GuiceModule( EntityManagerFactory emf ) {
+        this.emf = emf;
+    }
+
     @Override
     protected void configure() {
 
+        if ( emf != null ) {
+            bind( EntityManagerFactory.class ).toInstance( emf );
+        }
+
         install(new CommonModule());
         install(new CollectionModule());
         install(new GraphModule());
@@ -54,23 +65,22 @@ public class GuiceModule extends AbstractModule {
         install(new MapModule());
         install(new QueueModule());
 
-        Multibinder<EntityDeleted> entityBinder
-                = Multibinder.newSetBinder(binder(), EntityDeleted.class);
+        Multibinder<EntityDeleted> entityBinder = 
+            Multibinder.newSetBinder(binder(), EntityDeleted.class);
         entityBinder.addBinding().to(EntityDeletedHandler.class);
 
-        Multibinder<EntityVersionDeleted> versionBinder
-                = Multibinder.newSetBinder(binder(), EntityVersionDeleted.class);
+        Multibinder<EntityVersionDeleted> versionBinder = 
+            Multibinder.newSetBinder(binder(), EntityVersionDeleted.class);
         versionBinder.addBinding().to(EntityVersionDeletedHandler.class);
 
-        Multibinder<EntityVersionCreated> versionCreatedMultibinder
-                = Multibinder.newSetBinder( binder(),EntityVersionCreated.class );
+        Multibinder<EntityVersionCreated> versionCreatedMultibinder =
+            Multibinder.newSetBinder( binder(), EntityVersionCreated.class );
         versionCreatedMultibinder.addBinding().to(EntityVersionCreatedHandler.class);
 
-        Multibinder<DataMigration> dataMigrationMultibinder = Multibinder.newSetBinder(
binder(), DataMigration.class );
+        Multibinder<DataMigration> dataMigrationMultibinder = 
+            Multibinder.newSetBinder( binder(), DataMigration.class );
         dataMigrationMultibinder.addBinding().to( EntityTypeMappingMigration.class );
         dataMigrationMultibinder.addBinding().to( GraphShardVersionMigration.class );
-
-
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedHandler.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedHandler.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedHandler.java
index bd738fe..d34b51c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedHandler.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedHandler.java
@@ -17,15 +17,15 @@
  */
 package org.apache.usergrid.corepersistence.events;
 
+import com.google.inject.Inject;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.event.EntityDeleted;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import java.util.UUID;
 import org.apache.usergrid.corepersistence.CpEntityManagerFactory;
-import org.apache.usergrid.corepersistence.CpSetup;
 import org.apache.usergrid.corepersistence.HybridEntityManagerFactory;
+import org.apache.usergrid.persistence.EntityManagerFactory;
 import org.apache.usergrid.persistence.index.EntityIndex;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,6 +37,8 @@ import org.slf4j.LoggerFactory;
 public class EntityDeletedHandler implements EntityDeleted {
     private static final Logger logger = LoggerFactory.getLogger(EntityDeletedHandler.class
);
 
+    @Inject
+    EntityManagerFactory emf;
 
     public EntityDeletedHandler() {
         logger.debug("Created");        
@@ -50,7 +52,7 @@ public class EntityDeletedHandler implements EntityDeleted {
             new Object[] { entityId.getType(), entityId.getUuid(), version,
                 scope.getName(), scope.getOwner(), scope.getApplication()});
 
-        HybridEntityManagerFactory hemf = (HybridEntityManagerFactory)CpSetup.getEntityManagerFactory();
+        HybridEntityManagerFactory hemf = (HybridEntityManagerFactory)emf;
         CpEntityManagerFactory cpemf = (CpEntityManagerFactory)hemf.getImplementation();
 
         final EntityIndex ei = cpemf.getManagerCache().getEntityIndex(scope);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionCreatedHandler.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionCreatedHandler.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionCreatedHandler.java
index 08b8fbd..3462ecb 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionCreatedHandler.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionCreatedHandler.java
@@ -17,33 +17,36 @@
  */
 package org.apache.usergrid.corepersistence.events;
 
+import com.google.inject.Inject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.corepersistence.CpEntityManagerFactory;
-import org.apache.usergrid.corepersistence.CpSetup;
 import org.apache.usergrid.corepersistence.HybridEntityManagerFactory;
+import org.apache.usergrid.persistence.EntityManagerFactory;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.event.EntityVersionCreated;
 import org.apache.usergrid.persistence.index.EntityIndex;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
 import org.apache.usergrid.persistence.model.entity.Entity;
 
 
-
 /**
  * Clean up stale entity indexes when new version of Entity created. Called when an Entity
is 
  * updated by the Collections module and we react by calling the Query Index module and removing

  * any indexes that exist for previous versions of the the Entity. 
  */
 public class EntityVersionCreatedHandler implements EntityVersionCreated {
-
     private static final Logger logger = LoggerFactory.getLogger(EntityVersionCreatedHandler.class
);
 
+    @Inject
+    EntityManagerFactory emf;
+
+
     public EntityVersionCreatedHandler() {
         logger.debug("EntityVersionCreated");
     }
 
+
     @Override
     public void versionCreated( final CollectionScope scope, final Entity entity ) {
         logger.debug("Entering deleted for entity {}:{} v {} "
@@ -51,17 +54,14 @@ public class EntityVersionCreatedHandler implements EntityVersionCreated
{
                 new Object[] { entity.getId().getType(), entity.getId().getUuid(), entity.getVersion(),
                         scope.getName(), scope.getOwner(), scope.getApplication()});
 
-        HybridEntityManagerFactory hemf = (HybridEntityManagerFactory)CpSetup.getEntityManagerFactory();
+        HybridEntityManagerFactory hemf = (HybridEntityManagerFactory)emf;
         CpEntityManagerFactory cpemf = (CpEntityManagerFactory)hemf.getImplementation();
 
         final EntityIndex ei = cpemf.getManagerCache().getEntityIndex(scope);
 
-        EntityIndexBatch batch = ei.createBatch();
-
         //TODO why aren't we using a collection fig here? This seems kludgy
         if ( System.getProperty( "allow.stale.entities", "false" ).equals( "false" )) {
-            batch.deindexPreviousVersions( entity );
-            batch.execute();
+            ei.deletePreviousVersions( entity.getId(), entity.getVersion() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
index 046e9c2..d63edb7 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
@@ -36,6 +36,7 @@ import java.util.List;
 
 import com.google.inject.Inject;
 import org.apache.usergrid.corepersistence.HybridEntityManagerFactory;
+import org.apache.usergrid.persistence.EntityManagerFactory;
 
 
 /**
@@ -47,8 +48,10 @@ public class EntityVersionDeletedHandler implements EntityVersionDeleted
{
 
     private final SerializationFig serializationFig;
 
+    private EntityManagerFactory emf;
+
     @Inject
-    public EntityVersionDeletedHandler(SerializationFig fig) {
+    public EntityVersionDeletedHandler(SerializationFig fig, EntityManagerFactory emf) {
         this.serializationFig = fig;
     }
 
@@ -56,7 +59,7 @@ public class EntityVersionDeletedHandler implements EntityVersionDeleted
{
     public void versionDeleted(
             final CollectionScope scope, final Id entityId, final List<MvccEntity>
entityVersions) {
 
-        HybridEntityManagerFactory hemf = (HybridEntityManagerFactory)CpSetup.getEntityManagerFactory();
+        HybridEntityManagerFactory hemf = (HybridEntityManagerFactory)emf;
         CpEntityManagerFactory cpemf = (CpEntityManagerFactory)hemf.getImplementation();
 
         final EntityIndex ei = cpemf.getManagerCache().getEntityIndex(scope);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
index 95d77d0..e1c0214 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
@@ -35,7 +35,6 @@ import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.EntityRef;
 import org.apache.usergrid.persistence.Results;
-import static org.apache.usergrid.persistence.Schema.TYPE_APPLICATION;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
@@ -52,10 +51,14 @@ import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 
 import com.fasterxml.uuid.UUIDComparator;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 import static org.apache.usergrid.persistence.Schema.TYPE_APPLICATION;
+import org.junit.After;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import org.junit.Before;
 
 
 //need to create system properties in test that can get applied
@@ -65,6 +68,9 @@ import static org.junit.Assert.assertTrue;
 public class StaleIndexCleanupTest extends AbstractCoreIT {
     private static final Logger logger = LoggerFactory.getLogger( StaleIndexCleanupTest.class
);
 
+    // take it easy on Cassandra
+    private static final long writeDelayMs = 50;
+    private static final long readDelayMs = 50;
 
     Lock sequential = new ReentrantLock();
 
@@ -108,14 +114,16 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         assertEquals( "widget", cpUpdated.getField( "stuff" ).getValue() );
         UUID newVersion = cpUpdated.getVersion();
 
-        assertTrue( "New version is greater than old", UUIDComparator.staticCompare( newVersion,
oldVersion ) > 0 );
+        assertTrue( "New version is greater than old", 
+                UUIDComparator.staticCompare( newVersion, oldVersion ) > 0 );
 
         assertEquals( 2, queryCollectionCp( "things", "thing", "select *" ).size() );
     }
 
 
     /**
-     * Test that the CpRelationManager cleans up and stale indexes that it finds when it
is building search results.
+     * Test that the CpRelationManager cleans up and stale indexes that it finds when 
+     * it is building search results.
      */
     @Test
     public void testStaleIndexCleanup() throws Exception {
@@ -185,8 +193,8 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         // should return numEntities becuase it filters out the stale entities
         final int limit = 8;
 
-        //we order by updateCount asc, this forces old versions to appear first, otherwise,
we don't clean them up in
-        // our versions
+        // we order by updateCount asc, this forces old versions to appear first, otherwise,

+        // we don't clean them up in our versions
         Query q = Query.fromQL( "select * order by updateCount asc" );
         q.setLimit( limit );
         int thingCount = 0;
@@ -258,7 +266,7 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         }
         em.refreshIndex();
 
-        CandidateResults crs = queryCollectionCp( "things", "select *");
+        CandidateResults crs = queryCollectionCp( "things", "thing", "select *");
         Assert.assertEquals( "Expect no stale candidates yet", numEntities, crs.size() );
 
         // update each one a bunch of times
@@ -287,7 +295,7 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         em.refreshIndex();
 
         // query Core Persistence directly for total number of result candidates
-        crs = queryCollectionCp("things", "select *");
+        crs = queryCollectionCp("things", "thing", "select *");
         Assert.assertEquals( "Expect stale candidates", numEntities * (numUpdates + 1), crs.size());
 
         // delete all entities
@@ -300,7 +308,7 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         count = 0;
         do {
             Thread.sleep(100);
-            crs = queryCollectionCp("things", "select *");
+            crs = queryCollectionCp("things", "thing", "select *");
         } while ( crs.size() > 0 && count++ < 14 );
 
         Assert.assertEquals( "Expect no candidates", 0, crs.size() );
@@ -332,7 +340,7 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         }
         em.refreshIndex();
 
-        CandidateResults crs = queryCollectionCp( "things", "select *");
+        CandidateResults crs = queryCollectionCp( "things", "things", "select *");
         Assert.assertEquals( "Expect no stale candidates yet", numEntities, crs.size() );
 
         // update each one a bunch of times
@@ -361,7 +369,7 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
         em.refreshIndex();
 
         // query Core Persistence directly for total number of result candidates
-        crs = queryCollectionCp("things", "select *");
+        crs = queryCollectionCp("things", "thing", "select *");
         Assert.assertEquals( "Expect candidates without earlier stale entities", numEntities,
crs.size() );
     }
 
@@ -374,29 +382,34 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
 
         EntityManager em = app.getEntityManager();
 
-        CollectionScope cs = new CollectionScopeImpl( new SimpleId( em.getApplicationId(),
TYPE_APPLICATION ),
-                new SimpleId( em.getApplicationId(), TYPE_APPLICATION ),
-                CpNamingUtils.getCollectionScopeNameFromEntityType( eref.getType() ) );
+        CollectionScope cs = new CollectionScopeImpl( 
+            new SimpleId( em.getApplicationId(), TYPE_APPLICATION ),
+            new SimpleId( em.getApplicationId(), TYPE_APPLICATION ),
+            CpNamingUtils.getCollectionScopeNameFromEntityType( eref.getType() ) );
 
-        EntityCollectionManagerFactory ecmf = CpSetup.getInjector().getInstance( EntityCollectionManagerFactory.class
);
+        EntityCollectionManagerFactory ecmf = 
+                CpSetup.getInjector().getInstance( EntityCollectionManagerFactory.class );
 
         EntityCollectionManager ecm = ecmf.createCollectionManager( cs );
 
-        return ecm.load( new SimpleId( eref.getUuid(), eref.getType() ) ).toBlocking().lastOrDefault(
null );
+        return ecm.load( new SimpleId( eref.getUuid(), eref.getType() ) )
+                .toBlocking().lastOrDefault( null );
     }
 
 
     /**
-     * Go around EntityManager and execute query directly against Core Persistence. Results
may include stale index
-     * entries.
+     * Go around EntityManager and execute query directly against Core Persistence. 
+     * Results may include stale index entries.
      */
-    private CandidateResults queryCollectionCp( final String collName, final String type,
final String query ) {
+    private CandidateResults queryCollectionCp( 
+            final String collName, final String type, final String query ) {
 
         EntityManager em = app.getEntityManager();
 
         EntityIndexFactory eif = CpSetup.getInjector().getInstance( EntityIndexFactory.class
);
 
-        ApplicationScope as = new ApplicationScopeImpl( new SimpleId( em.getApplicationId(),
TYPE_APPLICATION ) );
+        ApplicationScope as = new ApplicationScopeImpl( 
+            new SimpleId( em.getApplicationId(), TYPE_APPLICATION ) );
         EntityIndex ei = eif.createEntityIndex( as );
 
         IndexScope is = new IndexScopeImpl( new SimpleId( em.getApplicationId(), TYPE_APPLICATION
),

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
index 7d1bd69..9a0b195 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
@@ -19,15 +19,19 @@
 package org.apache.usergrid.corepersistence;
 
 import com.google.inject.AbstractModule;
+import org.apache.usergrid.persistence.EntityManagerFactory;
 
 
 public class TestGuiceModule extends AbstractModule {
 
-    @Override
-    protected void configure() {
+    private static EntityManagerFactory emf;
 
-        install( new GuiceModule() );
+    public TestGuiceModule( EntityManagerFactory emf ) {
+        this.emf = emf;
     }
 
-
+    @Override
+    protected void configure() {
+        install( new GuiceModule( emf ) );
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index 29d8015..6d2cdd2 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@ -24,7 +24,6 @@ import java.util.UUID;
 import org.apache.usergrid.persistence.core.util.Health;
 import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.persistence.index.query.CandidateResults;
-import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
index 2da1033..4b7cc69 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
@@ -22,7 +22,6 @@ import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.management.OrganizationsIT;
 import org.apache.usergrid.rest.test.resource.TestContext;
 import org.apache.usergrid.rest.test.security.TestAdminUser;
 
@@ -31,8 +30,9 @@ import java.io.IOException;
 
 
 /**
- * A self configuring TestContext which sets itself up it implements TestRule. With a @Rule
annotation, an instance of
- * this Class as a public member in any test class or abstract test class will auto svcSetup
itself before each test.
+ * A self configuring TestContext which sets itself up it implements TestRule. With a @Rule

+ * annotation, an instance of this Class as a public member in any test class or abstract

+ * test class will auto svcSetup itself before each test.
  */
 public class TestContextSetup extends TestContext implements TestRule {
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
index 39344d0..5c98785 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
@@ -55,7 +55,7 @@ public class DuplicateNameIT extends AbstractRestIT {
 
         refreshIndex( context.getAppUuid() );
 
-        Injector injector = Guice.createInjector( new TestGuiceModule() ); 
+        Injector injector = Guice.createInjector( new TestGuiceModule( null ) ); 
         SerializationFig sfig = injector.getInstance( SerializationFig.class );
 
         // wait for any temporary unique value records to timeout

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ee0eff3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
index 24a05e7..814dd35 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
@@ -124,7 +124,8 @@ public class TestContext {
     }
 
 
-    /** Create the app if it doesn't exist with the given TestUser. If the app exists, the
user is logged in */
+    /** Create the app if it doesn't exist with the given TestUser. 
+     * If the app exists, the user is logged in */
     public TestContext loginUser() {
         // nothing to do
         if ( activeUser.isLoggedIn() ) {


Mime
View raw message