Search in sources :

Example 1 with Limiter

use of com.navercorp.pinpoint.web.util.Limiter in project pinpoint by naver.

the class DateLimiterTest method checkFail.

@Test
public void checkFail() {
    Limiter limiter = new DateLimiter(2);
    try {
        limiter.limit(0, TimeUnit.DAYS.toMillis(2) + 1);
        Assert.fail();
    } catch (Exception ignored) {
    }
    try {
        limiter.limit(TimeUnit.DAYS.toMillis(2), 0);
        Assert.fail();
    } catch (Exception ignored) {
    }
}
Also used : DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Limiter(com.navercorp.pinpoint.web.util.Limiter) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Test(org.junit.Test)

Example 2 with Limiter

use of com.navercorp.pinpoint.web.util.Limiter in project pinpoint by naver.

the class DateLimiterTest method checkRangeFail.

@Test
public void checkRangeFail() {
    Limiter limiter = new DateLimiter(2);
    try {
        limiter.limit(new Range(0, TimeUnit.DAYS.toMillis(2) + 1));
        Assert.fail();
    } catch (Exception ignored) {
    }
    try {
        limiter.limit(new Range(TimeUnit.DAYS.toMillis(2), 0));
        Assert.fail();
    } catch (Exception ignored) {
    }
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Limiter(com.navercorp.pinpoint.web.util.Limiter) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Test(org.junit.Test)

Example 3 with Limiter

use of com.navercorp.pinpoint.web.util.Limiter in project pinpoint by naver.

the class DateLimiterTest method check.

@Test
public void check() {
    Limiter limiter = new DateLimiter(2);
    limiter.limit(0, TimeUnit.DAYS.toMillis(2));
    long time = 1000;
    limiter.limit(time, time + TimeUnit.DAYS.toMillis(2));
    limiter.limit(TimeUnit.DAYS.toMillis(2), TimeUnit.DAYS.toMillis(2));
}
Also used : DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Limiter(com.navercorp.pinpoint.web.util.Limiter) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Test(org.junit.Test)

Example 4 with Limiter

use of com.navercorp.pinpoint.web.util.Limiter in project pinpoint by naver.

the class DateLimiterTest method checkRange.

@Test
public void checkRange() {
    Limiter limiter = new DateLimiter(2);
    limiter.limit(new Range(0, TimeUnit.DAYS.toMillis(2)));
    long time = 1000;
    limiter.limit(new Range(time, time + TimeUnit.DAYS.toMillis(2)));
    limiter.limit(new Range(TimeUnit.DAYS.toMillis(2), TimeUnit.DAYS.toMillis(2)));
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Limiter(com.navercorp.pinpoint.web.util.Limiter) DateLimiter(com.navercorp.pinpoint.web.util.DateLimiter) Test(org.junit.Test)

Aggregations

DateLimiter (com.navercorp.pinpoint.web.util.DateLimiter)4 Limiter (com.navercorp.pinpoint.web.util.Limiter)4 Test (org.junit.Test)4 Range (com.navercorp.pinpoint.web.vo.Range)2