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 AddRoleUnit extends WebUnit { 16 17 private String roleToAdd_ ; 18 19 public AddRoleUnit(String name, String description) { 20 super(name, description) ; 21 } 22 23 public WebUnit setRoleToAdd(String role) { 24 roleToAdd_ = role ; 25 return this ; 26 } 27 28 public WebResponse execute(WebResponse previousResponse, WebTable block, 29 ExoWebClient client) throws Exception { 30 client.getRoles().put(roleToAdd_, roleToAdd_) ; 31 return previousResponse ; 32 } 33 34 public void log(long executionTime , int contentLength, boolean error, boolean malformed) { 35 monitor_.log(0, contentLength, error, malformed) ; 36 } 37 38 public String getActionDescription() { 39 return "This unit do not submit any request to the server. It just add the role '" + roleToAdd_ +"' " + 40 "to web client so later the web client can decide to run/ignore certain web units"; 41 } 42 } | Popular Tags |