Search in sources :

Example 1 with MockStrategy

use of com.yahoo.bullet.querying.aggregations.MockStrategy in project bullet-core by yahoo.

the class SlidingRecordTest method setup.

@BeforeMethod
private void setup() {
    strategy = new MockStrategy();
    config = new BulletConfig();
    addMetadata(config, ALL_METADATA);
}
Also used : MockStrategy(com.yahoo.bullet.querying.aggregations.MockStrategy) BulletConfig(com.yahoo.bullet.common.BulletConfig) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with MockStrategy

use of com.yahoo.bullet.querying.aggregations.MockStrategy in project bullet-core by yahoo.

the class BasicTest method setup.

@BeforeMethod
private void setup() {
    config = new BulletConfig();
    strategy = new MockStrategy();
}
Also used : BulletConfig(com.yahoo.bullet.common.BulletConfig) MockStrategy(com.yahoo.bullet.querying.aggregations.MockStrategy) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with MockStrategy

use of com.yahoo.bullet.querying.aggregations.MockStrategy in project bullet-core by yahoo.

the class SlidingRecordTest method testReachingWindowSizeOnCombine.

@Test
public void testReachingWindowSizeOnCombine() {
    Window window = makeSlidingWindow(10);
    SlidingRecord sliding = new SlidingRecord(strategy, window, config);
    Assert.assertFalse(sliding.isClosed());
    Assert.assertFalse(sliding.isClosedForPartition());
    for (int i = 0; i < 6; ++i) {
        sliding.consume(RecordBox.get().getRecord());
        Assert.assertFalse(sliding.isClosed());
        Assert.assertTrue(sliding.isClosedForPartition());
    }
    Assert.assertEquals(strategy.getConsumeCalls(), 6);
    byte[] data = sliding.getData();
    // Remake
    strategy = new MockStrategy();
    sliding = new SlidingRecord(strategy, window, config);
    // Combine in the old data
    sliding.combine(data);
    for (int i = 0; i < 3; ++i) {
        sliding.consume(RecordBox.get().getRecord());
        Assert.assertFalse(sliding.isClosed());
        Assert.assertTrue(sliding.isClosedForPartition());
    }
    Assert.assertFalse(sliding.isClosed());
    Assert.assertTrue(sliding.isClosedForPartition());
    sliding.consume(RecordBox.get().getRecord());
    Assert.assertTrue(sliding.isClosed());
    Assert.assertTrue(sliding.isClosedForPartition());
    Assert.assertEquals(strategy.getConsumeCalls(), 4);
    Assert.assertEquals(strategy.getCombineCalls(), 1);
}
Also used : Window(com.yahoo.bullet.query.Window) MockStrategy(com.yahoo.bullet.querying.aggregations.MockStrategy) Test(org.testng.annotations.Test)

Example 4 with MockStrategy

use of com.yahoo.bullet.querying.aggregations.MockStrategy in project bullet-core by yahoo.

the class AdditiveTumblingTest method setup.

@BeforeMethod
private void setup() {
    strategy = new MockStrategy();
    config = new BulletConfig();
    addMetadata(config, ALL_METADATA);
}
Also used : MockStrategy(com.yahoo.bullet.querying.aggregations.MockStrategy) BulletConfig(com.yahoo.bullet.common.BulletConfig) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with MockStrategy

use of com.yahoo.bullet.querying.aggregations.MockStrategy in project bullet-core by yahoo.

the class TumblingTest method setup.

@BeforeMethod
private void setup() {
    strategy = new MockStrategy();
    config = new BulletConfig();
    addMetadata(config, ALL_METADATA);
}
Also used : MockStrategy(com.yahoo.bullet.querying.aggregations.MockStrategy) BulletConfig(com.yahoo.bullet.common.BulletConfig) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

MockStrategy (com.yahoo.bullet.querying.aggregations.MockStrategy)5 BulletConfig (com.yahoo.bullet.common.BulletConfig)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 Window (com.yahoo.bullet.query.Window)1 Test (org.testng.annotations.Test)1