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:04 UTC
[16/50] [abbrv] git commit: Add test for deindex() and ignore two
problematic tests.
Add test for deindex() and ignore two problematic 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/d53723b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d53723b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d53723b7
Branch: refs/heads/asyncqueue
Commit: d53723b7613f9a152205f944ed3ccd8de8bd6993
Parents: 699d274
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Mar 6 08:48:03 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Mar 6 08:48:03 2014 -0500
----------------------------------------------------------------------
.../index/impl/EntityCollectionIndexTest.java | 41 ++++++++++++++++----
.../persistence/index/impl/IndexIT.java | 4 +-
2 files changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d53723b7/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 90010fb..c8d013c 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
@@ -23,6 +23,7 @@ import com.google.common.collect.Maps;
import com.google.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.time.StopWatch;
@@ -47,7 +48,6 @@ import org.jukito.JukitoRunner;
import org.jukito.UseModules;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -114,6 +114,38 @@ public class EntityCollectionIndexTest {
testQueries( entityIndex );
}
+
+
+ @Test
+ public void testDeindex() {
+
+ Id appId = new SimpleId("AutoSpotterApp");
+ Id orgId = new SimpleId("AutoWorldMagazine");
+ CollectionScope scope = new CollectionScopeImpl( appId, orgId, "fastcars" );
+
+ EntityCollectionIndex entityIndex = collectionIndexFactory.createCollectionIndex( scope );
+ EntityCollectionManager entityManager = collectionManagerFactory.createCollectionManager( scope );
+
+ Map entityMap = new HashMap() {{
+ put("name", "Ferrari 212 Inter");
+ put("introduced", 1952);
+ put("topspeed", 215);
+ }};
+
+ Entity entity = EntityBuilder.fromMap( scope.getName(), entityMap );
+ EntityUtils.setId( entity, new SimpleId( "fastcar" ));
+ entity = entityManager.write( entity ).toBlockingObservable().last();
+ entityIndex.index( entity );
+
+ Results results = entityIndex.execute( Query.fromQL( "name contains 'Ferrari*'"));
+ assertEquals( 1, results.getEntities().size() );
+
+ entityManager.delete( entity.getId() );
+ entityIndex.deindex( entity );
+
+ results = entityIndex.execute( Query.fromQL( "name contains 'Ferrari*'"));
+ assertEquals( 0, results.getEntities().size() );
+ }
private void testQuery( EntityCollectionIndex entityIndex, String queryString, int num ) {
@@ -159,13 +191,6 @@ public class EntityCollectionIndexTest {
testQuery( entityIndex, "name = 'Minerva Harrell' and age <= 40", 1);
}
-
- @Test // TODO test for remove index
- @Ignore
- public void testRemoveIndex() {
- fail("Not implemented");
- }
-
@Test
public void testEntityToMap() throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d53723b7/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 28073f5..2a14cc8 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
@@ -40,6 +40,7 @@ import org.jukito.JukitoRunner;
import org.jukito.UseModules;
import static org.junit.Assert.assertEquals;
import org.junit.ClassRule;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -81,6 +82,7 @@ public class IndexIT {
"X-ray", "Yankee", "Zulu"
};
+ @Ignore // until we figure out why this hangs testing
@Test
public void testCollectionOrdering() throws Exception {
LOG.info( "testCollectionOrdering" );
@@ -272,7 +274,7 @@ public class IndexIT {
assertEquals( entityId, r.getEntity().getId() );
}
-
+ @Ignore // until we figure out why this hangs testing
@Test
public void testSecondarySorts() throws Exception {
LOG.info( "testSecondarySorts" );