mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-19 09:47:27 +10:00
[강운덕] [LUCYSUS-1744] sql 치환 로직 commit
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@1102 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package com.nhn.hippo.web.dao.hbase;
|
||||
|
||||
import com.profiler.common.dto.thrift.AgentInfo;
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath:test-web-applicationContext.xml")
|
||||
public class HbaseAgentInfoDaoTest {
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentInfoDao selectDao;
|
||||
@Autowired
|
||||
private com.profiler.server.dao.hbase.HbaseAgentInfoDao insertDao;
|
||||
|
||||
@Test
|
||||
public void testSelectAgentInfoStartTime() throws Exception {
|
||||
AgentInfo agentInfo1 = createAgentInfo(10000);
|
||||
insertDao.insert(agentInfo1);
|
||||
|
||||
AgentInfo agentInfo2 = createAgentInfo(20000);
|
||||
insertDao.insert(agentInfo2);
|
||||
|
||||
AgentInfo agentInfo3 = createAgentInfo(30000);
|
||||
insertDao.insert(agentInfo3);
|
||||
|
||||
long testcaseAgent1 = selectDao.selectAgentInfoBeforeStartTime("testcaseAgent", 20005);
|
||||
Assert.assertEquals(testcaseAgent1, 20000);
|
||||
|
||||
long testcaseAgent2 = selectDao.selectAgentInfoBeforeStartTime("testcaseAgent", 10004);
|
||||
Assert.assertEquals(testcaseAgent2, 10000);
|
||||
|
||||
long testcaseAgent3 = selectDao.selectAgentInfoBeforeStartTime("testcaseAgent", 50000);
|
||||
Assert.assertEquals(testcaseAgent3, 30000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private AgentInfo createAgentInfo(long startTime) {
|
||||
AgentInfo agentInfo = new AgentInfo();
|
||||
agentInfo.setAgentId("testcaseAgent");
|
||||
agentInfo.setApplicationName("testcaseApplication");
|
||||
agentInfo.setHostname("testcaseHostName");
|
||||
agentInfo.setPorts("9995");
|
||||
agentInfo.setIsAlive(true);
|
||||
agentInfo.setTimestamp(startTime);
|
||||
return agentInfo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user