Search in sources :

Example 1 with StatementsConfig

use of com.ning.metrics.meteo.binder.StatementsConfig in project meteo by pierre.

the class TestPublishersCompilerStreamConfig method setUp.

@BeforeTest
public void setUp() {
    // Build the following configuration
    //     {
    //         "publishers": [
    //             {
    //                 "name": "OpenTSDB",
    //                 "type": "com.ning.metrics.meteo.publishers.OpenTSDBListener",
    //                 "host": "opentsdb.company.com",
    //                 "port": 4242
    //             }
    //         ],
    //
    //         "streams": [
    //             {
    //                 "name": "TPs of visit",
    //
    //                 "sql": [
    //                     "select tp90 from visit output last every 1 second"
    //                 ],
    //
    //                 "routes": [
    //                     {
    //                         "name": "OpenTSDB",
    //                         "filters": [ "predict", "tp90" ],
    //                         "timeAttribute": "visit_date"
    //                     }
    //                 ]
    //             }
    //         ]
    //     }
    statementsConfig = new StatementsConfig();
    final DummyPublisherConfig globalPublisherConfig = new DummyPublisherConfig();
    globalPublisherConfig.setName("OpenTSDB");
    globalPublisherConfig.setType("com.ning.metrics.meteo.publishers.OpenTSDBListener");
    globalPublisherConfig.setHost("opentsdb.company.com");
    globalPublisherConfig.setPort(4242);
    statementsConfig.setPublishers(Arrays.asList((PublisherConfig) globalPublisherConfig));
    final StreamConfig streamConfig = new StreamConfig();
    streamConfig.setName("TPs of Visit");
    streamConfig.setSql(Arrays.asList("select tp90 from visit output last every 1 second"));
    final HashMap<String, Object> localPublisherConfig = new HashMap<String, Object>();
    localPublisherConfig.put("name", "OpenTSDB");
    localPublisherConfig.put("filters", (Arrays.asList("predict", "tp90")));
    localPublisherConfig.put("timeAttribute", "visit_date");
    streamConfig.setRoutes(Arrays.<HashMap<String, Object>>asList(localPublisherConfig));
    statementsConfig.setStatementConfigs(Arrays.asList(streamConfig));
}
Also used : HashMap(java.util.HashMap) StatementsConfig(com.ning.metrics.meteo.binder.StatementsConfig) StreamConfig(com.ning.metrics.meteo.binder.StreamConfig) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

StatementsConfig (com.ning.metrics.meteo.binder.StatementsConfig)1 StreamConfig (com.ning.metrics.meteo.binder.StreamConfig)1 HashMap (java.util.HashMap)1 BeforeTest (org.testng.annotations.BeforeTest)1