use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class AdditiveTumblingTest method makeAdditiveTumblingWindow.
private Window makeAdditiveTumblingWindow(int length) {
Window window = WindowUtils.makeWindow(Window.Unit.TIME, length, Window.Unit.ALL, null);
window.configure(config);
window.initialize();
return window;
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class AdditiveTumblingTest method testNotClosedOnStrategyClosed.
@Test
public void testNotClosedOnStrategyClosed() {
Window window = WindowUtils.makeWindow(Window.Unit.TIME, Integer.MAX_VALUE, Window.Unit.ALL, null);
ClosableStrategy strategy = new ClosableStrategy();
AdditiveTumbling additiveTumbling = new AdditiveTumbling(strategy, window, config);
Assert.assertFalse(additiveTumbling.initialize().isPresent());
Assert.assertFalse(additiveTumbling.isClosed());
Assert.assertFalse(additiveTumbling.isClosedForPartition());
strategy.setClosed(true);
Assert.assertFalse(additiveTumbling.isClosed());
Assert.assertFalse(additiveTumbling.isClosedForPartition());
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class ReactiveTest method testNotClosedOnStrategyClosed.
@Test
public void testNotClosedOnStrategyClosed() {
Window window = makeReactiveWindow();
ClosableStrategy strategy = new ClosableStrategy();
SlidingRecord sliding = new SlidingRecord(strategy, window, config);
Assert.assertFalse(sliding.initialize().isPresent());
Assert.assertFalse(sliding.isClosed());
Assert.assertFalse(sliding.isClosedForPartition());
strategy.setClosed(true);
Assert.assertFalse(sliding.isClosed());
Assert.assertFalse(sliding.isClosedForPartition());
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class ReactiveTest method testReachingWindowSizeOnConsume.
@Test
public void testReachingWindowSizeOnConsume() {
Window window = makeReactiveWindow();
Reactive reactive = new Reactive(strategy, window, config);
Assert.assertFalse(reactive.initialize().isPresent());
Assert.assertFalse(reactive.isClosed());
Assert.assertFalse(reactive.isClosedForPartition());
Assert.assertEquals(strategy.getConsumeCalls(), 0);
reactive.consume(RecordBox.get().getRecord());
Assert.assertTrue(reactive.isClosed());
Assert.assertTrue(reactive.isClosedForPartition());
Assert.assertEquals(strategy.getConsumeCalls(), 1);
}
use of com.yahoo.bullet.parsing.Window in project bullet-core by yahoo.
the class ReactiveTest method testResetting.
@Test
public void testResetting() {
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.reset();
Assert.assertFalse(reactive.isClosed());
Assert.assertFalse(reactive.isClosedForPartition());
Assert.assertEquals(strategy.getResetCalls(), 1);
}
Aggregations