Search in sources :

Example 31 with Document

use of org.apache.metron.indexing.dao.update.Document in project metron by apache.

the class SearchIntegrationTest method get_all_latest_guid.

@Test
public void get_all_latest_guid() throws Exception {
    List<GetRequest> request = JSONUtils.INSTANCE.load(getAllLatestQuery, new JSONUtils.ReferenceSupplier<List<GetRequest>>() {
    });
    Map<String, Document> docs = new HashMap<>();
    for (Document doc : dao.getAllLatest(request)) {
        docs.put(doc.getGuid(), doc);
    }
    Assert.assertEquals(2, docs.size());
    Assert.assertTrue(docs.keySet().contains("bro_1"));
    Assert.assertTrue(docs.keySet().contains("snort_2"));
    Assert.assertEquals("bro", docs.get("bro_1").getDocument().get("source:type"));
    Assert.assertEquals("snort", docs.get("snort_2").getDocument().get("source:type"));
}
Also used : HashMap(java.util.HashMap) GetRequest(org.apache.metron.indexing.dao.search.GetRequest) ArrayList(java.util.ArrayList) List(java.util.List) Document(org.apache.metron.indexing.dao.update.Document) JSONUtils(org.apache.metron.common.utils.JSONUtils) Test(org.junit.Test)

Aggregations

Document (org.apache.metron.indexing.dao.update.Document)31 ArrayList (java.util.ArrayList)13 GetRequest (org.apache.metron.indexing.dao.search.GetRequest)12 Map (java.util.Map)11 HashMap (java.util.HashMap)10 Test (org.junit.Test)10 IOException (java.io.IOException)9 List (java.util.List)6 Optional (java.util.Optional)6 Collectors (java.util.stream.Collectors)5 AccessConfig (org.apache.metron.indexing.dao.AccessConfig)5 IndexDao (org.apache.metron.indexing.dao.IndexDao)5 MetaAlertCreateResponse (org.apache.metron.indexing.dao.metaalert.MetaAlertCreateResponse)4 FieldType (org.apache.metron.indexing.dao.search.FieldType)4 GroupRequest (org.apache.metron.indexing.dao.search.GroupRequest)4 SearchRequest (org.apache.metron.indexing.dao.search.SearchRequest)4 java.util (java.util)3 Constants (org.apache.metron.common.Constants)3 MockHBaseTableProvider (org.apache.metron.hbase.mock.MockHBaseTableProvider)3 MetaAlertCreateRequest (org.apache.metron.indexing.dao.metaalert.MetaAlertCreateRequest)3