You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/15 01:27:12 UTC

[24/50] [abbrv] git commit: Still working on debugging IndexIT tests.

Still working on debugging IndexIT tests.


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

Branch: refs/heads/asyncqueue
Commit: ecb674ae90911adc9521df2992214869a1f8f572
Parents: d003552
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Mar 6 13:33:19 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Mar 6 13:33:19 2014 -0500

----------------------------------------------------------------------
 .../usergrid/persistence/index/IndexFig.java    |  7 +-
 .../index/impl/EsEntityCollectionIndex.java     | 79 +++++++++++++-------
 .../persistence/index/impl/EsProvider.java      | 59 +++++++++------
 .../persistence/index/impl/CollectionIT.java    |  2 +
 .../index/impl/ElasticSearchRule.java           | 16 ++--
 .../index/impl/EntityCollectionIndexTest.java   |  2 +-
 .../usergrid/persistence/index/impl/GeoIT.java  |  2 +
 .../persistence/index/impl/IndexIT.java         | 14 ++--
 .../index/legacy/EntityManagerFacade.java       |  4 +-
 .../src/test/resources/log4j.properties         |  2 +-
 10 files changed, 116 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index 3140142..8449c44 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -19,10 +19,12 @@
 package org.apache.usergrid.persistence.index;
 
 import org.safehaus.guicyfig.Default;
+import org.safehaus.guicyfig.FigSingleton;
 import org.safehaus.guicyfig.GuicyFig;
 import org.safehaus.guicyfig.Key;
 
 
