BUG-2318 adding test and updating javadoc
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4e499f35 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4e499f35 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4e499f35 Branch: refs/heads/ACCUMULO-2061 Commit: 4e499f359e39088449a731c942d8ec18c4d19f32 Parents: b75dcc5 Author: John Vines <vi...@apache.org> Authored: Wed Mar 5 13:42:09 2014 -0500 Committer: John Vines <vi...@apache.org> Committed: Wed Mar 5 13:42:09 2014 -0500 ---------------------------------------------------------------------- .../core/client/admin/TableOperations.java | 2 +- .../org/apache/accumulo/test/NamespacesIT.java | 23 ++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/4e499f35/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java index 253aa52..823b0e9 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java @@ -344,7 +344,7 @@ public interface TableOperations { * @param oldTableName * the old table name * @param newTableName - * the new table name, which must be either unqualified (no namespace) or in the same namespace as the oldTableName + * the new table name, which must be in the same namespace as the oldTableName * @throws AccumuloException * if a general error occurs * @throws AccumuloSecurityException http://git-wip-us.apache.org/repos/asf/accumulo/blob/4e499f35/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java index 313b0ce..643e81a 100644 --- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java +++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java @@ -501,6 +501,7 @@ public class NamespacesIT extends SimpleMacIT { String t2 = namespace2 + ".2"; String t3 = namespace + ".3"; String t4 = namespace + ".4"; + String t5 = "5"; c.namespaceOperations().create(namespace); c.namespaceOperations().create(namespace2); @@ -511,6 +512,7 @@ public class NamespacesIT extends SimpleMacIT { assertFalse(c.tableOperations().exists(t2)); assertFalse(c.tableOperations().exists(t3)); assertFalse(c.tableOperations().exists(t4)); + assertFalse(c.tableOperations().exists(t5)); c.tableOperations().create(t1); @@ -522,18 +524,31 @@ public class NamespacesIT extends SimpleMacIT { assertEquals(ThriftTableOperationException.class.getName(), e.getCause().getClass().getName()); assertEquals(TableOperation.RENAME, ((ThriftTableOperationException) e.getCause()).getOp()); assertEquals(TableOperationExceptionType.INVALID_NAME, ((ThriftTableOperationException) e.getCause()).getType()); - assertTrue(c.tableOperations().exists(t1)); - assertFalse(c.tableOperations().exists(t2)); - assertFalse(c.tableOperations().exists(t3)); - assertFalse(c.tableOperations().exists(t4)); } + try { + c.tableOperations().rename(t1, t5); + fail(); + } catch (AccumuloException e) { + // this is expected, because we don't allow renames across namespaces + assertEquals(ThriftTableOperationException.class.getName(), e.getCause().getClass().getName()); + assertEquals(TableOperation.RENAME, ((ThriftTableOperationException) e.getCause()).getOp()); + assertEquals(TableOperationExceptionType.INVALID_NAME, ((ThriftTableOperationException) e.getCause()).getType()); + } + + assertTrue(c.tableOperations().exists(t1)); + assertFalse(c.tableOperations().exists(t2)); + assertFalse(c.tableOperations().exists(t3)); + assertFalse(c.tableOperations().exists(t4)); + assertFalse(c.tableOperations().exists(t5)); + // fully qualified rename c.tableOperations().rename(t1, t3); assertFalse(c.tableOperations().exists(t1)); assertFalse(c.tableOperations().exists(t2)); assertTrue(c.tableOperations().exists(t3)); assertFalse(c.tableOperations().exists(t4)); + assertFalse(c.tableOperations().exists(t5)); } /**