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