Clover coverage report - Acegi Security System for Spring - 1.0.0-RC1
Coverage timestamp: Mon Dec 5 2005 09:05:15 EST
file stats: LOC: 80   Methods: 8
NCLOC: 39   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UserAttribute.java 100% 100% 100% 100%
coverage
 1    /* Copyright 2004, 2005 Acegi Technology Pty Limited
 2    *
 3    * Licensed under the Apache License, Version 2.0 (the "License");
 4    * you may not use this file except in compliance with the License.
 5    * You may obtain a copy of the License at
 6    *
 7    * http://www.apache.org/licenses/LICENSE-2.0
 8    *
 9    * Unless required by applicable law or agreed to in writing, software
 10    * distributed under the License is distributed on an "AS IS" BASIS,
 11    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    * See the License for the specific language governing permissions and
 13    * limitations under the License.
 14    */
 15   
 16    package org.acegisecurity.userdetails.memory;
 17   
 18    import java.util.List;
 19    import java.util.Vector;
 20   
 21    import org.acegisecurity.GrantedAuthority;
 22    import org.acegisecurity.GrantedAuthorityImpl;
 23   
 24   
 25    /**
 26    * Used by {@link InMemoryDaoImpl} to temporarily store the attributes
 27    * associated with a user.
 28    *
 29    * @author Ben Alex
 30    * @version $Id: UserAttribute.java,v 1.3 2005/11/29 13:10:09 benalex Exp $
 31    */
 32    public class UserAttribute {
 33    //~ Instance fields ========================================================
 34   
 35    private List authorities = new Vector();
 36    private String password;
 37    private boolean enabled = true;
 38   
 39    //~ Constructors ===========================================================
 40   
 41  161 public UserAttribute() {
 42  161 super();
 43    }
 44   
 45    //~ Methods ================================================================
 46   
 47  165 public GrantedAuthority[] getAuthorities() {
 48  165 GrantedAuthority[] toReturn = {new GrantedAuthorityImpl("demo")};
 49   
 50  165 return (GrantedAuthority[]) this.authorities.toArray(toReturn);
 51    }
 52   
 53  50 public void setEnabled(boolean enabled) {
 54  50 this.enabled = enabled;
 55    }
 56   
 57  153 public boolean isEnabled() {
 58  153 return enabled;
 59    }
 60   
 61  161 public void setPassword(String password) {
 62  161 this.password = password;
 63    }
 64   
 65  157 public String getPassword() {
 66  157 return password;
 67    }
 68   
 69  160 public boolean isValid() {
 70  160 if ((this.password != null) && (authorities.size() > 0)) {
 71  157 return true;
 72    } else {
 73  3 return false;
 74    }
 75    }
 76   
 77  210 public void addAuthority(GrantedAuthority newAuthority) {
 78  210 this.authorities.add(newAuthority);
 79    }
 80    }