use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.
the class NativeMapIT method test5.
@Test
public void test5() {
NativeMap nm = new NativeMap();
insertAndVerify(nm, 1, 10, 0);
Iterator<Entry<Key, Value>> iter = nm.iterator();
iter.next();
nm.delete();
try {
nm.put(newKey(1), newValue(1));
assertTrue(false);
} catch (IllegalStateException e) {
}
try {
nm.get(newKey(1));
assertTrue(false);
} catch (IllegalStateException e) {
}
try {
nm.iterator();
assertTrue(false);
} catch (IllegalStateException e) {
}
try {
nm.iterator(newKey(1));
assertTrue(false);
} catch (IllegalStateException e) {
}
try {
nm.size();
assertTrue(false);
} catch (IllegalStateException e) {
}
try {
iter.next();
assertTrue(false);
} catch (IllegalStateException e) {
}
}
use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.
the class NativeMapIT method testBinary.
@Test
public void testBinary() {
NativeMap nm = new NativeMap();
byte[] emptyBytes = new byte[0];
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 256; j++) {
byte[] row = new byte[] { 'r', (byte) (0xff & i), (byte) (0xff & j) };
byte[] data = new byte[] { 'v', (byte) (0xff & i), (byte) (0xff & j) };
Key k = new Key(row, emptyBytes, emptyBytes, emptyBytes, 1);
Value v = new Value(data);
nm.put(k, v);
}
}
Iterator<Entry<Key, Value>> iter = nm.iterator();
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 256; j++) {
byte[] row = new byte[] { 'r', (byte) (0xff & i), (byte) (0xff & j) };
byte[] data = new byte[] { 'v', (byte) (0xff & i), (byte) (0xff & j) };
Key k = new Key(row, emptyBytes, emptyBytes, emptyBytes, 1);
Value v = new Value(data);
assertTrue(iter.hasNext());
Entry<Key, Value> entry = iter.next();
assertEquals(k, entry.getKey());
assertEquals(v, entry.getValue());
}
}
assertFalse(iter.hasNext());
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 256; j++) {
byte[] row = new byte[] { 'r', (byte) (0xff & i), (byte) (0xff & j) };
byte[] data = new byte[] { 'v', (byte) (0xff & i), (byte) (0xff & j) };
Key k = new Key(row, emptyBytes, emptyBytes, emptyBytes, 1);
Value v = new Value(data);
Value v2 = nm.get(k);
assertEquals(v, v2);
}
}
nm.delete();
}
use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.
the class NativeMapIT method test2.
@Test
public void test2() {
NativeMap nm = new NativeMap();
insertAndVerify(nm, 1, 10, 0);
insertAndVerify(nm, 1, 10, 1);
insertAndVerify(nm, 1, 10, 2);
nm.delete();
}
use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.
the class NativeMapIT method testEmpty.
@Test
public void testEmpty() {
NativeMap nm = new NativeMap();
assertTrue(nm.size() == 0);
assertTrue(nm.getMemoryUsed() == 0);
nm.delete();
}
use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.
the class NativeMapIT method test9.
@Test
public void test9() {
NativeMap nm = new NativeMap();
Iterator<Entry<Key, Value>> iter = nm.iterator();
try {
iter.next();
assertTrue(false);
} catch (NoSuchElementException e) {
}
insertAndVerify(nm, 1, 1, 0);
iter = nm.iterator();
iter.next();
try {
iter.next();
assertTrue(false);
} catch (NoSuchElementException e) {
}
nm.delete();
}
Aggregations