use of com.linkedin.pinot.core.realtime.impl.kafka.KafkaLowLevelStreamProviderConfig in project pinot by linkedin.
the class LLRealtimeSegmentDataManagerTest method testTimeString.
@Test
public void testTimeString() throws Exception {
JSONObject tableConfigJson = new JSONObject(_tableConfigJson);
JSONObject tableIndexConfig = (JSONObject) tableConfigJson.get("tableIndexConfig");
JSONObject streamConfigs = (JSONObject) tableIndexConfig.get("streamConfigs");
{
streamConfigs.put(CommonConstants.Helix.DataSource.Realtime.REALTIME_SEGMENT_FLUSH_TIME, "3h");
AbstractTableConfig tableConfig = createTableConfig(tableConfigJson.toString());
InstanceZKMetadata instanceZKMetadata = new InstanceZKMetadata();
Schema schema = Schema.fromString(makeSchema());
KafkaLowLevelStreamProviderConfig config = new KafkaLowLevelStreamProviderConfig();
config.init(tableConfig, instanceZKMetadata, schema);
Assert.assertEquals(3 * 3600 * 1000L, config.getTimeThresholdToFlushSegment());
}
{
streamConfigs.put(CommonConstants.Helix.DataSource.Realtime.REALTIME_SEGMENT_FLUSH_TIME, "3h30m");
AbstractTableConfig tableConfig = createTableConfig(tableConfigJson.toString());
InstanceZKMetadata instanceZKMetadata = new InstanceZKMetadata();
Schema schema = Schema.fromString(makeSchema());
KafkaLowLevelStreamProviderConfig config = new KafkaLowLevelStreamProviderConfig();
config.init(tableConfig, instanceZKMetadata, schema);
Assert.assertEquals((3 * 3600 + 30 * 60) * 1000L, config.getTimeThresholdToFlushSegment());
}
{
final long segTime = 898789748357L;
streamConfigs.put(CommonConstants.Helix.DataSource.Realtime.REALTIME_SEGMENT_FLUSH_TIME, String.valueOf(segTime));
AbstractTableConfig tableConfig = createTableConfig(tableConfigJson.toString());
InstanceZKMetadata instanceZKMetadata = new InstanceZKMetadata();
Schema schema = Schema.fromString(makeSchema());
KafkaLowLevelStreamProviderConfig config = new KafkaLowLevelStreamProviderConfig();
config.init(tableConfig, instanceZKMetadata, schema);
Assert.assertEquals(segTime, config.getTimeThresholdToFlushSegment());
}
}
Aggregations