01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.jmeter.util;
20:
21: import junit.framework.TestCase;
22:
23: public class PackageTest extends TestCase {
24:
25: public PackageTest() {
26: super ();
27: }
28:
29: public PackageTest(String arg0) {
30: super (arg0);
31: }
32:
33: public void testServer() throws Exception {
34: BeanShellServer bshs = new BeanShellServer(9876, "");
35: assertNotNull(bshs);
36: // Not sure we can test anything else here
37: }
38:
39: public void testSub1() throws Exception {
40: String input = "http://jakarta.apache.org/jmeter/index.html";
41: String pattern = "jakarta.apache.org";
42: String sub = "${server}";
43: assertEquals("http://${server}/jmeter/index.html",
44: StringUtilities.substitute(input, pattern, sub));
45: }
46:
47: public void testSub2() throws Exception {
48: String input = "arg1=param1;param1";
49: String pattern = "param1";
50: String sub = "${value}";
51: assertEquals("arg1=${value};${value}", StringUtilities
52: .substitute(input, pattern, sub));
53: }
54:
55: public void testSub3() throws Exception {
56: String input = "jakarta.apache.org";
57: String pattern = "jakarta.apache.org";
58: String sub = "${server}";
59: assertEquals("${server}", StringUtilities.substitute(input,
60: pattern, sub));
61: }
62:
63: public void testSub4() throws Exception {
64: String input = "//a///b////c";
65: String pattern = "//";
66: String sub = "/";
67: assertEquals("/a//b//c", StringUtilities.substitute(input,
68: pattern, sub));
69: }
70:
71: }
|