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 junit.framework.Test;
21 import junit.framework.TestCase;
22
23 import org.apache.commons.logging.PathableClassLoader;
24 import org.apache.commons.logging.PathableTestSuite;
25 import org.apache.commons.logging.impl.ServletContextCleaner;
26
27
28
29
30
31
32 public class BasicServletTestCase extends TestCase {
33
34
35
36
37 public static Test suite() throws Exception {
38
39
40
41
42
43
44
45
46 PathableClassLoader parent = new PathableClassLoader(null);
47 parent.useExplicitLoader("junit.", Test.class.getClassLoader());
48 parent.addLogicalLib("commons-logging");
49 parent.addLogicalLib("servlet-api");
50
51 PathableClassLoader child = new PathableClassLoader(parent);
52 child.setParentFirst(false);
53 child.addLogicalLib("commons-logging");
54 child.addLogicalLib("testclasses");
55
56 PathableClassLoader tccl = new PathableClassLoader(child);
57 tccl.setParentFirst(false);
58 tccl.addLogicalLib("commons-logging");
59
60 Class testClass = child.loadClass(BasicServletTestCase.class.getName());
61 return new PathableTestSuite(testClass, tccl);
62 }
63
64
65
66
67
68 public void testBasics() {
69 ServletContextCleaner scc = new ServletContextCleaner();
70 scc.contextDestroyed(null);
71 }
72 }