public ScanCommandTest() { _config = A.Fake <IHBaseConfiguration>(); _pool = A.Fake <IConnectionPool>(); _thriftClient = A.Fake <IThriftClient>(); var configuration = new MockDomainObjectConfiguration(); _map = configuration.ExposeClassMap(); var pg = new ProxyGenerator(); _map.Generator = pg.ProduceGenerator <MockDomainObject>(); A.CallTo(() => _pool.GetClient()).Returns(_thriftClient); // A.CallTo(() => _pool.ReleaseClient(_thriftClient)).MustHaveHappened(); //A.CallTo(() => // _thriftClient.scannerOpenWithScan(Maps.MockDomainObject.TableName.GetBytes(), A.Dummy<TScan>(), // new Dictionary<byte[], byte[]>())).Returns(1); var results = new List <TRowResult>() { BuildRow("test", 21, "some street", 1), BuildRow("Foo", 21, "some street", 1), }; A.CallTo(() => _thriftClient.scannerGetList(A.Dummy <int>(), A.Dummy <int>())).ReturnsLazily(() => results); A.CallTo(_thriftClient).WithReturnType <List <TRowResult> >().Returns(results); }
internal ScanCommand(IHBaseConfiguration configuration, IConnectionPool pool, ClassMap map) { _tableName = $"{map.GetNamespace()}{configuration.ThriftTablePrefix}{map.TableName}".GetBytes(); _map = map; _pool = pool; }
internal HBaseSession(IHBaseConfiguration configuration, IHbaseSessionFactoryContext context) { _hbaseConfiguration = configuration; SessionId = Guid.NewGuid().ToString("N"); _context = context; _container = context.Container; }
internal DeleteCommand(IHBaseConfiguration configuration, IConnectionPool pool, ClassMap classMap) { _map = classMap; _pool = pool; _tableName = $"{classMap.GetNamespace()}{configuration.ThriftTablePrefix}{classMap.TableName}".GetBytes(); }
internal GetCommand(IHBaseConfiguration configuration, IConnectionPool pool, ClassMap classMap) { _tableName = $"{classMap.GetNamespace()}{configuration.ThriftTablePrefix}{classMap.TableName}".GetBytes(); _columns = new List <string>(); _rows = new List <string>(); _map = classMap; _pool = pool; }
internal PutCommand(IHBaseConfiguration configuration, IConnectionPool pool, ClassMap classMap) { _tableName = $"{classMap.GetNamespace()}{configuration.ThriftTablePrefix}{classMap.TableName}".GetBytes(); _map = classMap; _entities = new List <TEntity>(); _descriptors = new List <string>(); _pool = pool; }
private void ValidateConfiguration(IHBaseConfiguration config) { if (config == null) { throw new SessionFactoryConfigurationException("Invalid configuration"); } if (!(config is IConfigurationValidation validation)) { throw new SessionFactoryConfigurationException( "Configuration object needs to be cast to IConfigurationValidation"); } validation.Validate(); }
internal ThriftClient(IHBaseConfiguration configuration) { Configuration = configuration; _thriftSocket = new TSocket(Configuration.ThriftHost, Configuration.ThriftPort); _thriftTransport = new TBufferedTransport(_thriftSocket); _thriftProtocol = new TBinaryProtocol(_thriftTransport); var thriftClient = new Hbase.Client(_thriftProtocol); _thriftTransport.Open(); _connection = thriftClient; _timestamp = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds + (Configuration.ThriftTimeout ?? DEFAULT_TIMEOUT); }
public IHBaseSessionFactory Configure(IHBaseConfiguration configuration) { _configuration = configuration; return(this); }