protected override void Context() { if (!_arrangementCompleted) { // at present, no tables are modified so only arrange the tables once per test pass // and putting the arrangement into a static context. // (this knocked test runs down to ~30 seconds from ~5 minutes). _credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt"); var client = new HBaseClient(_credentials); // ensure tables from previous tests are cleaned up TableList tables = client.ListTables(); foreach (string name in tables.name) { string pinnedName = name; if (name.StartsWith(TableNamePrefix, StringComparison.Ordinal)) { client.DeleteTable(pinnedName); } } AddTable(); PopulateTable(); _arrangementCompleted = true; } }
protected override void Context() { _credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt"); var client = new HBaseClient(_credentials); // ensure tables from previous tests are cleaned up TableList tables = client.ListTables(); foreach (string name in tables.name) { if (name.StartsWith(TestTablePrefix, StringComparison.Ordinal)) { client.DeleteTable(name); } } // add a table specific to this test _testTableName = TestTablePrefix + _random.Next(10000); _testTableSchema = new TableSchema(); _testTableSchema.name = _testTableName; _testTableSchema.columns.Add(new ColumnSchema { name = "d" }); client.CreateTable(_testTableSchema); }
private HBaseClient GetClient() { _credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt"); var options = RequestOptions.GetDefaultOptions(); options.RetryPolicy = RetryPolicy.NoRetry; var client = new HBaseClient(_credentials, options); #region VNet //options.TimeoutMillis = 30000; //options.KeepAlive = false; //options.Port = 8090; //options.AlternativeEndpoint = "/"; //var client = new HBaseClient(null, options, new LoadBalancerRoundRobin(new List<string> { "ip address" })); #endregion return(client); }
public void It_should_throw_the_file_does_not_exist() { string path = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString()); var fnfe = (FileNotFoundException) typeof(FileNotFoundException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromFile(path))); fnfe.FileName.ShouldEqual(path); }
public void It_should_throw_when_the_path_is_null() { var ane = (ArgumentNullException) typeof(ArgumentNullException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromFile(null))); ane.ParamName.ShouldEqual("path"); }