1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.jndi;
18
19
20 import org.apache.ldap.server.AbstractCoreTest;
21
22
23 /***
24 * Tests the shutdown operation on the JNDI provider.
25 *
26 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
27 * @version $Rev$
28 */
29 public class ShutdownTest extends AbstractCoreTest
30 {
31 protected void tearDown() throws Exception
32 {
33
34
35
36 sysRoot = null;
37 }
38
39
40 /***
41 *
42 * @throws Exception if the test fails by generating a null context
43 */
44 public void testShutdownNonNullContext() throws Exception
45 {
46 overrides.put( EnvKeys.SHUTDOWN, "true" );
47
48 try
49 {
50 setSysRoot( "uid=admin,ou=system", "secret" );
51 }
52 finally
53 {
54 overrides.remove( EnvKeys.SHUTDOWN );
55 }
56
57 assertNotNull( sysRoot );
58 }
59
60
61 /***
62 *
63 *
64 * @throws Exception
65 */
66 public void testShutdownRestart() throws Exception
67 {
68 overrides.put( EnvKeys.SHUTDOWN, "true" );
69
70 try
71 {
72 setSysRoot( "uid=admin,ou=system", "secret" );
73 }
74 finally
75 {
76 overrides.remove( EnvKeys.SHUTDOWN );
77 }
78
79 assertNotNull( sysRoot );
80
81
82 setSysRoot( "uid=admin,ou=system", "secret" );
83 }
84 }