EnrichmentCoprocessor extends BaseRegionObserver { @Override public void start(CoprocessorEnvironment ce) throws IOException { LOG.info("Starting enrichment coprocessor"); if (ce instanceof RegionCoprocessorEnvironment) { this.coprocessorEnv = (RegionCoprocessorEnvironment) ce; } else { throw new CoprocessorException("Enrichment coprocessor must be loaded on a table region."); } LOG.info("Checking if internal cache initialized"); if (null == this.cache) { LOG.info("Cache null, initializing"); LOG.info("Getting global config from Zookeeper"); String zkUrl = getZookeeperUrl(this.coprocessorEnv.getConfiguration()); if (null == globalConfigService) { globalConfigService = getGlobalConfigService(zkUrl); } globalConfig = globalConfigService.get(); Configuration config = this.coprocessorEnv.getConfiguration(); CacheWriter<String, String> cacheWriter = null; try { String hbaseTableProviderName = (String) globalConfig .get(EnrichmentConfigurations.TABLE_PROVIDER); String tableName = (String) globalConfig.get(EnrichmentConfigurations.TABLE_NAME); String columnFamily = (String) globalConfig.get(EnrichmentConfigurations.COLUMN_FAMILY); cacheWriter = new HBaseCacheWriter(config, TableProvider .create(hbaseTableProviderName, HTableProvider::new), tableName, columnFamily, COLUMN_QUALIFIER); } catch (ClassNotFoundException | InstantiationException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { throw new IOException("Unable to instantiate cache writer", e); } this.cache = Caffeine.newBuilder().writer(cacheWriter).build(); LOG.info("Finished initializing cache"); } LOG.info("Finished starting enrichment coprocessor"); } EnrichmentCoprocessor();  EnrichmentCoprocessor(CacheWriter<String, String> cacheWriter,
      GlobalConfigService globalConfigService);  EnrichmentCoprocessor(GlobalConfigService globalConfigService); @Override void start(CoprocessorEnvironment ce); @Override void postPut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit,
      Durability durability); static final String ZOOKEEPER_URL; static final String COLUMN_QUALIFIER; }
@Test public void creates_tableprovider_from_config_property() throws Exception { cop = new EnrichmentCoprocessor(globalConfigService); Map<String, Object> globalConfig = new HashMap<String, Object>() {{ put(EnrichmentConfigurations.TABLE_PROVIDER, TestTableProvider.class.getName()); }}; when(globalConfigService.get()).thenReturn(globalConfig); cop.start(copEnv); assertThat(instantiatedCustomTableProvider, equalTo(true)); }