01: /*
02: * Created on 18.11.2005
03: * Author Sergey Pariev, spariev@gmail.com
04: */
05: package org.jzonic.webtester.commands;
06:
07: import org.jzonic.webtester.WebTestContext;
08:
09: /**
10: * This command will save the url prefix and everytime get_html
11: * is called the url prefix will be used to construct full url.
12: * <br/>
13: * parameter: urlPrefix
14: * <br/>
15: * examples:
16: * <br/>
17: * set_url_prefix | http://localhost:8080/myapp
18: * <br/>
19: * and then use
20: * <br/>
21: * get_html | /mypage.jsp
22: * <br/>
23: * instead of
24: * <br/>
25: * get_html | http://localhost:8080/myapp/mypage.jsp
26: *
27: * @author Sergey Pariev (spariev@gmail.com)
28: */
29: public class SetUrlPrefixCommand implements WebTestNode {
30:
31: public static final String COMMAND_NAME = "set_url_prefix";
32: private String urlPrefix;
33:
34: public void setParameter(String value) {
35: urlPrefix = value;
36: }
37:
38: public WebTestNodeResult execute(WebTestContext context) {
39: WebTestNodeResult result = new WebTestNodeResult(COMMAND_NAME,
40: urlPrefix);
41: context.setUrlPrefix(urlPrefix);
42: result.setSuccess(true);
43: return result;
44: }
45:
46: public String getName() {
47: return COMMAND_NAME;
48: }
49:
50: }
|