SEC-368: Tidied up captcha spelling.

This commit is contained in:
Luke Taylor
2007-09-11 11:11:05 +00:00
parent c91400b03b
commit dd2a46c7ca
14 changed files with 34 additions and 43 deletions

View File

@@ -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));
}

View File

@@ -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();

View File

@@ -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()));

View File

@@ -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());

View File

@@ -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();

View File

@@ -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));
}
}