示例#1
0
        private async Task CreateTableTest()
        {
            var table = _hbaseHelper.GetTableName <Student>();

            var cancel = new CancellationToken();

            var tables = await _client.getTableNamesAsync(cancel);

            if (tables.Select(t => t.ToObject <string>()).Contains(table))
            {
                return;
            }

            var colNames = _hbaseHelper.GetTableColumnNames <Student>();

            var columnFamilies = colNames
                                 .Select(t => new ColumnDescriptor {
                Name = t.ToBytes()
            })
                                 .ToList();

            await _client.createTableAsync(table.ToBytes(), columnFamilies, cancel);

            tables = await _client.getTableNamesAsync(cancel);

            Assert.Contains(tables, t => t.ToObject <string>() == table);
        }