You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2015/04/27 22:34:45 UTC
accumulo git commit: ACCUMULO-3754 use Iterators.size to loop over an
iterator
Repository: accumulo
Updated Branches:
refs/heads/1.7 1aea14c72 -> ba7fb3e15
ACCUMULO-3754 use Iterators.size to loop over an iterator
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ba7fb3e1
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ba7fb3e1
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ba7fb3e1
Branch: refs/heads/1.7
Commit: ba7fb3e15e0bf66e51a13bd441c3d8ef387a6a1f
Parents: 1aea14c
Author: Eric C. Newton <er...@gmail.com>
Authored: Mon Apr 27 16:34:26 2015 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Mon Apr 27 16:34:26 2015 -0400
----------------------------------------------------------------------
.../core/client/mock/MockConnectorTest.java | 26 +++++---------------
.../client/mock/MockTableOperationsTest.java | 8 +++---
.../examples/simple/shard/ContinuousQuery.java | 7 ++----
.../impl/MiniAccumuloClusterImplTest.java | 8 +++---
.../accumulo/server/util/TabletIterator.java | 8 +++---
.../apache/accumulo/test/IMMLGBenchmark.java | 11 +++------
.../metadata/MetadataBatchScanTest.java | 9 ++-----
.../accumulo/proxy/ProxyDurabilityIT.java | 4 +--
.../org/apache/accumulo/test/CleanWalIT.java | 5 ++--
.../test/ConfigurableMajorCompactionIT.java | 5 ++--
.../test/CreateTableWithNewTableConfigIT.java | 10 +++-----
.../accumulo/test/InterruptibleScannersIT.java | 8 +++---
.../test/MasterRepairsDualAssignmentIT.java | 5 ++--
.../apache/accumulo/test/MetaGetsReadersIT.java | 5 ++--
.../accumulo/test/MultiTableRecoveryIT.java | 3 +--
.../test/RecoveryCompactionsAreFlushesIT.java | 5 ++--
.../org/apache/accumulo/test/ShellServerIT.java | 5 ++--
.../apache/accumulo/test/SplitRecoveryIT.java | 5 ++--
.../accumulo/test/VerifySerialRecoveryIT.java | 9 +++----
.../apache/accumulo/test/WaitForBalanceIT.java | 6 ++---
.../test/functional/BadIteratorMincIT.java | 12 +++------
.../test/functional/BatchWriterFlushIT.java | 13 +++-------
.../test/functional/BigRootTabletIT.java | 4 ++-
.../accumulo/test/functional/CleanTmpIT.java | 3 ++-
.../accumulo/test/functional/CompactionIT.java | 4 ++-
.../accumulo/test/functional/ConcurrencyIT.java | 4 ++-
.../functional/ConfigurableCompactionIT.java | 4 ++-
.../test/functional/DeleteEverythingIT.java | 3 ++-
.../accumulo/test/functional/DeleteRowsIT.java | 4 ++-
.../accumulo/test/functional/DurabilityIT.java | 4 ++-
.../accumulo/test/functional/ExamplesIT.java | 4 ++-
.../test/functional/FunctionalTestUtils.java | 12 +++------
.../test/functional/GarbageCollectorIT.java | 13 ++++------
.../accumulo/test/functional/MetadataIT.java | 4 ++-
.../accumulo/test/functional/ReadWriteIT.java | 5 ++--
.../accumulo/test/functional/RowDeleteIT.java | 8 +++---
.../test/functional/SessionDurabilityIT.java | 4 ++-
.../accumulo/test/functional/TableIT.java | 6 +++--
.../accumulo/test/functional/VisibilityIT.java | 10 ++++----
.../test/replication/KerberosReplicationIT.java | 5 ++--
.../replication/MultiInstanceReplicationIT.java | 11 ++++-----
.../test/replication/ReplicationIT.java | 13 +++-------
.../UnorderedWorkAssignerReplicationIT.java | 11 ++++-----
43 files changed, 139 insertions(+), 174 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
index 4b90d72..980498e 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
@@ -51,6 +51,8 @@ import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class MockConnectorTest {
Random random = new Random();
@@ -186,11 +188,7 @@ public class MockConnectorTest {
Scanner scanner = c.createScanner("test", Authorizations.EMPTY);
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ int count = Iterators.size(scanner.iterator());
assertEquals(0, count);
@@ -263,11 +261,7 @@ public class MockConnectorTest {
private void checkRemaining(Connector c, String tableName, int count) throws Exception {
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
- int total = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- total++;
- }
+ int total = Iterators.size(scanner.iterator());
assertEquals(count, total);
}
@@ -339,18 +333,10 @@ public class MockConnectorTest {
b.flush();
Scanner scanner = c.createScanner("a", Authorizations.EMPTY);
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ int count = Iterators.size(scanner.iterator());
assertEquals(1, count);
- count = 0;
scanner = c.createScanner("b", Authorizations.EMPTY);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ count = Iterators.size(scanner.iterator());
assertEquals(1, count);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
index 5943e8d..9733bd3 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
@@ -61,6 +61,8 @@ import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class MockTableOperationsTest {
@Test
@@ -323,11 +325,7 @@ public class MockTableOperationsTest {
// deletes everything still left
to.deleteRows("test2", null, null);
s = connector.createScanner("test2", Authorizations.EMPTY);
- rowCnt = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : s) {
- rowCnt++;
- }
+ rowCnt = Iterators.size(s.iterator());
s.close();
to.delete("test2");
Assert.assertEquals(0, rowCnt);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
index 8d05922..00ec5a3 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
@@ -36,6 +36,7 @@ import org.apache.accumulo.core.iterators.user.IntersectingIterator;
import org.apache.hadoop.io.Text;
import com.beust.jcommander.Parameter;
+import com.google.common.collect.Iterators;
/**
* Using the doc2word table created by Reverse.java, this program randomly selects N words per document. Then it continually queries a random set of words in
@@ -83,11 +84,7 @@ public class ContinuousQuery {
bs.setRanges(Collections.singleton(new Range()));
long t1 = System.currentTimeMillis();
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : bs) {
- count++;
- }
+ int count = Iterators.size(bs.iterator());
long t2 = System.currentTimeMillis();
System.out.printf(" %s %,d %6.3f%n", Arrays.asList(columns), count, (t2 - t1) / 1000.0);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java
index 439605e..696c44e 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java
@@ -23,14 +23,11 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.master.thrift.MasterGoalState;
import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
import org.apache.accumulo.core.master.thrift.MasterState;
@@ -46,6 +43,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class MiniAccumuloClusterImplTest {
public static File testDir;
@@ -78,8 +77,7 @@ public class MiniAccumuloClusterImplTest {
testTableID = tableops.tableIdMap().get(TEST_TABLE);
Scanner s = conn.createScanner(TEST_TABLE, Authorizations.EMPTY);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> e : s) {}
+ Iterators.size(s.iterator());
}
@Test(timeout = 10000)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java b/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
index ea308d6..a1fc9c5 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
@@ -37,6 +37,8 @@ import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
/**
* This class iterates over the metadata table returning all key values for a tablet in one chunk. As it scans the metadata table it checks the correctness of
* the metadata table, and rescans if needed. So the tablet key/values returned by this iterator should satisfy the sorted linked list property of the metadata
@@ -244,11 +246,7 @@ public class TabletIterator implements Iterator<Map<Key,Value>> {
// check to see if the last tablet still exist
range = new Range(lastTablet, true, lastTablet, true);
scanner.setRange(range);
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ int count = Iterators.size(scanner.iterator());
if (count == 0)
throw new TabletDeletedException("Tablet " + lastTablet + " was deleted while iterating");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
index 3d86eab..1c3d89e 100644
--- a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
+++ b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
@@ -38,15 +38,15 @@ import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.FastFormat;
import org.apache.accumulo.core.util.Stat;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
+import com.google.common.collect.Iterators;
+
/**
*
*/
@@ -124,12 +124,7 @@ public class IMMLGBenchmark {
long t1 = System.currentTimeMillis();
- @SuppressWarnings("unused")
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ Iterators.size(scanner.iterator());
long t2 = System.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
index 34308ae..620ae8b 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
@@ -21,7 +21,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.Map.Entry;
import java.util.Random;
import java.util.TreeSet;
import java.util.UUID;
@@ -35,7 +34,6 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
@@ -50,6 +48,7 @@ import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
import com.google.common.net.HostAndPort;
/**
@@ -227,11 +226,7 @@ public class MetadataBatchScanTest {
ScanStat ss = new ScanStat();
long t1 = System.currentTimeMillis();
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : bs) {
- count++;
- }
+ int count = Iterators.size(bs.iterator());
bs.close();
long t2 = System.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java b/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
index 81e25cc..9c524be 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
@@ -48,13 +48,13 @@ import org.apache.accumulo.proxy.thrift.TimeType;
import org.apache.accumulo.proxy.thrift.WriterOptions;
import org.apache.accumulo.server.util.PortUtils;
import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.thrift.protocol.TJSONProtocol;
import org.apache.thrift.server.TServer;
import org.junit.Test;
+import com.google.common.collect.Iterators;
import com.google.common.net.HostAndPort;
public class ProxyDurabilityIT extends ConfigurableMacIT {
@@ -139,7 +139,7 @@ public class ProxyDurabilityIT extends ConfigurableMacIT {
private int count(String tableName) throws Exception {
Connector c = getConnector();
- return FunctionalTestUtils.count(c.createScanner(tableName, Authorizations.EMPTY));
+ return Iterators.size(((Iterable<?>) c.createScanner(tableName, Authorizations.EMPTY)).iterator());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
index fcad293..57fad5d 100644
--- a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
@@ -37,7 +37,6 @@ import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.harness.AccumuloClusterIT;
import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.junit.After;
@@ -46,6 +45,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
public class CleanWalIT extends AccumuloClusterIT {
private static final Logger log = LoggerFactory.getLogger(CleanWalIT.class);
@@ -139,7 +140,7 @@ public class CleanWalIT extends AccumuloClusterIT {
int count(String tableName, Connector conn) throws Exception {
Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
- return FunctionalTestUtils.count(s);
+ return Iterators.size(((Iterable<?>) s).iterator());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java b/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
index c362a95..e2ec222 100644
--- a/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
@@ -35,7 +35,6 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.accumulo.tserver.compaction.CompactionPlan;
import org.apache.accumulo.tserver.compaction.CompactionStrategy;
import org.apache.accumulo.tserver.compaction.MajorCompactionRequest;
@@ -43,6 +42,8 @@ import org.apache.accumulo.tserver.compaction.WriteParameters;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class ConfigurableMajorCompactionIT extends ConfigurableMacIT {
@Override
@@ -103,7 +104,7 @@ public class ConfigurableMajorCompactionIT extends ConfigurableMacIT {
Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
s.setRange(MetadataSchema.TabletsSection.getRange());
s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
- return FunctionalTestUtils.count(s);
+ return Iterators.size(((Iterable<?>) s).iterator());
}
private void writeFile(Connector conn, String tableName) throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java b/test/src/test/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java
index 8f88268..dd97458 100644
--- a/test/src/test/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java
@@ -38,6 +38,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
/**
*
*/
@@ -50,13 +52,7 @@ public class CreateTableWithNewTableConfigIT extends SharedMiniClusterIT {
};
public int numProperties(Connector connector, String tableName) throws AccumuloException, TableNotFoundException {
- int countNew = 0;
- for (@SuppressWarnings("unused")
- Entry<String,String> entry : connector.tableOperations().getProperties(tableName)) {
- countNew++;
- }
-
- return countNew;
+ return Iterators.size(connector.tableOperations().getProperties(tableName).iterator());
}
public int compareProperties(Connector connector, String tableNameOrig, String tableName, String changedProp) throws AccumuloException,
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java b/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
index d06b271..35d4048 100644
--- a/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
@@ -18,14 +18,11 @@ package org.apache.accumulo.test;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.Map.Entry;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.admin.ActiveScan;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterIT;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
@@ -34,6 +31,8 @@ import org.apache.hadoop.conf.Configuration;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
// ACCUMULO-3030
public class InterruptibleScannersIT extends AccumuloClusterIT {
@@ -93,8 +92,7 @@ public class InterruptibleScannersIT extends AccumuloClusterIT {
thread.start();
try {
// Use the scanner, expect problems
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {}
+ Iterators.size(scanner.iterator());
Assert.fail("Scan should not succeed");
} catch (Exception ex) {} finally {
thread.join();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index deb7a1c..44d7af0 100644
--- a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -45,12 +45,13 @@ import org.apache.accumulo.server.master.state.RootTabletStateStore;
import org.apache.accumulo.server.master.state.TServerInstance;
import org.apache.accumulo.server.master.state.TabletLocationState;
import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
@Override
@@ -147,7 +148,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
private void waitForCleanStore(MetaDataStateStore store) {
while (true) {
try {
- FunctionalTestUtils.count(store);
+ Iterators.size(((Iterable<?>) store).iterator());
} catch (Exception ex) {
System.out.println(ex);
UtilWaitThread.sleep(250);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java b/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
index dfd3bbf..6040d32 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
@@ -42,6 +42,8 @@ import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class MetaGetsReadersIT extends ConfigurableMacIT {
@Override
@@ -99,8 +101,7 @@ public class MetaGetsReadersIT extends ConfigurableMacIT {
UtilWaitThread.sleep(500);
long now = System.currentTimeMillis();
Scanner m = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : m) {}
+ Iterators.size(m.iterator());
long delay = System.currentTimeMillis() - now;
System.out.println("Delay = " + delay);
assertTrue("metadata table scan was slow", delay < 1000);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
index 87145ef..d7c0bab 100644
--- a/test/src/test/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
@@ -119,8 +119,7 @@ public class MultiTableRecoveryIT extends ConfigurableMacIT {
getCluster().getClusterControl().stop(ServerType.TABLET_SERVER);
getCluster().start();
// read the metadata table to know everything is back up
- for (@SuppressWarnings("unused")
- Entry<Key,Value> unused : getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {}
+ Iterators.size(getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
i++;
}
System.out.println("Restarted " + i + " times");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java b/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
index 49ed92f..1a3c92f 100644
--- a/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
@@ -38,6 +38,8 @@ import org.apache.hadoop.fs.RawLocalFileSystem;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
// Accumulo3010
public class RecoveryCompactionsAreFlushesIT extends AccumuloClusterIT {
@@ -84,8 +86,7 @@ public class RecoveryCompactionsAreFlushesIT extends AccumuloClusterIT {
control.startAllServers(ServerType.TABLET_SERVER);
// ensure the table is readable
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {}
+ Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
// ensure that the recovery was not a merging minor compaction
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index 5c5b95d..bef59ab 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@ -64,7 +64,6 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.harness.SharedMiniClusterIT;
import org.apache.accumulo.shell.Shell;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.accumulo.tracer.TraceServer;
import org.apache.commons.configuration.ConfigurationException;
@@ -87,6 +86,8 @@ import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
public class ShellServerIT extends SharedMiniClusterIT {
public static class TestOutputStream extends OutputStream {
StringBuilder sb = new StringBuilder();
@@ -1323,7 +1324,7 @@ public class ShellServerIT extends SharedMiniClusterIT {
@Override
public void run() {
try {
- FunctionalTestUtils.count(s);
+ Iterators.size(((Iterable<?>) s).iterator());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
index e47b20a..9c6d05c 100644
--- a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
@@ -37,10 +37,11 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.harness.AccumuloClusterIT;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class SplitRecoveryIT extends AccumuloClusterIT {
private Mutation m(String row) {
@@ -54,7 +55,7 @@ public class SplitRecoveryIT extends AccumuloClusterIT {
Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
scanner.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
- return FunctionalTestUtils.count(scanner) == 0;
+ return Iterators.size(((Iterable<?>) scanner).iterator()) == 0;
}
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
index 672709b..8338021 100644
--- a/test/src/test/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
@@ -20,16 +20,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import java.util.Map.Entry;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
@@ -43,6 +40,8 @@ import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class VerifySerialRecoveryIT extends ConfigurableMacIT {
@Override
@@ -78,9 +77,7 @@ public class VerifySerialRecoveryIT extends ConfigurableMacIT {
final Process ts = cluster.exec(TabletServer.class);
// wait for recovery
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY))
- ;
+ Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
ts.waitFor();
String result = FunctionalTestUtils.readAll(cluster, TabletServer.class, ts);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/WaitForBalanceIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/WaitForBalanceIT.java b/test/src/test/java/org/apache/accumulo/test/WaitForBalanceIT.java
index f818fdc..93854f5 100644
--- a/test/src/test/java/org/apache/accumulo/test/WaitForBalanceIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/WaitForBalanceIT.java
@@ -37,6 +37,8 @@ import org.apache.accumulo.test.functional.ConfigurableMacIT;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class WaitForBalanceIT extends ConfigurableMacIT {
@Override
@@ -48,9 +50,7 @@ public class WaitForBalanceIT extends ConfigurableMacIT {
public void test() throws Exception {
final Connector c = getConnector();
// ensure the metadata table is online
- for (@SuppressWarnings("unused")
- Entry<Key,Value> unused : c.createScanner(MetadataTable.NAME, Authorizations.EMPTY))
- ;
+ Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
c.instanceOperations().waitForBalance();
assertTrue(isBalanced());
final String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
index 89b931d..df5fa93 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
@@ -20,14 +20,12 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.util.EnumSet;
-import java.util.Map.Entry;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
@@ -37,6 +35,8 @@ import org.apache.accumulo.harness.AccumuloClusterIT;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class BadIteratorMincIT extends AccumuloClusterIT {
@Override
@@ -68,7 +68,7 @@ public class BadIteratorMincIT extends AccumuloClusterIT {
// try to scan table
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
- int count = FunctionalTestUtils.count(scanner);
+ int count = Iterators.size(((Iterable<?>) scanner).iterator());
assertEquals("Did not see expected # entries " + count, 1, count);
// remove the bad iterator
@@ -79,11 +79,7 @@ public class BadIteratorMincIT extends AccumuloClusterIT {
// minc should complete
FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1);
- count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ count = Iterators.size(scanner.iterator());
if (count != 1)
throw new Exception("Did not see expected # entries " + count);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
index 284bc5b..6378480 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
@@ -41,6 +41,8 @@ import org.apache.accumulo.harness.AccumuloClusterIT;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class BatchWriterFlushIT extends AccumuloClusterIT {
private static final int NUM_TO_FLUSH = 100000;
@@ -74,11 +76,7 @@ public class BatchWriterFlushIT extends AccumuloClusterIT {
UtilWaitThread.sleep(500);
- int count = 0;
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ int count = Iterators.size(scanner.iterator());
if (count != 0) {
throw new Exception("Flushed too soon");
@@ -86,10 +84,7 @@ public class BatchWriterFlushIT extends AccumuloClusterIT {
UtilWaitThread.sleep(1500);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner) {
- count++;
- }
+ count = Iterators.size(scanner.iterator());
if (count != 1) {
throw new Exception("Did not flush");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BigRootTabletIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
index 3e979d3..97270b1 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
@@ -30,6 +30,8 @@ import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class BigRootTabletIT extends AccumuloClusterIT {
// ACCUMULO-542: A large root tablet will fail to load if it does't fit in the tserver scan buffers
@@ -58,7 +60,7 @@ public class BigRootTabletIT extends AccumuloClusterIT {
}
cluster.stop();
cluster.start();
- assertTrue(FunctionalTestUtils.count(c.createScanner(RootTable.NAME, Authorizations.EMPTY)) > 0);
+ assertTrue(Iterators.size(((Iterable<?>) c.createScanner(RootTable.NAME, Authorizations.EMPTY)).iterator()) > 0);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
index 2114992..bb52a94 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
@@ -47,6 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
public class CleanTmpIT extends AccumuloClusterIT {
private static final Logger log = LoggerFactory.getLogger(CleanTmpIT.class);
@@ -106,7 +107,7 @@ public class CleanTmpIT extends AccumuloClusterIT {
getClusterControl().startAllServers(ServerType.TABLET_SERVER);
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
- assertEquals(2, FunctionalTestUtils.count(scanner));
+ assertEquals(2, Iterators.size(((Iterable<?>) scanner).iterator()));
// If we performed log recovery, we should have cleaned up any stray files
assertFalse("File still exists: " + tmp, fs.exists(tmp));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
index 03646c1..a9f93e7 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
@@ -51,6 +51,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
public class CompactionIT extends AccumuloClusterIT {
private static final Logger log = LoggerFactory.getLogger(CompactionIT.class);
@@ -176,7 +178,7 @@ public class CompactionIT extends AccumuloClusterIT {
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
s.fetchColumnFamily(MetadataSchema.TabletsSection.TabletColumnFamily.NAME);
s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
- return FunctionalTestUtils.count(s);
+ return Iterators.size(((Iterable<?>) s).iterator());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
index 87374ca..3699ef6 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
@@ -43,6 +43,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class ConcurrencyIT extends AccumuloClusterIT {
static class ScanTask extends Thread {
@@ -59,7 +61,7 @@ public class ConcurrencyIT extends AccumuloClusterIT {
@Override
public void run() {
- count = FunctionalTestUtils.count(scanner);
+ count = Iterators.size(((Iterable<?>) scanner).iterator());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
index 32c1a3f..80a6b76 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
@@ -44,6 +44,8 @@ import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class ConfigurableCompactionIT extends ConfigurableMacIT {
@Override
@@ -156,7 +158,7 @@ public class ConfigurableCompactionIT extends ConfigurableMacIT {
private int countFiles(Connector c, String tableName) throws Exception {
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
- return FunctionalTestUtils.count(s);
+ return Iterators.size(((Iterable<?>) s).iterator());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
index 961c09f..9112669 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
@@ -41,6 +41,7 @@ import org.junit.Before;
import org.junit.Test;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
public class DeleteEverythingIT extends AccumuloClusterIT {
@@ -97,7 +98,7 @@ public class DeleteEverythingIT extends AccumuloClusterIT {
Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
scanner.setRange(new Range());
- int count = FunctionalTestUtils.count(scanner);
+ int count = Iterators.size(((Iterable<?>) scanner).iterator());
assertEquals("count == " + count, 0, count);
getConnector().tableOperations().flush(tableName, null, null, true);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
index 7fdc65e..12d52c2 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
@@ -40,6 +40,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
public class DeleteRowsIT extends AccumuloClusterIT {
@Override
@@ -73,7 +75,7 @@ public class DeleteRowsIT extends AccumuloClusterIT {
c.tableOperations().create(tableName);
c.tableOperations().deleteRows(tableName, null, null);
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
- assertEquals(0, FunctionalTestUtils.count(scanner));
+ assertEquals(0, Iterators.size(((Iterable<?>) scanner).iterator()));
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
index de40718..236fc6b 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java
@@ -37,6 +37,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class DurabilityIT extends ConfigurableMacIT {
@Override
@@ -172,7 +174,7 @@ public class DurabilityIT extends ConfigurableMacIT {
}
private long readSome(String table) throws Exception {
- return FunctionalTestUtils.count(getConnector().createScanner(table, Authorizations.EMPTY));
+ return Iterators.size(((Iterable<?>) getConnector().createScanner(table, Authorizations.EMPTY)).iterator());
}
private void restartTServer() throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
index 33c4e48..8fb7e8f 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
@@ -99,6 +99,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
public class ExamplesIT extends AccumuloClusterIT {
private static final Logger log = LoggerFactory.getLogger(ExamplesIT.class);
private static final BatchWriterOpts bwOpts = new BatchWriterOpts();
@@ -288,7 +290,7 @@ public class ExamplesIT extends AccumuloClusterIT {
bw.addMutation(m);
bw.close();
UtilWaitThread.sleep(1000);
- assertEquals(0, FunctionalTestUtils.count(c.createScanner(tableName, Authorizations.EMPTY)));
+ assertEquals(0, Iterators.size(((Iterable<?>) c.createScanner(tableName, Authorizations.EMPTY)).iterator()));
}
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
index 876eb60..d215af6 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
@@ -51,6 +51,8 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.junit.Assert;
+import com.google.common.collect.Iterators;
+
public class FunctionalTestUtils {
public static int countRFiles(Connector c, String tableName) throws Exception {
@@ -59,7 +61,7 @@ public class FunctionalTestUtils {
scanner.setRange(MetadataSchema.TabletsSection.getRange(tableId));
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
- return count(scanner);
+ return Iterators.size(((Iterable<?>) scanner).iterator());
}
static void checkRFiles(Connector c, String tableName, int minTablets, int maxTablets, int minRFiles, int maxRFiles) throws Exception {
@@ -187,12 +189,4 @@ public class FunctionalTestUtils {
return result;
}
- public static int count(Iterable<?> i) {
- int count = 0;
- for (@SuppressWarnings("unused")
- Object entry : i)
- count++;
- return count;
- }
-
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index 9dc8eef..e7839ec 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -58,7 +59,6 @@ import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
@@ -68,6 +68,8 @@ import org.apache.zookeeper.KeeperException.NoNodeException;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class GarbageCollectorIT extends ConfigurableMacIT {
private static final String OUR_SECRET = "itsreallysecret";
@@ -170,7 +172,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
cluster.start();
// did it recover?
Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
- FunctionalTestUtils.count(scanner);
+ Iterators.size(((Iterable<?>) scanner).iterator());
}
private Mutation createDelMutation(String path, String cf, String cq, String val) {
@@ -278,13 +280,8 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
private int countFiles() throws Exception {
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
- int result = 0;
Path path = new Path(cluster.getConfig().getDir() + "/accumulo/tables/1/*/*.rf");
- for (@SuppressWarnings("unused")
- FileStatus entry : fs.globStatus(path)) {
- result++;
- }
- return result;
+ return Iterators.size(Arrays.asList(fs.globStatus(path)).iterator());
}
public static void addEntries(Connector conn, BatchWriterOpts bwOpts) throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
index ae33651..4b23463 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
@@ -44,6 +44,8 @@ import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class MetadataIT extends AccumuloClusterIT {
@Override
@@ -108,7 +110,7 @@ public class MetadataIT extends AccumuloClusterIT {
c.tableOperations().merge(MetadataTable.NAME, null, null);
Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY);
s.setRange(MetadataSchema.DeletesSection.getRange());
- while (FunctionalTestUtils.count(s) == 0) {
+ while (Iterators.size(((Iterable<?>) s).iterator()) == 0) {
UtilWaitThread.sleep(100);
}
assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
index 1f3e600..12e7656 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
@@ -85,6 +85,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Charsets;
+import com.google.common.collect.Iterators;
public class ReadWriteIT extends AccumuloClusterIT {
@Override
@@ -347,12 +348,12 @@ public class ReadWriteIT extends AccumuloClusterIT {
long now = System.currentTimeMillis();
Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
scanner.fetchColumnFamily(new Text("colf"));
- FunctionalTestUtils.count(scanner);
+ Iterators.size(((Iterable<?>) scanner).iterator());
long diff = System.currentTimeMillis() - now;
now = System.currentTimeMillis();
scanner = connector.createScanner(tableName, Authorizations.EMPTY);
scanner.fetchColumnFamily(new Text("colf2"));
- FunctionalTestUtils.count(scanner);
+ Iterators.size(((Iterable<?>) scanner).iterator());
bw.close();
long diff2 = System.currentTimeMillis() - now;
assertTrue(diff2 < diff);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java b/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
index 6d343ce..19ee6d2 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
@@ -41,6 +41,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class RowDeleteIT extends AccumuloClusterIT {
@Override
@@ -79,7 +81,7 @@ public class RowDeleteIT extends AccumuloClusterIT {
checkRFiles(c, tableName, 1, 1, 1, 1);
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
- int count = FunctionalTestUtils.count(scanner);
+ int count = Iterators.size(((Iterable<?>) scanner).iterator());
assertEquals("count == " + count, 2, count);
bw.addMutation(nm("r1", "", "", RowDeletingIterator.DELETE_ROW_VALUE));
@@ -90,7 +92,7 @@ public class RowDeleteIT extends AccumuloClusterIT {
checkRFiles(c, tableName, 1, 1, 2, 2);
scanner = c.createScanner(tableName, Authorizations.EMPTY);
- count = FunctionalTestUtils.count(scanner);
+ count = Iterators.size(((Iterable<?>) scanner).iterator());
assertEquals("count == " + count, 3, count);
c.tableOperations().compact(tableName, null, null, false, true);
@@ -98,7 +100,7 @@ public class RowDeleteIT extends AccumuloClusterIT {
checkRFiles(c, tableName, 1, 1, 0, 0);
scanner = c.createScanner(tableName, Authorizations.EMPTY);
- count = FunctionalTestUtils.count(scanner);
+ count = Iterators.size(((Iterable<?>) scanner).iterator());
assertEquals("count == " + count, 0, count);
bw.close();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
index f0df2d0..ebb48c1 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SessionDurabilityIT.java
@@ -38,6 +38,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class SessionDurabilityIT extends ConfigurableMacIT {
@Override
@@ -81,7 +83,7 @@ public class SessionDurabilityIT extends ConfigurableMacIT {
}
private int count(String tableName) throws Exception {
- return FunctionalTestUtils.count(getConnector().createScanner(tableName, Authorizations.EMPTY));
+ return Iterators.size(((Iterable<?>) getConnector().createScanner(tableName, Authorizations.EMPTY)).iterator());
}
private void writeSome(String tableName, int n, BatchWriterConfig cfg) throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java b/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
index a1c7fc2..3a248d4 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
@@ -46,6 +46,8 @@ import org.hamcrest.CoreMatchers;
import org.junit.Assume;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class TableIT extends AccumuloClusterIT {
@Override
@@ -86,12 +88,12 @@ public class TableIT extends AccumuloClusterIT {
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
s.setRange(new KeyExtent(new Text(id), null, null).toMetadataRange());
s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
- assertTrue(FunctionalTestUtils.count(s) > 0);
+ assertTrue(Iterators.size(((Iterable<?>) s).iterator()) > 0);
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
assertTrue(fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id)).length > 0);
to.delete(tableName);
- assertEquals(0, FunctionalTestUtils.count(s));
+ assertEquals(0, Iterators.size(((Iterable<?>) s).iterator()));
try {
assertEquals(0, fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id)).length);
} catch (FileNotFoundException ex) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
index 7211494..2c4783a 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
@@ -49,6 +49,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import com.google.common.collect.Iterators;
+
public class VisibilityIT extends AccumuloClusterIT {
@Override
@@ -264,11 +266,9 @@ public class VisibilityIT extends AccumuloClusterIT {
}
private void verifyDefault(Scanner scanner, int expectedCount) throws Exception {
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : scanner)
- --expectedCount;
- if (expectedCount != 0)
- throw new Exception(" expected count !=0 " + expectedCount);
+ int actual = Iterators.size(scanner.iterator());
+ if (actual != expectedCount)
+ throw new Exception("actual count " + actual + " != expected count " + expectedCount);
}
private void verify(Connector c, String tableName, Set<String> auths, Set<String> expectedValues) throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/replication/KerberosReplicationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/KerberosReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/KerberosReplicationIT.java
index 382cda0..be9e320 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/KerberosReplicationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/KerberosReplicationIT.java
@@ -57,6 +57,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
/**
* Ensure that replication occurs using keytabs instead of password (not to mention SASL)
*/
@@ -212,8 +214,7 @@ public class KerberosReplicationIT extends AccumuloIT {
log.info("Restarted the tserver");
// Read the data -- the tserver is back up and running and tablets are assigned
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : primaryConn.createScanner(primaryTable1, Authorizations.EMPTY)) {}
+ Iterators.size(primaryConn.createScanner(primaryTable1, Authorizations.EMPTY).iterator());
// Wait for both tables to be replicated
log.info("Waiting for {} for {}", filesFor1, primaryTable1);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
index 7a017e1..fea41fa 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
@@ -66,6 +66,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
/**
* Replication tests which start at least two MAC instances and replicate data between them
*/
@@ -220,8 +222,7 @@ public class MultiInstanceReplicationIT extends ConfigurableMacIT {
cluster.exec(TabletServer.class);
log.info("TabletServer restarted");
- for (@SuppressWarnings("unused")
- Entry<Key,Value> e : ReplicationTable.getScanner(connMaster)) {}
+ Iterators.size(ReplicationTable.getScanner(connMaster).iterator());
log.info("TabletServer is online");
log.info("");
@@ -406,8 +407,7 @@ public class MultiInstanceReplicationIT extends ConfigurableMacIT {
log.info("Restarted the tserver");
// Read the data -- the tserver is back up and running
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : connMaster.createScanner(masterTable1, Authorizations.EMPTY)) {}
+ Iterators.size(connMaster.createScanner(masterTable1, Authorizations.EMPTY).iterator());
// Wait for both tables to be replicated
log.info("Waiting for {} for {}", filesFor1, masterTable1);
@@ -516,8 +516,7 @@ public class MultiInstanceReplicationIT extends ConfigurableMacIT {
cluster.exec(TabletServer.class);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> kv : connMaster.createScanner(masterTable, Authorizations.EMPTY)) {}
+ Iterators.size(connMaster.createScanner(masterTable, Authorizations.EMPTY).iterator());
for (Entry<Key,Value> kv : ReplicationTable.getScanner(connMaster)) {
log.debug(kv.getKey().toStringNoTruncate() + " " + ProtobufUtil.toString(Status.parseFrom(kv.getValue().get())));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/replication/ReplicationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/ReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/ReplicationIT.java
index 8bd5641..768d857 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/ReplicationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/ReplicationIT.java
@@ -96,6 +96,7 @@ import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import com.google.protobuf.TextFormat;
@@ -680,9 +681,7 @@ public class ReplicationIT extends ConfigurableMacIT {
}
for (String table : Arrays.asList(MetadataTable.NAME, table1, table2, table3)) {
- Scanner s = conn.createScanner(table, Authorizations.EMPTY);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : s) {}
+ Iterators.size(conn.createScanner(table, Authorizations.EMPTY).iterator());
}
}
@@ -1119,9 +1118,7 @@ public class ReplicationIT extends ConfigurableMacIT {
// Make sure we can read all the tables (recovery complete)
for (String table : Arrays.asList(table1, table2, table3)) {
- Scanner s = conn.createScanner(table, Authorizations.EMPTY);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : s) {}
+ Iterators.size(conn.createScanner(table, Authorizations.EMPTY).iterator());
}
// Starting the gc will run CloseWriteAheadLogReferences which will first close Statuses
@@ -1361,9 +1358,7 @@ public class ReplicationIT extends ConfigurableMacIT {
// Make sure we can read all the tables (recovery complete)
for (String table : new String[] {MetadataTable.NAME, table1}) {
- s = conn.createScanner(table, Authorizations.EMPTY);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : s) {}
+ Iterators.size(conn.createScanner(table, Authorizations.EMPTY).iterator());
}
log.info("Recovered metadata:");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba7fb3e1/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
index f486424..761d92c 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
@@ -66,6 +66,8 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Iterators;
+
public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT {
private static final Logger log = LoggerFactory.getLogger(UnorderedWorkAssignerReplicationIT.class);
@@ -227,8 +229,7 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT {
cluster.exec(TabletServer.class);
log.info("TabletServer restarted");
- for (@SuppressWarnings("unused")
- Entry<Key,Value> e : ReplicationTable.getScanner(connMaster)) {}
+ Iterators.size(ReplicationTable.getScanner(connMaster).iterator());
log.info("TabletServer is online");
log.info("");
@@ -417,8 +418,7 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT {
log.info("Restarted the tserver");
// Read the data -- the tserver is back up and running
- for (@SuppressWarnings("unused")
- Entry<Key,Value> entry : connMaster.createScanner(masterTable1, Authorizations.EMPTY)) {}
+ Iterators.size(connMaster.createScanner(masterTable1, Authorizations.EMPTY).iterator());
// Wait for both tables to be replicated
log.info("Waiting for {} for {}", filesFor1, masterTable1);
@@ -543,8 +543,7 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT {
cluster.exec(TabletServer.class);
- for (@SuppressWarnings("unused")
- Entry<Key,Value> kv : connMaster.createScanner(masterTable, Authorizations.EMPTY)) {}
+ Iterators.size(connMaster.createScanner(masterTable, Authorizations.EMPTY).iterator());
for (Entry<Key,Value> kv : connMaster.createScanner(ReplicationTable.NAME, Authorizations.EMPTY)) {
log.debug(kv.getKey().toStringNoTruncate() + " " + ProtobufUtil.toString(Status.parseFrom(kv.getValue().get())));