Search in sources :

Example 41 with CustomEntryConcurrentHashMap

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

the class ConcurrentHashMapJUnitTest method testKeySetToArray.

/**
   * keySet.toArray returns contains all keys
   */
@Test
public void testKeySetToArray() {
    CustomEntryConcurrentHashMap map = map5();
    Set s = map.keySet();
    Object[] ar = s.toArray();
    assertTrue(s.containsAll(Arrays.asList(ar)));
    assertEquals(5, ar.length);
    ar[0] = m10;
    assertFalse(s.containsAll(Arrays.asList(ar)));
}
Also used : Set(java.util.Set) CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 42 with CustomEntryConcurrentHashMap

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

the class ConcurrentHashMapJUnitTest method testGet_NullPointerException.

/**
   * get(null) throws NPE
   */
@Test
public void testGet_NullPointerException() {
    try {
        CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
        c.get(null);
        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)

Example 43 with CustomEntryConcurrentHashMap

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

the class ConcurrentHashMapJUnitTest method testReplaceValue.

/**
   * replace value fails when the given key not mapped to expected value
   */
@Test
public void testReplaceValue() {
    CustomEntryConcurrentHashMap map = map5();
    assertEquals("A", map.get(one));
    assertFalse(map.replace(one, "Z", "Z"));
    assertEquals("A", 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 44 with CustomEntryConcurrentHashMap

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

the class ConcurrentHashMapJUnitTest method testToString.

/**
   * toString contains toString of elements
   */
@Test
public void testToString() {
    CustomEntryConcurrentHashMap map = map5();
    String s = map.toString();
    for (int i = 1; i <= 5; ++i) {
        assertTrue(s.indexOf(String.valueOf(i)) >= 0);
    }
}
Also used : CustomEntryConcurrentHashMap(org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 45 with CustomEntryConcurrentHashMap

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

the class ConcurrentHashMapJUnitTest method testReplaceValue3_NullPointerException.

/**
   * replace(x, y, null) throws NPE
   */
@Test
public void testReplaceValue3_NullPointerException() {
    try {
        CustomEntryConcurrentHashMap c = new CustomEntryConcurrentHashMap(5);
        c.replace("whatever", one, null);
        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