01: /**
02: * Copyright 2003-2007 Luck Consulting Pty Ltd
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */package net.sf.ehcache.store;
16:
17: import java.util.Map;
18:
19: /**
20: * Test cases for the Apache version of LruMemoryStore.
21: * <p/>
22: * @author Greg Luck
23: * @version $Id: ApacheLruMemoryStoreTest.java 519 2007-07-27 07:11:45Z gregluck $
24: */
25: public class ApacheLruMemoryStoreTest extends LruMemoryStoreTest {
26:
27: /**
28: * setup test
29: */
30: protected void setUp() throws Exception {
31: System.setProperty("net.sf.ehcache.useLRUMap", "true");
32: super .setUp();
33: }
34:
35: /**
36: * Put back system default.
37: * @throws Exception
38: */
39: protected void tearDown() throws Exception {
40: System.getProperties().remove("net.sf.ehcache.useLRUMap");
41: super .tearDown();
42: }
43:
44: /**
45: * The LRU map implementation can be overridden by setting the "net.sf.ehcache.useLRUMap" System property.
46: */
47: public void testCorrectMapImplementation() throws Exception {
48: createMemoryStore(MemoryStoreEvictionPolicy.LRU, 5);
49:
50: Map map = ((MemoryStore) store).getBackingMap();
51: assertTrue(map instanceof org.apache.commons.collections.LRUMap);
52: }
53: }
|