use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class SimpleHBaseAdapterTest method testEnrichNonStringValue.
@Test
public void testEnrichNonStringValue() 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", 10L, broSc));
Assert.assertEquals(actualMessage, new JSONObject());
}
use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class ThreatIntelAdapterTest method testEnrichNonString.
@Test
public void testEnrichNonString() 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);
actualMessage = tia.enrich(new CacheKey("ip_dst_addr", 10L, broSc));
Assert.assertEquals(actualMessage, new JSONObject());
}
use of org.apache.metron.enrichment.bolt.CacheKey in project metron by apache.
the class ParallelEnricherTest method setup.
@BeforeClass
public static void setup() {
ConcurrencyContext infrastructure = new ConcurrencyContext();
infrastructure.initialize(5, 100, 10, null, null, false);
stellarContext = new Context.Builder().build();
StellarFunctions.initialize(stellarContext);
StellarAdapter adapter = new StellarAdapter() {
@Override
public void logAccess(CacheKey value) {
numAccesses.incrementAndGet();
}
}.ofType("ENRICHMENT");
adapter.initializeAdapter(new HashMap<>());
enrichmentsByType = ImmutableMap.of("stellar", adapter);
enricher = new ParallelEnricher(enrichmentsByType, infrastructure, false);
}
Aggregations