Bladeren bron

SEC-368: Tidied up captcha spelling.

Luke Taylor 18 jaren geleden
bovenliggende
commit
dd2a46c7ca
14 gewijzigde bestanden met toevoegingen van 34 en 43 verwijderingen
  1. 4 5
      core/src/main/java/org/acegisecurity/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessor.java
  2. 4 4
      core/src/main/java/org/acegisecurity/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java
  3. 3 4
      core/src/main/java/org/acegisecurity/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor.java
  4. 2 2
      core/src/main/java/org/acegisecurity/captcha/CaptchaChannelProcessorTemplate.java
  5. 0 3
      core/src/main/java/org/acegisecurity/captcha/CaptchaEntryPoint.java
  6. 1 1
      core/src/main/java/org/acegisecurity/captcha/CaptchaSecurityContext.java
  7. 1 1
      core/src/main/java/org/acegisecurity/captcha/CaptchaSecurityContextImpl.java
  8. 1 2
      core/src/main/java/org/acegisecurity/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessor.java
  9. 4 7
      core/src/test/java/org/acegisecurity/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests.java
  10. 1 1
      core/src/test/java/org/acegisecurity/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessorTests.java
  11. 3 3
      core/src/test/java/org/acegisecurity/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessorTests.java
  12. 2 2
      core/src/test/java/org/acegisecurity/captcha/CaptchaChannelProcessorTemplateTests.java
  13. 4 4
      core/src/test/java/org/acegisecurity/captcha/CaptchaSecurityContextImplTests.java
  14. 4 4
      core/src/test/java/org/acegisecurity/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessorTests.java

+ 4 - 5
core/src/main/java/org/acegisecurity/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessor.java

@@ -29,29 +29,28 @@ public class AlwaysTestAfterMaxRequestsCaptchaChannelProcessor extends CaptchaCh
     //~ Static fields/initializers =====================================================================================
 
     /** Keyword for this channelProcessor */
-    public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_ABOVE_THRESOLD_REQUESTS";
+    public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_ABOVE_THRESHOLD_REQUESTS";
 
     //~ Constructors ===================================================================================================
 
