Search in sources :

Example 41 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class WindowingOperationsTest method testAdditiveTumblingWindow.

@Test
public void testAdditiveTumblingWindow() {
    BulletConfig config = new BulletConfig();
    Query query = new Query();
    Window window = WindowUtils.makeWindow(Window.Unit.TIME, 1000, Window.Unit.ALL, null);
    window.configure(config);
    query.setWindow(window);
    Aggregation aggregation = new Aggregation();
    aggregation.setType(Aggregation.Type.GROUP);
    query.setAggregation(aggregation);
    Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), AdditiveTumbling.class);
}
Also used : Window(com.yahoo.bullet.parsing.Window) Aggregation(com.yahoo.bullet.parsing.Aggregation) Query(com.yahoo.bullet.parsing.Query) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 42 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class WindowingOperationsTest method testOtherWindowsForcedToTumbling.

@Test
public void testOtherWindowsForcedToTumbling() {
    BulletConfig config = new BulletConfig();
    Query query = new Query();
    Window window = WindowUtils.makeWindow(Window.Unit.TIME, 1000, Window.Unit.RECORD, 4);
    window.configure(config);
    query.setWindow(window);
    Aggregation aggregation = new Aggregation();
    aggregation.setType(Aggregation.Type.COUNT_DISTINCT);
    query.setAggregation(aggregation);
    Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), Tumbling.class);
}
Also used : Window(com.yahoo.bullet.parsing.Window) Aggregation(com.yahoo.bullet.parsing.Aggregation) Query(com.yahoo.bullet.parsing.Query) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 43 with BulletConfig

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

Example 44 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class PubSubTest method testIllegalPubSubClassName.

@Test(expectedExceptions = PubSubException.class)
public void testIllegalPubSubClassName() throws PubSubException {
    BulletConfig config = new BulletConfig(null);
    config.set(BulletConfig.PUBSUB_CLASS_NAME, null);
    try {
        PubSub.from(config);
    } catch (Exception e) {
        Assert.assertEquals(e.getCause().getClass(), NullPointerException.class);
        throw e;
    }
}
Also used : BulletConfig(com.yahoo.bullet.common.BulletConfig) InvocationTargetException(java.lang.reflect.InvocationTargetException) Test(org.testng.annotations.Test)

Example 45 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class RESTPubSubTest method testGetSubscribers.

@Test
public void testGetSubscribers() throws PubSubException {
    BulletConfig config = new BulletConfig("src/test/resources/test_config.yaml");
    config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_SUBMISSION");
    RESTPubSub pubSub = new RESTPubSub(config);
    List<Subscriber> subscribers = pubSub.getSubscribers(8);
    Assert.assertNotNull(subscribers);
    Assert.assertTrue(subscribers.get(0) instanceof RESTSubscriber);
    Assert.assertTrue(subscribers.get(7) instanceof RESTSubscriber);
    config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_PROCESSING");
    pubSub = new RESTPubSub(config);
    subscribers = pubSub.getSubscribers(8);
    Assert.assertNotNull(subscribers);
    Assert.assertTrue(subscribers.get(0) instanceof RESTSubscriber);
    Assert.assertTrue(subscribers.get(7) instanceof RESTSubscriber);
}
Also used : Subscriber(com.yahoo.bullet.pubsub.Subscriber) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Aggregations

BulletConfig (com.yahoo.bullet.common.BulletConfig)101 Test (org.testng.annotations.Test)87 Aggregation (com.yahoo.bullet.parsing.Aggregation)37 List (java.util.List)25 Query (com.yahoo.bullet.parsing.Query)20 QueryUtils.makeAggregationQuery (com.yahoo.bullet.parsing.QueryUtils.makeAggregationQuery)17 BulletError (com.yahoo.bullet.common.BulletError)16 BulletRecord (com.yahoo.bullet.record.BulletRecord)16 Arrays.asList (java.util.Arrays.asList)16 Clip (com.yahoo.bullet.result.Clip)14 Collections.singletonList (java.util.Collections.singletonList)12 QueryUtils.makeProjectionFilterQuery (com.yahoo.bullet.parsing.QueryUtils.makeProjectionFilterQuery)11 QueryUtils.makeRawFullQuery (com.yahoo.bullet.parsing.QueryUtils.makeRawFullQuery)11 Map (java.util.Map)11 AggregationUtils.makeAttributes (com.yahoo.bullet.parsing.AggregationUtils.makeAttributes)10 Window (com.yahoo.bullet.parsing.Window)10 Concept (com.yahoo.bullet.result.Meta.Concept)10 RecordBox (com.yahoo.bullet.result.RecordBox)10 ArrayList (java.util.ArrayList)10 IntStream (java.util.stream.IntStream)10