use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testGet.
/**
* get returns the correct element at the given key, or null if not present
*/
@Test
public void testGet() {
CustomEntryConcurrentHashMap map = map5();
assertEquals("A", (String) map.get(one));
CustomEntryConcurrentHashMap empty = new CustomEntryConcurrentHashMap();
assertNull(map.get("anything"));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testSize.
/**
* size returns the correct values
*/
@Test
public void testSize() {
CustomEntryConcurrentHashMap map = map5();
CustomEntryConcurrentHashMap empty = new CustomEntryConcurrentHashMap();
assertEquals(0, empty.size());
assertEquals(5, map.size());
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testRemove.
/**
* remove removes the correct key-value pair from the map
*/
@Test
public void testRemove() {
CustomEntryConcurrentHashMap map = map5();
map.remove(five);
assertEquals(4, map.size());
assertFalse(map.containsKey(five));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testKeySet.
/**
* keySet returns a Set containing all the keys
*/
@Test
public void testKeySet() {
CustomEntryConcurrentHashMap map = map5();
Set s = map.keySet();
assertEquals(5, s.size());
assertTrue(s.contains(one));
assertTrue(s.contains(two));
assertTrue(s.contains(three));
assertTrue(s.contains(four));
assertTrue(s.contains(five));
}
use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.
the class ConcurrentHashMapJUnitTest method testSerialization.
/**
* A deserialized map equals original
*/
@Test
public void testSerialization() {
CustomEntryConcurrentHashMap q = map5();
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
out.writeObject(q);
out.close();
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
CustomEntryConcurrentHashMap r = (CustomEntryConcurrentHashMap) in.readObject();
assertEquals(q.size(), r.size());
assertTrue(q.equals(r));
assertTrue(r.equals(q));
} catch (Exception e) {
e.printStackTrace();
unexpectedException();
}
}
Aggregations