public void When_I_Scan_with_a_SingleColumnValueExcludeFilter_and_a_BinaryComparator_with_the_operator_equal_I_get_the_expected_results()
        {
            string bValue = (from r in _allExpectedRecords select r.B).First();

            // B column should not be returned, so set the value to null.
            List <FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.B == bValue select r.WithBValue(null)).ToList();

            var client  = new HBaseClient(_credentials);
            var scanner = new Scanner();

            var filter = new SingleColumnValueExcludeFilter(
                Encoding.UTF8.GetBytes(ColumnFamilyName2),
                Encoding.UTF8.GetBytes(ColumnNameB),
                CompareFilter.CompareOp.Equal,
                Encoding.UTF8.GetBytes(bValue));

            scanner.filter = filter.ToEncodedString();

            ScannerInformation      scanInfo      = client.CreateScanner(_tableName, scanner);
            List <FilterTestRecord> actualRecords = RetrieveResults(scanInfo).ToList();

            actualRecords.ShouldContainOnly(expectedRecords);
        }
示例#2
0
        public void When_I_Scan_with_a_SingleColumnValueExcludeFilter_and_a_BinaryComparator_with_the_operator_equal_I_get_the_expected_results()
        {
            var bValue = (from r in _allExpectedRecords select r.B).First();

            // B Column should not be returned, so set the value to null.
            var expectedRecords = (from r in _allExpectedRecords where r.B == bValue select r.WithBValue(null)).ToList();

            var client  = new HBaseClient(RequestOptionsFactory.GetDefaultOptions());
            var scanner = new Scanner();

            var filter = new SingleColumnValueExcludeFilter(
                Encoding.UTF8.GetBytes(ColumnFamilyName2),
                Encoding.UTF8.GetBytes(ColumnNameB),
                CompareFilter.CompareOp.Equal,
                Encoding.UTF8.GetBytes(bValue));

            scanner.Filter = filter.ToEncodedString();


            ScannerInformation scanInfo = null;

            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner).Result;
                var actualRecords = RetrieveResults(scanInfo).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo).Wait();
                }
            }
        }