accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo-testing] branch master updated: Add type safety to State (#86)
Date Tue, 25 Jun 2019 19:30:07 GMT
This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git


The following commit(s) were added to refs/heads/master by this push:
     new 0dd88ca  Add type safety to State (#86)
0dd88ca is described below

commit 0dd88ca38e1b058b613f70e0426a82df0861d02e
Author: Mike Miller <mmiller@apache.org>
AuthorDate: Tue Jun 25 15:30:00 2019 -0400

    Add type safety to State (#86)
    
    * Clean up code through reuse of new type safe State methods in bulk and concurrent modules
    * Allowed removal of a bunch of warning suppresses
---
 .../apache/accumulo/testing/randomwalk/State.java  | 52 ++++++++++++++++++++++
 .../testing/randomwalk/bulk/BulkPlusOne.java       |  2 +-
 .../testing/randomwalk/bulk/ConsistencyCheck.java  |  2 +-
 .../accumulo/testing/randomwalk/bulk/Merge.java    |  2 +-
 .../accumulo/testing/randomwalk/bulk/Setup.java    |  3 +-
 .../accumulo/testing/randomwalk/bulk/Split.java    |  2 +-
 .../testing/randomwalk/concurrent/AddSplits.java   | 11 ++---
 .../testing/randomwalk/concurrent/BatchScan.java   |  9 +---
 .../testing/randomwalk/concurrent/BatchWrite.java  | 10 +----
 .../testing/randomwalk/concurrent/BulkImport.java  |  9 +---
 .../concurrent/ChangeAuthorizations.java           |  9 +---
 .../randomwalk/concurrent/ChangePermissions.java   | 18 ++------
 .../randomwalk/concurrent/CheckPermission.java     | 19 ++------
 .../testing/randomwalk/concurrent/CloneTable.java  | 12 ++---
 .../testing/randomwalk/concurrent/Compact.java     | 10 +----
 .../randomwalk/concurrent/CreateNamespace.java     | 10 +----
 .../testing/randomwalk/concurrent/CreateTable.java | 10 +----
 .../testing/randomwalk/concurrent/CreateUser.java  | 10 +----
 .../randomwalk/concurrent/DeleteNamespace.java     | 10 +----
 .../testing/randomwalk/concurrent/DeleteRange.java |  9 +---
 .../testing/randomwalk/concurrent/DeleteTable.java | 10 +----
 .../testing/randomwalk/concurrent/DropUser.java    | 10 +----
 .../randomwalk/concurrent/IsolatedScan.java        | 10 +----
 .../testing/randomwalk/concurrent/ListSplits.java  | 10 +----
 .../testing/randomwalk/concurrent/Merge.java       | 11 ++---
 .../randomwalk/concurrent/OfflineTable.java        | 10 +----
 .../randomwalk/concurrent/RenameNamespace.java     | 12 +----
 .../testing/randomwalk/concurrent/RenameTable.java | 12 +----
 .../testing/randomwalk/concurrent/ScanTable.java   | 10 +----
 .../testing/randomwalk/concurrent/Setup.java       | 21 ++++-----
 .../testing/randomwalk/conditional/Compact.java    |  2 +-
 .../testing/randomwalk/conditional/Flush.java      |  2 +-
 .../testing/randomwalk/conditional/Merge.java      |  2 +-
 .../testing/randomwalk/conditional/Setup.java      |  2 +-
 .../testing/randomwalk/conditional/Split.java      |  2 +-
 .../testing/randomwalk/conditional/Transfer.java   |  2 +-
 .../testing/randomwalk/shard/BulkInsert.java       |  2 +-
 .../testing/randomwalk/shard/CompactFilter.java    |  2 +-
 .../accumulo/testing/randomwalk/shard/Delete.java  |  2 +-
 .../testing/randomwalk/shard/DeleteSomeDocs.java   |  2 +-
 .../testing/randomwalk/shard/DeleteWord.java       |  2 +-
 .../accumulo/testing/randomwalk/shard/Flush.java   |  2 +-
 .../accumulo/testing/randomwalk/shard/Grep.java    |  2 +-
 .../accumulo/testing/randomwalk/shard/Insert.java  |  2 +-
 .../accumulo/testing/randomwalk/shard/Reindex.java |  2 +-
 .../accumulo/testing/randomwalk/shard/Search.java  |  2 +-
 .../accumulo/testing/randomwalk/shard/Split.java   |  2 +-
 47 files changed, 127 insertions(+), 242 deletions(-)

diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/State.java b/src/main/java/org/apache/accumulo/testing/randomwalk/State.java
index 9b3e781..2e4f634 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/State.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/State.java
@@ -16,7 +16,10 @@
  */
 package org.apache.accumulo.testing.randomwalk;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Random;
 
 /**
  * A structure for storing state kept during a test. This class is not thread-safe.
@@ -24,6 +27,10 @@ import java.util.HashMap;
 public class State {
 
   private HashMap<String,Object> stateMap = new HashMap<>();
+  private List<String> tables = new ArrayList<>();
+  private List<String> namespaces = new ArrayList<>();
+  private List<String> users = new ArrayList<>();
+  private Random random = new Random();
 
   /**
    * Creates new empty state.
@@ -43,6 +50,20 @@ public class State {
   }
 
   /**
+   * Resets the Random object.
+   */
+  public void setRandom(Random rand) {
+    this.random = rand;
+  }
+
+  /**
+   * Gets the random object.
+   */
+  public Random getRandom() {
+    return random;
+  }
+
+  /**
    * Removes a state object.
    *
    * @param key
@@ -68,6 +89,37 @@ public class State {
     return stateMap.get(key);
   }
 
+  public List<String> getTableNames() {
+    return tables;
+  }
+
+  public void addTable(String tableName) {
+    tables.add(tableName);
+  }
+
+  public void addNamespace(String ns) {
+    namespaces.add(ns);
+  }
+
+  public String getRandomNamespace() {
+    return namespaces.get(random.nextInt(namespaces.size()));
+  }
+
+  /**
+   * Gets a random table name
+   */
+  public String getRandomTableName() {
+    return tables.get(random.nextInt(tables.size()));
+  }
+
+  public void addUser(String userName) {
+    users.add(userName);
+  }
+
+  public String getRandomUser() {
+    return users.get(random.nextInt(users.size()));
+  }
+
   /**
    * Gets a state object, returning null if it is absent.
    *
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/BulkPlusOne.java b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/BulkPlusOne.java
index 64db3c6..60821e2 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/BulkPlusOne.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/BulkPlusOne.java
@@ -59,7 +59,7 @@ public class BulkPlusOne extends BulkImportTest {
     final Path dir = new Path(fs.getUri() + "/tmp", "bulk_" + UUID.randomUUID().toString());
     log.debug("Bulk loading from {}", dir);
     final Path fail = new Path(dir.toString() + "_fail");
-    final Random rand = (Random) state.get("rand");
+    final Random rand = state.getRandom();
     fs.mkdirs(fail);
     final int parts = rand.nextInt(10) + 1;
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/ConsistencyCheck.java b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/ConsistencyCheck.java
index f011e0a..86da69d 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/ConsistencyCheck.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/ConsistencyCheck.java
@@ -33,7 +33,7 @@ public class ConsistencyCheck extends SelectiveBulkTest {
 
   @Override
   protected void runLater(State state, RandWalkEnv env) throws Exception {
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     Text row = Merge.getRandomRow(rand);
     log.info("Checking " + row);
     String user = env.getAccumuloClient().whoami();
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Merge.java b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Merge.java
index 242d795..1ffc764 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Merge.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Merge.java
@@ -44,7 +44,7 @@ public class Merge extends SelectiveBulkTest {
   }
 
   public static Text[] getRandomTabletRange(State state) {
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     Text[] points = {getRandomRow(rand), getRandomRow(rand),};
     Arrays.sort(points);
     if (rand.nextInt(10) == 0) {
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Setup.java b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Setup.java
index 2f4e66f..696fa92 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Setup.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Setup.java
@@ -39,7 +39,6 @@ public class Setup extends Test {
 
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
-    Random rand = new Random();
     String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_");
     String pid = env.getPid();
     tableName = String.format("bulk_%s_%s_%d", hostname, pid, System.currentTimeMillis());
@@ -57,7 +56,7 @@ public class Setup extends Test {
     } catch (TableExistsException ex) {
       // expected if there are multiple walkers
     }
-    state.set("rand", rand);
+    state.setRandom(new Random());
     state.set("fs", FileSystem.get(env.getHadoopConfiguration()));
     state.set("bulkImportSuccess", "true");
     BulkPlusOne.counter.set(0l);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Split.java b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Split.java
index 2588cb1..eb5e28e 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Split.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Split.java
@@ -29,7 +29,7 @@ public class Split extends SelectiveBulkTest {
   @Override
   protected void runLater(State state, RandWalkEnv env) throws Exception {
     SortedSet<Text> splits = new TreeSet<>();
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     int count = rand.nextInt(20);
     for (int i = 0; i < count; i++)
       splits.add(new Text(String.format(BulkPlusOne.FMT,
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/AddSplits.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/AddSplits.java
index ff31aaa..ab4cbce 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/AddSplits.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/AddSplits.java
@@ -25,7 +25,6 @@ import java.util.TreeSet;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
-import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.testing.randomwalk.RandWalkEnv;
 import org.apache.accumulo.testing.randomwalk.State;
 import org.apache.accumulo.testing.randomwalk.Test;
@@ -36,13 +35,9 @@ public class AddSplits extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-    tableNames = new ArrayList<>(tableNames);
-    tableNames.add(MetadataTable.NAME);
+    Random rand = state.getRandom();
+    List<String> tableNames = new ArrayList<>(state.getTableNames());
+    tableNames.add("accumulo.metadata");
     String tableName = tableNames.get(rand.nextInt(tableNames.size()));
 
     TreeSet<Text> splits = new TreeSet<>();
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchScan.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchScan.java
index 2f3af0a..e5c1934 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchScan.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchScan.java
@@ -42,13 +42,8 @@ public class BatchScan extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    Random rand = state.getRandom();
+    String tableName = state.getRandomTableName();
 
     try {
       BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 3);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchWrite.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchWrite.java
index a533af7..b22ff8a 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchWrite.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BatchWrite.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.testing.randomwalk.concurrent;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
-import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 
@@ -40,13 +39,8 @@ public class BatchWrite extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    Random rand = state.getRandom();
+    String tableName = state.getRandomTableName();
 
     try {
       BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BulkImport.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BulkImport.java
index df45f87..1d1d0c1 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BulkImport.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/BulkImport.java
@@ -92,13 +92,8 @@ public class BulkImport extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String tableName = state.getRandomTableName();
+    Random rand = state.getRandom();
 
     FileSystem fs = FileSystem.get(env.getHadoopConfiguration());
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangeAuthorizations.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangeAuthorizations.java
index 5a0a9fc..713f38a 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangeAuthorizations.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangeAuthorizations.java
@@ -35,13 +35,8 @@ public class ChangeAuthorizations extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> userNames = (List<String>) state.get("users");
-
-    String userName = userNames.get(rand.nextInt(userNames.size()));
+    Random rand = state.getRandom();
+    String userName = state.getRandomUser();
     try {
       List<byte[]> auths = new ArrayList<>(
           client.securityOperations().getUserAuthorizations(userName).getAuthorizations());
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangePermissions.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangePermissions.java
index e3a3d7c..2570065 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangePermissions.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ChangePermissions.java
@@ -37,20 +37,10 @@ public class ChangePermissions extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> userNames = (List<String>) state.get("users");
-    String userName = userNames.get(rand.nextInt(userNames.size()));
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
-    @SuppressWarnings("unchecked")
-    List<String> namespaces = (List<String>) state.get("namespaces");
-    String namespace = namespaces.get(rand.nextInt(namespaces.size()));
+    Random rand = state.getRandom();
+    String userName = state.getRandomUser();
+    String tableName = state.getRandomTableName();
+    String namespace = state.getRandomNamespace();
 
     try {
       int dice = rand.nextInt(3);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CheckPermission.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CheckPermission.java
index ec65a18..f62abee 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CheckPermission.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CheckPermission.java
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 
@@ -34,20 +33,10 @@ public class CheckPermission extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> userNames = (List<String>) state.get("users");
-    String userName = userNames.get(rand.nextInt(userNames.size()));
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
-    @SuppressWarnings("unchecked")
-    List<String> namespaces = (List<String>) state.get("namespaces");
-    String namespace = namespaces.get(rand.nextInt(namespaces.size()));
+    Random rand = state.getRandom();
+    String userName = state.getRandomUser();
+    String tableName = state.getRandomTableName();
+    String namespace = state.getRandomNamespace();
 
     try {
       int dice = rand.nextInt(2);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CloneTable.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CloneTable.java
index f97ba01..bdabd2c 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CloneTable.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CloneTable.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.testing.randomwalk.concurrent;
 
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 
@@ -36,14 +35,9 @@ public class CloneTable extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String srcTableName = tableNames.get(rand.nextInt(tableNames.size()));
-    String newTableName = tableNames.get(rand.nextInt(tableNames.size()));
+    Random rand = state.getRandom();
+    String srcTableName = state.getRandomTableName();
+    String newTableName = state.getRandomTableName();
     boolean flush = rand.nextBoolean();
 
     try {
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Compact.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Compact.java
index 9b5980f..bb22ded 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Compact.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Compact.java
@@ -33,14 +33,8 @@ public class Compact extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
+    Random rand = state.getRandom();
+    String tableName = state.getRandomTableName();
     List<Text> range = ConcurrentFixture.generateRange(rand);
 
     try {
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateNamespace.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateNamespace.java
index 24b870e..dabb939 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateNamespace.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateNamespace.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.NamespaceExistsException;
@@ -31,13 +29,7 @@ public class CreateNamespace extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> namespaces = (List<String>) state.get("namespaces");
-
-    String namespace = namespaces.get(rand.nextInt(namespaces.size()));
+    String namespace = state.getRandomNamespace();
 
     try {
       client.namespaceOperations().create(namespace);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateTable.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateTable.java
index 378ac46..fb6bfa0 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateTable.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateTable.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
@@ -34,13 +32,7 @@ public class CreateTable extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String tableName = state.getRandomTableName();
 
     try {
       client.tableOperations().create(tableName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateUser.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateUser.java
index 7e28385..8951c10 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateUser.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/CreateUser.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -31,13 +29,7 @@ public class CreateUser extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> userNames = (List<String>) state.get("users");
-
-    String userName = userNames.get(rand.nextInt(userNames.size()));
+    String userName = state.getRandomUser();
 
     try {
       log.debug("Creating user " + userName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteNamespace.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteNamespace.java
index dbdad2c..c4d5f4f 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteNamespace.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteNamespace.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.NamespaceNotEmptyException;
@@ -32,13 +30,7 @@ public class DeleteNamespace extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> namespaces = (List<String>) state.get("namespaces");
-
-    String namespace = namespaces.get(rand.nextInt(namespaces.size()));
+    String namespace = state.getRandomNamespace();
 
     try {
       client.namespaceOperations().delete(namespace);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteRange.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteRange.java
index 6c5d9d0..965656b 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteRange.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteRange.java
@@ -35,13 +35,8 @@ public class DeleteRange extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    Random rand = state.getRandom();
+    String tableName = state.getRandomTableName();
 
     List<Text> range = new ArrayList<>();
     do {
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteTable.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteTable.java
index 67f3e14..6a45b00 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteTable.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DeleteTable.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -31,13 +29,7 @@ public class DeleteTable extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String tableName = state.getRandomTableName();
 
     try {
       client.tableOperations().delete(tableName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DropUser.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DropUser.java
index bd21b5e..866b8be 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DropUser.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/DropUser.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -30,13 +28,7 @@ public class DropUser extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> userNames = (List<String>) state.get("users");
-
-    String userName = userNames.get(rand.nextInt(userNames.size()));
+    String userName = state.getRandomUser();
 
     try {
       log.debug("Dropping user " + userName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/IsolatedScan.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/IsolatedScan.java
index 43112ce..1e69a1f 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/IsolatedScan.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/IsolatedScan.java
@@ -16,10 +16,8 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Map.Entry;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.IsolatedScanner;
@@ -42,13 +40,7 @@ public class IsolatedScan extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String tableName = state.getRandomTableName();
 
     try {
       RowIterator iter = new RowIterator(
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ListSplits.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ListSplits.java
index 1f046fe..1678bd5 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ListSplits.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ListSplits.java
@@ -17,9 +17,7 @@
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
 import java.util.Collection;
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -34,13 +32,7 @@ public class ListSplits extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String tableName = state.getRandomTableName();
 
     try {
       Collection<Text> splits = client.tableOperations().listSplits(tableName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Merge.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Merge.java
index d7803dc..4f90e1e 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Merge.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Merge.java
@@ -24,7 +24,6 @@ import java.util.Random;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
-import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.testing.randomwalk.RandWalkEnv;
 import org.apache.accumulo.testing.randomwalk.State;
 import org.apache.accumulo.testing.randomwalk.Test;
@@ -35,13 +34,9 @@ public class Merge extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-    tableNames = new ArrayList<>(tableNames);
-    tableNames.add(MetadataTable.NAME);
+    Random rand = state.getRandom();
+    List<String> tableNames = new ArrayList<>(state.getTableNames());
+    tableNames.add("accumulo.metadata");
     String tableName = tableNames.get(rand.nextInt(tableNames.size()));
 
     List<Text> range = ConcurrentFixture.generateRange(rand);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/OfflineTable.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/OfflineTable.java
index 2d3c12f..a3af9d5 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/OfflineTable.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/OfflineTable.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.testing.randomwalk.concurrent;
 
 import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
 
-import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
@@ -34,13 +33,8 @@ public class OfflineTable extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    Random rand = state.getRandom();
+    String tableName = state.getRandomTableName();
 
     try {
       client.tableOperations().offline(tableName, rand.nextBoolean());
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameNamespace.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameNamespace.java
index 5399e22..23b1e5a 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameNamespace.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameNamespace.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.NamespaceExistsException;
@@ -32,14 +30,8 @@ public class RenameNamespace extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> namespaces = (List<String>) state.get("namespaces");
-
-    String srcName = namespaces.get(rand.nextInt(namespaces.size()));
-    String newName = namespaces.get(rand.nextInt(namespaces.size()));
+    String srcName = state.getRandomNamespace();
+    String newName = state.getRandomNamespace();
 
     try {
       client.namespaceOperations().rename(srcName, newName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameTable.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameTable.java
index a8c1b73..526a6c1 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameTable.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/RenameTable.java
@@ -16,9 +16,7 @@
  */
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
-import java.util.List;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
@@ -34,14 +32,8 @@ public class RenameTable extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String srcTableName = tableNames.get(rand.nextInt(tableNames.size()));
-    String newTableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String srcTableName = state.getRandomTableName();
+    String newTableName = state.getRandomTableName();
 
     String srcNamespace = "", newNamespace = "";
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ScanTable.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ScanTable.java
index 3ac45cb..c5ad06e 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ScanTable.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/ScanTable.java
@@ -17,10 +17,8 @@
 package org.apache.accumulo.testing.randomwalk.concurrent;
 
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map.Entry;
 import java.util.Properties;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -40,13 +38,7 @@ public class ScanTable extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     AccumuloClient client = env.getAccumuloClient();
-
-    Random rand = (Random) state.get("rand");
-
-    @SuppressWarnings("unchecked")
-    List<String> tableNames = (List<String>) state.get("tables");
-
-    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
+    String tableName = state.getRandomTableName();
 
     try {
       Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Setup.java b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Setup.java
index 833da77..20f2b0a 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Setup.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Setup.java
@@ -29,43 +29,40 @@ public class Setup extends Test {
 
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
-    Random rand = new Random();
-    state.set("rand", rand);
+    state.setRandom(new Random());
 
     int numTables = Integer.parseInt(props.getProperty("numTables", "9"));
     int numNamespaces = Integer.parseInt(props.getProperty("numNamespaces", "2"));
     log.debug("numTables = " + numTables);
     log.debug("numNamespaces = " + numNamespaces);
-    List<String> tables = new ArrayList<>();
     List<String> namespaces = new ArrayList<>();
 
     for (int i = 0; i < numNamespaces; i++) {
-      namespaces.add(String.format("nspc_%03d", i));
+      String ns = String.format("nspc_%03d", i);
+      namespaces.add(ns);
+      state.addNamespace(ns);
     }
 
     // Make tables in the default namespace
     double tableCeil = Math.ceil((double) numTables / (numNamespaces + 1));
     for (int i = 0; i < tableCeil; i++) {
-      tables.add(String.format("ctt_%03d", i));
+      state.addTable(String.format("ctt_%03d", i));
     }
 
     // Make tables in each namespace
     double tableFloor = Math.floor(numTables / (numNamespaces + 1));
     for (String n : namespaces) {
       for (int i = 0; i < tableFloor; i++) {
-        tables.add(String.format(n + ".ctt_%03d", i));
+        state.addTable(String.format(n + ".ctt_%03d", i));
       }
     }
 
-    state.set("tables", tables);
-    state.set("namespaces", namespaces);
-
     int numUsers = Integer.parseInt(props.getProperty("numUsers", "5"));
     log.debug("numUsers = " + numUsers);
-    List<String> users = new ArrayList<>();
     for (int i = 0; i < numUsers; i++)
-      users.add(String.format("user%03d", i));
-    state.set("users", users);
+      state.addUser(String.format("user%03d", i));
+
+    log.info("TABLES = " + state.getTableNames());
   }
 
 }
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Compact.java b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Compact.java
index 647bb7d..a31d3fb 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Compact.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Compact.java
@@ -32,7 +32,7 @@ public class Compact extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String table = state.getString("tableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     AccumuloClient client = env.getAccumuloClient();
     Text row1 = new Text(Utils.getBank(rand.nextInt((Integer) state.get("numBanks"))));
     Text row2 = new Text(Utils.getBank(rand.nextInt((Integer) state.get("numBanks"))));
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Flush.java b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Flush.java
index fe48c39..86f2775 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Flush.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Flush.java
@@ -32,7 +32,7 @@ public class Flush extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String table = state.getString("tableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     AccumuloClient client = env.getAccumuloClient();
     Text row1 = new Text(Utils.getBank(rand.nextInt((Integer) state.get("numBanks"))));
     Text row2 = new Text(Utils.getBank(rand.nextInt((Integer) state.get("numBanks"))));
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Merge.java b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Merge.java
index 363bd87..393dc6e 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Merge.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Merge.java
@@ -32,7 +32,7 @@ public class Merge extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String table = state.getString("tableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     AccumuloClient client = env.getAccumuloClient();
     Text row1 = new Text(Utils.getBank(rand.nextInt((Integer) state.get("numBanks"))));
     Text row2 = new Text(Utils.getBank(rand.nextInt((Integer) state.get("numBanks"))));
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Setup.java b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Setup.java
index b4fbb99..8153fc8 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Setup.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Setup.java
@@ -32,7 +32,7 @@ public class Setup extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     Random rand = new Random();
-    state.set("rand", rand);
+    state.setRandom(rand);
 
     int numBanks = Integer.parseInt(props.getProperty("numBanks", "1000"));
     log.debug("numBanks = " + numBanks);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Split.java b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Split.java
index b8e306f..cd77682 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Split.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Split.java
@@ -34,7 +34,7 @@ public class Split extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String table = state.getString("tableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     AccumuloClient client = env.getAccumuloClient();
     String row = Utils.getBank(rand.nextInt((Integer) state.get("numBanks")));
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Transfer.java b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Transfer.java
index a8fa018..f6b8544 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Transfer.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/conditional/Transfer.java
@@ -63,7 +63,7 @@ public class Transfer extends Test {
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String table = state.getString("tableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     AccumuloClient client = env.getAccumuloClient();
 
     int numAccts = (Integer) state.get("numAccts");
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/BulkInsert.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/BulkInsert.java
index cbc6589..e1c377a 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/BulkInsert.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/BulkInsert.java
@@ -101,7 +101,7 @@ public class BulkInsert extends Test {
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
     int numPartitions = (Integer) state.get("numPartitions");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     long nextDocID = (Long) state.get("nextDocID");
 
     int minInsert = Integer.parseInt(props.getProperty("minInsert"));
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/CompactFilter.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/CompactFilter.java
index 3c09149..e4689af 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/CompactFilter.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/CompactFilter.java
@@ -44,7 +44,7 @@ public class CompactFilter extends Test {
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String indexTableName = (String) state.get("indexTableName");
     String docTableName = (String) state.get("docTableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     String deleteChar = Integer.toHexString(rand.nextInt(16)) + "";
     String regex = "^[0-9a-f][" + deleteChar + "].*";
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Delete.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Delete.java
index 2689075..340a6b3 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Delete.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Delete.java
@@ -34,7 +34,7 @@ public class Delete extends Test {
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
     int numPartitions = (Integer) state.get("numPartitions");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     Entry<Key,Value> entry = Search.findRandomDocument(state, env, dataTableName, rand);
     if (entry == null)
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteSomeDocs.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteSomeDocs.java
index a0ee586..baf4719 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteSomeDocs.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteSomeDocs.java
@@ -40,7 +40,7 @@ public class DeleteSomeDocs extends Test {
     // from doc and index table
     // using the batch deleter
 
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteWord.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteWord.java
index f1dd3b0..e61c4ad 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteWord.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/DeleteWord.java
@@ -46,7 +46,7 @@ public class DeleteWord extends Test {
     String indexTableName = (String) state.get("indexTableName");
     String docTableName = (String) state.get("docTableName");
     int numPartitions = (Integer) state.get("numPartitions");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     String wordToDelete = Insert.generateRandomWord(rand);
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Flush.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Flush.java
index af050f9..741a60c 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Flush.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Flush.java
@@ -29,7 +29,7 @@ public class Flush extends Test {
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     String table;
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Grep.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Grep.java
index 2ba0397..519bf5a 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Grep.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Grep.java
@@ -45,7 +45,7 @@ public class Grep extends Test {
 
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     Text[] words = new Text[rand.nextInt(4) + 2];
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Insert.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Insert.java
index 27e8f19..4b86dbf 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Insert.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Insert.java
@@ -41,7 +41,7 @@ public class Insert extends Test {
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
     int numPartitions = (Integer) state.get("numPartitions");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
     long nextDocID = (Long) state.get("nextDocID");
 
     BatchWriter dataWriter = env.getMultiTableBatchWriter().getBatchWriter(dataTableName);
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Reindex.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Reindex.java
index 5f321c5..11d3c61 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Reindex.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Reindex.java
@@ -39,7 +39,7 @@ public class Reindex extends Test {
     String docTableName = (String) state.get("docTableName");
     int numPartitions = (Integer) state.get("numPartitions");
 
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     ShardFixture.createIndexTable(this.log, state, env, "_tmp", rand);
 
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Search.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Search.java
index 77963e6..56ee193 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Search.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Search.java
@@ -43,7 +43,7 @@ public class Search extends Test {
     String indexTableName = (String) state.get("indexTableName");
     String dataTableName = (String) state.get("docTableName");
 
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     Entry<Key,Value> entry = findRandomDocument(state, env, dataTableName, rand);
     if (entry == null)
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Split.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Split.java
index 65b0fbf..1cf381e 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Split.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Split.java
@@ -31,7 +31,7 @@ public class Split extends Test {
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
     String indexTableName = (String) state.get("indexTableName");
     int numPartitions = (Integer) state.get("numPartitions");
-    Random rand = (Random) state.get("rand");
+    Random rand = state.getRandom();
 
     SortedSet<Text> splitSet = ShardFixture.genSplits(numPartitions,
         rand.nextInt(numPartitions) + 1, "%06x");


Mime
View raw message