public void RenameIndexedTable() { DropTables(this.regex); Assert.IsFalse(Ns.TableExists("test-1")); Assert.IsFalse(Ns.TableExists("test-2")); Assert.IsFalse(Ns.TableExists("Test-2")); const string Schema = "<Schema><AccessGroup name=\"default\">" + "<ColumnFamily><Name>a</Name><Index>true</Index><QualifierIndex>true</QualifierIndex></ColumnFamily>" + "</AccessGroup></Schema>"; Ns.CreateTable("test-1", Schema, CreateDispositions.CreateIfNotExist); Assert.IsTrue(Ns.TableExists("test-1")); if (IsHyper || IsThrift) { Assert.IsTrue(Ns.TableExists("^test-1")); Assert.IsTrue(Ns.TableExists("^^test-1")); } using (var table = Ns.OpenTable("test-1")) { Assert.AreEqual(table.Name, Ns.Name + "/test-1"); } Ns.RenameTable("test-1", "test-2"); Assert.IsFalse(Ns.TableExists("test-1")); Assert.IsTrue(Ns.TableExists("test-2")); if (IsHyper || IsThrift) { Assert.IsFalse(Ns.TableExists("^test-1")); Assert.IsFalse(Ns.TableExists("^^test-1")); Assert.IsTrue(Ns.TableExists("^test-2")); Assert.IsTrue(Ns.TableExists("^^test-2")); } Ns.RenameTable("test-2", "Test-2"); Assert.IsFalse(Ns.TableExists("test-2")); using (var table = Ns.OpenTable("Test-2")) { Assert.AreEqual(table.Name, Ns.Name + "/Test-2"); } Assert.IsTrue(Ns.TableExists("Test-2")); if (IsHyper || IsThrift) { Assert.IsFalse(Ns.TableExists("^test-2")); Assert.IsFalse(Ns.TableExists("^^test-2")); Assert.IsTrue(Ns.TableExists("^Test-2")); Assert.IsTrue(Ns.TableExists("^^Test-2")); } }
public void RenameTable() { DropTables(this.regex); DropNamespaces(this.regex); Assert.IsFalse(Ns.TableExists("test-1")); Assert.IsFalse(Ns.TableExists("test-2")); Assert.IsFalse(Ns.TableExists("Test-2")); const string Schema = "<Schema><AccessGroup name=\"default\">" + "<ColumnFamily><Name>a</Name></ColumnFamily>" + "</AccessGroup></Schema>"; Ns.CreateTable("test-1", Schema, CreateDispositions.CreateIfNotExist); Assert.IsTrue(Ns.TableExists("test-1")); using (var table = Ns.OpenTable("test-1")) { Assert.AreEqual(table.Name, Ns.Name + "/test-1"); } Ns.RenameTable("test-1", "test-2"); Assert.IsFalse(Ns.TableExists("test-1")); Assert.IsTrue(Ns.TableExists("test-2")); Ns.RenameTable("test-2", "Test-2"); Assert.IsFalse(Ns.TableExists("test-2")); using (var table = Ns.OpenTable("Test-2")) { Assert.AreEqual(table.Name, Ns.Name + "/Test-2"); } Assert.IsTrue(Ns.TableExists("Test-2")); try { Ns.RenameTable("test-11", "test-111"); Assert.Fail(); } catch (TableNotFoundException) { } catch { Assert.Fail(); } try { Ns.CreateNamespace("test-22"); Ns.RenameTable("test-22", "test-222"); Assert.Fail(); } catch (TableNotFoundException) { } /*catch * { * Assert.Fail(); * }*/ try { Ns.RenameTable("Test-2", "test-22"); Assert.Fail(); } catch (NameAlreadyInUseException) { } catch { Assert.Fail(); } }