Search in sources :

Example 16 with NativeMap

use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.

the class NativeMapIT method test7.

@Test
public void test7() {
    NativeMap nm = new NativeMap();
    insertAndVerify(nm, 1, 10, 0);
    nm.delete();
    try {
        nm.delete();
        assertTrue(false);
    } catch (IllegalStateException e) {
    }
}
Also used : NativeMap(org.apache.accumulo.tserver.NativeMap) Test(org.junit.Test)

Example 17 with NativeMap

use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.

the class NativeMapIT method test4.

@Test
public void test4() {
    NativeMap nm = new NativeMap();
    insertAndVerifyExhaustive(nm, 3, 0);
    insertAndVerifyExhaustive(nm, 3, 1);
    nm.delete();
}
Also used : NativeMap(org.apache.accumulo.tserver.NativeMap) Test(org.junit.Test)

Example 18 with NativeMap

use of org.apache.accumulo.tserver.NativeMap in project accumulo by apache.

the class NativeMapIT method test8.

@Test
public void test8() {
    // test verifies that native map sorts keys sharing some common prefix properly
    NativeMap nm = new NativeMap();
    TreeMap<Key, Value> tm = new TreeMap<>();
    tm.put(new Key(new Text("fo")), new Value(new byte[] { '0' }));
    tm.put(new Key(new Text("foo")), new Value(new byte[] { '1' }));
    tm.put(new Key(new Text("foo1")), new Value(new byte[] { '2' }));
    tm.put(new Key(new Text("foo2")), new Value(new byte[] { '3' }));
    for (Entry<Key, Value> entry : tm.entrySet()) {
        nm.put(entry.getKey(), entry.getValue());
    }
    Iterator<Entry<Key, Value>> iter = nm.iterator();
    for (Entry<Key, Value> entry : tm.entrySet()) {
        assertTrue(iter.hasNext());
        Entry<Key, Value> entry2 = iter.next();
        assertEquals(entry.getKey(), entry2.getKey());
        assertEquals(entry.getValue(), entry2.getValue());
    }
    assertFalse(iter.hasNext());
    nm.delete();
}
Also used : Entry(java.util.Map.Entry) Value(org.apache.accumulo.core.data.Value) Text(org.apache.hadoop.io.Text) NativeMap(org.apache.accumulo.tserver.NativeMap) TreeMap(java.util.TreeMap) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Aggregations

NativeMap (org.apache.accumulo.tserver.NativeMap)18 Test (org.junit.Test)12 Entry (java.util.Map.Entry)10 Key (org.apache.accumulo.core.data.Key)7 Value (org.apache.accumulo.core.data.Value)7 ArrayList (java.util.ArrayList)4 Random (java.util.Random)4 Text (org.apache.hadoop.io.Text)3 TreeMap (java.util.TreeMap)2 JCommander (com.beust.jcommander.JCommander)1 HashMap (java.util.HashMap)1 NoSuchElementException (java.util.NoSuchElementException)1 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Mutation (org.apache.accumulo.core.data.Mutation)1 OpTimer (org.apache.accumulo.core.util.OpTimer)1 Pair (org.apache.accumulo.core.util.Pair)1