Search in sources :

Example 56 with ConcurrentSkipListMap

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

the class ConcurrentSkipListMapTest method testCeilingKey.

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

Example 57 with ConcurrentSkipListMap

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

the class ConcurrentSkipListMapTest method testReplaceValue2.

/**
 * replace value succeeds when the given key mapped to expected value
 */
public void testReplaceValue2() {
    ConcurrentSkipListMap map = map5();
    assertEquals("A", map.get(one));
    assertTrue(map.replace(one, "A", "Z"));
    assertEquals("Z", map.get(one));
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

Example 58 with ConcurrentSkipListMap

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

the class ConcurrentSkipListSubMapTest method map5.

// android-note: Removed because the CTS runner does a bad job of
// retrying tests that have suite() declarations.
// 
// public static void main(String[] args) {
// main(suite(), args);
// }
// public static Test suite() {
// return new TestSuite(ConcurrentSkipListSubMapTest.class);
// }
/**
 * Returns a new map from Integers 1-5 to Strings "A"-"E".
 */
private static ConcurrentNavigableMap map5() {
    ConcurrentSkipListMap map = new ConcurrentSkipListMap();
    assertTrue(map.isEmpty());
    map.put(zero, "Z");
    map.put(one, "A");
    map.put(five, "E");
    map.put(three, "C");
    map.put(two, "B");
    map.put(four, "D");
    map.put(seven, "F");
    assertFalse(map.isEmpty());
    assertEquals(7, map.size());
    return map.subMap(one, true, seven, false);
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

Example 59 with ConcurrentSkipListMap

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

the class ConcurrentSkipListMapTest method testLowerKey.

/**
 * lowerKey returns preceding element
 */
public void testLowerKey() {
    ConcurrentSkipListMap 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 : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

Example 60 with ConcurrentSkipListMap

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

the class ConcurrentSkipListMapTest method testGet.

/**
 * get returns the correct element at the given key,
 * or null if not present
 */
public void testGet() {
    ConcurrentSkipListMap map = map5();
    assertEquals("A", (String) map.get(one));
    ConcurrentSkipListMap empty = new ConcurrentSkipListMap();
    assertNull(empty.get(one));
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap)

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