usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [2/4] incubator-usergrid git commit: entityindextest and more timers
Date Tue, 10 Mar 2015 20:24:37 GMT
entityindextest and more timers


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

Branch: refs/heads/USERGRID-466
Commit: 7f83c3d449c2a4ba6bb081a2d0406f013e7e581a
Parents: 6730905
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Tue Mar 10 13:40:24 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Tue Mar 10 13:40:24 2015 -0600

----------------------------------------------------------------------
 .../index/impl/EsEntityIndexImpl.java           |  3 +-
 .../persistence/index/impl/EntityIndexTest.java | 42 ++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7f83c3d4/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index c92b299..ea3cb4d 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -196,7 +196,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
 
         final MapScope mapScope = new MapScopeImpl( appScope.getApplication(), "cursorcache"
);
 
-        mapManager = mapManagerFactory.createMapManager( mapScope );
+        mapManager = mapManagerFactory.createMapManager(mapScope);
     }
 
     @Override
@@ -680,6 +680,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
 
             @Override
             public void onFailure( Throwable e ) {
+                timeDeleteAllVersions.stop();
                 logger.error( "Deleted entity {}:{} from all index scopes with error {}",
entityId.getType(),
                     entityId.getUuid(), e);
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7f83c3d4/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index a3332a8..c1dfb55 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@ -25,7 +25,10 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.usergrid.persistence.index.*;
+import org.apache.usergrid.persistence.model.field.ArrayField;
+import org.apache.usergrid.persistence.model.field.EntityObjectField;
 import org.apache.usergrid.persistence.model.field.UUIDField;
+import org.apache.usergrid.persistence.model.field.value.EntityObject;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -86,6 +89,45 @@ public class EntityIndexTest extends BaseIT {
     }
 
     @Test
+    public void testIndexVariations() throws IOException {
+        Id appId = new SimpleId( "application" );
+
+        ApplicationScope applicationScope = new ApplicationScopeImpl( appId );
+
+        EntityIndex entityIndex = eif.createEntityIndex( applicationScope );
+        entityIndex.initializeIndex();
+
+        final String entityType = "thing";
+        IndexScope indexScope = new IndexScopeImpl( appId, "things" );
+        final SearchTypes searchTypes = SearchTypes.fromTypes( entityType );
+        EntityIndexBatch batch = entityIndex.createBatch();
+        Entity entity = new Entity( entityType );
+        EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
+        entity.setField(new UUIDField(IndexingUtils.ENTITYID_ID_FIELDNAME, UUID.randomUUID()));
+        entity.setField(new StringField("testfield","test"));
+        batch.index(indexScope, entity);
+        batch.execute().get();
+
+        EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
+        List<String> list = new ArrayList<>();
+        list.add("test");
+        entity.setField(new ArrayField<String>("testfield", list));
+        batch.index(indexScope, entity);
+        batch.execute().get();
+
+        EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
+        EntityObject testObj = new EntityObject();
+        testObj.setField(new StringField("test","testFiedl"));
+        entity.setField(new EntityObjectField("testfield", testObj));
+        batch.index(indexScope, entity);
+        batch.execute().get();
+
+        entityIndex.refresh();
+
+        testQueries( indexScope, searchTypes,  entityIndex );
+    }
+
+    @Test
     public void testIndexThreads() throws IOException {
         final Id appId = new SimpleId( "application" );
 


Mime
View raw message