1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package org.jboss.cache.eviction; |
8 |
| |
9 |
| import junit.framework.TestCase; |
10 |
| import org.jboss.cache.factories.XmlConfigurationParser; |
11 |
| import org.jboss.cache.xml.XmlHelper; |
12 |
| import org.w3c.dom.Element; |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| public class LFUConfigurationTest extends TestCase |
21 |
| { |
22 |
| |
23 |
1
| public void testXMLParsing() throws Exception
|
24 |
| { |
25 |
1
| LFUConfiguration config = new LFUConfiguration();
|
26 |
1
| String xml =
|
27 |
| "<region name=\"abc\">" + |
28 |
| "<attribute name=\"minNodes\">10</attribute>" + |
29 |
| "<attribute name=\"maxNodes\">20</attribute>" + |
30 |
| "</region>"; |
31 |
| |
32 |
1
| Element element = XmlHelper.stringToElement(xml);
|
33 |
| |
34 |
1
| XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
|
35 |
| |
36 |
1
| assertEquals(10, config.getMinNodes());
|
37 |
1
| assertEquals(20, config.getMaxNodes());
|
38 |
| } |
39 |
| |
40 |
1
| public void testXMLParsing2() throws Exception
|
41 |
| { |
42 |
1
| LFUConfiguration config = new LFUConfiguration();
|
43 |
1
| String xml =
|
44 |
| "<region name=\"abc\">" + |
45 |
| "<attribute name=\"minNodes\">10</attribute>" + |
46 |
| "</region>"; |
47 |
1
| Element element = XmlHelper.stringToElement(xml);
|
48 |
| |
49 |
1
| XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
|
50 |
| |
51 |
1
| assertEquals(10, config.getMinNodes());
|
52 |
1
| assertEquals(0, config.getMaxNodes());
|
53 |
| } |
54 |
| |
55 |
1
| public void testXMLParsing3() throws Exception
|
56 |
| { |
57 |
1
| LFUConfiguration config = new LFUConfiguration();
|
58 |
1
| String xml =
|
59 |
| "<region name=\"abc\">" + |
60 |
| "<attribute name=\"maxNodes\">20</attribute>" + |
61 |
| "</region>"; |
62 |
1
| Element element = XmlHelper.stringToElement(xml);
|
63 |
| |
64 |
1
| XmlConfigurationParser.parseEvictionPolicyConfig(element, config);
|
65 |
| |
66 |
1
| assertEquals(0, config.getMinNodes());
|
67 |
1
| assertEquals(20, config.getMaxNodes());
|
68 |
| |
69 |
| } |
70 |
| } |