Search in sources :

Example 51 with ConcurrentSkipListMap

use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.

the class ConcurrentSkipListMapTest method testHigherKey.

/**
 * higherKey returns next element
 */
public void testHigherKey() {
    ConcurrentSkipListMap q = map5();
    Object e1 = q.higherKey(three);
    assertEquals(four, e1);
    Object e2 = q.higherKey(zero);
    assertEquals(one, e2);
    Object e3 = q.higherKey(five);
    assertNull(e3);
    Object e4 = q.higherKey(six);
    assertNull(e4);
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

Example 52 with ConcurrentSkipListMap

use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.

the class ConcurrentSkipListMapTest method testPutIfAbsent2.

/**
 * putIfAbsent does not add the pair if the key is already present
 */
public void testPutIfAbsent2() {
    ConcurrentSkipListMap map = map5();
    assertEquals("A", map.putIfAbsent(one, "Z"));
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

Example 53 with ConcurrentSkipListMap

use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.

the class ConcurrentSkipListMapTest method testReplace2.

/**
 * replace succeeds if the key is already present
 */
public void testReplace2() {
    ConcurrentSkipListMap map = map5();
    assertNotNull(map.replace(one, "Z"));
    assertEquals("Z", map.get(one));
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

Example 54 with ConcurrentSkipListMap

use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.

the class ConcurrentSkipListMapTest method testDescendingKeySetDescendingIteratorOrder.

/**
 * descending iterator of descendingKeySet is ordered
 */
public void testDescendingKeySetDescendingIteratorOrder() {
    ConcurrentSkipListMap map = map5();
    NavigableSet s = map.descendingKeySet();
    Iterator i = s.descendingIterator();
    Integer last = (Integer) i.next();
    assertEquals(last, one);
    int count = 1;
    while (i.hasNext()) {
        Integer k = (Integer) i.next();
        assertTrue(last.compareTo(k) < 0);
        last = k;
        ++count;
    }
    assertEquals(5, count);
}
Also used : NavigableSet(java.util.NavigableSet) ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap) Iterator(java.util.Iterator)

Example 55 with ConcurrentSkipListMap

use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.

the class ConcurrentSkipListMapTest method testEntrySetToArray.

/**
 * entrySet.toArray contains all entries
 */
public void testEntrySetToArray() {
    ConcurrentSkipListMap map = map5();
    Set s = map.entrySet();
    Object[] ar = s.toArray();
    assertEquals(5, ar.length);
    for (int i = 0; i < 5; ++i) {
        assertTrue(map.containsKey(((Map.Entry) (ar[i])).getKey()));
        assertTrue(map.containsValue(((Map.Entry) (ar[i])).getValue()));
    }
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap) Set(java.util.Set) NavigableSet(java.util.NavigableSet) BitSet(java.util.BitSet)

Aggregations

ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)183 Test (org.junit.Test)66 PollStatus (org.opennms.netmgt.poller.PollStatus)32 MonitoredService (org.opennms.netmgt.poller.MonitoredService)31 Map (java.util.Map)30 ServiceMonitor (org.opennms.netmgt.poller.ServiceMonitor)25 MqttDeviceTwin (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttDeviceTwin)23 HashMap (java.util.HashMap)21 DeviceTwinMessage (com.microsoft.azure.sdk.iot.device.DeviceTwin.DeviceTwinMessage)17 NavigableMap (java.util.NavigableMap)14 Set (java.util.Set)12 Iterator (java.util.Iterator)11 NavigableSet (java.util.NavigableSet)11 MockMonitoredService (org.opennms.netmgt.poller.mock.MockMonitoredService)11 IOException (java.io.IOException)10 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)10 ArrayList (java.util.ArrayList)9 BitSet (java.util.BitSet)9 DeviceOperations (com.microsoft.azure.sdk.iot.device.DeviceTwin.DeviceOperations)8 JUnitHttpServer (org.opennms.core.test.http.annotations.JUnitHttpServer)8