SetUrlPrefixCommand.java :  » Testing » slimdog » org » jzonic » webtester » commands » Java Open Source

Java Open Source » Testing » slimdog 
slimdog » org » jzonic » webtester » commands » SetUrlPrefixCommand.java
/*
 * Created on 18.11.2005
 * Author Sergey Pariev, spariev@gmail.com
 */
package org.jzonic.webtester.commands;

import org.jzonic.webtester.WebTestContext;

/**
 * This command will save the url prefix and everytime get_html
 * is called the url prefix will be used to construct full url. 
 * <br/>
 * parameter: urlPrefix
 * <br/>
 * examples:
 * <br/>
 * set_url_prefix | http://localhost:8080/myapp
 * <br/>
 * and then use
 * <br/>
 * get_html | /mypage.jsp
 * <br/>
 * instead of 
 * <br/>
 * get_html | http://localhost:8080/myapp/mypage.jsp
 * 
 * @author Sergey Pariev (spariev@gmail.com)
 */
public class SetUrlPrefixCommand implements WebTestNode {

  public static final String COMMAND_NAME = "set_url_prefix";
    private String urlPrefix;
    
    public void setParameter(String value) {
      urlPrefix = value;        
    }

    public WebTestNodeResult execute(WebTestContext context) {
        WebTestNodeResult result = new WebTestNodeResult(COMMAND_NAME,urlPrefix);
        context.setUrlPrefix(urlPrefix);
        result.setSuccess(true);        
        return result;
    }

    public String getName() {
      return COMMAND_NAME;
    }
   
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.