1 5 package org.exoplatform.test.web.unit; 6 7 import org.exoplatform.test.web.ExoWebClient; 8 import com.meterware.httpunit.*; 9 15 public class NewSessionUnit extends WebUnit { 16 private String website_ ; 17 18 public NewSessionUnit(String name, String description) { 19 super(name, description) ; 20 } 21 22 public NewSessionUnit setWebsite(String url) { 23 website_ = url ; 24 return this ; 25 } 26 27 public WebResponse execute(WebResponse previousResponse, WebTable block, 28 ExoWebClient client) throws Exception { 29 WebConversation wc = new WebConversation() ; 30 client.setWebClient(wc) ; 31 String url = website_ ; 32 if(url == null) url = client.getHomePageURL() ; 33 WebRequest req = new GetMethodWebRequest(url); 34 WebResponse response = wc.getResponse( req ); 35 return response ; 36 } 37 38 public String getActionDescription() { 39 return "This web unit create a new session for the site '" + website_ + "' " + 40 "if there is no defined website, the web unit will use the default website of the web client at the runtime"; 41 } 42 } | Popular Tags |