01: package org.apache.turbine.util;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
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: private DynamicURI duri;
40:
41: /**
42: * Constructor for test.
43: *
44: * @param testName name of the test being executed
45: */
46: public DynamicURITest(String testName) throws Exception {
47: super (testName);
48:
49: // Setup configuration
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: ServerData sd = new ServerData("www.testserver.com", 80,
64: "http", "/servlet/turbine", "/context");
65: duri = new DynamicURI(sd);
66: }
67:
68: /**
69: * Clean up after each test is run.
70: */
71: protected void tearDown() {
72: duri = null;
73: }
74:
75: /**
76: * Factory method for creating a TestSuite for this class.
77: *
78: * @return the test suite
79: */
80: public static TestSuite suite() {
81: TestSuite suite = new TestSuite(DynamicURITest.class);
82: return suite;
83: }
84:
85: public void testAddRemove() {
86: duri.addPathInfo("test", "x").removePathInfo("test");
87: duri.addQueryData("test2", "x").removeQueryData("test2");
88: }
89:
90: }
|