1 package org.apache.turbine.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import junit.framework.TestSuite;
20
21 import org.apache.commons.configuration.BaseConfiguration;
22 import org.apache.commons.configuration.Configuration;
23
24 import org.apache.turbine.services.ServiceManager;
25 import org.apache.turbine.services.TurbineServices;
26 import org.apache.turbine.test.BaseTestCase;
27 import org.apache.turbine.util.parser.ParserUtils;
28
29 /***
30 * Testing of the DynamicURI class
31 *
32 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
33 * @version $Id: DynamicURITest.java 264148 2005-08-29 14:21:04Z henning $
34 */
35 public class DynamicURITest extends BaseTestCase
36 {
37 private DynamicURI duri;
38
39 /***
40 * Constructor for test.
41 *
42 * @param testName name of the test being executed
43 */
44 public DynamicURITest(String testName)
45 throws Exception
46 {
47 super(testName);
48
49
50 ServiceManager serviceManager = TurbineServices.getInstance();
51 serviceManager.setApplicationRoot(".");
52 Configuration cfg = new BaseConfiguration();
53 cfg.setProperty(ParserUtils.URL_CASE_FOLDING_KEY,
54 ParserUtils.URL_CASE_FOLDING_LOWER_VALUE );
55 serviceManager.setConfiguration(cfg);
56
57 }
58
59 /***
60 * Performs any initialization that must happen before each test is run.
61 */
62 protected void setUp()
63 {
64 ServerData sd = new ServerData("www.testserver.com", 80, "http",
65 "/servlet/turbine", "/context");
66 duri = new DynamicURI(sd);
67 }
68
69 /***
70 * Clean up after each test is run.
71 */
72 protected void tearDown()
73 {
74 duri = null;
75 }
76
77 /***
78 * Factory method for creating a TestSuite for this class.
79 *
80 * @return the test suite
81 */
82 public static TestSuite suite()
83 {
84 TestSuite suite = new TestSuite(DynamicURITest.class);
85 return suite;
86 }
87
88 public void testAddRemove()
89 {
90 duri.addPathInfo("test","x").removePathInfo("test");
91 duri.addQueryData("test2","x").removeQueryData("test2");
92 }
93
94 }