1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.logging.servlet;
19
20 import org.apache.commons.logging.PathableClassLoader;
21 import org.apache.commons.logging.PathableTestSuite;
22 import org.apache.commons.logging.impl.ServletContextCleaner;
23
24 import junit.framework.Test;
25 import junit.framework.TestCase;
26
27
28
29
30
31 public class BasicServletTestCase extends TestCase {
32
33
34
35
36 public static Test suite() throws Exception {
37
38
39
40
41
42
43
44
45 final PathableClassLoader parent = new PathableClassLoader(null);
46 parent.useExplicitLoader("junit.", Test.class.getClassLoader());
47 parent.addLogicalLib("commons-logging");
48 parent.addLogicalLib("servlet-api");
49
50 final PathableClassLoader child = new PathableClassLoader(parent);
51 child.setParentFirst(false);
52 child.addLogicalLib("commons-logging");
53 child.addLogicalLib("testclasses");
54
55 final PathableClassLoader tccl = new PathableClassLoader(child);
56 tccl.setParentFirst(false);
57 tccl.addLogicalLib("commons-logging");
58
59 final Class testClass = child.loadClass(BasicServletTestCase.class.getName());
60 return new PathableTestSuite(testClass, tccl);
61 }
62
63
64
65
66
67 public void testBasics() {
68 final ServletContextCleaner scc = new ServletContextCleaner();
69 scc.contextDestroyed(null);
70 }
71 }