ACCUMULO-802 added test to make sure tables that are moved to a new namespace change their parent properties, currently fails
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/88cbefbb Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/88cbefbb Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/88cbefbb Branch: refs/heads/ACCUMULO-802 Commit: 88cbefbb0e61e7ea72dec7905beb0d9db440d2a5 Parents: dabf6b4 Author: Sean Hickey <[email protected]> Authored: Tue Aug 6 15:07:35 2013 -0400 Committer: Christopher Tubbs <[email protected]> Committed: Thu Oct 31 21:30:39 2013 -0400 ---------------------------------------------------------------------- .../apache/accumulo/test/TableNamespacesIT.java | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/88cbefbb/test/src/test/java/org/apache/accumulo/test/TableNamespacesIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/TableNamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/TableNamespacesIT.java index c52b844..7ee186e 100644 --- a/test/src/test/java/org/apache/accumulo/test/TableNamespacesIT.java +++ b/test/src/test/java/org/apache/accumulo/test/TableNamespacesIT.java @@ -409,6 +409,45 @@ public class TableNamespacesIT { c.tableNamespaceOperations().removeConstraint(namespace, num); } + /** + * Tests that when a table moves to a new namespace that it's properties inherit from the new namespace and not the old one + */ + @Test + public void testRenameToNewNamespaceProperties() throws Exception { + Connector c = accumulo.getConnector("root", secret); + + String namespace1 = "moveToNewNamespace1"; + String namespace2 = "moveToNewNamespace2"; + String tableName1 = namespace1 + ".table"; + String tableName2 = namespace2 + ".table"; + + String propKey = Property.TABLE_FILE_MAX.getKey(); + String propVal = "42"; + + c.tableNamespaceOperations().create(namespace1); + c.tableNamespaceOperations().create(namespace2); + c.tableOperations().create(tableName1); + + c.tableNamespaceOperations().setProperty(namespace1, propKey, propVal); + boolean hasProp = false; + for (Entry<String,String> p : c.tableOperations().getProperties(tableName1)) { + if (p.getKey().equals(propKey) && p.getValue().equals(propVal)) { + hasProp = true; + } + } + assertTrue(hasProp); + + c.tableOperations().rename(tableName1, tableName2); + + hasProp = false; + for (Entry<String,String> p : c.tableOperations().getProperties(tableName2)) { + if (p.getKey().equals(propKey) && p.getValue().equals(propVal)) { + hasProp = true; + } + } + assertTrue(!hasProp); + } + private boolean checkTableHasProp(Connector c, String t, String propKey, String propVal) throws AccumuloException, TableNotFoundException { for (Entry<String,String> e : c.tableOperations().getProperties(t)) { if (e.getKey().equals(propKey) && e.getValue().equals(propVal)) {
