public void DropIndexedTable() { DropTables(this.regex); Assert.IsFalse(Ns.TableExists("test")); const string Schema = "<Schema><AccessGroup name=\"default\">" + "<ColumnFamily><Name>a</Name><Index>true</Index><QualifierIndex>true</QualifierIndex></ColumnFamily>" + "</AccessGroup></Schema>"; Ns.CreateTable("test", Schema, CreateDispositions.CreateIfNotExist); Assert.IsTrue(Ns.TableExists("test")); if (IsHyper || IsThrift) { Assert.IsTrue(Ns.TableExists("^test")); Assert.IsTrue(Ns.TableExists("^^test")); } Ns.DropTable("test"); if (IsHyper || IsThrift) { Assert.IsFalse(Ns.TableExists("^test")); Assert.IsFalse(Ns.TableExists("^^test")); } }
public void ScanMultipleTableAsync() { if (!HasAsyncTableScanner) { return; } const int CountTables = 10; var tables = new List <ITable>(); try { for (var t = 0; t < CountTables; ++t) { var testTable = EnsureTable(string.Format("ScanMultipleTableAsync-{0}", t), Schema); InitializeTableData(testTable); tables.Add(testTable); } var c = 0; using (var asyncResult = new AsyncResult( (ctx, cells) => { foreach (var cell in cells) { Assert.IsFalse(string.IsNullOrEmpty(cell.Key.Row)); Interlocked.Increment(ref c); } return(AsyncCallbackResult.Continue); })) { tables.ForEach(t => t.BeginScan(asyncResult, new ScanSpec().AddColumn("a"))); tables.ForEach(t => t.BeginScan(asyncResult, new ScanSpec().AddColumn("b"))); asyncResult.Join(); Assert.IsNull(asyncResult.Error, asyncResult.Error != null ? asyncResult.Error.ToString() : string.Empty); Assert.IsTrue(asyncResult.IsCompleted); } Assert.AreEqual(CountTables * (CountA + CountB), c); c = 0; using (var asyncResult = new AsyncResult()) { tables.ForEach( t => t.BeginScan( asyncResult, new ScanSpec().AddColumn("b"), (ctx, cells) => { foreach (var cell in cells) { Assert.IsFalse(string.IsNullOrEmpty(cell.Key.Row)); Interlocked.Increment(ref c); } return(AsyncCallbackResult.Continue); })); tables.ForEach( t => t.BeginScan( asyncResult, new ScanSpec().AddColumn("c"), (ctx, cells) => { foreach (var cell in cells) { Assert.IsFalse(string.IsNullOrEmpty(cell.Key.Row)); Interlocked.Increment(ref c); } return(AsyncCallbackResult.Continue); })); asyncResult.Join(); Assert.IsNull(asyncResult.Error, asyncResult.Error != null ? asyncResult.Error.ToString() : string.Empty); Assert.IsTrue(asyncResult.IsCompleted); } Assert.AreEqual(CountTables * (CountB + CountC), c); } finally { tables.ForEach(t => t.Dispose()); for (var t = 0; t < CountTables; ++t) { Ns.DropTable(string.Format("ScanMultipleTableAsync-{0}", t), DropDispositions.IfExists); } } }