Fix failing test to ensure we don't set the same timestamp for all entities inserted into the index (since we don't do actually do that). Also ensure it's a long as what's required of the timestamps
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/c652171f Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/c652171f Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/c652171f Branch: refs/heads/2.1-release Commit: c652171f476f6ad953c94328e0fb2f4ea0b3aa44 Parents: 22beca2 Author: Michael Russo <michaelaru...@gmail.com> Authored: Wed Oct 28 16:56:19 2015 -0700 Committer: Michael Russo <michaelaru...@gmail.com> Committed: Wed Oct 28 16:56:19 2015 -0700 ---------------------------------------------------------------------- .../persistence/index/impl/EntityIndexTest.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/c652171f/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 5243d5a..d6758dd 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 @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicLong; import com.google.common.base.Optional; import org.apache.usergrid.persistence.core.astyanax.CassandraFig; import org.apache.usergrid.persistence.index.*; +import org.apache.usergrid.persistence.model.field.*; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -48,10 +49,6 @@ import org.apache.usergrid.persistence.index.utils.UUIDUtils; import org.apache.usergrid.persistence.model.entity.Entity; import org.apache.usergrid.persistence.model.entity.Id; import org.apache.usergrid.persistence.model.entity.SimpleId; -import org.apache.usergrid.persistence.model.field.ArrayField; -import org.apache.usergrid.persistence.model.field.IntegerField; -import org.apache.usergrid.persistence.model.field.StringField; -import org.apache.usergrid.persistence.model.field.UUIDField; import org.apache.usergrid.persistence.model.util.EntityUtils; import org.apache.usergrid.persistence.model.util.UUIDGenerator; @@ -394,7 +391,6 @@ public class EntityIndexTest extends BaseIT { int numberOfEntities = 1000; int versionToSearchFor = numberOfEntities / 2; - IndexEdge searchEdge = new IndexEdgeImpl( appId, "mehCars", SearchEdge.NodeType.SOURCE, 1 ); UUID entityUUID = UUID.randomUUID(); Id entityId = new SimpleId( "mehCar" ); @@ -408,9 +404,11 @@ public class EntityIndexTest extends BaseIT { Entity[] entity = new Entity[numberOfEntities]; for(int i = 0; i < numberOfEntities; i++) { entity[i] = EntityIndexMapUtils.fromMap( entityMap ); - EntityUtils.setId( entity[i], entityId ); - EntityUtils.setVersion( entity[i], UUIDGenerator.newTimeUUID() ); - entity[i].setField( new UUIDField( IndexingUtils.ENTITY_ID_FIELDNAME, entityUUID ) ); + EntityUtils.setId(entity[i], entityId); + EntityUtils.setVersion(entity[i], UUIDGenerator.newTimeUUID()); + entity[i].setField(new UUIDField(IndexingUtils.ENTITY_ID_FIELDNAME, entityUUID)); + + IndexEdge searchEdge = new IndexEdgeImpl( appId, "mehCars", SearchEdge.NodeType.SOURCE, System.currentTimeMillis()*1000 ); //index the new entity. This is where the loop will be set to create like 100 entities. indexProducer.put(entityIndex.createBatch().index( searchEdge, entity[i] ).build()).subscribe();