Search in sources :

Example 16 with Window

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;
}
Also used : Window(com.yahoo.bullet.parsing.Window)

Example 17 with 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());
}
Also used : Window(com.yahoo.bullet.parsing.Window) Test(org.testng.annotations.Test)

Example 18 with Window

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());
}
Also used : Window(com.yahoo.bullet.parsing.Window) Test(org.testng.annotations.Test)

Example 19 with Window

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);
}
Also used : Window(com.yahoo.bullet.parsing.Window) Test(org.testng.annotations.Test)

Example 20 with Window

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);
}
Also used : Window(com.yahoo.bullet.parsing.Window) Test(org.testng.annotations.Test)

Aggregations

Window (com.yahoo.bullet.parsing.Window)32 Test (org.testng.annotations.Test)24 BulletConfig (com.yahoo.bullet.common.BulletConfig)6 Query (com.yahoo.bullet.parsing.Query)6 Aggregation (com.yahoo.bullet.parsing.Aggregation)5 MockStrategy (com.yahoo.bullet.aggregations.MockStrategy)2 Meta (com.yahoo.bullet.result.Meta)2 Arrays.asList (java.util.Arrays.asList)2 Collections.singletonList (java.util.Collections.singletonList)2 List (java.util.List)2 Map (java.util.Map)2 AdditiveTumbling (com.yahoo.bullet.windowing.AdditiveTumbling)1 Basic (com.yahoo.bullet.windowing.Basic)1 Reactive (com.yahoo.bullet.windowing.Reactive)1 Tumbling (com.yahoo.bullet.windowing.Tumbling)1