-/**
+    /**
      * Constructor
      */
     public AlwaysTestAfterMaxRequestsCaptchaChannelProcessor() {
-        super();
         this.setKeyword(DEFAULT_KEYWORD);
     }
 
     //~ Methods ========================================================================================================
 
     /**
-     * Verify wheter the context is valid concerning humanity
+     * Verify whether the context is valid concerning humanity
      *
      * @param context
      *
      * @return true if valid, false otherwise
      */
     boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) {
-        if (context.getHumanRestrictedResourcesRequestsCount() < getThresold()) {
+        if (context.getHumanRestrictedResourcesRequestsCount() < getThreshold()) {
             logger.debug("context is valid : request count < thresold");
 
             return true;

+ 4 - 4
core/src/main/java/org/acegisecurity/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java

@@ -26,15 +26,15 @@ public class AlwaysTestAfterTimeInMillisCaptchaChannelProcessor extends CaptchaC
     //~ Static fields/initializers =====================================================================================
 
     /** Keyword for this channelProcessor */
-    public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_AFTER_THRESOLD_IN_MILLIS";
+    public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_AFTER_THRESHOLD_IN_MILLIS";
 
     //~ Constructors ===================================================================================================
 
-/**
+    /**
      * Constructor
      */
     public AlwaysTestAfterTimeInMillisCaptchaChannelProcessor() {
-        super();
+
         this.setKeyword(DEFAULT_KEYWORD);
     }
 
@@ -48,7 +48,7 @@ public class AlwaysTestAfterTimeInMillisCaptchaChannelProcessor extends CaptchaC
      * @return true if valid, false otherwise
      */
     boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) {
-        if ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < getThresold()) {
+        if ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < getThreshold()) {
             logger.debug("context is valid : last passed captcha date - current time < thresold");
 
             return true;

+ 3 - 4
core/src/main/java/org/acegisecurity/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor.java

@@ -35,11 +35,10 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e
 
     //~ Constructors ===================================================================================================
 
-/**
+    /**
      * Constructor
      */
     public AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor() {
-        super();
         this.setKeyword(DEFAULT_KEYWORD);
     }
 
@@ -52,7 +51,7 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e
      */
     public void afterPropertiesSet() throws Exception {
         super.afterPropertiesSet();
-        Assert.isTrue(getThresold() > 0, "thresold must be > 0");
+        Assert.isTrue(getThreshold() > 0, "thresold must be > 0");
     }
 
     /**
@@ -64,7 +63,7 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e
      */
     boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) {
         int req = context.getHumanRestrictedResourcesRequestsCount();
-        float thresold = getThresold();
+        float thresold = getThreshold();
         float duration = System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis();
         float average;
 

+ 2 - 2
core/src/main/java/org/acegisecurity/captcha/CaptchaChannelProcessorTemplate.java

@@ -99,7 +99,7 @@ public abstract class CaptchaChannelProcessorTemplate implements ChannelProcesso
                     redirectToEntryPoint(invocation);
                 } else {
                     logger.debug("has been successfully checked this keyword, increment request count");
-                    context.incrementHumanRestrictedRessoucesRequestsCount();
+                    context.incrementHumanRestrictedResourcesRequestsCount();
                 }
             } else {
                 logger.debug("do not support this attribute");
@@ -115,7 +115,7 @@ public abstract class CaptchaChannelProcessorTemplate implements ChannelProcesso
         return keyword;
     }
 
-    public int getThresold() {
+    public int getThreshold() {
         return thresold;
     }
 

+ 0 - 3
core/src/main/java/org/acegisecurity/captcha/CaptchaEntryPoint.java

@@ -92,8 +92,6 @@ public class CaptchaEntryPoint implements ChannelEntryPoint, InitializingBean {
 
     //~ Instance fields ================================================================================================
 
-    // ~ Instance fields
-    // ========================================================
     private PortMapper portMapper = new PortMapperImpl();
     private PortResolver portResolver = new PortResolverImpl();
     private String captchaFormUrl;
@@ -208,7 +206,6 @@ public class CaptchaEntryPoint implements ChannelEntryPoint, InitializingBean {
     }
 
     /**
-     * DOCUMENT ME!
      *
      * @return the captcha test page to redirect to.
      */

+ 1 - 1
core/src/main/java/org/acegisecurity/captcha/CaptchaSecurityContext.java

@@ -43,7 +43,7 @@ public interface CaptchaSecurityContext extends SecurityContext {
     /**
      * Method to increment the human Restricted Resrouces Requests Count;
      */
-    void incrementHumanRestrictedRessoucesRequestsCount();
+    void incrementHumanRestrictedResourcesRequestsCount();
 
     /**
      * DOCUMENT ME!

+ 1 - 1
core/src/main/java/org/acegisecurity/captcha/CaptchaSecurityContextImpl.java

@@ -86,7 +86,7 @@ public class CaptchaSecurityContextImpl extends SecurityContextImpl implements C
     /**
      * Method to increment the human Restricted Resrouces Requests Count;
      */
-    public void incrementHumanRestrictedRessoucesRequestsCount() {
+    public void incrementHumanRestrictedResourcesRequestsCount() {
         humanRestrictedResourcesRequestsCount++;
     }
 

+ 1 - 2
core/src/main/java/org/acegisecurity/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessor.java

@@ -31,14 +31,13 @@ public class TestOnceAfterMaxRequestsCaptchaChannelProcessor extends CaptchaChan
     //~ Constructors ===================================================================================================
 
     public TestOnceAfterMaxRequestsCaptchaChannelProcessor() {
-        super();
         this.setKeyword(DEFAULT_KEYWORD);
     }
 
     //~ Methods ========================================================================================================
 
     boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) {
-        if (context.isHuman() || (context.getHumanRestrictedResourcesRequestsCount() < getThresold())) {
+        if (context.isHuman() || (context.getHumanRestrictedResourcesRequestsCount() < getThreshold())) {
             logger.debug("context is valid concerning humanity or request count < thresold");
 
             return true;

+ 4 - 7
core/src/test/java/org/acegisecurity/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests.java

@@ -15,13 +15,10 @@
 
 package org.acegisecurity.captcha;
 
-import junit.framework.*;
-
-import org.acegisecurity.captcha.AlwaysTestAfterMaxRequestsCaptchaChannelProcessor;
+import junit.framework.TestCase;
 
 
 /**
- * DOCUMENT ME!
  *
  * @author $author$
  * @version $Revision$
@@ -45,16 +42,16 @@ public class AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests extends Test
         CaptchaSecurityContextImpl context = new CaptchaSecurityContextImpl();
         assertTrue(alwaysTestAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
 
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
 
         alwaysTestAfterMaxRequestsCaptchaChannelProcessor.setThresold(-1);
         assertFalse(alwaysTestAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
 
         alwaysTestAfterMaxRequestsCaptchaChannelProcessor.setThresold(3);
         assertTrue(alwaysTestAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
         assertTrue(alwaysTestAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
         assertFalse(alwaysTestAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
     }
 

+ 1 - 1
core/src/test/java/org/acegisecurity/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessorTests.java

@@ -61,7 +61,7 @@ public class AlwaysTestAfterTimeInMillisCaptchaChannelProcessorTests extends Tes
         context.setHuman();
 
         while ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < alwaysTestAfterTimeInMillisCaptchaChannelProcessor
-            .getThresold()) {
+            .getThreshold()) {
             assertTrue(alwaysTestAfterTimeInMillisCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
             context.incrementHumanRestrictedRessoucesRequestsCount();
 

+ 3 - 3
core/src/test/java/org/acegisecurity/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessorTests.java

@@ -74,7 +74,7 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessorTe
         context.setHuman();
 
         while ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < (10 * alwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor
-            .getThresold())) {
+            .getThreshold())) {
             assertTrue(alwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor
                 .isContextValidConcerningHumanity(context));
         }
@@ -98,14 +98,14 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessorTe
         int i = 0;
 
         while ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < (100 * alwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor
-            .getThresold())) {
+            .getThreshold())) {
             System.out.println((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()));
 
             context.incrementHumanRestrictedRessoucesRequestsCount();
             i++;
 
             while ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < (alwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor
-                .getThresold() * i)) {}
+                .getThreshold() * i)) {}
 
             System.out.println((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()));
 

+ 2 - 2
core/src/test/java/org/acegisecurity/captcha/CaptchaChannelProcessorTemplateTests.java

@@ -122,9 +122,9 @@ public class CaptchaChannelProcessorTemplateTests extends TestCase {
         processor.setKeyword("X");
         assertEquals("X", processor.getKeyword());
 
-        assertEquals(0, processor.getThresold());
+        assertEquals(0, processor.getThreshold());
         processor.setThresold(1);
-        assertEquals(1, processor.getThresold());
+        assertEquals(1, processor.getThreshold());
 
         assertTrue(processor.getEntryPoint() == null);
         processor.setEntryPoint(new CaptchaEntryPoint());

+ 4 - 4
core/src/test/java/org/acegisecurity/captcha/CaptchaSecurityContextImplTests.java

@@ -48,7 +48,7 @@ public class CaptchaSecurityContextImplTests extends SecurityContextImplTests {
         context1 = new CaptchaSecurityContextImpl();
         assertEquals(context1, context2);
 
-        context1.incrementHumanRestrictedRessoucesRequestsCount();
+        context1.incrementHumanRestrictedResourcesRequestsCount();
         assertNotSame(context1, context2);
     }
 
@@ -66,7 +66,7 @@ public class CaptchaSecurityContextImplTests extends SecurityContextImplTests {
         context1 = new CaptchaSecurityContextImpl();
         assertEquals(context1.hashCode(), context2.hashCode());
 
-        context1.incrementHumanRestrictedRessoucesRequestsCount();
+        context1.incrementHumanRestrictedResourcesRequestsCount();
         assertTrue(context1 != context2);
     }
 
@@ -75,7 +75,7 @@ public class CaptchaSecurityContextImplTests extends SecurityContextImplTests {
         context.setHuman();
         assertEquals("should be human", true, context.isHuman());
         assertEquals("should be 0", 0, context.getHumanRestrictedResourcesRequestsCount());
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
         assertEquals("should be 1", 1, context.getHumanRestrictedResourcesRequestsCount());
     }
 
@@ -84,7 +84,7 @@ public class CaptchaSecurityContextImplTests extends SecurityContextImplTests {
         context.setHuman();
         assertEquals("should be human", true, context.isHuman());
         assertEquals("should be 0", 0, context.getHumanRestrictedResourcesRequestsCount());
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
         assertEquals("should be 1", 1, context.getHumanRestrictedResourcesRequestsCount());
 
         long now = System.currentTimeMillis();

+ 4 - 4
core/src/test/java/org/acegisecurity/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessorTests.java

@@ -45,20 +45,20 @@ public class TestOnceAfterMaxRequestsCaptchaChannelProcessorTests extends TestCa
         CaptchaSecurityContextImpl context = new CaptchaSecurityContextImpl();
         assertTrue(testOnceAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
 
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
 
         testOnceAfterMaxRequestsCaptchaChannelProcessor.setThresold(-1);
         assertFalse(testOnceAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
 
         testOnceAfterMaxRequestsCaptchaChannelProcessor.setThresold(3);
         assertTrue(testOnceAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
         assertTrue(testOnceAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
-        context.incrementHumanRestrictedRessoucesRequestsCount();
+        context.incrementHumanRestrictedResourcesRequestsCount();
         assertFalse(testOnceAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
         context.setHuman();
 
-        for (int i = 0; i < (2 * testOnceAfterMaxRequestsCaptchaChannelProcessor.getThresold()); i++) {
+        for (int i = 0; i < (2 * testOnceAfterMaxRequestsCaptchaChannelProcessor.getThreshold()); i++) {
             assertTrue(testOnceAfterMaxRequestsCaptchaChannelProcessor.isContextValidConcerningHumanity(context));
         }
     }