use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class WindowingOperationsTest method testRawReactiveWindow.
@Test
public void testRawReactiveWindow() {
BulletConfig config = new BulletConfig();
Query query = new Query();
Window window = WindowUtils.makeReactiveWindow();
window.configure(config);
query.setWindow(window);
Aggregation aggregation = new Aggregation();
aggregation.setType(Aggregation.Type.RAW);
query.setAggregation(aggregation);
Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), Reactive.class);
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class AdditiveTumblingTest method make.
private AdditiveTumbling make(int length, int minimumWindow) {
config.set(BulletConfig.WINDOW_MIN_EMIT_EVERY, minimumWindow);
config.validate();
Window window = makeAdditiveTumblingWindow(length);
return new AdditiveTumbling(strategy, window, config);
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class ReactiveTest method makeReactiveWindow.
private Window makeReactiveWindow() {
Window window = WindowUtils.makeReactiveWindow();
window.configure(config);
window.initialize();
return window;
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class ReactiveTest method testBadMaxWindowSize.
@Test
public void testBadMaxWindowSize() {
Window window = WindowUtils.makeWindow(Window.Unit.RECORD, 10);
window.configure(config);
Optional<List<BulletError>> errors = window.initialize();
Assert.assertTrue(errors.isPresent());
Assert.assertEquals(errors.get(), singletonList(Window.NOT_ONE_RECORD_EMIT));
Reactive reactive = new Reactive(strategy, window, config);
errors = reactive.initialize();
Assert.assertTrue(errors.isPresent());
Assert.assertEquals(errors.get(), singletonList(Reactive.ONLY_ONE_RECORD));
window = WindowUtils.makeWindow(Window.Unit.TIME, 10000);
window.configure(config);
Assert.assertFalse(window.initialize().isPresent());
reactive = new Reactive(strategy, window, config);
errors = reactive.initialize();
Assert.assertTrue(errors.isPresent());
Assert.assertEquals(errors.get(), singletonList(Reactive.NOT_RECORD));
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class ReactiveTest method testResettingForPartitoin.
@Test
public void testResettingForPartitoin() {
Window window = makeReactiveWindow();
Reactive reactive = new Reactive(strategy, window, config);
Assert.assertFalse(reactive.initialize().isPresent());
Assert.assertEquals(strategy.getResetCalls(), 0);
reactive.consume(RecordBox.get().getRecord());
Assert.assertTrue(reactive.isClosed());
Assert.assertTrue(reactive.isClosedForPartition());
Assert.assertEquals(strategy.getConsumeCalls(), 1);
reactive.resetForPartition();
Assert.assertFalse(reactive.isClosed());
Assert.assertFalse(reactive.isClosedForPartition());
Assert.assertEquals(strategy.getResetCalls(), 1);
}
Aggregations