Search in sources :

Example 21 with ConcurrentNavigableMap

use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.

the class ConcurrentSkipListSubMapTest method testDescendingKeySet.

/**
     * keySet returns a Set containing all the keys
     */
@Test
public void testDescendingKeySet() {
    ConcurrentNavigableMap map = dmap5();
    Set s = map.keySet();
    assertEquals(5, s.size());
    assertTrue(s.contains(m1));
    assertTrue(s.contains(m2));
    assertTrue(s.contains(m3));
    assertTrue(s.contains(m4));
    assertTrue(s.contains(m5));
}
Also used : Set(java.util.Set) ConcurrentNavigableMap(java.util.concurrent.ConcurrentNavigableMap) Test(org.junit.Test)

Example 22 with ConcurrentNavigableMap

use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.

the class ConcurrentSkipListSubMapTest method testRemove2_NullPointerException.

/**
     * remove(null, x) throws NPE
     */
@Test
public void testRemove2_NullPointerException() {
    try {
        ConcurrentNavigableMap c = map5();
        c.remove(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentNavigableMap(java.util.concurrent.ConcurrentNavigableMap) Test(org.junit.Test)

Example 23 with ConcurrentNavigableMap

use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.

the class ConcurrentSkipListSubMapTest method testEquals.

/**
     * Maps with same contents are equal
     */
@Test
public void testEquals() {
    ConcurrentNavigableMap map1 = map5();
    ConcurrentNavigableMap map2 = map5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    if (isReadOnly())
        return;
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
Also used : ConcurrentNavigableMap(java.util.concurrent.ConcurrentNavigableMap) Test(org.junit.Test)

Example 24 with ConcurrentNavigableMap

use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.

the class ConcurrentSkipListSubMapTest method testDescendingEquals.

/**
     * Maps with same contents are equal
     */
@Test
public void testDescendingEquals() {
    ConcurrentNavigableMap map1 = dmap5();
    ConcurrentNavigableMap map2 = dmap5();
    assertEquals(map1, map2);
    assertEquals(map2, map1);
    if (isReadOnly())
        return;
    map1.clear();
    assertFalse(map1.equals(map2));
    assertFalse(map2.equals(map1));
}
Also used : ConcurrentNavigableMap(java.util.concurrent.ConcurrentNavigableMap) Test(org.junit.Test)

Example 25 with ConcurrentNavigableMap

use of java.util.concurrent.ConcurrentNavigableMap in project mapdb by jankotek.

the class ConcurrentSkipListMapTest method testLowerKey.

/**
     * lowerKey returns preceding element
     */
@Test
public void testLowerKey() {
    ConcurrentNavigableMap q = map5();
    Object e1 = q.lowerKey(three);
    assertEquals(two, e1);
    Object e2 = q.lowerKey(six);
    assertEquals(five, e2);
    Object e3 = q.lowerKey(one);
    assertNull(e3);
    Object e4 = q.lowerKey(zero);
    assertNull(e4);
}
Also used : ConcurrentNavigableMap(java.util.concurrent.ConcurrentNavigableMap) Test(org.junit.Test)

Aggregations

ConcurrentNavigableMap (java.util.concurrent.ConcurrentNavigableMap)156 Test (org.junit.Test)147 SortedMap (java.util.SortedMap)25 Map (java.util.Map)19 NavigableMap (java.util.NavigableMap)19 Iterator (java.util.Iterator)12 Set (java.util.Set)10 Collection (java.util.Collection)4 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)4 Update (co.cask.cdap.data2.dataset2.lib.table.Update)3 ArrayList (java.util.ArrayList)2 IncrementValue (co.cask.cdap.data2.dataset2.lib.table.IncrementValue)1 PutValue (co.cask.cdap.data2.dataset2.lib.table.PutValue)1 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 HashMap (java.util.HashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1