FluoConfiguration extends SimpleConfiguration { @Deprecated public List<ObserverSpecification> getObserverSpecifications() { List<ObserverSpecification> configList = new ArrayList<>(); Iterator<String> iter = getKeys(); while (iter.hasNext()) { String key = iter.next(); if (key.startsWith(FluoConfiguration.OBSERVER_PREFIX) && !key.equals(FluoConfiguration.OBSERVER_PROVIDER) && !key.equals(FluoConfiguration.OBSERVER_INIT_DIR_PROP) && !key.equals(FluoConfiguration.OBSERVER_JARS_URL_PROP)) { String value = getString(key).trim(); if (value.isEmpty()) { throw new IllegalArgumentException(key + " is set to empty value"); } String[] fields = value.split(","); if (fields.length == 0) { throw new IllegalArgumentException(key + " has bad value: " + value); } String className = fields[0]; if (className.isEmpty()) { throw new IllegalArgumentException(key + " has empty class name: " + className); } Map<String, String> params = new HashMap<>(); for (int i = 1; i < fields.length; i++) { String[] kv = fields[i].split("="); if (kv.length != 2) { throw new IllegalArgumentException(key + " has invalid param. Expected 'key=value' but encountered '" + fields[i] + "'"); } if (kv[0].isEmpty() || kv[1].isEmpty()) { throw new IllegalArgumentException( key + " has empty key or value in param: " + fields[i]); } params.put(kv[0], kv[1]); } ObserverSpecification observerSpecification = new ObserverSpecification(className, params); configList.add(observerSpecification); } } return configList; } FluoConfiguration();  FluoConfiguration(SimpleConfiguration other);  FluoConfiguration(InputStream in);  FluoConfiguration(File propertiesFile);  FluoConfiguration(Map<String, String> map); void validate(); FluoConfiguration setApplicationName(String applicationName); String getApplicationName(); FluoConfiguration setInstanceZookeepers(String zookeepers); String getInstanceZookeepers(); String getAppZookeepers(); FluoConfiguration setZookeeperTimeout(int timeout); int getZookeeperTimeout(); String getZookeeperSecret(); void setZookeeperSecret(String secret); @Deprecated FluoConfiguration setClientRetryTimeout(int timeoutMs); @Deprecated int getClientRetryTimeout(); FluoConfiguration setConnectionRetryTimeout(int timeoutMS); int getConnectionRetryTimeout(); FluoConfiguration setAccumuloInstance(String accumuloInstance); String getAccumuloInstance(); FluoConfiguration setAccumuloUser(String accumuloUser); String getAccumuloUser(); FluoConfiguration setAccumuloPassword(String accumuloPassword); String getAccumuloPassword(); FluoConfiguration setAccumuloZookeepers(String zookeepers); String getAccumuloZookeepers(); FluoConfiguration setAccumuloTable(String table); String getAccumuloTable(); FluoConfiguration setAccumuloJars(String path); String getAccumuloJars(); FluoConfiguration setDfsRoot(String dfsRoot); String getDfsRoot(); FluoConfiguration setWorkerThreads(int numThreads); int getWorkerThreads(); @Deprecated List<ObserverSpecification> getObserverSpecifications(); void setObserverProvider(String className); void setObserverProvider(Class<? extends ObserverProvider> clazz); FluoConfiguration setObserverInitDir(String observerDir); String getObserverInitDir(); FluoConfiguration setObserverJarsUrl(String observerJarsUrl); String getObserverJarsUrl(); String getObserverProvider(); @Deprecated FluoConfiguration addObserver(ObserverSpecification oconf); @Deprecated FluoConfiguration addObservers(Iterable<ObserverSpecification> observers); @Deprecated FluoConfiguration clearObservers(); FluoConfiguration setTransactionRollbackTime(long time, TimeUnit tu); long getTransactionRollbackTime(); FluoConfiguration setLoaderThreads(int numThreads); int getLoaderThreads(); FluoConfiguration setLoaderQueueSize(int queueSize); int getLoaderQueueSize(); SimpleConfiguration getReporterConfiguration(String reporter); SimpleConfiguration getAppConfiguration(); FluoConfiguration setMiniStartAccumulo(boolean startAccumulo); boolean getMiniStartAccumulo(); FluoConfiguration setMiniDataDir(String dataDir); String getMiniDataDir(); void print(); boolean hasRequiredConnectionProps(); boolean hasRequiredClientProps(); boolean hasRequiredAdminProps(); boolean hasRequiredOracleProps(); boolean hasRequiredWorkerProps(); boolean hasRequiredMiniFluoProps(); SimpleConfiguration getClientConfiguration(); static SimpleConfiguration getDefaultConfiguration(); static void setDefaultConfiguration(SimpleConfiguration config); static final String FLUO_PREFIX; @Deprecated
  static final String CLIENT_APPLICATION_NAME_PROP; @Deprecated
  static final String CLIENT_ACCUMULO_PASSWORD_PROP; @Deprecated
  static final String CLIENT_ACCUMULO_USER_PROP; @Deprecated
  static final String CLIENT_ACCUMULO_INSTANCE_PROP; @Deprecated
  static final String CLIENT_ACCUMULO_ZOOKEEPERS_PROP; @Deprecated
  static final String CLIENT_ZOOKEEPER_TIMEOUT_PROP; @Deprecated
  static final String CLIENT_ZOOKEEPER_CONNECT_PROP; @Deprecated
  static final String CLIENT_RETRY_TIMEOUT_MS_PROP; @Deprecated
  static final int CLIENT_ZOOKEEPER_TIMEOUT_DEFAULT; @Deprecated
  static final String CLIENT_ACCUMULO_ZOOKEEPERS_DEFAULT; @Deprecated
  static final String CLIENT_ZOOKEEPER_CONNECT_DEFAULT; @Deprecated
  static final int CLIENT_RETRY_TIMEOUT_MS_DEFAULT; static final String CONNECTION_PREFIX; static final String CONNECTION_APPLICATION_NAME_PROP; static final String CONNECTION_ZOOKEEPER_TIMEOUT_PROP; static final String CONNECTION_ZOOKEEPER_SECRET; static final String CONNECTION_ZOOKEEPERS_PROP; static final String CONNECTION_RETRY_TIMEOUT_MS_PROP; static final int CONNECTION_ZOOKEEPER_TIMEOUT_DEFAULT; static final String CONNECTION_ZOOKEEPERS_DEFAULT; static final int CONNECTION_RETRY_TIMEOUT_MS_DEFAULT; static final String ACCUMULO_INSTANCE_PROP; static final String ACCUMULO_TABLE_PROP; static final String ACCUMULO_PASSWORD_PROP; static final String ACCUMULO_USER_PROP; static final String ACCUMULO_ZOOKEEPERS_PROP; static final String ACCUMULO_JARS_PROP; static final String ACCUMULO_ZOOKEEPERS_DEFAULT; static final String ACCUMULO_JARS_DEFAULT; static final String DFS_ROOT_PROP; static final String DFS_ROOT_DEFAULT; @Deprecated
  static final String ADMIN_ACCUMULO_TABLE_PROP; static final String WORKER_NUM_THREADS_PROP; static final int WORKER_NUM_THREADS_DEFAULT; static final String LOADER_NUM_THREADS_PROP; static final String LOADER_QUEUE_SIZE_PROP; static final int LOADER_NUM_THREADS_DEFAULT; static final int LOADER_QUEUE_SIZE_DEFAULT; static final String MINI_START_ACCUMULO_PROP; static final String MINI_DATA_DIR_PROP; static final boolean MINI_START_ACCUMULO_DEFAULT; static final String MINI_DATA_DIR_DEFAULT; static final String OBSERVER_PREFIX; static final String OBSERVER_PROVIDER; static final String OBSERVER_INIT_DIR_PROP; static final String OBSERVER_JARS_URL_PROP; static final String OBSERVER_PROVIDER_DEFAULT; static final String OBSERVER_INIT_DIR_DEFAULT; static final String OBSERVER_JARS_URL_DEFAULT; static final String TRANSACTION_PREFIX; static final String TRANSACTION_ROLLBACK_TIME_PROP; static final long TRANSACTION_ROLLBACK_TIME_DEFAULT; static final String REPORTER_PREFIX; static final String APP_PREFIX; }
