use of cz.o2.proxima.direct.time.BoundedOutOfOrdernessWatermarkEstimator in project proxima-platform by O2-Czech-Republic.
the class BoundedOutOfOrdernessWatermarkEstimatorTest method testIdlePolicy.
@Test
public void testIdlePolicy() {
WatermarkIdlePolicy idlePolicy = mock(WatermarkIdlePolicy.class);
BoundedOutOfOrdernessWatermarkEstimator estimator = BoundedOutOfOrdernessWatermarkEstimator.newBuilder().withWatermarkIdlePolicy(idlePolicy).build();
StreamElement element = element(now);
estimator.update(element);
verify(idlePolicy, times(1)).update(element);
estimator.idle();
verify(idlePolicy, times(1)).idle(now);
}
use of cz.o2.proxima.direct.time.BoundedOutOfOrdernessWatermarkEstimator in project proxima-platform by O2-Czech-Republic.
the class BoundedOutOfOrdernessWatermarkEstimatorTest method testFactory.
@Test
public void testFactory() {
Map<String, Object> cfg = new HashMap<String, Object>() {
{
put(prefixedKey(MAX_OUT_OF_ORDERNESS_MS), OUT_OF_ORDERNESS);
}
};
WatermarkIdlePolicyFactory idlePolicyFactory = mock(WatermarkIdlePolicyFactory.class);
when(idlePolicyFactory.create(cfg)).thenReturn(mock(WatermarkIdlePolicy.class));
WatermarkEstimatorFactory factory = new BoundedOutOfOrdernessWatermarkEstimator.Factory();
BoundedOutOfOrdernessWatermarkEstimator watermarkEstimator = (BoundedOutOfOrdernessWatermarkEstimator) factory.create(cfg, idlePolicyFactory);
assertEquals(OUT_OF_ORDERNESS, watermarkEstimator.getMaxOutOfOrderness());
verify(idlePolicyFactory, times(1)).create(cfg);
}
use of cz.o2.proxima.direct.time.BoundedOutOfOrdernessWatermarkEstimator in project proxima-platform by O2-Czech-Republic.
the class KafkaWatermarkConfigurationTest method testConfigureDefault.
@Test
public void testConfigureDefault() {
// Check backward compatibility with legacy behaviour
Map<String, Object> cfg = new HashMap<String, Object>() {
{
put("timestamp-skew", 10L);
}
};
KafkaWatermarkConfiguration configuration = new KafkaWatermarkConfiguration(cfg);
WatermarkIdlePolicyFactory policyFactory = configuration.getWatermarkIdlePolicyFactory();
BoundedOutOfOrdernessWatermarkEstimator estimator = (BoundedOutOfOrdernessWatermarkEstimator) configuration.getWatermarkEstimatorFactory().create(cfg, policyFactory);
SkewedProcessingTimeIdlePolicy policy = (SkewedProcessingTimeIdlePolicy) policyFactory.create(cfg);
assertNotNull(estimator);
assertNotNull(policy);
assertEquals(0L, estimator.getMaxOutOfOrderness());
assertEquals(Watermarks.MIN_WATERMARK, estimator.getMinWatermark());
assertEquals(10L, policy.getTimestampSkew());
}
Aggregations