Search in sources :

Example 6 with BitHashSet

use of org.apache.zookeeper.server.util.BitHashSet in project zookeeper by apache.

the class WatcherOrBitSetTest method testBitSet.

@Test
public void testBitSet() {
    BitHashSet bset = new BitHashSet(0);
    WatcherOrBitSet bitSet = new WatcherOrBitSet(bset);
    assertEquals(0, bitSet.size());
    Integer bit = 1;
    assertFalse(bitSet.contains(1));
    assertFalse(bitSet.contains(bit));
    bset.add(bit);
    assertTrue(bitSet.contains(1));
    assertTrue(bitSet.contains(bit));
    assertEquals(1, bitSet.size());
}
Also used : BitHashSet(org.apache.zookeeper.server.util.BitHashSet) Test(org.junit.jupiter.api.Test)

Aggregations

BitHashSet (org.apache.zookeeper.server.util.BitHashSet)6 Watcher (org.apache.zookeeper.Watcher)4 BitSet (java.util.BitSet)3 HashSet (java.util.HashSet)3 Set (java.util.Set)3 HashMap (java.util.HashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ServerCnxn (org.apache.zookeeper.server.ServerCnxn)2 WatchedEvent (org.apache.zookeeper.WatchedEvent)1 Test (org.junit.jupiter.api.Test)1