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:51 UTC
[6/6] accumulo git commit: ACCUMULO-4525: replace more meaningless
method names
ACCUMULO-4525: replace more meaningless method names
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/fcde1d93
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/fcde1d93
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/fcde1d93
Branch: refs/heads/1.8
Commit: fcde1d93aeab12fb26c2f38b225b3d470fe1d44c
Parents: cd70d78
Author: Mike Miller <mm...@apache.org>
Authored: Wed Nov 23 08:13:53 2016 -0500
Committer: Mike Miller <mm...@apache.org>
Committed: Wed Nov 23 08:13:53 2016 -0500
----------------------------------------------------------------------
.../core/file/rfile/KeyShortenerTest.java | 57 ++++----
.../accumulo/core/file/rfile/RFileTest.java | 140 ++++++++++---------
.../accumulo/tserver/InMemoryMapTest.java | 10 +-
3 files changed, 107 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/fcde1d93/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
index 67ff70c..090d153 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
@@ -41,14 +41,14 @@ public class KeyShortenerTest {
/**
* append 0xff to end of string
*/
- private byte[] aff(String s) {
+ private byte[] apendFF(String s) {
return Bytes.concat(s.getBytes(), FF);
}
/**
* append 0x00 to end of string
*/
- private byte[] a00(String s) {
+ private byte[] append00(String s) {
return Bytes.concat(s.getBytes(), new byte[] {(byte) 0x00});
}
@@ -62,74 +62,75 @@ public class KeyShortenerTest {
throw new IllegalArgumentException();
}
- private Key nk(Object row, Object fam, Object qual, long ts) {
+ private Key newKey(Object row, Object fam, Object qual, long ts) {
return new Key(toBytes(row), toBytes(fam), toBytes(qual), E, ts);
}
@Test
public void testOneCharacterDifference() {
// row has char that differs by one byte
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hbhahaha", "f89222", "q90232e"), nk(aff("r321ha"), E, E, 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hbhahaha", "f89222", "q90232e"), newKey(apendFF("r321ha"), E, E, 0));
// family has char that differs by one byte
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89322", "q90232e"), nk("r321hahahaha", aff("f892"), E, 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89322", "q90232e"), newKey("r321hahahaha", apendFF("f892"), E, 0));
// qualifier has char that differs by one byte
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89222", "q91232e"), nk("r321hahahaha", "f89222", aff("q90"), 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89222", "q91232e"), newKey("r321hahahaha", "f89222", apendFF("q90"), 0));
}
@Test
public void testMultiCharacterDifference() {
// row has char that differs by two bytes
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hchahaha", "f89222", "q90232e"), nk("r321hb", E, E, 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hchahaha", "f89222", "q90232e"), newKey("r321hb", E, E, 0));
// family has char that differs by two bytes
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89422", "q90232e"), nk("r321hahahaha", "f893", E, 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89422", "q90232e"), newKey("r321hahahaha", "f893", E, 0));
// qualifier has char that differs by two bytes
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89222", "q92232e"), nk("r321hahahaha", "f89222", "q91", 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89222", "q92232e"), newKey("r321hahahaha", "f89222", "q91", 0));
}
@Test
public void testOneCharacterDifferenceAndFF() {
- byte[] ff1 = Bytes.concat(aff("mop"), "b".getBytes());
- byte[] ff2 = Bytes.concat(aff("mop"), FF, "b".getBytes());
+ byte[] ff1 = Bytes.concat(apendFF("mop"), "b".getBytes());
+ byte[] ff2 = Bytes.concat(apendFF("mop"), FF, "b".getBytes());
- byte[] eff1 = Bytes.concat(aff("mop"), FF, FF);
- byte[] eff2 = Bytes.concat(aff("mop"), FF, FF, FF);
+ byte[] eff1 = Bytes.concat(apendFF("mop"), FF, FF);
+ byte[] eff2 = Bytes.concat(apendFF("mop"), FF, FF, FF);
- testKeys(nk(ff1, "f89222", "q90232e", 34), new Key("mor56", "f89222", "q90232e"), nk(eff1, E, E, 0));
- testKeys(nk("r1", ff1, "q90232e", 34), new Key("r1", "mor56", "q90232e"), nk("r1", eff1, E, 0));
- testKeys(nk("r1", "f1", ff1, 34), new Key("r1", "f1", "mor56"), nk("r1", "f1", eff1, 0));
+ testKeys(newKey(ff1, "f89222", "q90232e", 34), new Key("mor56", "f89222", "q90232e"), newKey(eff1, E, E, 0));
+ testKeys(newKey("r1", ff1, "q90232e", 34), new Key("r1", "mor56", "q90232e"), newKey("r1", eff1, E, 0));
+ testKeys(newKey("r1", "f1", ff1, 34), new Key("r1", "f1", "mor56"), newKey("r1", "f1", eff1, 0));
- testKeys(nk(ff2, "f89222", "q90232e", 34), new Key("mor56", "f89222", "q90232e"), nk(eff2, E, E, 0));
- testKeys(nk("r1", ff2, "q90232e", 34), new Key("r1", "mor56", "q90232e"), nk("r1", eff2, E, 0));
- testKeys(nk("r1", "f1", ff2, 34), new Key("r1", "f1", "mor56"), nk("r1", "f1", eff2, 0));
+ testKeys(newKey(ff2, "f89222", "q90232e", 34), new Key("mor56", "f89222", "q90232e"), newKey(eff2, E, E, 0));
+ testKeys(newKey("r1", ff2, "q90232e", 34), new Key("r1", "mor56", "q90232e"), newKey("r1", eff2, E, 0));
+ testKeys(newKey("r1", "f1", ff2, 34), new Key("r1", "f1", "mor56"), newKey("r1", "f1", eff2, 0));
}
@Test
public void testOneCharacterDifferenceAtEnd() {
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahahb", "f89222", "q90232e"), nk(a00("r321hahahaha"), E, E, 0));
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89223", "q90232e"), nk("r321hahahaha", a00("f89222"), E, 0));
- testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89222", "q90232f"), nk("r321hahahaha", "f89222", a00("q90232e"), 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahahb", "f89222", "q90232e"), newKey(append00("r321hahahaha"), E, E, 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89223", "q90232e"), newKey("r321hahahaha", append00("f89222"), E, 0));
+ testKeys(new Key("r321hahahaha", "f89222", "q90232e"), new Key("r321hahahaha", "f89222", "q90232f"),
+ newKey("r321hahahaha", "f89222", append00("q90232e"), 0));
}
@Test
public void testSamePrefix() {
- testKeys(new Key("r3boot4", "f89222", "q90232e"), new Key("r3boot452", "f89222", "q90232e"), nk(a00("r3boot4"), E, E, 0));
- testKeys(new Key("r3boot4", "f892", "q90232e"), new Key("r3boot4", "f89222", "q90232e"), nk("r3boot4", a00("f892"), E, 0));
- testKeys(new Key("r3boot4", "f89222", "q902"), new Key("r3boot4", "f89222", "q90232e"), nk("r3boot4", "f89222", a00("q902"), 0));
+ testKeys(new Key("r3boot4", "f89222", "q90232e"), new Key("r3boot452", "f89222", "q90232e"), newKey(append00("r3boot4"), E, E, 0));
+ testKeys(new Key("r3boot4", "f892", "q90232e"), new Key("r3boot4", "f89222", "q90232e"), newKey("r3boot4", append00("f892"), E, 0));
+ testKeys(new Key("r3boot4", "f89222", "q902"), new Key("r3boot4", "f89222", "q90232e"), newKey("r3boot4", "f89222", append00("q902"), 0));
}
@Test
public void testSamePrefixAnd00() {
Key prev = new Key("r3boot4", "f89222", "q90232e");
- Assert.assertEquals(prev, KeyShortener.shorten(prev, nk(a00("r3boot4"), "f89222", "q90232e", 8)));
+ Assert.assertEquals(prev, KeyShortener.shorten(prev, newKey(append00("r3boot4"), "f89222", "q90232e", 8)));
prev = new Key("r3boot4", "f892", "q90232e");
- Assert.assertEquals(prev, KeyShortener.shorten(prev, nk("r3boot4", a00("f892"), "q90232e", 8)));
+ Assert.assertEquals(prev, KeyShortener.shorten(prev, newKey("r3boot4", append00("f892"), "q90232e", 8)));
prev = new Key("r3boot4", "f89222", "q902");
- Assert.assertEquals(prev, KeyShortener.shorten(prev, nk("r3boot4", "f89222", a00("q902"), 8)));
+ Assert.assertEquals(prev, KeyShortener.shorten(prev, newKey("r3boot4", "f89222", append00("q902"), 8)));
}
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/fcde1d93/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index aff1a8f..fc43ef1 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -646,7 +646,8 @@ public class RFileTest {
trf.openReader();
// test that has top returns false when end of range reached
- trf.iter.seek(new Range(newKey(formatString("r_", 3), "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4), "cf1", "cq1", "L1", 55), false), EMPTY_COL_FAMS, false);
+ trf.iter.seek(new Range(newKey(formatString("r_", 3), "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4), "cf1", "cq1", "L1", 55), false),
+ EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
assertTrue(trf.iter.getTopKey().equals(newKey(formatString("r_", 3), "cf1", "cq1", "L1", 55)));
assertEquals(newValue("foo" + 3), trf.iter.getTopValue());
@@ -654,19 +655,23 @@ public class RFileTest {
assertFalse(trf.iter.hasTop());
// test seeking to a range that is between two keys, should not return anything
- trf.iter.seek(new Range(newKey(formatString("r_", 4) + "a", "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4) + "b", "cf1", "cq1", "L1", 55), true), EMPTY_COL_FAMS, false);
+ trf.iter.seek(new Range(newKey(formatString("r_", 4) + "a", "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4) + "b", "cf1", "cq1", "L1", 55),
+ true), EMPTY_COL_FAMS, false);
assertFalse(trf.iter.hasTop());
// test seeking to another range after the previously seeked range, that is between the same two keys in the file
// as the previously seeked range.... this test an optimization on RFile
- trf.iter.seek(new Range(newKey(formatString("r_", 4) + "c", "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4) + "d", "cf1", "cq1", "L1", 55), true), EMPTY_COL_FAMS, false);
+ trf.iter.seek(new Range(newKey(formatString("r_", 4) + "c", "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4) + "d", "cf1", "cq1", "L1", 55),
+ true), EMPTY_COL_FAMS, false);
assertFalse(trf.iter.hasTop());
- trf.iter.seek(new Range(newKey(formatString("r_", 4) + "e", "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4) + "f", "cf1", "cq1", "L1", 55), true), EMPTY_COL_FAMS, false);
+ trf.iter.seek(new Range(newKey(formatString("r_", 4) + "e", "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 4) + "f", "cf1", "cq1", "L1", 55),
+ true), EMPTY_COL_FAMS, false);
assertFalse(trf.iter.hasTop());
// now ensure we can seek somewhere, that triggering the optimization does not cause any problems
- trf.iter.seek(new Range(newKey(formatString("r_", 5), "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 6), "cf1", "cq1", "L1", 55), false), EMPTY_COL_FAMS, false);
+ trf.iter.seek(new Range(newKey(formatString("r_", 5), "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 6), "cf1", "cq1", "L1", 55), false),
+ EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
assertTrue(trf.iter.getTopKey().equals(newKey(formatString("r_", 5), "cf1", "cq1", "L1", 55)));
assertEquals(newValue("foo" + 5), trf.iter.getTopValue());
@@ -674,7 +679,8 @@ public class RFileTest {
assertFalse(trf.iter.hasTop());
// test seeking to range that is before the beginning of the file
- trf.iter.seek(new Range(newKey(formatString("r_", 0), "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 2), "cf1", "cq1", "L1", 55), false), EMPTY_COL_FAMS, false);
+ trf.iter.seek(new Range(newKey(formatString("r_", 0), "cf1", "cq1", "L1", 55), true, newKey(formatString("r_", 2), "cf1", "cq1", "L1", 55), false),
+ EMPTY_COL_FAMS, false);
assertFalse(trf.iter.hasTop());
assertEquals(newKey(formatString("r_", 49), "cf1", "cq1", "L1", 55), trf.reader.getLastKey());
@@ -789,7 +795,7 @@ public class RFileTest {
trf.closeReader();
}
- public static Set<ByteSequence> ncfs(String... colFams) {
+ public static Set<ByteSequence> newColFamByteSequence(String... colFams) {
HashSet<ByteSequence> cfs = new HashSet<>();
for (String cf : colFams) {
@@ -805,12 +811,12 @@ public class RFileTest {
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
trf.writer.append(newKey("0000", "cf1", "doe,john", "", 4), newValue("1123 West Left st"));
trf.writer.append(newKey("0002", "cf2", "doe,jane", "", 5), newValue("1124 East Right st"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
trf.writer.append(newKey("0001", "cf3", "buck,john", "", 4), newValue("90 Slum st"));
trf.writer.append(newKey("0003", "cf4", "buck,jane", "", 5), newValue("09 Slum st"));
@@ -821,7 +827,7 @@ public class RFileTest {
// scan first loc group
Range r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf1", "cf2"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf1", "cf2"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -836,7 +842,7 @@ public class RFileTest {
// scan second loc group
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf3", "cf4"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf3", "cf4"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -874,13 +880,13 @@ public class RFileTest {
// scan no loc groups
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("saint", "dogooder"), true);
+ trf.iter.seek(r, newColFamByteSequence("saint", "dogooder"), true);
assertEquals(0, trf.reader.getNumLocalityGroupsSeeked());
assertFalse(trf.iter.hasTop());
// scan a subset of second locality group
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf4"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf4"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -891,7 +897,7 @@ public class RFileTest {
// scan a subset of second locality group
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf3"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf3"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -902,7 +908,7 @@ public class RFileTest {
// scan subset of first loc group
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf1"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf1"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -913,7 +919,7 @@ public class RFileTest {
// scan subset of first loc group
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf2"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf2"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -924,7 +930,7 @@ public class RFileTest {
// scan subset of all loc groups
r = new Range(newKey("0000", "cf1", "doe,john", "", 4), true, newKey("0003", "cf4", "buck,jane", "", 5), true);
- trf.iter.seek(r, ncfs("cf1", "cf4"), true);
+ trf.iter.seek(r, newColFamByteSequence("cf1", "cf4"), true);
assertEquals(2, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
@@ -948,8 +954,8 @@ public class RFileTest {
TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
trf.writer.startDefaultLocalityGroup();
trf.writer.close();
@@ -963,10 +969,10 @@ public class RFileTest {
trf = new TestRFile(conf);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
trf.writer.append(newKey("0000", "cf1", "doe,john", "", 4), newValue("1123 West Left st"));
trf.writer.append(newKey("0002", "cf2", "doe,jane", "", 5), newValue("1124 East Right st"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
trf.writer.startDefaultLocalityGroup();
trf.writer.close();
@@ -988,8 +994,8 @@ public class RFileTest {
trf = new TestRFile(conf);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
trf.writer.append(newKey("0001", "cf3", "buck,john", "", 4), newValue("90 Slum st"));
trf.writer.append(newKey("0003", "cf4", "buck,jane", "", 5), newValue("09 Slum st"));
trf.writer.startDefaultLocalityGroup();
@@ -1013,8 +1019,8 @@ public class RFileTest {
trf = new TestRFile(conf);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
trf.writer.startDefaultLocalityGroup();
trf.writer.append(newKey("0007", "good citizen", "q,john", "", 4), newValue("70 Apple st"));
trf.writer.append(newKey("0008", "model citizen", "q,jane", "", 5), newValue("81 Plum st"));
@@ -1038,10 +1044,10 @@ public class RFileTest {
trf = new TestRFile(conf);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
trf.writer.append(newKey("0000", "cf1", "doe,john", "", 4), newValue("1123 West Left st"));
trf.writer.append(newKey("0002", "cf2", "doe,jane", "", 5), newValue("1124 East Right st"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
trf.writer.startDefaultLocalityGroup();
trf.writer.append(newKey("0007", "good citizen", "q,john", "", 4), newValue("70 Apple st"));
trf.writer.append(newKey("0008", "model citizen", "q,jane", "", 5), newValue("81 Plum st"));
@@ -1077,12 +1083,12 @@ public class RFileTest {
TestRFile trf = new TestRFile(conf);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("3mod10"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("3mod10"));
for (int i = 3; i < 1024; i += 10) {
trf.writer.append(newKey(formatString("i", i), "3mod10", "", "", i + 2), newValue("" + i));
}
- trf.writer.startNewLocalityGroup("lg2", ncfs("5mod10", "7mod10"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("5mod10", "7mod10"));
for (int i = 5; i < 1024;) {
trf.writer.append(newKey(formatString("i", i), "5mod10", "", "", i + 2), newValue("" + i));
@@ -1117,7 +1123,7 @@ public class RFileTest {
// try reading each of the 10 column families separately
for (int m = 0; m < 10; m++) {
- trf.iter.seek(new Range(new Key(), true, null, true), ncfs(m + "mod10"), true);
+ trf.iter.seek(new Range(new Key(), true, null, true), newColFamByteSequence(m + "mod10"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
for (int i = m; i < 1024; i += 10) {
assertTrue(trf.iter.hasTop());
@@ -1128,7 +1134,7 @@ public class RFileTest {
assertFalse(trf.iter.hasTop());
// test excluding an individual column family
- trf.iter.seek(new Range(new Key(), true, null, true), ncfs(m + "mod10"), false);
+ trf.iter.seek(new Range(new Key(), true, null, true), newColFamByteSequence(m + "mod10"), false);
if (m == 3)
assertEquals(2, trf.reader.getNumLocalityGroupsSeeked());
else
@@ -1151,9 +1157,9 @@ public class RFileTest {
// try reading from cloned reader at the same time as parent reader
for (int m = 0; m < 9; m++) {
- trf.iter.seek(new Range(new Key(), true, null, true), ncfs(m + "mod10"), true);
+ trf.iter.seek(new Range(new Key(), true, null, true), newColFamByteSequence(m + "mod10"), true);
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
- reader2.seek(new Range(new Key(), true, null, true), ncfs((m + 1) + "mod10"), true);
+ reader2.seek(new Range(new Key(), true, null, true), newColFamByteSequence((m + 1) + "mod10"), true);
// assertEquals(1, reader2.getNumLocalityGroupsSeeked());
for (int i = m; i < 1024; i += 10) {
// System.out.println(m+","+i);
@@ -1183,7 +1189,7 @@ public class RFileTest {
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("a", "b"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("a", "b"));
trf.writer.append(newKey("0007", "a", "cq1", "", 4), newValue("1"));
@@ -1216,7 +1222,7 @@ public class RFileTest {
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("a", "b"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("a", "b"));
trf.writer.append(newKey("0007", "a", "cq1", "", 4), newValue("1"));
@@ -1258,7 +1264,7 @@ public class RFileTest {
trf.writer.startDefaultLocalityGroup();
try {
- trf.writer.startNewLocalityGroup("lg1", ncfs("a", "b"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("a", "b"));
assertFalse(true);
} catch (IllegalStateException ioe) {
@@ -1280,11 +1286,11 @@ public class RFileTest {
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("a", "b"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("a", "b"));
trf.writer.append(newKey("0007", "a", "cq1", "", 4), newValue("1"));
try {
- trf.writer.startNewLocalityGroup("lg1", ncfs("b", "c"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("b", "c"));
assertFalse(true);
} catch (IllegalArgumentException ioe) {
@@ -1386,7 +1392,7 @@ public class RFileTest {
return String.format("cf%06d", i);
}
- private Set<ByteSequence> t18ncfs(int... colFams) {
+ private Set<ByteSequence> t18newColFamByteSequence(int... colFams) {
HashSet<ByteSequence> cfs = new HashSet<>();
for (int i : colFams) {
cfs.add(new ArrayByteSequence(t18ncf(i)));
@@ -1442,15 +1448,15 @@ public class RFileTest {
HashSet<ByteSequence> allCf = new HashSet<>();
- trf.writer.startNewLocalityGroup("lg1", t18ncfs(0));
+ trf.writer.startNewLocalityGroup("lg1", t18newColFamByteSequence(0));
for (int i = 0; i < 1; i++)
t18Append(trf, allCf, i);
- trf.writer.startNewLocalityGroup("lg2", t18ncfs(1, 2));
+ trf.writer.startNewLocalityGroup("lg2", t18newColFamByteSequence(1, 2));
for (int i = 1; i < 3; i++)
t18Append(trf, allCf, i);
- trf.writer.startNewLocalityGroup("lg3", t18ncfs(3, 4, 5));
+ trf.writer.startNewLocalityGroup("lg3", t18newColFamByteSequence(3, 4, 5));
for (int i = 3; i < 6; i++)
t18Append(trf, allCf, i);
@@ -1464,22 +1470,22 @@ public class RFileTest {
trf.openReader();
- t18Verify(t18ncfs(0), trf.iter, trf.reader, allCf, 1, 3);
+ t18Verify(t18newColFamByteSequence(0), trf.iter, trf.reader, allCf, 1, 3);
for (int i = 1; i < 10; i++)
- t18Verify(t18ncfs(i), trf.iter, trf.reader, allCf, 1, 4);
+ t18Verify(t18newColFamByteSequence(i), trf.iter, trf.reader, allCf, 1, 4);
- t18Verify(t18ncfs(max + 1), trf.iter, trf.reader, allCf, 1, 4);
+ t18Verify(t18newColFamByteSequence(max + 1), trf.iter, trf.reader, allCf, 1, 4);
- t18Verify(t18ncfs(1, 2, 3, 4), trf.iter, trf.reader, allCf, 2, 3);
- t18Verify(t18ncfs(1, 2, 3, 4, 5), trf.iter, trf.reader, allCf, 2, 2);
+ t18Verify(t18newColFamByteSequence(1, 2, 3, 4), trf.iter, trf.reader, allCf, 2, 3);
+ t18Verify(t18newColFamByteSequence(1, 2, 3, 4, 5), trf.iter, trf.reader, allCf, 2, 2);
- t18Verify(t18ncfs(0, 1, 2, 3, 4), trf.iter, trf.reader, allCf, 3, 2);
- t18Verify(t18ncfs(0, 1, 2, 3, 4, 5), trf.iter, trf.reader, allCf, 3, 1);
- t18Verify(t18ncfs(0, 1, 2, 3, 4, 5, 6), trf.iter, trf.reader, allCf, 4, 1);
+ t18Verify(t18newColFamByteSequence(0, 1, 2, 3, 4), trf.iter, trf.reader, allCf, 3, 2);
+ t18Verify(t18newColFamByteSequence(0, 1, 2, 3, 4, 5), trf.iter, trf.reader, allCf, 3, 1);
+ t18Verify(t18newColFamByteSequence(0, 1, 2, 3, 4, 5, 6), trf.iter, trf.reader, allCf, 4, 1);
- t18Verify(t18ncfs(0, 1), trf.iter, trf.reader, allCf, 2, 3);
- t18Verify(t18ncfs(2, 3), trf.iter, trf.reader, allCf, 2, 4);
- t18Verify(t18ncfs(5, 6), trf.iter, trf.reader, allCf, 2, 4);
+ t18Verify(t18newColFamByteSequence(0, 1), trf.iter, trf.reader, allCf, 2, 3);
+ t18Verify(t18newColFamByteSequence(2, 3), trf.iter, trf.reader, allCf, 2, 4);
+ t18Verify(t18newColFamByteSequence(5, 6), trf.iter, trf.reader, allCf, 2, 4);
trf.closeReader();
}
@@ -1492,10 +1498,10 @@ public class RFileTest {
trf.openWriter(false);
trf.openWriter(false);
- trf.writer.startNewLocalityGroup("lg1", ncfs("cf1", "cf2"));
+ trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
trf.writer.append(newKey("0000", "cf1", "doe,john", "", 4), newValue("1123 West Left st"));
trf.writer.append(newKey("0002", "cf2", "doe,jane", "", 5), newValue("1124 East Right st"));
- trf.writer.startNewLocalityGroup("lg2", ncfs("cf3", "cf4"));
+ trf.writer.startNewLocalityGroup("lg2", newColFamByteSequence("cf3", "cf4"));
DataOutputStream dos = trf.writer.createMetaStore("count");
@@ -1627,9 +1633,9 @@ public class RFileTest {
for (int start : new int[] {0, 10, 100, 998}) {
for (int cf = 1; cf <= 4; cf++) {
if (start == 0)
- iter.seek(new Range(), ncfs(formatString("cf_", cf)), true);
+ iter.seek(new Range(), newColFamByteSequence(formatString("cf_", cf)), true);
else
- iter.seek(new Range(formatString("r_", start), null), ncfs(formatString("cf_", cf)), true);
+ iter.seek(new Range(formatString("r_", start), null), newColFamByteSequence(formatString("cf_", cf)), true);
for (int i = start; i < 1000; i++) {
assertTrue(iter.hasTop());
@@ -1642,9 +1648,9 @@ public class RFileTest {
}
if (start == 0)
- iter.seek(new Range(), ncfs(), false);
+ iter.seek(new Range(), newColFamByteSequence(), false);
else
- iter.seek(new Range(formatString("r_", start), null), ncfs(), false);
+ iter.seek(new Range(formatString("r_", start), null), newColFamByteSequence(), false);
for (int i = start; i < 1000; i++) {
for (int cf = 1; cf <= 4; cf++) {
@@ -2016,7 +2022,7 @@ public class RFileTest {
trf.openWriter(false, 1000);
- trf.writer.startNewLocalityGroup("meta-lg", ncfs("metaA", "metaB"));
+ trf.writer.startNewLocalityGroup("meta-lg", newColFamByteSequence("metaA", "metaB"));
for (int r = 0; r < num; r++) {
String row = String.format("r%06d", r);
Key k1 = new Key(row, "metaA", "q9", 7);
@@ -2061,13 +2067,13 @@ public class RFileTest {
trf.openReader(false);
FileSKVIterator sample = trf.reader.getSample(SamplerConfigurationImpl.newSamplerConfig(sampleConf));
- checkSample(sample, sampleDataLG1, ncfs("metaA", "metaB"), true);
- checkSample(sample, sampleDataLG1, ncfs("metaA"), true);
- checkSample(sample, sampleDataLG1, ncfs("metaB"), true);
- checkSample(sample, sampleDataLG1, ncfs("dataA"), false);
+ checkSample(sample, sampleDataLG1, newColFamByteSequence("metaA", "metaB"), true);
+ checkSample(sample, sampleDataLG1, newColFamByteSequence("metaA"), true);
+ checkSample(sample, sampleDataLG1, newColFamByteSequence("metaB"), true);
+ checkSample(sample, sampleDataLG1, newColFamByteSequence("dataA"), false);
- checkSample(sample, sampleDataLG2, ncfs("metaA", "metaB"), false);
- checkSample(sample, sampleDataLG2, ncfs("dataA"), true);
+ checkSample(sample, sampleDataLG2, newColFamByteSequence("metaA", "metaB"), false);
+ checkSample(sample, sampleDataLG2, newColFamByteSequence("dataA"), true);
ArrayList<Entry<Key,Value>> allSampleData = new ArrayList<>();
allSampleData.addAll(sampleDataLG1);
@@ -2080,7 +2086,7 @@ public class RFileTest {
}
});
- checkSample(sample, allSampleData, ncfs("dataA", "metaA"), true);
+ checkSample(sample, allSampleData, newColFamByteSequence("dataA", "metaA"), true);
checkSample(sample, allSampleData, EMPTY_COL_FAMS, false);
trf.closeReader();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/fcde1d93/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
index 2733efd..43f0c0f 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
@@ -141,9 +141,9 @@ public class InMemoryMapTest {
}
- static void aeNoNext(SortedKeyValueIterator<Key,Value> dc, String row, String column, int ts, String val) throws IOException {
+ static void assertEqualsNoNext(SortedKeyValueIterator<Key,Value> dc, String row, String column, int ts, String val) throws IOException {
assertTrue(dc.hasTop());
- assertEquals(nk(row, column, ts), dc.getTopKey());
+ assertEquals(newKey(row, column, ts), dc.getTopKey());
assertEquals(new Value(val.getBytes()), dc.getTopValue());
}
@@ -265,9 +265,9 @@ public class InMemoryMapTest {
imm.delete(0);
ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
- aeNoNext(ski1, "r1", "foo:cq1", 3, "");
+ assertEqualsNoNext(ski1, "r1", "foo:cq1", 3, "");
ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
- ae(ski1, "r1", "foo:cq1", 3, "");
+ testAndCallNext(ski1, "r1", "foo:cq1", 3, "");
assertFalse(ski1.hasTop());
ski1.close();
@@ -733,7 +733,7 @@ public class InMemoryMapTest {
private void mutate(InMemoryMap imm, String row, String cols, int ts, String val, Sampler sampler, TreeMap<Key,Value> expectedSample,
TreeMap<Key,Value> expectedAll) {
mutate(imm, row, cols, ts, val);
- Key k1 = nk(row, cols, ts);
+ Key k1 = newKey(row, cols, ts);
if (sampler.accept(k1)) {
expectedSample.put(k1, new Value(val.getBytes()));
}