usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [1/2] Refactor of loader started
Date Thu, 09 Oct 2014 19:28:57 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/collection_multiget 63094abc3 -> 7af7e702e


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
index 8bd98f4..e4aeb0b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
@@ -20,8 +20,10 @@ package org.apache.usergrid.persistence.collection.serialization.impl;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -35,8 +37,10 @@ import org.apache.cassandra.db.marshal.ReversedType;
 import org.apache.cassandra.db.marshal.UUIDType;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.VersionSet;
+import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
@@ -54,9 +58,9 @@ import com.netflix.astyanax.ColumnListMutation;
 import com.netflix.astyanax.Keyspace;
 import com.netflix.astyanax.MutationBatch;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import com.netflix.astyanax.connectionpool.exceptions.NotFoundException;
 import com.netflix.astyanax.model.Column;
 import com.netflix.astyanax.model.ColumnList;
+import com.netflix.astyanax.model.Row;
 import com.netflix.astyanax.serializers.AbstractSerializer;
 import com.netflix.astyanax.serializers.UUIDSerializer;
 
@@ -69,13 +73,13 @@ import com.netflix.astyanax.serializers.UUIDSerializer;
 @Singleton
 public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerializationStrategy, Migration {
 
-    private static final Logger LOG =  LoggerFactory.getLogger( MvccLogEntrySerializationStrategyImpl.class );
+    private static final Logger LOG = LoggerFactory.getLogger( MvccLogEntrySerializationStrategyImpl.class );
 
     private static final StageSerializer SER = new StageSerializer();
 
     private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
 
-    private static final CollectionScopedRowKeySerializer<Id> ROW_KEY_SER = 
+    private static final CollectionScopedRowKeySerializer<Id> ROW_KEY_SER =
             new CollectionScopedRowKeySerializer<Id>( ID_SER );
 
     private static final MultiTennantColumnFamily<CollectionScope, Id, UUID> CF_ENTITY_LOG =
@@ -102,7 +106,7 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
 
         final Stage stage = entry.getStage();
         final UUID colName = entry.getVersion();
-        final StageStatus stageStatus = new StageStatus(stage,entry.getState());
+        final StageStatus stageStatus = new StageStatus( stage, entry.getState() );
 
         return doWrite( collectionScope, entry.getEntityId(), entry.getVersion(), new RowOp() {
             @Override
@@ -122,44 +126,90 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
 
 
     @Override
-    public MvccLogEntry load( final CollectionScope collectionScope, final Id entityId, final UUID version )
-            throws ConnectionException {
+    public VersionSet load( final CollectionScope collectionScope, final Collection<Id> entityIds,
+                            final UUID maxVersion ) {
         Preconditions.checkNotNull( collectionScope, "collectionScope is required" );
-        Preconditions.checkNotNull( entityId, "entity id is required" );
-        Preconditions.checkNotNull( version, "version is required" );
+        Preconditions.checkNotNull( entityIds, "entityIds is required" );
+        Preconditions.checkArgument( entityIds.size() > 0, "You must specify an Id" );
+        Preconditions.checkNotNull( maxVersion, "maxVersion is required" );
+
+
+        //didnt put the max in the error message, I don't want to take the string construction hit every time
+        Preconditions.checkArgument( entityIds.size() <= fig.getMaxLoadSize(),
+                "requested size cannot be over configured maximum" );
+
+
+        final List<ScopedRowKey<CollectionScope, Id>> rowKeys = new ArrayList<>( entityIds.size() );
+
+
+        for ( final Id entityId : entityIds ) {
+            rowKeys.add( ScopedRowKey.fromKey( collectionScope, entityId ) );
+        }
 
 
-        Column<UUID> result;
+        final Iterator<Row<ScopedRowKey<CollectionScope, Id>, UUID>> latestEntityColumns;
+
 
         try {
-            result = keyspace.prepareQuery( CF_ENTITY_LOG ).getKey( ScopedRowKey
-                    .fromKey( collectionScope, entityId ) )
-                             .getColumn( version ).execute().getResult();
+            latestEntityColumns = keyspace.prepareQuery( CF_ENTITY_LOG ).getKeySlice( rowKeys )
+                                          .withColumnRange( maxVersion, null, false, 1 ).execute().getResult()
+                                          .iterator();
         }
-        catch ( NotFoundException nfe ) {
-            return null;
+        catch ( ConnectionException e ) {
+            throw new CollectionRuntimeException( null, collectionScope, "An error occurred connecting to cassandra",
+                    e );
         }
 
 
-        final StageStatus stageStatus = result.getValue( SER );
+        final VersionSetImpl versionResults = new VersionSetImpl( entityIds.size() );
+
+        while ( latestEntityColumns.hasNext() ) {
+            final Row<ScopedRowKey<CollectionScope, Id>, UUID> row = latestEntityColumns.next();
+
+            final ColumnList<UUID> columns = row.getColumns();
+
+            if ( columns.size() == 0 ) {
+                continue;
+            }
+
+
+            final Id entityId = row.getKey().getKey();
+
+            final Column<UUID> column = columns.getColumnByIndex( 0 );
 
-        return new MvccLogEntryImpl( entityId, version, stageStatus.stage, stageStatus.state );
+
+            final UUID version = column.getName();
+
+            final StageStatus stageStatus = column.getValue( SER );
+
+            final MvccLogEntry logEntry =
+                    new MvccLogEntryImpl( entityId, version, stageStatus.stage, stageStatus.state );
+
+
+            versionResults.addEntry( logEntry );
+        }
+
+        return versionResults;
     }
 
 
     @Override
     public List<MvccLogEntry> load( final CollectionScope collectionScope, final Id entityId, final UUID version,
-                                    final int maxSize ) throws ConnectionException {
+                                    final int maxSize ) {
         Preconditions.checkNotNull( collectionScope, "collectionScope is required" );
         Preconditions.checkNotNull( entityId, "entity id is required" );
         Preconditions.checkNotNull( version, "version is required" );
         Preconditions.checkArgument( maxSize > 0, "max Size must be greater than 0" );
 
 
-        ColumnList<UUID> columns =
-                keyspace.prepareQuery( CF_ENTITY_LOG ).getKey( ScopedRowKey
-                        .fromKey( collectionScope, entityId ) )
-                        .withColumnRange( version, null, false, maxSize ).execute().getResult();
+        ColumnList<UUID> columns = null;
+        try {
+            columns = keyspace.prepareQuery( CF_ENTITY_LOG ).getKey( ScopedRowKey.fromKey( collectionScope, entityId ) )
+                              .withColumnRange( version, null, false, maxSize ).execute().getResult();
+        }
+        catch ( ConnectionException e ) {
+            throw new RuntimeException( "Unable to load log entries", e );
+        }
 
 
         List<MvccLogEntry> results = new ArrayList<MvccLogEntry>( columns.size() );
@@ -182,7 +232,7 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
         Preconditions.checkNotNull( entityId, "entityId is required" );
         Preconditions.checkNotNull( version, "version context is required" );
 
-        return doWrite( context, entityId, version,  new RowOp() {
+        return doWrite( context, entityId, version, new RowOp() {
             @Override
             public void doOp( final ColumnListMutation<UUID> colMutation ) {
                 colMutation.deleteColumn( version );
@@ -192,13 +242,13 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
 
 
     @Override
-    public java.util.Collection getColumnFamilies() {
+    public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
         //create the CF entity data.  We want it reversed b/c we want the most recent version at the top of the
         //row for fast seeks
-        MultiTennantColumnFamilyDefinition cf = new MultiTennantColumnFamilyDefinition( CF_ENTITY_LOG,
-                BytesType.class.getSimpleName(),
-                ReversedType.class.getSimpleName() + "(" + UUIDType.class.getSimpleName() + ")",
-                IntegerType.class.getSimpleName() , MultiTennantColumnFamilyDefinition.CacheOption.KEYS);
+        MultiTennantColumnFamilyDefinition cf =
+                new MultiTennantColumnFamilyDefinition( CF_ENTITY_LOG, BytesType.class.getSimpleName(),
+                        ReversedType.class.getSimpleName() + "(" + UUIDType.class.getSimpleName() + ")",
+                        IntegerType.class.getSimpleName(), MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
 
 
         return Collections.singleton( cf );
@@ -261,12 +311,13 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
         }
     }
 
+
     /**
      * Internal stage shard
      */
     private static class StatusCache {
-        private Map<Integer, MvccLogEntry.State> values = new HashMap<Integer, MvccLogEntry.State>( MvccLogEntry.State
-                                                                                                                .values().length );
+        private Map<Integer, MvccLogEntry.State> values =
+                new HashMap<Integer, MvccLogEntry.State>( MvccLogEntry.State.values().length );
 
 
         private StatusCache() {
@@ -287,6 +338,7 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
         }
     }
 
+
     public static class StageSerializer extends AbstractSerializer<StageStatus> {
 
         /**
@@ -295,12 +347,13 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
         private static final StageCache CACHE = new StageCache();
         private static final StatusCache STATUS_CACHE = new StatusCache();
 
+
         @Override
         public ByteBuffer toByteBuffer( final StageStatus obj ) {
 
-            ByteBuffer byteBuffer  = ByteBuffer.allocate(8);
-            byteBuffer.putInt(obj.stage.getId());
-            byteBuffer.putInt(obj.state.getId());
+            ByteBuffer byteBuffer = ByteBuffer.allocate( 8 );
+            byteBuffer.putInt( obj.stage.getId() );
+            byteBuffer.putInt( obj.state.getId() );
             byteBuffer.rewind();
             return byteBuffer;
         }
@@ -311,18 +364,20 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
             int value = byteBuffer.getInt();
             Stage stage = CACHE.getStage( value );
             value = byteBuffer.getInt();
-            MvccLogEntry.State state =  STATUS_CACHE.getStatus(value);
-            return new StageStatus(stage, state );
+            MvccLogEntry.State state = STATUS_CACHE.getStatus( value );
+            return new StageStatus( stage, state );
         }
     }
 
+
     public static class StageStatus {
         final Stage stage;
         final MvccLogEntry.State state;
-        public StageStatus(Stage stage, MvccLogEntry.State state ){
+
+
+        public StageStatus( Stage stage, MvccLogEntry.State state ) {
             this.stage = stage;
             this.state = state;
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/VersionSetImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/VersionSetImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/VersionSetImpl.java
new file mode 100644
index 0000000..0adb921
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/VersionSetImpl.java
@@ -0,0 +1,80 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.persistence.collection.serialization.impl;/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.VersionSet;
+import org.apache.usergrid.persistence.model.entity.Id;
+
+
+/**
+ * Implementation of the version set
+ */
+public class VersionSetImpl implements VersionSet {
+
+    private final Map<Id, MvccLogEntry> logEntries;
+
+    public VersionSetImpl(final int maxSize){
+        logEntries = new HashMap<>( maxSize );
+    }
+
+    public void addEntry(final MvccLogEntry entry){
+        this.logEntries.put( entry.getEntityId(), entry );
+    }
+
+    @Override
+    public MvccLogEntry getMaxVersion( final Id entityId ) {
+        return this.logEntries.get( entityId );
+    }
+
+
+    @Override
+    public int size() {
+        return this.logEntries.size();
+    }
+
+
+    @Override
+    public boolean isEmpty() {
+        return this.logEntries.isEmpty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
index a7f9ea2..c01e022 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
@@ -19,6 +19,7 @@ package org.apache.usergrid.persistence.collection;
 
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.UUID;
 
@@ -31,7 +32,7 @@ import org.apache.usergrid.persistence.collection.exception.WriteUniqueVerifyExc
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.core.cassandra.ITRunner;
 import org.apache.usergrid.persistence.model.entity.Entity;
@@ -432,21 +433,19 @@ public class EntityCollectionManagerIT {
 
         assertNotNull( entitySet );
 
-        assertEquals(multigetSize, entitySet.size());
-        assertFalse(entitySet.isEmpty());
+        assertEquals( multigetSize, entitySet.size() );
+        assertFalse( entitySet.isEmpty() );
 
         /**
          * Validate every element exists
          */
-        for(int i = 0; i < multigetSize; i ++){
+        for ( int i = 0; i < multigetSize; i++ ) {
             final Entity expected = writtenEntities.get( i );
 
             final MvccEntity returned = entitySet.getEntity( expected.getId() );
 
-            assertEquals("Same entity returned", expected, returned.getEntity().get());
+            assertEquals( "Same entity returned", expected, returned.getEntity().get() );
         }
-
-
     }
 
 
@@ -454,64 +453,61 @@ public class EntityCollectionManagerIT {
      * Perform a multiget where every entity will need repaired on load
      */
     @Test
-     public void writeMultigetRepair() {
-
-           final CollectionScope context =
-                   new CollectionScopeImpl( new SimpleId( "organization" ), new SimpleId( "test" ), "test" );
-           final EntityCollectionManager manager = factory.createCollectionManager( context );
-
-           final int multigetSize = serializationFig.getMaxLoadSize();
-
-           final List<Entity> writtenEntities = new ArrayList<>( multigetSize );
-           final List<Id> entityIds = new ArrayList<>( multigetSize );
+    public void writeMultigetRepair() {
 
-           for ( int i = 0; i < multigetSize; i++ ) {
-               final Entity entity = new Entity( new SimpleId( "test" ) );
+        final CollectionScope context =
+                new CollectionScopeImpl( new SimpleId( "organization" ), new SimpleId( "test" ), "test" );
+        final EntityCollectionManager manager = factory.createCollectionManager( context );
 
-               final Entity written = manager.write( entity ).toBlocking().last();
+        final int multigetSize = serializationFig.getMaxLoadSize();
 
-               written.setField( new BooleanField( "updated", true ) );
+        final List<Entity> writtenEntities = new ArrayList<>( multigetSize );
+        final List<Id> entityIds = new ArrayList<>( multigetSize );
 
-               final Entity updated  = manager.update( written ).toBlocking().last();
+        for ( int i = 0; i < multigetSize; i++ ) {
+            final Entity entity = new Entity( new SimpleId( "test" ) );
 
-               writtenEntities.add( updated );
-               entityIds.add( updated.getId() );
-           }
+            final Entity written = manager.write( entity ).toBlocking().last();
 
+            written.setField( new BooleanField( "updated", true ) );
 
-           final EntitySet entitySet = manager.load( entityIds ).toBlocking().lastOrDefault( null );
+            final Entity updated = manager.update( written ).toBlocking().last();
 
-           assertNotNull( entitySet );
+            writtenEntities.add( updated );
+            entityIds.add( updated.getId() );
+        }
 
-           assertEquals(multigetSize, entitySet.size());
-           assertFalse(entitySet.isEmpty());
 
-           /**
-            * Validate every element exists
-            */
-           for(int i = 0; i < multigetSize; i ++){
-               final Entity expected = writtenEntities.get( i );
+        final EntitySet entitySet = manager.load( entityIds ).toBlocking().lastOrDefault( null );
 
-               final MvccEntity returned = entitySet.getEntity( expected.getId() );
+        assertNotNull( entitySet );
 
-               assertEquals("Same entity returned", expected, returned.getEntity().get());
+        assertEquals( multigetSize, entitySet.size() );
+        assertFalse( entitySet.isEmpty() );
 
-               assertTrue( ( Boolean ) returned.getEntity().get().getField( "updated" ).getValue() );
-           }
+        /**
+         * Validate every element exists
+         */
+        for ( int i = 0; i < multigetSize; i++ ) {
+            final Entity expected = writtenEntities.get( i );
 
+            final MvccEntity returned = entitySet.getEntity( expected.getId() );
 
-       }
+            assertEquals( "Same entity returned", expected, returned.getEntity().get() );
 
+            assertTrue( ( Boolean ) returned.getEntity().get().getField( "updated" ).getValue() );
+        }
+    }
 
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test( expected = IllegalArgumentException.class )
     public void readTooLarge() {
 
         final CollectionScope context =
                 new CollectionScopeImpl( new SimpleId( "organization" ), new SimpleId( "test" ), "test" );
         final EntityCollectionManager manager = factory.createCollectionManager( context );
 
-        final int multigetSize = serializationFig.getMaxLoadSize() +1;
+        final int multigetSize = serializationFig.getMaxLoadSize() + 1;
 
 
         final List<Id> entityIds = new ArrayList<>( multigetSize );
@@ -524,25 +520,47 @@ public class EntityCollectionManagerIT {
 
         //should throw an exception
         manager.load( entityIds ).toBlocking().lastOrDefault( null );
+    }
 
 
-
-    }
     @Test
     public void testGetVersion() {
 
-        CollectionScope context = new CollectionScopeImpl(
-                new SimpleId( "organization" ),  new SimpleId( "test" ), "test" );
+        CollectionScope context =
+                new CollectionScopeImpl( new SimpleId( "organization" ), new SimpleId( "test" ), "test" );
+
+
+        final EntityCollectionManager manager = factory.createCollectionManager( context );
+
+        final Entity newEntity = new Entity( new SimpleId( "test" ) );
+
+        Entity created1 = manager.write( newEntity ).toBlocking().lastOrDefault( null );
+
+        assertNotNull( "Id was assigned", created1.getId() );
+        assertNotNull( "Version was assigned", created1.getVersion() );
+
+        Entity secondEntity = new Entity( new SimpleId( "test" ) );
+
+        Entity created2 = manager.write( secondEntity ).toBlocking().lastOrDefault( null );
+
+        assertNotNull( "Id was assigned", created2.getId() );
+        assertNotNull( "Version was assigned", created2.getVersion() );
+
+
+        VersionSet results =
+                manager.getLatestVersion( Arrays.asList( created1.getId(), created2.getId() ) ).toBlocking().last();
 
-        Entity newEntity = new Entity( new SimpleId( "test" ) );
-        EntityCollectionManager manager = factory.createCollectionManager( context );
-        Observable<Entity> observable = manager.write( newEntity );
-        Entity created = observable.toBlocking().lastOrDefault( null );
 
-        assertNotNull("Id was assigned", created.getId() );
-        assertNotNull("Version was assigned", created.getVersion() );
+        final MvccLogEntry version1Log = results.getMaxVersion( created1.getId() );
+        assertEquals( created1.getId(), version1Log.getEntityId() );
+        assertEquals( created1.getVersion(), version1Log.getVersion() );
+        assertEquals( MvccLogEntry.State.COMPLETE, version1Log.getState() );
+        assertEquals( Stage.COMMITTED, version1Log.getStage() );
 
-        assertTrue(UUIDComparator.staticCompare(created.getVersion(), 
-            manager.getLatestVersion( created.getId() ).toBlocking().lastOrDefault(null)) == 0);
+        final MvccLogEntry version2Log = results.getMaxVersion( created2.getId() );
+        assertEquals( created2.getId(), version2Log.getEntityId() );
+        assertEquals( created2.getVersion(), version2Log.getVersion() );
+        assertEquals( MvccLogEntry.State.COMPLETE, version2Log.getState() );
+        assertEquals( Stage.COMMITTED, version2Log.getStage() );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/changelog/ChangeLogGeneratorImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/changelog/ChangeLogGeneratorImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/changelog/ChangeLogGeneratorImplTest.java
index 6795893..0ca0649 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/changelog/ChangeLogGeneratorImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/changelog/ChangeLogGeneratorImplTest.java
@@ -20,14 +20,13 @@ package org.apache.usergrid.persistence.collection.mvcc.changelog;
 
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImplTest.java
index 33c3102..52cf954 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccEntityImplTest.java
@@ -23,7 +23,7 @@ import java.util.UUID;
 
 import org.junit.Test;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccLogEntryImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccLogEntryImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccLogEntryImplTest.java
index eb9bd18..a892238 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccLogEntryImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/entity/impl/MvccLogEntryImplTest.java
@@ -5,7 +5,7 @@ import java.util.UUID;
 
 import org.junit.Test;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/AbstractMvccEntityStageTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/AbstractMvccEntityStageTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/AbstractMvccEntityStageTest.java
index 950130a..6c6ea0f 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/AbstractMvccEntityStageTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/AbstractMvccEntityStageTest.java
@@ -26,7 +26,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.util.EntityUtils;
 import org.apache.usergrid.persistence.collection.util.InvalidEntityGenerator;
 import org.apache.usergrid.persistence.collection.util.InvalidIdGenerator;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/TestEntityGenerator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/TestEntityGenerator.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/TestEntityGenerator.java
index 99cd335..576c1c6 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/TestEntityGenerator.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/TestEntityGenerator.java
@@ -20,7 +20,7 @@ package org.apache.usergrid.persistence.collection.mvcc.stage;
 
 import java.util.UUID;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.util.EntityUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommitTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommitTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommitTest.java
index c2876b0..f5dc24c 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommitTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommitTest.java
@@ -1,16 +1,14 @@
 package org.apache.usergrid.persistence.collection.mvcc.stage.delete;
 
 
-import java.security.Key;
-
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.stage.AbstractMvccEntityStageTest;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStartTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStartTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStartTest.java
index 1b04022..6c13dd5 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStartTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStartTest.java
@@ -8,8 +8,8 @@ import org.mockito.ArgumentCaptor;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.stage.AbstractIdStageTest;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommitTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommitTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommitTest.java
index b0ccb4f..93cde8e 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommitTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommitTest.java
@@ -24,8 +24,8 @@ import org.mockito.ArgumentCaptor;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.stage.AbstractMvccEntityStageTest;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerifyTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerifyTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerifyTest.java
index c64fe23..85fce69 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerifyTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerifyTest.java
@@ -30,8 +30,8 @@ import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.WriteOptimisticVerifyException;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.mvcc.stage.AbstractMvccEntityStageTest;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStartTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStartTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStartTest.java
index 3ff3e09..e32c17c 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStartTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStartTest.java
@@ -23,8 +23,8 @@ import org.mockito.ArgumentCaptor;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.stage.AbstractEntityStageTest;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
index 1dc2f32..6551716 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerifyTest.java
@@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/EntityRepairImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/EntityRepairImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/EntityRepairImplTest.java
index d1b2961..27f39dc 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/EntityRepairImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/EntityRepairImplTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
 import org.apache.usergrid.persistence.collection.serialization.impl.EntityRepairImpl;
 import org.apache.usergrid.persistence.model.entity.Entity;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/LogEntryIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/LogEntryIteratorTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/LogEntryIteratorTest.java
index 9ee284b..20d478d 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/LogEntryIteratorTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/LogEntryIteratorTest.java
@@ -10,7 +10,7 @@ import org.junit.Test;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.util.LogEntryMock;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
index 8965668..73cf848 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
@@ -38,7 +38,7 @@ import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.util.EntityUtils;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLESSTransientTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLESSTransientTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLESSTransientTest.java
index b1ed50d..fa80ca4 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLESSTransientTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLESSTransientTest.java
@@ -20,6 +20,7 @@
 package org.apache.usergrid.persistence.collection.serialization.impl;
 
 
+import java.util.Collections;
 import java.util.UUID;
 
 import org.jukito.UseModules;
@@ -35,7 +36,7 @@ import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
@@ -80,7 +81,7 @@ public class MvccLESSTransientTest {
 
         CollectionScope context = new CollectionScopeImpl( organizationId, applicationId, name );
 
-        final SimpleId id = new SimpleId( "test" );
+        final Id id = new SimpleId( "test" );
         final UUID version = UUIDGenerator.newTimeUUID();
 
         for ( Stage stage : Stage.values() ) {
@@ -93,7 +94,7 @@ public class MvccLESSTransientTest {
             //noinspection PointlessArithmeticExpression
             Thread.sleep( 1000 );
 
-            MvccLogEntry returned = logEntryStrategy.load( context, id, version );
+            MvccLogEntry returned = logEntryStrategy.load( context, Collections.singleton(id), version ).getMaxVersion( id );
 
 
             if ( stage.isTransient() ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
index 25daa3b..629dd83 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImplTest.java
@@ -20,6 +20,7 @@
 package org.apache.usergrid.persistence.collection.serialization.impl;
 
 
+import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 
@@ -33,7 +34,7 @@ import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.collection.guice.TestCollectionModule;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.core.cassandra.ITRunner;
@@ -74,7 +75,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
         CollectionScope context = new CollectionScopeImpl(organizationId, applicationId, name );
 
 
-        final SimpleId id = new SimpleId( "test" );
+        final Id id = new SimpleId( "test" );
         final UUID version = UUIDGenerator.newTimeUUID();
 
         for ( Stage stage : Stage.values() ) {
@@ -83,7 +84,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
 
             //Read it back
 
-            MvccLogEntry returned = logEntryStrategy.load( context, id, version );
+            MvccLogEntry returned = logEntryStrategy.load( context, Collections.singleton(id), version ).getMaxVersion( id );
 
             assertNotNull( "Returned value should not be null", returned );
 
@@ -103,11 +104,11 @@ public class MvccLogEntrySerializationStrategyImplTest {
         CollectionScope context = new CollectionScopeImpl(organizationId, applicationId, name );
 
 
-        final SimpleId id = new SimpleId( "test" );
+        final Id id = new SimpleId( "test" );
         final UUID version = UUIDGenerator.newTimeUUID();
 
 
-        MvccLogEntry returned = logEntryStrategy.load( context, id, version );
+        MvccLogEntry returned = logEntryStrategy.load( context, Collections.singleton(id), version ).getMaxVersion( id );
 
         assertNull( "Returned value should not exist", returned );
     }
@@ -124,7 +125,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
         CollectionScope context = new CollectionScopeImpl(organizationId, applicationId, name );
 
 
-        final SimpleId id = new SimpleId( "test" );
+        final Id id = new SimpleId( "test" );
 
         int count = 10;
 
@@ -141,7 +142,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
 
             //Read it back
 
-            MvccLogEntry returned = logEntryStrategy.load( context, id, versions[i] );
+            MvccLogEntry returned = logEntryStrategy.load( context, Collections.singleton(id), versions[i] ).getMaxVersion( id );
 
             assertNotNull( "Returned value should not be null", returned );
 
@@ -210,7 +211,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
 
     @Test(expected = NullPointerException.class)
     public void loadParamContext() throws ConnectionException {
-        logEntryStrategy.load( null, new SimpleId( "test" ), UUIDGenerator.newTimeUUID() );
+        logEntryStrategy.load( null, Collections.<Id>emptyList(), UUIDGenerator.newTimeUUID() );
     }
 
 
@@ -227,7 +228,7 @@ public class MvccLogEntrySerializationStrategyImplTest {
 
         logEntryStrategy
                 .load( new CollectionScopeImpl( new SimpleId( "organization" ), new SimpleId( "test" ), "test" ),
-                        new SimpleId( "test" ), null );
+                        Collections.<Id>singleton( new SimpleId( "test" )), null );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidMvccEntityGenerator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidMvccEntityGenerator.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidMvccEntityGenerator.java
index 48dc38c..550f02a 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidMvccEntityGenerator.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidMvccEntityGenerator.java
@@ -31,7 +31,7 @@ import org.junit.experimental.theories.PotentialAssignment;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidValueGeneratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidValueGeneratorTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidValueGeneratorTest.java
index b2616d9..adb79ab 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidValueGeneratorTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/InvalidValueGeneratorTest.java
@@ -25,7 +25,7 @@ import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7af7e702/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/LogEntryMock.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/LogEntryMock.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/LogEntryMock.java
index a25bc94..57c06f5 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/LogEntryMock.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/LogEntryMock.java
@@ -20,7 +20,6 @@ package org.apache.usergrid.persistence.collection.util;/*
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
@@ -32,14 +31,13 @@ import org.mockito.stubbing.Answer;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
 import com.fasterxml.uuid.UUIDComparator;
-import com.google.common.base.Preconditions;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
 import static org.mockito.Matchers.any;


Mime
View raw message