Search in sources :

Example 1 with CustomEntryConcurrentHashMap

use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.

the class ConcurrentHashMapJUnitTest method testReplace.

/**
   * replace fails when the given key is not present
   */
@Test
public void testReplace() {
    CustomEntryConcurrentHashMap map = map5();
    assertNull(map.replace(six, "Z"));
    assertFalse(map.containsKey(six));
}
Also used : CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 2 with CustomEntryConcurrentHashMap

use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.

the class ConcurrentHashMapJUnitTest method testContains.

/**
   * contains returns true for contained value
   */
@Test
public void testContains() {
    CustomEntryConcurrentHashMap map = map5();
    assertTrue(map.contains("A"));
    assertFalse(map.contains("Z"));
}
Also used : CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 3 with CustomEntryConcurrentHashMap

use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.

the class ConcurrentHashMapJUnitTest method testReplaceValue2.

/**
   * replace value succeeds when the given key mapped to expected value
   */
@Test
public void testReplaceValue2() {
    CustomEntryConcurrentHashMap map = map5();
    assertEquals("A", map.get(one));
    assertTrue(map.replace(one, "A", "Z"));
    assertEquals("Z", map.get(one));
}
Also used : CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 4 with CustomEntryConcurrentHashMap

use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.

the class ConcurrentHashMapJUnitTest method testContainsKey.

/**
   * containsKey returns true for contained key
   */
@Test
public void testContainsKey() {
    CustomEntryConcurrentHashMap map = map5();
    assertTrue(map.containsKey(one));
    assertFalse(map.containsKey(zero));
}
Also used : CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 5 with CustomEntryConcurrentHashMap

use of org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap in project geode by apache.

the class ConcurrentHashMapJUnitTest method testRemove2_NullPointerException.

/**
   * remove(null, x) throws NPE
   */
@Test
public void testRemove2_NullPointerException() {
    try {
        CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
        c.put("sadsdf", "asdads");
        c.remove(null, "whatever");
        shouldThrow();
    } catch (NullPointerException e) {
    }
}
Also used : CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

CustomEntryConcurrentHashMap (org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap)46 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)44 Test (org.junit.Test)44 Set (java.util.Set)4 Map (java.util.Map)3 Collection (java.util.Collection)2 Enumeration (java.util.Enumeration)2 BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 LRUEntry (org.apache.geode.internal.cache.lru.LRUEntry)1 VersionTag (org.apache.geode.internal.cache.versions.VersionTag)1 StoredObject (org.apache.geode.internal.offheap.StoredObject)1 Released (org.apache.geode.internal.offheap.annotations.Released)1 Retained (org.apache.geode.internal.offheap.annotations.Retained)1