@SuppressWarnings("deprecation") @Test public void testObserverConfig() { FluoConfiguration config = new FluoConfiguration(); config.setProperty(FluoConfiguration.OBSERVER_PREFIX + "1", "com.foo.Observer2,configKey1=configVal1,configKey2=configVal2"); List<ObserverSpecification> ocList = config.getObserverSpecifications(); Assert.assertEquals(1, ocList.size()); Assert.assertEquals("com.foo.Observer2", ocList.get(0).getClassName()); Assert.assertEquals("configVal1", ocList.get(0).getConfiguration().getString("configKey1")); Assert.assertEquals("configVal2", ocList.get(0).getConfiguration().getString("configKey2")); Assert.assertEquals(2, ocList.get(0).getConfiguration().toMap().size()); assertIAE("class,bad,input"); assertIAE("index,check,,phrasecount.PhraseCounter"); assertIAE(""); assertIAE(" "); assertIAE(",key=value"); assertIAE(","); assertIAE("com.foo.Observer2,configKey1=,configKey2=configVal2"); assertIAE("com.foo.Observer2,configKey1=val,=configVal2"); config = new FluoConfiguration(); config.setProperty(FluoConfiguration.OBSERVER_PREFIX + "1", "Class,"); ocList = config.getObserverSpecifications(); Assert.assertEquals(1, ocList.size()); Assert.assertEquals("Class", ocList.get(0).getClassName()); Assert.assertEquals(0, ocList.get(0).getConfiguration().toMap().size()); }