Address issues found during code review
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/b1e1ed18 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/b1e1ed18 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/b1e1ed18 Branch: refs/heads/2.1-release Commit: b1e1ed181d88f6a8e4b1b7bac76c99f936f66c8c Parents: c9bf87c Author: Todd Nine <tn...@apigee.com> Authored: Thu Oct 22 12:13:00 2015 -0600 Committer: Todd Nine <tn...@apigee.com> Committed: Thu Oct 22 12:13:00 2015 -0600 ---------------------------------------------------------------------- .../graph/GraphManagerShardConsistencyIT.java | 5 +++-- .../impl/shard/impl/ShardGroupDeletionImplTest.java | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/b1e1ed18/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 9ee7b95..c1917bb 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 @@ -55,6 +55,7 @@ import org.apache.usergrid.persistence.graph.guice.TestGraphModule; import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType; import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdgeMeta; import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeShardCache; +import org.apache.usergrid.persistence.graph.serialization.impl.shard.Shard; import org.apache.usergrid.persistence.graph.serialization.impl.shard.ShardEntryGroup; import org.apache.usergrid.persistence.model.entity.Id; @@ -595,7 +596,7 @@ public class GraphManagerShardConsistencyIT { while ( groups.hasNext() ) { - group = groups.next();; + group = groups.next(); log.info( "Shard size for group is {}", group.getReadShards() ); @@ -604,7 +605,7 @@ public class GraphManagerShardConsistencyIT { //we're done, 1 shard remains, we have a group, and it's our default shard - if ( shardCount == 1 && group != null && group.getMinShard().getShardIndex() == 0 ) { + if ( shardCount == 1 && group != null && group.getMinShard().getShardIndex() == Shard.MIN_SHARD.getShardIndex() ) { log.info( "All compactions complete," ); break; http://git-wip-us.apache.org/repos/asf/usergrid/blob/b1e1ed18/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java index 9a3e407..f943e9b 100644 --- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java +++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupDeletionImplTest.java @@ -43,6 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import com.netflix.astyanax.MutationBatch; +import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import static org.apache.usergrid.persistence.core.util.IdGenerator.createId; import static org.junit.Assert.assertEquals; @@ -50,6 +51,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.same; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -252,7 +254,7 @@ public class ShardGroupDeletionImplTest { //now check when marked we also retain them final Iterator<MarkedEdge> markedEdgeIterator = Collections.singleton( - ( MarkedEdge ) new SimpleMarkedEdge( createId( "source" ), "type", createId( "target" ), 1000, false ) ) + ( MarkedEdge ) new SimpleMarkedEdge( createId( "source" ), "type", createId( "target" ), 1000, true ) ) .iterator(); @@ -266,7 +268,7 @@ public class ShardGroupDeletionImplTest { @Test - public void testDeletion() throws ExecutionException, InterruptedException { + public void testDeletion() throws ExecutionException, InterruptedException, ConnectionException { final long createTime = 10000; @@ -290,9 +292,10 @@ public class ShardGroupDeletionImplTest { //mock up returning a mutation final EdgeShardSerialization edgeShardSerialization = mock( EdgeShardSerialization.class ); + final MutationBatch batch = mock( MutationBatch.class ); when( edgeShardSerialization.removeShardMeta( same( scope ), same( shard0 ), same( directedEdgeMeta ) ) ) - .thenReturn( mock( MutationBatch.class ) ); + .thenReturn( batch ); final TimeService timeService = mock( TimeService.class ); @@ -310,6 +313,8 @@ public class ShardGroupDeletionImplTest { final ShardGroupDeletion.DeleteResult result = future.get(); assertEquals( "should delete", ShardGroupDeletion.DeleteResult.DELETED, result ); + + verify(batch).execute(); }