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: 66   Methods: 2
NCLOC: 21   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.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    package org.acegisecurity.captcha;
 16   
 17    /**
 18    * <p>
 19    * return false if thresold is greater than millis since last captcha test has occured;<br>
 20    * Default keyword : REQUIRES_CAPTCHA_AFTER_THRESOLD_IN_MILLIS
 21    * </p>
 22    *
 23    * @author Marc-Antoine Garrigue
 24    * @version $Id: AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java,v 1.2 2005/11/17 00:55:49 benalex Exp $
 25    */
 26    public class AlwaysTestAfterTimeInMillisCaptchaChannelProcessor
 27    extends CaptchaChannelProcessorTemplate {
 28    //~ Static fields/initializers =============================================
 29   
 30    /** Keyword for this channelProcessor */
 31    public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_AFTER_THRESOLD_IN_MILLIS";
 32   
 33    //~ Constructors ===========================================================
 34   
 35    /**
 36    * Constructor
 37    */
 38  3 public AlwaysTestAfterTimeInMillisCaptchaChannelProcessor() {
 39  3 super();
 40  3 this.setKeyword(DEFAULT_KEYWORD);
 41    }
 42   
 43    //~ Methods ================================================================
 44   
 45    /**
 46    * Verify wheter the context is valid concerning humanity
 47    *
 48    * @param context the CaptchaSecurityContext
 49    *
 50    * @return true if valid, false otherwise
 51    */
 52  11 boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) {
 53  11 if ((System.currentTimeMillis()
 54    - context.getLastPassedCaptchaDateInMillis()) < getThresold()) {
 55  7 logger.debug(
 56    "context is valid : last passed captcha date - current time < thresold");
 57   
 58  7 return true;
 59    } else {
 60  4 logger.debug(
 61    "context is not valid : last passed captcha date - current time > thresold");
 62   
 63  4 return false;
 64    }
 65    }
 66    }