HBASE-26919 Rewrite the counting rows part in TestFromClientSide4 (#4314)

Signed-off-by: Xiaolin Ha <haxiaolin@apache.org>
(cherry picked from commit 4e12eee531)
This commit is contained in:
Duo Zhang 2022-04-03 22:42:49 +08:00
parent 03b5529feb
commit 0b87621a38
1 changed files with 4 additions and 8 deletions

View File

@ -61,6 +61,8 @@ import org.junit.runners.Parameterized;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
/** /**
* Run tests that use the HBase clients; {@link Table}. * Run tests that use the HBase clients; {@link Table}.
* Sets up the HBase mini cluster once at start and runs through all client tests. * Sets up the HBase mini cluster once at start and runs through all client tests.
@ -1041,10 +1043,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
Scan scan = new Scan(); Scan scan = new Scan();
scan.addFamily(CONTENTS_FAMILY); scan.addFamily(CONTENTS_FAMILY);
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int nbRows = 0; int nbRows = Iterables.size(scanner);
for (@SuppressWarnings("unused") Result row : scanner) {
nbRows++;
}
assertEquals(NB_BATCH_ROWS, nbRows); assertEquals(NB_BATCH_ROWS, nbRows);
} }
} }
@ -1070,10 +1069,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
Scan scan = new Scan(); Scan scan = new Scan();
scan.addFamily(CONTENTS_FAMILY); scan.addFamily(CONTENTS_FAMILY);
try (ResultScanner scanner = table.getScanner(scan)) { try (ResultScanner scanner = table.getScanner(scan)) {
int nbRows = 0; int nbRows = Iterables.size(scanner);
for (@SuppressWarnings("unused") Result row : scanner) {
nbRows++;
}
assertEquals(NB_BATCH_ROWS * 10, nbRows); assertEquals(NB_BATCH_ROWS * 10, nbRows);
} }
} }