コード例 #1
0
 public AdminController(IHelpArticleService helpArticleService, IHelpCategoryService helpCategoryService, IThumbnailSettingService thumbnailSettingService, IThriftClient thriftClient)
 {
     _helpArticleService      = helpArticleService;
     _helpCategoryService     = helpCategoryService;
     _thumbnailSettingService = thumbnailSettingService;
     _thriftClient            = thriftClient;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
            /// <summary>
            /// new
            /// </summary>
            /// <param name="client"></param>
            /// <exception cref="ArgumentNullException">client is null</exception>
            public Client(IThriftClient client)
            {
                if (client == null)
                    throw new ArgumentNullException("client");

                this.client_ = client;
            }
コード例 #4
0
            /// <summary>
            /// new
            /// </summary>
            /// <param name="client"></param>
            /// <exception cref="ArgumentNullException">client is null</exception>
            public Client(IThriftClient client)
            {
                if (client == null)
                {
                    throw new ArgumentNullException("client");
                }

                this.client_ = client;
            }
コード例 #5
0
 public void ReleaseClient(IThriftClient client)
 {
     if (_clients.Count <= (client.Configuration.MaxInstances ?? MAX_CONNECTIONS))
     {
         _clients.Push(client);
     }
     else
     {
         client.Cleanup();
         client = null;
     }
 }