mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 00:36:02 +10:00
[강운덕] [LUCYSUS-1744] limitUtil의 패키지명 변경. web으로 이동시킴.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@2795 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.nhn.pinpoint.common.util.LimitUtils;
|
||||
import com.nhn.pinpoint.web.util.LimitUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.nhn.pinpoint.common.util.LimitUtils;
|
||||
import com.nhn.pinpoint.web.util.LimitUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.nhn.pinpoint.common.util.DateUtils;
|
||||
import com.nhn.pinpoint.common.util.LimitUtils;
|
||||
import com.nhn.pinpoint.web.util.LimitUtils;
|
||||
import com.nhn.pinpoint.web.filter.Filter;
|
||||
import com.nhn.pinpoint.web.filter.FilterBuilder;
|
||||
import com.nhn.pinpoint.web.vo.scatter.Dot;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.nhn.pinpoint.web.util;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public final class LimitUtils {
|
||||
public static final int MAX = 10000;
|
||||
|
||||
public static int checkRange(final int limit) {
|
||||
if (limit < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (limit > MAX) {
|
||||
return MAX;
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.nhn.pinpoint.web.util;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class LimitUtilsTest {
|
||||
@Test
|
||||
public void testCheckLimit() throws Exception {
|
||||
int equals = LimitUtils.checkRange(LimitUtils.MAX);
|
||||
Assert.assertEquals(equals, LimitUtils.MAX);
|
||||
|
||||
int over = LimitUtils.checkRange(LimitUtils.MAX + 1);
|
||||
Assert.assertEquals(over, LimitUtils.MAX);
|
||||
|
||||
int low = LimitUtils.checkRange(0);
|
||||
Assert.assertEquals(low, 0);
|
||||
|
||||
int negative = LimitUtils.checkRange(-1);
|
||||
Assert.assertEquals(negative, 0);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user