ThreatIntelAdapter implements EnrichmentAdapter<CacheKey>,Serializable { @Override public boolean initializeAdapter(Map<String, Object> configuration) { PersistentAccessTracker accessTracker; String hbaseTable = config.getHBaseTable(); int expectedInsertions = config.getExpectedInsertions(); double falsePositives = config.getFalsePositiveRate(); String trackerHBaseTable = config.getTrackerHBaseTable(); String trackerHBaseCF = config.getTrackerHBaseCF(); long millisecondsBetweenPersist = config.getMillisecondsBetweenPersists(); BloomAccessTracker bat = new BloomAccessTracker(hbaseTable, expectedInsertions, falsePositives); Configuration hbaseConfig = HBaseConfiguration.create(); try { accessTracker = new PersistentAccessTracker( hbaseTable , UUID.randomUUID().toString() , config.getProvider().getTable(hbaseConfig, trackerHBaseTable) , trackerHBaseCF , bat , millisecondsBetweenPersist ); lookup = new EnrichmentLookup(config.getProvider().getTable(hbaseConfig, hbaseTable), config.getHBaseCF(), accessTracker); } catch (IOException e) { LOG.error("Unable to initialize ThreatIntelAdapter", e); return false; } return true; } ThreatIntelAdapter();  ThreatIntelAdapter(ThreatIntelConfig config); ThreatIntelAdapter withConfig(ThreatIntelConfig config); @Override void logAccess(CacheKey value); @Override JSONObject enrich(CacheKey value); boolean isInitialized(); @Override boolean initializeAdapter(Map<String, Object> configuration); @Override void updateAdapter(Map<String, Object> config); @Override void cleanup(); @Override String getOutputPrefix(CacheKey value);  }
@Test public void testInitializeAdapter() { String cf = "cf"; String table = "threatintel"; String trackCf = "cf"; String trackTable = "Track"; double falsePositive = 0.03; int expectedInsertion = 1; long millionseconds = (long) 0.1; ThreatIntelConfig config = new ThreatIntelConfig(); config.withHBaseCF(cf); config.withHBaseTable(table); config.withExpectedInsertions(expectedInsertion); config.withFalsePositiveRate(falsePositive); config.withMillisecondsBetweenPersists(millionseconds); config.withTrackerHBaseCF(trackCf); config.withTrackerHBaseTable(trackTable); config.withProviderImpl(ExceptionProvider.class.getName()); ThreatIntelAdapter tia = new ThreatIntelAdapter(config); UnitTestHelper.setLog4jLevel(ThreatIntelAdapter.class, Level.FATAL); tia.initializeAdapter(null); UnitTestHelper.setLog4jLevel(ThreatIntelAdapter.class, Level.ERROR); assertFalse(tia.isInitialized()); }