You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2016/11/29 14:01:47 UTC
[2/6] accumulo git commit: ACCUMULO-4525: replace meaningless method
names
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
index 33c398f..d0802f0 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
@@ -34,16 +34,16 @@ public class ColumnFamilySkippingIteratorTest extends TestCase {
private static final Collection<ByteSequence> EMPTY_SET = new HashSet<>();
- Key nk(String row, String cf, String cq, long time) {
+ Key newKey(String row, String cf, String cq, long time) {
return new Key(new Text(row), new Text(cf), new Text(cq), time);
}
- Key nk(int row, int cf, int cq, long time) {
- return nk(String.format("%06d", row), String.format("%06d", cf), String.format("%06d", cq), time);
+ Key newKey(int row, int cf, int cq, long time) {
+ return newKey(String.format("%06d", row), String.format("%06d", cf), String.format("%06d", cq), time);
}
void put(TreeMap<Key,Value> tm, String row, String cf, String cq, long time, Value val) {
- tm.put(nk(row, cf, cq, time), val);
+ tm.put(newKey(row, cf, cq, time), val);
}
void put(TreeMap<Key,Value> tm, String row, String cf, String cq, long time, String val) {
@@ -51,12 +51,12 @@ public class ColumnFamilySkippingIteratorTest extends TestCase {
}
void put(TreeMap<Key,Value> tm, int row, int cf, int cq, long time, int val) {
- tm.put(nk(row, cf, cq, time), new Value((val + "").getBytes()));
+ tm.put(newKey(row, cf, cq, time), new Value((val + "").getBytes()));
}
- private void aten(ColumnFamilySkippingIterator rdi, String row, String cf, String cq, long time, String val) throws Exception {
+ private void testAndCallnext(ColumnFamilySkippingIterator rdi, String row, String cf, String cq, long time, String val) throws Exception {
assertTrue(rdi.hasTop());
- assertEquals(nk(row, cf, cq, time), rdi.getTopKey());
+ assertEquals(newKey(row, cf, cq, time), rdi.getTopKey());
assertEquals(val, rdi.getTopValue().toString());
rdi.next();
}
@@ -87,22 +87,22 @@ public class ColumnFamilySkippingIteratorTest extends TestCase {
HashSet<ByteSequence> colfams = new HashSet<>();
colfams.add(new ArrayByteSequence("cf2"));
cfi.seek(new Range(), colfams, true);
- aten(cfi, "r2", "cf2", "cq4", 5, "v4");
- aten(cfi, "r2", "cf2", "cq5", 5, "v5");
+ testAndCallnext(cfi, "r2", "cf2", "cq4", 5, "v4");
+ testAndCallnext(cfi, "r2", "cf2", "cq5", 5, "v5");
assertFalse(cfi.hasTop());
colfams.add(new ArrayByteSequence("cf3"));
colfams.add(new ArrayByteSequence("cf4"));
cfi.seek(new Range(), colfams, true);
- aten(cfi, "r2", "cf2", "cq4", 5, "v4");
- aten(cfi, "r2", "cf2", "cq5", 5, "v5");
- aten(cfi, "r3", "cf3", "cq6", 5, "v6");
+ testAndCallnext(cfi, "r2", "cf2", "cq4", 5, "v4");
+ testAndCallnext(cfi, "r2", "cf2", "cq5", 5, "v5");
+ testAndCallnext(cfi, "r3", "cf3", "cq6", 5, "v6");
assertFalse(cfi.hasTop());
cfi.seek(new Range(), colfams, false);
- aten(cfi, "r1", "cf1", "cq1", 5, "v1");
- aten(cfi, "r1", "cf1", "cq3", 5, "v2");
- aten(cfi, "r2", "cf1", "cq1", 5, "v3");
+ testAndCallnext(cfi, "r1", "cf1", "cq1", 5, "v1");
+ testAndCallnext(cfi, "r1", "cf1", "cq3", 5, "v2");
+ testAndCallnext(cfi, "r2", "cf1", "cq1", 5, "v3");
assertFalse(cfi.hasTop());
}
@@ -204,11 +204,11 @@ public class ColumnFamilySkippingIteratorTest extends TestCase {
HashSet<ByteSequence> colfams = new HashSet<>();
colfams.add(new ArrayByteSequence(String.format("%06d", 4)));
- Range range = new Range(nk(0, 4, 0, 6), true, nk(0, 400, 0, 6), true);
+ Range range = new Range(newKey(0, 4, 0, 6), true, newKey(0, 400, 0, 6), true);
cfi.seek(range, colfams, true);
assertTrue(cfi.hasTop());
- assertEquals(nk(0, 4, 0, 6), cfi.getTopKey());
+ assertEquals(newKey(0, 4, 0, 6), cfi.getTopKey());
cfi.next();
assertFalse(cfi.hasTop());
@@ -216,21 +216,21 @@ public class ColumnFamilySkippingIteratorTest extends TestCase {
cfi.seek(range, colfams, true);
assertTrue(cfi.hasTop());
- assertEquals(nk(0, 4, 0, 6), cfi.getTopKey());
+ assertEquals(newKey(0, 4, 0, 6), cfi.getTopKey());
cfi.next();
assertFalse(cfi.hasTop());
- range = new Range(nk(0, 4, 0, 6), true, nk(1, 400, 0, 6), true);
+ range = new Range(newKey(0, 4, 0, 6), true, newKey(1, 400, 0, 6), true);
cfi.seek(range, colfams, true);
assertTrue(cfi.hasTop());
- assertEquals(nk(0, 4, 0, 6), cfi.getTopKey());
+ assertEquals(newKey(0, 4, 0, 6), cfi.getTopKey());
cfi.next();
assertTrue(cfi.hasTop());
- assertEquals(nk(0, 500, 0, 6), cfi.getTopKey());
+ assertEquals(newKey(0, 500, 0, 6), cfi.getTopKey());
cfi.next();
assertTrue(cfi.hasTop());
- assertEquals(nk(1, 4, 0, 6), cfi.getTopKey());
+ assertEquals(newKey(1, 4, 0, 6), cfi.getTopKey());
cfi.next();
assertFalse(cfi.hasTop());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
index cfed90f..6158476 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
@@ -27,52 +27,52 @@ import org.apache.hadoop.io.Text;
public class ColumnFilterTest extends TestCase {
- Key nk(String row, String cf, String cq) {
+ Key newKey(String row, String cf, String cq) {
return new Key(new Text(row), new Text(cf), new Text(cq));
}
- Column nc(String cf) {
+ Column newColumn(String cf) {
return new Column(cf.getBytes(), null, null);
}
- Column nc(String cf, String cq) {
+ Column newColumn(String cf, String cq) {
return new Column(cf.getBytes(), cq.getBytes(), null);
}
public void test1() {
HashSet<Column> columns = new HashSet<>();
- columns.add(nc("cf1"));
+ columns.add(newColumn("cf1"));
ColumnQualifierFilter cf = new ColumnQualifierFilter(null, columns);
- assertTrue(cf.accept(nk("r1", "cf1", "cq1"), new Value(new byte[0])));
- assertTrue(cf.accept(nk("r1", "cf2", "cq1"), new Value(new byte[0])));
+ assertTrue(cf.accept(newKey("r1", "cf1", "cq1"), new Value(new byte[0])));
+ assertTrue(cf.accept(newKey("r1", "cf2", "cq1"), new Value(new byte[0])));
}
public void test2() {
HashSet<Column> columns = new HashSet<>();
- columns.add(nc("cf1"));
- columns.add(nc("cf2", "cq1"));
+ columns.add(newColumn("cf1"));
+ columns.add(newColumn("cf2", "cq1"));
ColumnQualifierFilter cf = new ColumnQualifierFilter(null, columns);
- assertTrue(cf.accept(nk("r1", "cf1", "cq1"), new Value(new byte[0])));
- assertTrue(cf.accept(nk("r1", "cf2", "cq1"), new Value(new byte[0])));
- assertFalse(cf.accept(nk("r1", "cf2", "cq2"), new Value(new byte[0])));
+ assertTrue(cf.accept(newKey("r1", "cf1", "cq1"), new Value(new byte[0])));
+ assertTrue(cf.accept(newKey("r1", "cf2", "cq1"), new Value(new byte[0])));
+ assertFalse(cf.accept(newKey("r1", "cf2", "cq2"), new Value(new byte[0])));
}
public void test3() {
HashSet<Column> columns = new HashSet<>();
- columns.add(nc("cf2", "cq1"));
+ columns.add(newColumn("cf2", "cq1"));
ColumnQualifierFilter cf = new ColumnQualifierFilter(null, columns);
- assertFalse(cf.accept(nk("r1", "cf1", "cq1"), new Value(new byte[0])));
- assertTrue(cf.accept(nk("r1", "cf2", "cq1"), new Value(new byte[0])));
- assertFalse(cf.accept(nk("r1", "cf2", "cq2"), new Value(new byte[0])));
+ assertFalse(cf.accept(newKey("r1", "cf1", "cq1"), new Value(new byte[0])));
+ assertTrue(cf.accept(newKey("r1", "cf2", "cq1"), new Value(new byte[0])));
+ assertFalse(cf.accept(newKey("r1", "cf2", "cq2"), new Value(new byte[0])));
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
index 9082a36..85131f0 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
@@ -117,24 +117,24 @@ public class DeletingIteratorTest extends TestCase {
public void test2() throws IOException {
TreeMap<Key,Value> tm = new TreeMap<>();
- nkv(tm, "r000", 4, false, "v4");
- nkv(tm, "r000", 3, false, "v3");
- nkv(tm, "r000", 2, true, "v2");
- nkv(tm, "r000", 1, false, "v1");
+ newKeyValue(tm, "r000", 4, false, "v4");
+ newKeyValue(tm, "r000", 3, false, "v3");
+ newKeyValue(tm, "r000", 2, true, "v2");
+ newKeyValue(tm, "r000", 1, false, "v1");
DeletingIterator it = new DeletingIterator(new SortedMapIterator(tm), false);
// SEEK two keys before delete
- it.seek(nr("r000", 4), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 4), EMPTY_COL_FAMS, false);
assertTrue(it.hasTop());
- assertEquals(nk("r000", 4), it.getTopKey());
+ assertEquals(newKey("r000", 4), it.getTopKey());
assertEquals("v4", it.getTopValue().toString());
it.next();
assertTrue(it.hasTop());
- assertEquals(nk("r000", 3), it.getTopKey());
+ assertEquals(newKey("r000", 3), it.getTopKey());
assertEquals("v3", it.getTopValue().toString());
it.next();
@@ -142,20 +142,20 @@ public class DeletingIteratorTest extends TestCase {
assertFalse(it.hasTop());
// SEEK passed delete
- it.seek(nr("r000", 1), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 1), EMPTY_COL_FAMS, false);
assertFalse(it.hasTop());
// SEEK to delete
- it.seek(nr("r000", 2), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 2), EMPTY_COL_FAMS, false);
assertFalse(it.hasTop());
// SEEK right before delete
- it.seek(nr("r000", 3), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 3), EMPTY_COL_FAMS, false);
assertTrue(it.hasTop());
- assertEquals(nk("r000", 3), it.getTopKey());
+ assertEquals(newKey("r000", 3), it.getTopKey());
assertEquals("v3", it.getTopValue().toString());
it.next();
@@ -167,23 +167,23 @@ public class DeletingIteratorTest extends TestCase {
public void test3() throws IOException {
TreeMap<Key,Value> tm = new TreeMap<>();
- nkv(tm, "r000", 3, false, "v3");
- nkv(tm, "r000", 2, false, "v2");
- nkv(tm, "r000", 2, true, "");
- nkv(tm, "r000", 1, false, "v1");
+ newKeyValue(tm, "r000", 3, false, "v3");
+ newKeyValue(tm, "r000", 2, false, "v2");
+ newKeyValue(tm, "r000", 2, true, "");
+ newKeyValue(tm, "r000", 1, false, "v1");
DeletingIterator it = new DeletingIterator(new SortedMapIterator(tm), false);
it.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(it.hasTop());
- assertEquals(nk("r000", 3), it.getTopKey());
+ assertEquals(newKey("r000", 3), it.getTopKey());
assertEquals("v3", it.getTopValue().toString());
it.next();
assertFalse(it.hasTop());
- it.seek(nr("r000", 2), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 2), EMPTY_COL_FAMS, false);
assertFalse(it.hasTop());
}
@@ -192,42 +192,42 @@ public class DeletingIteratorTest extends TestCase {
public void test4() throws IOException {
TreeMap<Key,Value> tm = new TreeMap<>();
- nkv(tm, "r000", 3, false, "v3");
- nkv(tm, "r000", 2, false, "v2");
- nkv(tm, "r000", 2, true, "");
- nkv(tm, "r000", 1, false, "v1");
+ newKeyValue(tm, "r000", 3, false, "v3");
+ newKeyValue(tm, "r000", 2, false, "v2");
+ newKeyValue(tm, "r000", 2, true, "");
+ newKeyValue(tm, "r000", 1, false, "v1");
DeletingIterator it = new DeletingIterator(new SortedMapIterator(tm), false);
- it.seek(nr("r000", 3), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 3), EMPTY_COL_FAMS, false);
assertTrue(it.hasTop());
- assertEquals(nk("r000", 3), it.getTopKey());
+ assertEquals(newKey("r000", 3), it.getTopKey());
assertEquals("v3", it.getTopValue().toString());
it.next();
assertFalse(it.hasTop());
- it.seek(nr("r000", 3, false), EMPTY_COL_FAMS, false);
+ it.seek(newRange("r000", 3, false), EMPTY_COL_FAMS, false);
assertFalse(it.hasTop());
}
- private Range nr(String row, long ts, boolean inclusive) {
- return new Range(nk(row, ts), inclusive, null, true);
+ private Range newRange(String row, long ts, boolean inclusive) {
+ return new Range(newKey(row, ts), inclusive, null, true);
}
- private Range nr(String row, long ts) {
- return nr(row, ts, true);
+ private Range newRange(String row, long ts) {
+ return newRange(row, ts, true);
}
- private Key nk(String row, long ts) {
+ private Key newKey(String row, long ts) {
return new Key(new Text(row), ts);
}
- private void nkv(TreeMap<Key,Value> tm, String row, long ts, boolean deleted, String val) {
- Key k = nk(row, ts);
+ private void newKeyValue(TreeMap<Key,Value> tm, String row, long ts, boolean deleted, String val) {
+ Key k = newKey(row, ts);
k.setDeleted(deleted);
tm.put(k, new Value(val.getBytes()));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
index f257690..d599674 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
@@ -38,21 +38,21 @@ public class MultiIteratorTest extends TestCase {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<>();
- public static Key nk(int row, long ts) {
- return new Key(nr(row), ts);
+ public static Key newKey(int row, long ts) {
+ return new Key(newRow(row), ts);
}
- public static Range nrng(int row, long ts) {
- return new Range(nk(row, ts), null);
+ public static Range newRange(int row, long ts) {
+ return new Range(newKey(row, ts), null);
}
- public static void nkv(TreeMap<Key,Value> tm, int row, long ts, boolean deleted, String val) {
- Key k = nk(row, ts);
+ public static void newKeyValue(TreeMap<Key,Value> tm, int row, long ts, boolean deleted, String val) {
+ Key k = newKey(row, ts);
k.setDeleted(deleted);
tm.put(k, new Value(val.getBytes()));
}
- public static Text nr(int row) {
+ public static Text newRow(int row) {
return new Text(String.format("r%03d", row));
}
@@ -85,9 +85,9 @@ public class MultiIteratorTest extends TestCase {
int i = start;
while (mi.hasTop()) {
if (incrRow)
- assertEquals(nk(i, 0), mi.getTopKey());
+ assertEquals(newKey(i, 0), mi.getTopKey());
else
- assertEquals(nk(0, i), mi.getTopKey());
+ assertEquals(newKey(0, i), mi.getTopKey());
assertEquals("v" + i, mi.getTopValue().toString());
@@ -125,19 +125,19 @@ public class MultiIteratorTest extends TestCase {
List<TreeMap<Key,Value>> tmpList = new ArrayList<>(2);
for (int i = 0; i < 4; i++) {
- nkv(tm1, 0, i, false, "v" + i);
+ newKeyValue(tm1, 0, i, false, "v" + i);
}
tmpList.add(tm1);
tm1 = new TreeMap<>();
for (int i = 4; i < 8; i++) {
- nkv(tm1, 0, i, false, "v" + i);
+ newKeyValue(tm1, 0, i, false, "v" + i);
}
tmpList.add(tm1);
for (int seek = -1; seek < 8; seek++) {
if (seek == 7) {
verify(seek, null, tmpList);
}
- verify(seek, nk(0, seek), tmpList);
+ verify(seek, newKey(0, seek), tmpList);
}
}
@@ -150,9 +150,9 @@ public class MultiIteratorTest extends TestCase {
for (int i = 0; i < 8; i++) {
if (i % 2 == 0)
- nkv(tm1, 0, i, false, "v" + i);
+ newKeyValue(tm1, 0, i, false, "v" + i);
else
- nkv(tm2, 0, i, false, "v" + i);
+ newKeyValue(tm2, 0, i, false, "v" + i);
}
tmpList.add(tm1);
tmpList.add(tm2);
@@ -160,7 +160,7 @@ public class MultiIteratorTest extends TestCase {
if (seek == 7) {
verify(seek, null, tmpList);
}
- verify(seek, nk(0, seek), tmpList);
+ verify(seek, newKey(0, seek), tmpList);
}
}
@@ -171,7 +171,7 @@ public class MultiIteratorTest extends TestCase {
List<TreeMap<Key,Value>> tmpList = new ArrayList<>(2);
for (int i = 0; i < 8; i++) {
- nkv(tm1, 0, i, false, "v" + i);
+ newKeyValue(tm1, 0, i, false, "v" + i);
}
tmpList.add(tm1);
@@ -179,7 +179,7 @@ public class MultiIteratorTest extends TestCase {
if (seek == 7) {
verify(seek, null, tmpList);
}
- verify(seek, nk(0, seek), tmpList);
+ verify(seek, newKey(0, seek), tmpList);
}
}
@@ -194,7 +194,7 @@ public class MultiIteratorTest extends TestCase {
assertFalse(mi.hasTop());
- mi.seek(nrng(0, 6), EMPTY_COL_FAMS, false);
+ mi.seek(newRange(0, 6), EMPTY_COL_FAMS, false);
assertFalse(mi.hasTop());
}
@@ -207,16 +207,16 @@ public class MultiIteratorTest extends TestCase {
for (int i = 0; i < 8; i++) {
if (i % 2 == 0)
- nkv(tm1, i, 0, false, "v" + i);
+ newKeyValue(tm1, i, 0, false, "v" + i);
else
- nkv(tm2, i, 0, false, "v" + i);
+ newKeyValue(tm2, i, 0, false, "v" + i);
}
tmpList.add(tm1);
tmpList.add(tm2);
for (int seek = -1; seek < 9; seek++) {
- verify(Math.max(0, seek), 8, nk(seek, 0), null, null, true, true, tmpList);
- verify(Math.max(0, seek), 8, nk(seek, 0), null, null, false, true, tmpList);
+ verify(Math.max(0, seek), 8, newKey(seek, 0), null, null, true, true, tmpList);
+ verify(Math.max(0, seek), 8, newKey(seek, 0), null, null, false, true, tmpList);
for (int er = seek; er < 10; er++) {
@@ -227,9 +227,9 @@ public class MultiIteratorTest extends TestCase {
noSeekEnd = 0;
}
- verify(0, noSeekEnd, null, nr(er), null, true, true, tmpList);
- verify(Math.max(0, seek), end, nk(seek, 0), nr(er), null, true, true, tmpList);
- verify(Math.max(0, seek), end, nk(seek, 0), nr(er), null, false, true, tmpList);
+ verify(0, noSeekEnd, null, newRow(er), null, true, true, tmpList);
+ verify(Math.max(0, seek), end, newKey(seek, 0), newRow(er), null, true, true, tmpList);
+ verify(Math.max(0, seek), end, newKey(seek, 0), newRow(er), null, false, true, tmpList);
for (int per = -1; per < er; per++) {
@@ -247,9 +247,9 @@ public class MultiIteratorTest extends TestCase {
noSeekEnd = noSeekStart;
}
- verify(noSeekStart, noSeekEnd, null, nr(er), nr(per), true, true, tmpList);
- verify(Math.max(0, start), end, nk(seek, 0), nr(er), nr(per), true, true, tmpList);
- verify(Math.max(0, start), end, nk(seek, 0), nr(er), nr(per), false, true, tmpList);
+ verify(noSeekStart, noSeekEnd, null, newRow(er), newRow(per), true, true, tmpList);
+ verify(Math.max(0, start), end, newKey(seek, 0), newRow(er), newRow(per), true, true, tmpList);
+ verify(Math.max(0, start), end, newKey(seek, 0), newRow(er), newRow(per), false, true, tmpList);
}
}
}
@@ -258,70 +258,70 @@ public class MultiIteratorTest extends TestCase {
public void test6() throws IOException {
// TEst setting an endKey
TreeMap<Key,Value> tm1 = new TreeMap<>();
- nkv(tm1, 3, 0, false, "1");
- nkv(tm1, 4, 0, false, "2");
- nkv(tm1, 6, 0, false, "3");
+ newKeyValue(tm1, 3, 0, false, "1");
+ newKeyValue(tm1, 4, 0, false, "2");
+ newKeyValue(tm1, 6, 0, false, "3");
List<SortedKeyValueIterator<Key,Value>> skvil = new ArrayList<>(1);
skvil.add(new SortedMapIterator(tm1));
MultiIterator mi = new MultiIterator(skvil, true);
- mi.seek(new Range(null, true, nk(5, 9), false), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(null, true, newKey(5, 9), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(3, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(3, 0)));
assertTrue(mi.getTopValue().toString().equals("1"));
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(4, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(4, 0)));
assertTrue(mi.getTopValue().toString().equals("2"));
mi.next();
assertFalse(mi.hasTop());
- mi.seek(new Range(nk(4, 10), true, nk(5, 9), false), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(newKey(4, 10), true, newKey(5, 9), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(4, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(4, 0)));
assertTrue(mi.getTopValue().toString().equals("2"));
mi.next();
assertFalse(mi.hasTop());
- mi.seek(new Range(nk(4, 10), true, nk(6, 0), false), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(newKey(4, 10), true, newKey(6, 0), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(4, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(4, 0)));
assertTrue(mi.getTopValue().toString().equals("2"));
mi.next();
assertFalse(mi.hasTop());
- mi.seek(new Range(nk(4, 10), true, nk(6, 0), true), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(newKey(4, 10), true, newKey(6, 0), true), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(4, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(4, 0)));
assertTrue(mi.getTopValue().toString().equals("2"));
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(6, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(6, 0)));
assertTrue(mi.getTopValue().toString().equals("3"));
mi.next();
assertFalse(mi.hasTop());
- mi.seek(new Range(nk(4, 0), true, nk(6, 0), false), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(newKey(4, 0), true, newKey(6, 0), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(4, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(4, 0)));
assertTrue(mi.getTopValue().toString().equals("2"));
mi.next();
assertFalse(mi.hasTop());
- mi.seek(new Range(nk(4, 0), false, nk(6, 0), false), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(newKey(4, 0), false, newKey(6, 0), false), EMPTY_COL_FAMS, false);
assertFalse(mi.hasTop());
- mi.seek(new Range(nk(4, 0), false, nk(6, 0), true), EMPTY_COL_FAMS, false);
+ mi.seek(new Range(newKey(4, 0), false, newKey(6, 0), true), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(nk(6, 0)));
+ assertTrue(mi.getTopKey().equals(newKey(6, 0)));
assertTrue(mi.getTopValue().toString().equals("3"));
mi.next();
assertFalse(mi.hasTop());
@@ -331,20 +331,20 @@ public class MultiIteratorTest extends TestCase {
public void test7() throws IOException {
// TEst setting an endKey
TreeMap<Key,Value> tm1 = new TreeMap<>();
- nkv(tm1, 0, 3, false, "1");
- nkv(tm1, 0, 2, false, "2");
- nkv(tm1, 0, 1, false, "3");
- nkv(tm1, 0, 0, false, "4");
- nkv(tm1, 1, 2, false, "5");
- nkv(tm1, 1, 1, false, "6");
- nkv(tm1, 1, 0, false, "7");
- nkv(tm1, 2, 1, false, "8");
- nkv(tm1, 2, 0, false, "9");
+ newKeyValue(tm1, 0, 3, false, "1");
+ newKeyValue(tm1, 0, 2, false, "2");
+ newKeyValue(tm1, 0, 1, false, "3");
+ newKeyValue(tm1, 0, 0, false, "4");
+ newKeyValue(tm1, 1, 2, false, "5");
+ newKeyValue(tm1, 1, 1, false, "6");
+ newKeyValue(tm1, 1, 0, false, "7");
+ newKeyValue(tm1, 2, 1, false, "8");
+ newKeyValue(tm1, 2, 0, false, "9");
List<SortedKeyValueIterator<Key,Value>> skvil = new ArrayList<>(1);
skvil.add(new SortedMapIterator(tm1));
- KeyExtent extent = new KeyExtent(new Text("tablename"), nr(1), nr(0));
+ KeyExtent extent = new KeyExtent(new Text("tablename"), newRow(1), newRow(0));
MultiIterator mi = new MultiIterator(skvil, extent);
Range r1 = new Range((Text) null, (Text) null);
@@ -360,7 +360,7 @@ public class MultiIteratorTest extends TestCase {
mi.next();
assertFalse(mi.hasTop());
- Range r2 = new Range(nk(0, 0), true, nk(1, 1), true);
+ Range r2 = new Range(newKey(0, 0), true, newKey(1, 1), true);
mi.seek(r2, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
assertTrue(mi.getTopValue().toString().equals("5"));
@@ -370,32 +370,32 @@ public class MultiIteratorTest extends TestCase {
mi.next();
assertFalse(mi.hasTop());
- Range r3 = new Range(nk(0, 0), false, nk(1, 1), false);
+ Range r3 = new Range(newKey(0, 0), false, newKey(1, 1), false);
mi.seek(r3, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
assertTrue(mi.getTopValue().toString().equals("5"));
mi.next();
assertFalse(mi.hasTop());
- Range r4 = new Range(nk(1, 2), true, nk(1, 1), false);
+ Range r4 = new Range(newKey(1, 2), true, newKey(1, 1), false);
mi.seek(r4, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
assertTrue(mi.getTopValue().toString().equals("5"));
mi.next();
assertFalse(mi.hasTop());
- Range r5 = new Range(nk(1, 2), false, nk(1, 1), true);
+ Range r5 = new Range(newKey(1, 2), false, newKey(1, 1), true);
mi.seek(r5, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
assertTrue(mi.getTopValue().toString().equals("6"));
mi.next();
assertFalse(mi.hasTop());
- Range r6 = new Range(nk(2, 1), true, nk(2, 0), true);
+ Range r6 = new Range(newKey(2, 1), true, newKey(2, 0), true);
mi.seek(r6, EMPTY_COL_FAMS, false);
assertFalse(mi.hasTop());
- Range r7 = new Range(nk(0, 3), true, nk(0, 1), true);
+ Range r7 = new Range(newKey(0, 3), true, newKey(0, 1), true);
mi.seek(r7, EMPTY_COL_FAMS, false);
assertFalse(mi.hasTop());
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
index 1ebf9df..e6ca6d3 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
@@ -36,21 +36,22 @@ import org.apache.hadoop.io.Text;
public class SourceSwitchingIteratorTest extends TestCase {
- Key nk(String row, String cf, String cq, long time) {
+ Key newKey(String row, String cf, String cq, long time) {
return new Key(new Text(row), new Text(cf), new Text(cq), time);
}
void put(TreeMap<Key,Value> tm, String row, String cf, String cq, long time, Value val) {
- tm.put(nk(row, cf, cq, time), val);
+ tm.put(newKey(row, cf, cq, time), val);
}
void put(TreeMap<Key,Value> tm, String row, String cf, String cq, long time, String val) {
put(tm, row, cf, cq, time, new Value(val.getBytes()));
}
- private void ane(SortedKeyValueIterator<Key,Value> rdi, String row, String cf, String cq, long time, String val, boolean callNext) throws Exception {
+ private void testAndCallNext(SortedKeyValueIterator<Key,Value> rdi, String row, String cf, String cq, long time, String val, boolean callNext)
+ throws Exception {
assertTrue(rdi.hasTop());
- assertEquals(nk(row, cf, cq, time), rdi.getTopKey());
+ assertEquals(newKey(row, cf, cq, time), rdi.getTopKey());
assertEquals(val, rdi.getTopValue().toString());
if (callNext)
rdi.next();
@@ -121,9 +122,9 @@ public class SourceSwitchingIteratorTest extends TestCase {
SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds);
ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(ssi, "r1", "cf1", "cq1", 5, "v1", true);
- ane(ssi, "r1", "cf1", "cq3", 5, "v2", true);
- ane(ssi, "r2", "cf1", "cq1", 5, "v3", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq3", 5, "v2", true);
+ testAndCallNext(ssi, "r2", "cf1", "cq1", 5, "v3", true);
assertFalse(ssi.hasTop());
}
@@ -138,7 +139,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds);
ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(ssi, "r1", "cf1", "cq1", 5, "v1", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
TreeMap<Key,Value> tm2 = new TreeMap<>();
put(tm2, "r1", "cf1", "cq1", 5, "v4");
@@ -149,8 +150,8 @@ public class SourceSwitchingIteratorTest extends TestCase {
TestDataSource tds2 = new TestDataSource(smi2);
tds.next = tds2;
- ane(ssi, "r1", "cf1", "cq3", 5, "v2", true);
- ane(ssi, "r2", "cf1", "cq1", 5, "v6", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq3", 5, "v2", true);
+ testAndCallNext(ssi, "r2", "cf1", "cq1", 5, "v6", true);
assertFalse(ssi.hasTop());
}
@@ -170,7 +171,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds, true);
ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(ssi, "r1", "cf1", "cq1", 5, "v1", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
TreeMap<Key,Value> tm2 = new TreeMap<>(tm1);
put(tm2, "r1", "cf1", "cq5", 5, "v7"); // should not see this because it should not switch until the row is finished
@@ -181,12 +182,12 @@ public class SourceSwitchingIteratorTest extends TestCase {
TestDataSource tds2 = new TestDataSource(smi2);
tds.next = tds2;
- ane(ssi, "r1", "cf1", "cq2", 5, "v2", true);
- ane(ssi, "r1", "cf1", "cq3", 5, "v3", true);
- ane(ssi, "r1", "cf1", "cq4", 5, "v4", true);
- ane(ssi, "r2", "cf1", "cq1", 5, "v8", true);
- ane(ssi, "r3", "cf1", "cq1", 5, "v5", true);
- ane(ssi, "r3", "cf1", "cq2", 5, "v6", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq2", 5, "v2", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq3", 5, "v3", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq4", 5, "v4", true);
+ testAndCallNext(ssi, "r2", "cf1", "cq1", 5, "v8", true);
+ testAndCallNext(ssi, "r3", "cf1", "cq1", 5, "v5", true);
+ testAndCallNext(ssi, "r3", "cf1", "cq2", 5, "v6", true);
}
@@ -210,8 +211,8 @@ public class SourceSwitchingIteratorTest extends TestCase {
ssi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(ssi, "r1", "cf1", "cq1", 6, "v3", true);
- ane(ssi, "r1", "cf1", "cq2", 6, "v4", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq1", 6, "v3", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq2", 6, "v4", true);
}
@@ -240,9 +241,9 @@ public class SourceSwitchingIteratorTest extends TestCase {
ssi.seek(new Range("r1"), new ArrayList<ByteSequence>(), false);
dc1.seek(new Range("r2"), new ArrayList<ByteSequence>(), false);
- ane(ssi, "r1", "cf1", "cq1", 6, "v3", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq1", 6, "v3", true);
assertFalse(ssi.hasTop());
- ane(dc1, "r2", "cf1", "cq2", 6, "v4", true);
+ testAndCallNext(dc1, "r2", "cf1", "cq2", 6, "v4", true);
assertFalse(dc1.hasTop());
}
@@ -261,7 +262,7 @@ public class SourceSwitchingIteratorTest extends TestCase {
assertSame(flag, tds.iflag);
ssi.seek(new Range("r1"), new ArrayList<ByteSequence>(), false);
- ane(ssi, "r1", "cf1", "cq1", 5, "v1", true);
+ testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
assertFalse(ssi.hasTop());
flag.set(true);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
index 861ce02..de51a85 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
@@ -57,13 +57,13 @@ public class BigDecimalCombinerTest {
columns = Collections.singletonList(new IteratorSetting.Column("cf001"));
// keys that will aggregate
- CombinerTest.nkv(tm1, 1, 1, 1, 1, false, BigDecimal.valueOf(2), encoder);
- CombinerTest.nkv(tm1, 1, 1, 1, 2, false, BigDecimal.valueOf(2.3), encoder);
- CombinerTest.nkv(tm1, 1, 1, 1, 3, false, BigDecimal.valueOf(-1.4E1), encoder);
+ CombinerTest.newKeyValue(tm1, 1, 1, 1, 1, false, BigDecimal.valueOf(2), encoder);
+ CombinerTest.newKeyValue(tm1, 1, 1, 1, 2, false, BigDecimal.valueOf(2.3), encoder);
+ CombinerTest.newKeyValue(tm1, 1, 1, 1, 3, false, BigDecimal.valueOf(-1.4E1), encoder);
// and keys that will not aggregate
- CombinerTest.nkv(tm1, 1, 2, 1, 1, false, BigDecimal.valueOf(99), encoder);
- CombinerTest.nkv(tm1, 1, 3, 1, 1, false, BigDecimal.valueOf(-88), encoder);
+ CombinerTest.newKeyValue(tm1, 1, 2, 1, 1, false, BigDecimal.valueOf(99), encoder);
+ CombinerTest.newKeyValue(tm1, 1, 3, 1, 1, false, BigDecimal.valueOf(-88), encoder);
}
@Test
@@ -76,7 +76,7 @@ public class BigDecimalCombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(CombinerTest.nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(CombinerTest.newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals(-9.7, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
verify();
@@ -92,7 +92,7 @@ public class BigDecimalCombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(CombinerTest.nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(CombinerTest.newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals(-14.0, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
verify();
@@ -108,7 +108,7 @@ public class BigDecimalCombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(CombinerTest.nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(CombinerTest.newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals(2.3, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
verify();
@@ -118,11 +118,11 @@ public class BigDecimalCombinerTest {
ai.next(); // Skip the combined key, since we've already looked at it by now
// Should have exactly two more keys left over
- assertEquals(CombinerTest.nk(1, 2, 1, 1), ai.getTopKey());
+ assertEquals(CombinerTest.newKey(1, 2, 1, 1), ai.getTopKey());
assertEquals(99.0, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
ai.next();
- assertEquals(CombinerTest.nk(1, 3, 1, 1), ai.getTopKey());
+ assertEquals(CombinerTest.newKey(1, 3, 1, 1), ai.getTopKey());
assertEquals(-88.0, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
ai.next();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
index 698d9ec..df27800 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
@@ -43,25 +43,25 @@ public class ColumnSliceFilterTest {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<>();
private static final SortedMap<Key,Value> TEST_DATA = new TreeMap<>();
- private static final Key KEY_1 = nkv(TEST_DATA, "boo1", "yup", "20080201", "dog");
- private static final Key KEY_2 = nkv(TEST_DATA, "boo1", "yap", "20080202", "cat");
- private static final Key KEY_3 = nkv(TEST_DATA, "boo2", "yap", "20080203", "hamster");
- private static final Key KEY_4 = nkv(TEST_DATA, "boo2", "yop", "20080204", "lion");
- private static final Key KEY_5 = nkv(TEST_DATA, "boo2", "yup", "20080206", "tiger");
- private static final Key KEY_6 = nkv(TEST_DATA, "boo2", "yip", "20080203", "tiger");
+ private static final Key KEY_1 = newKeyValue(TEST_DATA, "boo1", "yup", "20080201", "dog");
+ private static final Key KEY_2 = newKeyValue(TEST_DATA, "boo1", "yap", "20080202", "cat");
+ private static final Key KEY_3 = newKeyValue(TEST_DATA, "boo2", "yap", "20080203", "hamster");
+ private static final Key KEY_4 = newKeyValue(TEST_DATA, "boo2", "yop", "20080204", "lion");
+ private static final Key KEY_5 = newKeyValue(TEST_DATA, "boo2", "yup", "20080206", "tiger");
+ private static final Key KEY_6 = newKeyValue(TEST_DATA, "boo2", "yip", "20080203", "tiger");
private IteratorEnvironment iteratorEnvironment;
private ColumnSliceFilter columnSliceFilter = new ColumnSliceFilter();
private IteratorSetting is;
- private static Key nkv(SortedMap<Key,Value> tm, String row, String cf, String cq, String val) {
- Key k = nk(row, cf, cq);
+ private static Key newKeyValue(SortedMap<Key,Value> tm, String row, String cf, String cq, String val) {
+ Key k = newKey(row, cf, cq);
tm.put(k, new Value(val.getBytes()));
return k;
}
- private static Key nk(String row, String cf, String cq) {
+ private static Key newKey(String row, String cf, String cq) {
return new Key(new Text(row), new Text(cf), new Text(cq));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
index 6300532..ec740a6 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
@@ -83,31 +83,31 @@ public class CombinerTest {
static final IteratorEnvironment SCAN_IE = new CombinerIteratorEnvironment(IteratorScope.scan, false);
- static Key nk(int row, int colf, int colq, long ts, boolean deleted) {
- Key k = nk(row, colf, colq, ts);
+ static Key newKey(int row, int colf, int colq, long ts, boolean deleted) {
+ Key k = newKey(row, colf, colq, ts);
k.setDeleted(deleted);
return k;
}
- static Key nk(int row, int colf, int colq, long ts) {
- return new Key(nr(row), new Text(String.format("cf%03d", colf)), new Text(String.format("cq%03d", colq)), ts);
+ static Key newKey(int row, int colf, int colq, long ts) {
+ return new Key(newRow(row), new Text(String.format("cf%03d", colf)), new Text(String.format("cq%03d", colq)), ts);
}
- static Range nr(int row, int colf, int colq, long ts, boolean inclusive) {
- return new Range(nk(row, colf, colq, ts), inclusive, null, true);
+ static Range newRow(int row, int colf, int colq, long ts, boolean inclusive) {
+ return new Range(newKey(row, colf, colq, ts), inclusive, null, true);
}
- static Range nr(int row, int colf, int colq, long ts) {
- return nr(row, colf, colq, ts, true);
+ static Range newRow(int row, int colf, int colq, long ts) {
+ return newRow(row, colf, colq, ts, true);
}
- static <V> void nkv(TreeMap<Key,Value> tm, int row, int colf, int colq, long ts, boolean deleted, V val, Encoder<V> encoder) {
- Key k = nk(row, colf, colq, ts);
+ static <V> void newKeyValue(TreeMap<Key,Value> tm, int row, int colf, int colq, long ts, boolean deleted, V val, Encoder<V> encoder) {
+ Key k = newKey(row, colf, colq, ts);
k.setDeleted(deleted);
tm.put(k, new Value(encoder.encode(val)));
}
- static Text nr(int row) {
+ static Text newRow(int row) {
return new Text(String.format("r%03d", row));
}
@@ -118,9 +118,9 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that do not aggregate
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
Combiner ai = new SummingCombiner();
@@ -132,19 +132,19 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("4", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 2), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 1), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 1), ai.getTopKey());
assertEquals("2", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -153,16 +153,16 @@ public class CombinerTest {
// try seeking
- ai.seek(nr(1, 1, 1, 2), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 2), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 2), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 1), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 1), ai.getTopKey());
assertEquals("2", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -170,7 +170,7 @@ public class CombinerTest {
assertFalse(ai.hasTop());
// seek after everything
- ai.seek(nr(1, 1, 1, 0), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 0), EMPTY_COL_FAMS, false);
assertFalse(ai.hasTop());
@@ -183,9 +183,9 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
Combiner ai = new SummingCombiner();
@@ -197,7 +197,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -206,10 +206,10 @@ public class CombinerTest {
// try seeking to the beginning of a key that aggregates
- ai.seek(nr(1, 1, 1, 3), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 3), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -217,20 +217,20 @@ public class CombinerTest {
assertFalse(ai.hasTop());
// try seeking the middle of a key the aggregates
- ai.seek(nr(1, 1, 1, 2), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 2), EMPTY_COL_FAMS, false);
assertFalse(ai.hasTop());
// try seeking to the end of a key the aggregates
- ai.seek(nr(1, 1, 1, 1), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 1), EMPTY_COL_FAMS, false);
assertFalse(ai.hasTop());
// try seeking before a key the aggregates
- ai.seek(nr(1, 1, 1, 4), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 4), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -245,13 +245,13 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
// keys that do not aggregate
- nkv(tm1, 2, 2, 1, 1, false, 2l, encoder);
- nkv(tm1, 2, 2, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 2, 2, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 2, 2, 1, 2, false, 3l, encoder);
Combiner ai = new SummingCombiner();
@@ -263,19 +263,19 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 1), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 1), ai.getTopKey());
assertEquals("2", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -283,23 +283,23 @@ public class CombinerTest {
assertFalse(ai.hasTop());
// seek after key that aggregates
- ai.seek(nr(1, 1, 1, 2), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 2), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
// seek before key that aggregates
- ai.seek(nr(1, 1, 1, 4), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 4), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
}
@@ -311,13 +311,13 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
// keys that do not aggregate
- nkv(tm1, 2, 2, 1, 1, false, 2l, encoder);
- nkv(tm1, 2, 2, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 2, 2, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 2, 2, 1, 2, false, 3l, encoder);
Combiner ai = new SummingCombiner();
@@ -332,19 +332,19 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 1), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 1), ai.getTopKey());
assertEquals("2", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -352,23 +352,23 @@ public class CombinerTest {
assertFalse(ai.hasTop());
// seek after key that aggregates
- ai2.seek(nr(1, 1, 1, 2), EMPTY_COL_FAMS, false);
+ ai2.seek(newRow(1, 1, 1, 2), EMPTY_COL_FAMS, false);
assertTrue(ai2.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai2.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai2.getTopKey());
assertEquals("3", encoder.decode(ai2.getTopValue().get()).toString());
// seek before key that aggregates
- ai3.seek(nr(1, 1, 1, 4), EMPTY_COL_FAMS, false);
+ ai3.seek(newRow(1, 1, 1, 4), EMPTY_COL_FAMS, false);
assertTrue(ai3.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai3.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai3.getTopKey());
assertEquals("9", encoder.decode(ai3.getTopValue().get()).toString());
ai3.next();
assertTrue(ai3.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai3.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai3.getTopKey());
assertEquals("3", encoder.decode(ai3.getTopValue().get()).toString());
}
@@ -379,16 +379,16 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that do not aggregate
- nkv(tm1, 0, 0, 1, 1, false, 7l, encoder);
+ newKeyValue(tm1, 0, 0, 1, 1, false, 7l, encoder);
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
// keys that do not aggregate
- nkv(tm1, 2, 2, 1, 1, false, 2l, encoder);
- nkv(tm1, 2, 2, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 2, 2, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 2, 2, 1, 2, false, 3l, encoder);
Combiner ai = new SummingCombiner();
@@ -400,25 +400,25 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(0, 0, 1, 1), ai.getTopKey());
+ assertEquals(newKey(0, 0, 1, 1), ai.getTopKey());
assertEquals("7", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 1), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 1), ai.getTopKey());
assertEquals("2", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -426,23 +426,23 @@ public class CombinerTest {
assertFalse(ai.hasTop());
// seek test
- ai.seek(nr(0, 0, 1, 0), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(0, 0, 1, 0), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
// seek after key that aggregates
- ai.seek(nr(1, 1, 1, 2), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 2), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("3", encoder.decode(ai.getTopValue().get()).toString());
// combine all columns
@@ -455,19 +455,19 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(0, 0, 1, 1), ai.getTopKey());
+ assertEquals(newKey(0, 0, 1, 1), ai.getTopKey());
assertEquals("7", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(2, 2, 1, 2), ai.getTopKey());
+ assertEquals(newKey(2, 2, 1, 2), ai.getTopKey());
assertEquals("5", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -482,13 +482,13 @@ public class CombinerTest {
// the exact same keys w/ different values
TreeMap<Key,Value> tm1 = new TreeMap<>();
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
TreeMap<Key,Value> tm2 = new TreeMap<>();
- nkv(tm2, 1, 1, 1, 1, false, 3l, encoder);
+ newKeyValue(tm2, 1, 1, 1, 1, false, 3l, encoder);
TreeMap<Key,Value> tm3 = new TreeMap<>();
- nkv(tm3, 1, 1, 1, 1, false, 4l, encoder);
+ newKeyValue(tm3, 1, 1, 1, 1, false, 4l, encoder);
Combiner ai = new SummingCombiner();
@@ -506,7 +506,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 1), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 1), ai.getTopKey());
assertEquals("9", encoder.decode(ai.getTopValue().get()).toString());
}
@@ -516,9 +516,9 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, 2l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
Combiner ai = new SummingCombiner();
@@ -530,7 +530,7 @@ public class CombinerTest {
// try seeking to the beginning of a key that aggregates
- ai.seek(nr(1, 1, 1, 3, false), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 3, false), EMPTY_COL_FAMS, false);
assertFalse(ai.hasTop());
@@ -544,9 +544,9 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
- nkv(tm1, 1, 1, 1, 2, true, 0l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 4l, encoder);
- nkv(tm1, 1, 1, 1, 4, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, true, 0l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 4, false, 3l, encoder);
Combiner ai = new SummingCombiner();
@@ -556,29 +556,29 @@ public class CombinerTest {
ai.init(new SortedMapIterator(tm1), is.getOptions(), SCAN_IE);
- ai.seek(nr(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 4), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 4), ai.getTopKey());
assertEquals("7", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 2, true), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 2, true), ai.getTopKey());
assertEquals("0", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
assertFalse(ai.hasTop());
tm1 = new TreeMap<>();
- nkv(tm1, 1, 1, 1, 2, true, 0l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, true, 0l, encoder);
ai = new SummingCombiner();
ai.init(new SortedMapIterator(tm1), is.getOptions(), SCAN_IE);
- ai.seek(nr(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
+ ai.seek(newRow(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 2, true), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 2, true), ai.getTopKey());
assertEquals("0", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -639,9 +639,9 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, 4l, encoder);
- nkv(tm1, 1, 1, 1, 2, false, 3l, encoder);
- nkv(tm1, 1, 1, 1, 3, false, 2l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, 4l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, 3l, encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, 2l, encoder);
Combiner ai = new MaxCombiner();
@@ -653,7 +653,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("4", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -666,7 +666,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals("2", encoder.decode(ai.getTopValue().get()).toString());
ai.next();
@@ -695,9 +695,9 @@ public class CombinerTest {
TreeMap<Key,Value> tm1 = new TreeMap<>();
// keys that aggregate
- nkv(tm1, 1, 1, 1, 1, false, nal(1l, 2l), encoder);
- nkv(tm1, 1, 1, 1, 2, false, nal(3l, 4l, 5l), encoder);
- nkv(tm1, 1, 1, 1, 3, false, nal(), encoder);
+ newKeyValue(tm1, 1, 1, 1, 1, false, nal(1l, 2l), encoder);
+ newKeyValue(tm1, 1, 1, 1, 2, false, nal(3l, 4l, 5l), encoder);
+ newKeyValue(tm1, 1, 1, 1, 3, false, nal(), encoder);
Combiner ai = new SummingArrayCombiner();
@@ -709,7 +709,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertBytesEqual(encoder.encode(nal(4l, 6l, 5l)), ai.getTopValue().get());
ai.next();
@@ -724,7 +724,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertBytesEqual(encoder.encode(nal(4l, 6l, 5l)), ai.getTopValue().get());
ai.next();
@@ -739,7 +739,7 @@ public class CombinerTest {
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
- assertEquals(nk(1, 1, 1, 3), ai.getTopKey());
+ assertEquals(newKey(1, 1, 1, 3), ai.getTopKey());
assertBytesEqual(encoder.encode(nal(4l, 6l, 5l)), ai.getTopValue().get());
ai.next();
@@ -901,15 +901,15 @@ public class CombinerTest {
IteratorEnvironment fullMajcIe = new CombinerIteratorEnvironment(IteratorScope.majc, true);
// keys that aggregate
- nkv(input, 1, 1, 1, 1, false, 4l, encoder);
- nkv(input, 1, 1, 1, 2, true, 0l, encoder);
- nkv(input, 1, 1, 1, 3, false, 2l, encoder);
- nkv(input, 1, 1, 1, 4, false, 9l, encoder);
+ newKeyValue(input, 1, 1, 1, 1, false, 4l, encoder);
+ newKeyValue(input, 1, 1, 1, 2, true, 0l, encoder);
+ newKeyValue(input, 1, 1, 1, 3, false, 2l, encoder);
+ newKeyValue(input, 1, 1, 1, 4, false, 9l, encoder);
TreeMap<Key,Value> expected = new TreeMap<>();
- nkv(expected, 1, 1, 1, 1, false, 4l, encoder);
- nkv(expected, 1, 1, 1, 2, true, 0l, encoder);
- nkv(expected, 1, 1, 1, 4, false, 11l, encoder);
+ newKeyValue(expected, 1, 1, 1, 1, false, 4l, encoder);
+ newKeyValue(expected, 1, 1, 1, 2, true, 0l, encoder);
+ newKeyValue(expected, 1, 1, 1, 4, false, 11l, encoder);
runDeleteHandlingTest(input, input, true, paritalMajcIe);
runDeleteHandlingTest(input, expected, true, fullMajcIe);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
index cb6d3f7..c753ee0 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
@@ -146,12 +146,12 @@ public class IndexedDocIteratorTest extends TestCase {
trf.openWriter(false);
TreeMap<Key,Value> inMemoryMap = createSortedMap(hitRatio, numRows, numDocsPerRow, columnFamilies, otherColumnFamilies, docs, negatedColumns);
- trf.writer.startNewLocalityGroup("docs", RFileTest.ncfs(docColf.toString()));
+ trf.writer.startNewLocalityGroup("docs", RFileTest.newColFamByteSequence(docColf.toString()));
for (Entry<Key,Value> entry : inMemoryMap.entrySet()) {
if (entry.getKey().getColumnFamily().equals(docColf))
trf.writer.append(entry.getKey(), entry.getValue());
}
- trf.writer.startNewLocalityGroup("terms", RFileTest.ncfs(indexColf.toString()));
+ trf.writer.startNewLocalityGroup("terms", RFileTest.newColFamByteSequence(indexColf.toString()));
for (Entry<Key,Value> entry : inMemoryMap.entrySet()) {
if (entry.getKey().getColumnFamily().equals(indexColf))
trf.writer.append(entry.getKey(), entry.getValue());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
index 742d339..003974c 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
@@ -52,22 +52,22 @@ public class RegExFilterTest extends TestCase {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<>();
- private Key nkv(TreeMap<Key,Value> tm, String row, String cf, String cq, String val) {
- Key k = nk(row, cf, cq);
+ private Key newKeyValue(TreeMap<Key,Value> tm, String row, String cf, String cq, String val) {
+ Key k = newKey(row, cf, cq);
tm.put(k, new Value(val.getBytes()));
return k;
}
- private Key nk(String row, String cf, String cq) {
+ private Key newKey(String row, String cf, String cq) {
return new Key(new Text(row), new Text(cf), new Text(cq));
}
public void test1() throws IOException {
TreeMap<Key,Value> tm = new TreeMap<>();
- Key k1 = nkv(tm, "boo1", "yup", "20080201", "dog");
- Key k2 = nkv(tm, "boo1", "yap", "20080202", "cat");
- Key k3 = nkv(tm, "boo2", "yip", "20080203", "hamster");
+ Key k1 = newKeyValue(tm, "boo1", "yup", "20080201", "dog");
+ Key k2 = newKeyValue(tm, "boo1", "yap", "20080202", "cat");
+ Key k3 = newKeyValue(tm, "boo2", "yip", "20080203", "hamster");
RegExFilter rei = new RegExFilter();
rei.describeOptions();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
index ae77c0b..e16c912 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
@@ -78,21 +78,21 @@ public class RowDeletingIteratorTest extends TestCase {
}
}
- Key nk(String row, String cf, String cq, long time) {
+ Key newKey(String row, String cf, String cq, long time) {
return new Key(new Text(row), new Text(cf), new Text(cq), time);
}
void put(TreeMap<Key,Value> tm, String row, String cf, String cq, long time, Value val) {
- tm.put(nk(row, cf, cq, time), val);
+ tm.put(newKey(row, cf, cq, time), val);
}
void put(TreeMap<Key,Value> tm, String row, String cf, String cq, long time, String val) {
put(tm, row, cf, cq, time, new Value(val.getBytes()));
}
- private void ane(RowDeletingIterator rdi, String row, String cf, String cq, long time, String val) {
+ private void testAssertions(RowDeletingIterator rdi, String row, String cf, String cq, long time, String val) {
assertTrue(rdi.hasTop());
- assertEquals(nk(row, cf, cq, time), rdi.getTopKey());
+ assertEquals(newKey(row, cf, cq, time), rdi.getTopKey());
assertEquals(val, rdi.getTopValue().toString());
}
@@ -108,28 +108,28 @@ public class RowDeletingIteratorTest extends TestCase {
rdi.init(new SortedMapIterator(tm1), null, new TestIE(IteratorScope.scan, false));
rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
for (int i = 0; i < 5; i++) {
- rdi.seek(new Range(nk("r1", "cf1", "cq" + i, 5), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ rdi.seek(new Range(newKey("r1", "cf1", "cq" + i, 5), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
- rdi.seek(new Range(nk("r11", "cf1", "cq1", 5), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ rdi.seek(new Range(newKey("r11", "cf1", "cq1", 5), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
put(tm1, "r2", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE);
rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
assertFalse(rdi.hasTop());
for (int i = 0; i < 5; i++) {
- rdi.seek(new Range(nk("r1", "cf1", "cq" + i, 5), null), new ArrayList<ByteSequence>(), false);
+ rdi.seek(new Range(newKey("r1", "cf1", "cq" + i, 5), null), new ArrayList<ByteSequence>(), false);
assertFalse(rdi.hasTop());
}
put(tm1, "r0", "cf1", "cq1", 5, "v1");
rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r0", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r0", "cf1", "cq1", 5, "v1");
rdi.next();
assertFalse(rdi.hasTop());
@@ -149,31 +149,31 @@ public class RowDeletingIteratorTest extends TestCase {
rdi.init(new SortedMapIterator(tm1), null, new TestIE(IteratorScope.scan, false));
rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "cf1", "cq3", 15, "v1");
+ testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
- ane(rdi, "r1", "cf1", "cq5", 15, "v1");
+ testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(nk("r1", "cf1", "cq1", 5), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "cf1", "cq3", 15, "v1");
+ rdi.seek(new Range(newKey("r1", "cf1", "cq1", 5), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
- ane(rdi, "r1", "cf1", "cq5", 15, "v1");
+ testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(nk("r1", "cf1", "cq4", 5), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "cf1", "cq5", 15, "v1");
+ rdi.seek(new Range(newKey("r1", "cf1", "cq4", 5), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(nk("r1", "cf1", "cq5", 20), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "cf1", "cq5", 15, "v1");
+ rdi.seek(new Range(newKey("r1", "cf1", "cq5", 20), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r1", "cf1", "cq5", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(nk("r1", "cf1", "cq9", 20), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ rdi.seek(new Range(newKey("r1", "cf1", "cq9", 20), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
public void test3() throws Exception {
@@ -192,18 +192,18 @@ public class RowDeletingIteratorTest extends TestCase {
cols.add(new ArrayByteSequence("cf1".getBytes()));
rdi.seek(new Range(), cols, true);
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
cols.clear();
cols.add(new ArrayByteSequence("".getBytes()));
rdi.seek(new Range(), cols, false);
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
cols.clear();
rdi.seek(new Range(), cols, false);
- ane(rdi, "r2", "", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "", "cq1", 5, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
public void test4() throws Exception {
@@ -219,23 +219,23 @@ public class RowDeletingIteratorTest extends TestCase {
rdi.init(new SortedMapIterator(tm1), null, new TestIE(IteratorScope.minc, false));
rdi.seek(new Range(), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE.toString());
+ testAssertions(rdi, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE.toString());
rdi.next();
- ane(rdi, "r1", "cf1", "cq3", 15, "v1");
+ testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(nk("r1", "cf1", "cq3", 20), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "cf1", "cq3", 15, "v1");
+ rdi.seek(new Range(newKey("r1", "cf1", "cq3", 20), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
- rdi.seek(new Range(nk("r1", "", "", 42), null), new ArrayList<ByteSequence>(), false);
- ane(rdi, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE.toString());
+ rdi.seek(new Range(newKey("r1", "", "", 42), null), new ArrayList<ByteSequence>(), false);
+ testAssertions(rdi, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE.toString());
rdi.next();
- ane(rdi, "r1", "cf1", "cq3", 15, "v1");
+ testAssertions(rdi, "r1", "cf1", "cq3", 15, "v1");
rdi.next();
- ane(rdi, "r2", "cf1", "cq1", 5, "v1");
+ testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a4a45398/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
index b1d79ce..8d8767f 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
@@ -31,11 +31,11 @@ import org.junit.Test;
public class CheckTabletMetadataTest {
- private static Key nk(String row, ColumnFQ cfq) {
+ private static Key newKey(String row, ColumnFQ cfq) {
return new Key(new Text(row), cfq.getColumnFamily(), cfq.getColumnQualifier());
}
- private static Key nk(String row, Text cf, String cq) {
+ private static Key newKey(String row, Text cf, String cq) {
return new Key(row, cf.toString(), cq);
}
@@ -93,18 +93,18 @@ public class CheckTabletMetadataTest {
assertFail(tabletMeta, new KeyExtent(new Text("1"), new Text("r"), new Text("m")), tsi);
- assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN));
+ assertFail(tabletMeta, ke, tsi, newKey("1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN));
- assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN));
+ assertFail(tabletMeta, ke, tsi, newKey("1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN));
- assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.ServerColumnFamily.TIME_COLUMN));
+ assertFail(tabletMeta, ke, tsi, newKey("1<", TabletsSection.ServerColumnFamily.TIME_COLUMN));
- assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
+ assertFail(tabletMeta, ke, tsi, newKey("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
TreeMap<Key,Value> copy = new TreeMap<>(tabletMeta);
put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "4", "127.0.0.1:9997");
assertFail(copy, ke, tsi);
- assertFail(copy, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
+ assertFail(copy, ke, tsi, newKey("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
copy = new TreeMap<>(tabletMeta);
put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "5", "127.0.0.1:9998");