diff --git a/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/StreamingVtGateIT.java b/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/StreamingVtGateIT.java index 79ced9f7fc..6525261966 100644 --- a/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/StreamingVtGateIT.java +++ b/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/StreamingVtGateIT.java @@ -8,7 +8,6 @@ import com.youtube.vitess.vtgate.KeyRange; import com.youtube.vitess.vtgate.KeyspaceId; import com.youtube.vitess.vtgate.Query; import com.youtube.vitess.vtgate.Query.QueryBuilder; -import com.youtube.vitess.vtgate.Row; import com.youtube.vitess.vtgate.TestEnv; import com.youtube.vitess.vtgate.VtGate; import com.youtube.vitess.vtgate.cursor.Cursor; @@ -99,11 +98,7 @@ public class StreamingVtGateIT { Query query = new QueryBuilder(selectSql, testEnv.getKeyspace(), "master").addKeyRange(kr) .setStreaming(true).build(); Cursor cursor = vtgate.execute(query); - int count = 0; - while (cursor.hasNext()) { - cursor.next(); - count++; - } + int count = Iterables.size(cursor); Assert.assertEquals((int) Math.pow(rowCount, 3), count); } vtgate.close(); @@ -123,10 +118,7 @@ public class StreamingVtGateIT { .setKeyspaceIds(testEnv.getAllKeyspaceIds()).setStreaming(true).build(); VtGate vtgate = VtGate.connect("localhost:" + testEnv.getPort(), 0, testEnv.getRpcClientFactory()); Cursor cursor = vtgate.execute(query); - int count = 0; - for (Row row : cursor) { - count++; - } + int count = Iterables.size(cursor); Assert.assertEquals(2 * (int) Math.pow(rowCount, 3), count); vtgate.close(); } diff --git a/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/VtGateIT.java b/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/VtGateIT.java index 859e323dd5..a68062aede 100644 --- a/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/VtGateIT.java +++ b/java/vtgate-client/src/test/java/com/youtube/vitess/vtgate/integration/VtGateIT.java @@ -2,6 +2,7 @@ package com.youtube.vitess.vtgate.integration; import com.google.common.collect.Lists; import com.google.common.primitives.UnsignedLong; + import com.youtube.vitess.vtgate.BindVariable; import com.youtube.vitess.vtgate.Exceptions.ConnectionException; import com.youtube.vitess.vtgate.KeyRange; @@ -10,11 +11,12 @@ import com.youtube.vitess.vtgate.Query; import com.youtube.vitess.vtgate.Query.QueryBuilder; import com.youtube.vitess.vtgate.Row; import com.youtube.vitess.vtgate.Row.Cell; +import com.youtube.vitess.vtgate.TestEnv; import com.youtube.vitess.vtgate.VtGate; import com.youtube.vitess.vtgate.cursor.Cursor; import com.youtube.vitess.vtgate.cursor.CursorImpl; -import com.youtube.vitess.vtgate.TestEnv; import com.youtube.vitess.vtgate.integration.util.Util; + import org.apache.commons.codec.binary.Hex; import org.joda.time.DateTime; import org.junit.AfterClass;