Return-Path: X-Original-To: apmail-usergrid-commits-archive@minotaur.apache.org Delivered-To: apmail-usergrid-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1B5D11768E for ; Tue, 10 Mar 2015 20:24:37 +0000 (UTC) Received: (qmail 10089 invoked by uid 500); 10 Mar 2015 20:24:37 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 10069 invoked by uid 500); 10 Mar 2015 20:24:37 -0000 Mailing-List: contact commits-help@usergrid.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@usergrid.incubator.apache.org Delivered-To: mailing list commits@usergrid.incubator.apache.org Received: (qmail 10027 invoked by uid 99); 10 Mar 2015 20:24:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Mar 2015 20:24:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D19FEE187A; Tue, 10 Mar 2015 20:24:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sfeldman@apache.org To: commits@usergrid.apache.org Date: Tue, 10 Mar 2015 20:24:37 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/4] incubator-usergrid git commit: entityindextest and more timers 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 Authored: Tue Mar 10 13:40:24 2015 -0600 Committer: Shawn Feldman 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 list = new ArrayList<>(); + list.add("test"); + entity.setField(new ArrayField("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" );