"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zxingorg/src/test/java/com/google/zxing/web/DoSTrackerTestCase.java" between
zxing-zxing-3.4.0.tar.gz and zxing-zxing-3.4.1.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

DoSTrackerTestCase.java  (zxing-zxing-3.4.0):DoSTrackerTestCase.java  (zxing-zxing-3.4.1)
skipping to change at line 34 skipping to change at line 34
/** /**
* Tests {@link DoSTracker}. * Tests {@link DoSTracker}.
*/ */
public final class DoSTrackerTestCase extends Assert { public final class DoSTrackerTestCase extends Assert {
@Test @Test
public void testDoS() throws Exception { public void testDoS() throws Exception {
Timer timer = new Timer(); Timer timer = new Timer();
long timerTimeMS = 500; long timerTimeMS = 500;
int maxAccessPerTime = 2; int maxAccessPerTime = 2;
DoSTracker tracker = new DoSTracker(timer, "test", maxAccessPerTime, timerTi meMS, 3); DoSTracker tracker = new DoSTracker(timer, "test", maxAccessPerTime, timerTi meMS, 3, null);
// 2 requests allowed per time; 3rd should be banned // 2 requests allowed per time; 3rd should be banned
assertFalse(tracker.isBanned("A")); assertFalse(tracker.isBanned("A"));
assertFalse(tracker.isBanned("A")); assertFalse(tracker.isBanned("A"));
assertTrue(tracker.isBanned("A")); assertTrue(tracker.isBanned("A"));
// After max 3 others are tracked, A should be reset/evicted and un-ban // After max 3 others are tracked, A should be reset/evicted and un-ban
assertFalse(tracker.isBanned("B")); assertFalse(tracker.isBanned("B"));
assertFalse(tracker.isBanned("C")); assertFalse(tracker.isBanned("C"));
assertFalse(tracker.isBanned("D")); assertFalse(tracker.isBanned("D"));
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)