use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class GeoAdapterTest method testEnrichNonString.
@Test
public void testEnrichNonString() throws Exception {
JSONObject actualMessage = geo.enrich(new CacheKey("dummy", 10L, null));
Assert.assertEquals(new JSONObject(), actualMessage);
}
use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class HostFromJSONListAdapterTest method testEnrich.
@Test
public void testEnrich() throws Exception {
HostFromJSONListAdapter hja = new HostFromJSONListAdapter(expectedKnownHostsString);
JSONObject actualMessage = hja.enrich(new CacheKey("dummy", ip, null));
Assert.assertNotNull(actualMessage);
Assert.assertEquals(expectedMessage, actualMessage);
actualMessage = hja.enrich(new CacheKey("dummy", ip1, null));
JSONObject emptyJson = new JSONObject();
Assert.assertEquals(emptyJson, actualMessage);
}
use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class SimpleHBaseAdapterTest method testMultiColumnFamiliesWrongCF.
@Test
public void testMultiColumnFamiliesWrongCF() throws Exception {
SimpleHBaseAdapter sha = new SimpleHBaseAdapter();
sha.lookup = lookup;
SensorEnrichmentConfig broSc = JSONUtils.INSTANCE.load(sourceConfigStr, SensorEnrichmentConfig.class);
JSONObject actualMessage = sha.enrich(new CacheKey("test", "test", broSc));
Assert.assertEquals(actualMessage, new JSONObject());
actualMessage = sha.enrich(new CacheKey("ip_dst_addr", "10.0.2.4", broSc));
Assert.assertNotNull(actualMessage);
Assert.assertEquals(new JSONObject(new HashMap<String, Object>()), actualMessage);
}
use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class SimpleHBaseAdapterTest method testEnrich.
@Test
public void testEnrich() throws Exception {
SimpleHBaseAdapter sha = new SimpleHBaseAdapter();
sha.lookup = lookup;
SensorEnrichmentConfig broSc = JSONUtils.INSTANCE.load(sourceConfigStr, SensorEnrichmentConfig.class);
JSONObject actualMessage = sha.enrich(new CacheKey("test", "test", broSc));
Assert.assertEquals(actualMessage, new JSONObject());
actualMessage = sha.enrich(new CacheKey("ip_dst_addr", "10.0.2.3", broSc));
Assert.assertNotNull(actualMessage);
Assert.assertEquals(expectedMessage, actualMessage);
}
use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class ThreatIntelAdapterTest method testEnrich.
@Test
public void testEnrich() throws Exception {
ThreatIntelAdapter tia = new ThreatIntelAdapter();
tia.lookup = lookup;
SensorEnrichmentConfig broSc = JSONUtils.INSTANCE.load(sourceConfigStr, SensorEnrichmentConfig.class);
JSONObject actualMessage = tia.enrich(new CacheKey("ip_dst_addr", "10.0.2.3", broSc));
Assert.assertNotNull(actualMessage);
Assert.assertEquals(expectedMessage, actualMessage);
}
Aggregations