Skip to content

Commit 22345f7

Browse files
committed
Upgrade tests to EhCache 2.10+
Issue: SPR-13794
1 parent f7f37cd commit 22345f7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheSupportTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -119,7 +119,7 @@ public void testCacheManagerFromConfigFile() throws Exception {
119119
assertTrue("Correct number of caches loaded", cm.getCacheNames().length == 1);
120120
Cache myCache1 = cm.getCache("myCache1");
121121
assertFalse("myCache1 is not eternal", myCache1.getCacheConfiguration().isEternal());
122-
assertTrue("myCache1.maxElements == 300", myCache1.getCacheConfiguration().getMaxElementsInMemory() == 300);
122+
assertTrue("myCache1.maxElements == 300", myCache1.getCacheConfiguration().getMaxEntriesLocalHeap() == 300);
123123
}
124124
finally {
125125
cacheManagerFb.destroy();
@@ -162,10 +162,10 @@ private void doTestEhCacheFactoryBean(boolean useCacheManagerFb) throws Exceptio
162162
CacheConfiguration config = cache.getCacheConfiguration();
163163
assertEquals("myCache1", cache.getName());
164164
if (useCacheManagerFb){
165-
assertEquals("myCache1.maxElements", 300, config.getMaxElementsInMemory());
165+
assertEquals("myCache1.maxElements", 300, config.getMaxEntriesLocalHeap());
166166
}
167167
else {
168-
assertEquals("myCache1.maxElements", 10000, config.getMaxElementsInMemory());
168+
assertEquals("myCache1.maxElements", 10000, config.getMaxEntriesLocalHeap());
169169
}
170170

171171
// Cache region is not defined. Should create one with default properties.
@@ -178,7 +178,7 @@ private void doTestEhCacheFactoryBean(boolean useCacheManagerFb) throws Exceptio
178178
cache = (Cache) cacheFb.getObject();
179179
config = cache.getCacheConfiguration();
180180
assertEquals("undefinedCache", cache.getName());
181-
assertTrue("default maxElements is correct", config.getMaxElementsInMemory() == 10000);
181+
assertTrue("default maxElements is correct", config.getMaxEntriesLocalHeap() == 10000);
182182
assertFalse("default eternal is correct", config.isEternal());
183183
assertTrue("default timeToLive is correct", config.getTimeToLiveSeconds() == 120);
184184
assertTrue("default timeToIdle is correct", config.getTimeToIdleSeconds() == 120);
@@ -190,7 +190,7 @@ private void doTestEhCacheFactoryBean(boolean useCacheManagerFb) throws Exceptio
190190
cacheFb.setCacheManager(cacheManagerFb.getObject());
191191
}
192192
cacheFb.setBeanName("undefinedCache2");
193-
cacheFb.setMaxElementsInMemory(5);
193+
cacheFb.setMaxEntriesLocalHeap(5);
194194
cacheFb.setTimeToLive(8);
195195
cacheFb.setTimeToIdle(7);
196196
cacheFb.setDiskExpiryThreadIntervalSeconds(10);
@@ -199,7 +199,7 @@ private void doTestEhCacheFactoryBean(boolean useCacheManagerFb) throws Exceptio
199199
config = cache.getCacheConfiguration();
200200

201201
assertEquals("undefinedCache2", cache.getName());
202-
assertTrue("overridden maxElements is correct", config.getMaxElementsInMemory() == 5);
202+
assertTrue("overridden maxElements is correct", config.getMaxEntriesLocalHeap() == 5);
203203
assertTrue("default timeToLive is correct", config.getTimeToLiveSeconds() == 8);
204204
assertTrue("default timeToIdle is correct", config.getTimeToIdleSeconds() == 7);
205205
assertTrue("overridden diskExpiryThreadIntervalSeconds is correct", config.getDiskExpiryThreadIntervalSeconds() == 10);
@@ -253,7 +253,7 @@ public Object createEntry(Object key) throws Exception {
253253
cacheFb.afterPropertiesSet();
254254
Ehcache myCache1 = cm.getEhcache("myCache1");
255255
assertTrue(myCache1 instanceof SelfPopulatingCache);
256-
assertEquals("myKey1", myCache1.get("myKey1").getValue());
256+
assertEquals("myKey1", myCache1.get("myKey1").getObjectValue());
257257
}
258258
finally {
259259
cacheManagerFb.destroy();
@@ -282,7 +282,7 @@ public void updateEntryValue(Object key, Object value) throws Exception {
282282
cacheFb.afterPropertiesSet();
283283
Ehcache myCache1 = cm.getEhcache("myCache1");
284284
assertTrue(myCache1 instanceof UpdatingSelfPopulatingCache);
285-
assertEquals("myKey1", myCache1.get("myKey1").getValue());
285+
assertEquals("myKey1", myCache1.get("myKey1").getObjectValue());
286286
}
287287
finally {
288288
cacheManagerFb.destroy();

0 commit comments

Comments
 (0)