use of org.apache.metron.solr.dao.SolrDao in project metron by apache.
the class SolrRetrieveLatestIntegrationTest method testGetBrokenMapping.
@Test
public void testGetBrokenMapping() throws IOException {
AccessConfig accessConfig = new AccessConfig();
Map<String, Object> globalConfig = new HashMap<>();
globalConfig.put(SOLR_ZOOKEEPER, solrComponent.getZookeeperUrl());
accessConfig.setGlobalConfigSupplier(() -> globalConfig);
// Map the sensor name to the collection name for test.
accessConfig.setIndexSupplier(s -> null);
dao = new SolrDao();
dao.init(accessConfig);
Document actual = dao.getLatest("message_1_bro", TEST_SENSOR);
assertNull(actual);
}
use of org.apache.metron.solr.dao.SolrDao in project metron by apache.
the class SolrRetrieveLatestIntegrationTest method setup.
@BeforeEach
public void setup() throws Exception {
solrComponent.addCollection(TEST_COLLECTION, "./src/test/resources/config/test/conf");
solrComponent.addCollection(BRO_SENSOR, "./src/main/config/schema/bro");
AccessConfig accessConfig = new AccessConfig();
Map<String, Object> globalConfig = new HashMap<>();
globalConfig.put(SOLR_ZOOKEEPER, solrComponent.getZookeeperUrl());
accessConfig.setGlobalConfigSupplier(() -> globalConfig);
// Map the sensor name to the collection name for test.
accessConfig.setIndexSupplier(s -> s.equals(TEST_SENSOR) ? TEST_COLLECTION : s);
dao = new SolrDao();
dao.init(accessConfig);
addData(BRO_SENSOR, BRO_SENSOR, expectedTimestamp);
addData(TEST_COLLECTION, TEST_SENSOR, expectedTimestamp);
}
use of org.apache.metron.solr.dao.SolrDao 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);
}
use of org.apache.metron.solr.dao.SolrDao in project metron by apache.
the class SolrSearchIntegrationTest method createDao.
protected static IndexDao createDao() {
AccessConfig config = new AccessConfig();
config.setMaxSearchResults(100);
config.setMaxSearchGroups(100);
config.setGlobalConfigSupplier(() -> new HashMap<String, Object>() {
{
put(SOLR_ZOOKEEPER, solrComponent.getZookeeperUrl());
}
});
config.setIndexSupplier(sensorType -> sensorType);
IndexDao dao = new SolrDao();
dao.init(config);
return dao;
}
Aggregations