Search in sources :

Example 1 with ZKConfigurationsCache

use of org.apache.metron.common.zookeeper.ZKConfigurationsCache in project metron by apache.

the class SolrUpdateIntegrationTest method setup.

@BeforeEach
public void setup() throws Exception {
    solrComponent.addCollection(SENSOR_NAME, "./src/test/resources/config/test/conf");
    solrComponent.addCollection("error", "./src/main/config/schema/error");
    Map<String, Object> globalConfig = createGlobalConfig();
    globalConfig.put(HBaseDao.HBASE_TABLE, TABLE_NAME);
    globalConfig.put(HBaseDao.HBASE_CF, CF);
    CuratorFramework client = ConfigurationsUtils.getClient(solrComponent.getZookeeperUrl());
    client.start();
    ZKConfigurationsCache cache = new ZKConfigurationsCache(client);
    cache.start();
    AccessConfig accessConfig = new AccessConfig();
    accessConfig.setGlobalConfigSupplier(() -> globalConfig);
    accessConfig.setIndexSupplier(s -> s);
    accessConfig.setIndexSupplier(IndexingCacheUtil.getIndexLookupFunction(cache, "solr"));
    SolrDao dao = new SolrDao();
    dao.init(accessConfig);
    setDao(dao);
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) SolrDao(org.apache.metron.solr.dao.SolrDao) ZKConfigurationsCache(org.apache.metron.common.zookeeper.ZKConfigurationsCache) AccessConfig(org.apache.metron.indexing.dao.AccessConfig)

Aggregations

CuratorFramework (org.apache.curator.framework.CuratorFramework)1 ZKConfigurationsCache (org.apache.metron.common.zookeeper.ZKConfigurationsCache)1 AccessConfig (org.apache.metron.indexing.dao.AccessConfig)1 SolrDao (org.apache.metron.solr.dao.SolrDao)1