You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2011/10/27 17:25:17 UTC
svn commit: r1189806 [44/46] - in /incubator/accumulo: branches/1.3/contrib/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/admin/
branches/1.3/src/core/src/main/...
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java Thu Oct 27 15:24:51 2011
@@ -116,7 +116,8 @@ public class PermissionsTest {
test_user_conn.tableOperations().create(tableName);
throw new IllegalStateException("Should NOT be able to create a table");
} catch (AccumuloSecurityException e) {
- if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.tableOperations().list().contains(tableName)) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.tableOperations().list().contains(tableName))
+ throw e;
}
break;
case DROP_TABLE:
@@ -126,7 +127,8 @@ public class PermissionsTest {
test_user_conn.tableOperations().delete(tableName);
throw new IllegalStateException("Should NOT be able to delete a table");
} catch (AccumuloSecurityException e) {
- if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName)) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName))
+ throw e;
}
break;
case ALTER_TABLE:
@@ -138,7 +140,8 @@ public class PermissionsTest {
throw new IllegalStateException("Should NOT be able to set a table property");
} catch (AccumuloSecurityException e) {
if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED
- || ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%")) throw e;
+ || ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%"))
+ throw e;
}
root_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
try {
@@ -146,7 +149,8 @@ public class PermissionsTest {
throw new IllegalStateException("Should NOT be able to remove a table property");
} catch (AccumuloSecurityException e) {
if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED
- || !ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%")) throw e;
+ || !ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%"))
+ throw e;
}
String table2 = tableName + "2";
try {
@@ -154,7 +158,8 @@ public class PermissionsTest {
throw new IllegalStateException("Should NOT be able to rename a table");
} catch (AccumuloSecurityException e) {
if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.tableOperations().list().contains(tableName)
- || root_conn.tableOperations().list().contains(table2)) throw e;
+ || root_conn.tableOperations().list().contains(table2))
+ throw e;
}
break;
case CREATE_USER:
@@ -163,7 +168,8 @@ public class PermissionsTest {
test_user_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
throw new IllegalStateException("Should NOT be able to create a user");
} catch (AccumuloSecurityException e) {
- if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.securityOperations().authenticateUser(user, password.getBytes())) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.securityOperations().authenticateUser(user, password.getBytes()))
+ throw e;
}
break;
case DROP_USER:
@@ -173,7 +179,8 @@ public class PermissionsTest {
test_user_conn.securityOperations().dropUser(user);
throw new IllegalStateException("Should NOT be able to delete a user");
} catch (AccumuloSecurityException e) {
- if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().authenticateUser(user, password.getBytes())) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().authenticateUser(user, password.getBytes()))
+ throw e;
}
break;
case ALTER_USER:
@@ -183,7 +190,8 @@ public class PermissionsTest {
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.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().getUserAuthorizations(user).isEmpty()) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
+ throw e;
}
break;
case SYSTEM:
@@ -204,13 +212,15 @@ public class PermissionsTest {
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");
+ 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");
+ 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__";
@@ -218,31 +228,34 @@ public class PermissionsTest {
root_conn.tableOperations().create(tableName);
tableId = Tables.getNameToIdMap(root_conn.getInstance()).get(tableName);
test_user_conn.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ERRORRATE.getKey(), "003.14159%");
- if (!ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%")) throw new IllegalStateException(
- "Should be able to set a table property");
+ if (!ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).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());
- if (ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).equals("003.14159%")) throw new IllegalStateException(
- "Should be able to remove a table property");
+ if (ServerConfiguration.getTableConfiguration(tableId).get(Property.TABLE_BLOOM_ERRORRATE).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");
+ 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().createUser(user, password.getBytes(), Constants.NO_AUTHS);
- if (!root_conn.securityOperations().authenticateUser(user, password.getBytes())) throw new IllegalStateException("Should be able to create a user");
+ if (!root_conn.securityOperations().authenticateUser(user, password.getBytes()))
+ throw new IllegalStateException("Should be able to create a user");
break;
case DROP_USER:
user = "__DROP_USER_WITH_PERM_TEST__";
root_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
test_user_conn.securityOperations().dropUser(user);
- if (root_conn.securityOperations().authenticateUser(user, password.getBytes())) throw new IllegalStateException("Should be able to delete a user");
+ if (root_conn.securityOperations().authenticateUser(user, password.getBytes()))
+ throw new IllegalStateException("Should be able to delete a user");
break;
case ALTER_USER:
user = "__ALTER_USER_WITH_PERM_TEST__";
root_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
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");
+ 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
@@ -258,10 +271,12 @@ public class PermissionsTest {
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);
+ 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);
+ if (root_conn.securityOperations().hasSystemPermission(user, p))
+ throw new IllegalStateException(user + " SHOULD NOT have system permission " + p);
}
}
}
@@ -269,7 +284,8 @@ public class PermissionsTest {
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);
+ if (root_conn.securityOperations().hasSystemPermission(user, p))
+ throw new IllegalStateException(user + " SHOULD NOT have system permission " + p);
}
}
@@ -352,10 +368,12 @@ public class PermissionsTest {
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");
+ 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.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED) throw se;
+ if (se.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+ throw se;
}
break;
case WRITE:
@@ -367,12 +385,13 @@ public class PermissionsTest {
try {
writer.close();
} catch (MutationsRejectedException e1) {
- if (e1.getAuthorizationFailures().size() > 0) throw new AccumuloSecurityException(test_user_conn.whoami(), SecurityErrorCode.PERMISSION_DENIED,
- e1);
+ if (e1.getAuthorizationFailures().size() > 0)
+ throw new AccumuloSecurityException(test_user_conn.whoami(), SecurityErrorCode.PERMISSION_DENIED, e1);
}
throw new IllegalStateException("Should NOT be able to write to a table");
} catch (AccumuloSecurityException e) {
- if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+ throw e;
}
break;
case BULK_IMPORT:
@@ -385,7 +404,8 @@ public class PermissionsTest {
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.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+ throw e;
}
break;
case DROP_TABLE:
@@ -393,7 +413,8 @@ public class PermissionsTest {
test_user_conn.tableOperations().delete(TEST_TABLE);
throw new IllegalStateException("User should not be able delete the table");
} catch (AccumuloSecurityException e) {
- if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+ throw e;
}
break;
case GRANT:
@@ -401,7 +422,8 @@ public class PermissionsTest {
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.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED) throw e;
+ if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
+ throw e;
}
break;
default:
@@ -455,12 +477,12 @@ public class PermissionsTest {
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);
+ 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);
+ if (root_conn.securityOperations().hasTablePermission(user, table, p))
+ throw new IllegalStateException(user + " SHOULD NOT have table permission " + p + " for table " + table);
}
}
}
@@ -468,8 +490,8 @@ public class PermissionsTest {
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);
+ if (root_conn.securityOperations().hasTablePermission(user, table, p))
+ throw new IllegalStateException(user + " SHOULD NOT have table permission " + p + " for table " + table);
}
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RowDeleteTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RowDeleteTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RowDeleteTest.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RowDeleteTest.java Thu Oct 27 15:24:51 2011
@@ -70,7 +70,8 @@ public class RowDeleteTest extends Funct
Entry<Key,Value> entry : scanner) {
count++;
}
- if (count != 2) throw new Exception("1 count=" + count);
+ if (count != 2)
+ throw new Exception("1 count=" + count);
bw.addMutation(nm("r1", "", "", RowDeletingIterator.DELETE_ROW_VALUE));
@@ -88,7 +89,8 @@ public class RowDeleteTest extends Funct
Entry<Key,Value> entry : scanner) {
count++;
}
- if (count != 3) throw new Exception("2 count=" + count);
+ if (count != 3)
+ throw new Exception("2 count=" + count);
getConnector().tableOperations().compact("rdel1", null, null, false, true);
@@ -100,7 +102,8 @@ public class RowDeleteTest extends Funct
Entry<Key,Value> entry : scanner) {
count++;
}
- if (count != 0) throw new Exception("3 count=" + count);
+ if (count != 0)
+ throw new Exception("3 count=" + count);
bw.close();
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RunTests.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RunTests.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RunTests.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/RunTests.java Thu Oct 27 15:24:51 2011
@@ -150,7 +150,8 @@ public class RunTests extends Configured
RunTests tests = new RunTests();
ToolRunner.run(new Configuration(), tests, args);
tests.job.waitForCompletion(true);
- if (!tests.job.isSuccessful()) System.exit(1);
+ if (!tests.job.isSuccessful())
+ System.exit(1);
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/ServerSideErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/ServerSideErrorTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/ServerSideErrorTest.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/ServerSideErrorTest.java Thu Oct 27 15:24:51 2011
@@ -82,7 +82,8 @@ public class ServerSideErrorTest extends
caught = true;
}
- if (!caught) throw new Exception("Scan did not fail");
+ if (!caught)
+ throw new Exception("Scan did not fail");
// try to batch scan the table
BatchScanner bs = getConnector().createBatchScanner("tt", Constants.NO_AUTHS, 2);
@@ -96,7 +97,8 @@ public class ServerSideErrorTest extends
} catch (Exception e) {
caught = true;
}
- if (!caught) throw new Exception("batch scan did not fail");
+ if (!caught)
+ throw new Exception("batch scan did not fail");
// remove the bad agg so accumulo can shutdown
TableOperations to = getConnector().tableOperations();
@@ -125,6 +127,7 @@ public class ServerSideErrorTest extends
caught = true;
}
- if (!caught) throw new Exception("Scan did not fail");
+ if (!caught)
+ throw new Exception("Scan did not fail");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/SplitRecoveryTest.java Thu Oct 27 15:24:51 2011
@@ -163,9 +163,11 @@ public class SplitRecoveryTest extends F
m.put(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY, assignment.server.asColumnQualifier(), assignment.server.asMutationValue());
writer.update(m);
- if (steps >= 1) MetadataTable.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, SecurityConstants.getSystemCredentials(), TabletTime.LOGICAL_TIME_ID
- + "0", -1l, -1l, zl);
- if (steps >= 2) MetadataTable.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SecurityConstants.getSystemCredentials(), zl);
+ if (steps >= 1)
+ MetadataTable.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, SecurityConstants.getSystemCredentials(), TabletTime.LOGICAL_TIME_ID + "0", -1l,
+ -1l, zl);
+ if (steps >= 2)
+ MetadataTable.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SecurityConstants.getSystemCredentials(), zl);
SortedMap<KeyExtent,Text> vtiRet = TabletServer.verifyTabletInformation(extent, instance, null, "127.0.0.1:0", zl);
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/VisibilityTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/VisibilityTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/VisibilityTest.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/functional/VisibilityTest.java Thu Oct 27 15:24:51 2011
@@ -248,7 +248,8 @@ public class VisibilityTest extends Func
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : scanner)
--expectedCount;
- if (expectedCount != 0) throw new Exception(" expected count !=0 " + expectedCount);
+ if (expectedCount != 0)
+ throw new Exception(" expected count !=0 " + expectedCount);
}
private void verify(Set<String> auths, Set<String> expectedValues) throws Exception {
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/metadata/MBinner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/metadata/MBinner.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/metadata/MBinner.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/metadata/MBinner.java Thu Oct 27 15:24:51 2011
@@ -262,7 +262,8 @@ public class MBinner {
List<TabletLocation> locs = slo.lookupTablet(null, null, null, null);
for (TabletLocation loc : locs) {
- if (loc.tablet_extent.getEndRow() != null) trie.add(loc.tablet_extent.getEndRow(), loc);
+ if (loc.tablet_extent.getEndRow() != null)
+ trie.add(loc.tablet_extent.getEndRow(), loc);
}
} catch (Exception e) {
@@ -285,7 +286,8 @@ public class MBinner {
/*
* if(!tl.tablet_extent.contains(row)){ throw new RuntimeException(tl.tablet_extent+" does not contain "+row); }
*/
- if (tl != null) notNull++;
+ if (tl != null)
+ notNull++;
}
System.out.println("notNull " + notNull);
@@ -336,7 +338,8 @@ public class MBinner {
List<TabletLocation> locs = slo.lookupTablet(null, null, null, null);
for (TabletLocation loc : locs) {
- if (loc.tablet_extent.getEndRow() != null) mc.put(loc.tablet_extent.getEndRow(), loc);
+ if (loc.tablet_extent.getEndRow() != null)
+ mc.put(loc.tablet_extent.getEndRow(), loc);
}
} catch (Exception e) {
@@ -402,18 +405,24 @@ public class MBinner {
DataGenerator generator;
- if (args[4].equals("binary")) generator = new BinaryGenerator();
- else if (args[4].equals("hex")) generator = new HexGenerator();
- else throw new IllegalArgumentException(args[4]);
+ if (args[4].equals("binary"))
+ generator = new BinaryGenerator();
+ else if (args[4].equals("hex"))
+ generator = new HexGenerator();
+ else
+ throw new IllegalArgumentException(args[4]);
TabletLocator tli;
- if (args[5].equals("trie")) tli = new TrieLocator(trieDepth, new SimpleLocationObtainer(numTablets, rowLen, generator));
- else if (args[5].equals("tree")) tli = new TreeLocator(new SimpleLocationObtainer(numTablets, rowLen, generator));
+ if (args[5].equals("trie"))
+ tli = new TrieLocator(trieDepth, new SimpleLocationObtainer(numTablets, rowLen, generator));
+ else if (args[5].equals("tree"))
+ tli = new TreeLocator(new SimpleLocationObtainer(numTablets, rowLen, generator));
else if (args[5].equals("system")) {
TabletLocator parent = new SimpleParent();
tli = new TabletLocatorImpl(new Text("0"), parent, new SimpleLocationObtainer(numTablets, rowLen, generator));
- } else throw new IllegalArgumentException(args[5]);
+ } else
+ throw new IllegalArgumentException(args[5]);
for (int i = 0; i < numThreads; i++) {
new Thread(new BinTask(tli, rowLen, generator)).start();
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/scan/CollectTabletStats.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/scan/CollectTabletStats.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/scan/CollectTabletStats.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/performance/scan/CollectTabletStats.java Thu Oct 27 15:24:51 2011
@@ -87,12 +87,18 @@ public class CollectTabletStats {
int index = 0;
String processedArgs[] = new String[8];
for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-i")) iterations = Integer.parseInt(args[++i]);
- else if (args[i].equals("-t")) numThreads = Integer.parseInt(args[++i]);
- else if (args[i].equals("-l")) selectLocalTablets = true;
- else if (args[i].equals("-f")) selectLocalTablets = false;
- else if (args[i].equals("-c")) columnsTmp = args[++i].split(",");
- else processedArgs[index++] = args[i];
+ if (args[i].equals("-i"))
+ iterations = Integer.parseInt(args[++i]);
+ else if (args[i].equals("-t"))
+ numThreads = Integer.parseInt(args[++i]);
+ else if (args[i].equals("-l"))
+ selectLocalTablets = true;
+ else if (args[i].equals("-f"))
+ selectLocalTablets = false;
+ else if (args[i].equals("-c"))
+ columnsTmp = args[++i].split(",");
+ else
+ processedArgs[index++] = args[i];
}
final String columns[] = columnsTmp;
@@ -434,8 +440,9 @@ public class CollectTabletStats {
ColumnQualifierFilter colFilter = new ColumnQualifierFilter(delIter, columnSet);
VisibilityFilter visFilter = new VisibilityFilter(colFilter, authorizations, defaultLabels);
- if (useTableIterators) return IteratorUtil.loadIterators(IteratorScope.scan, visFilter, ke,
- ServerConfiguration.getTableConfiguration(ke.getTableId().toString()), ssiList, ssio, null);
+ if (useTableIterators)
+ return IteratorUtil.loadIterators(IteratorScope.scan, visFilter, ke, ServerConfiguration.getTableConfiguration(ke.getTableId().toString()), ssiList,
+ ssio, null);
return visFilter;
}
@@ -516,7 +523,8 @@ public class CollectTabletStats {
int count = 0;
for (Entry<Key,Value> entry : scanner) {
- if (entry != null) count++;
+ if (entry != null)
+ count++;
}
return count;
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Module.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Module.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Module.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Module.java Thu Oct 27 15:24:51 2011
@@ -169,14 +169,20 @@ public class Module extends Node {
Properties initProps = getProps("_init");
initProps.putAll(props);
String prop;
- if ((prop = initProps.getProperty("maxHops")) == null || prop.equals("0") || prop.equals("")) maxHops = Integer.MAX_VALUE;
- else maxHops = Integer.parseInt(initProps.getProperty("maxHops", "0"));
-
- if ((prop = initProps.getProperty("maxSec")) == null || prop.equals("0") || prop.equals("")) maxSec = Integer.MAX_VALUE;
- else maxSec = Integer.parseInt(initProps.getProperty("maxSec", "0"));
-
- if ((prop = initProps.getProperty("teardown")) == null || prop.equals("true") || prop.equals("")) teardown = true;
- else teardown = false;
+ if ((prop = initProps.getProperty("maxHops")) == null || prop.equals("0") || prop.equals(""))
+ maxHops = Integer.MAX_VALUE;
+ else
+ maxHops = Integer.parseInt(initProps.getProperty("maxHops", "0"));
+
+ if ((prop = initProps.getProperty("maxSec")) == null || prop.equals("0") || prop.equals(""))
+ maxSec = Integer.MAX_VALUE;
+ else
+ maxSec = Integer.parseInt(initProps.getProperty("maxSec", "0"));
+
+ if ((prop = initProps.getProperty("teardown")) == null || prop.equals("true") || prop.equals(""))
+ teardown = true;
+ else
+ teardown = false;
if (fixture != null) {
fixture.setUp(state);
@@ -187,9 +193,10 @@ public class Module extends Node {
state.visitedNode();
// update aliases
Set<String> aliases;
- if ((aliases = aliasMap.get(initNodeId)) != null) for (String alias : aliases) {
- ((Alias) nodes.get(alias)).update(initNodeId);
- }
+ if ((aliases = aliasMap.get(initNodeId)) != null)
+ for (String alias : aliases) {
+ ((Alias) nodes.get(alias)).update(initNodeId);
+ }
String curNodeId = initNodeId;
int numHops = 0;
@@ -231,9 +238,10 @@ public class Module extends Node {
state.visitedNode();
// update aliases
- if ((aliases = aliasMap.get(curNodeId)) != null) for (String alias : aliases) {
- ((Alias) nodes.get(alias)).update(curNodeId);
- }
+ if ((aliases = aliasMap.get(curNodeId)) != null)
+ for (String alias : aliases) {
+ ((Alias) nodes.get(alias)).update(curNodeId);
+ }
curNodeId = nextNodeId;
}
@@ -361,13 +369,16 @@ public class Module extends Node {
Properties initProps = new Properties();
String attr = initEl.getAttribute("maxHops");
- if (attr != null) initProps.setProperty("maxHops", attr);
+ if (attr != null)
+ initProps.setProperty("maxHops", attr);
attr = initEl.getAttribute("maxSec");
- if (attr != null) initProps.setProperty("maxSec", attr);
+ if (attr != null)
+ initProps.setProperty("maxSec", attr);
attr = initEl.getAttribute("teardown");
- if (attr != null) initProps.setProperty("teardown", attr);
+ if (attr != null)
+ initProps.setProperty("teardown", attr);
localProps.put("_init", initProps);
// parse all nodes
@@ -407,7 +418,8 @@ public class Module extends Node {
aliases.add(key);
createNode(key, null);
}
- if (aliases.size() > 0) aliasMap.put(id, aliases);
+ if (aliases.size() > 0)
+ aliasMap.put(id, aliases);
// parse properties of nodes
NodeList proplist = nodeEl.getElementsByTagName("property");
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/BulkPlusOne.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/BulkPlusOne.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/BulkPlusOne.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/BulkPlusOne.java Thu Oct 27 15:24:51 2011
@@ -59,7 +59,8 @@ public class BulkPlusOne extends BulkTes
AccumuloConfiguration.getDefaultConfiguration());
f.startDefaultLocalityGroup();
int end = (int) LOTS / parts;
- if (i == parts - 1) end = (int) (LOTS - ctr);
+ if (i == parts - 1)
+ end = (int) (LOTS - ctr);
for (int j = 0; j < end; j++) {
for (String col : cols) {
f.append(new Key(String.format(FMT, ctr), "cf", col), value);
@@ -72,7 +73,8 @@ public class BulkPlusOne extends BulkTes
fs.delete(dir, true);
fs.delete(fail, true);
FileStatus[] failures = fs.listStatus(fail);
- if (failures != null && failures.length > 0) throw new Exception("Failures " + Arrays.asList(failures) + " found importing files from " + dir);
+ if (failures != null && failures.length > 0)
+ throw new Exception("Failures " + Arrays.asList(failures) + " found importing files from " + dir);
}
@Override
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/ConsistencyCheck.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/ConsistencyCheck.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/ConsistencyCheck.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/ConsistencyCheck.java Thu Oct 27 15:24:51 2011
@@ -47,8 +47,8 @@ public class ConsistencyCheck extends Bu
v = entry.getValue();
first = entry.getKey();
}
- if (!v.equals(entry.getValue())) throw new RuntimeException("Inconsistent value at " + entry.getKey() + " was " + entry.getValue() + " should be " + v
- + " first read at " + first);
+ if (!v.equals(entry.getValue()))
+ throw new RuntimeException("Inconsistent value at " + entry.getKey() + " was " + entry.getValue() + " should be " + v + " first read at " + first);
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/Verify.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/Verify.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/Verify.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/bulk/Verify.java Thu Oct 27 15:24:51 2011
@@ -47,7 +47,8 @@ public class Verify extends Test {
Scanner scanner = state.getConnector().createScanner(Setup.getTableName(), auths);
for (Entry<Key,Value> entry : scanner) {
byte[] value = entry.getValue().get();
- if (!Arrays.equals(value, zero)) throw new Exception("Bad key at " + entry);
+ if (!Arrays.equals(value, zero))
+ throw new Exception("Bad key at " + entry);
}
log.info("Test successful on table " + Setup.getTableName());
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/BatchWrite.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/BatchWrite.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/BatchWrite.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/BatchWrite.java Thu Oct 27 15:24:51 2011
@@ -67,9 +67,12 @@ public class BatchWrite extends Test {
} catch (TableOfflineException e) {
log.debug("BatchWrite " + tableName + " failed, offline");
} catch (MutationsRejectedException mre) {
- if (mre.getCause() instanceof TableDeletedException) log.debug("BatchWrite " + tableName + " failed, table deleted");
- else if (mre.getCause() instanceof TableOfflineException) log.debug("BatchWrite " + tableName + " failed, offline");
- else throw mre;
+ if (mre.getCause() instanceof TableDeletedException)
+ log.debug("BatchWrite " + tableName + " failed, table deleted");
+ else if (mre.getCause() instanceof TableOfflineException)
+ log.debug("BatchWrite " + tableName + " failed, offline");
+ else
+ throw mre;
}
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/ChangePermissions.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/ChangePermissions.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/ChangePermissions.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/ChangePermissions.java Thu Oct 27 15:24:51 2011
@@ -47,8 +47,10 @@ public class ChangePermissions extends T
String tableName = tableNames.get(rand.nextInt(tableNames.size()));
try {
- if (rand.nextBoolean()) changeSystemPermission(conn, rand, userName);
- else changeTablePermission(conn, rand, userName, tableName);
+ if (rand.nextBoolean())
+ changeSystemPermission(conn, rand, userName);
+ else
+ changeTablePermission(conn, rand, userName, tableName);
} catch (AccumuloSecurityException ex) {
log.debug("Unable to change user permissions: " + ex.getCause());
}
@@ -58,7 +60,8 @@ public class ChangePermissions extends T
EnumSet<TablePermission> perms = EnumSet.noneOf(TablePermission.class);
for (TablePermission p : TablePermission.values()) {
- if (conn.securityOperations().hasTablePermission(userName, tableName, p)) perms.add(p);
+ if (conn.securityOperations().hasTablePermission(userName, tableName, p))
+ perms.add(p);
}
EnumSet<TablePermission> more = EnumSet.allOf(TablePermission.class);
@@ -82,7 +85,8 @@ public class ChangePermissions extends T
private void changeSystemPermission(Connector conn, Random rand, String userName) throws AccumuloException, AccumuloSecurityException {
EnumSet<SystemPermission> perms = EnumSet.noneOf(SystemPermission.class);
for (SystemPermission p : SystemPermission.values()) {
- if (conn.securityOperations().hasSystemPermission(userName, p)) perms.add(p);
+ if (conn.securityOperations().hasSystemPermission(userName, p))
+ perms.add(p);
}
EnumSet<SystemPermission> more = EnumSet.allOf(SystemPermission.class);
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/DeleteRange.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/DeleteRange.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/DeleteRange.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/DeleteRange.java Thu Oct 27 15:24:51 2011
@@ -48,8 +48,10 @@ public class DeleteRange extends Test {
range.add(new Text(String.format("%016x", Math.abs(rand.nextLong()))));
} while (range.get(0).equals(range.get(1)));
Collections.sort(range);
- if (rand.nextInt(20) == 0) range.set(0, null);
- if (rand.nextInt(20) == 0) range.set(1, null);
+ if (rand.nextInt(20) == 0)
+ range.set(0, null);
+ if (rand.nextInt(20) == 0)
+ range.set(1, null);
try {
conn.tableOperations().deleteRows(tableName, range.get(0), range.get(1));
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/IsolatedScan.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/IsolatedScan.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/IsolatedScan.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/IsolatedScan.java Thu Oct 27 15:24:51 2011
@@ -53,10 +53,12 @@ public class IsolatedScan extends Test {
while (iter.hasNext()) {
PeekingIterator<Entry<Key,Value>> row = new PeekingIterator<Entry<Key,Value>>(iter.next());
Entry<Key,Value> kv = null;
- if (row.hasNext()) kv = row.peek();
+ if (row.hasNext())
+ kv = row.peek();
while (row.hasNext()) {
Entry<Key,Value> currentKV = row.next();
- if (!kv.getValue().equals(currentKV.getValue())) throw new Exception("values not equal " + kv + " " + currentKV);
+ if (!kv.getValue().equals(currentKV.getValue()))
+ throw new Exception("values not equal " + kv + " " + currentKV);
}
}
log.debug("Isolated scan " + tableName);
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/multitable/CopyTable.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/multitable/CopyTable.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/multitable/CopyTable.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/multitable/CopyTable.java Thu Oct 27 15:24:51 2011
@@ -33,7 +33,8 @@ public class CopyTable extends Test {
@SuppressWarnings("unchecked")
ArrayList<String> tables = (ArrayList<String>) state.get("tableList");
- if (tables.isEmpty()) return;
+ if (tables.isEmpty())
+ return;
Random rand = new Random();
String srcTableName = tables.remove(rand.nextInt(tables.size()));
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterSystemPerm.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterSystemPerm.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterSystemPerm.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterSystemPerm.java Thu Oct 27 15:24:51 2011
@@ -42,16 +42,19 @@ public class AlterSystemPerm extends Tes
Random r = new Random();
int i = r.nextInt(SystemPermission.values().length);
sysPerm = SystemPermission.values()[i];
- } else sysPerm = SystemPermission.valueOf(perm);
+ } else
+ sysPerm = SystemPermission.valueOf(perm);
boolean hasPerm = SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), sysPerm);
// toggle
if (!"take".equals(action) && !"give".equals(action)) {
- if (hasPerm != conn.securityOperations().hasSystemPermission(targetUser, sysPerm)) throw new AccumuloException(
- "Test framework and accumulo are out of sync!");
- if (hasPerm) action = "take";
- else action = "give";
+ if (hasPerm != conn.securityOperations().hasSystemPermission(targetUser, sysPerm))
+ throw new AccumuloException("Test framework and accumulo are out of sync!");
+ if (hasPerm)
+ action = "take";
+ else
+ action = "give";
}
if ("take".equals(action)) {
@@ -60,7 +63,8 @@ public class AlterSystemPerm extends Tes
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case GRANT_INVALID:
- if (sysPerm.equals(SystemPermission.GRANT)) return;
+ if (sysPerm.equals(SystemPermission.GRANT))
+ return;
case PERMISSION_DENIED:
throw new AccumuloException("Test user doesn't have root", ae);
case USER_DOESNT_EXIST:
@@ -76,7 +80,8 @@ public class AlterSystemPerm extends Tes
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case GRANT_INVALID:
- if (sysPerm.equals(SystemPermission.GRANT)) return;
+ if (sysPerm.equals(SystemPermission.GRANT))
+ return;
case PERMISSION_DENIED:
throw new AccumuloException("Test user doesn't have root", ae);
case USER_DOESNT_EXIST:
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTable.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTable.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTable.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTable.java Thu Oct 27 15:24:51 2011
@@ -41,7 +41,8 @@ public class AlterTable extends Test {
boolean exists = SecurityHelper.getTableExists(state);
boolean hasPermission = false;
if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.ALTER_TABLE)
- || SecurityHelper.getTabPerm(state, SecurityHelper.getSysUserName(state), TablePermission.ALTER_TABLE)) hasPermission = true;
+ || SecurityHelper.getTabPerm(state, SecurityHelper.getSysUserName(state), TablePermission.ALTER_TABLE))
+ hasPermission = true;
String newTableName = String.format("security_%s_%s_%d", InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_"), state.getPid(),
System.currentTimeMillis());
@@ -54,15 +55,20 @@ public class AlterTable extends Test {
conn.tableOperations().rename(oldName, newName);
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
- if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
- else return;
+ if (hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ else
+ return;
}
throw new AccumuloException("Got unexpected ae error code", ae);
} catch (TableNotFoundException tnfe) {
- if (tableExists) throw new TableExistsException(null, oldName, "Got a TableNotFoundException but it should exist", tnfe);
- else return;
+ if (tableExists)
+ throw new TableExistsException(null, oldName, "Got a TableNotFoundException but it should exist", tnfe);
+ else
+ return;
}
SecurityHelper.setTableName(state, newName);
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTablePerm.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTablePerm.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTablePerm.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/AlterTablePerm.java Thu Oct 27 15:24:51 2011
@@ -44,8 +44,10 @@ public class AlterTablePerm extends Test
boolean tabExists = SecurityHelper.getTableExists(state);
String target;
- if ("table".equals(targetUser)) target = SecurityHelper.getTabUserName(state);
- else target = SecurityHelper.getSysUserName(state);
+ if ("table".equals(targetUser))
+ target = SecurityHelper.getTabUserName(state);
+ else
+ target = SecurityHelper.getSysUserName(state);
boolean exists = SecurityHelper.getTabUserExists(state);
boolean tableExists = SecurityHelper.getTableExists(state);
@@ -55,7 +57,8 @@ public class AlterTablePerm extends Test
Random r = new Random();
int i = r.nextInt(TablePermission.values().length);
tabPerm = TablePermission.values()[i];
- } else tabPerm = TablePermission.valueOf(perm);
+ } else
+ tabPerm = TablePermission.valueOf(perm);
boolean hasPerm = SecurityHelper.getTabPerm(state, target, tabPerm);
boolean canGive;
@@ -75,20 +78,26 @@ public class AlterTablePerm extends Test
if (!"take".equals(action) && !"give".equals(action)) {
try {
boolean res;
- if (hasPerm != (res = state.getConnector().securityOperations().hasTablePermission(target, SecurityHelper.getTableName(state), tabPerm))) throw new AccumuloException(
- "Test framework and accumulo are out of sync for user " + conn.whoami() + " for perm " + tabPerm.name() + " with local vs. accumulo being "
- + hasPerm + " " + res);
+ if (hasPerm != (res = state.getConnector().securityOperations().hasTablePermission(target, SecurityHelper.getTableName(state), tabPerm)))
+ throw new AccumuloException("Test framework and accumulo are out of sync for user " + conn.whoami() + " for perm " + tabPerm.name()
+ + " with local vs. accumulo being " + hasPerm + " " + res);
- if (hasPerm) action = "take";
- else action = "give";
+ if (hasPerm)
+ action = "take";
+ else
+ action = "give";
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case USER_DOESNT_EXIST:
- if (exists) throw new AccumuloException("Framework and Accumulo are out of sync, we think user exists", ae);
- else return;
+ if (exists)
+ throw new AccumuloException("Framework and Accumulo are out of sync, we think user exists", ae);
+ else
+ return;
case TABLE_DOESNT_EXIST:
- if (tabExists) throw new AccumuloException(conn.whoami(), ae);
- else return;
+ if (tabExists)
+ throw new AccumuloException(conn.whoami(), ae);
+ else
+ return;
default:
throw ae;
}
@@ -101,15 +110,19 @@ public class AlterTablePerm extends Test
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case GRANT_INVALID:
- if (tabPerm.equals(SystemPermission.GRANT)) return;
+ if (tabPerm.equals(SystemPermission.GRANT))
+ return;
case PERMISSION_DENIED:
- if (canGive) throw new AccumuloException("Test user failed to give permission when it should have worked", ae);
+ if (canGive)
+ throw new AccumuloException("Test user failed to give permission when it should have worked", ae);
return;
case USER_DOESNT_EXIST:
- if (exists) throw new AccumuloException("Table user doesn't exist and they SHOULD.", ae);
+ if (exists)
+ throw new AccumuloException("Table user doesn't exist and they SHOULD.", ae);
return;
case TABLE_DOESNT_EXIST:
- if (tableExists) throw new AccumuloException("Table doesn't exist but it should", ae);
+ if (tableExists)
+ throw new AccumuloException("Table doesn't exist but it should", ae);
return;
default:
throw new AccumuloException("Got unexpected exception", ae);
@@ -122,16 +135,20 @@ public class AlterTablePerm extends Test
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case GRANT_INVALID:
- if (tabPerm.equals(SystemPermission.GRANT)) return;
+ if (tabPerm.equals(SystemPermission.GRANT))
+ return;
throw new AccumuloException("Got a grant invalid on non-System.GRANT option", ae);
case PERMISSION_DENIED:
- if (canGive) throw new AccumuloException("Test user failed to give permission when it should have worked", ae);
+ if (canGive)
+ throw new AccumuloException("Test user failed to give permission when it should have worked", ae);
return;
case USER_DOESNT_EXIST:
- if (exists) throw new AccumuloException("Table user doesn't exist and they SHOULD.", ae);
+ if (exists)
+ throw new AccumuloException("Table user doesn't exist and they SHOULD.", ae);
return;
case TABLE_DOESNT_EXIST:
- if (tableExists) throw new AccumuloException("Table doesn't exist but it should", ae);
+ if (tableExists)
+ throw new AccumuloException("Table doesn't exist but it should", ae);
return;
default:
throw new AccumuloException("Got unexpected exception", ae);
@@ -140,9 +157,12 @@ public class AlterTablePerm extends Test
SecurityHelper.setTabPerm(state, target, tabPerm, true);
}
- if (!exists) throw new AccumuloException("User shouldn't have existed, but apparantly does");
- if (!tableExists) throw new AccumuloException("Table shouldn't have existed, but apparantly does");
- if (!canGive) throw new AccumuloException("Source user shouldn't have been able to grant privilege");
+ if (!exists)
+ throw new AccumuloException("User shouldn't have existed, but apparantly does");
+ if (!tableExists)
+ throw new AccumuloException("Table shouldn't have existed, but apparantly does");
+ if (!canGive)
+ throw new AccumuloException("Source user shouldn't have been able to grant privilege");
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Authenticate.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Authenticate.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Authenticate.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Authenticate.java Thu Oct 27 15:24:51 2011
@@ -47,15 +47,17 @@ public class Authenticate extends Test {
exists = SecurityHelper.getTabUserExists(state);
target = SecurityHelper.getTabUserName(state);
if (!conn.whoami().equals(state.getConnector().whoami())
- && !SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.SYSTEM)) hasPermission = false;
+ && !SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.SYSTEM))
+ hasPermission = false;
password = Arrays.copyOf(SecurityHelper.getTabUserPass(state), SecurityHelper.getTabUserPass(state).length);
} else {
target = SecurityHelper.getSysUserName(state);
password = Arrays.copyOf(SecurityHelper.getSysUserPass(state), SecurityHelper.getSysUserPass(state).length);
}
- if (!success) for (int i = 0; i < password.length; i++)
- password[i]++;
+ if (!success)
+ for (int i = 0; i < password.length; i++)
+ password[i]++;
boolean result;
@@ -64,13 +66,17 @@ public class Authenticate extends Test {
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case PERMISSION_DENIED:
- if (exists && hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
- else return;
+ if (exists && hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ else
+ return;
default:
throw new AccumuloException("Unexpected exception!", ae);
}
}
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
- if (result != (success && exists)) throw new AccumuloException("Got " + result + " as the result when it should be " + success);
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (result != (success && exists))
+ throw new AccumuloException("Got " + result + " as the result when it should be " + success);
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/ChangePass.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/ChangePass.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/ChangePass.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/ChangePass.java Thu Oct 27 15:24:51 2011
@@ -47,23 +47,28 @@ public class ChangePass extends Test {
conn = state.getInstance().getConnector(sourceUser, (SecurityHelper.getTabUserPass(state)));
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.BAD_CREDENTIALS)) {
- if (SecurityHelper.getTabUserExists(state)) throw new AccumuloException("Got a security exception when the user should have existed", ae);
- else return;
+ if (SecurityHelper.getTabUserExists(state))
+ throw new AccumuloException("Got a security exception when the user should have existed", ae);
+ else
+ return;
}
throw new AccumuloException("Unexpected exception!", ae);
}
}
boolean hasPerm = true;
- if (!source.equals(target)) hasPerm = SecurityHelper.getSysPerm(state, sourceUser, SystemPermission.ALTER_USER);
+ if (!source.equals(target))
+ hasPerm = SecurityHelper.getSysPerm(state, sourceUser, SystemPermission.ALTER_USER);
boolean targetExists = true;
boolean targetSystem = true;
if (target.equals("table")) {
targetSystem = false;
- if (!SecurityHelper.getTabUserExists(state)) targetExists = false;
+ if (!SecurityHelper.getTabUserExists(state))
+ targetExists = false;
target = SecurityHelper.getTabUserName(state);
- } else target = SecurityHelper.getSysUserName(state);
+ } else
+ target = SecurityHelper.getSysUserName(state);
Random r = new Random();
@@ -77,10 +82,12 @@ public class ChangePass extends Test {
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case PERMISSION_DENIED:
- if (hasPerm) throw new AccumuloException("Change failed when it should have succeeded to change " + target + "'s password", ae);
+ if (hasPerm)
+ throw new AccumuloException("Change failed when it should have succeeded to change " + target + "'s password", ae);
return;
case USER_DOESNT_EXIST:
- if (targetExists) throw new AccumuloException("User " + target + " doesn't exist and they SHOULD.", ae);
+ if (targetExists)
+ throw new AccumuloException("User " + target + " doesn't exist and they SHOULD.", ae);
return;
default:
throw new AccumuloException("Got unexpected exception", ae);
@@ -88,7 +95,9 @@ public class ChangePass extends Test {
}
if (targetSystem) {
SecurityHelper.setSysUserPass(state, newPass);
- } else SecurityHelper.setTabUserPass(state, newPass);
- if (!hasPerm) throw new AccumuloException("Password change succeeded when it should have failed.");
+ } else
+ SecurityHelper.setTabUserPass(state, newPass);
+ if (!hasPerm)
+ throw new AccumuloException("Password change succeeded when it should have failed.");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateTable.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateTable.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateTable.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateTable.java Thu Oct 27 15:24:51 2011
@@ -38,13 +38,15 @@ public class CreateTable extends Test {
boolean exists = SecurityHelper.getTableExists(state);
boolean hasPermission = false;
- if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.CREATE_TABLE)) hasPermission = true;
+ if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.CREATE_TABLE))
+ hasPermission = true;
try {
conn.tableOperations().create(tableName);
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
- if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ if (hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
else
// create table anyway for sake of state
{
@@ -52,19 +54,25 @@ public class CreateTable extends Test {
state.getConnector().tableOperations().create(tableName);
SecurityHelper.setTableExists(state, true);
} catch (TableExistsException tee) {
- if (exists) return;
- else throw new AccumuloException("Test and Accumulo are out of sync");
+ if (exists)
+ return;
+ else
+ throw new AccumuloException("Test and Accumulo are out of sync");
}
return;
}
- } else throw new AccumuloException("Got unexpected error", ae);
+ } else
+ throw new AccumuloException("Got unexpected error", ae);
} catch (TableExistsException tee) {
- if (!exists) throw new TableExistsException(null, tableName, "Got a TableExistsException but it shouldn't have existed", tee);
- else return;
+ if (!exists)
+ throw new TableExistsException(null, tableName, "Got a TableExistsException but it shouldn't have existed", tee);
+ else
+ return;
}
SecurityHelper.setTableExists(state, true);
for (TablePermission tp : TablePermission.values())
SecurityHelper.setTabPerm(state, conn.whoami(), tp, true);
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java Thu Oct 27 15:24:51 2011
@@ -36,14 +36,16 @@ public class CreateUser extends Test {
boolean exists = SecurityHelper.getTabUserExists(state);
boolean hasPermission = false;
- if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.CREATE_USER)) hasPermission = true;
+ if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.CREATE_USER))
+ hasPermission = true;
byte[] tabUserPass = "Super Sekret Table User Password".getBytes();
try {
conn.securityOperations().createUser(tableUserName, tabUserPass, new Authorizations());
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case PERMISSION_DENIED:
- if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ if (hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
else
// create user anyway for sake of state
{
@@ -55,14 +57,17 @@ public class CreateUser extends Test {
return;
}
case USER_EXISTS:
- if (!exists) throw new AccumuloException("Got security exception when the user shouldn't have existed", ae);
- else return;
+ if (!exists)
+ throw new AccumuloException("Got security exception when the user shouldn't have existed", ae);
+ else
+ return;
default:
throw new AccumuloException("Got unexpected exception", ae);
}
}
SecurityHelper.setTabUserPass(state, tabUserPass);
SecurityHelper.setTabUserExists(state, true);
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropTable.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropTable.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropTable.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropTable.java Thu Oct 27 15:24:51 2011
@@ -52,13 +52,15 @@ public class DropTable extends Test {
boolean exists = SecurityHelper.getTableExists(state);
boolean hasPermission = false;
- if (SecurityHelper.getSysPerm(state, username, SystemPermission.DROP_TABLE) || SecurityHelper.getTabPerm(state, username, TablePermission.DROP_TABLE)) hasPermission = true;
+ if (SecurityHelper.getSysPerm(state, username, SystemPermission.DROP_TABLE) || SecurityHelper.getTabPerm(state, username, TablePermission.DROP_TABLE))
+ hasPermission = true;
try {
conn.tableOperations().delete(tableName);
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
- if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ if (hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
else {
// Drop anyway for sake of state
state.getConnector().tableOperations().delete(tableName);
@@ -71,13 +73,16 @@ public class DropTable extends Test {
}
throw new AccumuloException("Got unexpected ae error code", ae);
} catch (TableNotFoundException tnfe) {
- if (exists) throw new TableExistsException(null, tableName, "Got a TableNotFOundException but it should have existed", tnfe);
- else return;
+ if (exists)
+ throw new TableExistsException(null, tableName, "Got a TableNotFOundException but it should have existed", tnfe);
+ else
+ return;
}
SecurityHelper.setTableExists(state, false);
for (String user : new String[] {SecurityHelper.getSysUserName(state), SecurityHelper.getTabUserName(state)})
for (TablePermission tp : TablePermission.values())
SecurityHelper.setTabPerm(state, user, tp, false);
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropUser.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropUser.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropUser.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/DropUser.java Thu Oct 27 15:24:51 2011
@@ -36,13 +36,15 @@ public class DropUser extends Test {
boolean exists = SecurityHelper.getTabUserExists(state);
boolean hasPermission = false;
- if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.DROP_USER)) hasPermission = true;
+ if (SecurityHelper.getSysPerm(state, SecurityHelper.getSysUserName(state), SystemPermission.DROP_USER))
+ hasPermission = true;
try {
conn.securityOperations().dropUser(tableUserName);
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case PERMISSION_DENIED:
- if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ if (hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
else {
if (exists) {
state.getConnector().securityOperations().dropUser(tableUserName);
@@ -56,8 +58,10 @@ public class DropUser extends Test {
}
case USER_DOESNT_EXIST:
- if (exists) throw new AccumuloException("Got user DNE exception when user should exists.", ae);
- else return;
+ if (exists)
+ throw new AccumuloException("Got user DNE exception when user should exists.", ae);
+ else
+ return;
default:
throw new AccumuloException("Got unexpected exception", ae);
}
@@ -67,6 +71,7 @@ public class DropUser extends Test {
SecurityHelper.setTabPerm(state, tableUserName, tp, false);
for (SystemPermission sp : SystemPermission.values())
SecurityHelper.setSysPerm(state, tableUserName, sp, false);
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SetAuths.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SetAuths.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SetAuths.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SetAuths.java Thu Oct 27 15:24:51 2011
@@ -75,17 +75,22 @@ public class SetAuths extends Test {
} catch (AccumuloSecurityException ae) {
switch (ae.getErrorCode()) {
case PERMISSION_DENIED:
- if (hasPermission) throw new AccumuloException("Got a security exception when I should have had permission.", ae);
- else return;
+ if (hasPermission)
+ throw new AccumuloException("Got a security exception when I should have had permission.", ae);
+ else
+ return;
case USER_DOESNT_EXIST:
- if (exists) throw new AccumuloException("Got security exception when the user should have existed", ae);
- else return;
+ if (exists)
+ throw new AccumuloException("Got security exception when the user should have existed", ae);
+ else
+ return;
default:
throw new AccumuloException("Got unexpected exception", ae);
}
}
SecurityHelper.setUserAuths(state, target, auths);
- if (!hasPermission) throw new AccumuloException("Didn't get Security Exception when we should have");
+ if (!hasPermission)
+ throw new AccumuloException("Didn't get Security Exception when we should have");
}
}
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/TableOp.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/TableOp.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/TableOp.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/TableOp.java Thu Oct 27 15:24:51 2011
@@ -58,8 +58,10 @@ public class TableOp extends Test {
conn = state.getInstance().getConnector(SecurityHelper.getTabUserName(state), SecurityHelper.getTabUserPass(state));
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.BAD_CREDENTIALS)) {
- if (userExists) throw new AccumuloException("User didn't exist when they should (or worse- password mismatch)", ae);
- else return;
+ if (userExists)
+ throw new AccumuloException("User didn't exist when they should (or worse- password mismatch)", ae);
+ else
+ return;
}
throw new AccumuloException("Unexpected exception!", ae);
}
@@ -89,27 +91,36 @@ public class TableOp extends Test {
Entry<Key,Value> entry = iter.next();
Key k = entry.getKey();
seen++;
- if (!auths.contains(k.getColumnVisibilityData())) throw new AccumuloException("Got data I should not be capable of seeing");
+ if (!auths.contains(k.getColumnVisibilityData()))
+ throw new AccumuloException("Got data I should not be capable of seeing");
}
- if (!canRead) throw new AccumuloException("Was able to read when I shouldn't have had the perm with connection user " + conn.whoami());
+ if (!canRead)
+ throw new AccumuloException("Was able to read when I shouldn't have had the perm with connection user " + conn.whoami());
for (Entry<String,Integer> entry : SecurityHelper.getAuthsMap(state).entrySet()) {
- if (auths.contains(entry.getKey().getBytes())) seen = seen - entry.getValue();
+ if (auths.contains(entry.getKey().getBytes()))
+ seen = seen - entry.getValue();
}
- if (seen != 0) throw new AccumuloException("Got mismatched amounts of data");
+ if (seen != 0)
+ throw new AccumuloException("Got mismatched amounts of data");
} catch (TableNotFoundException tnfe) {
- if (tableExists) throw new AccumuloException("Accumulo and test suite out of sync", tnfe);
+ if (tableExists)
+ throw new AccumuloException("Accumulo and test suite out of sync", tnfe);
return;
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
- if (canRead) throw new AccumuloException("Table read permission out of sync with Accumulo", ae);
- else return;
+ if (canRead)
+ throw new AccumuloException("Table read permission out of sync with Accumulo", ae);
+ else
+ return;
}
throw new AccumuloException("Unexpected exception!", ae);
} catch (RuntimeException re) {
if (re.getCause() instanceof AccumuloSecurityException
&& ((AccumuloSecurityException) re.getCause()).getErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
- if (canRead) throw new AccumuloException("Table read permission out of sync with Accumulo", re.getCause());
- else return;
+ if (canRead)
+ throw new AccumuloException("Table read permission out of sync with Accumulo", re.getCause());
+ else
+ return;
}
throw new AccumuloException("Unexpected exception!", re);
}
@@ -125,7 +136,8 @@ public class TableOp extends Test {
try {
writer = conn.createBatchWriter(tableName, 9000l, 0l, 1);
} catch (TableNotFoundException tnfe) {
- if (tableExists) throw new AccumuloException("Table didn't exist when it should have");
+ if (tableExists)
+ throw new AccumuloException("Table didn't exist when it should have");
return;
}
boolean works = true;
@@ -134,8 +146,9 @@ public class TableOp extends Test {
} catch (MutationsRejectedException mre) {
throw new AccumuloException("Mutation exception!", mre);
}
- if (works) for (String s : SecurityHelper.getAuthsArray())
- SecurityHelper.increaseAuthMap(state, s, 1);
+ if (works)
+ for (String s : SecurityHelper.getAuthsArray())
+ SecurityHelper.increaseAuthMap(state, s, 1);
break;
case BULK_IMPORT:
key = SecurityHelper.getLastKey(state) + "1";
@@ -157,11 +170,13 @@ public class TableOp extends Test {
try {
conn.tableOperations().importDirectory(tableName, dir.toString(), fail.toString(), true);
} catch (TableNotFoundException tnfe) {
- if (tableExists) throw new AccumuloException("Table didn't exist when it should have");
+ if (tableExists)
+ throw new AccumuloException("Table didn't exist when it should have");
return;
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
- if (hasPerm) throw new AccumuloException("Bulk Import failed when it should have worked.");
+ if (hasPerm)
+ throw new AccumuloException("Bulk Import failed when it should have worked.");
return;
}
throw new AccumuloException("Unexpected exception!", ae);
@@ -169,7 +184,8 @@ public class TableOp extends Test {
for (String s : SecurityHelper.getAuthsArray())
SecurityHelper.increaseAuthMap(state, s, 1);
- if (!hasPerm) throw new AccumuloException("Bulk Import succeeded when it should have failed.");
+ if (!hasPerm)
+ throw new AccumuloException("Bulk Import succeeded when it should have failed.");
break;
case ALTER_TABLE:
AlterTable.renameTable(conn, state, tableName, tableName + "plus", hasPerm, tableExists);
Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java (original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java Thu Oct 27 15:24:51 2011
@@ -41,11 +41,13 @@ public class Validate extends Test {
boolean tableExists = SecurityHelper.getTableExists(state);
boolean cloudTableExists = conn.tableOperations().list().contains(SecurityHelper.getTableName(state));
- if (tableExists != cloudTableExists) throw new AccumuloException("Table existance out of sync");
+ if (tableExists != cloudTableExists)
+ throw new AccumuloException("Table existance out of sync");
boolean tableUserExists = SecurityHelper.getTabUserExists(state);
boolean cloudTableUserExists = conn.securityOperations().listUsers().contains(SecurityHelper.getTabUserName(state));
- if (tableUserExists != cloudTableUserExists) throw new AccumuloException("Table User existance out of sync");
+ if (tableUserExists != cloudTableUserExists)
+ throw new AccumuloException("Table User existance out of sync");
Properties props = new Properties();
props.setProperty("target", "system");
@@ -63,12 +65,15 @@ public class Validate extends Test {
log.debug("Just checked to see if user " + user + " has system perm " + sp.name() + " with answer " + accuHasSp);
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
- if (tabUserExists) throw new AccumuloException("Got user DNE error when they should", ae);
- else continue;
- } else throw new AccumuloException("Unexpected exception!", ae);
+ if (tabUserExists)
+ throw new AccumuloException("Got user DNE error when they should", ae);
+ else
+ continue;
+ } else
+ throw new AccumuloException("Unexpected exception!", ae);
}
- if (hasSp != accuHasSp) throw new AccumuloException(user + " existance out of sync for system perm " + sp + " hasSp/CloudhasSP " + hasSp + " "
- + accuHasSp);
+ if (hasSp != accuHasSp)
+ throw new AccumuloException(user + " existance out of sync for system perm " + sp + " hasSp/CloudhasSP " + hasSp + " " + accuHasSp);
}
for (TablePermission tp : TablePermission.values()) {
@@ -79,15 +84,20 @@ public class Validate extends Test {
log.debug("Just checked to see if user " + user + " has table perm " + tp.name() + " with answer " + accuHasTp);
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
- if (tabUserExists) throw new AccumuloException("Got user DNE error when they should", ae);
- else continue;
+ if (tabUserExists)
+ throw new AccumuloException("Got user DNE error when they should", ae);
+ else
+ continue;
} else if (ae.getErrorCode().equals(SecurityErrorCode.TABLE_DOESNT_EXIST)) {
- if (tableExists) throw new AccumuloException("Got table DNE when it should", ae);
- else continue;
- } else throw new AccumuloException("Unexpected exception!", ae);
+ if (tableExists)
+ throw new AccumuloException("Got table DNE when it should", ae);
+ else
+ continue;
+ } else
+ throw new AccumuloException("Unexpected exception!", ae);
}
- if (hasTp != accuHasTp) throw new AccumuloException(user + " existance out of sync for table perm " + tp + " hasTp/CloudhasTP " + hasTp + " "
- + accuHasTp);
+ if (hasTp != accuHasTp)
+ throw new AccumuloException(user + " existance out of sync for table perm " + tp + " hasTp/CloudhasTP " + hasTp + " " + accuHasTp);
}
}
@@ -98,12 +108,15 @@ public class Validate extends Test {
accuAuths = conn.securityOperations().getUserAuthorizations(SecurityHelper.getTabUserName(state));
} catch (AccumuloSecurityException ae) {
if (ae.getErrorCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
- if (tabUserExists) throw new AccumuloException("Table user didn't exist when they should.", ae);
- else return;
+ if (tabUserExists)
+ throw new AccumuloException("Table user didn't exist when they should.", ae);
+ else
+ return;
}
throw new AccumuloException("Unexpected exception!", ae);
}
- if (!auths.equals(accuAuths)) throw new AccumuloException("Table User authorizations out of sync");
+ if (!auths.equals(accuAuths))
+ throw new AccumuloException("Table User authorizations out of sync");
}
}