Search in sources :

Example 1 with QueryHostFinder

use of org.apache.druid.server.router.QueryHostFinder in project druid by druid-io.

the class AsyncQueryForwardingServletTest method testSqlQueryProxy.

@Test
public void testSqlQueryProxy() throws Exception {
    final SqlQuery query = new SqlQuery("SELECT * FROM foo", ResultFormat.ARRAY, false, false, false, null, null);
    final QueryHostFinder hostFinder = EasyMock.createMock(QueryHostFinder.class);
    EasyMock.expect(hostFinder.findServerSql(query)).andReturn(new TestServer("http", "1.2.3.4", 9999)).once();
    EasyMock.replay(hostFinder);
    Properties properties = new Properties();
    properties.setProperty("druid.router.sql.enable", "true");
    verifyServletCallsForQuery(query, true, hostFinder, properties);
}
Also used : SqlQuery(org.apache.druid.sql.http.SqlQuery) Properties(java.util.Properties) QueryHostFinder(org.apache.druid.server.router.QueryHostFinder) BaseJettyTest(org.apache.druid.server.initialization.BaseJettyTest) Test(org.junit.Test)

Example 2 with QueryHostFinder

use of org.apache.druid.server.router.QueryHostFinder in project druid by druid-io.

the class AsyncQueryForwardingServletTest method testQueryProxy.

@Test
public void testQueryProxy() throws Exception {
    final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("foo").intervals("2000/P1D").granularity(Granularities.ALL).context(ImmutableMap.of("queryId", "dummy")).build();
    final QueryHostFinder hostFinder = EasyMock.createMock(QueryHostFinder.class);
    EasyMock.expect(hostFinder.pickServer(query)).andReturn(new TestServer("http", "1.2.3.4", 9999)).once();
    EasyMock.replay(hostFinder);
    verifyServletCallsForQuery(query, false, hostFinder, new Properties());
}
Also used : TimeseriesQuery(org.apache.druid.query.timeseries.TimeseriesQuery) Properties(java.util.Properties) QueryHostFinder(org.apache.druid.server.router.QueryHostFinder) BaseJettyTest(org.apache.druid.server.initialization.BaseJettyTest) Test(org.junit.Test)

Aggregations

Properties (java.util.Properties)2 BaseJettyTest (org.apache.druid.server.initialization.BaseJettyTest)2 QueryHostFinder (org.apache.druid.server.router.QueryHostFinder)2 Test (org.junit.Test)2 TimeseriesQuery (org.apache.druid.query.timeseries.TimeseriesQuery)1 SqlQuery (org.apache.druid.sql.http.SqlQuery)1