示例#1
0
        public void When_I_Scan_with_a_ColumnPrefixFilter_I_get_the_expected_results()
        {
            var expectedRecords = (from r in _allExpectedRecords select r.WithAValue(null).WithBValue(null)).ToList();

            var client  = new HBaseClient(RequestOptionsFactory.GetDefaultOptions());
            var scanner = new Scanner();
            var filter  = new ColumnPrefixFilter(Encoding.UTF8.GetBytes(LineNumberColumnName));

            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();
                }
            }
        }
示例#2
0
        public void ColumnPrefixFilter_ValueSet_Builds_OK()
        {
            var filter = new ColumnPrefixFilter <MockDomainObject>(_map);

            filter.ColumnName(Maps.MockDomainObject.NameColumn);

            var expected   = $"ColumnPrefixFilter ('{Maps.MockDomainObject.NameColumn}')";
            var validation = filter.ToFilterBuild();

            Assert.Equal(expected, validation.Build());
        }
        public void When_I_Scan_with_a_ColumnPrefixFilter_I_get_the_expected_results()
        {
            List <FilterTestRecord> expectedRecords = (from r in _allExpectedRecords select r.WithAValue(null).WithBValue(null)).ToList();

            var client  = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter  = new ColumnPrefixFilter(Encoding.UTF8.GetBytes(LineNumberColumnName));

            scanner.filter = filter.ToEncodedString();

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

            actualRecords.ShouldContainOnly(expectedRecords);
        }
示例#4
0
        public void ColumnPrefixFilter_MapNull_RaisesException()
        {
            var filter = new ColumnPrefixFilter <MockDomainObject>(null);

            Assert.Throws <MappingException>(() => filter.ColumnName(x => x.Address.Number));
        }
示例#5
0
        public void ColumnPrefixFilter_ValueNotSet_ValidationFails()
        {
            var filter = new ColumnPrefixFilter <MockDomainObject>(_map);

            Assert.Throws <FilterException>(() => filter.ToFilterBuild().Validate());
        }