You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/10/28 19:09:37 UTC

[1/3] git commit: Refactored merge to use Lists. Still O(log n) implementation, but faster access for page trimming

Repository: incubator-usergrid
Updated Branches:
  refs/heads/key-row-sharding 963fe57c4 -> ca943fed7


Refactored merge to use Lists.  Still O(log n) implementation, but faster access for page trimming


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

Branch: refs/heads/key-row-sharding
Commit: 21d399e9a2fe9606ab78892e1094f132f0bf5fe8
Parents: 963fe57
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Oct 28 10:40:43 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Oct 28 10:40:43 2014 -0600

----------------------------------------------------------------------
 .../persistence/core/astyanax/ColumnSearch.java | 13 ++-
 .../core/astyanax/MultiRowColumnIterator.java   | 90 ++++++++++++++------
 .../astyanax/MultiRowColumnIteratorTest.java    | 36 ++++++++
 3 files changed, 108 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21d399e9/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ColumnSearch.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ColumnSearch.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ColumnSearch.java
index 589cb72..41ee7c4 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ColumnSearch.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ColumnSearch.java
@@ -33,14 +33,19 @@ public interface ColumnSearch<T> {
 
     /**
      * Set the start value supplied and the user supplied end value (if present)
-     * @param rangeBuilder
+     *
      * @param value The value to set in the start
      */
-    public  void   buildRange(final RangeBuilder rangeBuilder, final T value);
+    public void buildRange( final RangeBuilder rangeBuilder, final T value );
 
     /**
      * Set the range builder with the user supplied start and finish
-     * @param rangeBuilder
      */
-    public void buildRange(final RangeBuilder rangeBuilder);
+    public void buildRange( final RangeBuilder rangeBuilder );
+
+    /**
+     * Return true if we should skip the first result
+     * @return
+     */
+    public boolean skipFirst(final T first);
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21d399e9/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
index 1f8a359..46405ad 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
@@ -22,11 +22,13 @@
 package org.apache.usergrid.persistence.core.astyanax;
 
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.TreeSet;
@@ -78,7 +80,8 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
     private T startColumn;
 
 
-    private int lastReturnCount;
+    private boolean moreToReturn;
+
 
     private Iterator<T> currentColumnIterator;
 
@@ -112,7 +115,7 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
         this.rowKeys = rowKeys;
         this.keyspace = keyspace;
         this.consistencyLevel = consistencyLevel;
-        this.lastReturnCount = -1;
+        this.moreToReturn = true;
 
         //        seenResults = new HashMap<>( pageSize * 10 );
     }
