HBASE-23646 Resolved remaining Checkstyle violations in tests of hbase-rest

Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
Jan Hentschel 2020-01-11 21:09:14 +01:00 committed by GitHub
parent c8496bc694
commit 0a9e1f807d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 315 additions and 317 deletions

View File

@ -49,4 +49,6 @@
<suppress checks="LineLength" files="org.apache.hadoop.hbase.util.ZKDataMigrator.java"/> <suppress checks="LineLength" files="org.apache.hadoop.hbase.util.ZKDataMigrator.java"/>
<suppress checks="InnerAssignment" files="org.apache.hadoop.hbase.Waiter"/> <suppress checks="InnerAssignment" files="org.apache.hadoop.hbase.Waiter"/>
<suppress checks="EmptyBlock" files="org.apache.hadoop.hbase.TestTimeout"/> <suppress checks="EmptyBlock" files="org.apache.hadoop.hbase.TestTimeout"/>
<suppress checks="InnerAssignment" files="org.apache.hadoop.hbase.rest.PerformanceEvaluation"/>
<suppress checks="EmptyBlock" files="org.apache.hadoop.hbase.rest.PerformanceEvaluation"/>
</suppressions> </suppressions>

View File

@ -25,7 +25,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class HBaseRESTTestingUtility { public class HBaseRESTTestingUtility {
private static final Logger LOG = LoggerFactory.getLogger(HBaseRESTTestingUtility.class); private static final Logger LOG = LoggerFactory.getLogger(HBaseRESTTestingUtility.class);
private RESTServer server; private RESTServer server;
@ -52,12 +51,14 @@ public class HBaseRESTTestingUtility {
} }
public void shutdownServletContainer() { public void shutdownServletContainer() {
if (server != null) try { if (server != null) {
server.stop(); try {
server = null; server.stop();
RESTServlet.stop(); server = null;
} catch (Exception e) { RESTServlet.stop();
LOG.warn(StringUtils.stringifyException(e)); } catch (Exception e) {
LOG.warn(StringUtils.stringifyException(e));
}
} }
} }
} }

View File

