use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.
the class RunningQueryTest method testCreatingWithStringQuery.
@Test
public void testCreatingWithStringQuery() {
BulletConfig config = new BulletConfig();
RunningQuery runningQuery = new RunningQuery("foo", "{}", config);
Assert.assertFalse(runningQuery.initialize().isPresent());
Assert.assertEquals(runningQuery.getId(), "foo");
Assert.assertNotNull(runningQuery.getQuery());
Assert.assertEquals(runningQuery.toString(), "{}");
}
use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.
the class RunningQueryTest method testTimingOut.
@Test
public void testTimingOut() throws Exception {
BulletConfig config = new BulletConfig();
Query query = new Query();
query.setAggregation(new Aggregation());
query.setDuration(1L);
query.configure(config);
Assert.assertFalse(query.initialize().isPresent());
RunningQuery runningQuery = new RunningQuery("foo", query);
Assert.assertFalse(runningQuery.initialize().isPresent());
// Sleep to make sure it's 1 ms
Thread.sleep(1);
Assert.assertTrue(runningQuery.isTimedOut());
}
use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.
the class RunningQueryTest method testInitialization.
@Test
public void testInitialization() {
BulletConfig config = new BulletConfig();
String query = makeAggregationQuery(Aggregation.Type.RAW, null, Window.Unit.RECORD, 10, Window.Unit.TIME, 2000);
RunningQuery runningQuery = new RunningQuery("foo", query, config);
Optional<List<BulletError>> errors = runningQuery.initialize();
Assert.assertTrue(errors.isPresent());
Assert.assertEquals(errors.get(), Collections.singletonList(Window.NOT_ONE_RECORD_EMIT));
}
use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.
the class RunningQueryTest method testCreatingWithQuery.
@Test
public void testCreatingWithQuery() {
BulletConfig config = new BulletConfig();
Query query = new Query();
query.setAggregation(new Aggregation());
query.configure(config);
Assert.assertFalse(query.initialize().isPresent());
RunningQuery runningQuery = new RunningQuery("foo", query);
Assert.assertFalse(runningQuery.initialize().isPresent());
Assert.assertEquals(runningQuery.getId(), "foo");
Assert.assertNotNull(runningQuery.getQuery());
String actual = runningQuery.toString();
Assert.assertTrue(actual.contains("{"));
Assert.assertTrue(actual.contains("filters: null, projection: null,"));
Assert.assertTrue(actual.contains("aggregation: {size: 500, type: RAW, fields: null, attributes: null},"));
Assert.assertTrue(actual.contains("window: null, duration:"));
Assert.assertTrue(actual.contains("}"));
}
use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.
the class WindowingOperationsTest method testNotForcingNonRawToTumbling.
@Test
public void testNotForcingNonRawToTumbling() {
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.GROUP);
query.setAggregation(aggregation);
Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), Reactive.class);
}
Aggregations