1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.apache.jetspeed.prefs;
24
25 import java.util.prefs.Preferences;
26
27 import org.apache.jetspeed.prefs.util.test.AbstractPrefsSupportedTestCase;
28
29 /***
30 * <p>
31 * TestPreferencesNoPropManager
32 * </p>
33 *
34 * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
35 * @version $Id: TestPreferencesNoPropManager.java 516881 2007-03-11 10:34:21Z ate $
36 */
37 public class TestPreferencesNoPropManager extends AbstractPrefsSupportedTestCase
38 {
39
40 /***
41 * @see junit.framework.TestCase#setUp()
42 */
43 public void setUp() throws Exception
44 {
45 super.setUp();
46
47
48 clearChildren(Preferences.userRoot());
49 clearChildren(Preferences.systemRoot());
50
51 }
52
53 /***
54 * @see junit.framework.TestCase#tearDown()
55 */
56 public void tearDown() throws Exception
57 {
58 super.tearDown();
59 }
60
61 protected void clearChildren(Preferences node) throws Exception
62 {
63 String[] names = node.childrenNames();
64 for (int i = 0; i < names.length; i++)
65 {
66 node.node(names[i]).removeNode();
67 }
68 }
69
70 /***
71 * <p>
72 * Legacy test from the times where we add a property manager. The property manager is
73 * since gone, but the test still tests the prefs implementation.
74 * </p>
75 *
76 * @throws Exception
77 */
78 public void testSansPropertyManager() throws Exception
79 {
80
81
82 clearChildren(Preferences.userRoot());
83 clearChildren(Preferences.systemRoot());
84
85 Preferences pref0 = Preferences.userRoot();
86
87 Preferences pref1 = pref0.node("testOpenNode");
88 pref1.put("0", "I am 0 key");
89
90 assertNotNull(pref1.get("0", null));
91
92 }
93
94 /***
95 * @see org.apache.jetspeed.components.test.AbstractSpringTestCase#getConfigurations()
96 */
97 protected String[] getConfigurations()
98 {
99 return new String[]
100 { "prefs.xml", "transaction.xml", "cache.xml" };
101 }
102 }