+@FigSingleton
 public interface IndexFig extends GuicyFig {
 
     public static final String ELASTICSEARCH_HOSTS = "elasticsearch.hosts";
@@ -35,10 +37,9 @@ public interface IndexFig extends GuicyFig {
 
     public static final String QUERY_CURSOR_TIMEOUT_MINUTES = "elasticsearch.cursor-timeout.minutes";
 
-    public static final String QUERY_LIMIT_DEFAULT = "index.query.limit.default";
-
     public static final String ELASTICSEARCH_FORCE_REFRESH = "elasticsearch.force-refresh";
 
+    public static final String QUERY_LIMIT_DEFAULT = "index.query.limit.default";
     
     @Default( "127.0.0.1" )
     @Key( ELASTICSEARCH_HOSTS )
@@ -56,7 +57,7 @@ public interface IndexFig extends GuicyFig {
     @Key( QUERY_CURSOR_TIMEOUT_MINUTES )
     int getQueryCursorTimeout();
 
-    @Default( "false" )
+    @Default( "true" )
     @Key( ELASTICSEARCH_EMBEDDED )
     boolean isEmbedded();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
index 2854d9c..d5647ad 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
@@ -72,7 +72,10 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
     private static final Logger log = LoggerFactory.getLogger(EsEntityCollectionIndex.class);
 
     private final Client client;
-    private final String index;
+
+    private final String indexName;
+    private final String typeName;
+
     private final boolean refresh;
     private final int cursorTimeout;
 
@@ -91,39 +94,69 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
         this.manager = factory.createCollectionManager(scope);
         this.client = provider.getClient();
         this.scope = scope;
-        this.index = config.getIndexName();
+
+        this.indexName = config.getIndexName();
+        this.typeName = createTypeName( scope );
+
         this.refresh = config.isForcedRefresh();
         this.cursorTimeout = config.getQueryCursorTimeout();
 
         // if new index then create it 
         AdminClient admin = client.admin();
-        if (!admin.indices().exists(new IndicesExistsRequest(index)).actionGet().isExists()) {
-            admin.indices().prepareCreate(index).execute().actionGet();
-            log.debug("Created new index: " + index);
+        if (!admin.indices().exists(new IndicesExistsRequest(indexName)).actionGet().isExists()) {
+            admin.indices().prepareCreate(indexName).execute().actionGet();
+            log.debug("Created new index: " + indexName);
         }
 
-        // TODO: is it appropriate to use scope name as type name? are scope names unique?
         // if new type then create mapping
         if (!admin.indices().typesExists(new TypesExistsRequest(
-                new String[]{index}, scope.getName())).actionGet().isExists()) {
+                new String[]{indexName}, typeName )).actionGet().isExists()) {
 
             try {
                 XContentBuilder mxcb = EsEntityCollectionIndex
                         .createDoubleStringIndexMapping(jsonBuilder(), scope.getName());
 
-                PutMappingResponse pmr = admin.indices().preparePutMapping(index)
+                PutMappingResponse pmr = admin.indices().preparePutMapping( indexName )
                         .setType(scope.getName()).setSource(mxcb).execute().actionGet();
 
-                log.debug("Created new type mapping for scope: " + scope.getName());
+                log.debug("Created new type mapping for scope named: " + scope.getName());
                 log.debug("   Scope organization: " + scope.getOrganization());
                 log.debug("   Scope owner: " + scope.getOwner());
+                log.debug("   Type name: " + typeName );
 
             } catch (IOException ex) {
                 throw new RuntimeException("Error adding mapping for type " + scope.getName(), ex);
             }
         }
     }
+   
+    
+    private String createIndexId(Entity entity) {
+        return createIndexId(entity.getId(), entity.getVersion());
+    }
+
+    
+    private String createIndexId(Id entityId, UUID version) {
+        StringBuilder sb = new StringBuilder();
+        sb.append( entityId.getUuid() ).append("|");
+        sb.append( entityId.getType() ).append("|");
+        sb.append( version.toString() );
+        return sb.toString();
+    }
 
+    
+    public static String createTypeName( CollectionScope scope ) {
+        //return scope.getName();
+        StringBuilder sb = new StringBuilder();
+        sb.append( scope.getName()                   ).append("|");
+        sb.append( scope.getOwner().getUuid()        ).append("|");
+        sb.append( scope.getOwner().getType()        ).append("|");
+        sb.append( scope.getOrganization().getUuid() ).append("|");
+        sb.append( scope.getOrganization().getType() );
+        return sb.toString();
+    }
+
+    
     public void index(Entity entity) {
 
         if (entity.getId() == null) {
@@ -141,7 +174,7 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
 
         String indexId = createIndexId(entity);
 
-        IndexRequestBuilder irb = client.prepareIndex(index, scope.getName(), indexId)
+        IndexRequestBuilder irb = client.prepareIndex(indexName, typeName, indexId)
                 .setSource(entityAsMap)
                 .setRefresh(refresh);
 
@@ -150,42 +183,33 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
         log.debug("Indexed Entity with index id " + indexId);
     }
 
-    private String createIndexId(Entity entity) {
-        return createIndexId(entity.getId(), entity.getVersion());
-    }
-
-    private String createIndexId(Id entityId, UUID version) {
-        return entityId.getUuid().toString() + "|"
-                + entityId.getType() + "|"
-                + version.toString();
-    }
-
     public void deindex(Entity entity) {
         deindex(entity.getId(), entity.getVersion());
     }
 
     public void deindex(Id entityId, UUID version) {
         String indexId = createIndexId(entityId, version);
-        client.prepareDelete(index, scope.getName(), indexId)
-                .setRefresh(refresh).execute().actionGet();
+        client.prepareDelete( indexName, typeName, indexId )
+            .setRefresh( refresh )
+            .execute().actionGet();
         log.debug("Deindexed Entity with index id " + indexId);
     }
 
     public Results execute(Query query) {
 
         QueryBuilder qb = query.createQueryBuilder();
-        log.debug("Executing query on type {} query: {} ", scope.getName(), query.toString());
 
         SearchResponse sr;
 
         if (query.getCursor() == null) {
 
             log.debug("Executing query on type {} query: {} ", scope.getName(), qb.toString());
+            log.debug("   Type name: " + typeName );
 
-            SearchRequestBuilder srb = client.prepareSearch(index)
-                    .setTypes( scope.getName() )
-                    .setScroll( cursorTimeout + "m" )
-                    .setQuery( qb );
+            SearchRequestBuilder srb = client.prepareSearch(indexName)
+                .setTypes( typeName )
+                .setScroll( cursorTimeout + "m" )
+                .setQuery( qb );
 
             FilterBuilder fb = query.createFilterBuilder();
             if (fb != null) {
@@ -209,6 +233,7 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
 
         } else {
             log.debug("Executing query on type {} cursor: {} ", scope.getName(), query.getCursor());
+
             SearchScrollRequestBuilder ssrb = client.prepareSearchScroll(query.getCursor())
                     .setScroll( cursorTimeout + "m" );
             sr = ssrb.execute().actionGet();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
index 44dd9e6..edae017 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
@@ -49,36 +49,49 @@ public class EsProvider {
     }
 
     public synchronized Client getClient() {
+       if ( client == null ) {
+           client = getClient( indexFig );
+       }
+       return client;
+    }
+
+    public static synchronized Client getClient( IndexFig fig ) {
+
+        Client newClient = null;
 
-        if ( client == null ) {
+        if ( fig.isEmbedded() ) {
 
-            if ( indexFig.isEmbedded() ) {
+            log.info("--------------------------------");
+            log.info("Starting embedded ElasticSearch");
+            log.info("--------------------------------");
 
-                log.info("Starting ElasticSearch");
+            int port = AvailablePortFinder.getNextAvailable( 2000 );
+            Settings settings = ImmutableSettings.settingsBuilder()
+                    .put( "node.http.enabled", true )
+                    .put( "transport.tcp.port", port )
+                    .put( "path.logs", "target/elasticsearch/logs_" + port )
+                    .put( "path.data", "target/elasticsearch/data_" + port )
+                    .put( "gateway.type", "none" )
+                    .put( "index.store.type", "memory" )
+                    .put( "index.number_of_shards", 1 )
+                    .put( "index.number_of_replicas", 1 ).build();
 
-                int port = AvailablePortFinder.getNextAvailable( 2000 );
-                Settings settings = ImmutableSettings.settingsBuilder()
-                        .put( "node.http.enabled", true )
-                        .put( "transport.tcp.port", port )
-                        .put( "path.logs", "target/elasticsearch/logs_" + port )
-                        .put( "path.data", "target/elasticsearch/data_" + port )
-                        .put( "gateway.type", "none" )
-                        .put( "index.store.type", "memory" )
-                        .put( "index.number_of_shards", 1 )
-                        .put( "index.number_of_replicas", 1 ).build();
+            Node node = NodeBuilder.nodeBuilder().local( true ).settings( settings ).node();
+            newClient = node.client();
+        
+        } else { // build client that connects to all hosts
 
-                Node node = NodeBuilder.nodeBuilder().local( true ).settings( settings ).node();
-                client = node.client();
-            
-            } else { // build client that connects to all hosts
+            log.info("--------------------------------");
+            log.info("Creating ElasticSearch client");
+            log.info("--------------------------------");
 
-                TransportClient tclient = new TransportClient();
-                for ( String host : indexFig.getHosts().split(",") ) {
-                    tclient.addTransportAddress(new InetSocketTransportAddress( host, indexFig.getPort() ));
-                }
-                client = tclient;
+            TransportClient transportClient = new TransportClient();
+            for ( String host : fig.getHosts().split(",") ) {
+                transportClient.addTransportAddress(
+                        new InetSocketTransportAddress( host, fig.getPort() ));
             }
+            newClient = transportClient;
         }
-        return client;
+        return newClient;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CollectionIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CollectionIT.java
index 3a8fc2d..3510568 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CollectionIT.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CollectionIT.java
@@ -54,9 +54,11 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.ClassRule;
+import org.junit.Ignore;
 import org.junit.runner.RunWith;
 
 
+@Ignore
 @RunWith(JukitoRunner.class)
 @UseModules({ TestIndexModule.class })
 public class CollectionIT {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchRule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchRule.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchRule.java
index 5ffeecb..5dcd49e 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchRule.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchRule.java
@@ -22,25 +22,27 @@ import com.google.inject.Guice;
 import com.google.inject.Injector;
 import org.apache.usergrid.persistence.index.IndexFig;
 import org.elasticsearch.client.Client;
-import org.junit.rules.ExternalResource;
+import org.safehaus.guicyfig.Env;
+import org.safehaus.guicyfig.EnvironResource;
 import org.safehaus.guicyfig.GuicyFigModule;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class ElasticSearchRule extends ExternalResource {
+public class ElasticSearchRule extends EnvironResource {
     private static final Logger log = LoggerFactory.getLogger( ElasticSearchRule.class ); 
 
     private Client client;
 
     private final IndexFig indexFig;
 
-    private EsProvider esProvider;
-
     public ElasticSearchRule() {
+        super( Env.UNIT );
         Injector injector = Guice.createInjector( new GuicyFigModule( IndexFig.class ) );
         indexFig = injector.getInstance( IndexFig.class );
-        esProvider = injector.getInstance( EsProvider.class );
+
+        log.info("Embedded: " + indexFig.isEmbedded());
+        log.info("Limit: " + indexFig.getQueryLimitDefault());
     }
 
     @Override
@@ -50,10 +52,10 @@ public class ElasticSearchRule extends ExternalResource {
 
     @Override
     protected void before() throws Throwable {
-        client = esProvider.getClient();
+        client = EsProvider.getClient( indexFig );
     }
 
-    public Client getClient() {
+    public synchronized Client getClient() {
         return client;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityCollectionIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityCollectionIndexTest.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityCollectionIndexTest.java
index c8d013c..fedecb3 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityCollectionIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityCollectionIndexTest.java
@@ -174,7 +174,7 @@ public class EntityCollectionIndexTest {
 
         testQuery( entityIndex, "name = 'Morgan'", 0);
 
-        testQuery( entityIndex, "name" + EsEntityCollectionIndex.ANALYZED_SUFFIX + " = 'Morgan'", 1);
+        testQuery( entityIndex, "name contains 'Morgan'", 1);
 
         testQuery( entityIndex, "company > 'GeoLogix'", 564);
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoIT.java
index 9e05775..51ba458 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoIT.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoIT.java
@@ -47,6 +47,7 @@ import org.jukito.UseModules;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import org.junit.ClassRule;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -54,6 +55,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
+@Ignore
 @RunWith(JukitoRunner.class)
 @UseModules({ TestIndexModule.class })
 public class GeoIT {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java
index 79852d8..d31a121 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexIT.java
@@ -47,7 +47,7 @@ import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
+@Ignore
 @RunWith(JukitoRunner.class)
 @UseModules({ TestIndexModule.class })
 public class IndexIT {
@@ -82,13 +82,13 @@ public class IndexIT {
             "X-ray", "Yankee", "Zulu"
     };
 
-    @Ignore // TODO: diagnose why this sometimes hangs and causes all subsequent tests to fail.
+    //@Ignore // TODO: diagnose why this sometimes hangs and causes all subsequent tests to fail.
     @Test
     public void testCollectionOrdering() throws Exception {
         LOG.info( "testCollectionOrdering" );
 
         Id appId = new SimpleId("application");
-        Id orgId = new SimpleId("organization");
+        Id orgId = new SimpleId("testCollectionOrdering");
         EntityManagerFacade em = new EntityManagerFacade( orgId, appId, 
             collectionManagerFactory, collectionIndexFactory );
 
@@ -153,13 +153,13 @@ public class IndexIT {
     }
 
 
-    @Ignore // TODO: diagnose why this sometimes hangs and causes all subsequent tests to fail.
+    //@Ignore // TODO: diagnose why this sometimes hangs and causes all subsequent tests to fail.
     @Test
     public void testCollectionFilters() throws Exception {
         LOG.info( "testCollectionFilters" );
 
         Id appId = new SimpleId("application");
-        Id orgId = new SimpleId("organization");
+        Id orgId = new SimpleId("testCollectionFilters");
         EntityManagerFacade em = new EntityManagerFacade( orgId, appId, 
             collectionManagerFactory, collectionIndexFactory );
 
@@ -275,13 +275,13 @@ public class IndexIT {
         assertEquals( entityId, r.getEntity().getId() );
     }
 
-    @Ignore // TODO: diagnose why this sometimes hangs and causes all subsequent tests to fail.
+    //@Ignore // TODO: diagnose why this sometimes hangs and causes all subsequent tests to fail.
     @Test
     public void testSecondarySorts() throws Exception {
         LOG.info( "testSecondarySorts" );
 
         Id appId = new SimpleId("application");
-        Id orgId = new SimpleId("organization");
+        Id orgId = new SimpleId("testSecondarySorts");
         EntityManagerFacade em = new EntityManagerFacade( orgId, appId, 
             collectionManagerFactory, collectionIndexFactory );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
index 089446b..bad4343 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
@@ -77,8 +77,8 @@ public class EntityManagerFacade {
             collectionName = type + "s";
         }
         typesByCollectionNames.put( collectionName, type );
-        
-        Entity entity = new Entity(new SimpleId(UUIDGenerator.newTimeUUID(), scope.getName()));
+
+        Entity entity = new Entity(new SimpleId(UUIDGenerator.newTimeUUID(), type ));
         entity = EntityBuilder.fromMap( scope.getName(), entity, properties );
         entity = ecm.write( entity ).toBlockingObservable().last();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ecb674ae/stack/corepersistence/queryindex/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/resources/log4j.properties b/stack/corepersistence/queryindex/src/test/resources/log4j.properties
index cc51888..c2f39ef 100644
--- a/stack/corepersistence/queryindex/src/test/resources/log4j.properties
+++ b/stack/corepersistence/queryindex/src/test/resources/log4j.properties
@@ -4,7 +4,7 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %c{3}.%M(%L)<%t>- %m%n
 
-log4j.logger.org.safehaus.guicyfig=ERROR
+log4j.logger.org.safehaus.guicyfig=DEBUG
 log4j.logger.org.safehaus.chop.plugin=INFO
 log4j.logger.org.safehaus.chop.api.store.amazon=DEBUG