@ -75,6 +75,7 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Hash; import org.apache.hadoop.hbase.util.Hash;
import org.apache.hadoop.hbase.util.MurmurHash; import org.apache.hadoop.hbase.util.MurmurHash;
import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Text;
@ -91,6 +92,7 @@ import org.apache.hadoop.mapreduce.lib.reduce.LongSumReducer;
import org.apache.hadoop.util.LineReader; import org.apache.hadoop.util.LineReader;
import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.ToolRunner;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -204,8 +206,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
protected void addCommandDescriptor(Class<? extends Test> cmdClass, protected void addCommandDescriptor(Class<? extends Test> cmdClass,
String name, String description) { String name, String description) {
CmdDescriptor cmdDescriptor = CmdDescriptor cmdDescriptor = new CmdDescriptor(cmdClass, name, description);
new CmdDescriptor(cmdClass, name, description);
commands.put(name, cmdDescriptor); commands.put(name, cmdDescriptor);
} }
@ -335,7 +336,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
// generate splits // generate splits
List<InputSplit> splitList = new ArrayList<>(); List<InputSplit> splitList = new ArrayList<>();
for (FileStatus file: listStatus(job)) { for (FileStatus file : listStatus(job)) {
if (file.isDirectory()) { if (file.isDirectory()) {
continue; continue;
} }
@ -344,10 +345,10 @@ public class PerformanceEvaluation extends Configured implements Tool {
FSDataInputStream fileIn = fs.open(path); FSDataInputStream fileIn = fs.open(path);
LineReader in = new LineReader(fileIn, job.getConfiguration()); LineReader in = new LineReader(fileIn, job.getConfiguration());
int lineLen; int lineLen;
while(true) { while (true) {
Text lineText = new Text(); Text lineText = new Text();
lineLen = in.readLine(lineText); lineLen = in.readLine(lineText);
if(lineLen <= 0) { if (lineLen <= 0) {
break; break;
} }
Matcher m = LINE_PATTERN.matcher(lineText.toString()); Matcher m = LINE_PATTERN.matcher(lineText.toString());
@ -406,7 +407,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override @Override
public boolean nextKeyValue() { public boolean nextKeyValue() {
if(readOver) { if (readOver) {
return false; return false;
} }
@ -429,7 +430,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override @Override
public float getProgress() { public float getProgress() {
if(readOver) { if (readOver) {
return 1.0f; return 1.0f;
} else { } else {
return 0.0f; return 0.0f;
@ -562,7 +563,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
int numSplitPoints = presplitRegions - 1; int numSplitPoints = presplitRegions - 1;
byte[][] splits = new byte[numSplitPoints][]; byte[][] splits = new byte[numSplitPoints][];
int jump = this.R / this.presplitRegions; int jump = this.R / this.presplitRegions;
for (int i=0; i < numSplitPoints; i++) { for (int i = 0; i < numSplitPoints; i++) {
int rowkey = jump * (1 + i); int rowkey = jump * (1 + i);
splits[i] = format(rowkey); splits[i] = format(rowkey);
} }
@ -635,11 +636,11 @@ public class PerformanceEvaluation extends Configured implements Tool {
}; };
threads.add(t); threads.add(t);
} }
for (Thread t: threads) { for (Thread t : threads) {
t.start(); t.start();
} }
for (Thread t: threads) { for (Thread t : threads) {
while(t.isAlive()) { while (t.isAlive()) {
try { try {
t.join(); t.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -708,33 +709,32 @@ public class PerformanceEvaluation extends Configured implements Tool {
FileSystem fs = FileSystem.get(c); FileSystem fs = FileSystem.get(c);
fs.mkdirs(inputDir); fs.mkdirs(inputDir);
Path inputFile = new Path(inputDir, "input.txt"); Path inputFile = new Path(inputDir, "input.txt");
PrintStream out = new PrintStream(fs.create(inputFile));
// Make input random. // Make input random.
Map<Integer, String> m = new TreeMap<>(); try (PrintStream out = new PrintStream(fs.create(inputFile))) {
Hash h = MurmurHash.getInstance(); Map<Integer, String> m = new TreeMap<>();
int perClientRows = (this.R / this.N); Hash h = MurmurHash.getInstance();
try { int perClientRows = (this.R / this.N);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
for (int j = 0; j < N; j++) { for (int j = 0; j < N; j++) {
String s = "tableName=" + this.tableName + StringBuilder s = new StringBuilder();
", startRow=" + ((j * perClientRows) + (i * (perClientRows/10))) + s.append("tableName=").append(tableName);
", perClientRunRows=" + (perClientRows / 10) + s.append(", startRow=").append((j * perClientRows) + (i * (perClientRows / 10)));
", totalRows=" + this.R + s.append(", perClientRunRows=").append(perClientRows / 10);
", clients=" + this.N + s.append(", totalRows=").append(R);
", flushCommits=" + this.flushCommits + s.append(", clients=").append(N);
", writeToWAL=" + this.writeToWAL + s.append(", flushCommits=").append(flushCommits);
", useTags=" + this.useTags + s.append(", writeToWAL=").append(writeToWAL);
", noOfTags=" + this.noOfTags; s.append(", useTags=").append(useTags);
byte[] b = Bytes.toBytes(s); s.append(", noOfTags=").append(noOfTags);
byte[] b = Bytes.toBytes(s.toString());
int hash = h.hash(new ByteArrayHashKey(b, 0, b.length), -1); int hash = h.hash(new ByteArrayHashKey(b, 0, b.length), -1);
m.put(hash, s); m.put(hash, s.toString());
} }
} }
for (Map.Entry<Integer, String> e: m.entrySet()) { for (Map.Entry<Integer, String> e : m.entrySet()) {
out.println(e.getValue()); out.println(e.getValue());
} }
} finally {
out.close();
} }
return inputDir; return inputDir;
} }
@ -1198,15 +1198,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
void testRow(int i) throws IOException { void testRow(int i) throws IOException {
byte[] value = generateValue(this.rand); byte[] value = generateValue(this.rand);
Scan scan = constructScan(value); Scan scan = constructScan(value);
ResultScanner scanner = null; try (ResultScanner scanner = this.table.getScanner(scan)) {
try {
scanner = this.table.getScanner(scan);
while (scanner.next() != null) { while (scanner.next() != null) {
} }
} finally {
if (scanner != null) {
scanner.close();
}
} }
} }

View File

@ -19,6 +19,9 @@ package org.apache.hadoop.hbase.rest;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
@ -31,8 +34,6 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller; import javax.xml.bind.Unmarshaller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
@ -53,7 +54,6 @@ import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
public class RowResourceBase { public class RowResourceBase {
protected static final String TABLE = "TestRowResource"; protected static final String TABLE = "TestRowResource";
protected static final TableName TABLE_NAME = TableName.valueOf(TABLE); protected static final TableName TABLE_NAME = TableName.valueOf(TABLE);
@ -84,7 +84,6 @@ public class RowResourceBase {
protected static Configuration conf; protected static Configuration conf;
protected static ObjectMapper jsonMapper; protected static ObjectMapper jsonMapper;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration(); conf = TEST_UTIL.getConfiguration();
@ -184,8 +183,8 @@ public class RowResourceBase {
assertEquals(Bytes.toString(cell.getValue()), value); assertEquals(Bytes.toString(cell.getValue()), value);
} }
protected static void checkIncrementValueXML(String table, String row, String column, protected static void checkIncrementValueXML(String table, String row, String column, long value)
long value) throws IOException, JAXBException { throws IOException, JAXBException {
Response response1 = getValueXML(table, row, column); Response response1 = getValueXML(table, row, column);
assertEquals(200, response1.getCode()); assertEquals(200, response1.getCode());
assertEquals(Constants.MIMETYPE_XML, response1.getHeader("content-type")); assertEquals(Constants.MIMETYPE_XML, response1.getHeader("content-type"));
@ -267,16 +266,17 @@ public class RowResourceBase {
assertEquals(Bytes.toLong(cell.getValue()), value); assertEquals(Bytes.toLong(cell.getValue()), value);
} }
protected static Response checkAndPutValuePB(String url, String table, protected static Response checkAndPutValuePB(String url, String table, String row, String column,
String row, String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells) String valueToCheck, String valueToPut, HashMap<String,String> otherCells)
throws IOException { throws IOException {
RowModel rowModel = new RowModel(row); RowModel rowModel = new RowModel(row);
rowModel.addCell(new CellModel(Bytes.toBytes(column), rowModel.addCell(new CellModel(Bytes.toBytes(column),
Bytes.toBytes(valueToPut))); Bytes.toBytes(valueToPut)));
if(otherCells != null) { if (otherCells != null) {
for (Map.Entry<String,String> entry :otherCells.entrySet()) { for (Map.Entry<String,String> entry : otherCells.entrySet()) {
rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()))); rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()),
Bytes.toBytes(entry.getValue())));
} }
} }
@ -296,8 +296,10 @@ public class RowResourceBase {
String column, String valueToCheck, String valueToPut) throws IOException { String column, String valueToCheck, String valueToPut) throws IOException {
return checkAndPutValuePB(table,row,column,valueToCheck,valueToPut,null); return checkAndPutValuePB(table,row,column,valueToCheck,valueToPut,null);
} }
protected static Response checkAndPutValuePB(String table, String row,
String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells) throws IOException { protected static Response checkAndPutValuePB(String table, String row, String column,
String valueToCheck, String valueToPut, HashMap<String,String> otherCells)
throws IOException {
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append('/'); path.append('/');
path.append(table); path.append(table);
@ -308,16 +310,17 @@ public class RowResourceBase {
valueToCheck, valueToPut, otherCells); valueToCheck, valueToPut, otherCells);
} }
protected static Response checkAndPutValueXML(String url, String table, protected static Response checkAndPutValueXML(String url, String table, String row, String column,
String row, String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells) String valueToCheck, String valueToPut, HashMap<String,String> otherCells)
throws IOException, JAXBException { throws IOException, JAXBException {
RowModel rowModel = new RowModel(row); RowModel rowModel = new RowModel(row);
rowModel.addCell(new CellModel(Bytes.toBytes(column), rowModel.addCell(new CellModel(Bytes.toBytes(column),
Bytes.toBytes(valueToPut))); Bytes.toBytes(valueToPut)));
if(otherCells != null) { if (otherCells != null) {
for (Map.Entry<String,String> entry :otherCells.entrySet()) { for (Map.Entry<String,String> entry : otherCells.entrySet()) {
rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()))); rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()),
Bytes.toBytes(entry.getValue())));
} }
} }
@ -334,9 +337,8 @@ public class RowResourceBase {
return response; return response;
} }
protected static Response checkAndPutValueXML(String table, String row, protected static Response checkAndPutValueXML(String table, String row, String column,
String column, String valueToCheck, String valueToPut) String valueToCheck, String valueToPut) throws IOException, JAXBException {
throws IOException, JAXBException {
return checkAndPutValueXML(table,row,column,valueToCheck,valueToPut, null); return checkAndPutValueXML(table,row,column,valueToCheck,valueToPut, null);
} }
@ -358,9 +360,10 @@ public class RowResourceBase {
throws IOException, JAXBException { throws IOException, JAXBException {
RowModel rowModel = new RowModel(row); RowModel rowModel = new RowModel(row);
if(cellsToDelete != null) { if (cellsToDelete != null) {
for (Map.Entry<String,String> entry :cellsToDelete.entrySet()) { for (Map.Entry<String,String> entry : cellsToDelete.entrySet()) {
rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()))); rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()),
Bytes.toBytes(entry.getValue())));
} }
} }
// Add this at the end // Add this at the end
@ -380,8 +383,10 @@ public class RowResourceBase {
String column, String valueToCheck) throws IOException, JAXBException { String column, String valueToCheck) throws IOException, JAXBException {
return checkAndDeleteXML(table, row, column, valueToCheck, null); return checkAndDeleteXML(table, row, column, valueToCheck, null);
} }
protected static Response checkAndDeleteXML(String table, String row, protected static Response checkAndDeleteXML(String table, String row,
String column, String valueToCheck, HashMap<String,String> cellsToDelete) throws IOException, JAXBException { String column, String valueToCheck, HashMap<String,String> cellsToDelete)
throws IOException, JAXBException {
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append('/'); path.append('/');
path.append(table); path.append(table);
@ -392,12 +397,13 @@ public class RowResourceBase {
} }
protected static Response checkAndDeleteJson(String table, String row, protected static Response checkAndDeleteJson(String table, String row,
String column, String valueToCheck) throws IOException, JAXBException { String column, String valueToCheck) throws IOException {
return checkAndDeleteJson(table, row, column, valueToCheck, null); return checkAndDeleteJson(table, row, column, valueToCheck, null);
} }
protected static Response checkAndDeleteJson(String table, String row, protected static Response checkAndDeleteJson(String table, String row,
String column, String valueToCheck, HashMap<String,String> cellsToDelete) throws IOException, JAXBException { String column, String valueToCheck, HashMap<String,String> cellsToDelete)
throws IOException {
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append('/'); path.append('/');
path.append(table); path.append(table);
@ -409,12 +415,13 @@ public class RowResourceBase {
protected static Response checkAndDeleteJson(String url, String table, protected static Response checkAndDeleteJson(String url, String table,
String row, String column, String valueToCheck, HashMap<String,String> cellsToDelete) String row, String column, String valueToCheck, HashMap<String,String> cellsToDelete)
throws IOException, JAXBException { throws IOException {
RowModel rowModel = new RowModel(row); RowModel rowModel = new RowModel(row);
if(cellsToDelete != null) { if (cellsToDelete != null) {
for (Map.Entry<String,String> entry :cellsToDelete.entrySet()) { for (Map.Entry<String,String> entry : cellsToDelete.entrySet()) {
rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()))); rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()),
Bytes.toBytes(entry.getValue())));
} }
} }
// Add this at the end // Add this at the end
@ -429,9 +436,8 @@ public class RowResourceBase {
return response; return response;
} }
protected static Response checkAndDeletePB(String table, String row, protected static Response checkAndDeletePB(String table, String row, String column, String value)
String column, String value) throws IOException { throws IOException {
return checkAndDeletePB(table, row, column, value, null); return checkAndDeletePB(table, row, column, value, null);
} }
@ -450,9 +456,10 @@ public class RowResourceBase {
throws IOException { throws IOException {
RowModel rowModel = new RowModel(row); RowModel rowModel = new RowModel(row);
if(cellsToDelete != null) { if (cellsToDelete != null) {
for (Map.Entry<String,String> entry :cellsToDelete.entrySet()) { for (Map.Entry<String,String> entry : cellsToDelete.entrySet()) {
rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()))); rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()),
Bytes.toBytes(entry.getValue())));
} }
} }
// Add this at the end // Add this at the end
@ -541,12 +548,12 @@ public class RowResourceBase {
} }
protected static void checkValueJSON(String table, String row, String column, protected static void checkValueJSON(String table, String row, String column,
String value) throws IOException, JAXBException { String value) throws IOException {
Response response = getValueJson(table, row, column); Response response = getValueJson(table, row, column);
assertEquals(200, response.getCode()); assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
ObjectMapper mapper = new JacksonJaxbJsonProvider() ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class,
.locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); MediaType.APPLICATION_JSON_TYPE);
CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class); CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class);
RowModel rowModel = cellSet.getRows().get(0); RowModel rowModel = cellSet.getRows().get(0);
CellModel cell = rowModel.getCells().get(0); CellModel cell = rowModel.getCells().get(0);
@ -555,7 +562,7 @@ public class RowResourceBase {
} }
protected static void checkIncrementValueJSON(String table, String row, String column, protected static void checkIncrementValueJSON(String table, String row, String column,
long value) throws IOException, JAXBException { long value) throws IOException {
Response response = getValueJson(table, row, column); Response response = getValueJson(table, row, column);
assertEquals(200, response.getCode()); assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
@ -569,7 +576,7 @@ public class RowResourceBase {
} }
protected static Response putValueJson(String table, String row, String column, protected static Response putValueJson(String table, String row, String column,
String value) throws IOException, JAXBException { String value) throws IOException {
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append('/'); path.append('/');
path.append(table); path.append(table);
@ -581,7 +588,7 @@ public class RowResourceBase {
} }
protected static Response putValueJson(String url, String table, String row, String column, protected static Response putValueJson(String url, String table, String row, String column,
String value) throws IOException, JAXBException { String value) throws IOException {
RowModel rowModel = new RowModel(row); RowModel rowModel = new RowModel(row);
rowModel.addCell(new CellModel(Bytes.toBytes(column), rowModel.addCell(new CellModel(Bytes.toBytes(column),
Bytes.toBytes(value))); Bytes.toBytes(value)));
@ -606,7 +613,7 @@ public class RowResourceBase {
} }
protected static Response appendValuePB(String table, String row, String column, protected static Response appendValuePB(String table, String row, String column,
String value) throws IOException, JAXBException { String value) throws IOException {
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append('/'); path.append('/');
path.append(table); path.append(table);
@ -639,7 +646,7 @@ public class RowResourceBase {
} }
protected static Response incrementValuePB(String table, String row, String column, protected static Response incrementValuePB(String table, String row, String column,
String value) throws IOException, JAXBException { String value) throws IOException {
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append('/'); path.append('/');
path.append(table); path.append(table);

View File

@ -21,13 +21,14 @@ import static org.junit.Assert.assertEquals;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller; import javax.xml.bind.Unmarshaller;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtility; import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
@ -46,8 +47,10 @@ import org.apache.hadoop.hbase.rest.model.RowModel;
import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RestTests; import org.apache.hadoop.hbase.testclassification.RestTests;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicHeader;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -59,7 +62,6 @@ import org.junit.runners.Parameterized;
@Category({RestTests.class, MediumTests.class}) @Category({RestTests.class, MediumTests.class})
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class TestMultiRowResource { public class TestMultiRowResource {
@ClassRule @ClassRule
public static final HBaseClassTestRule CLASS_RULE = public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMultiRowResource.class); HBaseClassTestRule.forClass(TestMultiRowResource.class);
@ -74,7 +76,6 @@ public class TestMultiRowResource {
private static final String ROW_2 = "testrow6"; private static final String ROW_2 = "testrow6";
private static final String VALUE_2 = "testvalue6"; private static final String VALUE_2 = "testvalue6";
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = new HBaseRESTTestingUtility(); private static final HBaseRESTTestingUtility REST_TEST_UTIL = new HBaseRESTTestingUtility();
@ -96,7 +97,6 @@ public class TestMultiRowResource {
csrfEnabled = csrf; csrfEnabled = csrf;
} }
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration(); conf = TEST_UTIL.getConfiguration();
@ -135,13 +135,11 @@ public class TestMultiRowResource {
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }
@Test @Test
public void testMultiCellGetJSON() throws IOException, JAXBException { public void testMultiCellGetJSON() throws IOException {
String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1; String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2; String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2;
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append("/"); path.append("/");
path.append(TABLE); path.append(TABLE);
@ -158,22 +156,19 @@ public class TestMultiRowResource {
client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr); client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr);
client.post(row_6_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_2), extraHdr); client.post(row_6_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_2), extraHdr);
Response response = client.get(path.toString(), Constants.MIMETYPE_JSON); Response response = client.get(path.toString(), Constants.MIMETYPE_JSON);
assertEquals(200, response.getCode()); assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
client.delete(row_5_url, extraHdr); client.delete(row_5_url, extraHdr);
client.delete(row_6_url, extraHdr); client.delete(row_6_url, extraHdr);
} }
@Test @Test
public void testMultiCellGetXML() throws IOException, JAXBException { public void testMultiCellGetXML() throws IOException {
String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1; String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2; String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2;
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
path.append("/"); path.append("/");
path.append(TABLE); path.append(TABLE);
@ -185,18 +180,16 @@ public class TestMultiRowResource {
client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr); client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr);
client.post(row_6_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_2), extraHdr); client.post(row_6_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_2), extraHdr);
Response response = client.get(path.toString(), Constants.MIMETYPE_XML); Response response = client.get(path.toString(), Constants.MIMETYPE_XML);
assertEquals(200, response.getCode()); assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type")); assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
client.delete(row_5_url, extraHdr); client.delete(row_5_url, extraHdr);
client.delete(row_6_url, extraHdr); client.delete(row_6_url, extraHdr);
} }
@Test @Test
public void testMultiCellGetWithColsJSON() throws IOException, JAXBException { public void testMultiCellGetWithColsJSON() throws IOException {
String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1; String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2; String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2;
@ -215,8 +208,8 @@ public class TestMultiRowResource {
Response response = client.get(path.toString(), Constants.MIMETYPE_JSON); Response response = client.get(path.toString(), Constants.MIMETYPE_JSON);
assertEquals(200, response.getCode()); assertEquals(200, response.getCode());
ObjectMapper mapper = ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class,
new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); MediaType.APPLICATION_JSON_TYPE);
CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class); CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class);
assertEquals(2, cellSet.getRows().size()); assertEquals(2, cellSet.getRows().size());
assertEquals(ROW_1, Bytes.toString(cellSet.getRows().get(0).getKey())); assertEquals(ROW_1, Bytes.toString(cellSet.getRows().get(0).getKey()));
@ -226,11 +219,10 @@ public class TestMultiRowResource {
client.delete(row_5_url, extraHdr); client.delete(row_5_url, extraHdr);
client.delete(row_6_url, extraHdr); client.delete(row_6_url, extraHdr);
} }
@Test @Test
public void testMultiCellGetJSONNotFound() throws IOException, JAXBException { public void testMultiCellGetJSONNotFound() throws IOException {
String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1; String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
StringBuilder path = new StringBuilder(); StringBuilder path = new StringBuilder();
@ -254,7 +246,7 @@ public class TestMultiRowResource {
} }
@Test @Test
public void testMultiCellGetWithColsInQueryPathJSON() throws IOException, JAXBException { public void testMultiCellGetWithColsInQueryPathJSON() throws IOException {
String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1; String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2; String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2;
@ -286,4 +278,3 @@ public class TestMultiRowResource {
client.delete(row_6_url, extraHdr); client.delete(row_6_url, extraHdr);
} }
} }

