Class Environment
- java.lang.Object
-
- org.apache.accumulo.test.randomwalk.Environment
-
public class Environment extends Object
The test environment that is available for randomwalk tests. This includes configuration properties that are available to any randomwalk test and facilities for creating client-side objects. This class is not thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_INSTANCE
The configuration property key for the instance name.static String
KEY_KEYTAB
The configuration property key for a keytabstatic String
KEY_MAX_LATENCY
The configuration property key for the maximum latency, in milliseconds, for the multi-table batch writer.static String
KEY_MAX_MEM
The configuration property key for the maximum memory for the multi-table batch writer.static String
KEY_NUM_THREADS
The configuration property key for the number of write threads for the multi-table batch writer.static String
KEY_PASSWORD
The configuration property key for a password.static String
KEY_USERNAME
The configuration property key for a username.static String
KEY_ZOOKEEPERS
The configuration property key for the comma-separated list of ZooKeepers.
-
Constructor Summary
Constructors Constructor Description Environment(Properties p)
Creates a new test environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getConfigProperty(String key)
Gets a configuration property.Connector
getConnector()
Gets an Accumulo connector.Instance
getInstance()
Gets an Accumulo instance object.String
getKeytab()
Gets the configured keytab.MultiTableBatchWriter
getMultiTableBatchWriter()
Gets a multitable batch writer.String
getPassword()
Gets the configured password.String
getPid()
Gets this process's ID.AuthenticationToken
getToken()
Gets an authentication token based on the configured password.String
getUserName()
Gets the configured username.boolean
isMultiTableBatchWriterInitialized()
Checks if a multitable batch writer has been created by this wrapper.void
resetMultiTableBatchWriter()
Clears the multitable batch writer previously created and remembered by this wrapper.
-
-
-
Field Detail
-
KEY_USERNAME
public static final String KEY_USERNAME
The configuration property key for a username.- See Also:
- Constant Field Values
-
KEY_PASSWORD
public static final String KEY_PASSWORD
The configuration property key for a password.- See Also:
- Constant Field Values
-
KEY_KEYTAB
public static final String KEY_KEYTAB
The configuration property key for a keytab- See Also:
- Constant Field Values
-
KEY_INSTANCE
public static final String KEY_INSTANCE
The configuration property key for the instance name.- See Also:
- Constant Field Values
-
KEY_ZOOKEEPERS
public static final String KEY_ZOOKEEPERS
The configuration property key for the comma-separated list of ZooKeepers.- See Also:
- Constant Field Values
-
KEY_MAX_MEM
public static final String KEY_MAX_MEM
The configuration property key for the maximum memory for the multi-table batch writer.- See Also:
- Constant Field Values
-
KEY_MAX_LATENCY
public static final String KEY_MAX_LATENCY
The configuration property key for the maximum latency, in milliseconds, for the multi-table batch writer.- See Also:
- Constant Field Values
-
KEY_NUM_THREADS
public static final String KEY_NUM_THREADS
The configuration property key for the number of write threads for the multi-table batch writer.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Environment
public Environment(Properties p)
Creates a new test environment.- Parameters:
p
- configuration properties- Throws:
NullPointerException
- if p is null
-
-
Method Detail
-
getConfigProperty
public String getConfigProperty(String key)
Gets a configuration property.- Parameters:
key
- key- Returns:
- property value
-
getUserName
public String getUserName()
Gets the configured username.- Returns:
- username
-
getPassword
public String getPassword()
Gets the configured password.- Returns:
- password
-
getKeytab
public String getKeytab()
Gets the configured keytab.- Returns:
- path to keytab
-
getPid
public String getPid()
Gets this process's ID.- Returns:
- pid
-
getToken
public AuthenticationToken getToken()
Gets an authentication token based on the configured password.- Returns:
- authentication token
-
getInstance
public Instance getInstance()
Gets an Accumulo instance object. The same instance is reused after the first call.- Returns:
- instance
-
getConnector
public Connector getConnector() throws AccumuloException, AccumuloSecurityException
Gets an Accumulo connector. The same connector is reused after the first call.- Returns:
- connector
- Throws:
AccumuloException
AccumuloSecurityException
-
getMultiTableBatchWriter
public MultiTableBatchWriter getMultiTableBatchWriter() throws AccumuloException, AccumuloSecurityException, NumberFormatException
Gets a multitable batch writer. The same object is reused after the first call unless it is reset.- Returns:
- multitable batch writer
- Throws:
NumberFormatException
- if any of the numeric batch writer configuration properties cannot be parsedAccumuloException
AccumuloSecurityException
-
isMultiTableBatchWriterInitialized
public boolean isMultiTableBatchWriterInitialized()
Checks if a multitable batch writer has been created by this wrapper.- Returns:
- true if multitable batch writer is already created
-
resetMultiTableBatchWriter
public void resetMultiTableBatchWriter()
Clears the multitable batch writer previously created and remembered by this wrapper.
-
-