cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAY-1827) EhCache regeion corresponding to a cache group loses it settings after 'removeGroup'
Date Fri, 24 May 2013 10:45:45 GMT
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

Mime
View raw message