AccumuloGraphConfiguration extends GraphConfiguration { public BatchWriterConfig createBatchWriterConfig() { long maxMemory = getConfigLong(BATCHWRITER_MAX_MEMORY, DEFAULT_BATCHWRITER_MAX_MEMORY); long maxLatency = getConfigLong(BATCHWRITER_MAX_LATENCY, DEFAULT_BATCHWRITER_MAX_LATENCY); int maxWriteThreads = getInt(BATCHWRITER_MAX_WRITE_THREADS, DEFAULT_BATCHWRITER_MAX_WRITE_THREADS); long timeout = getConfigLong(BATCHWRITER_TIMEOUT, DEFAULT_BATCHWRITER_TIMEOUT); BatchWriterConfig config = new BatchWriterConfig(); config.setMaxMemory(maxMemory); config.setMaxLatency(maxLatency, TimeUnit.MILLISECONDS); config.setMaxWriteThreads(maxWriteThreads); config.setTimeout(timeout, TimeUnit.MILLISECONDS); return config; } AccumuloGraphConfiguration(Map<String, Object> config);  AccumuloGraphConfiguration(Configuration configuration, String prefix); Connector createConnector(); @SuppressWarnings("unchecked") ClientConfiguration getClientConfiguration(); Map<String, String> getClientConfigurationProperties(); FileSystem createFileSystem(); AuthenticationToken getAuthenticationToken(); String getAccumuloUsername(); String getAccumuloInstanceName(); String getZookeeperServers(); boolean isAutoFlush(); long getMaxStreamingPropertyValueTableDataSize(); String getDataDir(); NameSubstitutionStrategy createSubstitutionStrategy(Graph graph); StreamingPropertyValueStorageStrategy createStreamingPropertyValueStorageStrategy(Graph graph); BatchWriterConfig createBatchWriterConfig(); Integer getMaxVersions(); Integer getExtendedDataMaxVersions(); int getNumberOfQueryThreads(); String getHdfsContextClasspath(); String getZookeeperMetadataSyncPath(); boolean isHistoryInSeparateTable(); boolean isCompressIteratorTransfers(); int getLargeValueErrorThreshold(); int getLargeValueWarningThreshold(); static final String HDFS_CONFIG_PREFIX; static final String BATCHWRITER_CONFIG_PREFIX; static final String ACCUMULO_INSTANCE_NAME; static final String ACCUMULO_USERNAME; static final String ACCUMULO_PASSWORD; static final String ZOOKEEPER_SERVERS; static final String ZOOKEEPER_METADATA_SYNC_PATH; static final String ACCUMULO_MAX_VERSIONS; static final String ACCUMULO_MAX_EXTENDED_DATA_VERSIONS; static final String HISTORY_IN_SEPARATE_TABLE; static final String NAME_SUBSTITUTION_STRATEGY_PROP_PREFIX; static final String MAX_STREAMING_PROPERTY_VALUE_TABLE_DATA_SIZE; static final String HDFS_USER; static final String HDFS_ROOT_DIR; static final String DATA_DIR; static final String BATCHWRITER_MAX_MEMORY; static final String BATCHWRITER_MAX_LATENCY; static final String BATCHWRITER_TIMEOUT; static final String BATCHWRITER_MAX_WRITE_THREADS; static final String NUMBER_OF_QUERY_THREADS; static final String HDFS_CONTEXT_CLASSPATH; static final String STREAMING_PROPERTY_VALUE_STORAGE_STRATEGY_PREFIX; static final String CLIENT_CONFIGURATION_PROPERTY_CONFIG_PREFIX; static final String COMPRESS_ITERATOR_TRANSFERS; static final String LARGE_VALUE_ERROR_THRESHOLD; static final String LARGE_VALUE_WARNING_THRESHOLD; static final String DEFAULT_ACCUMULO_PASSWORD; static final String DEFAULT_ACCUMULO_USERNAME; static final String DEFAULT_ACCUMULO_INSTANCE_NAME; static final String DEFAULT_ZOOKEEPER_SERVERS; static final String DEFAULT_ZOOKEEPER_METADATA_SYNC_PATH; static final int DEFAULT_MAX_STREAMING_PROPERTY_VALUE_TABLE_DATA_SIZE; static final String DEFAULT_HDFS_USER; static final String DEFAULT_HDFS_ROOT_DIR; static final String HADOOP_CONF_DIR; static final String DEFAULT_DATA_DIR; static final Long DEFAULT_BATCHWRITER_MAX_MEMORY; static final Long DEFAULT_BATCHWRITER_MAX_LATENCY; static final Long DEFAULT_BATCHWRITER_TIMEOUT; static final Integer DEFAULT_BATCHWRITER_MAX_WRITE_THREADS; static final Integer DEFAULT_ACCUMULO_MAX_VERSIONS; static final boolean DEFAULT_HISTORY_IN_SEPARATE_TABLE; static final int DEFAULT_NUMBER_OF_QUERY_THREADS; static final String DEFAULT_HDFS_CONTEXT_CLASSPATH; static final String DEFAULT_STREAMING_PROPERTY_VALUE_STORAGE_STRATEGY; static final boolean DEFAULT_COMPRESS_ITERATOR_TRANSFERS; static final int DEFAULT_LARGE_VALUE_ERROR_THRESHOLD; static final int DEFAULT_LARGE_VALUE_WARNING_THRESHOLD; static final String[] HADOOP_CONF_FILENAMES; }
@Test @SuppressWarnings("unchecked") public void testBatchWriterConfigUsesDefaultWithNoParameters() { Map configMap = Maps.newHashMap(); AccumuloGraphConfiguration accumuloGraphConfiguration = new AccumuloGraphConfiguration(configMap); BatchWriterConfig batchWriterConfig = accumuloGraphConfiguration.createBatchWriterConfig(); assertThat(batchWriterConfig.getMaxLatency(TimeUnit.MILLISECONDS), is(AccumuloGraphConfiguration.DEFAULT_BATCHWRITER_MAX_LATENCY)); assertThat(batchWriterConfig.getTimeout(TimeUnit.MILLISECONDS), is(AccumuloGraphConfiguration.DEFAULT_BATCHWRITER_TIMEOUT)); assertThat(batchWriterConfig.getMaxMemory(), is(AccumuloGraphConfiguration.DEFAULT_BATCHWRITER_MAX_MEMORY)); assertThat(batchWriterConfig.getMaxWriteThreads(), is(AccumuloGraphConfiguration.DEFAULT_BATCHWRITER_MAX_WRITE_THREADS)); }
@Test @SuppressWarnings("unchecked") public void testBatchWriterConfigIsSetToValuesWithParameters() { int numThreads = 2; long timeout = 3; long maxMemory = 5; long maxLatency = 7; Map configMap = Maps.newHashMap(); MapUtils.putAll(configMap, new String[]{ AccumuloGraphConfiguration.BATCHWRITER_MAX_LATENCY, "" + maxLatency, AccumuloGraphConfiguration.BATCHWRITER_MAX_MEMORY, "" + maxMemory, AccumuloGraphConfiguration.BATCHWRITER_MAX_WRITE_THREADS, "" + numThreads, AccumuloGraphConfiguration.BATCHWRITER_TIMEOUT, "" + timeout}); AccumuloGraphConfiguration accumuloGraphConfiguration = new AccumuloGraphConfiguration(configMap); BatchWriterConfig batchWriterConfig = accumuloGraphConfiguration.createBatchWriterConfig(); assertThat(batchWriterConfig.getMaxLatency(TimeUnit.MILLISECONDS), is(maxLatency)); assertThat(batchWriterConfig.getTimeout(TimeUnit.MILLISECONDS), is(timeout)); assertThat(batchWriterConfig.getMaxMemory(), is(maxMemory)); assertThat(batchWriterConfig.getMaxWriteThreads(), is(numThreads)); }