You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/07/02 22:57:23 UTC

svn commit: r1499110 [2/3] - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/conf/ server/src/main/java/org/apache/accumulo/server/util/ test/src/main/java/org/apache/accumulo/test/ test/src/main/java/org/apache/accumulo/test/functional...

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java Tue Jul  2 20:57:21 2013
@@ -17,7 +17,6 @@
 package org.apache.accumulo.test.functional;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -31,12 +30,10 @@ import org.apache.accumulo.core.client.A
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.security.SecurityErrorCode;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
@@ -47,458 +44,432 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.core.util.MetadataTable;
-import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.hadoop.io.Text;
-import org.apache.log4j.Logger;
+import org.junit.Test;
 
-public class PermissionsTest {
+public class PermissionsIT extends MacTest {
   private static final String TEST_USER = "test_user";
   private static final PasswordToken TEST_PASS = new PasswordToken("test_password");
   
-  public static class SystemPermissionsTest extends FunctionalTest {
-    private static final Logger log = Logger.getLogger(SystemPermissionsTest.class);
-    
-    @Override
-    public void cleanup() throws Exception {}
-    
-    @Override
-    public Map<String,String> getInitialConfig() {
-      return Collections.emptyMap();
-    }
-    
-    @Override
-    public List<TableSetup> getTablesToCreate() {
-      return Collections.emptyList();
-    }
-    
-    @Override
-    public void run() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException {
-      // verify that the test is being run by root
-      verifyHasOnlyTheseSystemPermissions(getConnector(), getConnector().whoami(), SystemPermission.values());
-      
-      // create the test user
-      getConnector().securityOperations().createLocalUser(TEST_USER, TEST_PASS);
-      Connector test_user_conn = getInstance().getConnector(TEST_USER, TEST_PASS);
-      verifyHasNoSystemPermissions(getConnector(), TEST_USER, SystemPermission.values());
+  @Test(timeout=60*1000)
+  public void systemPermissionsTest() throws Exception {
+    // verify that the test is being run by root
+    Connector c = getConnector();
+    verifyHasOnlyTheseSystemPermissions(c, c.whoami(), SystemPermission.values());
+    
+    // create the test user
+    c.securityOperations().createLocalUser(TEST_USER, TEST_PASS);
+    Connector test_user_conn = c.getInstance().getConnector(TEST_USER, TEST_PASS);
+    verifyHasNoSystemPermissions(c, TEST_USER, SystemPermission.values());
+    
+    // test each permission
+    for (SystemPermission perm : SystemPermission.values()) {
+      log.debug("Verifying the " + perm + " permission");
       
-      // test each permission
-      for (SystemPermission perm : SystemPermission.values()) {
-        log.debug("Verifying the " + perm + " permission");
-        
-        // verify GRANT can't be granted
-        if (perm.equals(SystemPermission.GRANT)) {
-          try {
-            getConnector().securityOperations().grantSystemPermission(TEST_USER, perm);
-          } catch (AccumuloSecurityException e) {
-            verifyHasNoSystemPermissions(getConnector(), TEST_USER, perm);
-            continue;
-          }
-          throw new IllegalStateException("Should NOT be able to grant GRANT");
+      // verify GRANT can't be granted
+      if (perm.equals(SystemPermission.GRANT)) {
+        try {
+          c.securityOperations().grantSystemPermission(TEST_USER, perm);
+        } catch (AccumuloSecurityException e) {
+          verifyHasNoSystemPermissions(c, TEST_USER, perm);
+          continue;
         }
-        
-        // test permission before and after granting it
-        testMissingSystemPermission(getConnector(), test_user_conn, perm);
-        getConnector().securityOperations().grantSystemPermission(TEST_USER, perm);
-        verifyHasOnlyTheseSystemPermissions(getConnector(), TEST_USER, perm);
-        testGrantedSystemPermission(getConnector(), test_user_conn, perm);
-        getConnector().securityOperations().revokeSystemPermission(TEST_USER, perm);
-        verifyHasNoSystemPermissions(getConnector(), TEST_USER, perm);
+        throw new IllegalStateException("Should NOT be able to grant GRANT");
       }
-    }
-    
-    private static void testMissingSystemPermission(Connector root_conn, Connector test_user_conn, SystemPermission perm) throws AccumuloException,
-        TableExistsException, AccumuloSecurityException, TableNotFoundException {
-      String tableName, tableId, user, password = "password";
-      log.debug("Confirming that the lack of the " + perm + " permission properly restricts the user");
       
-      // test permission prior to granting it
-      switch (perm) {
-        case CREATE_TABLE:
-          tableName = "__CREATE_TABLE_WITHOUT_PERM_TEST__";
-          try {
-            test_user_conn.tableOperations().create(tableName);
-            throw new IllegalStateException("Should NOT be able to create a table");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.tableOperations().list().contains(tableName))
-              throw e;
-          }
-          break;
-        case DROP_TABLE:
-          tableName = "__DROP_TABLE_WITHOUT_PERM_TEST__";
-          root_conn.tableOperations().create(tableName);
-          try {
-            test_user_conn.tableOperations().delete(tableName);
-            throw new IllegalStateException("Should NOT be able to delete a table");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName))
-              throw e;
-          }
-          break;
-        case ALTER_TABLE:
-          tableName = "__ALTER_TABLE_WITHOUT_PERM_TEST__";
-          root_conn.tableOperations().create(tableName);
-          tableId = Tables.getNameToIdMap(root_conn.getInstance()).get(tableName);
-          try {
-            test_user_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
-            throw new IllegalStateException("Should NOT be able to set a table property");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
-                || ServerConfiguration.getTableConfiguration(root_conn.getInstance(), tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%"))
-              throw e;
-          }
-          root_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
-          try {
-            test_user_conn.tableOperations().removeProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey());
-            throw new IllegalStateException("Should NOT be able to remove a table property");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
-                || !ServerConfiguration.getTableConfiguration(root_conn.getInstance(), tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%"))
-              throw e;
-          }
-          String table2 = tableName + "2";
-          try {
-            test_user_conn.tableOperations().rename(tableName, table2);
-            throw new IllegalStateException("Should NOT be able to rename a table");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName)
-                || root_conn.tableOperations().list().contains(table2))
-              throw e;
-          }
-          break;
-        case CREATE_USER:
-          user = "__CREATE_USER_WITHOUT_PERM_TEST__";
-          try {
-            test_user_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
-            throw new IllegalStateException("Should NOT be able to create a user");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
-                || root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
-              throw e;
-          }
-          break;
-        case DROP_USER:
-          user = "__DROP_USER_WITHOUT_PERM_TEST__";
-          root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
-          try {
-            test_user_conn.securityOperations().dropLocalUser(user);
-            throw new IllegalStateException("Should NOT be able to delete a user");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
-                || !root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
-              throw e;
-          }
-          break;
-        case ALTER_USER:
-          user = "__ALTER_USER_WITHOUT_PERM_TEST__";
-          root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
-          try {
-            test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A", "B"));
-            throw new IllegalStateException("Should NOT be able to alter a user");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
-              throw e;
-          }
-          break;
-        case SYSTEM:
-          // test for system permission would go here
-          break;
-        default:
-          throw new IllegalArgumentException("Unrecognized System Permission: " + perm);
-      }
+      // test permission before and after granting it
+      testMissingSystemPermission(c, test_user_conn, perm);
+      c.securityOperations().grantSystemPermission(TEST_USER, perm);
+      verifyHasOnlyTheseSystemPermissions(c, TEST_USER, perm);
+      testGrantedSystemPermission(c, test_user_conn, perm);
+      c.securityOperations().revokeSystemPermission(TEST_USER, perm);
+      verifyHasNoSystemPermissions(c, TEST_USER, perm);
     }
-    
-    private static void testGrantedSystemPermission(Connector root_conn, Connector test_user_conn, SystemPermission perm) throws AccumuloException,
-        AccumuloSecurityException, TableNotFoundException, TableExistsException {
-      String tableName, tableId, user, password = "password";
-      log.debug("Confirming that the presence of the " + perm + " permission properly permits the user");
-      
-      // test permission after granting it
-      switch (perm) {
-        case CREATE_TABLE:
-          tableName = "__CREATE_TABLE_WITH_PERM_TEST__";
+  }
+  
+  static Map<String, String> map(Iterable<Entry<String,String>> i) {
+    Map<String, String> result = new HashMap<String, String>();
+    for (Entry<String, String> e : i) {
+      result.put(e.getKey(), e.getValue());
+    }
+    return result;
+  }
+  
+  private static void testMissingSystemPermission(Connector root_conn, Connector test_user_conn, SystemPermission perm) throws AccumuloException,
+  TableExistsException, AccumuloSecurityException, TableNotFoundException {
+    String tableName, user, password = "password";
+    log.debug("Confirming that the lack of the " + perm + " permission properly restricts the user");
+    
+    // test permission prior to granting it
+    switch (perm) {
+      case CREATE_TABLE:
+        tableName = "__CREATE_TABLE_WITHOUT_PERM_TEST__";
+        try {
           test_user_conn.tableOperations().create(tableName);
-          if (!root_conn.tableOperations().list().contains(tableName))
-            throw new IllegalStateException("Should be able to create a table");
-          break;
-        case DROP_TABLE:
-          tableName = "__DROP_TABLE_WITH_PERM_TEST__";
-          root_conn.tableOperations().create(tableName);
+          throw new IllegalStateException("Should NOT be able to create a table");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.tableOperations().list().contains(tableName))
+            throw e;
+        }
+        break;
+      case DROP_TABLE:
+        tableName = "__DROP_TABLE_WITHOUT_PERM_TEST__";
+        root_conn.tableOperations().create(tableName);
+        try {
           test_user_conn.tableOperations().delete(tableName);
-          if (root_conn.tableOperations().list().contains(tableName))
-            throw new IllegalStateException("Should be able to delete a table");
-          break;
-        case ALTER_TABLE:
-          tableName = "__ALTER_TABLE_WITH_PERM_TEST__";
-          String table2 = tableName + "2";
-          root_conn.tableOperations().create(tableName);
-          tableId = Tables.getNameToIdMap(root_conn.getInstance()).get(tableName);
-          Instance instance = root_conn.getInstance();
+          throw new IllegalStateException("Should NOT be able to delete a table");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName))
+            throw e;
+        }
+        break;
+      case ALTER_TABLE:
+        tableName = "__ALTER_TABLE_WITHOUT_PERM_TEST__";
+        root_conn.tableOperations().create(tableName);
+        try {
           test_user_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
-          if (!ServerConfiguration.getTableConfiguration(instance, tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%"))
-            throw new IllegalStateException("Should be able to set a table property");
+          throw new IllegalStateException("Should NOT be able to set a table property");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
+              || map(root_conn.tableOperations().getProperties(tableName)).get(Property.TABLE_BLOOM_ERRORRATE.getKey()).equals("003.14159%"))
+            throw e;
+        }
+        root_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
+        try {
           test_user_conn.tableOperations().removeProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey());
-          if (ServerConfiguration.getTableConfiguration(instance, tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%"))
-            throw new IllegalStateException("Should be able to remove a table property");
+          throw new IllegalStateException("Should NOT be able to remove a table property");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
+              || !map(root_conn.tableOperations().getProperties(tableName)).get(Property.TABLE_BLOOM_ERRORRATE.getKey()).equals("003.14159%"))
+            throw e;
+        }
+        String table2 = tableName + "2";
+        try {
           test_user_conn.tableOperations().rename(tableName, table2);
-          if (root_conn.tableOperations().list().contains(tableName) || !root_conn.tableOperations().list().contains(table2))
-            throw new IllegalStateException("Should be able to rename a table");
-          break;
-        case CREATE_USER:
-          user = "__CREATE_USER_WITH_PERM_TEST__";
+          throw new IllegalStateException("Should NOT be able to rename a table");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName)
+              || root_conn.tableOperations().list().contains(table2))
+            throw e;
+        }
+        break;
+      case CREATE_USER:
+        user = "__CREATE_USER_WITHOUT_PERM_TEST__";
+        try {
           test_user_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
-          if (!root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
-            throw new IllegalStateException("Should be able to create a user");
-          break;
-        case DROP_USER:
-          user = "__DROP_USER_WITH_PERM_TEST__";
-          root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+          throw new IllegalStateException("Should NOT be able to create a user");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
+              || root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
+            throw e;
+        }
+        break;
+      case DROP_USER:
+        user = "__DROP_USER_WITHOUT_PERM_TEST__";
+        root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+        try {
           test_user_conn.securityOperations().dropLocalUser(user);
-          if (root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
-            throw new IllegalStateException("Should be able to delete a user");
-          break;
-        case ALTER_USER:
-          user = "__ALTER_USER_WITH_PERM_TEST__";
-          root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+          throw new IllegalStateException("Should NOT be able to delete a user");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED
+              || !root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
+            throw e;
+        }
+        break;
+      case ALTER_USER:
+        user = "__ALTER_USER_WITHOUT_PERM_TEST__";
+        root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+        try {
           test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A", "B"));
-          if (root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
-            throw new IllegalStateException("Should be able to alter a user");
-          break;
-        case SYSTEM:
-          // test for system permission would go here
-          break;
-        default:
-          throw new IllegalArgumentException("Unrecognized System Permission: " + perm);
-      }
-    }
-    
-    private static void verifyHasOnlyTheseSystemPermissions(Connector root_conn, String user, SystemPermission... perms) throws AccumuloException,
-        AccumuloSecurityException {
-      List<SystemPermission> permList = Arrays.asList(perms);
-      for (SystemPermission p : SystemPermission.values()) {
-        if (permList.contains(p)) {
-          // should have these
-          if (!root_conn.securityOperations().hasSystemPermission(user, p))
-            throw new IllegalStateException(user + " SHOULD have system permission " + p);
-        } else {
-          // should not have these
-          if (root_conn.securityOperations().hasSystemPermission(user, p))
-            throw new IllegalStateException(user + " SHOULD NOT have system permission " + p);
+          throw new IllegalStateException("Should NOT be able to alter a user");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
+            throw e;
         }
-      }
+        break;
+      case SYSTEM:
+        // test for system permission would go here
+        break;
+      default:
+        throw new IllegalArgumentException("Unrecognized System Permission: " + perm);
     }
-    
-    private static void verifyHasNoSystemPermissions(Connector root_conn, String user, SystemPermission... perms) throws AccumuloException,
-        AccumuloSecurityException {
-      for (SystemPermission p : perms)
+  }
+  
+  private static void testGrantedSystemPermission(Connector root_conn, Connector test_user_conn, SystemPermission perm) throws AccumuloException,
+  AccumuloSecurityException, TableNotFoundException, TableExistsException {
+    String tableName, user, password = "password";
+    log.debug("Confirming that the presence of the " + perm + " permission properly permits the user");
+    
+    // test permission after granting it
+    switch (perm) {
+      case CREATE_TABLE:
+        tableName = "__CREATE_TABLE_WITH_PERM_TEST__";
+        test_user_conn.tableOperations().create(tableName);
+        if (!root_conn.tableOperations().list().contains(tableName))
+          throw new IllegalStateException("Should be able to create a table");
+        break;
+      case DROP_TABLE:
+        tableName = "__DROP_TABLE_WITH_PERM_TEST__";
+        root_conn.tableOperations().create(tableName);
+        test_user_conn.tableOperations().delete(tableName);
+        if (root_conn.tableOperations().list().contains(tableName))
+          throw new IllegalStateException("Should be able to delete a table");
+        break;
+      case ALTER_TABLE:
+        tableName = "__ALTER_TABLE_WITH_PERM_TEST__";
+        String table2 = tableName + "2";
+        root_conn.tableOperations().create(tableName);
+        test_user_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
+        Map<String,String> properties = map(root_conn.tableOperations().getProperties(tableName));
+        if (!properties.get(Property.TABLE_BLOOM_ERRORRATE.getKey()).equals("003.14159%"))
+          throw new IllegalStateException("Should be able to set a table property");
+        test_user_conn.tableOperations().removeProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey());
+        properties = map(root_conn.tableOperations().getProperties(tableName));
+        if (properties.get(Property.TABLE_BLOOM_ERRORRATE.getKey()).equals("003.14159%"))
+          throw new IllegalStateException("Should be able to remove a table property");
+        test_user_conn.tableOperations().rename(tableName, table2);
+        if (root_conn.tableOperations().list().contains(tableName) || !root_conn.tableOperations().list().contains(table2))
+          throw new IllegalStateException("Should be able to rename a table");
+        break;
+      case CREATE_USER:
+        user = "__CREATE_USER_WITH_PERM_TEST__";
+        test_user_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+        if (!root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
+          throw new IllegalStateException("Should be able to create a user");
+        break;
+      case DROP_USER:
+        user = "__DROP_USER_WITH_PERM_TEST__";
+        root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+        test_user_conn.securityOperations().dropLocalUser(user);
+        if (root_conn.securityOperations().authenticateUser(user, new PasswordToken(password)))
+          throw new IllegalStateException("Should be able to delete a user");
+        break;
+      case ALTER_USER:
+        user = "__ALTER_USER_WITH_PERM_TEST__";
+        root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
+        test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A", "B"));
+        if (root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
+          throw new IllegalStateException("Should be able to alter a user");
+        break;
+      case SYSTEM:
+        // test for system permission would go here
+        break;
+      default:
+        throw new IllegalArgumentException("Unrecognized System Permission: " + perm);
+    }
+  }
+  
+  private static void verifyHasOnlyTheseSystemPermissions(Connector root_conn, String user, SystemPermission... perms) throws AccumuloException,
+  AccumuloSecurityException {
+    List<SystemPermission> permList = Arrays.asList(perms);
+    for (SystemPermission p : SystemPermission.values()) {
+      if (permList.contains(p)) {
+        // should have these
+        if (!root_conn.securityOperations().hasSystemPermission(user, p))
+          throw new IllegalStateException(user + " SHOULD have system permission " + p);
+      } else {
+        // should not have these
         if (root_conn.securityOperations().hasSystemPermission(user, p))
           throw new IllegalStateException(user + " SHOULD NOT have system permission " + p);
+      }
     }
   }
   
-  public static class TablePermissionsTest extends FunctionalTest {
-    private static final Logger log = Logger.getLogger(SystemPermissionsTest.class);
-    private static final String TEST_TABLE = "__TABLE_PERMISSION_TEST__";
-    
-    @Override
-    public void cleanup() throws Exception {}
-    
-    @Override
-    public Map<String,String> getInitialConfig() {
-      return Collections.emptyMap();
-    }
-    
-    @Override
-    public List<TableSetup> getTablesToCreate() {
-      return Collections.emptyList();
-    }
-    
-    @Override
-    public void run() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException, MutationsRejectedException {
-      // create the test user
-      getConnector().securityOperations().createLocalUser(TEST_USER, TEST_PASS);
-      Connector test_user_conn = getInstance().getConnector(TEST_USER, TEST_PASS);
+  private static void verifyHasNoSystemPermissions(Connector root_conn, String user, SystemPermission... perms) throws AccumuloException,
+  AccumuloSecurityException {
+    for (SystemPermission p : perms)
+      if (root_conn.securityOperations().hasSystemPermission(user, p))
+        throw new IllegalStateException(user + " SHOULD NOT have system permission " + p);
+  }
+  
+  private static final String TEST_TABLE = "__TABLE_PERMISSION_TEST__";
+  
+  @Test
+  public void tablePermissionTest() throws Exception {
+    // create the test user
+    Connector c = getConnector();
+    c.securityOperations().createLocalUser(TEST_USER, TEST_PASS);
+    Connector test_user_conn = c.getInstance().getConnector(TEST_USER, TEST_PASS);
+    
+    // check for read-only access to metadata table
+    verifyHasOnlyTheseTablePermissions(c, c.whoami(), MetadataTable.NAME, TablePermission.READ,
+        TablePermission.ALTER_TABLE);
+    verifyHasOnlyTheseTablePermissions(c, TEST_USER, MetadataTable.NAME, TablePermission.READ);
+    
+    // test each permission
+    for (TablePermission perm : TablePermission.values()) {
+      log.debug("Verifying the " + perm + " permission");
       
-      // check for read-only access to metadata table
-      verifyHasOnlyTheseTablePermissions(getConnector(), getConnector().whoami(), MetadataTable.NAME, TablePermission.READ,
-          TablePermission.ALTER_TABLE);
-      verifyHasOnlyTheseTablePermissions(getConnector(), TEST_USER, MetadataTable.NAME, TablePermission.READ);
+      // test permission before and after granting it
+      createTestTable(c);
+      testMissingTablePermission(c, test_user_conn, perm);
+      c.securityOperations().grantTablePermission(TEST_USER, TEST_TABLE, perm);
+      verifyHasOnlyTheseTablePermissions(c, TEST_USER, TEST_TABLE, perm);
+      testGrantedTablePermission(c, test_user_conn, perm);
       
-      // test each permission
-      for (TablePermission perm : TablePermission.values()) {
-        log.debug("Verifying the " + perm + " permission");
-        
-        // test permission before and after granting it
-        createTestTable();
-        testMissingTablePermission(getConnector(), test_user_conn, perm);
-        getConnector().securityOperations().grantTablePermission(TEST_USER, TEST_TABLE, perm);
-        verifyHasOnlyTheseTablePermissions(getConnector(), TEST_USER, TEST_TABLE, perm);
-        testGrantedTablePermission(getConnector(), test_user_conn, perm);
-        
-        createTestTable();
-        getConnector().securityOperations().revokeTablePermission(TEST_USER, TEST_TABLE, perm);
-        verifyHasNoTablePermissions(getConnector(), TEST_USER, TEST_TABLE, perm);
-      }
-    }
-    
-    private void createTestTable() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException,
-        MutationsRejectedException {
-      if (!getConnector().tableOperations().exists(TEST_TABLE)) {
-        // create the test table
-        getConnector().tableOperations().create(TEST_TABLE);
-        // put in some initial data
-        BatchWriter writer = getConnector().createBatchWriter(TEST_TABLE, new BatchWriterConfig());
-        Mutation m = new Mutation(new Text("row"));
-        m.put(new Text("cf"), new Text("cq"), new Value("val".getBytes()));
-        writer.addMutation(m);
-        writer.close();
-        
-        // verify proper permissions for creator and test user
-        verifyHasOnlyTheseTablePermissions(getConnector(), getConnector().whoami(), TEST_TABLE, TablePermission.values());
-        verifyHasNoTablePermissions(getConnector(), TEST_USER, TEST_TABLE, TablePermission.values());
-        
-      }
+      createTestTable(c);
+      c.securityOperations().revokeTablePermission(TEST_USER, TEST_TABLE, perm);
+      verifyHasNoTablePermissions(c, TEST_USER, TEST_TABLE, perm);
     }
-    
-    private static void testMissingTablePermission(Connector root_conn, Connector test_user_conn, TablePermission perm) throws AccumuloException,
-        AccumuloSecurityException, TableNotFoundException {
-      Scanner scanner;
-      BatchWriter writer;
-      Mutation m;
-      log.debug("Confirming that the lack of the " + perm + " permission properly restricts the user");
+  }
+  
+  private void createTestTable(Connector c) throws Exception,
+  MutationsRejectedException {
+    if (!c.tableOperations().exists(TEST_TABLE)) {
+      // create the test table
+      c.tableOperations().create(TEST_TABLE);
+      // put in some initial data
+      BatchWriter writer = c.createBatchWriter(TEST_TABLE, new BatchWriterConfig());
+      Mutation m = new Mutation(new Text("row"));
+      m.put(new Text("cf"), new Text("cq"), new Value("val".getBytes()));
+      writer.addMutation(m);
+      writer.close();
       
-      // test permission prior to granting it
-      switch (perm) {
-        case READ:
-          try {
-            scanner = test_user_conn.createScanner(TEST_TABLE, Authorizations.EMPTY);
-            int i = 0;
-            for (Entry<Key,Value> entry : scanner)
-              i += 1 + entry.getKey().getRowData().length();
-            if (i != 0)
-              throw new IllegalStateException("Should NOT be able to read from the table");
-          } catch (RuntimeException e) {
-            AccumuloSecurityException se = (AccumuloSecurityException) e.getCause();
-            if (se.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
-              throw se;
-          }
-          break;
-        case WRITE:
-          try {
-            writer = test_user_conn.createBatchWriter(TEST_TABLE, new BatchWriterConfig());
-            m = new Mutation(new Text("row"));
-            m.put(new Text("a"), new Text("b"), new Value("c".getBytes()));
-            writer.addMutation(m);
-            try {
-              writer.close();
-            } catch (MutationsRejectedException e1) {
-              if (e1.getAuthorizationFailuresMap().size() > 0)
-                throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED,
-                    e1);
-            }
-            throw new IllegalStateException("Should NOT be able to write to a table");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
-              throw e;
-          }
-          break;
-        case BULK_IMPORT:
-          // test for bulk import permission would go here
-          break;
-        case ALTER_TABLE:
-          Map<String,Set<Text>> groups = new HashMap<String,Set<Text>>();
-          groups.put("tgroup", new HashSet<Text>(Arrays.asList(new Text("t1"), new Text("t2"))));
-          try {
-            test_user_conn.tableOperations().setLocalityGroups(TEST_TABLE, groups);
-            throw new IllegalStateException("User should not be able to set locality groups");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
-              throw e;
-          }
-          break;
-        case DROP_TABLE:
-          try {
-            test_user_conn.tableOperations().delete(TEST_TABLE);
-            throw new IllegalStateException("User should not be able delete the table");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
-              throw e;
-          }
-          break;
-        case GRANT:
-          try {
-            test_user_conn.securityOperations().grantTablePermission("root", TEST_TABLE, TablePermission.GRANT);
-            throw new IllegalStateException("User should not be able grant permissions");
-          } catch (AccumuloSecurityException e) {
-            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
-              throw e;
-          }
-          break;
-        default:
-          throw new IllegalArgumentException("Unrecognized table Permission: " + perm);
-      }
-    }
-    
-    private static void testGrantedTablePermission(Connector root_conn, Connector test_user_conn, TablePermission perm) throws AccumuloException,
-        TableExistsException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
-      Scanner scanner;
-      BatchWriter writer;
-      Mutation m;
-      log.debug("Confirming that the presence of the " + perm + " permission properly permits the user");
+      // verify proper permissions for creator and test user
+      verifyHasOnlyTheseTablePermissions(c, c.whoami(), TEST_TABLE, TablePermission.values());
+      verifyHasNoTablePermissions(c, TEST_USER, TEST_TABLE, TablePermission.values());
       
-      // test permission after granting it
-      switch (perm) {
-        case READ:
+    }
+  }
+  
+  private static void testMissingTablePermission(Connector root_conn, Connector test_user_conn, TablePermission perm) throws Exception {
+    Scanner scanner;
+    BatchWriter writer;
+    Mutation m;
+    log.debug("Confirming that the lack of the " + perm + " permission properly restricts the user");
+    
+    // test permission prior to granting it
+    switch (perm) {
+      case READ:
+        try {
           scanner = test_user_conn.createScanner(TEST_TABLE, Authorizations.EMPTY);
-          Iterator<Entry<Key,Value>> iter = scanner.iterator();
-          while (iter.hasNext())
-            iter.next();
-          break;
-        case WRITE:
+          int i = 0;
+          for (Entry<Key,Value> entry : scanner)
+            i += 1 + entry.getKey().getRowData().length();
+          if (i != 0)
+            throw new IllegalStateException("Should NOT be able to read from the table");
+        } catch (RuntimeException e) {
+          AccumuloSecurityException se = (AccumuloSecurityException) e.getCause();
+          if (se.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+            throw se;
+        }
+        break;
+      case WRITE:
+        try {
           writer = test_user_conn.createBatchWriter(TEST_TABLE, new BatchWriterConfig());
           m = new Mutation(new Text("row"));
           m.put(new Text("a"), new Text("b"), new Value("c".getBytes()));
           writer.addMutation(m);
-          writer.close();
-          break;
-        case BULK_IMPORT:
-          // test for bulk import permission would go here
-          break;
-        case ALTER_TABLE:
-          Map<String,Set<Text>> groups = new HashMap<String,Set<Text>>();
-          groups.put("tgroup", new HashSet<Text>(Arrays.asList(new Text("t1"), new Text("t2"))));
-          break;
-        case DROP_TABLE:
+          try {
+            writer.close();
+          } catch (MutationsRejectedException e1) {
+            if (e1.getAuthorizationFailuresMap().size() > 0)
+              throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED,
+                  e1);
+          }
+          throw new IllegalStateException("Should NOT be able to write to a table");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+            throw e;
+        }
+        break;
+      case BULK_IMPORT:
+        // test for bulk import permission would go here
+        break;
+      case ALTER_TABLE:
+        Map<String,Set<Text>> groups = new HashMap<String,Set<Text>>();
+        groups.put("tgroup", new HashSet<Text>(Arrays.asList(new Text("t1"), new Text("t2"))));
+        try {
+          test_user_conn.tableOperations().setLocalityGroups(TEST_TABLE, groups);
+          throw new IllegalStateException("User should not be able to set locality groups");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+            throw e;
+        }
+        break;
+      case DROP_TABLE:
+        try {
           test_user_conn.tableOperations().delete(TEST_TABLE);
-          break;
-        case GRANT:
+          throw new IllegalStateException("User should not be able delete the table");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+            throw e;
+        }
+        break;
+      case GRANT:
+        try {
           test_user_conn.securityOperations().grantTablePermission("root", TEST_TABLE, TablePermission.GRANT);
-          break;
-        default:
-          throw new IllegalArgumentException("Unrecognized table Permission: " + perm);
-      }
-    }
-    
-    private static void verifyHasOnlyTheseTablePermissions(Connector root_conn, String user, String table, TablePermission... perms) throws AccumuloException,
-        AccumuloSecurityException {
-      List<TablePermission> permList = Arrays.asList(perms);
-      for (TablePermission p : TablePermission.values()) {
-        if (permList.contains(p)) {
-          // should have these
-          if (!root_conn.securityOperations().hasTablePermission(user, table, p))
-            throw new IllegalStateException(user + " SHOULD have table permission " + p + " for table " + table);
-        } else {
-          // should not have these
-          if (root_conn.securityOperations().hasTablePermission(user, table, p))
-            throw new IllegalStateException(user + " SHOULD NOT have table permission " + p + " for table " + table);
+          throw new IllegalStateException("User should not be able grant permissions");
+        } catch (AccumuloSecurityException e) {
+          if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+            throw e;
         }
-      }
+        break;
+      default:
+        throw new IllegalArgumentException("Unrecognized table Permission: " + perm);
     }
-    
-    private static void verifyHasNoTablePermissions(Connector root_conn, String user, String table, TablePermission... perms) throws AccumuloException,
-        AccumuloSecurityException {
-      for (TablePermission p : perms)
+  }
+  
+  private static void testGrantedTablePermission(Connector root_conn, Connector test_user_conn, TablePermission perm) throws AccumuloException,
+  TableExistsException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
+    Scanner scanner;
+    BatchWriter writer;
+    Mutation m;
+    log.debug("Confirming that the presence of the " + perm + " permission properly permits the user");
+    
+    // test permission after granting it
+    switch (perm) {
+      case READ:
+        scanner = test_user_conn.createScanner(TEST_TABLE, Authorizations.EMPTY);
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        while (iter.hasNext())
+          iter.next();
+        break;
+      case WRITE:
+        writer = test_user_conn.createBatchWriter(TEST_TABLE, new BatchWriterConfig());
+        m = new Mutation(new Text("row"));
+        m.put(new Text("a"), new Text("b"), new Value("c".getBytes()));
+        writer.addMutation(m);
+        writer.close();
+        break;
+      case BULK_IMPORT:
+        // test for bulk import permission would go here
+        break;
+      case ALTER_TABLE:
+        Map<String,Set<Text>> groups = new HashMap<String,Set<Text>>();
+        groups.put("tgroup", new HashSet<Text>(Arrays.asList(new Text("t1"), new Text("t2"))));
+        break;
+      case DROP_TABLE:
+        test_user_conn.tableOperations().delete(TEST_TABLE);
+        break;
+      case GRANT:
+        test_user_conn.securityOperations().grantTablePermission("root", TEST_TABLE, TablePermission.GRANT);
+        break;
+      default:
+        throw new IllegalArgumentException("Unrecognized table Permission: " + perm);
+    }
+  }
+  
+  private static void verifyHasOnlyTheseTablePermissions(Connector root_conn, String user, String table, TablePermission... perms) throws AccumuloException,
+  AccumuloSecurityException {
+    List<TablePermission> permList = Arrays.asList(perms);
+    for (TablePermission p : TablePermission.values()) {
+      if (permList.contains(p)) {
+        // should have these
+        if (!root_conn.securityOperations().hasTablePermission(user, table, p))
+          throw new IllegalStateException(user + " SHOULD have table permission " + p + " for table " + table);
+      } else {
+        // should not have these
         if (root_conn.securityOperations().hasTablePermission(user, table, p))
           throw new IllegalStateException(user + " SHOULD NOT have table permission " + p + " for table " + table);
+      }
     }
   }
+  
+  private static void verifyHasNoTablePermissions(Connector root_conn, String user, String table, TablePermission... perms) throws AccumuloException,
+  AccumuloSecurityException {
+    for (TablePermission p : perms)
+      if (root_conn.securityOperations().hasTablePermission(user, table, p))
+        throw new IllegalStateException(user + " SHOULD NOT have table permission " + p + " for table " + table);
+  }
 }

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java?rev=1499110&r1=1499109&r2=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java Tue Jul  2 20:57:21 2013
@@ -56,7 +56,7 @@ import org.junit.Test;
 
 public class ReadWriteIT extends MacTest {
   
-  static final int ROWS = 20000;
+  static final int ROWS = 200000;
   static final int COLS = 1;
   static final String COLF = "colf";
   
@@ -81,11 +81,11 @@ public class ReadWriteIT extends MacTest
     monitor.destroy();
   }
   
-  public void ingest(Connector connector, int rows, int cols, int width, int offset) throws Exception {
+  public static void ingest(Connector connector, int rows, int cols, int width, int offset) throws Exception {
     ingest(connector, rows, cols, width, offset, COLF);
   }
   
-  public void ingest(Connector connector, int rows, int cols, int width, int offset, String colf) throws Exception {
+  public static void ingest(Connector connector, int rows, int cols, int width, int offset, String colf) throws Exception {
     TestIngest.Opts opts = new TestIngest.Opts();
     opts.rows = rows;
     opts.cols = cols;
@@ -96,10 +96,10 @@ public class ReadWriteIT extends MacTest
     TestIngest.ingest(connector, opts, new BatchWriterOpts());
   }
   
-  private void verify(Connector connector, int rows, int cols, int width, int offset) throws Exception {
+  private static void verify(Connector connector, int rows, int cols, int width, int offset) throws Exception {
     verify(connector, rows, cols, width, offset, COLF);
   }
-  private void verify(Connector connector, int rows, int cols, int width, int offset, String colf) throws Exception {
+  private static void verify(Connector connector, int rows, int cols, int width, int offset, String colf) throws Exception {
     ScannerOpts scannerOpts = new ScannerOpts();
     VerifyIngest.Opts opts = new VerifyIngest.Opts();
     opts.rows = rows;
@@ -135,6 +135,10 @@ public class ReadWriteIT extends MacTest
   public void interleaved() throws Exception {
     // read and write concurrently
     final Connector connector = getConnector();
+    interleaveTest(connector);
+  }
+ 
+  static void interleaveTest(final Connector connector) throws Exception {
     final AtomicBoolean fail = new AtomicBoolean(false);
     final int CHUNKSIZE = ROWS / 10;
     ingest(connector, CHUNKSIZE, 1, 50, 0);

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java Tue Jul  2 20:57:21 2013
@@ -16,14 +16,20 @@
  */
 package org.apache.accumulo.test.functional;
 
+import static org.apache.accumulo.test.functional.FunctionalTestUtils.checkRFiles;
+import static org.apache.accumulo.test.functional.FunctionalTestUtils.nm;
+
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -31,42 +37,42 @@ import org.apache.accumulo.core.data.Val
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 import org.apache.accumulo.core.iterators.user.RowDeletingIterator;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class RowDeleteIT extends MacTest {
 
-public class RowDeleteTest extends FunctionalTest {
-  
-  @Override
-  public void cleanup() throws Exception {}
-  
-  @Override
-  public Map<String,String> getInitialConfig() {
-    HashMap<String,String> conf = new HashMap<String,String>();
-    conf.put(Property.TSERV_MAJC_DELAY.getKey(), "50ms");
-    return conf;
-  }
   
   @Override
-  public List<TableSetup> getTablesToCreate() {
-    TableSetup ts1 = new TableSetup("rdel1", parseConfig(Property.TABLE_LOCALITY_GROUPS + "=lg1,dg", Property.TABLE_LOCALITY_GROUP_PREFIX + "lg1=foo",
-        Property.TABLE_LOCALITY_GROUP_PREFIX + "dg=",
-        Property.TABLE_ITERATOR_PREFIX + "" + IteratorScope.majc + ".rdel=30," + RowDeletingIterator.class.getName(), Property.TABLE_MAJC_RATIO + "=100"));
-    return Collections.singletonList(ts1);
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "50ms"));
   }
-  
-  @Override
+
+  @Test(timeout=30*1000)
   public void run() throws Exception {
-    BatchWriter bw = getConnector().createBatchWriter("rdel1", new BatchWriterConfig());
+    Connector c = getConnector();
+    c.tableOperations().create("rdel1");
+    Map<String,Set<Text>> groups = new HashMap<String, Set<Text>>();
+    groups.put("lg1", Collections.singleton(new Text("foo")));
+    groups.put("dg", Collections.<Text>emptySet());
+    c.tableOperations().setLocalityGroups("rdel1", groups);
+    IteratorSetting setting = new IteratorSetting(30, RowDeletingIterator.class);
+    c.tableOperations().attachIterator("rdel1", setting, EnumSet.of(IteratorScope.majc));
+    c.tableOperations().setProperty("rdel1", Property.TABLE_MAJC_RATIO.getKey(), "100");
+    
+    BatchWriter bw = c.createBatchWriter("rdel1", new BatchWriterConfig());
     
     bw.addMutation(nm("r1", "foo", "cf1", "v1"));
     bw.addMutation(nm("r1", "bar", "cf1", "v2"));
     
     bw.flush();
-    getConnector().tableOperations().flush("rdel1", null, null, true);
+    c.tableOperations().flush("rdel1", null, null, true);
     
-    checkRFiles("rdel1", 1, 1, 1, 1);
+    checkRFiles(c, "rdel1", 1, 1, 1, 1);
     
     int count = 0;
-    Scanner scanner = getConnector().createScanner("rdel1", Authorizations.EMPTY);
+    Scanner scanner = c.createScanner("rdel1", Authorizations.EMPTY);
     for (@SuppressWarnings("unused")
     Entry<Key,Value> entry : scanner) {
       count++;
@@ -77,15 +83,12 @@ public class RowDeleteTest extends Funct
     bw.addMutation(nm("r1", "", "", RowDeletingIterator.DELETE_ROW_VALUE));
     
     bw.flush();
-    getConnector().tableOperations().flush("rdel1", null, null, true);
-    
-    // Wait for the files in HDFS to be older than the future compaction date
-    UtilWaitThread.sleep(2000);
+    c.tableOperations().flush("rdel1", null, null, true);
     
-    checkRFiles("rdel1", 1, 1, 2, 2);
+    checkRFiles(c, "rdel1", 1, 1, 2, 2);
     
     count = 0;
-    scanner = getConnector().createScanner("rdel1", Authorizations.EMPTY);
+    scanner = c.createScanner("rdel1", Authorizations.EMPTY);
     for (@SuppressWarnings("unused")
     Entry<Key,Value> entry : scanner) {
       count++;
@@ -93,12 +96,12 @@ public class RowDeleteTest extends Funct
     if (count != 3)
       throw new Exception("2 count=" + count);
     
-    getConnector().tableOperations().compact("rdel1", null, null, false, true);
+    c.tableOperations().compact("rdel1", null, null, false, true);
     
-    checkRFiles("rdel1", 1, 1, 0, 0);
+    checkRFiles(c, "rdel1", 1, 1, 0, 0);
     
     count = 0;
-    scanner = getConnector().createScanner("rdel1", Authorizations.EMPTY);
+    scanner = c.createScanner("rdel1", Authorizations.EMPTY);
     for (@SuppressWarnings("unused")
     Entry<Key,Value> entry : scanner) {
       count++;

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java Tue Jul  2 20:57:21 2013
@@ -19,13 +19,12 @@ package org.apache.accumulo.test.functio
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.ScannerBase;
@@ -35,26 +34,16 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
+import org.junit.Test;
 
-public class ScanIteratorTest extends FunctionalTest {
+public class ScanIteratorIT extends MacTest {
   
-  @Override
-  public void cleanup() throws Exception {}
-  
-  @Override
-  public Map<String,String> getInitialConfig() {
-    return Collections.emptyMap();
-  }
-  
-  @Override
-  public List<TableSetup> getTablesToCreate() {
-    return Collections.singletonList(new TableSetup("foo"));
-  }
-  
-  @Override
+  @Test(timeout=30*1000)
   public void run() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("foo");
     
-    BatchWriter bw = getConnector().createBatchWriter("foo", new BatchWriterConfig());
+    BatchWriter bw = c.createBatchWriter("foo", new BatchWriterConfig());
     
     for (int i = 0; i < 1000; i++) {
       Mutation m = new Mutation(new Text(String.format("%06d", i)));
@@ -66,12 +55,12 @@ public class ScanIteratorTest extends Fu
     
     bw.close();
     
-    Scanner scanner = getConnector().createScanner("foo", new Authorizations());
+    Scanner scanner = c.createScanner("foo", new Authorizations());
     
     setupIter(scanner);
     verify(scanner, 1, 999);
     
-    BatchScanner bscanner = getConnector().createBatchScanner("foo", new Authorizations(), 3);
+    BatchScanner bscanner = c.createBatchScanner("foo", new Authorizations(), 3);
     bscanner.setRanges(Collections.singleton(new Range((Key) null, null)));
     
     setupIter(bscanner);

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java Tue Jul  2 20:57:21 2013
@@ -16,15 +16,12 @@
  */
 package org.apache.accumulo.test.functional;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
 import java.util.Map.Entry;
 import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -32,73 +29,59 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
+import org.junit.Test;
 
-public class ScanRangeTest extends FunctionalTest {
+public class ScanRangeIT extends MacTest {
   
   private static final int TS_LIMIT = 1;
   private static final int CQ_LIMIT = 5;
   private static final int CF_LIMIT = 5;
   private static final int ROW_LIMIT = 100;
   
-  @Override
-  public void cleanup() {}
-  
-  @Override
-  public Map<String,String> getInitialConfig() {
-    return Collections.emptyMap();
-  }
-  
-  @Override
-  public List<TableSetup> getTablesToCreate() {
-    ArrayList<TableSetup> ts = new ArrayList<TableSetup>();
-    ts.add(new TableSetup("table1"));
-    
+  @Test(timeout=30*1000)
+  public void run() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("table1");
+    c.tableOperations().create("table2");
     TreeSet<Text> splitRows = new TreeSet<Text>();
     int splits = 3;
     for (int i = (ROW_LIMIT / splits); i < ROW_LIMIT; i += (ROW_LIMIT / splits))
       splitRows.add(createRow(i));
+    c.tableOperations().addSplits("table2", splitRows);
     
-    Map<String,String> empty = Collections.emptyMap();
-    ts.add(new TableSetup("table2", empty, splitRows));
-    
-    return ts;
-  }
-  
-  @Override
-  public void run() throws Exception {
-    insertData("table1");
-    scanTable("table1");
+    insertData(c, "table1");
+    scanTable(c, "table1");
     
-    insertData("table2");
-    scanTable("table2");
+    insertData(c, "table2");
+    scanTable(c, "table2");
   }
   
-  private void scanTable(String table) throws Exception {
-    scanRange(table, new IntKey(0, 0, 0, 0), new IntKey(1, 0, 0, 0));
+  private void scanTable(Connector c, String table) throws Exception {
+    scanRange(c, table, new IntKey(0, 0, 0, 0), new IntKey(1, 0, 0, 0));
     
-    scanRange(table, new IntKey(0, 0, 0, 0), new IntKey(ROW_LIMIT - 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+    scanRange(c, table, new IntKey(0, 0, 0, 0), new IntKey(ROW_LIMIT - 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
     
-    scanRange(table, null, null);
+    scanRange(c, table, null, null);
     
     for (int i = 0; i < ROW_LIMIT; i += (ROW_LIMIT / 3)) {
       for (int j = 0; j < CF_LIMIT; j += (CF_LIMIT / 2)) {
         for (int k = 1; k < CQ_LIMIT; k += (CQ_LIMIT / 2)) {
-          scanRange(table, null, new IntKey(i, j, k, 0));
-          scanRange(table, new IntKey(0, 0, 0, 0), new IntKey(i, j, k, 0));
+          scanRange(c, table, null, new IntKey(i, j, k, 0));
+          scanRange(c, table, new IntKey(0, 0, 0, 0), new IntKey(i, j, k, 0));
           
-          scanRange(table, new IntKey(i, j, k, 0), new IntKey(ROW_LIMIT - 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+          scanRange(c, table, new IntKey(i, j, k, 0), new IntKey(ROW_LIMIT - 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
           
-          scanRange(table, new IntKey(i, j, k, 0), null);
+          scanRange(c, table, new IntKey(i, j, k, 0), null);
           
         }
       }
     }
     
     for (int i = 0; i < ROW_LIMIT; i++) {
-      scanRange(table, new IntKey(i, 0, 0, 0), new IntKey(i, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+      scanRange(c, table, new IntKey(i, 0, 0, 0), new IntKey(i, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
       
       if (i > 0 && i < ROW_LIMIT - 1) {
-        scanRange(table, new IntKey(i - 1, 0, 0, 0), new IntKey(i + 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+        scanRange(c, table, new IntKey(i - 1, 0, 0, 0), new IntKey(i + 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
       }
     }
     
@@ -155,15 +138,15 @@ public class ScanRangeTest extends Funct
     
   }
   
-  private void scanRange(String table, IntKey ik1, IntKey ik2) throws Exception {
-    scanRange(table, ik1, false, ik2, false);
-    scanRange(table, ik1, false, ik2, true);
-    scanRange(table, ik1, true, ik2, false);
-    scanRange(table, ik1, true, ik2, true);
+  private void scanRange(Connector c, String table, IntKey ik1, IntKey ik2) throws Exception {
+    scanRange(c, table, ik1, false, ik2, false);
+    scanRange(c, table, ik1, false, ik2, true);
+    scanRange(c, table, ik1, true, ik2, false);
+    scanRange(c, table, ik1, true, ik2, true);
   }
   
-  private void scanRange(String table, IntKey ik1, boolean inclusive1, IntKey ik2, boolean inclusive2) throws Exception {
-    Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
+  private void scanRange(Connector c, String table, IntKey ik1, boolean inclusive1, IntKey ik2, boolean inclusive2) throws Exception {
+    Scanner scanner = c.createScanner(table, Authorizations.EMPTY);
     
     Key key1 = null;
     Key key2 = null;
@@ -227,9 +210,9 @@ public class ScanRangeTest extends Funct
     return trow;
   }
   
-  private void insertData(String table) throws Exception {
+  private void insertData(Connector c, String table) throws Exception {
     
-    BatchWriter bw = getConnector().createBatchWriter(table, new BatchWriterConfig());
+    BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig());
     
     for (int i = 0; i < ROW_LIMIT; i++) {
       Mutation m = new Mutation(createRow(i));

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java Tue Jul  2 20:57:21 2013
@@ -17,14 +17,12 @@
 package org.apache.accumulo.test.functional;
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -32,29 +30,23 @@ import org.apache.accumulo.core.data.Mut
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
 import org.apache.hadoop.io.Text;
+import org.junit.Test;
 
-public class ScanSessionTimeOutTest extends FunctionalTest {
+public class ScanSessionTimeOutIT extends MacTest {
   
   @Override
-  public void cleanup() throws Exception {}
-  
-  @Override
-  public Map<String,String> getInitialConfig() {
-    HashMap<String,String> config = new HashMap<String,String>();
-    // set the session idle time 3 seconds
-    config.put(Property.TSERV_SESSION_MAXIDLE.getKey(), "3");
-    return config;
-  }
-  
-  @Override
-  public List<TableSetup> getTablesToCreate() {
-    return Collections.singletonList(new TableSetup("abc"));
+  public void configure(MiniAccumuloConfig cfg) {
+    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_SESSION_MAXIDLE.getKey(), "3"));
   }
-  
-  @Override
+
+  @Test(timeout=30*1000)
   public void run() throws Exception {
-    BatchWriter bw = getConnector().createBatchWriter("abc", new BatchWriterConfig());
+    Connector c = getConnector();
+    c.tableOperations().create("abc");
+    
+    BatchWriter bw = c.createBatchWriter("abc", new BatchWriterConfig());
     
     for (int i = 0; i < 100000; i++) {
       Mutation m = new Mutation(new Text(String.format("%08d", i)));
@@ -66,7 +58,7 @@ public class ScanSessionTimeOutTest exte
     
     bw.close();
     
-    Scanner scanner = getConnector().createScanner("abc", new Authorizations());
+    Scanner scanner = c.createScanner("abc", new Authorizations());
     scanner.setBatchSize(1000);
     
     Iterator<Entry<Key,Value>> iter = scanner.iterator();

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java Tue Jul  2 20:57:21 2013
@@ -17,13 +17,12 @@
 package org.apache.accumulo.test.functional;
 
 import java.util.Collections;
-import java.util.List;
-import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.admin.TableOperations;
@@ -35,34 +34,19 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.hadoop.io.Text;
+import org.junit.Test;
 
-public class ServerSideErrorTest extends FunctionalTest {
+public class ServerSideErrorIT extends MacTest {
   
-  @Override
-  public void cleanup() throws Exception {}
-  
-  @Override
-  public Map<String,String> getInitialConfig() {
-    return Collections.emptyMap();
-  }
-  
-  @Override
-  public List<TableSetup> getTablesToCreate() {
-    return Collections.emptyList();
-  }
-  
-  @Override
+  @Test
   public void run() throws Exception {
-    
-    // Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME);
-    // logger.setLevel(Level.TRACE);
-    
-    getConnector().tableOperations().create("tt");
+    Connector c = getConnector();
+    c.tableOperations().create("tt");
     IteratorSetting is = new IteratorSetting(5, "Bad Aggregator", BadCombiner.class);
     Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("acf")));
-    getConnector().tableOperations().attachIterator("tt", is);
+    c.tableOperations().attachIterator("tt", is);
     
-    BatchWriter bw = getConnector().createBatchWriter("tt", new BatchWriterConfig());
+    BatchWriter bw = c.createBatchWriter("tt", new BatchWriterConfig());
     
     Mutation m = new Mutation(new Text("r1"));
     m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
@@ -72,7 +56,7 @@ public class ServerSideErrorTest extends
     bw.close();
     
     // try to scan table
-    Scanner scanner = getConnector().createScanner("tt", Authorizations.EMPTY);
+    Scanner scanner = c.createScanner("tt", Authorizations.EMPTY);
     
     boolean caught = false;
     try {
@@ -87,7 +71,7 @@ public class ServerSideErrorTest extends
       throw new Exception("Scan did not fail");
     
     // try to batch scan the table
-    BatchScanner bs = getConnector().createBatchScanner("tt", Authorizations.EMPTY, 2);
+    BatchScanner bs = c.createBatchScanner("tt", Authorizations.EMPTY, 2);
     bs.setRanges(Collections.singleton(new Range()));
     
     caught = false;
@@ -103,7 +87,7 @@ public class ServerSideErrorTest extends
       throw new Exception("batch scan did not fail");
     
     // remove the bad agg so accumulo can shutdown
-    TableOperations to = getConnector().tableOperations();
+    TableOperations to = c.tableOperations();
     for (Entry<String,String> e : to.getProperties("tt")) {
       to.removeProperty("tt", e.getKey());
     }
@@ -111,7 +95,7 @@ public class ServerSideErrorTest extends
     UtilWaitThread.sleep(500);
     
     // should be able to scan now
-    scanner = getConnector().createScanner("tt", Authorizations.EMPTY);
+    scanner = c.createScanner("tt", Authorizations.EMPTY);
     for (Entry<Key,Value> entry : scanner) {
       entry.getKey();
     }

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java?rev=1499110&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java Tue Jul  2 20:57:21 2013
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.server.util.Admin;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.TestRandomDeletes;
+import org.apache.accumulo.test.VerifyIngest;
+import org.junit.Test;
+
+public class ShutdownIT extends MacTest {
+  
+  @Test(timeout=60*1000)
+  public void shutdownDuringIngest() throws Exception {
+    Process ingest = cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable");
+    UtilWaitThread.sleep(100);
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+    ingest.destroy();
+  }
+  
+  @Test(timeout=60*1000)
+  public void shutdownDuringQuery() throws Exception {
+    assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable").waitFor());
+    Process verify = cluster.exec(VerifyIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD);
+    UtilWaitThread.sleep(100);
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+    verify.destroy();
+  }
+  
+  @Test(timeout=30*1000)
+  public void shutdownDuringDelete() throws Exception {
+    assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable").waitFor());
+    Process deleter = cluster.exec(TestRandomDeletes.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD);
+    UtilWaitThread.sleep(100);
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+    deleter.destroy();
+  }
+
+  
+  @Test(timeout=30*1000)
+  public void shutdownDuringDeleteTable() throws Exception {
+    final Connector c = getConnector();
+    for (int i = 0; i < 10 ; i++) {
+      c.tableOperations().create("table" + i);
+    }
+    final AtomicReference<Exception> ref = new AtomicReference<Exception>();
+    Thread async = new Thread() {
+      public void run() {
+        try {
+          for (int i = 0; i < 10; i++)
+            c.tableOperations().delete("table" + i);
+        } catch (Exception ex) {
+          ref.set(ex);
+        }
+      }
+    };
+    async.start();
+    UtilWaitThread.sleep(100);
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+    if (ref.get() != null)
+      throw ref.get();
+  }
+  
+  @Test(timeout=60*1000)
+  public void stopDuringStart() throws Exception {
+    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+  }
+  
+  @Test(timeout=30*1000)
+  public void adminStop() throws Exception {
+    Connector c = getConnector();
+    assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable").waitFor());
+    List<String> tabletServers = c.instanceOperations().getTabletServers();
+    assertEquals(2, tabletServers.size());
+    String doomed = tabletServers.get(0);
+    assertEquals(0, cluster.exec(Admin.class, "stop", doomed).waitFor());
+    tabletServers = c.instanceOperations().getTabletServers();
+    assertEquals(1, tabletServers.size());
+    assertFalse(tabletServers.get(0).equals(doomed));
+  }
+
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java?rev=1499110&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java Tue Jul  2 20:57:21 2013
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.MasterClient;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.master.thrift.MasterClientService;
+import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
+import org.apache.accumulo.core.master.thrift.TableInfo;
+import org.apache.accumulo.core.master.thrift.TabletServerStatus;
+import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.trace.instrument.Tracer;
+import org.junit.Test;
+
+public class SimpleBalancerFairnessIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    Map<String,String> siteConfig = new HashMap<String, String>();
+    siteConfig.put(Property.TSERV_MAXMEM.getKey(), "10K");
+    siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "0");
+    cfg.setSiteConfig(siteConfig );
+  }
+  
+  @Test(timeout=120*1000)
+  public void simpleBalancerFairness() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+    c.tableOperations().create("unused");
+    c.tableOperations().addSplits("unused", TestIngest.getSplitPoints(0, 10000000, 2000));
+    List<String> tservers = c.instanceOperations().getTabletServers();
+    TestIngest.Opts opts = new TestIngest.Opts();
+    opts.rows = 200000;
+    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    c.tableOperations().flush("test_ingest", null, null, false);
+    UtilWaitThread.sleep(15*1000);
+    TCredentials creds = CredentialHelper.create("root", new PasswordToken(MacTest.PASSWORD), c.getInstance().getInstanceName());
+    
+    MasterClientService.Iface client = null;
+    MasterMonitorInfo stats = null;
+    try {
+      client = MasterClient.getConnectionWithRetry(c.getInstance());
+      stats = client.getMasterStats(Tracer.traceInfo(), creds);
+    } finally {
+      if (client != null)
+        MasterClient.close(client);
+    }
+    List<Integer> counts = new ArrayList<Integer>();
+    for (TabletServerStatus server: stats.tServerInfo) {
+      int count = 0;
+      for (TableInfo table : server.tableMap.values()) {
+        count += table.onlineTablets;
+      }
+      counts.add(count);
+    }
+    assertTrue(counts.size() > 1);
+    for (int i = 1; i < counts.size(); i++)
+      assertTrue(Math.abs(counts.get(0) - counts.get(i)) <= tservers.size());
+  }
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java Tue Jul  2 20:57:21 2013
@@ -16,14 +16,12 @@
  */
 package org.apache.accumulo.test.functional;
 
-import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -31,27 +29,19 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
+import org.junit.Test;
 
 /**
  * This test recreates issue ACCUMULO-516. Until that issue is fixed this test should time out.
  */
-public class SparseColumnFamilyTest extends FunctionalTest {
+public class SparseColumnFamilyIT extends MacTest {
   
-  @Override
-  public Map<String,String> getInitialConfig() {
-    return Collections.emptyMap();
-  }
-  
-  @Override
-  public List<TableSetup> getTablesToCreate() {
-    return Collections.emptyList();
-  }
-  
-  @Override
-  public void run() throws Exception {
-    getConnector().tableOperations().create("scftt");
+  @Test(timeout=30*1000)
+  public void sparceColumnFamily() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("scftt");
     
-    BatchWriter bw = getConnector().createBatchWriter("scftt", new BatchWriterConfig());
+    BatchWriter bw = c.createBatchWriter("scftt", new BatchWriterConfig());
     
     // create file in the tablet that has mostly column family 0, with a few entries for column family 1
     
@@ -62,7 +52,7 @@ public class SparseColumnFamilyTest exte
     bw.addMutation(nm(99999 * 2, 1, 99999));
     bw.flush();
     
-    getConnector().tableOperations().flush("scftt", null, null, true);
+    c.tableOperations().flush("scftt", null, null, true);
     
     // create a file that has column family 1 and 0 interleaved
     for (int i = 0; i < 100000; i++) {
@@ -70,9 +60,9 @@ public class SparseColumnFamilyTest exte
     }
     bw.close();
     
-    getConnector().tableOperations().flush("scftt", null, null, true);
+    c.tableOperations().flush("scftt", null, null, true);
     
-    Scanner scanner = getConnector().createScanner("scftt", Authorizations.EMPTY);
+    Scanner scanner = c.createScanner("scftt", Authorizations.EMPTY);
     
     for (int i = 0; i < 200; i++) {
       
@@ -109,8 +99,4 @@ public class SparseColumnFamilyTest exte
     m.put(String.format("%03d", cf), "", "" + val);
     return m;
   }
-  
-  @Override
-  public void cleanup() throws Exception {}
-  
 }

Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java?rev=1499110&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java Tue Jul  2 20:57:21 2013
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.server.util.CheckForMetadataProblems;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class SplitIT extends MacTest {
+  
+  @Override
+  public void configure(MiniAccumuloConfig cfg) {
+    Map<String, String> siteConfig = new HashMap<String, String>();
+    siteConfig.put(Property.TSERV_MAXMEM.getKey(), "5K");
+    siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
+    cfg.setSiteConfig(siteConfig);
+  }
+
+  @Test(timeout=60*1000)
+  public void tabletShouldSplit() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "256K");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    opts.rows = 100000;
+    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+    vopts.rows = opts.rows;
+    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+    UtilWaitThread.sleep(10*1000);
+    String id = c.tableOperations().tableIdMap().get("test_ingest");
+    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+    KeyExtent extent = new KeyExtent(new Text(id), null, null);
+    s.setRange(extent.toMetadataRange());
+    MetadataTable.PREV_ROW_COLUMN.fetch(s);
+    int count = 0;
+    int shortened = 0;
+    for (Entry<Key,Value> entry : s) {
+      extent = new KeyExtent(entry.getKey().getRow(), entry.getValue());
+      if (extent.getEndRow() != null && extent.getEndRow().toString().length() < 14)
+        shortened++;
+      count++;
+    }
+    assertTrue(shortened > 0);
+    assertTrue(count > 10);
+    assertEquals(0, cluster.exec(CheckForMetadataProblems.class, "-i", cluster.getInstanceName(), "-u", "root", "-p", MacTest.PASSWORD, "-z", cluster.getZooKeepers()).waitFor());
+  }
+  
+  @Test(timeout=60*1000)
+  public void interleaveSplit() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+    ReadWriteIT.interleaveTest(c);
+    UtilWaitThread.sleep(10*1000);
+    assertTrue(c.tableOperations().listSplits("test_ingest").size() > 20);
+  }
+  
+  @Test(timeout=120*1000)
+  public void deleteSplit() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("test_ingest");
+    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+    DeleteIT.deleteTest(c);
+    assertTrue(c.tableOperations().listSplits("test_ingest").size() > 30);
+  }
+  
+}

Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
------------------------------------------------------------------------------
    svn:eol-style = native