public void When_I_Scan_with_a_SingleColumnValueFilter_and_a_NullComparator_with_the_operator_not_equal_I_get_the_expected_results() { var expectedRecords = new List<FilterTestRecord>(); var client = new HBaseClient(_credentials); var scanner = new Scanner(); var comparer = new NullComparator(); var filter = new SingleColumnValueFilter( Encoding.UTF8.GetBytes(ColumnFamilyName1), Encoding.UTF8.GetBytes(LineNumberColumnName), CompareFilter.CompareOp.Equal, comparer); scanner.filter = filter.ToEncodedString(); RequestOptions scanOptions = RequestOptions.GetDefaultOptions(); scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero; ScannerInformation scanInfo = null; try { scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result; List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList(); actualRecords.ShouldContainOnly(expectedRecords); } finally { if (scanInfo != null) { client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait(); } } }
public void When_I_Scan_with_a_SingleColumnValueFilter_and_a_NullComparator_with_the_operator_not_equal_I_get_the_expected_results() { var expectedRecords = new List<FilterTestRecord>(); var client = new HBaseClient(_credentials); var scanner = new Scanner(); var comparer = new NullComparator(); var filter = new SingleColumnValueFilter( Encoding.UTF8.GetBytes(ColumnFamilyName1), Encoding.UTF8.GetBytes(LineNumberColumnName), CompareFilter.CompareOp.Equal, comparer); scanner.filter = filter.ToEncodedString(); ScannerInformation scanInfo = client.CreateScanner(_tableName, scanner); List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo).ToList(); actualRecords.ShouldContainOnly(expectedRecords); }
public void When_I_Scan_with_a_SingleColumnValueFilter_and_a_SubstringComparator_with_the_operator_equal_I_get_the_expected_results() { // grab a substring that is guaranteed to match at least one record. string ss = _allExpectedRecords.First().A.Substring(1, 2); //Debug.WriteLine("The substring value is: " + ss); List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.A.Contains(ss) select r).ToList(); var client = new HBaseClient(_credentials); var scanner = new Scanner(); var comparer = new SubstringComparator(ss); var filter = new SingleColumnValueFilter( Encoding.UTF8.GetBytes(ColumnFamilyName1), Encoding.UTF8.GetBytes(ColumnNameA), CompareFilter.CompareOp.Equal, comparer); scanner.filter = filter.ToEncodedString(); RequestOptions scanOptions = RequestOptions.GetDefaultOptions(); scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero; ScannerInformation scanInfo = null; try { scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result; List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList(); actualRecords.ShouldContainOnly(expectedRecords); } finally { if (scanInfo != null) { client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait(); } } }
When_I_Scan_with_a_SingleColumnValueFilter_and_a_BitComparator_with_the_operator_equal_and_the_bitop_XOR_I_get_the_expected_results() { List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.LineNumber != 3 select r).ToList(); var client = new HBaseClient(_credentials); var scanner = new Scanner(); var comparer = new BitComparator(BitConverter.GetBytes(3), BitComparator.BitwiseOp.Xor); var filter = new SingleColumnValueFilter( Encoding.UTF8.GetBytes(ColumnFamilyName1), Encoding.UTF8.GetBytes(LineNumberColumnName), CompareFilter.CompareOp.Equal, comparer); scanner.filter = filter.ToEncodedString(); ScannerInformation scanInfo = client.CreateScanner(_tableName, scanner); List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo).ToList(); actualRecords.ShouldContainOnly(expectedRecords); }