You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2013/05/24 12:45:45 UTC

[jira] [Created] (CAY-1827) EhCache regeion corresponding to a cache group loses it settings after 'removeGroup'

Andrus Adamchik created CAY-1827:
------------------------------------

             Summary: EhCache regeion corresponding to a cache group loses it settings after 'removeGroup'
                 Key: CAY-1827
                 URL: https://issues.apache.org/jira/browse/CAY-1827
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 3.1B2, 3.2M1
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik


Here is a unit test showing how the cache region is destroyed and recreated by calling 'removeGroup'. All 'c3' assertions fail.

        EhCacheQueryCache cache = new EhCacheQueryCache(cacheManager);

        Object[] lists = new Object[] { new ArrayList<Object>(), new ArrayList<Object>(), new ArrayList<Object>() };
        QueryCacheEntryFactory factory = mock(QueryCacheEntryFactory.class);
        when(factory.createObject()).thenReturn(lists[0], lists[1], lists[2]);

        QueryMetadata md = mock(QueryMetadata.class);
        when(md.getCacheKey()).thenReturn("k1");
        when(md.getCacheGroups()).thenReturn(new String[] { "cg1" });

        assertEquals(lists[0], cache.get(md, factory));
        assertEquals(lists[0], cache.get(md, factory));

        Cache c1 = cache.cacheManager.getCache("cg1");
        assertEquals(201, c1.getCacheConfiguration().getTimeToLiveSeconds());

        cache.removeGroup("cg1");
        assertEquals(lists[1], cache.get(md, factory));

        // make sure the cache still has all the configured settings after
        // 'removeGroup'
        Cache c3 = cache.cacheManager.getCache("cg1");
        assertSame(c1, c3);
        assertEquals(201, c3.getCacheConfiguration().getTimeToLiveSeconds());

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira