[강운덕] [LUCYSUS-1744] agendid의 limit 넘을 경우 메시지를 찍도록 변경. 넘을 경우의 후처리가 부족함.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-commons/trunk@833 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2012-10-30 07:17:22 +00:00
parent 16ea3f2a5a
commit 35a98fe5fc
2 changed files with 36 additions and 1 deletions
@@ -0,0 +1,28 @@
package com.profiler.common.util;
import com.profiler.common.dto.Header;
import com.profiler.common.util.HeaderUtils;
import org.apache.thrift.TException;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HeaderUtilsTest {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
@Test
public void validateSignature() throws TException {
Header header = new Header();
Assert.assertTrue(HeaderUtils.validateSignature(header.getSignature()));
Header error = new Header((byte) 0x11, (byte) 0x20, (short) 1);
Assert.assertTrue(!HeaderUtils.validateSignature(error.getSignature()));
logger.info(header.toString());
}
}
@@ -9,6 +9,13 @@ import org.junit.Test;
*
*/
public class SpanUtilsTest {
@Test
public void testGetTraceIndexRowKeyWhiteSpace() throws Exception {
String agentId = "test test";
long time = System.currentTimeMillis();
check(agentId, time);
}
@Test
public void testGetTraceIndexRowKey1() throws Exception {
String agentId = "test";
@@ -49,7 +56,7 @@ public class SpanUtilsTest {
byte[] traceIndexRowKey = SpanUtils.getTraceIndexRowKey(span);
String agentId = Bytes.toString(traceIndexRowKey, 0, agentId0.length());
String agentId = Bytes.toString(traceIndexRowKey, 0, 24).trim();
Assert.assertEquals(agentId0, agentId);
long time = Bytes.toLong(traceIndexRowKey, SpanUtils.AGENT_NAME_LIMIT);