@@ -121,7 +124,7 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
     @Override
     public boolean hasNext() {
 
-        if ( currentColumnIterator == null || ( !currentColumnIterator.hasNext() && lastReturnCount == pageSize || lastReturnCount == -1 ) ) {
+        if ( currentColumnIterator == null || ( !currentColumnIterator.hasNext() && moreToReturn ) ) {
             advance();
         }
 
@@ -139,10 +142,6 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
         final T next = currentColumnIterator.next();
 
 
-        //set our start pointer
-        startColumn = next;
-        lastReturnCount ++;
-
         return next;
     }
 
@@ -155,8 +154,6 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
 
     public void advance() {
 
-        this.lastReturnCount = 0;
-
         /**
          * If the edge is present, we need to being seeking from this
          */
@@ -201,7 +198,7 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
         //do a merge if only one row has data.
 
 
-        final Iterator<T> mergedResults;
+        final List<T> mergedResults;
 
         if ( containsSingleRowOnly( result ) ) {
             mergedResults = singleRowResult( result );
@@ -219,21 +216,31 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
 
         //discard our first element (maybe)
 
-        PushbackIterator<T> iterator = new PushbackIterator<>( mergedResults );
 
-        //we have a first column to discard, our iterator has a value, but they are not equal, meaning we can't discard it
-        //as we have from the check so we need to push it back into the iterator
-        if(skipFirstColumn && iterator.hasNext()) {
 
-            final T firstResult = iterator.next();
+        final int size = mergedResults.size();
+
+        moreToReturn = size == selectSize;
 
-            if(comparator.compare( startColumn, firstResult ) != 0){
-                iterator.pushback( firstResult );
+        //we have a first column to to check
+        if( size > 0) {
+
+            final T firstResult = mergedResults.get( 0 );
+
+            //The search has either told us to skip the first element, or it matches our last, therefore we disregard it
+            if(columnSearch.skipFirst( firstResult ) || (skipFirstColumn && comparator.compare( startColumn, firstResult ) == 0)){
+                mergedResults.remove( 0 );
             }
 
         }
 
-        currentColumnIterator = iterator;
+
+        if(moreToReturn && mergedResults.size() > 0){
+            startColumn = mergedResults.get( mergedResults.size()  - 1 );
+        }
+
+
+        currentColumnIterator = mergedResults.iterator();
 
         LOG.trace( "Finished parsing {} rows for results", rowKeys.size() );
     }
@@ -266,21 +273,30 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
      * @param result
      * @return
      */
-    private Iterator<T> singleRowResult( final Rows<R, C> result ) {
+    private List<T> singleRowResult( final Rows<R, C> result ) {
 
 
         for ( R key : result.getKeys() ) {
             final ColumnList<C> columnList = result.getRow( key ).getColumns();
 
-            if ( columnList.size() > 0 ) {
+            final int size = columnList.size();
+
+            if ( size > 0 ) {
+
+                final List<T> results = new ArrayList<>(size);
+
+                for(Column<C> column: columnList){
+                    results.add(columnParser.parseColumn( column ));
+                }
+
+                return results;
 
-                return new SingleRowIterator(columnList);
 
             }
         }
 
         //we didn't have any results, just return nothing
-        return Collections.<T>emptyList().iterator();
+        return Collections.<T>emptyList();
     }
 
 
@@ -289,9 +305,12 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
      * @param result
      * @return
      */
-    private Iterator<T> mergeResults( final Rows<R, C> result, final int maxSize ) {
+    private List<T> mergeResults( final Rows<R, C> result, final int maxSize ) {
+
+
+        final List<T> mergedResults = new ArrayList<>(maxSize);
+
 
-        final TreeSet<T> mergedResults = new TreeSet<>( comparator );
 
 
         for ( final R key : result.getKeys() ) {
@@ -302,6 +321,9 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
 
                 final T returnedValue = columnParser.parseColumn( column );
 
+                //Use an O(log n) search, same as a tree, but with fast access to indexes for later operations
+                int searchIndex = Collections.binarySearch( mergedResults, returnedValue, comparator );
+
                 /**
                  * DO NOT remove this section of code. If you're seeing inconsistent results during shard transition,
                  * you'll
@@ -320,18 +342,32 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
                 //
                 //                previous = returnedValue;
 
-                mergedResults.add( returnedValue );
+                //we've already seen it, no-op
+                if(searchIndex > -1){
+                    continue;
+                }
+
+                final int insertIndex = (searchIndex+1)*-1;
+
+                //it's at the end of the list, don't bother inserting just to remove it
+                if(insertIndex >= maxSize){
+                    continue;
+                }
+
+                mergedResults.add( insertIndex, returnedValue );
+
 
                 //prune the mergedResults
                 while ( mergedResults.size() > maxSize ) {
-                    mergedResults.pollLast();
+                    //just remove from our tail until the size falls to the correct value
+                    mergedResults.remove(mergedResults.size()-1);
                 }
             }
 
             LOG.trace( "Candidate result set size is {}", mergedResults.size() );
 
         }
-        return mergedResults.iterator();
+        return mergedResults;
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21d399e9/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
index 8b4c7b7..04039e4 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
@@ -150,6 +150,12 @@ public class MultiRowColumnIteratorTest {
             public void buildRange( final RangeBuilder rangeBuilder ) {
 
             }
+
+
+            @Override
+            public boolean skipFirst( final Long first ) {
+                return false;
+            }
         };
 
 
@@ -190,6 +196,12 @@ public class MultiRowColumnIteratorTest {
             public void buildRange( final RangeBuilder rangeBuilder ) {
                 rangeBuilder.setReversed( true );
             }
+
+
+            @Override
+            public boolean skipFirst( final Long first ) {
+                return false;
+            }
         };
 
 
@@ -258,6 +270,12 @@ public class MultiRowColumnIteratorTest {
             public void buildRange( final RangeBuilder rangeBuilder ) {
 
             }
+
+
+            @Override
+            public boolean skipFirst( final Long first ) {
+                return false;
+            }
         };
 
 
@@ -302,6 +320,12 @@ public class MultiRowColumnIteratorTest {
             public void buildRange( final RangeBuilder rangeBuilder ) {
                 rangeBuilder.setReversed( true );
             }
+
+
+            @Override
+            public boolean skipFirst( final Long first ) {
+                return false;
+            }
         };
 
 
@@ -393,6 +417,12 @@ public class MultiRowColumnIteratorTest {
             public void buildRange( final RangeBuilder rangeBuilder ) {
 
             }
+
+
+            @Override
+            public boolean skipFirst( final Long first ) {
+                return false;
+            }
         };
 
 
@@ -433,6 +463,12 @@ public class MultiRowColumnIteratorTest {
             public void buildRange( final RangeBuilder rangeBuilder ) {
                 rangeBuilder.setReversed( true );
             }
+
+
+            @Override
+            public boolean skipFirst( final Long first ) {
+                return false;
+            }
         };
 
 


[2/3] Both V1 and V2 impl correct.

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
index 3332f04..c9f87fd 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCacheTest.java
@@ -28,7 +28,6 @@ import org.junit.Test;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
-import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphFig;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.NodeShardCacheImpl;
@@ -94,10 +93,10 @@ public class NodeShardCacheTest {
 
 
         final ShardEntryGroup group = new ShardEntryGroup( newTime );
-        group.addShard( new Shard(0, 0, true) );
+        group.addShard( new Shard( 0, 0, true ) );
 
 
-        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( id, edgeType, otherIdType ) ;
+        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( id, edgeType, otherIdType );
 
         /**
          * Simulate returning no shards at all.
@@ -112,28 +111,25 @@ public class NodeShardCacheTest {
                             throws Throwable {
                         return Collections.singletonList( group ).iterator();
                     }
-                });
+                } );
 
 
         ShardEntryGroup returnedGroup = cache.getWriteShardGroup( scope, newTime, directedEdgeMeta );
 
         //ensure it's the same group
-        assertSame(group, returnedGroup);
+        assertSame( group, returnedGroup );
 
 
-        Iterator<ShardEntryGroup>
-                shards = cache.getReadShardGroup( scope, newTime, directedEdgeMeta );
+        Iterator<ShardEntryGroup> shards = cache.getReadShardGroup( scope, newTime, directedEdgeMeta );
 
-        assertTrue(shards.hasNext());
+        assertTrue( shards.hasNext() );
 
 
         returnedGroup = shards.next();
 
-        assertSame("Single shard group expected", group, returnedGroup);
-
-        assertFalse(shards.hasNext());
-
+        assertSame( "Single shard group expected", group, returnedGroup );
 
+        assertFalse( shards.hasNext() );
 
 
         //we return the min UUID possible, all edges should start by writing to this edge
@@ -143,11 +139,10 @@ public class NodeShardCacheTest {
          *
          * TODO, us the GUAVA Tick to make this happen
          */
-//        verify(and allocation ).auditMaxShard( scope, id, edgeType, otherIdType );
+        //        verify(and allocation ).auditMaxShard( scope, id, edgeType, otherIdType );
     }
 
 
-
     @Test
     public void testRangeShard() {
 
@@ -170,9 +165,9 @@ public class NodeShardCacheTest {
         NodeShardCache cache = new NodeShardCacheImpl( allocation, graphFig );
 
 
-        final Shard minShard = new Shard(0, 0, true);
-        final Shard midShard = new Shard(10000, 1000, true);
-        final Shard maxShard = new Shard(20000, 2000, true);
+        final Shard minShard = new Shard( 0, 0, true );
+        final Shard midShard = new Shard( 10000, 1000, true );
+        final Shard maxShard = new Shard( 20000, 2000, true );
 
 
         /**
@@ -189,134 +184,121 @@ public class NodeShardCacheTest {
         maxShardGroup.addShard( maxShard );
 
 
-
-
-        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( id, edgeType, otherIdType ) ;
+        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( id, edgeType, otherIdType );
 
 
         /**
          * Simulate returning no shards at all.
          */
-        when( allocation
-                .getShards( same( scope ), any( Optional.class ), same( directedEdgeMeta ) ) )
+        when( allocation.getShards( same( scope ), any( Optional.class ), same( directedEdgeMeta ) ) )
 
                 //use "thenAnswer" so we always return the value, even if  it's invoked more than 1 time.
-                .thenAnswer( new Answer<Iterator<ShardEntryGroup>>(){
+                .thenAnswer( new Answer<Iterator<ShardEntryGroup>>() {
 
                     @Override
                     public Iterator<ShardEntryGroup> answer( final InvocationOnMock invocationOnMock )
                             throws Throwable {
                         return Arrays.asList( maxShardGroup, midShardGroup, minShardGroup ).iterator();
                     }
-                });
+                } );
 
 
         //check getting equal to our min, mid and max
 
-        ShardEntryGroup writeShard  = cache.getWriteShardGroup( scope, minShard.getShardIndex(), directedEdgeMeta );
-
-        assertSame(minShardGroup, writeShard);
-
+        ShardEntryGroup writeShard = cache.getWriteShardGroup( scope, minShard.getShardIndex(), directedEdgeMeta );
 
-        Iterator<ShardEntryGroup>
-                groups = cache.getReadShardGroup( scope, minShard.getShardIndex(), directedEdgeMeta );
+        assertSame( minShardGroup, writeShard );
 
-        assertTrue(groups.hasNext());
 
-        assertSame("min shard expected", minShardGroup, groups.next());
+        Iterator<ShardEntryGroup> groups = cache.getReadShardGroup( scope, minShard.getShardIndex(), directedEdgeMeta );
 
-        assertFalse(groups.hasNext());
+        assertTrue( groups.hasNext() );
 
+        assertSame( "min shard expected", minShardGroup, groups.next() );
 
+        assertFalse( groups.hasNext() );
 
 
         //mid
         writeShard = cache.getWriteShardGroup( scope, midShard.getShardIndex(), directedEdgeMeta );
 
-        assertSame(midShardGroup, writeShard);
+        assertSame( midShardGroup, writeShard );
 
 
-        groups =  cache.getReadShardGroup( scope, midShard.getShardIndex(), directedEdgeMeta );
+        groups = cache.getReadShardGroup( scope, midShard.getShardIndex(), directedEdgeMeta );
 
-        assertTrue(groups.hasNext());
+        assertTrue( groups.hasNext() );
 
-        assertSame("mid shard expected", midShardGroup, groups.next());
+        assertSame( "mid shard expected", midShardGroup, groups.next() );
 
-        assertTrue(groups.hasNext());
+        assertTrue( groups.hasNext() );
 
-        assertSame("min shard expected", minShardGroup, groups.next());
-
-        assertFalse(groups.hasNext());
+        assertSame( "min shard expected", minShardGroup, groups.next() );
 
+        assertFalse( groups.hasNext() );
 
 
         //max
 
         writeShard = cache.getWriteShardGroup( scope, maxShard.getShardIndex(), directedEdgeMeta );
 
-        assertSame(maxShardGroup, writeShard);
-
+        assertSame( maxShardGroup, writeShard );
 
-        groups =  cache.getReadShardGroup( scope, maxShard.getShardIndex(), directedEdgeMeta );
 
-        assertTrue(groups.hasNext());
+        groups = cache.getReadShardGroup( scope, maxShard.getShardIndex(), directedEdgeMeta );
 
-        assertSame("max shard expected", maxShardGroup, groups.next());
+        assertTrue( groups.hasNext() );
 
-        assertTrue(groups.hasNext());
+        assertSame( "max shard expected", maxShardGroup, groups.next() );
 
-        assertSame("mid shard expected", midShardGroup, groups.next());
+        assertTrue( groups.hasNext() );
 
+        assertSame( "mid shard expected", midShardGroup, groups.next() );
 
-        assertTrue(groups.hasNext());
 
-        assertSame("min shard expected", minShardGroup, groups.next());
+        assertTrue( groups.hasNext() );
 
-        assertFalse(groups.hasNext());
+        assertSame( "min shard expected", minShardGroup, groups.next() );
 
+        assertFalse( groups.hasNext() );
 
 
         //now test at mid +1 to ensure we get mid + min
         writeShard = cache.getWriteShardGroup( scope, midShard.getShardIndex() + 1, directedEdgeMeta );
 
-        assertSame(midShardGroup, writeShard);
+        assertSame( midShardGroup, writeShard );
 
 
-        groups =  cache.getReadShardGroup( scope, midShard.getShardIndex() + 1, directedEdgeMeta );
+        groups = cache.getReadShardGroup( scope, midShard.getShardIndex() + 1, directedEdgeMeta );
 
-        assertTrue(groups.hasNext());
+        assertTrue( groups.hasNext() );
 
-        assertSame("mid shard expected", midShardGroup, groups.next());
+        assertSame( "mid shard expected", midShardGroup, groups.next() );
 
-        assertTrue(groups.hasNext());
+        assertTrue( groups.hasNext() );
 
-        assertSame("min shard expected", minShardGroup, groups.next());
-
-        assertFalse(groups.hasNext());
+        assertSame( "min shard expected", minShardGroup, groups.next() );
 
+        assertFalse( groups.hasNext() );
 
 
         //now test at mid -1 to ensure we get min
         writeShard = cache.getWriteShardGroup( scope, midShard.getShardIndex() - 1, directedEdgeMeta );
 
-        assertSame(minShardGroup, writeShard);
-
+        assertSame( minShardGroup, writeShard );
 
-        groups =  cache.getReadShardGroup( scope, midShard.getShardIndex() - 1, directedEdgeMeta );
 
+        groups = cache.getReadShardGroup( scope, midShard.getShardIndex() - 1, directedEdgeMeta );
 
-        assertTrue(groups.hasNext());
 
-        assertSame("min shard expected", minShardGroup, groups.next());
+        assertTrue( groups.hasNext() );
 
-        assertFalse(groups.hasNext());
+        assertSame( "min shard expected", minShardGroup, groups.next() );
 
+        assertFalse( groups.hasNext() );
     }
 
 
-
-
-
     private GraphFig getFigMock() {
         final GraphFig graphFig = mock( GraphFig.class );
         when( graphFig.getShardCacheSize() ).thenReturn( 1000l );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
index ee4b94a..9289340 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardEntryGroupTest.java
@@ -85,7 +85,8 @@ public class ShardEntryGroupTest {
         assertNull( "Can't compact, no min compacted shard present", shardEntryGroup.getCompactionTarget() );
 
 
-        //TODO, should this blow up in general?  We don't have a compacted shard at the lower bounds, which shouldn't be allowed
+        //TODO, should this blow up in general?  We don't have a compacted shard at the lower bounds,
+        // which shouldn't be allowed
 
     }
 
@@ -229,7 +230,8 @@ public class ShardEntryGroupTest {
         assertFalse( "Merge cannot be run within min time",
                 shardEntryGroup.shouldCompact( secondShard.getCreatedTime() + delta + 1 ) );
 
-        assertTrue( "Merge should be run with after min time", shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + delta + 1 ) );
+        assertTrue( "Merge should be run with after min time",
+                shardEntryGroup.shouldCompact( firstShard.getCreatedTime() + delta + 1 ) );
     }
 
 
@@ -264,12 +266,11 @@ public class ShardEntryGroupTest {
 
         Collection<Shard> readShards = shardEntryGroup.getReadShards();
 
-        assertEquals("Shard size correct", 2, readShards.size());
+        assertEquals( "Shard size correct", 2, readShards.size() );
 
-        assertTrue("First shard present",  readShards.contains( secondShard ) );
-
-        assertTrue("Second shard present",  readShards.contains( compactedShard1 ) );
+        assertTrue( "First shard present", readShards.contains( secondShard ) );
 
+        assertTrue( "Second shard present", readShards.contains( compactedShard1 ) );
     }
 
 
@@ -303,55 +304,50 @@ public class ShardEntryGroupTest {
         assertTrue( "Shard added", result );
 
 
-
         Collection<Shard> writeShards = shardEntryGroup.getWriteShards( firstShard.getCreatedTime() + delta );
 
-        assertEquals("Shard size correct", 1, writeShards.size());
+        assertEquals( "Shard size correct", 1, writeShards.size() );
 
-        assertTrue("Root shard present",  writeShards.contains( compactedShard ) );
+        assertTrue( "Root shard present", writeShards.contains( compactedShard ) );
 
 
+        writeShards = shardEntryGroup.getWriteShards( secondShard.getCreatedTime() + delta );
 
-        writeShards = shardEntryGroup.getWriteShards(secondShard.getCreatedTime()+delta);
+        assertEquals( "Shard size correct", 1, writeShards.size() );
 
-        assertEquals("Shard size correct", 1, writeShards.size());
-
-        assertTrue("Third shard present",  writeShards.contains( compactedShard ) );
+        assertTrue( "Third shard present", writeShards.contains( compactedShard ) );
 
 
         /**
          * Not the max created timestamp, shouldn't return less than all shards
          */
-        writeShards = shardEntryGroup.getWriteShards(secondShard.getCreatedTime() +1 + delta);
-
-        assertEquals("Shard size correct", 1, writeShards.size());
-
-
-        assertTrue("Second shard present",  writeShards.contains( compactedShard ) );
+        writeShards = shardEntryGroup.getWriteShards( secondShard.getCreatedTime() + 1 + delta );
 
+        assertEquals( "Shard size correct", 1, writeShards.size() );
 
 
+        assertTrue( "Second shard present", writeShards.contains( compactedShard ) );
 
-        assertEquals("Compaction target correct", secondShard, shardEntryGroup.getCompactionTarget());
 
-        writeShards = shardEntryGroup.getWriteShards(firstShard.getCreatedTime() +1 + delta);
+        assertEquals( "Compaction target correct", secondShard, shardEntryGroup.getCompactionTarget() );
 
-        assertEquals("Shard size correct", 1, writeShards.size());
+        writeShards = shardEntryGroup.getWriteShards( firstShard.getCreatedTime() + 1 + delta );
 
+        assertEquals( "Shard size correct", 1, writeShards.size() );
 
-        assertTrue("Second shard present",  writeShards.contains( secondShard ) );
 
+        assertTrue( "Second shard present", writeShards.contains( secondShard ) );
     }
 
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test( expected = IllegalArgumentException.class )
     public void failsInsertionOrder() {
 
         final long delta = 10000;
 
-        Shard secondShard = new Shard(20000, 10000, false);
+        Shard secondShard = new Shard( 20000, 10000, false );
 
-        Shard firstShard = new Shard(10000 , 10000, false );
+        Shard firstShard = new Shard( 10000, 10000, false );
 
         Shard rootShard = new Shard( 0, 0, false );
 
@@ -368,12 +364,9 @@ public class ShardEntryGroupTest {
         //this should blow up, we can't add a shard in the middle, it must always be greater than the current max
 
         shardEntryGroup.addShard( firstShard );
-
-
     }
 
 
-
     @Test
     public void shardEntryAddList() {
 
@@ -383,7 +376,7 @@ public class ShardEntryGroupTest {
 
         Shard midShard = new Shard( 20000, 1000, true );
 
-        Shard lowShard = new Shard( 10000, 1000, false);
+        Shard lowShard = new Shard( 10000, 1000, false );
 
         ShardEntryGroup shardEntryGroup = new ShardEntryGroup( delta );
 
@@ -399,10 +392,6 @@ public class ShardEntryGroupTest {
 
         assertFalse( "Shard added", result );
     }
-
-
-
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
index 9f0792d..71b1f0d 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardGroupCompactionTest.java
@@ -23,21 +23,17 @@ package org.apache.usergrid.persistence.graph.serialization.impl.shard;
 
 
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
 
 import org.hamcrest.BaseMatcher;
 import org.hamcrest.Description;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Matchers;
 
 import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
 import org.apache.usergrid.persistence.graph.GraphFig;
-import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.impl.ShardGroupCompactionImpl;
 
 import com.netflix.astyanax.Keyspace;
@@ -45,9 +41,6 @@ import com.netflix.astyanax.Keyspace;
 import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.same;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -85,7 +78,7 @@ public class ShardGroupCompactionTest {
 
         final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
 
-        final TaskExecutor taskExecutor = mock(TaskExecutor.class);
+        final TaskExecutor taskExecutor = mock( TaskExecutor.class );
 
         final long delta = 10000;
 
@@ -106,90 +99,96 @@ public class ShardGroupCompactionTest {
                         edgeColumnFamilies, keyspace, edgeShardSerialization, taskExecutor );
 
 
-        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId("source"), "test" );
+        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId( "source" ), "test" );
 
         try {
             compaction.compact( this.scope, directedEdgeMeta, group );
             fail( "I should not reach this point" );
-        }catch(Throwable t){
-            assertEquals("Correct error message returned", "Compaction cannot be run yet.  Ignoring compaction.", t.getMessage());
         }
-
+        catch ( Throwable t ) {
+            assertEquals( "Correct error message returned", "Compaction cannot be run yet.  Ignoring compaction.",
+                    t.getMessage() );
+        }
     }
 
 
-//    /**
-//     * Tests that when we copy edges, we do not actually run the compaction, we can only run it after we get nothing
-//     * and the timeout has elapsed
-//     */
-//    @Test
-//    public void shouldOnlyCopy() {
-//
-//        final TimeService timeService = mock( TimeService.class );
-//
-//        final NodeShardAllocation nodeShardAllocation = mock( NodeShardAllocation.class );
-//
-//        final ShardedEdgeSerialization shardedEdgeSerialization = mock( ShardedEdgeSerialization.class );
-//
-//        final EdgeColumnFamilies edgeColumnFamilies = mock( EdgeColumnFamilies.class );
-//
-//        final Keyspace keyspace = mock( Keyspace.class );
-//
-//        final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
-//
-//        final long delta = 10000;
-//
-//        final long createTime = 20000;
-//
-//        //we shouldn't be able to compact, should throw an exception
-//        final long timeNow = createTime + delta ;
-//
-//
-//        final Shard targetShard = new Shard( 2000, createTime, false ) ;
-//        final Shard sourceShard =  new Shard( 1000, 5000, true );
-//        ShardEntryGroup group = new ShardEntryGroup( delta );
-//        group.addShard( targetShard );
-//        group.addShard( sourceShard );
-//
-//
-//        when( timeService.getCurrentTime() ).thenReturn( timeNow );
-//
-//        ShardGroupCompaction compaction =
-//                new ShardGroupCompactionImpl( timeService, graphFig, nodeShardAllocation, shardedEdgeSerialization,
-//                        edgeColumnFamilies, keyspace, edgeShardSerialization );
-//
-//
-//        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId("source"), "test" );
-//
-//
-//        /**
-//         * Mock up returning edges from the source
-//         */
-//
-//        int count = 100;
-//
-//        for(int i = 0; i < count; i ++){
-//
-//
-//
-//            when(shardedEdgeSerialization.getEdgesFromSource( same(edgeColumnFamilies), same(scope), any(
-//                    SearchByEdgeType.class), Matchers.argThat(new ShardSetMatcher( Collections.singleton( sourceShard ) ))/*any(Set.class)*/ ));
-//            edgeMeta.loadEdges( shardedEdgeSerialization, edgeColumnFamilies, scope,
-//
-//                                Collections.singleton( sourceShard ),  SearchByEdgeType.Order.DESCENDING, Long.MAX_VALUE );
-//        }
-//
-//        try {
-//            compaction.compact( this.scope, directedEdgeMeta, group );
-//            fail( "I should not reach this point" );
-//        }catch(Throwable t){
-//            assertEquals("Correct error message returned", "Compaction cannot be run yet.  Ignoring compaction.", t.getMessage());
-//        }
-//
-//    }
-
-
-    private final class ShardSetMatcher extends BaseMatcher<Collection<Shard>>{
+    //    /**
+    //     * Tests that when we copy edges, we do not actually run the compaction,
+    // we can only run it after we get nothing
+    //     * and the timeout has elapsed
+    //     */
+    //    @Test
+    //    public void shouldOnlyCopy() {
+    //
+    //        final TimeService timeService = mock( TimeService.class );
+    //
+    //        final NodeShardAllocation nodeShardAllocation = mock( NodeShardAllocation.class );
+    //
+    //        final ShardedEdgeSerialization shardedEdgeSerialization = mock( ShardedEdgeSerialization.class );
+    //
+    //        final EdgeColumnFamilies edgeColumnFamilies = mock( EdgeColumnFamilies.class );
+    //
+    //        final Keyspace keyspace = mock( Keyspace.class );
+    //
+    //        final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class );
+    //
+    //        final long delta = 10000;
+    //
+    //        final long createTime = 20000;
+    //
+    //        //we shouldn't be able to compact, should throw an exception
+    //        final long timeNow = createTime + delta ;
+    //
+    //
+    //        final Shard targetShard = new Shard( 2000, createTime, false ) ;
+    //        final Shard sourceShard =  new Shard( 1000, 5000, true );
+    //        ShardEntryGroup group = new ShardEntryGroup( delta );
+    //        group.addShard( targetShard );
+    //        group.addShard( sourceShard );
+    //
+    //
+    //        when( timeService.getCurrentTime() ).thenReturn( timeNow );
+    //
+    //        ShardGroupCompaction compaction =
+    //                new ShardGroupCompactionImpl( timeService, graphFig, nodeShardAllocation,
+    // shardedEdgeSerialization,
+    //                        edgeColumnFamilies, keyspace, edgeShardSerialization );
+    //
+    //
+    //        DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromSourceNode( createId("source"), "test" );
+    //
+    //
+    //        /**
+    //         * Mock up returning edges from the source
+    //         */
+    //
+    //        int count = 100;
+    //
+    //        for(int i = 0; i < count; i ++){
+    //
+    //
+    //
+    //            when(shardedEdgeSerialization.getEdgesFromSource( same(edgeColumnFamilies), same(scope), any(
+    //                    SearchByEdgeType.class), Matchers.argThat(new ShardSetMatcher( Collections.singleton(
+    // sourceShard ) ))/*any(Set.class)*/ ));
+    //            edgeMeta.loadEdges( shardedEdgeSerialization, edgeColumnFamilies, scope,
+    //
+    //                                Collections.singleton( sourceShard ),  SearchByEdgeType.Order.DESCENDING,
+    // Long.MAX_VALUE );
+    //        }
+    //
+    //        try {
+    //            compaction.compact( this.scope, directedEdgeMeta, group );
+    //            fail( "I should not reach this point" );
+    //        }catch(Throwable t){
+    //            assertEquals("Correct error message returned", "Compaction cannot be run yet.  Ignoring compaction
+    // .", t.getMessage());
+    //        }
+    //
+    //    }
+
+
+    private final class ShardSetMatcher extends BaseMatcher<Collection<Shard>> {
 
         private final Collection<Shard> expected;
 
@@ -199,7 +198,7 @@ public class ShardGroupCompactionTest {
 
         @Override
         public boolean matches( final Object o ) {
-            if(! (o instanceof Collection)){
+            if ( !( o instanceof Collection ) ) {
                 return false;
             }
 
@@ -213,17 +212,17 @@ public class ShardGroupCompactionTest {
         @Override
         public void describeTo( final Description description ) {
 
-           StringBuilder builder = new StringBuilder(  );
+            StringBuilder builder = new StringBuilder();
 
-            builder.append("Collection of shards with shards {");
+            builder.append( "Collection of shards with shards {" );
 
-            for(Shard shard: expected){
-              builder.append(shard).append( "," );
+            for ( Shard shard : expected ) {
+                builder.append( shard ).append( "," );
             }
 
-            builder.setLength( builder.length()-1 );
+            builder.setLength( builder.length() - 1 );
 
-           description.appendText( builder.toString() );
+            description.appendText( builder.toString() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
index b74572f..e08abd5 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardApproximationTest.java
@@ -35,6 +35,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.safehaus.guicyfig.Bypass;
 import org.safehaus.guicyfig.OptionState;
@@ -65,7 +66,6 @@ import com.netflix.astyanax.retry.RetryPolicy;
 
 import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createId;
 import static org.junit.Assert.assertEquals;
-import org.junit.Ignore;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -121,13 +121,13 @@ public class NodeShardApproximationTest {
 
 
         final Id id = createId( "test" );
-        final Shard shard = new Shard(0, 0, true);
+        final Shard shard = new Shard( 0, 0, true );
         final String type = "type";
         final String type2 = "subType";
 
         final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( id, type, type2 );
 
-        long count = approximation.getCount( scope, shard, directedEdgeMeta);
+        long count = approximation.getCount( scope, shard, directedEdgeMeta );
 
         waitForFlush( approximation );
 
@@ -153,7 +153,7 @@ public class NodeShardApproximationTest {
         final String type = "type";
         final String type2 = "subType";
 
-        final Shard shard = new Shard(10000, 0, true);
+        final Shard shard = new Shard( 10000, 0, true );
 
         final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( id, type, type2 );
 
@@ -194,14 +194,14 @@ public class NodeShardApproximationTest {
 
         //test we get nothing with the other type
 
-        final long emptyCount = approximation.getCount( scope, shard,  DirectedEdgeMeta.fromSourceNodeTargetType( id, type, type2 ));
+        final long emptyCount =
+                approximation.getCount( scope, shard, DirectedEdgeMeta.fromSourceNodeTargetType( id, type, type2 ) );
 
 
         assertEquals( 0, emptyCount );
     }
 
 
-
     @Ignore("outdated and no longer relevant test")
     @Test
     public void testMultipleShardMultipleThreads() throws ExecutionException, InterruptedException {
@@ -226,7 +226,6 @@ public class NodeShardApproximationTest {
         final DirectedEdgeMeta directedEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( id, type, type2 );
 
 
-
         ExecutorService executor = Executors.newFixedThreadPool( workers );
 
         List<Future<Shard>> futures = new ArrayList<>( workers );
@@ -258,7 +257,7 @@ public class NodeShardApproximationTest {
 
             waitForFlush( approximation );
 
-            final long returnedCount = approximation.getCount( scope, shardId, directedEdgeMeta);
+            final long returnedCount = approximation.getCount( scope, shardId, directedEdgeMeta );
 
             assertEquals( increments, returnedCount );
         }
@@ -271,14 +270,13 @@ public class NodeShardApproximationTest {
 
         while ( approximation.flushPending() ) {
 
-            LOG.info("Waiting on beginFlush to complete");
+            LOG.info( "Waiting on beginFlush to complete" );
 
             Thread.sleep( 100 );
         }
     }
 
 
-
     /**
      * These are created b/c we can't use Mockito.  It OOM's with keeping track of all the mock invocations
      */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
index 2c901e7..a5edae5 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationTest.java
@@ -98,11 +98,11 @@ public class NodeShardCounterSerializationTest {
 
         final Id id = createId( "test" );
 
-        ShardKey key1 = new ShardKey( scope, new Shard(0, 0, false), DirectedEdgeMeta.fromSourceNode( id, "type1"  ) );
+        ShardKey key1 = new ShardKey( scope, new Shard( 0, 0, false ), DirectedEdgeMeta.fromSourceNode( id, "type1" ) );
 
-        ShardKey key2 = new ShardKey( scope, new Shard(0, 0, false), DirectedEdgeMeta.fromSourceNode( id, "type2"  ) );
+        ShardKey key2 = new ShardKey( scope, new Shard( 0, 0, false ), DirectedEdgeMeta.fromSourceNode( id, "type2" ) );
 
-        ShardKey key3 = new ShardKey( scope, new Shard(1, 0, false), DirectedEdgeMeta.fromSourceNode( id, "type1"  ) );
+        ShardKey key3 = new ShardKey( scope, new Shard( 1, 0, false ), DirectedEdgeMeta.fromSourceNode( id, "type1" ) );
 
 
         Counter counter = new Counter();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
index 34bc079..9544865 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardEntryGroupIteratorTest.java
@@ -90,7 +90,7 @@ public class ShardEntryGroupIteratorTest {
         verify( shardGroupCompaction ).evaluateShardGroup( same( scope ), same( directedEdgeMeta ), eq( group ) );
 
 
-        Collection<Shard> readShards = group.getReadShards( );
+        Collection<Shard> readShards = group.getReadShards();
 
         assertEquals( "Min shard present", 1, readShards.size() );
 
@@ -173,7 +173,7 @@ public class ShardEntryGroupIteratorTest {
         //verify we ran our compaction check
         verify( shardGroupCompaction ).evaluateShardGroup( same( scope ), same( directedEdgeMeta ), eq( group ) );
 
-        Collection<Shard> readShards = group.getReadShards( );
+        Collection<Shard> readShards = group.getReadShards();
 
         assertEquals( "Both shards present", 2, readShards.size() );
 
@@ -213,7 +213,7 @@ public class ShardEntryGroupIteratorTest {
         verify( shardGroupCompaction ).evaluateShardGroup( same( scope ), same( directedEdgeMeta ), eq( group ) );
 
 
-        readShards = group.getReadShards( );
+        readShards = group.getReadShards();
 
 
         assertEquals( "Both shards present", 2, readShards.size() );
@@ -230,7 +230,7 @@ public class ShardEntryGroupIteratorTest {
         assertTrue( "shardGroup2Shard1 shard present", writeShards.contains( shardGroup2Shard1 ) );
 
 
-        writeShards = group.getWriteShards( shardGroup2Shard2.getCreatedTime() + delta +1 );
+        writeShards = group.getWriteShards( shardGroup2Shard2.getCreatedTime() + delta + 1 );
 
         assertEquals( "Both shards present", 1, writeShards.size() );
 
@@ -251,7 +251,6 @@ public class ShardEntryGroupIteratorTest {
         verify( shardGroupCompaction ).evaluateShardGroup( same( scope ), same( directedEdgeMeta ), eq( group ) );
 
 
-
         readShards = group.getReadShards();
 
         assertEquals( "Both shards present", 2, readShards.size() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
index d0adc1e..bb9fd0d 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/comparators/SourceDirectedEdgeDescendingComparatorTest.java
@@ -114,8 +114,8 @@ public class SourceDirectedEdgeDescendingComparatorTest {
 
         final UUID sourceId = UUIDGenerator.newTimeUUID();
 
-        final Id sourceId1 = createId( sourceId,  "source1" );
-        final Id sourceId2 = createId( sourceId,  "source2" );
+        final Id sourceId1 = createId( sourceId, "source1" );
+        final Id sourceId2 = createId( sourceId, "source2" );
         final Id targetId = createId( "target" );
         final String type = "type";
         final long timestamp = 10000;


[3/3] git commit: Both V1 and V2 impl correct.

Posted by to...@apache.org.
Both V1 and V2 impl correct.


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

Branch: refs/heads/key-row-sharding
Commit: ca943fed740d0c75db5cf34f1c9906e99df99710
Parents: 21d399e
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Oct 28 12:09:33 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Oct 28 12:09:33 2014 -0600

----------------------------------------------------------------------
 portal/config.js                                |   3 +-
 .../persistence/core/guice/CurrentImpl.java     |  42 +++++
 .../persistence/core/guice/CurrentVersion.java  |  42 -----
 .../persistence/core/guice/PreviousImpl.java    |  42 +++++
 .../persistence/core/guice/PreviousVersion.java |  42 -----
 .../persistence/core/guice/ProxyImpl.java       |  42 +++++
 .../persistence/core/guice/ProxyVersion.java    |  42 -----
 .../persistence/graph/guice/GraphModule.java    |  50 ++++-
 .../graph/impl/GraphManagerImpl.java            |   4 +-
 .../graph/impl/stage/EdgeMetaRepairImpl.java    |   3 +-
 .../impl/stage/NodeDeleteListenerImpl.java      |   3 +-
 .../EdgeMetadataSerializationProxyImpl.java     | 147 +++++++++++++++
 .../impl/EdgeMetadataSerializationV2Impl.java   |  18 +-
 .../impl/shard/impl/EdgeSearcher.java           |  10 +-
 .../impl/shard/impl/ShardsColumnIterator.java   |  15 +-
 .../graph/GraphManagerShardConsistencyIT.java   |   1 -
 .../EdgeMetaDataSerializationBridgeTest.java    |  58 ------
 .../EdgeMetaDataSerializationProxyV1Test.java   |  58 ++++++
 .../EdgeMetaDataSerializationProxyV2Test.java   |  57 ++++++
 .../EdgeMetaDataSerializationV1Test.java        |  19 +-
 .../EdgeMetaDataSerializationV2Test.java        |  40 ++--
 .../EdgeMetadataSerializationTest.java          |  24 +--
 .../serialization/EdgeSerializationTest.java    |  46 +++--
 .../serialization/NodeSerializationTest.java    |   6 +-
 .../PermanentSerializationTest.java             |   5 +-
 .../graph/serialization/TestCount.java          |  52 +++---
 .../impl/shard/EdgeShardSerializationTest.java  |  31 ++--
 .../impl/shard/NodeShardAllocationTest.java     |  15 +-
 .../impl/shard/NodeShardCacheTest.java          | 118 +++++-------
 .../impl/shard/ShardEntryGroupTest.java         |  57 +++---
 .../impl/shard/ShardGroupCompactionTest.java    | 181 +++++++++----------
 .../shard/count/NodeShardApproximationTest.java |  18 +-
 .../NodeShardCounterSerializationTest.java      |   6 +-
 .../shard/impl/ShardEntryGroupIteratorTest.java |   9 +-
 ...rceDirectedEdgeDescendingComparatorTest.java |   4 +-
 35 files changed, 754 insertions(+), 556 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/portal/config.js
----------------------------------------------------------------------
diff --git a/portal/config.js b/portal/config.js
index c65de7e..70138f4 100644
--- a/portal/config.js
+++ b/portal/config.js
@@ -24,7 +24,8 @@ Usergrid.showNotifcations = true;
 
 
 // used only if hostname does not match a real server name
-Usergrid.overrideUrl = 'https://api.usergrid.com/';
+Usergrid.overrideUrl = 'http://localhost:8080/';
+//Usergrid.overrideUrl = 'https://api.usergrid.com/';
 
 Usergrid.options = {
   client:{

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java
new file mode 100644
index 0000000..a071edf
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentImpl.java
@@ -0,0 +1,42 @@
+/*
+ *
+ *  * 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.
+ *
+ */
+
+package org.apache.usergrid.persistence.core.guice;
+
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+/**
+ * Represents 2 versions of an impl.  Generally used for online migration.  This represents the version that is the
+ * current version of the implementation.  I.E the "new" version.
+ */
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface CurrentImpl {}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java
deleted file mode 100644
index c375df3..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CurrentVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- *  * 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.
- *
- */
-
-package org.apache.usergrid.persistence.core.guice;
-
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
-/**
- * Represents 2 versions of an impl.  Generally used for online migration.  This represents the version that is the
- * current version of the implementation.  I.E the "new" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface CurrentVersion {}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java
new file mode 100644
index 0000000..9d5e359
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousImpl.java
@@ -0,0 +1,42 @@
+/*
+ *
+ *  * 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.
+ *
+ */
+
+package org.apache.usergrid.persistence.core.guice;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+
+/**
+ * Represents 2 versions of an impl.  Generally used for online migration.  This represents the version that is the
+ * previous version of the implementation.  I.E the "old" version.
+ */
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface PreviousImpl {}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java
deleted file mode 100644
index edda25a..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/PreviousVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- *  * 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.
- *
- */
-
-package org.apache.usergrid.persistence.core.guice;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
-
-/**
- * Represents 2 versions of an impl.  Generally used for online migration.  This represents the version that is the
- * previous version of the implementation.  I.E the "old" version.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface PreviousVersion {}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java
new file mode 100644
index 0000000..0bebd6c
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyImpl.java
@@ -0,0 +1,42 @@
+/*
+ *
+ *  * 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.
+ *
+ */
+
+package org.apache.usergrid.persistence.core.guice;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.BindingAnnotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+
+/**
+ * Represents 2 versions of an impl.  Generally used for online migration.  This represents the version of the impl
+ * that is responsible for bridging the versions from previous to current during the migration.
+ */
+@BindingAnnotation
+@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
+public @interface ProxyImpl {}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java
deleted file mode 100644
index 5209882..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/ProxyVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- *  * 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.
- *
- */
-
-package org.apache.usergrid.persistence.core.guice;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.google.inject.BindingAnnotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
-
-/**
- * Represents 2 versions of an impl.  Generally used for online migration.  This represents the version of the impl
- * that is responsible for bridging the versions from previous to current during the migration.
- */
-@BindingAnnotation
-@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
-public @interface ProxyVersion {}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
index 41a66c5..2cbc5e8 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
@@ -21,8 +21,12 @@ package org.apache.usergrid.persistence.graph.guice;
 
 import org.safehaus.guicyfig.GuicyFigModule;
 
+import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
 import org.apache.usergrid.persistence.core.consistency.TimeService;
 import org.apache.usergrid.persistence.core.consistency.TimeServiceImpl;
+import org.apache.usergrid.persistence.core.guice.CurrentImpl;
+import org.apache.usergrid.persistence.core.guice.PreviousImpl;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.migration.Migration;
 import org.apache.usergrid.persistence.core.task.NamedTaskExecutorImpl;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
@@ -41,7 +45,9 @@ import org.apache.usergrid.persistence.graph.impl.stage.NodeDeleteListenerImpl;
 import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
 import org.apache.usergrid.persistence.graph.serialization.EdgeSerialization;
 import org.apache.usergrid.persistence.graph.serialization.NodeSerialization;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationProxyImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV1Impl;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
 import org.apache.usergrid.persistence.graph.serialization.impl.EdgeSerializationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.NodeSerializationImpl;
 import org.apache.usergrid.persistence.graph.serialization.impl.shard.EdgeColumnFamilies;
@@ -70,6 +76,7 @@ import com.google.inject.Provides;
 import com.google.inject.Singleton;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
 import com.google.inject.multibindings.Multibinder;
+import com.netflix.astyanax.Keyspace;
 
 
 public class GraphModule extends AbstractModule {
@@ -81,7 +88,6 @@ public class GraphModule extends AbstractModule {
         install( new GuicyFigModule( GraphFig.class ) );
 
 
-        bind( EdgeMetadataSerialization.class ).to( EdgeMetadataSerializationV1Impl.class );
         bind( NodeSerialization.class ).to( NodeSerializationImpl.class );
 
         bind( TimeService.class ).to( TimeServiceImpl.class );
@@ -126,7 +132,7 @@ public class GraphModule extends AbstractModule {
 
         bind( EdgeColumnFamilies.class ).to( SizebasedEdgeColumnFamilies.class );
 
-        bind( ShardGroupCompaction.class).to( ShardGroupCompactionImpl.class);
+        bind( ShardGroupCompaction.class ).to( ShardGroupCompactionImpl.class );
 
 
         /**
@@ -141,13 +147,16 @@ public class GraphModule extends AbstractModule {
         //do multibindings for migrations
         Multibinder<Migration> migrationBinding = Multibinder.newSetBinder( binder(), Migration.class );
         migrationBinding.addBinding().to( Key.get( NodeSerialization.class ) );
-        migrationBinding.addBinding().to( Key.get( EdgeMetadataSerialization.class ) );
 
         //bind each singleton to the multi set.  Otherwise we won't migrate properly
         migrationBinding.addBinding().to( Key.get( EdgeColumnFamilies.class ) );
 
         migrationBinding.addBinding().to( Key.get( EdgeShardSerialization.class ) );
         migrationBinding.addBinding().to( Key.get( NodeShardCounterSerialization.class ) );
+
+        //Get the old version and the new one
+        migrationBinding.addBinding().to( Key.get( EdgeMetadataSerialization.class, PreviousImpl.class) );
+        migrationBinding.addBinding().to( Key.get( EdgeMetadataSerialization.class, CurrentImpl.class  ) );
     }
 
 
@@ -155,11 +164,42 @@ public class GraphModule extends AbstractModule {
     @Singleton
     @Provides
     @GraphTaskExecutor
-    public TaskExecutor graphTaskExecutor(final GraphFig graphFig){
-        return new NamedTaskExecutorImpl( "graphTaskExecutor",  graphFig.getShardAuditWorkerCount(), graphFig.getShardAuditWorkerQueueSize()  );
+    public TaskExecutor graphTaskExecutor( final GraphFig graphFig ) {
+        return new NamedTaskExecutorImpl( "graphTaskExecutor", graphFig.getShardAuditWorkerCount(),
+                graphFig.getShardAuditWorkerQueueSize() );
     }
 
 
+    @Inject
+    @Singleton
+    @Provides
+    @PreviousImpl
+    public EdgeMetadataSerialization getPreviousEdgeMetaSerialization( final Keyspace keyspace,
+                                                                       final CassandraConfig cassandraConfig,
+                                                                       final GraphFig graphFig ) {
+        return new EdgeMetadataSerializationV1Impl( keyspace, cassandraConfig, graphFig );
+    }
+
+
+    @Inject
+    @Singleton
+    @Provides
+    @CurrentImpl
+    public EdgeMetadataSerialization getCurrentEdgeMetaSerialization( final Keyspace keyspace,
+                                                                      final CassandraConfig cassandraConfig,
+                                                                      final GraphFig graphFig ) {
+        return new EdgeMetadataSerializationV2Impl( keyspace, cassandraConfig, graphFig );
+    }
+
+
+    @Inject
+    @Singleton
+    @Provides
+    @ProxyImpl
+    public EdgeMetadataSerialization getCurrentEdgeMetaSerialization( @PreviousImpl final EdgeMetadataSerialization previous,
+                                                   @CurrentImpl final EdgeMetadataSerialization current ) {
+       return new EdgeMetadataSerializationProxyImpl( previous, current );
+    }
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
index 8b8a3ee..564dc5b 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/GraphManagerImpl.java
@@ -28,6 +28,7 @@ import java.util.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
 import org.apache.usergrid.persistence.core.rx.ObservableIterator;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -54,7 +55,6 @@ import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
 import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
 import rx.Observable;
 import rx.Observer;
@@ -90,7 +90,7 @@ public class GraphManagerImpl implements GraphManager {
 
 
     @Inject
-    public GraphManagerImpl( final EdgeMetadataSerialization edgeMetadataSerialization,
+    public GraphManagerImpl( @ProxyImpl final EdgeMetadataSerialization edgeMetadataSerialization,
                              final EdgeSerialization storageEdgeSerialization,
                              final NodeSerialization nodeSerialization, final GraphFig graphFig,
                              @Assisted final ApplicationScope scope, final EdgeDeleteListener edgeDeleteListener,

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
index 7e09eca..0e1c4e2 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/EdgeMetaRepairImpl.java
@@ -27,6 +27,7 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
 import org.apache.usergrid.persistence.core.rx.ObservableIterator;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -70,7 +71,7 @@ public class EdgeMetaRepairImpl implements EdgeMetaRepair {
 
 
     @Inject
-    public EdgeMetaRepairImpl( final EdgeMetadataSerialization edgeMetadataSerialization, final Keyspace keyspace,
+    public EdgeMetaRepairImpl( @ProxyImpl final EdgeMetadataSerialization edgeMetadataSerialization, final Keyspace keyspace,
                                final GraphFig graphFig, final EdgeSerialization storageEdgeSerialization ) {
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
index 2be6c55..f167f0c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/stage/NodeDeleteListenerImpl.java
@@ -28,6 +28,7 @@ import java.util.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.hystrix.HystrixCassandra;
 import org.apache.usergrid.persistence.core.rx.ObservableIterator;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -74,7 +75,7 @@ public class NodeDeleteListenerImpl implements NodeDeleteListener {
      */
     @Inject
     public NodeDeleteListenerImpl( final NodeSerialization nodeSerialization,
-                                   final EdgeMetadataSerialization edgeMetadataSerialization,
+                                   @ProxyImpl final EdgeMetadataSerialization edgeMetadataSerialization,
                                    final EdgeMetaRepair edgeMetaRepair, final GraphFig graphFig,
                                    final EdgeSerialization storageSerialization,
                                    final Keyspace keyspace ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
new file mode 100644
index 0000000..4fbe801
--- /dev/null
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
@@ -0,0 +1,147 @@
+/*
+ *
+ *  * 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.
+ *
+ */
+
+package org.apache.usergrid.persistence.graph.serialization.impl;
+
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.guice.CurrentImpl;
+import org.apache.usergrid.persistence.core.guice.PreviousImpl;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.graph.Edge;
+import org.apache.usergrid.persistence.graph.SearchEdgeType;
+import org.apache.usergrid.persistence.graph.SearchIdType;
+import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
+import org.apache.usergrid.persistence.model.entity.Id;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.netflix.astyanax.MutationBatch;
+
+
+@Singleton
+public class EdgeMetadataSerializationProxyImpl implements EdgeMetadataSerialization {
+
+    private EdgeMetadataSerialization previous;
+    private EdgeMetadataSerialization current;
+
+
+    /**
+     * TODO fin
+     */
+    @Inject
+    public EdgeMetadataSerializationProxyImpl( @PreviousImpl final EdgeMetadataSerialization previous,
+                                               @CurrentImpl final EdgeMetadataSerialization current ) {
+        this.previous = previous;
+        this.current = current;
+    }
+
+
+    @Override
+    public MutationBatch writeEdge( final ApplicationScope scope, final Edge edge ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeEdgeTypeFromSource( final ApplicationScope scope, final Edge edge ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeEdgeTypeFromSource( final ApplicationScope scope, final Id sourceNode, final String type,
+                                                   final long timestamp ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeIdTypeFromSource( final ApplicationScope scope, final Edge edge ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeIdTypeFromSource( final ApplicationScope scope, final Id sourceNode, final String type,
+                                                 final String idType, final long timestamp ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeEdgeTypeToTarget( final ApplicationScope scope, final Edge edge ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeEdgeTypeToTarget( final ApplicationScope scope, final Id targetNode, final String type,
+                                                 final long timestamp ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeIdTypeToTarget( final ApplicationScope scope, final Edge edge ) {
+        return null;
+    }
+
+
+    @Override
+    public MutationBatch removeIdTypeToTarget( final ApplicationScope scope, final Id targetNode, final String type,
+                                               final String idType, final long timestamp ) {
+        return null;
+    }
+
+
+    @Override
+    public Iterator<String> getEdgeTypesFromSource( final ApplicationScope scope, final SearchEdgeType search ) {
+        return null;
+    }
+
+
+    @Override
+    public Iterator<String> getIdTypesFromSource( final ApplicationScope scope, final SearchIdType search ) {
+        return null;
+    }
+
+
+    @Override
+    public Iterator<String> getEdgeTypesToTarget( final ApplicationScope scope, final SearchEdgeType search ) {
+        return null;
+    }
+
+
+    @Override
+    public Iterator<String> getIdTypesToTarget( final ApplicationScope scope, final SearchIdType search ) {
+        return null;
+    }
+
+
+    @Override
+    public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
index d7ffeea..0c3a04a 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
@@ -55,6 +55,7 @@ import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerializa
 import org.apache.usergrid.persistence.graph.serialization.util.GraphValidation;
 import org.apache.usergrid.persistence.model.entity.Id;
 
+import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.hash.Funnel;
 import com.google.common.hash.PrimitiveSink;
@@ -451,8 +452,8 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
         final int[] bucketIds = edgeTypeExpandingShardLocator.getAllBuckets( edgeIdTypeKey );
 
         //no generics is intentional here
-        final List<BucketScopedRowKey<Id>> buckets =
-                BucketScopedRowKey.fromRange( applicationId, searchNode, bucketIds );
+        final List<BucketScopedRowKey<EdgeIdTypeKey>> buckets =
+                BucketScopedRowKey.fromRange( applicationId, edgeIdTypeKey, bucketIds );
 
 
         final ColumnSearch<String> columnSearch = createSearch( search );
@@ -518,6 +519,19 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
             public void buildRange( final RangeBuilder rangeBuilder ) {
                 buildRange( rangeBuilder, null );
             }
+
+
+            @Override
+            public boolean skipFirst( final String first ) {
+
+                final Optional<String> last = search.getLast();
+
+                if(!last.isPresent()){
+                    return false;
+                }
+
+                return last.get().equals( first );
+            }
         };
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
index e1800c0..57c5814 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
@@ -71,11 +71,13 @@ public abstract class EdgeSearcher<R, C, T> implements ColumnParser<C, T>, Colum
     }
 
 
+    @Override
+    public boolean skipFirst( final T first ) {
+        if(last == null){
+            return false;
+        }
 
-
-
-    public boolean hasPage() {
-        return last.isPresent();
+        return last.equals( first );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
index 0020f8c..e35107c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
@@ -105,20 +105,7 @@ public class ShardsColumnIterator<R, C, T> implements Iterator<T> {
          */
         final List<ScopedRowKey<R>> rowKeys = searcher.getRowKeys();
 
-
-        if(rowKeys.size() == 1){
-
-            final  RowQuery<ScopedRowKey<R>, C> query =
-                           keyspace.prepareQuery( cf ).setConsistencyLevel( consistencyLevel ).getKey( rowKeys.get( 0 ) )
-                                   .autoPaginate( true ).withColumnRange( rangeBuilder.build() );
-
-            currentColumnIterator = new ColumnNameIterator<>( query, searcher, searcher.hasPage() );
-        }
-
-        else{
-
-            currentColumnIterator = new MultiRowColumnIterator<>( keyspace, cf,  consistencyLevel, searcher, searcher, searcher.getComparator(), rowKeys, pageSize);
-        }
+        currentColumnIterator = new MultiRowColumnIterator<>( keyspace, cf,  consistencyLevel, searcher, searcher, searcher.getComparator(), rowKeys, pageSize);
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
index 41248fc..ec3fb29 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/GraphManagerShardConsistencyIT.java
@@ -31,7 +31,6 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java
deleted file mode 100644
index 96b3a07..0000000
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationBridgeTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- *  * 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.
- *
- */
-
-package org.apache.usergrid.persistence.graph.serialization;/*
- * 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 org.apache.usergrid.persistence.core.guice.CurrentVersion;
-
-import com.google.inject.Inject;
-
-
-public class EdgeMetaDataSerializationBridgeTest extends EdgeMetadataSerializationTest {
-
-
-    @Inject
-    @CurrentVersion
-    protected EdgeMetadataSerialization serialization;
-
-    @Override
-    protected EdgeMetadataSerialization getSerializationImpl() {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java
new file mode 100644
index 0000000..663a43f
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV1Test.java
@@ -0,0 +1,58 @@
+/*
+ *
+ *  * 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.
+ *
+ */
+
+package org.apache.usergrid.persistence.graph.serialization;
+
+
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationProxyImpl;
+
+import com.google.inject.Inject;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test for when V1 is the current version during migration
+ */
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationProxyV1Test extends EdgeMetadataSerializationTest {
+
+
+    @Inject
+    @ProxyImpl
+    protected EdgeMetadataSerialization serialization;
+
+
+    @Override
+    protected EdgeMetadataSerialization getSerializationImpl() {
+
+        assertTrue(serialization instanceof EdgeMetadataSerializationProxyImpl );
+
+        return serialization;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java
new file mode 100644
index 0000000..e3402e8
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationProxyV2Test.java
@@ -0,0 +1,57 @@
+/*
+ *
+ *  * 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.
+ *
+ */
+
+package org.apache.usergrid.persistence.graph.serialization;
+
+
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationProxyImpl;
+
+import com.google.inject.Inject;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test for when V2 is the current version
+ */
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationProxyV2Test extends EdgeMetadataSerializationTest {
+
+
+    @Inject
+    @ProxyImpl
+    protected EdgeMetadataSerialization serialization;
+
+
+    @Override
+    protected EdgeMetadataSerialization getSerializationImpl() {
+        assertTrue(serialization instanceof EdgeMetadataSerializationProxyImpl );
+
+        return serialization;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
index 00453d4..9645ad4 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV1Test.java
@@ -39,20 +39,31 @@ package org.apache.usergrid.persistence.graph.serialization;/*
  */
 
 
-import org.apache.usergrid.persistence.core.guice.PreviousVersion;
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.PreviousImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV1Impl;
 
 import com.google.inject.Inject;
 
+import static org.junit.Assert.assertTrue;
 
-public class EdgeMetaDataSerializationV1Test extends EdgeMetadataSerializationTest {
 
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationV1Test extends EdgeMetadataSerializationTest {
 
     @Inject
-    @PreviousVersion
+    @PreviousImpl
     protected EdgeMetadataSerialization serialization;
 
+
     @Override
     protected EdgeMetadataSerialization getSerializationImpl() {
-        return null;
+        assertTrue(serialization instanceof EdgeMetadataSerializationV1Impl );
+        return serialization;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
index 522368b..de9148f 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetaDataSerializationV2Test.java
@@ -19,42 +19,34 @@
  *
  */
 
-package org.apache.usergrid.persistence.graph.serialization;/*
- * 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.
- */
+package org.apache.usergrid.persistence.graph.serialization;
+
 
+import org.jukito.UseModules;
+import org.junit.runner.RunWith;
 
-import org.apache.usergrid.persistence.core.guice.CurrentVersion;
-import org.apache.usergrid.persistence.core.guice.PreviousVersion;
-import org.apache.usergrid.persistence.core.guice.ProxyVersion;
+import org.apache.usergrid.persistence.core.cassandra.ITRunner;
+import org.apache.usergrid.persistence.core.guice.CurrentImpl;
+import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationV2Impl;
 
 import com.google.inject.Inject;
 
+import static org.junit.Assert.assertTrue;
 
-public class EdgeMetaDataSerializationV2Test extends EdgeMetadataSerializationTest {
 
+@RunWith( ITRunner.class )
+@UseModules( { TestGraphModule.class } )
+public class EdgeMetaDataSerializationV2Test extends EdgeMetadataSerializationTest {
 
     @Inject
-    @ProxyVersion
+    @CurrentImpl
     protected EdgeMetadataSerialization serialization;
 
+
     @Override
     protected EdgeMetadataSerialization getSerializationImpl() {
-        return null;
+        assertTrue(serialization instanceof EdgeMetadataSerializationV2Impl );
+        return serialization;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
index 02f18c9..e166194 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeMetadataSerializationTest.java
@@ -23,17 +23,13 @@ package org.apache.usergrid.persistence.graph.serialization;
 import java.util.Iterator;
 import java.util.UUID;
 
-import org.jukito.UseModules;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
-import org.apache.usergrid.persistence.core.cassandra.ITRunner;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.Edge;
-import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
@@ -59,19 +55,16 @@ import static org.mockito.Mockito.when;
 
 
 /**
- *
- *
+ * Made abstract to allow subclasses to perform the wiring required for the functional testing.
  */
-@RunWith(ITRunner.class)
-@UseModules({ TestGraphModule.class })
 public abstract class EdgeMetadataSerializationTest {
 
+
+
     @Inject
     @Rule
     public MigrationManagerRule migrationManagerRule;
 
-
-
     @Inject
     protected Keyspace keyspace;
 
@@ -80,6 +73,7 @@ public abstract class EdgeMetadataSerializationTest {
 
     protected EdgeMetadataSerialization serialization;
 
+
     @Before
     public void setup() {
         scope = mock( ApplicationScope.class );
@@ -431,9 +425,9 @@ public abstract class EdgeMetadataSerializationTest {
 
         final Id targetId = edge1.getTargetNode();
 
-        final Edge edge2 = createEdge( createId( "source" ), "edge", targetId, timestamp+1 );
+        final Edge edge2 = createEdge( createId( "source" ), "edge", targetId, timestamp + 1 );
 
-        final Edge edge3 = createEdge( createId( "source2" ), "edge", targetId, timestamp+2 );
+        final Edge edge3 = createEdge( createId( "source2" ), "edge", targetId, timestamp + 2 );
 
         //set writing the edge
         serialization.writeEdge( scope, edge1 ).execute();
@@ -484,16 +478,13 @@ public abstract class EdgeMetadataSerializationTest {
         final StringSerializer STR_SER = StringSerializer.get();
 
 
-
         ColumnFamily<String, String> testCf = new ColumnFamily<String, String>( CF_NAME, STR_SER, STR_SER );
 
-        if(keyspace.describeKeyspace().getColumnFamily( CF_NAME ) == null){
+        if ( keyspace.describeKeyspace().getColumnFamily( CF_NAME ) == null ) {
             keyspace.createColumnFamily( testCf, null );
         }
 
 
-
-
         final String key = "key";
         final String colname = "name";
         final String colvalue = "value";
@@ -577,5 +568,6 @@ public abstract class EdgeMetadataSerializationTest {
         assertTrue( deleted );
     }
 
+
     protected abstract EdgeMetadataSerialization getSerializationImpl();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
index 57391de..6e5d324 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
@@ -172,7 +172,7 @@ public abstract class EdgeSerializationTest {
     @Test
     public void testPaging() throws ConnectionException {
 
-        final MarkedEdge edge1 = createEdge( "source", "edge", "target", 0);
+        final MarkedEdge edge1 = createEdge( "source", "edge", "target", 0 );
 
         final Id sourceId = edge1.getSourceNode();
         final Id targetId = edge1.getTargetNode();
@@ -190,10 +190,6 @@ public abstract class EdgeSerializationTest {
         //get our edges out by name
 
 
-
-
-
-
         Iterator<MarkedEdge> results =
                 serialization.getEdgesFromSource( scope, createSearchByEdge( sourceId, "edge", now, edge2 ) );
 
@@ -232,7 +228,7 @@ public abstract class EdgeSerializationTest {
         final Id targetId = edgev1.getTargetNode();
 
 
-        final MarkedEdge edgev2 = createEdge( sourceId, "edge1", targetId, timestamp+1 );
+        final MarkedEdge edgev2 = createEdge( sourceId, "edge1", targetId, timestamp + 1 );
 
         //we shouldn't get this one back
         final MarkedEdge diffTarget = createEdge( sourceId, "edge1", createId( "newTarget" ) );
@@ -244,7 +240,6 @@ public abstract class EdgeSerializationTest {
         final MarkedEdge edgeType2V1 = createEdge( sourceId, "edge2", targetId );
 
 
-
         serialization.writeEdge( scope, edgev1, UUIDGenerator.newTimeUUID() ).execute();
         serialization.writeEdge( scope, edgev2, UUIDGenerator.newTimeUUID() ).execute();
         serialization.writeEdge( scope, edgeType2V1, UUIDGenerator.newTimeUUID() ).execute();
@@ -339,7 +334,7 @@ public abstract class EdgeSerializationTest {
         final Id targetId1 = edge1.getTargetNode();
 
 
-        final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp+1 );
+        final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp + 1 );
 
         final Id targetId2 = edge2.getTargetNode();
 
@@ -402,8 +397,8 @@ public abstract class EdgeSerializationTest {
 
         final Id targetId2 = edge2.getTargetNode();
 
-        serialization.writeEdge( scope, edge1,  UUIDGenerator.newTimeUUID() ).execute();
-        serialization.writeEdge( scope, edge2,  UUIDGenerator.newTimeUUID() ).execute();
+        serialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
+        serialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
 
 
         long now = System.currentTimeMillis();
@@ -506,13 +501,13 @@ public abstract class EdgeSerializationTest {
         final Id targetId1 = edge1.getTargetNode();
 
 
-        final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp+1 );
+        final MarkedEdge edge2 = createEdge( sourceId, "edge", createId( "target" ), timestamp + 1 );
 
         final Id targetId2 = edge2.getTargetNode();
 
 
-        serialization.writeEdge( scope, edge1,  UUIDGenerator.newTimeUUID() ).execute();
-        serialization.writeEdge( scope, edge2,  UUIDGenerator.newTimeUUID() ).execute();
+        serialization.writeEdge( scope, edge1, UUIDGenerator.newTimeUUID() ).execute();
+        serialization.writeEdge( scope, edge2, UUIDGenerator.newTimeUUID() ).execute();
 
 
         long now = System.currentTimeMillis();
@@ -668,7 +663,7 @@ public abstract class EdgeSerializationTest {
         Set<Edge> edges = new HashSet<Edge>( size );
 
 
-       long timestamp = 0;
+        long timestamp = 0;
 
         for ( int i = 0; i < size; i++ ) {
             final MarkedEdge edge = createEdge( sourceId, type, createId( "target" ), timestamp );
@@ -719,7 +714,8 @@ public abstract class EdgeSerializationTest {
 
             batch.mergeShallow( serialization.writeEdge( scope, edge, UUIDGenerator.newTimeUUID() ) );
 
-            //increment timestamp (not done inline on purpose) If we do System.currentMillis we get the same edge on fast systems
+            //increment timestamp (not done inline on purpose) If we do System.currentMillis we get the same edge on
+            // fast systems
             timestamp++;
         }
 
@@ -727,8 +723,8 @@ public abstract class EdgeSerializationTest {
         batch.execute();
 
 
-        Iterator<MarkedEdge> results =
-                serialization.getEdgeVersions( scope, createGetByEdge( sourceId, edgeType, targetId, timestamp, null ) );
+        Iterator<MarkedEdge> results = serialization
+                .getEdgeVersions( scope, createGetByEdge( sourceId, edgeType, targetId, timestamp, null ) );
 
         verify( results, writeCount );
 
@@ -879,8 +875,8 @@ public abstract class EdgeSerializationTest {
         assertFalse( results.hasNext() );
 
 
-        Iterator<MarkedEdge> versions = serialization
-                .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+        Iterator<MarkedEdge> versions = serialization.getEdgeVersions( scope,
+                createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
 
 
         assertEquals( edge1, versions.next() );
@@ -896,8 +892,8 @@ public abstract class EdgeSerializationTest {
         assertFalse( results.hasNext() );
 
 
-        versions = serialization
-                .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+        versions = serialization.getEdgeVersions( scope,
+                createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
 
 
         assertEquals( edge1, versions.next() );
@@ -914,8 +910,8 @@ public abstract class EdgeSerializationTest {
 
         assertFalse( results.hasNext() );
 
-        versions = serialization
-                .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+        versions = serialization.getEdgeVersions( scope,
+                createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
 
 
         assertFalse( versions.hasNext() );
@@ -929,8 +925,8 @@ public abstract class EdgeSerializationTest {
         assertFalse( results.hasNext() );
 
 
-        versions = serialization
-                .getEdgeVersions( scope, createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
+        versions = serialization.getEdgeVersions( scope,
+                createGetByEdge( edge1.getSourceNode(), "edge", edge1.getTargetNode(), now, null ) );
 
 
         assertEquals( edge1, versions.next() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
index 935808c..e874c15 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/NodeSerializationTest.java
@@ -113,7 +113,7 @@ public class NodeSerializationTest {
 
         final Id nodeId = createId( "test" );
 
-        Optional<Long>returned = serialization.getMaxVersion( scope, nodeId );
+        Optional<Long> returned = serialization.getMaxVersion( scope, nodeId );
 
         /**
          * Verifies we didnt' get anything back when nothing has been marked
@@ -130,11 +130,11 @@ public class NodeSerializationTest {
 
         final Id nodeId = createId( "test" );
         final long version1 = System.currentTimeMillis();
-        final long version2 = version1+1;
+        final long version2 = version1 + 1;
 
         serialization.mark( scope, nodeId, version2 ).execute();
 
-        Optional<Long>returned = serialization.getMaxVersion( scope, nodeId );
+        Optional<Long> returned = serialization.getMaxVersion( scope, nodeId );
 
         assertEquals( version2, returned.get().longValue() );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
index caf1833..42eca95 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/PermanentSerializationTest.java
@@ -29,13 +29,14 @@ import org.apache.usergrid.persistence.graph.guice.TestGraphModule;
 import com.google.inject.Inject;
 
 
-@RunWith( ITRunner.class )
-@UseModules( { TestGraphModule.class } )
+@RunWith(ITRunner.class)
+@UseModules({ TestGraphModule.class })
 public class PermanentSerializationTest extends EdgeSerializationTest {
 
     @Inject
     protected EdgeSerialization edgeSerialization;
 
+
     @Override
     protected EdgeSerialization getSerialization() {
         return edgeSerialization;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
index a3bc3b9..0c09e81 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/TestCount.java
@@ -40,10 +40,11 @@ import static org.junit.Assert.assertEquals;
  */
 public class TestCount {
 
-    private static final Logger log = LoggerFactory.getLogger(TestCount.class);
+    private static final Logger log = LoggerFactory.getLogger( TestCount.class );
+
 
     @Test
-    public void mergeTest(){
+    public void mergeTest() {
 
         final int sizePerObservable = 2000;
 
@@ -62,40 +63,39 @@ public class TestCount {
             }
         } );
 
-       int returned =  Observable.merge(input1, input2).buffer( 1000 ).flatMap(
-               new Func1<List<Integer>, Observable<Integer>>() {
-                   @Override
-                   public Observable<Integer> call( final List<Integer> integers ) {
+        int returned = Observable.merge( input1, input2 ).buffer( 1000 )
+                                 .flatMap( new Func1<List<Integer>, Observable<Integer>>() {
+                                             @Override
+                                             public Observable<Integer> call( final List<Integer> integers ) {
 
-                       //simulates batching a network operation from buffer, then re-emitting the values passed
+                                                 //simulates batching a network operation from buffer,
+                                                 // then re-emitting the values passed
 
-                       try {
-                           Thread.sleep( 100 );
-                       }
-                       catch ( InterruptedException e ) {
-                           throw new RuntimeException( e );
-                       }
+                                                 try {
+                                                     Thread.sleep( 100 );
+                                                 }
+                                                 catch ( InterruptedException e ) {
+                                                     throw new RuntimeException( e );
+                                                 }
 
 
-                       return Observable.from( integers );
-                   }
-               } ).count().defaultIfEmpty( 0 ).toBlocking().last();
+                                                 return Observable.from( integers );
+                                             }
+                                         } ).count().defaultIfEmpty( 0 ).toBlocking().last();
 
 
-        assertEquals("Count was correct", sizePerObservable*2*100, returned);
+        assertEquals( "Count was correct", sizePerObservable * 2 * 100, returned );
     }
 
 
     /**
      * Get observables from the sets
-     * @param size
-     * @return
      */
-    private Observable<Integer> getObservables( int size ){
+    private Observable<Integer> getObservables( int size ) {
 
-        final List<Integer> values = new ArrayList<Integer>(size);
+        final List<Integer> values = new ArrayList<Integer>( size );
 
-        for(int i = 0; i <size; i ++ ) {
+        for ( int i = 0; i < size; i++ ) {
             values.add( i );
         }
 
@@ -109,11 +109,10 @@ public class TestCount {
 
                 final int size = values.size();
 
-                for(int i = 0; i < size; i ++){
-
+                for ( int i = 0; i < size; i++ ) {
 
 
-                    if(i%1000 == 0){
+                    if ( i % 1000 == 0 ) {
                         //simulate network fetch
                         try {
                             Thread.sleep( 250 );
@@ -126,7 +125,7 @@ public class TestCount {
 
                     final Integer value = values.get( i );
 
-                    log.info( "Emitting {}", value  );
+                    log.info( "Emitting {}", value );
 
 
                     subscriber.onNext( value );
@@ -137,6 +136,5 @@ public class TestCount {
                 //purposefully no error handling here
             }
         } ).subscribeOn( Schedulers.io() );
-
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
index da57b0a..c966605 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeShardSerializationTest.java
@@ -94,9 +94,9 @@ public class EdgeShardSerializationTest {
 
         final Shard shard3 = new Shard( shard2.getShardIndex() * 2, timestamp, false );
 
-        final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType(now,  "edgeType", "subType"  );
+        final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( now, "edgeType", "subType" );
 
-        MutationBatch batch = edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta  );
+        MutationBatch batch = edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
 
         batch.mergeShallow( edgeShardSerialization.writeShardMeta( scope, shard2, sourceEdgeMeta ) );
 
@@ -118,11 +118,10 @@ public class EdgeShardSerializationTest {
 
         assertFalse( results.hasNext() );
 
-        final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now,  "edgeType", "subType"  );
+        final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
 
         //test we get nothing with the other node type
-        results =
-                edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
+        results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
 
         assertFalse( results.hasNext() );
 
@@ -155,17 +154,14 @@ public class EdgeShardSerializationTest {
         final Shard shard3 = new Shard( shard2.getShardIndex() * 2, timestamp, false );
 
 
-        final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType(now,  "edgeType", "subType"  );
+        final DirectedEdgeMeta sourceEdgeMeta = DirectedEdgeMeta.fromSourceNodeTargetType( now, "edgeType", "subType" );
 
 
-        MutationBatch batch =
-                edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
+        MutationBatch batch = edgeShardSerialization.writeShardMeta( scope, shard1, sourceEdgeMeta );
 
-        batch.mergeShallow(
-                edgeShardSerialization.writeShardMeta( scope, shard2, sourceEdgeMeta ) );
+        batch.mergeShallow( edgeShardSerialization.writeShardMeta( scope, shard2, sourceEdgeMeta ) );
 
-        batch.mergeShallow(
-                edgeShardSerialization.writeShardMeta( scope, shard3, sourceEdgeMeta ) );
+        batch.mergeShallow( edgeShardSerialization.writeShardMeta( scope, shard3, sourceEdgeMeta ) );
 
         batch.execute();
 
@@ -183,10 +179,9 @@ public class EdgeShardSerializationTest {
 
         //test nothing with other type
 
-        final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now,  "edgeType", "subType"  );
+        final DirectedEdgeMeta targetEdgeMeta = DirectedEdgeMeta.fromTargetNodeSourceType( now, "edgeType", "subType" );
 
-        results =
-                edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
+        results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), targetEdgeMeta );
 
         assertFalse( results.hasNext() );
 
@@ -194,8 +189,7 @@ public class EdgeShardSerializationTest {
         //test paging and size
         edgeShardSerialization.removeShardMeta( scope, shard1, sourceEdgeMeta ).execute();
 
-        results =
-                edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+        results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
 
         assertEquals( shard3, results.next() );
 
@@ -208,8 +202,7 @@ public class EdgeShardSerializationTest {
 
         edgeShardSerialization.removeShardMeta( scope, shard3, sourceEdgeMeta ).execute();
 
-        results =
-                edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
+        results = edgeShardSerialization.getShardMetaData( scope, Optional.<Shard>absent(), sourceEdgeMeta );
 
 
         assertFalse( results.hasNext() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ca943fed/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
index b8be5d2..4e572c0 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardAllocationTest.java
@@ -251,7 +251,7 @@ public class NodeShardAllocationTest {
         /**
          * Allocate 2.5x what this shard should have.  We should ultimately have a split at 2x
          */
-        final long shardCount = ( long ) (graphFig.getShardSize() * 2.5);
+        final long shardCount = ( long ) ( graphFig.getShardSize() * 2.5 );
 
 
         //return a shard size equal to our max
@@ -259,7 +259,7 @@ public class NodeShardAllocationTest {
 
 
         //this is how many we should be iterating and should set the value of the last shard we keep
-        final int numToIterate = ( int ) (graphFig.getShardSize() *2);
+        final int numToIterate = ( int ) ( graphFig.getShardSize() * 2 );
 
 
         /**
@@ -282,7 +282,7 @@ public class NodeShardAllocationTest {
         edges.add( keep );
         i++;
 
-        for ( ; i < shardCount; i++ ) {
+        for (; i < shardCount; i++ ) {
 
             edges.add( skipped );
         }
@@ -365,14 +365,14 @@ public class NodeShardAllocationTest {
         final long shardCount = graphFig.getShardSize();
 
 
-        final SimpleMarkedEdge skippedEdge =   new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10000l, false );
+        final SimpleMarkedEdge skippedEdge = new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10000l, false );
         final SimpleMarkedEdge returnedEdge =
                 new SimpleMarkedEdge( nodeId, type, createId( "subType" ), 10005l, false );
 
         List<MarkedEdge> iteratedEdges = new ArrayList<>( ( int ) shardCount );
 
-        for(long i = 0; i < shardCount-1; i ++){
-            iteratedEdges.add( skippedEdge);
+        for ( long i = 0; i < shardCount - 1; i++ ) {
+            iteratedEdges.add( skippedEdge );
         }
 
         iteratedEdges.add( returnedEdge );
@@ -388,7 +388,6 @@ public class NodeShardAllocationTest {
                 .thenReturn( mock( MutationBatch.class ) );
 
 
-
         final Iterator<MarkedEdge> edgeIterator = iteratedEdges.iterator();
 
         //mock up returning the value
@@ -635,7 +634,7 @@ public class NodeShardAllocationTest {
 
         final TimeService timeService = mock( TimeService.class );
 
-        final long returnTime = System.currentTimeMillis()+graphFig.getShardCacheTimeout()*2 ;
+        final long returnTime = System.currentTimeMillis() + graphFig.getShardCacheTimeout() * 2;
 
         when( timeService.getCurrentTime() ).thenReturn( returnTime );