View File

@ -79,7 +79,6 @@ import org.slf4j.LoggerFactory;
@Category({RestTests.class, MediumTests.class}) @Category({RestTests.class, MediumTests.class})
public class TestScannersWithFilters { public class TestScannersWithFilters {
@ClassRule @ClassRule
public static final HBaseClassTestRule CLASS_RULE = public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestScannersWithFilters.class); HBaseClassTestRule.forClass(TestScannersWithFilters.class);
@ -88,31 +87,31 @@ public class TestScannersWithFilters {
private static final TableName TABLE = TableName.valueOf("TestScannersWithFilters"); private static final TableName TABLE = TableName.valueOf("TestScannersWithFilters");
private static final byte [][] ROWS_ONE = { private static final byte[][] ROWS_ONE = {
Bytes.toBytes("testRowOne-0"), Bytes.toBytes("testRowOne-1"), Bytes.toBytes("testRowOne-0"), Bytes.toBytes("testRowOne-1"),
Bytes.toBytes("testRowOne-2"), Bytes.toBytes("testRowOne-3") Bytes.toBytes("testRowOne-2"), Bytes.toBytes("testRowOne-3")
}; };
private static final byte [][] ROWS_TWO = { private static final byte[][] ROWS_TWO = {
Bytes.toBytes("testRowTwo-0"), Bytes.toBytes("testRowTwo-1"), Bytes.toBytes("testRowTwo-0"), Bytes.toBytes("testRowTwo-1"),
Bytes.toBytes("testRowTwo-2"), Bytes.toBytes("testRowTwo-3") Bytes.toBytes("testRowTwo-2"), Bytes.toBytes("testRowTwo-3")
}; };
private static final byte [][] FAMILIES = { private static final byte[][] FAMILIES = {
Bytes.toBytes("testFamilyOne"), Bytes.toBytes("testFamilyTwo") Bytes.toBytes("testFamilyOne"), Bytes.toBytes("testFamilyTwo")
}; };
private static final byte [][] QUALIFIERS_ONE = { private static final byte[][] QUALIFIERS_ONE = {
Bytes.toBytes("testQualifierOne-0"), Bytes.toBytes("testQualifierOne-1"), Bytes.toBytes("testQualifierOne-0"), Bytes.toBytes("testQualifierOne-1"),
Bytes.toBytes("testQualifierOne-2"), Bytes.toBytes("testQualifierOne-3") Bytes.toBytes("testQualifierOne-2"), Bytes.toBytes("testQualifierOne-3")
}; };
private static final byte [][] QUALIFIERS_TWO = { private static final byte[][] QUALIFIERS_TWO = {
Bytes.toBytes("testQualifierTwo-0"), Bytes.toBytes("testQualifierTwo-1"), Bytes.toBytes("testQualifierTwo-0"), Bytes.toBytes("testQualifierTwo-1"),
Bytes.toBytes("testQualifierTwo-2"), Bytes.toBytes("testQualifierTwo-3") Bytes.toBytes("testQualifierTwo-2"), Bytes.toBytes("testQualifierTwo-3")
}; };
private static final byte [][] VALUES = { private static final byte[][] VALUES = {
Bytes.toBytes("testValueOne"), Bytes.toBytes("testValueTwo") Bytes.toBytes("testValueOne"), Bytes.toBytes("testValueTwo")
}; };
@ -147,49 +146,49 @@ public class TestScannersWithFilters {
admin.createTable(htd); admin.createTable(htd);
Table table = TEST_UTIL.getConnection().getTable(TABLE); Table table = TEST_UTIL.getConnection().getTable(TABLE);
// Insert first half // Insert first half
for(byte [] ROW : ROWS_ONE) { for (byte[] ROW : ROWS_ONE) {
Put p = new Put(ROW); Put p = new Put(ROW);
p.setDurability(Durability.SKIP_WAL); p.setDurability(Durability.SKIP_WAL);
for(byte [] QUALIFIER : QUALIFIERS_ONE) { for (byte[] QUALIFIER : QUALIFIERS_ONE) {
p.addColumn(FAMILIES[0], QUALIFIER, VALUES[0]); p.addColumn(FAMILIES[0], QUALIFIER, VALUES[0]);
} }
table.put(p); table.put(p);
} }
for(byte [] ROW : ROWS_TWO) { for (byte[] ROW : ROWS_TWO) {
Put p = new Put(ROW); Put p = new Put(ROW);
p.setDurability(Durability.SKIP_WAL); p.setDurability(Durability.SKIP_WAL);
for(byte [] QUALIFIER : QUALIFIERS_TWO) { for (byte[] QUALIFIER : QUALIFIERS_TWO) {
p.addColumn(FAMILIES[1], QUALIFIER, VALUES[1]); p.addColumn(FAMILIES[1], QUALIFIER, VALUES[1]);
} }
table.put(p); table.put(p);
} }
// Insert second half (reverse families) // Insert second half (reverse families)
for(byte [] ROW : ROWS_ONE) { for (byte[] ROW : ROWS_ONE) {
Put p = new Put(ROW); Put p = new Put(ROW);
p.setDurability(Durability.SKIP_WAL); p.setDurability(Durability.SKIP_WAL);
for(byte [] QUALIFIER : QUALIFIERS_ONE) { for (byte[] QUALIFIER : QUALIFIERS_ONE) {
p.addColumn(FAMILIES[1], QUALIFIER, VALUES[0]); p.addColumn(FAMILIES[1], QUALIFIER, VALUES[0]);
} }
table.put(p); table.put(p);
} }
for(byte [] ROW : ROWS_TWO) { for (byte[] ROW : ROWS_TWO) {
Put p = new Put(ROW); Put p = new Put(ROW);
p.setDurability(Durability.SKIP_WAL); p.setDurability(Durability.SKIP_WAL);
for(byte [] QUALIFIER : QUALIFIERS_TWO) { for (byte[] QUALIFIER : QUALIFIERS_TWO) {
p.addColumn(FAMILIES[0], QUALIFIER, VALUES[1]); p.addColumn(FAMILIES[0], QUALIFIER, VALUES[1]);
} }
table.put(p); table.put(p);
} }
// Delete the second qualifier from all rows and families // Delete the second qualifier from all rows and families
for(byte [] ROW : ROWS_ONE) { for (byte[] ROW : ROWS_ONE) {
Delete d = new Delete(ROW); Delete d = new Delete(ROW);
d.addColumns(FAMILIES[0], QUALIFIERS_ONE[1]); d.addColumns(FAMILIES[0], QUALIFIERS_ONE[1]);
d.addColumns(FAMILIES[1], QUALIFIERS_ONE[1]); d.addColumns(FAMILIES[1], QUALIFIERS_ONE[1]);
table.delete(d); table.delete(d);
} }
for(byte [] ROW : ROWS_TWO) { for (byte[] ROW : ROWS_TWO) {
Delete d = new Delete(ROW); Delete d = new Delete(ROW);
d.addColumns(FAMILIES[0], QUALIFIERS_TWO[1]); d.addColumns(FAMILIES[0], QUALIFIERS_TWO[1]);
d.addColumns(FAMILIES[1], QUALIFIERS_TWO[1]); d.addColumns(FAMILIES[1], QUALIFIERS_TWO[1]);
@ -198,13 +197,13 @@ public class TestScannersWithFilters {
colsPerRow -= 2; colsPerRow -= 2;
// Delete the second rows from both groups, one column at a time // Delete the second rows from both groups, one column at a time
for(byte [] QUALIFIER : QUALIFIERS_ONE) { for (byte[] QUALIFIER : QUALIFIERS_ONE) {
Delete d = new Delete(ROWS_ONE[1]); Delete d = new Delete(ROWS_ONE[1]);
d.addColumns(FAMILIES[0], QUALIFIER); d.addColumns(FAMILIES[0], QUALIFIER);
d.addColumns(FAMILIES[1], QUALIFIER); d.addColumns(FAMILIES[1], QUALIFIER);
table.delete(d); table.delete(d);
} }
for(byte [] QUALIFIER : QUALIFIERS_TWO) { for (byte[] QUALIFIER : QUALIFIERS_TWO) {
Delete d = new Delete(ROWS_TWO[1]); Delete d = new Delete(ROWS_TWO[1]);
d.addColumns(FAMILIES[0], QUALIFIER); d.addColumns(FAMILIES[0], QUALIFIER);
d.addColumns(FAMILIES[1], QUALIFIER); d.addColumns(FAMILIES[1], QUALIFIER);
@ -243,9 +242,9 @@ public class TestScannersWithFilters {
unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody())); unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
int rows = cells.getRows().size(); int rows = cells.getRows().size();
assertTrue("Scanned too many rows! Only expected " + expectedRows + assertEquals("Scanned too many rows! Only expected " + expectedRows +
" total but scanned " + rows, expectedRows == rows); " total but scanned " + rows, expectedRows, rows);
for (RowModel row: cells.getRows()) { for (RowModel row : cells.getRows()) {
int count = row.getCells().size(); int count = row.getCells().size();
assertEquals("Expected " + expectedKeys + " keys per row but " + assertEquals("Expected " + expectedKeys + " keys per row but " +
"returned " + count, expectedKeys, count); "returned " + count, expectedKeys, count);
@ -256,8 +255,7 @@ public class TestScannersWithFilters {
assertEquals(200, response.getCode()); assertEquals(200, response.getCode());
} }
private static void verifyScanFull(Scan s, KeyValue [] kvs) private static void verifyScanFull(Scan s, KeyValue [] kvs) throws Exception {
throws Exception {
ScannerModel model = ScannerModel.fromScan(s); ScannerModel model = ScannerModel.fromScan(s);
model.setBatch(Integer.MAX_VALUE); // fetch it all at once model.setBatch(Integer.MAX_VALUE); // fetch it all at once
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
@ -286,10 +284,16 @@ public class TestScannersWithFilters {
Iterator<RowModel> i = cellSet.getRows().iterator(); Iterator<RowModel> i = cellSet.getRows().iterator();
for (boolean done = true; done; row++) { for (boolean done = true; done; row++) {
done = i.hasNext(); done = i.hasNext();
if (!done) break; if (!done) {
break;
}
RowModel rowModel = i.next(); RowModel rowModel = i.next();
List<CellModel> cells = rowModel.getCells(); List<CellModel> cells = rowModel.getCells();
if (cells.isEmpty()) break; if (cells.isEmpty()) {
break;
}
assertTrue("Scanned too many keys! Only expected " + kvs.length + assertTrue("Scanned too many keys! Only expected " + kvs.length +
" total but already scanned " + (cells.size() + idx), " total but already scanned " + (cells.size() + idx),
kvs.length >= idx + cells.size()); kvs.length >= idx + cells.size());
@ -339,10 +343,16 @@ public class TestScannersWithFilters {
int j = 0; int j = 0;
for (boolean done = true; done; j++) { for (boolean done = true; done; j++) {
done = i.hasNext(); done = i.hasNext();
if (!done) break; if (!done) {
break;
}
RowModel rowModel = i.next(); RowModel rowModel = i.next();
List<CellModel> cells = rowModel.getCells(); List<CellModel> cells = rowModel.getCells();
if (cells.isEmpty()) break; if (cells.isEmpty()) {
break;
}
assertTrue("Scanned too many rows! Only expected " + expectedRows + assertTrue("Scanned too many rows! Only expected " + expectedRows +
" total but already scanned " + (j+1), expectedRows > j); " total but already scanned " + (j+1), expectedRows > j);
assertEquals("Expected " + expectedKeys + " keys per row but " + assertEquals("Expected " + expectedKeys + " keys per row but " +
@ -517,8 +527,7 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
verifyScanNoEarlyOut(s, expectedRows, expectedKeys); verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
// Match keys less than or equal // Match keys less than or equal. Expect four keys (two from each family) in half the rows
// Expect four keys (two from each family) in half the rows
expectedRows = numRows / 2; expectedRows = numRows / 2;
expectedKeys = 4; expectedKeys = 4;
f = new QualifierFilter(CompareOperator.LESS_OR_EQUAL, f = new QualifierFilter(CompareOperator.LESS_OR_EQUAL,
@ -527,8 +536,7 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
verifyScanNoEarlyOut(s, expectedRows, expectedKeys); verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
// Match keys not equal // Match keys not equal. Expect four keys (two from each family)
// Expect four keys (two from each family)
// Only look in first group of rows // Only look in first group of rows
expectedRows = numRows / 2; expectedRows = numRows / 2;
expectedKeys = 4; expectedKeys = 4;
@ -538,8 +546,7 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
verifyScanNoEarlyOut(s, expectedRows, expectedKeys); verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
// Match keys greater or equal // Match keys greater or equal. Expect four keys (two from each family)
// Expect four keys (two from each family)
// Only look in first group of rows // Only look in first group of rows
expectedRows = numRows / 2; expectedRows = numRows / 2;
expectedKeys = 4; expectedKeys = 4;
@ -549,8 +556,7 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
verifyScanNoEarlyOut(s, expectedRows, expectedKeys); verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
// Match keys greater // Match keys greater. Expect two keys (one from each family)
// Expect two keys (one from each family)
// Only look in first group of rows // Only look in first group of rows
expectedRows = numRows / 2; expectedRows = numRows / 2;
expectedKeys = 2; expectedKeys = 2;
@ -560,57 +566,54 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
verifyScanNoEarlyOut(s, expectedRows, expectedKeys); verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
// Match keys not equal to // Match keys not equal to. Look across rows and fully validate the keys and ordering
// Look across rows and fully validate the keys and ordering // Expect varied numbers of keys, 4 per row in group one, 6 per row in group two
// Expect varied numbers of keys, 4 per row in group one, 6 per row in
// group two
f = new QualifierFilter(CompareOperator.NOT_EQUAL, f = new QualifierFilter(CompareOperator.NOT_EQUAL,
new BinaryComparator(QUALIFIERS_ONE[2])); new BinaryComparator(QUALIFIERS_ONE[2]));
s = new Scan(); s = new Scan();
s.setFilter(f); s.setFilter(f);
KeyValue [] kvs = { KeyValue [] kvs = {
// testRowOne-0 // testRowOne-0
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowOne-2 // testRowOne-2
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowOne-3 // testRowOne-3
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowTwo-0 // testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2 // testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3 // testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
// Test across rows and groups with a regex // Test across rows and groups with a regex. Filter out "test*-2"
// Filter out "test*-2"
// Expect 4 keys per row across both groups // Expect 4 keys per row across both groups
f = new QualifierFilter(CompareOperator.NOT_EQUAL, f = new QualifierFilter(CompareOperator.NOT_EQUAL,
new RegexStringComparator("test.+-2")); new RegexStringComparator("test.+-2"));
@ -618,36 +621,36 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
kvs = new KeyValue [] { kvs = new KeyValue [] {
// testRowOne-0 // testRowOne-0
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowOne-2 // testRowOne-2
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowOne-3 // testRowOne-3
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowTwo-0 // testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2 // testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3 // testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
} }
@ -731,41 +734,41 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
KeyValue [] kvs = { KeyValue [] kvs = {
// testRowOne-0 // testRowOne-0
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[2], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[2], VALUES[0]),
new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowOne-3 // testRowOne-3
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[2], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[2], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowTwo-0 // testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2 // testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3 // testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
@ -778,20 +781,20 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
kvs = new KeyValue [] { kvs = new KeyValue [] {
// testRowOne-2 // testRowOne-2
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[3], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[2], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[2], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[1], QUALIFIERS_ONE[3], VALUES[0]),
// testRowTwo-2 // testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]) new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1])
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
} }
@ -894,27 +897,27 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
KeyValue [] kvs = { KeyValue [] kvs = {
// testRowTwo-0 // testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2 // testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3 // testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
} }
@ -929,27 +932,27 @@ public class TestScannersWithFilters {
s.setFilter(f); s.setFilter(f);
KeyValue [] kvs = { KeyValue [] kvs = {
// testRowTwo-0 // testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2 // testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3 // testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]), new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
} }
@ -971,7 +974,7 @@ public class TestScannersWithFilters {
s.addFamily(FAMILIES[0]); s.addFamily(FAMILIES[0]);
s.setFilter(f); s.setFilter(f);
KeyValue [] kvs = { KeyValue [] kvs = {
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0]) new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0])
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
@ -996,12 +999,12 @@ public class TestScannersWithFilters {
s.setFilter(new FirstKeyOnlyFilter()); s.setFilter(new FirstKeyOnlyFilter());
// Expected KVs, the first KV from each of the remaining 6 rows // Expected KVs, the first KV from each of the remaining 6 rows
KeyValue [] kvs = { KeyValue [] kvs = {
new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[0], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]), new KeyValue(ROWS_ONE[3], FAMILIES[0], QUALIFIERS_ONE[0], VALUES[0]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]), new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]) new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1])
}; };
verifyScanFull(s, kvs); verifyScanFull(s, kvs);
} }