use of com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint in project pinpoint by naver.
the class AgentStatHbaseOperationFactoryTest method create_should_create_one_put_if_there_is_only_one_dataPoint.
@Test
public void create_should_create_one_put_if_there_is_only_one_dataPoint() {
// Given
final int numDataPoints = 1;
final long initialTimestamp = AGENT_STAT_STATISTICS.TIMESPAN_MS + 1L;
final long expectedBaseTimestamp = AgentStatUtils.getBaseTimestamp(initialTimestamp);
final List<AgentStatDataPoint> testDataPoints = createTestDataPoints(initialTimestamp, TEST_COLLECTION_INTERVAL, numDataPoints);
// When
List<Put> puts = this.agentStatHbaseOperationFactory.createPuts(TEST_AGENT_ID, TEST_AGENT_STAT_TYPE, testDataPoints, this.mockSerializer);
// Then
assertEquals(1, puts.size());
Put put = puts.get(0);
assertEquals(TEST_AGENT_ID, this.agentStatHbaseOperationFactory.getAgentId(put.getRow()));
assertEquals(TEST_AGENT_STAT_TYPE, this.agentStatHbaseOperationFactory.getAgentStatType(put.getRow()));
assertEquals(expectedBaseTimestamp, this.agentStatHbaseOperationFactory.getBaseTimestamp(put.getRow()));
}
use of com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint in project pinpoint by naver.
the class AgentStatHbaseOperationFactoryTest method create_should_create_two_puts_if_dataPoints_span_over_a_timespan.
@Test
public void create_should_create_two_puts_if_dataPoints_span_over_a_timespan() {
// Given
final int numDataPoints = 6;
final long initialTimestamp = AGENT_STAT_STATISTICS.TIMESPAN_MS - TEST_COLLECTION_INTERVAL;
final long expectedBaseTimestamp1 = AgentStatUtils.getBaseTimestamp(initialTimestamp);
final long expectedBaseTimestamp2 = AgentStatUtils.getBaseTimestamp(expectedBaseTimestamp1 + AGENT_STAT_STATISTICS.TIMESPAN_MS);
final List<AgentStatDataPoint> testDataPoints = createTestDataPoints(initialTimestamp, TEST_COLLECTION_INTERVAL, numDataPoints);
// When
List<Put> puts = this.agentStatHbaseOperationFactory.createPuts(TEST_AGENT_ID, TEST_AGENT_STAT_TYPE, testDataPoints, this.mockSerializer);
// Then
assertEquals(2, puts.size());
Put firstPut = puts.get(0);
assertEquals(TEST_AGENT_ID, this.agentStatHbaseOperationFactory.getAgentId(firstPut.getRow()));
assertEquals(TEST_AGENT_STAT_TYPE, this.agentStatHbaseOperationFactory.getAgentStatType(firstPut.getRow()));
assertEquals(expectedBaseTimestamp1, this.agentStatHbaseOperationFactory.getBaseTimestamp(firstPut.getRow()));
Put secondPut = puts.get(1);
assertEquals(TEST_AGENT_ID, this.agentStatHbaseOperationFactory.getAgentId(secondPut.getRow()));
assertEquals(TEST_AGENT_STAT_TYPE, this.agentStatHbaseOperationFactory.getAgentStatType(secondPut.getRow()));
assertEquals(expectedBaseTimestamp2, this.agentStatHbaseOperationFactory.getBaseTimestamp(secondPut.getRow()));
}
Aggregations