KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > web > unit > AddRoleUnit


1     /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.test.web.unit;
6
7 import org.exoplatform.test.web.ExoWebClient;
8 import com.meterware.httpunit.*;
9 /**
10  * May 21, 2004
11  * @author: Tuan Nguyen
12  * @email: tuan08@users.sourceforge.net
13  * @version: $Id: AddRoleUnit.java,v 1.1 2004/10/11 23:36:06 tuan08 Exp $
14  **/

15 public class AddRoleUnit extends WebUnit {
16     
17     private String JavaDoc roleToAdd_ ;
18     
19   public AddRoleUnit(String JavaDoc name, String JavaDoc description) {
20     super(name, description) ;
21   }
22   
23   public WebUnit setRoleToAdd(String JavaDoc role) {
24     roleToAdd_ = role ;
25     return this ;
26   }
27   
28   public WebResponse execute(WebResponse previousResponse, WebTable block,
29                                ExoWebClient client) throws Exception JavaDoc {
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 JavaDoc 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