KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > web > condition > NoRoleCondition


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.condition;
6
7 import org.exoplatform.test.web.ExoWebClient;
8 import com.meterware.httpunit.*;
9
10 /**
11  * May 21, 2004
12  * @author: Tuan Nguyen
13  * @email: tuan08@users.sourceforge.net
14  * @version: $Id: NoRoleCondition.java,v 1.1 2004/10/11 23:36:04 tuan08 Exp $
15  **/

16 public class NoRoleCondition implements Condition {
17   private String JavaDoc role_ ;
18   
19   public NoRoleCondition(String JavaDoc role) {
20     role_ = role ;
21   }
22   
23   public boolean checkCondition(WebResponse response, WebTable block, ExoWebClient client) throws Exception JavaDoc {
24     return !client.getRoles().containsKey(role_) ;
25   }
26   
27   public String JavaDoc getName() { return "NoRoleCondition" ; }
28   public String JavaDoc getDescription() {
29     return "This unit test should run only if the remote user do not have the role '" + role_ + "'" ;
30   }
31 }
Popular Tags